/* build: header-v8-dropdown-backdrop */
/* ============================================================
   Book Management System — base styles
   Pure CSS. Light default; dark via [data-theme="dark"].
   Dark = warm navy. Sidebar is dark in both themes.
   ============================================================ */

/* ---------- Theme tokens ---------- */

:root {
    /* Light theme content area */
    --bg:            #eef1f6;
    --bg-accent:     rgba(99, 102, 241, 0.07);
    --surface:       #ffffff;
    --surface-2:     #f4f6fa;
    --surface-3:     #e9edf3;
    --border:        #e4e8ef;
    --border-strong: #d3d9e3;
    --text:          #161b26;
    --text-muted:    #5b6573;
    --text-faint:    #99a2b2;

    /* Brand: refined indigo -> violet */
    --primary:       #6366f1;
    --primary-hover: #5457e5;
    --primary-soft:  rgba(99, 102, 241, 0.12);
    --on-primary:    #ffffff;

    /* Sidebar (dark in both themes) — warm navy */
    --side-bg:       #0e1729;
    --side-bg-2:     #16223a;
    --side-border:   #1f2d49;
    --side-text:     #aab4c8;
    --side-text-dim: #6b7689;
    --side-active-bg:rgba(99, 102, 241, 0.18);
    --side-active:   #c3c7ff;
    --side-brand:    #ffffff;

    /* Status */
    --danger-bg:     #fdecee;
    --danger-border: #f5c2c7;
    --danger-text:   #b42d3a;
    --success-bg:    #e7f6ec;
    --success-border:#bfe3cb;
    --success-text:  #1f7a44;

    --radius:        12px;
    --radius-sm:     9px;
    --radius-card:   16px;
    --shadow:        0 10px 40px rgba(20, 25, 40, 0.10);
    --shadow-sm:     0 1px 3px rgba(20, 25, 40, 0.06);
    --font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --transition:    0.18s ease;
    --sidebar-w:     250px;
    --sidebar-mini:  64px;

    /* Sidebar icon accent colors */
    --ic-blue:   #4f7cff;
    --ic-orange: #f97316;
    --ic-green:  #16a34a;
    --ic-purple: #8b5cf6;

    /* Header action icon colors (warm, saturated) */
    --hi-bell:    #f97316;  /* warm orange */
    --hi-gear:    #a16207;  /* caramel / terracotta */
    --hi-theme:   #7c3aed;  /* violet */
    --hi-user:    #e11d48;  /* coral red */
    --hi-sidebar: #2563eb;  /* blue */
    /* Darker on-tile ink for readability */
    --hi-bell-ink:    #c2410c;
    --hi-gear-ink:    #854d0e;
    --hi-theme-ink:   #6d28d9;
    --hi-user-ink:    #be123c;
    --hi-sidebar-ink: #1d4ed8;
    --header-h:      60px;
}

[data-theme="dark"] {
    /* Warm navy content area (from reference) */
    --bg:            #0a1424;
    --bg-accent:     rgba(99, 102, 241, 0.14);
    --surface:       #0f1d33;
    --surface-2:     #16263f;
    --surface-3:     #1d3050;
    --border:        #1d2d47;
    --border-strong: #2a3d5c;
    --text:          #e6ebf4;
    --text-muted:    #9aa7bd;
    --text-faint:    #6b7689;

    --primary:       #7c80ff;
    --primary-hover: #8e92ff;
    --primary-soft:  rgba(124, 128, 255, 0.18);
    --on-primary:    #ffffff;

    /* Sidebar slightly deeper than content for separation */
    --side-bg:       #081020;
    --side-bg-2:     #101e34;
    --side-border:   #1a2942;
    --side-text:     #9aa7bd;
    --side-text-dim: #5e6b82;
    --side-active-bg:rgba(124, 128, 255, 0.20);
    --side-active:   #c3c7ff;
    --side-brand:    #ffffff;

    --danger-bg:     #2a1719;
    --danger-border: #5b2a2f;
    --danger-text:   #ff8a8a;
    --success-bg:    #14241a;
    --success-border:#27482f;
    --success-text:  #7fd39b;

    --ic-blue:   #6b8cff;
    --ic-orange: #fb923c;
    --ic-green:  #34d399;
    --ic-purple: #a78bfa;

    --hi-bell:    #fb923c;
    --hi-gear:    #d6a04a;
    --hi-theme:   #a78bfa;
    --hi-user:    #fb7185;
    --hi-sidebar: #60a5fa;
    --hi-bell-ink:    #fdba74;
    --hi-gear-ink:    #e6c07b;
    --hi-theme-ink:   #c4b5fd;
    --hi-user-ink:    #fda4af;
    --hi-sidebar-ink: #93c5fd;

    --shadow:        0 10px 40px rgba(0, 0, 0, 0.45);
    --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ---------- Reset ---------- */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: clamp(15px, 0.9rem + 0.25vw, 16.5px); }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition), color var(--transition);
}

