:root {
    --bg: #f4f7fb;
    --bg-accent: #eef3ff;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #18212f;
    --muted: #66758a;
    --border: #dbe3ee;
    --primary: #2952cc;
    --primary-hover: #1f43af;
    --success: #1f7a52;
    --danger: #c0392b;
    --shadow-sm: 0 2px 10px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 10px 30px rgba(16, 24, 40, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, #f8fbff 0, #f4f7fb 40%, #f4f7fb 100%);
}

.container {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(219, 227, 238, 0.9);
}

.bar-wrap {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #4f7cff);
    color: #fff;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.86rem;
    color: var(--muted);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-chip {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.92rem;
}

.top-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 16px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    transition: 0.2s ease;
}

    .top-link:hover {
        border-color: #c7d3e3;
        background: var(--surface-2);
    }

.page-body {
    padding: 28px 0 40px;
}

.page-header {
    margin-bottom: 22px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 2rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.surface-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.section-card {
    padding: 22px;
    margin-bottom: 20px;
}

.auth-shell {
    min-height: calc(100vh - 71px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-wrap {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    padding: 21px;
}

.auth-side {
    padding: 21px;
    background: linear-gradient(160deg, #2449ba, #3b63df 55%, #6a8dff 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 560px;
}

    .auth-side h1 {
        margin: 0 0 14px;
        font-size: 2.3rem;
        line-height: 1.08;
        letter-spacing: -0.03em;
    }

    .auth-side p {
        margin: 0;
        max-width: 42ch;
        color: rgba(255,255,255,0.88);
        line-height: 1.7;
    }

.auth-points {
    display: grid;
    gap: 14px;
    margin-top: 28px;
}

.auth-point {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.14);
}

.auth-form-panel {
    padding: 48px;
    display: flex;
    align-items: center;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.auth-eyebrow {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.auth-card h2 {
    margin: 0;
    font-size: 1.9rem;
    letter-spacing: -0.02em;
}

.auth-card .subtext {
    margin: 10px 0 28px;
    color: var(--muted);
    line-height: 1.65;
}

.form-grid {
    display: grid;
    gap: 18px;
}

.field label {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.94rem;
    font-weight: 600;
    color: #243041;
}

.field input,
.field select {
    width: 100%;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 14px;
    background: #fff;
    color: var(--text);
    font-size: 0.96rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

    .field input:focus,
    .field select:focus {
        border-color: rgba(41, 82, 204, 0.6);
        box-shadow: 0 0 0 4px rgba(41, 82, 204, 0.12);
    }

.btn,
button {
    border: 0;
    cursor: pointer;
    transition: 0.2s ease;
    font: inherit;
}

    .btn-primary,
    button[type="submit"] {
        height: 48px;
        width: 100%;
        border-radius: 12px;
        background: linear-gradient(135deg, var(--primary), #3d67e6);
        color: #fff;
        font-weight: 700;
        box-shadow: 0 10px 24px rgba(41, 82, 204, 0.22);
    }

        .btn-primary:hover,
        button[type="submit"]:hover {
            background: linear-gradient(135deg, var(--primary-hover), #3257c8);
        }

.error {
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff2f0;
    color: var(--danger);
    border: 1px solid #f3c9c1;
    font-size: 0.93rem;
}

.filters-bar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-form {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
}

    .filter-form .field {
        min-width: 190px;
    }

    .filter-form button {
        width: auto;
        min-width: 120px;
        padding: 0 20px;
    }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.stat-label {
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.section-title {
    margin: 0;
    font-size: 1.15rem;
}

.section-note {
    color: var(--muted);
    font-size: 0.92rem;
}

.table-card {
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 720px;
}

thead th {
    background: #f8fbff;
    color: #304055;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

tbody td,
tfoot th {
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.95rem;
}

tbody tr:hover td {
    background: #fbfdff;
}

td.num,
th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

tfoot th {
    background: #f4f8ff;
    color: #1f2c3d;
    font-weight: 700;
}

.branch-block {
    margin-bottom: 22px;
}

.muted {
    color: var(--muted);
}

@media (max-width: 1024px) {
    .auth-wrap {
        grid-template-columns: 1fr;
    }

    .auth-side {
        min-height: auto;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .container {
        width: min(100% - 20px, 1240px);
    }

    .auth-side,
    .auth-form-panel {
        padding: 28px;
    }

    .page-title {
        font-size: 1.6rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-form {
        width: 100%;
    }

        .filter-form .field,
        .filter-form button {
            width: 100%;
        }

    .top-actions {
        width: 100%;
        justify-content: space-between;
    }

    .branch-head {
        align-items: start;
        flex-direction: column;
    }
}
