@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('/fonts/PlusJakartaSans-Normal-CyrillicExt.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('/fonts/PlusJakartaSans-Normal-Vietnamese.woff2') format('woff2');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('/fonts/PlusJakartaSans-Normal-LatinExt.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('/fonts/PlusJakartaSans-Normal-Latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: italic;
    font-weight: 200 800;
    font-display: swap;
    src: url('/fonts/PlusJakartaSans-Italic-CyrillicExt.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: italic;
    font-weight: 200 800;
    font-display: swap;
    src: url('/fonts/PlusJakartaSans-Italic-Vietnamese.woff2') format('woff2');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: italic;
    font-weight: 200 800;
    font-display: swap;
    src: url('/fonts/PlusJakartaSans-Italic-LatinExt.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: italic;
    font-weight: 200 800;
    font-display: swap;
    src: url('/fonts/PlusJakartaSans-Italic-Latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
    --font-sans: 'Plus Jakarta Sans', 'Plus Jakarta Sans Fallback', system-ui, sans-serif;

    /* Brand palette */
    --color-brand-50:  #f3efff;
    --color-brand-100: #ebe3fe;
    --color-brand-200: #d8c9fc;
    --color-brand-500: #9e7cf7;
    --color-brand-600: #8a63f5;
    --color-brand-700: #7649f1;

    /* Neutral */
    --color-surface:      #f8f9fb;
    --color-surface-2:    #ffffff;
    --color-surface-3:    #eef1f4;
    --color-surface-4:    #dfe4ea;
    --color-border:       #dfe4ea;
    --color-border-hover: #c8d2dc;

    /* Text */
    --color-text-primary:   #384f63;
    --color-text-secondary: #5a7389;
    --color-text-muted:     #7b8da0;

    /* Semantic */
    --color-success: #22a55b;
    --color-warning: #f59e0b;
    --color-danger:  #ef4444;
    --color-info:    #3b82f6;
    --color-on-emphasis: #ffffff;
    --color-surface-muted: var(--color-surface-3);
    --color-brand-tint: rgba(158, 124, 247, 0.12);
    --color-brand-border: rgba(158, 124, 247, 0.30);
    --color-success-tint: rgba(34, 165, 91, 0.12);
    --color-success-border: rgba(34, 165, 91, 0.28);
    --color-warning-tint: #fffbeb;
    --color-warning-border: #fcd34d;
    --color-warning-foreground: #b45309;
    --color-danger-tint: rgba(239, 68, 68, 0.12);
    --color-danger-border: rgba(239, 68, 68, 0.30);
    --color-danger-foreground: #b42318;
    --color-info-tint: rgba(59, 130, 246, 0.12);
    --color-info-border: rgba(59, 130, 246, 0.28);
    --color-info-foreground: #1d4ed8;

    /* Motion */
    --transition-fast: 0.15s ease;
    --transition-medium: 0.2s ease;

    /* Spacing */
    --sidebar-width: 256px;
    --topbar-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-card: 8px;
    --radius-panel: 10px;
    --radius-pill: 999px;

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(56, 79, 99, 0.04), 0 4px 12px rgba(56, 79, 99, 0.045);
    --shadow-modal: 0 20px 50px rgba(56, 79, 99, 0.18);
    --shadow-glow: 0 0 18px rgba(158,124,247,0.2);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-brand-600); text-decoration: none; }
a:hover { color: var(--color-brand-700); }

h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: 0; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem;    font-weight: 600; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface-2);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    min-height: 88px;
}

.sidebar-logo-image {
    max-height: 56px;
    max-width: 180px;
    width: auto;
    object-fit: contain;
}

.sidebar-logo-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: 0;
}