svg { display: block; }

/* ---------- Shared controls ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: clamp(0.9rem, 0.88rem + 0.15vw, 0.95rem);
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), opacity var(--transition);
}
.btn-primary { background: var(--primary); color: var(--on-primary); padding: clamp(11px, 2vw, 13px) 18px; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-sm { font-size: 0.825rem; padding: 7px 12px; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--border-strong); }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 19px; height: 19px; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Form primitives ---------- */

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 550;
    color: var(--text-muted);
    margin-bottom: 7px;
}
.form-group input {
    width: 100%;
    padding: clamp(10px, 2vw, 13px) 14px;
    font-size: clamp(0.9rem, 0.88rem + 0.15vw, 0.95rem);
    font-family: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-group input::placeholder { color: var(--text-faint); }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 0.875rem; margin-bottom: 20px; }
.alert-error   { background: var(--danger-bg);  border: 1px solid var(--danger-border);  color: var(--danger-text); }
.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success-text); }

/* ============================================================
   Split-screen login
   ============================================================ */

.login-split { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 880px) { .login-split { grid-template-columns: 1.05fr 1fr; } }

.login-aside {
    display: none;
    position: relative;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    color: #fff;
    background:
        radial-gradient(800px 500px at 15% 10%, rgba(255,255,255,0.14), transparent 55%),
        radial-gradient(700px 600px at 90% 100%, rgba(124,128,255,0.5), transparent 60%),
        linear-gradient(150deg, #0e1729 0%, #1a2747 55%, #2d2a6e 100%);
    overflow: hidden;
}
@media (min-width: 880px) { .login-aside { display: flex; } }

.login-aside .aside-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.login-aside .aside-brand .brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 12px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.22);
    font-size: 0.82rem; letter-spacing: 0.02em;
    backdrop-filter: blur(4px);
}
.login-aside .aside-headline { max-width: 32ch; }
.login-aside .aside-headline h2 {
    font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.4rem);
    font-weight: 680; line-height: 1.16; letter-spacing: -0.025em; margin-bottom: 16px;
}
.login-aside .aside-headline p { font-size: 1.02rem; color: rgba(255,255,255,0.78); line-height: 1.6; }
.login-aside .aside-foot { font-size: 0.85rem; color: rgba(255,255,255,0.6); }

.login-main { display: flex; align-items: center; justify-content: center; padding: clamp(24px, 6vw, 56px); position: relative; background: var(--bg); }
.login-main .login-topbar { position: absolute; top: clamp(16px, 4vw, 28px); right: clamp(16px, 4vw, 28px); }
.login-form-wrap { width: 100%; max-width: 380px; }
.login-form-wrap .form-head { margin-bottom: clamp(24px, 4vw, 32px); }
.login-form-wrap .form-head h1 { font-size: clamp(1.5rem, 1.3rem + 1vw, 1.85rem); font-weight: 680; letter-spacing: -0.02em; }
.login-form-wrap .form-head p { color: var(--text-muted); font-size: clamp(0.9rem, 0.88rem + 0.2vw, 0.95rem); margin-top: 7px; }
.login-form-wrap .form-foot { margin-top: 26px; font-size: 0.8rem; color: var(--text-faint); text-align: center; }

.login-mobile-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 24px; color: var(--text); }
.login-mobile-brand .brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--primary); color: #fff; font-size: 0.78rem;
}
@media (min-width: 880px) { .login-mobile-brand { display: none; } }

/* ============================================================
   App shell
   ============================================================ */

.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; }

/* Sidebar — dark in both themes */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--side-bg);
    border-right: 1px solid var(--side-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform var(--transition);
}
.sidebar.is-open { transform: translateX(0); }

/* Desktop: visible by default, collapsible via .sidebar-collapsed on shell */
@media (min-width: 1024px) {
    .sidebar { position: sticky; height: 100vh; transform: none; transition: width var(--transition); }

    /* Collapsed = mini rail: icons only */
    .app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-mini); }
    .app-shell.sidebar-collapsed .brand-text,
    .app-shell.sidebar-collapsed .nav-label,
    .app-shell.sidebar-collapsed .sidebar-footer span { display: none; }
    .app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
    .app-shell.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }
    .app-shell.sidebar-collapsed .sidebar-footer { text-align: center; padding: 14px 0; }
}

.sidebar-brand {
    display: flex; align-items: center; gap: 11px;
    height: var(--header-h);
    padding: 0 20px;
    border-bottom: 1px solid var(--side-border);
}
.sidebar-brand .brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--primary); color: #fff; font-weight: 700; font-size: 0.74rem; letter-spacing: 0.02em;
}
.sidebar-brand .brand-text { font-weight: 650; letter-spacing: -0.01em; color: var(--side-brand); }

.sidebar-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--side-text); text-decoration: none;
    font-size: 0.92rem; font-weight: 550;
    transition: background var(--transition), color var(--transition);
}
.nav-item .nav-icon { display: inline-flex; flex-shrink: 0; }
.nav-item .nav-icon svg { width: 18px; height: 18px; }
.nav-item:hover { background: var(--side-bg-2); color: #fff; }
.nav-item.is-active { background: var(--side-active-bg); color: var(--side-active); }

.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--side-border); font-size: 0.75rem; color: var(--side-text-dim); }

.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    opacity: 0; visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition); z-index: 35;
}
.sidebar-backdrop.is-visible { opacity: 1; visibility: visible; }
@media (min-width: 1024px) { .sidebar-backdrop { display: none; } }

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

.app-header {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 10px;
    height: var(--header-h);
    padding: 0 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.header-home {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    color: var(--text-muted); text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.header-home:hover { background: var(--surface-2); color: var(--primary); }
.header-home svg { width: 20px; height: 20px; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.header-actions > * { flex-shrink: 0; }

/* User dropdown panel */
.user-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0;
    min-width: 210px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
    z-index: 50;
}
.user-menu.is-open .user-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }

/* Mobile: dropdown opens below the header, edge-to-edge (10px gutters) */
@media (max-width: 599px) {
    .user-dropdown {
        position: fixed;
        top: calc(var(--header-h) + 6px);
        bottom: auto;
        left: 10px;
        right: 10px;
        min-width: 0;
        width: auto;
        border-radius: var(--radius-card);
        padding: 8px;
        transform: translateY(-8px);
        z-index: 50;
    }
    .user-menu.is-open .user-dropdown { transform: translateY(0); }
    .user-dropdown .dropdown-item { padding: 13px 14px; font-size: 0.95rem; }
    .user-dropdown .dropdown-head { padding: 12px 14px; }
}

/* Dropdown backdrop — only visible on mobile when menu is open */
.dropdown-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 45;
}
.dropdown-backdrop.is-visible { opacity: 1; visibility: visible; }
@media (min-width: 600px) { .dropdown-backdrop { display: none; } }