.sidebar-logo-company {
    font-size: 11px;
    color: var(--color-text-secondary);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    padding: 12px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    color: var(--color-text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
    margin-bottom: 0;
    border-right: 4px solid transparent;
    min-height: 44px;
}

.nav-item:hover {
    background: rgba(158, 124, 247, 0.1);
    color: var(--color-text-primary);
}

.nav-item.active {
    background: #384f63;
    color: #ffffff;
    border-right-color: #9e7cf7;
}

.nav-item svg, .nav-item .nav-icon {
    width: 16px; height: 16px;
    opacity: 1;
    flex-shrink: 0;
}

.nav-item .nav-icon,
.nav-item .nav-icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-item .nav-icon-svg svg {
    width: 16px;
    height: 16px;
    display: block;
}

.nav-item.active svg, .nav-item.active .nav-icon { opacity: 1; }

.nav-item.nav-item-settings {
    border-right-color: transparent;
}

.nav-item.nav-item-settings.active {
    border-right-color: transparent;
}

.nav-item-button {
    width: 100%;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
}

.sidebar-footer {
    border-top: 1px solid var(--color-border);
    padding: 0;
}

.user-widget {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: white;
    flex-shrink: 0;
}

.user-widget-info { flex: 1; min-width: 0; }
.user-widget-name {
    font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-widget-role { font-size: 11px; color: var(--color-text-secondary); }

/* ---- Main area ---- */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 24px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-2);
    gap: 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.mobile-brand,
.mobile-account-trigger,
.mobile-bottom-nav,
.mobile-menu-overlay,
.mobile-account-menu {
    display: none;
}

.topbar-user {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.role-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 2px;
    padding-left: 12px;
    border-left: 1px solid var(--color-border);
}

.role-switch-btn {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.role-switch-btn:hover {
    background: var(--color-surface-3);
    border-color: var(--color-border-hover);
    color: var(--color-text-primary);
}

.role-switch-btn.active {
    background: #384f63;
    border-color: #384f63;
    color: #ffffff;
}

.icon-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface-2);
    color: var(--color-text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}
.icon-btn:hover:not(:disabled) {
    background: var(--color-surface-3);
    color: var(--color-text-primary);
    border-color: var(--color-border-hover);
}

.icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.icon-btn svg,
.refresh-icon,
.btn-icon,
.modal-close-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.refresh-icon,
.btn-icon,
.modal-close-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-size-action,
.icon-size-inline,
.icon-size-status,
.icon-size-identity {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-size-action,
.icon-size-inline {
    width: 16px;
    height: 16px;
}

.icon-size-status {
    width: 24px;
    height: 24px;
}

.icon-size-identity {
    width: 32px;
    height: 32px;
}

.icon-size-action svg,
.icon-size-inline svg,
.icon-size-status svg,
.icon-size-identity svg {
    width: 100%;
    height: 100%;
    display: block;
}

.refresh-icon-spinning {
    animation: refresh-spin 0.7s linear infinite;
}

@keyframes refresh-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .refresh-icon-spinning {
        animation: none;
    }
}

.topbar-bell-icon {
    color: var(--color-brand-500);
}

.badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--color-brand-500);
    color: white;
    font-size: 9px; font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: var(--radius-pill);
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background: var(--color-surface);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.interactive-card,
.card-clickable,
button.card,
a.card {
    cursor: pointer;
}

.interactive-card:hover,
.card-clickable:hover,
button.card:hover,
a.card:hover {
    border-color: var(--color-border-hover);
    box-shadow: 0 10px 24px rgba(56, 79, 99, 0.08);
}

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; }

.stat-card {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex; flex-direction: column; gap: 8px;
}
.stat-label { font-size: 12px; color: var(--color-text-secondary); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: 0; }
.stat-change { font-size: 12px; }
.stat-change.positive { color: var(--color-success); }
.stat-change.negative { color: var(--color-danger); }

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

table { width: 100%; border-collapse: collapse; }
thead { background: var(--color-surface-3); }
th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    white-space: nowrap;
}
td {
    padding: 12px 14px;
    border-top: 1px solid var(--color-border);
    font-size: 13.5px;
    vertical-align: middle;
}
tr:hover td { background: var(--color-surface-3); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    min-height: 36px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    line-height: 1.2;
    font-family: var(--font-sans);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
    white-space: nowrap;
    justify-content: center;
    text-decoration: none;
}
.btn-primary {
    background: var(--color-brand-500);
    color: white;
    border-color: var(--color-brand-500);
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-brand-600);
    box-shadow: var(--shadow-glow);
}
.btn-secondary {
    background: var(--color-surface-2);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}
.btn-secondary:hover:not(:disabled) {
    background: rgba(56, 79, 99, 0.08);
    border-color: var(--color-border-hover);
}
.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--color-surface-3); color: var(--color-text-primary); }
.btn-soft {
    background: rgba(158, 124, 247, 0.16);
    color: #6f58c9;
    border-color: rgba(158, 124, 247, 0.22);
}
.btn-soft:hover:not(:disabled) {
    background: rgba(158, 124, 247, 0.24);
    color: #5c46b8;
    border-color: rgba(158, 124, 247, 0.34);
}
.btn-warning {
    background: var(--color-warning-tint);
    color: var(--color-warning-foreground);
    border-color: var(--color-warning-border);
}
.btn-warning:hover:not(:disabled) {
    background: #fef3c7;
    border-color: #f59e0b;
}
.btn-success {
    background: var(--color-success);
    color: #ffffff;
    border-color: var(--color-success);
}
.btn-success:hover:not(:disabled) {
    background: #18884a;
    border-color: #18884a;
}
.btn-danger {
    background: var(--color-danger-tint);
    color: var(--color-danger);
    border-color: var(--color-danger-border);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.18); }
.btn-link {
    min-height: 0;
    padding: 0;
    background: transparent;
    border-color: transparent;
    color: var(--color-brand-600);
}
.btn-link:hover:not(:disabled) {
    color: var(--color-brand-700);
    text-decoration: underline;
}
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.btn-lg { min-height: 42px; padding: 10px 20px; font-size: 14px; }
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.nav-item:focus-visible,
.tab-btn:focus-visible {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 2px;
}