.dropdown-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-head .dd-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.dropdown-head .dd-role { font-size: 0.78rem; color: var(--text-muted); margin-top: 1px; }

.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none; font-size: 0.9rem;
    transition: background var(--transition);
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--text-muted); }
.dropdown-item.is-danger { color: var(--danger-text); }
.dropdown-item.is-danger svg { color: var(--danger-text); }

.app-content { flex: 1; padding: clamp(14px, 1.5vw, 18px) 10px; width: 100%; display: flex; flex-direction: column; }

.app-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 10px; border-top: 1px solid var(--border);
    color: var(--text-faint); font-size: 0.8rem;
}

/* ---------- Dashboard content ---------- */

.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.7rem); font-weight: 680; letter-spacing: -0.02em; }
.page-sub { color: var(--text-muted); margin-top: 5px; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: clamp(10px, 1.5vw, 16px);
    margin-bottom: 18px;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-card); padding: 18px;
    display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 550; }
.stat-value { font-size: clamp(1.5rem, 1.3rem + 1vw, 1.9rem); font-weight: 700; letter-spacing: -0.02em; }
.stat-trend { font-size: 0.78rem; color: var(--text-faint); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 1.02rem; font-weight: 640; letter-spacing: -0.01em; }
.panel-body { padding: 18px; color: var(--text-muted); }


/* ---------- Color-matched header icons (exact, from mockup) ---------- */
.icon-btn.hi, .theme-toggle.hi-theme, .header-home {
    width: 38px; height: 38px;
    border-radius: 11px;
    border: 1px solid transparent;
    transition: background var(--transition), border-color var(--transition);
}