/* ============================================================
   BADGES / CHIPS
   ============================================================ */
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 11px; font-weight: 600;
}
.chip-success { background: var(--color-success-tint); color: var(--color-success); }
.chip-warning { background: var(--color-warning-tint); color: var(--color-warning-foreground); }
.chip-danger  { background: var(--color-danger-tint);  color: var(--color-danger); }
.chip-info    { background: var(--color-info-tint);  color: var(--color-info-foreground); }
.chip-brand   { background: var(--color-brand-tint); color: #384f63; }
.chip-muted   { background: var(--color-surface-3); color: var(--color-text-secondary); }

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 22px;
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.status-chip-success { background: var(--color-success-tint); border-color: var(--color-success-border); color: var(--color-success); }
.status-chip-warning { background: var(--color-warning-tint); border-color: var(--color-warning-border); color: var(--color-warning-foreground); }
.status-chip-danger { background: var(--color-danger-tint); border-color: var(--color-danger-border); color: var(--color-danger); }
.status-chip-info { background: var(--color-info-tint); border-color: var(--color-info-border); color: var(--color-info-foreground); }
.status-chip-brand { background: var(--color-brand-tint); border-color: var(--color-brand-border); color: var(--color-brand-700); }
.status-chip-muted { background: var(--color-surface-3); border-color: var(--color-border); color: var(--color-text-secondary); }

.status-surface {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 10px 12px;
}

.status-surface-success { background: var(--color-success-tint); border-color: var(--color-success-border); color: var(--color-success); }
.status-surface-warning { background: var(--color-warning-tint); border-color: var(--color-warning-border); color: var(--color-warning-foreground); }
.status-surface-danger { background: var(--color-danger-tint); border-color: var(--color-danger-border); color: var(--color-danger); }
.status-surface-info { background: var(--color-info-tint); border-color: var(--color-info-border); color: var(--color-info-foreground); }
.status-surface-brand { background: var(--color-brand-tint); border-color: var(--color-brand-border); color: var(--color-brand-700); }
.status-surface-muted { background: var(--color-surface-3); border-color: var(--color-border); color: var(--color-text-secondary); }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-bar-wrap {
    height: 6px;
    background: var(--color-surface-4);
    border-radius: 99px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #9e7cf7, #72c1f9);
    transition: width 0.4s ease;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label {
    font-size: 12px; font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.form-control {
    background: var(--color-surface-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    padding: 8px 12px;
    font-size: 13.5px;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}
.form-control:focus {
    border-color: var(--color-brand-500);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-control::placeholder { color: var(--color-text-muted); }
.form-control:disabled {
    background: var(--color-surface-4);
    color: var(--color-text-secondary);
    cursor: not-allowed;
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-control-error { border-color: #ef4444; }
.form-error { margin: 4px 0 0; font-size: 12px; color: #b42318; font-weight: 600; }
.form-required { color: var(--color-danger); margin-left: 2px; font-weight: 600; }
.form-optional {
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    margin-left: 4px;
    text-transform: none;
    white-space: nowrap;
}
.form-required-hint { margin: 8px 0 0; font-size: 12px; color: var(--color-text-muted); }
.form-required-hint .form-required { margin-left: 0; margin-right: 4px; }
.form-helper { margin: 4px 0 0; font-size: 12px; color: var(--color-text-muted); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}

.modal {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border-hover);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    width: 100%; max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.2s ease;
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--color-border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px 24px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
}

.modal-shell-small { max-width: 420px; }
.modal-shell-medium { max-width: 520px; }
.modal-shell-large { max-width: 720px; }
.modal-shell-wide { max-width: 960px; }
.modal-shell-extrawide { max-width: min(1120px, calc(100vw - 48px)); }

.modal-shell-heading {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.modal-shell-title {
    overflow-wrap: anywhere;
}

.modal-shell-subtitle {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.modal-shell-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.modal-shell-close {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.modal-shell-footer .action-row {
    width: 100%;
}

.modal-shell-body > .alert-banner {
    margin-bottom: 14px;
}

.modal-shell-body > .toggle-row,
.modal-shell-body > .form-group + .toggle-row,
.modal-shell-body > .form-required-hint + .form-group + .toggle-row {
    border-top: 1px solid var(--color-border);
}

.action-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
}

.action-row-secondary {
    margin-right: auto;
}

.action-row-secondary,
.action-row-cancel,
.action-row-destructive,
.action-row-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.alert-banner {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-card);
    font-size: 13px;
    line-height: 1.45;
}

.alert-banner-compact {
    padding: 9px 11px;
}

.alert-banner-title {
    margin: 0;
    font-weight: 700;
}

.alert-banner-body > :last-child {
    margin-bottom: 0;
}

.alert-banner-info { background: var(--color-info-tint); border-color: var(--color-info-border); color: var(--color-info-foreground); }
.alert-banner-success { background: var(--color-success-tint); border-color: var(--color-success-border); color: var(--color-success); }
.alert-banner-warning { background: var(--color-warning-tint); border-color: var(--color-warning-border); color: var(--color-warning-foreground); }
.alert-banner-danger { background: var(--color-danger-tint); border-color: var(--color-danger-border); color: var(--color-danger-foreground); }

.modal-alert {
    padding: 12px 14px;
    border-radius: var(--radius-card);
    font-size: 13px;
    line-height: 1.45;
}

.modal-alert-error {
    background: var(--color-danger-tint);
    border: 1px solid var(--color-danger-border);
    color: var(--color-danger-foreground);
}

.state-panel {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-surface-2);
    color: var(--color-text-secondary);
}

.state-panel-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--color-text-muted);
}

.state-panel-icon svg {
    width: 100%;
    height: 100%;
}

.state-panel-copy {
    min-width: 0;
    flex: 1;
}

.state-panel-title {
    margin: 0;
    font-weight: 700;
    color: var(--color-text-primary);
}

.state-panel-body {
    margin-top: 4px;
    font-size: 13px;
}

.state-panel-body > :last-child {
    margin-bottom: 0;
}

.state-panel-actions {
    flex: 0 0 auto;
}

.state-panel-loading .state-panel-icon {
    color: var(--color-brand-500);
    animation: refresh-spin 0.7s linear infinite;
}

.state-panel-error { background: var(--color-danger-tint); border-color: var(--color-danger-border); }
.state-panel-error .state-panel-icon,
.state-panel-error .state-panel-title { color: var(--color-danger-foreground); }
.state-panel-forbidden { background: var(--color-warning-tint); border-color: var(--color-warning-border); }
.state-panel-forbidden .state-panel-icon,
.state-panel-forbidden .state-panel-title { color: var(--color-warning-foreground); }
.state-panel-placeholder { background: var(--color-info-tint); border-color: var(--color-info-border); }
.state-panel-placeholder .state-panel-icon,
.state-panel-placeholder .state-panel-title { color: var(--color-info-foreground); }

.file-picker-field {
    display: grid;
    gap: 6px;
}

.file-picker-control {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.file-picker-button-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.file-picker-control:focus-within .file-picker-button:not(.file-picker-button-disabled) {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 2px;
}

.file-picker-summary {
    min-width: 0;
    color: var(--color-text-secondary);
    font-size: 12.5px;
    overflow-wrap: anywhere;
}

.file-picker-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-picker-field-dropzone .file-picker-control {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
    border: 1px dashed var(--color-border-hover);
    border-radius: var(--radius-card);
    background: var(--color-surface-3);
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    color: var(--color-text-primary);
    cursor: pointer;
}

.toggle-row-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.toggle-row-label {
    font-size: 14px;
    font-weight: 700;
}

.toggle-row-helper {
    color: var(--color-text-secondary);
    font-size: 12.5px;
    line-height: 1.45;
}

.toggle-row-status {
    font-size: 12px;
    color: var(--color-text-muted);
}

.toggle-row-switch {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.toggle-row-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-row-switch-track {
    width: 42px;
    height: 24px;
    border-radius: var(--radius-pill);
    background: var(--color-surface-4);
    border: 1px solid var(--color-border);
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
    position: relative;
}

.toggle-row-switch-track::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 2px;
    left: 2px;
    border-radius: 50%;
    background: var(--color-surface-2);
    box-shadow: 0 1px 2px rgba(56, 79, 99, 0.18);
    transition: transform var(--transition-fast);
}

.toggle-row-switch input:checked + .toggle-row-switch-track {
    background: var(--color-brand-500);
    border-color: var(--color-brand-500);
}

.toggle-row-switch input:checked + .toggle-row-switch-track::before {
    transform: translateX(18px);
}

.toggle-row-switch input:focus-visible + .toggle-row-switch-track {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 2px;
}

.toggle-row-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.suggestion-combobox {
    position: relative;
    display: grid;
    gap: 6px;
}

.suggestion-combobox-control {
    position: relative;
    display: flex;
    align-items: stretch;
}

.suggestion-combobox-input {
    padding-right: 42px;
}

.suggestion-combobox-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 34px;
    height: calc(100% - 2px);
    border: 0;
    border-left: 1px solid var(--color-border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: transparent;
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.suggestion-combobox-toggle:hover:not(:disabled) {
    color: var(--color-text-primary);
    background: rgba(56, 79, 99, 0.06);
}

.suggestion-combobox-toggle-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
}

.suggestion-combobox-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-surface-2);
    box-shadow: 0 12px 28px rgba(56, 79, 99, 0.12);
    padding: 4px;
}

.suggestion-combobox-option {
    width: 100%;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-primary);
    font: inherit;
    font-size: 13px;
    text-align: left;
    padding: 8px 10px;
    cursor: pointer;
}

.suggestion-combobox-option:hover,
.suggestion-combobox-option:focus-visible,
.suggestion-combobox-option[aria-selected="true"] {
    background: var(--color-brand-tint);
    color: var(--color-text-primary);
}

@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 24px;
}
.page-header-left {}
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: 0; }
.page-subtitle { color: var(--color-text-secondary); font-size: 13px; margin-top: 3px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; }

.page-shell {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.app-page-title {
    margin: 0;
    font-size: 36px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--color-text-primary);
    overflow-wrap: anywhere;
}

.app-page-subtitle {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.app-section-title {
    margin: 0 0 16px;
    font-size: 20px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--color-text-primary);
}

.page-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.page-title-row > :first-child {
    min-width: 0;
}

.page-refresh-button {
    flex: 0 0 auto;
    margin-top: 2px;
}

/* ============================================================
   GRIDS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    display: flex; flex-direction: column; align-items: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
    gap: 12px;
    text-align: center;
}
.empty-state-icon { font-size: 2.5rem; opacity: 0.4; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--color-text-secondary); }
.empty-state-desc  { font-size: 13px; max-width: 320px; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; border-bottom: 1px solid var(--color-border); margin-bottom: 24px; gap: 4px; }
.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-secondary);
    font-size: 13.5px; font-weight: 500; font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: -1px;
}
.tab-btn:hover { color: var(--color-text-primary); }
.tab-btn.active { color: #384f63; border-bottom-color: var(--color-brand-500); }

/* ============================================================
   MISC
   ============================================================ */
.divider { height: 1px; background: var(--color-border); margin: 20px 0; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--color-text-secondary); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skeleton-line-w-40 { width: 40%; }
.skeleton-line-w-60 { width: 60%; }
.skeleton-line-w-80 { width: 80%; }

@media (max-width: 900px) {
    .app-shell {
        display: block;
        min-height: 100dvh;
    }

    .sidebar {
        display: none;
    }

    .main-area {
        min-height: 100dvh;
        overflow: visible;
    }

    .topbar {
        height: 60px;
        min-height: 60px;
        justify-content: space-between;
        padding: 0 14px;
        position: sticky;
        top: 0;
        z-index: 320;
        box-shadow: 0 1px 0 rgba(56, 79, 99, 0.08);
    }

    .topbar-actions {
        width: auto;
        gap: 8px;
        flex-wrap: nowrap;
        align-items: center;
        margin-left: auto;
    }

    .topbar-user {
        display: none;
    }

    .role-switcher {
        order: 3;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
    }

    .role-switch-btn {
        width: 100%;
        min-width: 0;
        justify-content: center;
        padding: 0 8px;
    }

    .mobile-brand {
        display: inline-flex;
        align-items: center;
        gap: 9px;
        min-width: 0;
        color: var(--color-text-primary);
        text-decoration: none;
    }

    .mobile-brand-mark {
        width: 34px;
        height: 34px;
        position: relative;
        display: block;
        overflow: hidden;
        border-radius: 10px;
        background: #384f63;
        flex: 0 0 auto;
    }

    .mobile-brand-logo {
        display: block;
        width: 76px;
        max-width: none;
        height: auto;
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
    }

    .mobile-brand-wordmark {
        display: block;
        color: #384f63;
        font-size: 15px;
        font-weight: 800;
        line-height: 1;
        letter-spacing: 0;
        white-space: nowrap;
    }

    .mobile-account-trigger {
        display: inline-flex;
        width: 36px;
        height: 36px;
        border: 1px solid var(--color-border);
        border-radius: 50%;
        background: var(--color-surface-2);
        color: var(--color-text-primary);
        align-items: center;
        justify-content: center;
        padding: 0;
        cursor: pointer;
        font: inherit;
        box-shadow: 0 1px 2px rgba(56, 79, 99, 0.06);
    }

    .mobile-account-trigger:hover,
    .mobile-account-trigger:focus-visible {
        border-color: var(--color-border-hover);
        background: var(--color-surface-3);
    }

    .mobile-account-initials,
    .mobile-account-summary-avatar {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: #384f63;
        color: #ffffff;
        font-size: 12px;
        font-weight: 700;
    }

    .mobile-account-initials {
        width: 28px;
        height: 28px;
    }

    .mobile-menu-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 510;
        background: rgba(15, 23, 42, 0.18);
    }

    .mobile-account-menu {
        display: grid;
        gap: 4px;
        position: fixed;
        top: 68px;
        right: 12px;
        left: 12px;
        z-index: 520;
        background: var(--color-surface-2);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-card);
        box-shadow: 0 18px 48px rgba(56, 79, 99, 0.22);
        padding: 10px;
    }

    .mobile-account-summary {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 8px 12px;
        border-bottom: 1px solid var(--color-border);
        margin-bottom: 4px;
    }

    .mobile-account-summary-avatar {
        width: 36px;
        height: 36px;
        flex: 0 0 auto;
    }

    .mobile-account-summary-copy {
        display: grid;
        min-width: 0;
    }

    .mobile-account-summary-name {
        font-weight: 700;
        color: var(--color-text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-account-summary-role {
        font-size: 12px;
        color: var(--color-text-secondary);
        text-transform: capitalize;
    }

    .mobile-account-menu-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        gap: 10px;
        border: 0;
        border-radius: var(--radius-sm);
        background: transparent;
        color: var(--color-text-primary);
        padding: 10px;
        font: inherit;
        font-weight: 600;
        text-align: left;
        text-decoration: none;
        cursor: pointer;
    }

    .mobile-account-menu-item:hover,
    .mobile-account-menu-item:focus-visible,
    .mobile-account-menu-item.active {
        background: var(--color-surface-3);
        color: var(--color-text-primary);
    }

    .mobile-account-menu-button {
        width: 100%;
    }

    .mobile-account-menu-icon {
        width: 18px;
        height: 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--color-text-secondary);
        flex: 0 0 auto;
    }

    .mobile-account-menu-icon svg {
        width: 18px;
        height: 18px;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 330;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 2px;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid var(--color-border);
        box-shadow: 0 -10px 30px rgba(56, 79, 99, 0.08);
        backdrop-filter: blur(12px);
    }

    .mobile-nav-item {
        min-width: 0;
        min-height: 48px;
        display: grid;
        grid-template-rows: 20px auto;
        align-content: center;
        justify-items: center;
        gap: 3px;
        border-radius: var(--radius-sm);
        color: var(--color-text-secondary);
        text-decoration: none;
        font-size: 11px;
        font-weight: 600;
        line-height: 1.15;
        padding: 6px 2px;
    }

    .mobile-nav-item:hover,
    .mobile-nav-item:focus-visible {
        background: rgba(158, 124, 247, 0.1);
        color: var(--color-text-primary);
    }

    .mobile-nav-item.active {
        background: #384f63;
        color: #ffffff;
        box-shadow: 0 4px 10px rgba(56, 79, 99, 0.16);
    }

    .mobile-nav-icon {
        width: 18px;
        height: 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-nav-icon svg {
        width: 18px;
        height: 18px;
    }

    .mobile-nav-label {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .page-content {
        min-height: calc(100dvh - 60px);
        padding: 20px 16px calc(88px + env(safe-area-inset-bottom));
        overflow-y: visible;
    }

    .app-page-title {
        font-size: 30px;
    }

}

@media (max-width: 640px) {
    .topbar {
        height: 58px;
        min-height: 58px;
        padding: 0 12px;
    }

    .mobile-brand {
        gap: 8px;
    }

    .mobile-brand-mark {
        width: 32px;
        height: 32px;
        border-radius: 9px;
    }

    .mobile-brand-logo {
        width: 72px;
    }

    .mobile-brand-wordmark {
        font-size: 14px;
    }

    .icon-btn,
    .mobile-account-trigger {
        width: 34px;
        height: 34px;
    }

    .mobile-account-initials {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }

    .mobile-account-menu {
        top: 66px;
        right: 10px;
        left: 10px;
    }

    .mobile-bottom-nav {
        padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    }

    .mobile-nav-item {
        min-height: 48px;
        gap: 2px;
        font-size: 10px;
    }

    .mobile-nav-icon,
    .mobile-nav-icon svg {
        width: 17px;
        height: 17px;
    }

    .page-content {
        padding: 16px 12px calc(84px + env(safe-area-inset-bottom));
    }

    .app-page-title {
        font-size: 26px;
    }

    .app-section-title {
        font-size: 18px;
    }

    .card {
        padding: 16px;
    }

    .modal-overlay {
        align-items: center;
        padding: 12px;
        overflow-y: auto;
    }

    .modal {
        max-width: none;
        max-height: calc(100dvh - 24px);
        margin: auto;
        border-radius: 18px;
    }

    .modal-header {
        padding: 16px 18px 12px;
    }

    .modal-body {
        padding: 16px 18px;
    }

    .modal-footer {
        flex-direction: column-reverse;
        padding: 12px 18px 18px;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }

    .action-row {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .action-row-secondary {
        margin-right: 0;
    }

    .action-row-secondary,
    .action-row-cancel,
    .action-row-destructive,
    .action-row-primary,
    .action-row-secondary .btn,
    .action-row-cancel .btn,
    .action-row-destructive .btn,
    .action-row-primary .btn {
        width: 100%;
    }

    .state-panel {
        flex-direction: column;
    }

    .state-panel-actions,
    .state-panel-actions .btn {
        width: 100%;
    }

    .file-picker-control {
        align-items: stretch;
        flex-direction: column;
    }

    .toggle-row {
        align-items: flex-start;
    }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    padding: 24px;
    overflow-x: hidden;
}

.login-card {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: min(400px, 100%);
    min-width: 0;
    padding: 44px 40px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-logo {
    max-height: 60px;
    max-width: 200px;
    width: auto;
    object-fit: contain;
    margin-bottom: 28px;
}

.login-heading {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: 0;
    text-align: center;
    margin-bottom: 10px;
}

.login-subtext {
    font-size: 13.5px;
    color: var(--color-text-secondary);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 32px;
}

.login-btn {
    width: 100%;
    height: 46px;
    background: var(--color-brand-500);
    color: white;
    border: none;
    border-radius: var(--radius-card);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.login-btn:hover {
    background: var(--color-brand-600);
    box-shadow: var(--shadow-glow);
}

.login-helper {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.6;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.login-helper-spaced {
    margin-bottom: 24px;
}

@media (max-width: 480px) {
    .login-shell {
        padding: 20px 16px;
    }

    .login-card {
        width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        padding: 36px 24px 32px;
    }

    .login-btn {
        height: auto;
        min-height: 46px;
        min-width: 0;
        padding: 0 16px;
        text-align: center;
        white-space: normal;
    }
}

/* ============================================================
   LOADING PROGRESS
   ============================================================ */
.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--color-border);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--color-brand-500);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem;
    position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}