/* Home — indigo */
.header-home {
    color: #4f46e5;
    background: #eef2ff;
    border-color: #c7d2fe;
}
.header-home:hover { background: #e0e7ff; border-color: #a5b4fc; }

/* Bell — orange */
.hi-bell {
    color: #ea580c;
    background: #fff1e6;
    border-color: #fed7aa;
}
.hi-bell:hover { background: #ffe4d1; border-color: #fdba74; }

/* Settings — cyan */
.hi-gear {
    color: #0891b2;
    background: #e0f7fa;
    border-color: #a5e8f0;
}
.hi-gear:hover { background: #cbeff4; border-color: #7dd3e0; }

/* Theme — violet */
.theme-toggle.hi-theme {
    color: #7c3aed;
    background: #f3eaff;
    border-color: #ddd0f7;
}
.theme-toggle.hi-theme:hover { background: #e9daff; border-color: #c9b3f0; }

/* Sidebar toggle — blue */
.hi-sidebar {
    color: #2563eb;
    background: #eff6ff;
    border-color: #bfdbfe;
}
.hi-sidebar:hover { background: #dbeafe; border-color: #93c5fd; }

/* Dark theme overrides for header icons */
[data-theme="dark"] .header-home { color: #a5b4fc; background: #1e2a4a; border-color: #2e3d63; }
[data-theme="dark"] .hi-bell     { color: #fb923c; background: #2a2016; border-color: #4a3520; }
[data-theme="dark"] .hi-gear     { color: #22d3ee; background: #122a30; border-color: #1d454e; }
[data-theme="dark"] .theme-toggle.hi-theme { color: #a78bfa; background: #221a38; border-color: #392d5c; }
[data-theme="dark"] .hi-sidebar  { color: #60a5fa; background: #13243d; border-color: #21385c; }
[data-theme="dark"] .header-home:hover { background: #243456; }

/* Notification dot */
.icon-btn .badge {
    position: absolute; top: 6px; right: 7px;
    width: 8px; height: 8px; padding: 0;
    font-size: 0; line-height: 0;
    background: #ef4444; color: transparent;
    border-radius: 50%; border: 2px solid var(--surface);
}
.icon-btn { position: relative; }

/* ---------- User chip ---------- */
.user-menu { position: relative; flex-shrink: 0; }
.user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 10px 0 5px;
    margin: 0;
    border: 1px solid #fecdd3;
    border-radius: 12px;
    background: #fff0f3;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background var(--transition), border-color var(--transition);
}
.user-trigger:hover,
.user-menu.is-open .user-trigger {
    background: #ffe0e6;
    border-color: #fda4af;
}
.user-trigger .user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f43f5e, #fb7185);
    color: #fff;
    font-weight: 650;
    font-size: 0.8rem;
}
.user-trigger .user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    line-height: 1.15;
    text-align: left;
}
.user-trigger .user-meta .u-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #161b26;
}
.user-trigger .user-meta .u-role {
    font-size: 0.68rem;
    color: #6b7280;
}
.user-trigger .u-caret {
    display: inline-flex;
    align-items: center;
    color: #9aa1ad;
    flex-shrink: 0;
}
.user-trigger .u-caret svg { width: 15px; height: 15px; }

/* On narrow screens, collapse to avatar only */
@media (max-width: 599px) {
    .user-trigger .user-meta,
    .user-trigger .u-caret { display: none; }
    .user-trigger { padding: 0; width: 38px; justify-content: center; }
}

[data-theme="dark"] .user-trigger { background: #2a1820; border-color: #4a2630; }
[data-theme="dark"] .user-trigger:hover,
[data-theme="dark"] .user-menu.is-open .user-trigger { background: #361e28; border-color: #5e3340; }
[data-theme="dark"] .user-trigger .user-meta .u-name { color: #e6ebf4; }
[data-theme="dark"] .user-trigger .user-meta .u-role { color: #9aa7bd; }

/* Divider before user chip */
.header-divider { width: 1px; height: 26px; background: var(--border); margin: 0 4px; flex-shrink: 0; }


/* ---------- Dismissible banner ---------- */
.app-banner {
    display: flex; align-items: flex-start; gap: 12px;
    background: color-mix(in srgb, var(--hi-bell) 12%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--hi-bell) 26%, transparent);
    border-radius: var(--radius-card);
    padding: 14px 16px;
    margin-bottom: 18px;
}
.app-banner .banner-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; flex-shrink: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--hi-bell) 30%, var(--surface));
    color: color-mix(in srgb, var(--hi-bell) 75%, #000);
}
.app-banner .banner-icon svg { width: 19px; height: 19px; }
.app-banner .banner-body { flex: 1; min-width: 0; }
.app-banner .banner-title {
    font-weight: 600; font-size: 0.94rem;
    color: color-mix(in srgb, var(--hi-bell) 78%, #000);
    margin-bottom: 2px;
}
.app-banner .banner-text {
    font-size: 0.86rem; line-height: 1.5;
    color: color-mix(in srgb, var(--hi-bell) 70%, var(--text-muted));
}
.app-banner .banner-actions { margin-top: 10px; }
.app-banner .banner-close {
    flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border: none; cursor: pointer;
    border-radius: 50%; background: transparent;
    color: color-mix(in srgb, var(--hi-bell) 70%, #000);
    transition: background var(--transition);
}
.app-banner .banner-close:hover { background: color-mix(in srgb, var(--hi-bell) 22%, transparent); }
.app-banner .banner-close svg { width: 16px; height: 16px; }
.app-banner[hidden] { display: none; }

[data-theme="dark"] .app-banner .banner-icon { color: #fff; }
[data-theme="dark"] .app-banner .banner-title { color: color-mix(in srgb, var(--hi-bell) 60%, #fff); }
[data-theme="dark"] .app-banner .banner-text { color: color-mix(in srgb, var(--hi-bell) 40%, var(--text-muted)); }

/* ============================================================
   User management — card grid
   ============================================================ */

.page-head--row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* Responsive grid: wide cards, ~340px min => 1 (mobile) / 2 (tablet) / 3 (desktop) */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: clamp(12px, 1.5vw, 16px);
}
@media (max-width: 520px) {
    .user-grid { grid-template-columns: 1fr; }
}

.user-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.user-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

.uc-top { display: flex; align-items: flex-start; gap: 13px; }
.uc-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-weight: 650; font-size: 1.05rem;
}
.uc-id { flex: 1; min-width: 0; }
.uc-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.uc-name { font-weight: 600; font-size: 0.98rem; color: var(--text); }
.uc-email {
    font-size: 0.85rem; color: var(--text-muted); margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.uc-foot {
    display: flex; align-items: center; gap: 12px;
    margin-top: 14px; padding-top: 13px;
    border-top: 1px solid var(--border);
}
.uc-meta {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.78rem; color: var(--text-faint);
}
.uc-meta svg { flex-shrink: 0; }
.uc-actions { margin-left: auto; display: flex; gap: 7px; }

.act {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface-2);
    color: var(--text-muted); cursor: pointer; text-decoration: none;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.act:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.act.del:hover { color: #be123c; border-color: #fecdd3; background: #fff0f3; }
[data-theme="dark"] .act.del:hover { color: #fb7185; border-color: #4a2630; background: #2a1820; }

/* Status as a standalone dot in cards */
.uc-top .status { flex-shrink: 0; margin-top: 4px; }

/* Role badges */
.badge-role {
    display: inline-flex; align-items: center;
    padding: 4px 10px;
    font-size: 0.76rem; font-weight: 600;
    border-radius: 7px;
    border: 1px solid transparent;
}
.badge-admin   { color: #be123c; background: #fff0f3; border-color: #fecdd3; }
.badge-partner { color: #6d28d9; background: #f3eaff; border-color: #ddd0f7; }
.badge-staff   { color: #0891b2; background: #e0f7fa; border-color: #a5e8f0; }

[data-theme="dark"] .badge-admin   { color: #fb7185; background: #2a1820; border-color: #4a2630; }
[data-theme="dark"] .badge-partner { color: #a78bfa; background: #221a38; border-color: #392d5c; }
[data-theme="dark"] .badge-staff   { color: #22d3ee; background: #122a30; border-color: #1d454e; }

/* Status indicator */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 0.82rem; font-weight: 550; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; }
.status-active   { color: #1f7a44; }
.status-active .dot   { background: #1f9d55; }
.status-inactive { color: var(--text-faint); }
.status-inactive .dot { background: var(--text-faint); }

[data-theme="dark"] .status-active { color: #7fd39b; }
[data-theme="dark"] .status-active .dot { background: #34d399; }

/* ============================================================
   Split-screen form (add/edit user)
   ============================================================ */

.form-split {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
/* Desktop: form left (wider), info panel right; fill the content area height */
@media (min-width: 820px) {
    .form-split {
        grid-template-columns: 1.6fr 1fr;
        min-height: 100%;
    }
}

/* Form panel (left) */
.form-main {
    display: flex;
    flex-direction: column;
    padding: clamp(20px, 3vw, 32px);
}
.form-main form { display: flex; flex-direction: column; flex: 1; width: 100%; max-width: 640px; margin: 0 auto; }
.form-body { flex: 1; }

/* Info panel (right) */
.form-aside {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    padding: 30px 28px;
    color: #fff;
    background:
        radial-gradient(600px 400px at 80% 10%, rgba(255,255,255,0.12), transparent 55%),
        linear-gradient(150deg, #0e1729 0%, #1a2747 55%, #2d2a6e 100%);
}
@media (min-width: 820px) { .form-aside { display: flex; } }

.form-aside-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 12px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.22);
    margin-bottom: 16px;
}
.form-aside-title { font-size: 1.25rem; font-weight: 650; line-height: 1.25; margin-bottom: 10px; letter-spacing: -0.01em; }
.form-aside-text { font-size: 0.88rem; color: rgba(255,255,255,0.78); line-height: 1.6; }
.form-aside-foot { font-size: 0.78rem; color: rgba(255,255,255,0.62); line-height: 1.6; }
.form-aside-foot strong { color: rgba(255,255,255,0.85); font-weight: 600; }

.field { margin-bottom: 16px; }
.field > label {
    display: block; font-size: 0.83rem; font-weight: 550;
    color: var(--text-muted); margin-bottom: 6px;
}
.field .req { color: #e11d48; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field select {
    width: 100%;
    height: 42px;
    padding: 0 13px;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.field select { cursor: pointer; }
.field input:focus,
.field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field input::placeholder { color: var(--text-faint); }
.field input.has-error,
.field select.has-error { border-color: #e11d48; }

.field-error { font-size: 0.78rem; color: #be123c; margin-top: 5px; }
[data-theme="dark"] .field-error { color: #fb7185; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 360px) { .field-row { grid-template-columns: 1fr; gap: 0; } }

/* Password show/hide */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-eye {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border: none; background: transparent;
    color: var(--text-faint); cursor: pointer; border-radius: 6px;
    transition: color var(--transition), background var(--transition);
}
.pw-eye:hover { color: var(--text); background: var(--surface-3); }

/* Switch toggle */
.switch-row { display: inline-flex; align-items: center; gap: 10px; height: 42px; cursor: pointer; }
.switch-row input {
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    flex: 0 0 auto;
    pointer-events: none;
}
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex: 0 0 auto;
    background: var(--border-strong);
    border-radius: 12px;
    transition: background var(--transition);
}
.switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.switch-row input:checked + .switch { background: #1f9d55; }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.switch-label { font-size: 0.9rem; color: var(--text); white-space: nowrap; }

/* Form actions */
.form-actions {
    display: flex; gap: 10px; justify-content: flex-end; align-items: center;
    margin-top: 18px; padding-top: 18px;
    border-top: 1px solid var(--border);
}
.form-actions .btn {
    flex: 0 0 auto;
    min-width: 100px;
    height: 42px;
    white-space: nowrap;
}
.form-actions .btn-outline { padding: 0 18px; }
.form-actions .btn-primary { padding: 0 20px; }

/* ============================================================
   Flash messages
   ============================================================ */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.flash-success { background: #e7f6ed; color: #1f7a44; border-color: #b6e2c7; }
.flash-error   { background: #fdecec; color: #be123c; border-color: #f6c6cd; }
[data-theme="dark"] .flash-success { background: #11271c; color: #7fd39b; border-color: #1f4632; }
[data-theme="dark"] .flash-error   { background: #2a1418; color: #fb7185; border-color: #4a2027; }

/* ============================================================
   Modal (confirmation dialog)
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 100;
}
.modal-overlay.is-open { opacity: 1; visibility: visible; }

.modal {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    padding: 26px 24px 22px;
    text-align: center;
    transform: translateY(12px) scale(0.98);
    transition: transform var(--transition);
}
.modal-overlay.is-open .modal { transform: translateY(0) scale(1); }

.modal-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; border-radius: 14px; margin-bottom: 14px;
}
.modal-icon-danger { background: #fdecec; color: #dc2626; }
[data-theme="dark"] .modal-icon-danger { background: #2a1418; color: #f87171; }

.modal-title { font-size: 1.15rem; font-weight: 650; margin-bottom: 8px; color: var(--text); }
.modal-text { font-size: 0.9rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 14px; }
.modal-text strong { color: var(--text); font-weight: 600; }

.modal-user {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 20px;
}
.modal-user-line { font-size: 0.85rem; color: var(--text-muted); }

.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { flex: 1; min-width: 0; height: 42px; }

/* Danger button */
.btn-danger {
    background: #dc2626;
    color: #fff;
    border: 1px solid #dc2626;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }