/* ============================================================
   DashboardEC — clean management dashboard theme
   (login + dashboard shell). Inspired by the "Adon" clean
   dashboard style: soft surfaces, indigo/violet accent,
   generous spacing, subtle shadows.
   ============================================================ */

:root {
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --violet-500: #8b5cf6;
    --brand-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #9333ea 100%);

    --bg: #f4f5fb;
    --surface: #ffffff;
    --surface-2: #fbfbfe;
    --border: #e7e8f0;
    --border-strong: #d8dae6;

    --text: #1f2430;
    --text-muted: #6b7280;
    --text-soft: #9aa1ae;

    --success: #16a34a;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 8px 24px rgba(16, 24, 40, .08);
    --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .18);

    --sidebar-w: 264px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* ============================================================
   THEMES — user-selectable color schemes. Applied via data-theme
   on <html> and persisted in localStorage. "indigo" = the default
   above (no attribute). Each preset just re-points the accent tokens.
   ============================================================ */
:root[data-theme="ocean"]   { --brand-500:#38bdf8; --brand-600:#0284c7; --brand-700:#0369a1; --violet-500:#06b6d4; --brand-grad:linear-gradient(135deg,#0284c7 0%,#0891b2 55%,#06b6d4 100%); }
:root[data-theme="emerald"] { --brand-500:#34d399; --brand-600:#059669; --brand-700:#047857; --violet-500:#14b8a6; --brand-grad:linear-gradient(135deg,#059669 0%,#0d9488 55%,#14b8a6 100%); }
:root[data-theme="violet"]  { --brand-500:#a78bfa; --brand-600:#7c3aed; --brand-700:#6d28d9; --violet-500:#c026d3; --brand-grad:linear-gradient(135deg,#7c3aed 0%,#9333ea 55%,#c026d3 100%); }
:root[data-theme="rose"]    { --brand-500:#fb7185; --brand-600:#e11d48; --brand-700:#be123c; --violet-500:#f43f5e; --brand-grad:linear-gradient(135deg,#e11d48 0%,#db2777 55%,#f43f5e 100%); }
:root[data-theme="amber"]   { --brand-500:#fbbf24; --brand-600:#d97706; --brand-700:#b45309; --violet-500:#f59e0b; --brand-grad:linear-gradient(135deg,#d97706 0%,#ea580c 55%,#f59e0b 100%); }
:root[data-theme="slate"]   { --brand-500:#64748b; --brand-600:#475569; --brand-700:#334155; --violet-500:#0ea5e9; --brand-grad:linear-gradient(135deg,#334155 0%,#475569 55%,#0284c7 100%); }
:root[data-theme="teal"]    { --brand-500:#2dd4bf; --brand-600:#0d9488; --brand-700:#0f766e; --violet-500:#06b6d4; --brand-grad:linear-gradient(135deg,#0d9488 0%,#0891b2 55%,#06b6d4 100%); }
:root[data-theme="dark"] {
    --bg:#0f1115; --surface:#181b22; --surface-2:#1f232c; --border:#2a2f3a; --border-strong:#3a4150;
    --text:#e6e8ee; --text-muted:#9aa1ae; --text-soft:#6b7280;
    --brand-500:#818cf8; --brand-600:#6366f1; --brand-700:#a5b4fc; --violet-500:#a78bfa;
    --brand-grad:linear-gradient(135deg,#4f46e5 0%,#7c3aed 55%,#9333ea 100%);
    --shadow-sm:0 1px 2px rgba(0,0,0,.45); --shadow:0 8px 24px rgba(0,0,0,.5); --shadow-lg:0 24px 48px -12px rgba(0,0,0,.65);
    --danger-bg:#2a1416; --danger-border:#5b1d1d;
}
:root[data-theme="midnight"] {
    --bg:#0b1020; --surface:#121831; --surface-2:#1a2140; --border:#283154; --border-strong:#37426b;
    --text:#e7eaf6; --text-muted:#9aa6c7; --text-soft:#6b7595;
    --brand-500:#60a5fa; --brand-600:#3b82f6; --brand-700:#93c5fd; --violet-500:#818cf8;
    --brand-grad:linear-gradient(135deg,#2563eb 0%,#4f46e5 55%,#7c3aed 100%);
    --shadow-sm:0 1px 2px rgba(0,0,0,.5); --shadow:0 8px 24px rgba(0,0,0,.55); --shadow-lg:0 24px 48px -12px rgba(0,0,0,.7);
    --danger-bg:#2a1620; --danger-border:#5b1d33;
}

/* Dark-theme component fixes: topbar + controls that hardcode light backgrounds */
:root[data-theme="dark"] .topbar { background: rgba(24,27,34,.85); }
:root[data-theme="midnight"] .topbar { background: rgba(15,21,40,.85); }
:root[data-theme="dark"] .seg button.active, :root[data-theme="midnight"] .seg button.active,
:root[data-theme="dark"] .ctl:focus, :root[data-theme="midnight"] .ctl:focus,
:root[data-theme="dark"] .entry-table input:focus, :root[data-theme="midnight"] .entry-table input:focus,
:root[data-theme="dark"] .searchbox input:focus, :root[data-theme="midnight"] .searchbox input:focus { background: var(--surface); }
:root[data-theme="dark"] .icon-btn .dot, :root[data-theme="midnight"] .icon-btn .dot { border-color: var(--surface); }

/* Theme picker swatches (topbar user menu) */
.user-menu__theme { padding: 10px 14px 12px; border-top: 1px solid var(--border); }
.umt-label { display:block; font-size:11px; font-weight:600; color: var(--text-soft); text-transform:uppercase; letter-spacing:.04em; margin-bottom:8px; }
.umt-swatches { display:flex; gap:9px; flex-wrap:wrap; }
.umt-sw { width:22px; height:22px; border-radius:50%; border:2px solid var(--surface); outline:1px solid var(--border-strong); cursor:pointer; padding:0; transition: transform .12s ease; }
.umt-sw:hover { transform: scale(1.14); }
.umt-sw.is-active { outline:2px solid var(--brand-600); outline-offset:1px; }

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

/* ============================================================
   LOGIN
   ============================================================ */
.auth {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

/* Left brand / illustration panel */
.auth__brand {
    flex: 1.05 1 0;
    position: relative;
    overflow: hidden;
    background: var(--brand-grad);
    color: #fff;
    padding: 56px 64px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth__brand::before,
.auth__brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    filter: blur(2px);
}
.auth__brand::before { width: 420px; height: 420px; top: -140px; right: -120px; }
.auth__brand::after  { width: 320px; height: 320px; bottom: -120px; left: -80px; background: rgba(255,255,255,.06); }

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: .2px;
    position: relative;
    z-index: 1;
}
.brand-logo .mark {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255,255,255,.25);
    display: grid; place-items: center;
    font-weight: 800; font-size: 16px;
    backdrop-filter: blur(6px);
}

.auth__brand-body { position: relative; z-index: 1; max-width: 460px; }
.auth__brand-body h1 {
    font-size: 38px;
    line-height: 1.15;
    font-weight: 700;
    margin: 0 0 16px;
    letter-spacing: -.5px;
}
.auth__brand-body p {
    font-size: 15.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .82);
    margin: 0 0 28px;
}
.auth__features { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.auth__features li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: rgba(255,255,255,.92); }
.auth__features .tick {
    width: 22px; height: 22px; border-radius: 7px;
    background: rgba(255,255,255,.18);
    display: grid; place-items: center; flex: 0 0 auto;
}

/* Decorative mini-chart card */
.glass-card {
    position: relative;
    z-index: 1;
    margin-top: 36px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: var(--radius);
    padding: 18px 20px;
    backdrop-filter: blur(10px);
    max-width: 360px;
}
.glass-card .gc-label { font-size: 12.5px; color: rgba(255,255,255,.8); }
.glass-card .gc-value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.glass-card .gc-bars { display: flex; align-items: flex-end; gap: 8px; height: 56px; margin-top: 14px; }
.glass-card .gc-bars span {
    flex: 1; border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.45));
}

.auth__foot { position: relative; z-index: 1; font-size: 12.5px; color: rgba(255,255,255,.7); }

/* Right form panel */
.auth__form {
    flex: .95 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.auth__card { width: 100%; max-width: 400px; }
.auth__card .eyebrow {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-600);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 10px;
}
.auth__card h2 { font-size: 28px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.4px; }
.auth__card .sub { color: var(--text-muted); font-size: 14.5px; margin: 0 0 28px; }

.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 7px; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .ico {
    position: absolute; left: 14px; color: var(--text-soft);
    display: grid; place-items: center; pointer-events: none;
}
.input-wrap input {
    width: 100%;
    height: 48px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0 44px;
    font-size: 15px;
    color: var(--text);
    background: var(--surface-2);
    transition: border-color .15s, box-shadow .15s, background .15s;
    font-family: inherit;
}
.input-wrap input::placeholder { color: var(--text-soft); }
.input-wrap input:focus {
    outline: none;
    border-color: var(--brand-500);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .14);
}
.input-wrap .toggle-pwd {
    position: absolute; right: 8px;
    background: none; border: none; cursor: pointer;
    color: var(--text-soft); padding: 8px; border-radius: 6px;
    display: grid; place-items: center;
}
.input-wrap .toggle-pwd:hover { color: var(--text-muted); background: var(--bg); }

.field-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 24px; }
.checkbox { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-muted); cursor: pointer; user-select: none; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--brand-600); cursor: pointer; }
.field-row .link { font-size: 13.5px; font-weight: 600; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; height: 49px;
    border: none; border-radius: var(--radius-sm);
    background: var(--brand-grad);
    color: #fff; font-size: 15.5px; font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 22px -8px rgba(79, 70, 229, .6);
    transition: transform .08s ease, box-shadow .15s, filter .15s;
    font-family: inherit;
}
.btn:hover { filter: brightness(1.04); box-shadow: 0 14px 26px -8px rgba(79, 70, 229, .7); }
.btn:active { transform: translateY(1px); }

.alert {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13.5px;
    margin-bottom: 22px;
}
.alert svg { flex: 0 0 auto; margin-top: 1px; }
.alert ul { margin: 0; padding-left: 2px; list-style: none; }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 6px; display: block; }

.auth__signup { text-align: center; margin-top: 26px; font-size: 14px; color: var(--text-muted); }

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

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar__brand {
    display: flex; align-items: center; gap: 12px;
    padding: 22px 22px;
    font-weight: 700; font-size: 16.5px;
    border-bottom: 1px solid var(--border);
}
.sidebar__brand .mark {
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--brand-grad); color: #fff;
    display: grid; place-items: center; font-weight: 800; font-size: 15px;
    box-shadow: 0 8px 18px -6px rgba(79,70,229,.6);
}
.sidebar__brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--text-soft); }

.nav { padding: 16px 14px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; }
.nav__label { font-size: 11px; font-weight: 600; letter-spacing: .7px; text-transform: uppercase; color: var(--text-soft); padding: 14px 12px 6px; }
.nav__item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--text-muted); font-size: 14.5px; font-weight: 500;
    cursor: pointer; transition: background .12s, color .12s;
}
.nav__item:hover { background: var(--bg); color: var(--text); }
.nav__item.active { background: linear-gradient(135deg, rgba(79,70,229,.10), rgba(124,58,237,.10)); color: var(--brand-700); font-weight: 600; }
.nav__item.active .nav__ico { color: var(--brand-600); }
.nav__item.is-disabled { opacity: .55; cursor: default; }
.nav__item.is-disabled:hover { background: none; color: var(--text-muted); }
.nav__ico { display: grid; place-items: center; width: 20px; color: var(--text-soft); flex: 0 0 auto; }
.nav__badge { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--text-soft); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }

.sidebar__foot { border-top: 1px solid var(--border); padding: 14px; }

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

.topbar {
    height: 68px; flex: 0 0 68px;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 18px;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
.topbar h1 small { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-soft); margin-top: 1px; }

.searchbox { margin-left: 8px; position: relative; display: none; }
.searchbox input {
    height: 40px; width: 280px; border: 1px solid var(--border-strong);
    border-radius: 10px; background: var(--surface-2); padding: 0 14px 0 40px; font-size: 14px; font-family: inherit;
}
.searchbox input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(99,102,241,.12); background:#fff; }
.searchbox .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-soft); }

.topbar__spacer { flex: 1; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-muted); display: grid; place-items: center; cursor: pointer;
    position: relative;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-600); border: 2px solid #fff; }

.user-chip { display: flex; align-items: center; gap: 11px; padding-left: 8px; border-left: 1px solid var(--border); margin-left: 4px; }
.avatar {
    width: 38px; height: 38px; border-radius: 11px;
    background: var(--brand-grad); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 14px;
    box-shadow: 0 6px 14px -5px rgba(79,70,229,.6);
}
.user-chip .meta { line-height: 1.25; }
.user-chip .meta b { font-size: 13.5px; font-weight: 600; }
.user-chip .meta span { display: block; font-size: 11.5px; color: var(--text-soft); }
.logout-btn { background: none; border: none; color: var(--text-soft); cursor: pointer; padding: 8px; border-radius: 8px; display: grid; place-items: center; }
.logout-btn:hover { color: var(--danger); background: var(--danger-bg); }

/* Content */
.content { padding: 28px; flex: 1; }
.page-head { margin-bottom: 24px; }
.page-head h2 { font-size: 23px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.4px; }
.page-head p { color: var(--text-muted); font-size: 14.5px; margin: 0; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* Placeholder stat cards (empty starting state) */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .s-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 14px; }
.stat .s-label { font-size: 13px; color: var(--text-muted); }
.stat .s-value { font-size: 13px; color: var(--text-soft); margin-top: 6px; font-weight: 500; }
.stat .s-skel { height: 24px; width: 70%; border-radius: 7px; margin-top: 8px; background: linear-gradient(90deg, #eef0f6, #f6f7fb, #eef0f6); }

.empty-state {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    padding: 64px 32px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state .es-ico {
    width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 18px;
    background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(124,58,237,.12));
    color: var(--brand-600); display: grid; place-items: center;
}
.empty-state h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: var(--text); }
.empty-state p { margin: 0 auto; max-width: 420px; font-size: 14.5px; line-height: 1.6; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
    .auth__brand { display: none; }
}
@media (max-width: 860px) {
    .sidebar { display: none; }
}
@media (max-width: 620px) {
    .stat-grid { grid-template-columns: 1fr; }
    .user-chip .meta { display: none; }
    .content { padding: 18px; }
    .auth__form { padding: 24px; }
}

/* ============================================================
   DASHBOARD / KPI CHARTS
   ============================================================ */
.dash-toolbar { padding: 16px 18px; margin-bottom: 18px; }
.dt-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.dt-field { display: flex; flex-direction: column; gap: 6px; }
.dt-field > label { font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--text-soft); }
.dt-grow { flex: 1 1 280px; min-width: 220px; }
.dt-check { align-self: center; padding-top: 18px; }

.ctl {
    height: 40px; border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--surface-2); padding: 0 12px; font-size: 14px; font-family: inherit; color: var(--text);
    min-width: 120px; cursor: pointer;
}
.ctl:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(99,102,241,.12); background: #fff; }
.ctl-sm { height: 34px; font-size: 13px; min-width: 130px; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button {
    border: none; background: none; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-muted);
    padding: 7px 13px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.seg button.active { background: #fff; color: var(--brand-700); box-shadow: var(--shadow-sm); }

.chart-card { padding: 18px 20px 22px; margin-bottom: 18px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 38px; margin-bottom: 6px; flex-wrap: wrap; }
.crumb { display: flex; align-items: center; gap: 9px; font-size: 14.5px; }
.crumb-root { font-weight: 700; color: var(--text); }
.crumb-link { color: var(--brand-600); cursor: pointer; }
.crumb-link:hover { text-decoration: underline; }
.crumb-sep { color: var(--text-soft); }
.crumb-cur { color: var(--text-muted); font-weight: 500; }

.dd-controls { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.btn-ghost {
    height: 34px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted);
    border-radius: 9px; padding: 0 14px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: var(--brand-500); }

.chart-area { min-height: 420px; }
.chart-msg { padding: 60px 20px; text-align: center; color: var(--text-muted); font-size: 14.5px; }
.chart-hint { font-size: 12.5px; color: var(--text-soft); margin-top: 6px; }

.grid-card { padding: 18px 20px 8px; }
.grid-head h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left; padding: 9px 12px; border-bottom: 2px solid var(--border);
    color: var(--text-soft); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap;
}
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.empty { color: var(--text-soft); text-align: center; padding: 24px; }
.data-table tbody tr:hover { background: var(--surface-2); }

/* ============================================================
   KPI DASHBOARD LANDING (agency tree + KPI grid)
   ============================================================ */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--brand-600); margin-bottom: 14px; }
.back-link:hover { color: var(--brand-700); }

.dash-split { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }

.tree-card { padding: 0; overflow: hidden; position: sticky; top: 90px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; }
.tree-head { padding: 14px 18px; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-soft); border-bottom: 1px solid var(--border); }
.tree { overflow-y: auto; padding: 8px 6px 12px; flex: 1; }
.tree-ul { list-style: none; margin: 0; padding: 0; }
.tree-node { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--text); user-select: none; }
.tree-node:hover { background: var(--bg); }
.tree-node.selected { background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(124,58,237,.12)); color: var(--brand-700); font-weight: 600; }
.tree-tog { width: 16px; flex: 0 0 16px; color: var(--text-soft); font-size: 10px; text-align: center; cursor: pointer; }
.tree-tog.leaf { visibility: hidden; }
.tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-loading { padding: 16px; color: var(--text-soft); font-size: 13px; }

.grid-main { padding: 16px 18px 10px; min-width: 0; }
.grid-main-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid-main-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.grid-pager { display: flex; align-items: center; gap: 10px; }
.pginfo { font-size: 12.5px; color: var(--text-soft); }
.pgbtn { height: 32px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); border-radius: 8px; padding: 0 12px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.pgbtn:hover:not(:disabled) { background: var(--bg); color: var(--text); border-color: var(--brand-500); }
.pgbtn:disabled { opacity: .45; cursor: default; }

/* KPI grid rows */
.kpi-grid td { vertical-align: middle; }
.kpi-grid th.sortable { cursor: pointer; user-select: none; }
.kpi-grid th.sortable:hover { color: var(--brand-600); }
.kpi-grid th.sorted { color: var(--brand-600); }
.kpi-grid th .sort-arrow { font-style: normal; font-size: 10px; }
.kpi-row { cursor: pointer; }
.kpi-row:hover { background: var(--surface-2); }
.kpi-grid .c-agency { color: var(--text-muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.kpi-grid .c-cat { color: var(--text-muted); }
.kpi-grid .c-kpi { font-weight: 600; color: var(--text); }
.kpi-grid .c-kpi .unit { display: block; font-weight: 500; font-size: 11px; color: var(--text-soft); margin-top: 1px; }
.kpi-grid td.strong { font-weight: 700; }
.kpi-grid .c-status { white-space: nowrap; }

.delta { font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 600; }
.delta.up, .delta-up { color: var(--success); }
.delta.down, .delta-down { color: var(--danger); }
.delta-good { color: var(--success); }   /* move is in the KPI's good direction */
.delta-bad { color: var(--danger); }     /* move is in the bad direction (e.g. absenteeism rising) */
.delta-flat { color: var(--text-soft); } /* steady / direction-goodness unknown — neutral */
.delta.zero { color: var(--text-soft); font-weight: 500; }

.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-left: 5px; vertical-align: middle; box-shadow: 0 0 0 2px #fff; }
.dot:first-child { margin-left: 0; }
.dot-ok { background: var(--success); }
.dot-warn { background: var(--brand-500); }
.dot-bad { background: var(--danger); }
.dot-na { background: #cbd0db; }

/* Trend arrow: glyph = direction the value moved, colour = good/bad/steady (decoupled, like the legacy KPI dashboard). */
.trend { display: inline-block; font-size: 13px; font-weight: 800; line-height: 1; vertical-align: middle; margin-right: 6px; }
.trend:last-child { margin-right: 0; }
.trend-ok { color: var(--success); }
.trend-bad { color: var(--danger); }
.trend-warn { color: #f59e0b; }
.trend-na { color: var(--text-soft); }

@media (max-width: 920px) {
    .dash-split { grid-template-columns: 1fr; }
    .tree-card { position: static; max-height: 320px; }
}

/* ============================================================
   KPI SETUP WIZARD
   ============================================================ */
.setup-split { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.list-card { padding: 0; overflow: hidden; position: sticky; top: 90px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.list-head strong { font-size: 13px; letter-spacing: .4px; text-transform: uppercase; color: var(--text-soft); }
.list-search { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.kpi-list { overflow-y: auto; flex: 1; }
.kpi-li { padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.kpi-li:hover { background: var(--bg); }
.kpi-li.active { background: linear-gradient(135deg, rgba(79,70,229,.10), rgba(124,58,237,.10)); box-shadow: inset 3px 0 0 var(--brand-600); }
.kpi-li b { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.kpi-li span { display: block; font-size: 12px; color: var(--text-soft); margin-top: 1px; }
.kpi-list .grid-pager, #kpiListPager { padding: 10px 14px; border-top: 1px solid var(--border); justify-content: space-between; }

.editor { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.section-card { padding: 18px 20px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.muted { color: var(--text-soft); font-size: 12.5px; }
.form-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.form-grid .ctl { min-width: 160px; }
.form-grid .dt-grow { flex: 1 1 260px; }
.form-grid .dt-grow .ctl { width: 100%; }
.section-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.save-msg { font-size: 13px; font-weight: 600; }
.save-msg.ok { color: var(--success); }
.save-msg.err { color: var(--danger); }

.btn-primary { height: 40px; border: none; border-radius: 9px; background: var(--brand-grad); color: #fff; font-size: 14px; font-weight: 600; padding: 0 18px; cursor: pointer; font-family: inherit; box-shadow: 0 8px 18px -8px rgba(79,70,229,.6); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-sm-primary { height: 30px; border: none; border-radius: 8px; background: var(--brand-grad); color: #fff; font-size: 12.5px; font-weight: 600; padding: 0 12px; cursor: pointer; font-family: inherit; }
.btn-link { background: none; border: none; color: var(--brand-600); font-weight: 600; font-size: 13px; cursor: pointer; padding: 8px 0; font-family: inherit; }
.btn-link.danger { color: var(--danger); }
.btn-link:hover { text-decoration: underline; }

.add-agency { display: flex; gap: 10px; margin-bottom: 14px; }
.add-agency .ctl { width: auto; }
.add-agency .dt-grow { flex: 1; }

#setupsCard .table-wrap { max-height: 300px; overflow-y: auto; }
.cfg-pane { padding-top: 16px; }
.band-table th { font-size: 11px; }
.band-table td { padding: 6px 8px; }
.band-table input, .band-table select { height: 34px; border: 1px solid var(--border-strong); border-radius: 7px; padding: 0 8px; font-family: inherit; font-size: 13px; background: var(--surface-2); }
.band-table input:focus, .band-table select:focus { outline: none; border-color: var(--brand-500); }

@media (max-width: 920px) {
    .setup-split { grid-template-columns: 1fr; }
    .list-card { position: static; max-height: 360px; }
}

/* My Dashboard widget grid */
.widget-grid { display: flex; flex-wrap: wrap; gap: 18px; }
.widget-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 18px; display: flex; flex-direction: column; min-width: 0; }
.widget-card.size-100 { flex: 1 1 100%; }
.widget-card.size-50 { flex: 1 1 calc(50% - 9px); }
.widget-card.size-33 { flex: 1 1 calc(33.333% - 12px); }
.widget-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.widget-head b { font-size: 14.5px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.widget-tools .muted { font-size: 11.5px; }
.widget-tools .wsize { font-size: 12px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-soft); cursor: pointer; }
.widget-tools .wdel { width: 22px; height: 22px; line-height: 1; font-size: 17px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.widget-tools .wdel:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.widget-body { flex: 1; min-height: 280px; }
.widget-empty { padding: 70px 20px; text-align: center; color: var(--text-soft); font-size: 13.5px; }
@media (max-width: 800px) { .widget-card.size-50, .widget-card.size-33 { flex: 1 1 100%; } }

/* KPI Data Entry grid */
#worklistCard .table-wrap { max-height: 320px; overflow-y: auto; }
.entry-table input.cell-val { width: 110px; height: 34px; text-align: right; }
.entry-table input.cell-note { width: 100%; min-width: 160px; height: 34px; }
.entry-table input { border: 1px solid var(--border-strong); border-radius: 7px; padding: 0 8px; font-family: inherit; font-size: 13px; background: var(--surface-2); }
.entry-table input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(99,102,241,.12); background: #fff; }
.entry-table tr.kpi-group td { border-top: 2px solid var(--border); }
.entry-table .c-kpi { vertical-align: top; }

/* ============================================================
   Topbar user menu (dropdown: Change password / Sign out)
   ============================================================ */
.user-menu { position: relative; }
.user-chip {
    background: none; font-family: inherit; color: inherit; cursor: pointer;
    border: none; border-left: 1px solid var(--border); border-radius: 0;
    padding: 6px 6px 6px 12px;
}
.user-chip:hover .meta b { color: var(--brand-600); }
.user-chip .meta { text-align: left; }
.user-chip__chev { color: var(--text-soft); display: grid; place-items: center; transition: transform .18s ease; }
.user-menu.open .user-chip__chev { transform: rotate(180deg); }
.user-menu__panel {
    position: absolute; top: calc(100% + 10px); right: 0; min-width: 232px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 7px; z-index: 50;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.user-menu.open .user-menu__panel { opacity: 1; visibility: visible; transform: translateY(0); }
.user-menu__head { padding: 9px 11px 11px; border-bottom: 1px solid var(--border); margin-bottom: 6px; line-height: 1.3; }
.user-menu__head b { display: block; font-size: 13.5px; font-weight: 600; }
.user-menu__head span { font-size: 11.5px; color: var(--text-soft); }
.user-menu__panel form { margin: 0; }
.user-menu__item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: none; border: none; font-family: inherit; font-size: 13.5px; font-weight: 500;
    color: var(--text); text-align: left; padding: 9px 11px; border-radius: 9px; cursor: pointer;
}
.user-menu__item:hover { background: var(--bg); color: var(--text); }
.user-menu__item svg { color: var(--text-soft); flex: 0 0 auto; }
.user-menu__item--danger:hover { background: var(--danger-bg); color: var(--danger); }
.user-menu__item--danger:hover svg { color: var(--danger); }

/* Success variant of the auth alert (e.g. "password changed" on the login page) */
.alert--ok { background: #ecfdf3; border-color: #abefc6; color: #067647; }

/* ============================================================
   Change password page
   ============================================================ */
.pwd-wrap { max-width: 460px; margin: 0 auto; }
.pwd-card { padding: 26px 26px 24px; }
.pwd-card__head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 22px; }
.pwd-card__ico {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
    background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(124,58,237,.12)); color: var(--brand-600);
}
.pwd-card__head h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.pwd-card__head p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.pwd-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.pwd-actions .btn-ghost { height: 40px; display: inline-flex; align-items: center; padding: 0 16px; }
.pwd-tips { margin-top: 18px; padding: 16px 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.pwd-tips__title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); margin-bottom: 10px; }
.pwd-tips ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.pwd-tips li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-muted); }
.pwd-tips li svg { color: var(--success); flex: 0 0 auto; }

/* ============================================================
   Manage Agencies / Categories (admin)
   ============================================================ */
.req { color: var(--danger); font-weight: 700; }
.ctl-area { height: auto; min-height: 80px; padding: 9px 12px; line-height: 1.5; resize: vertical; cursor: text; width: 100%; }
.btn-xs { height: 30px; padding: 0 12px; font-size: 12.5px; }
.pager-info { font-size: 12.5px; color: var(--text-soft); }
.data-table td.cell-wrap { white-space: normal; max-width: 360px; }

/* sortable headers (generic data-table) */
.data-table th.sortable { cursor: pointer; user-select: none; position: relative; }
.data-table th.sortable:hover { color: var(--brand-600); }
.data-table th.sortable.sort-asc::after { content: " ▲"; font-size: 9px; color: var(--brand-600); }
.data-table th.sortable.sort-desc::after { content: " ▼"; font-size: 9px; color: var(--brand-600); }

/* status pill */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.6; }
.pill-ok { background: #ecfdf3; color: #067647; }
.pill-off { background: #f1f3f7; color: var(--text-muted); }

/* agency tree table */
.tree-table td { vertical-align: middle; }
.tw-cell { display: inline-flex; align-items: center; gap: 6px; }
.tw-caret { background: none; border: none; cursor: pointer; color: var(--text-soft); font-size: 11px; width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; padding: 0; font-family: inherit; }
.tw-caret:hover { background: var(--bg); color: var(--text); }
.tw-leaf { cursor: default; }
.tw-name { font-weight: 600; color: var(--text); }
.tw-actions { white-space: nowrap; }
.tw-actions .btn-link { padding: 4px 6px; font-size: 12.5px; }

/* ============================================================
   Home overview (main dashboard)
   ============================================================ */
a.stat { text-decoration: none; color: inherit; display: block; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.stat:hover { border-color: var(--brand-500); box-shadow: var(--shadow); transform: translateY(-1px); }
.stat .s-num { font-size: 27px; font-weight: 800; letter-spacing: -.6px; margin-top: 4px; color: var(--text); }

.ov-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 18px; margin-bottom: 18px; }
.snap-card, .dept-card { padding: 18px 20px; }
.snap-body { display: flex; align-items: center; gap: 20px; min-height: 210px; }
.snap-chart { width: 210px; flex: 0 0 auto; }
.snap-legend { list-style: none; margin: 0; padding: 0; flex: 1; display: grid; gap: 12px; min-width: 0; }
.snap-legend li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.lg-sw { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 auto; }
.lg-label { color: var(--text); }
.lg-val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.lg-pct { color: var(--text-soft); font-size: 12px; width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.snap-note { margin: 14px 0 0; font-size: 12px; }
.snap-hint { color: var(--text-soft); }

/* clickable legend rows + selected state */
.snap-legend li.lg-click { cursor: pointer; padding: 4px 8px; margin: -4px -8px; border-radius: 8px; transition: background .12s; outline: none; }
.snap-legend li.lg-click:hover { background: var(--bg); }
.snap-legend li.lg-click:focus-visible { box-shadow: 0 0 0 2px var(--brand-300, #a5b4fc); }
.snap-legend li.is-active { background: var(--bg); }

/* clickable department rows */
.dept-row.dept-click { cursor: pointer; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; transition: background .12s; outline: none; }
.dept-row.dept-click:hover { background: var(--bg); }
.dept-row.dept-click:focus-visible { box-shadow: 0 0 0 2px var(--brand-300, #a5b4fc); }
.dept-row.is-active { background: var(--bg); }

/* snapshot click-through detail (KPIs in the clicked bucket) */
.snap-detail { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.sd-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sd-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.sd-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.sd-meta { font-size: 12px; }
.sd-close { margin-left: auto; background: none; border: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 0 4px; border-radius: 6px; }
.sd-close:hover { background: var(--bg); color: var(--text); }
.sd-list { max-height: 320px; overflow-y: auto; display: grid; gap: 2px; margin: 0 -6px; }
.sd-empty { padding: 6px; }
.sd-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,0.9fr) auto auto; align-items: center; gap: 10px;
          padding: 7px 8px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 13px; }
.sd-row:hover { background: var(--bg); }
.sd-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-name em { font-style: normal; color: var(--text-muted); font-size: 11px; margin-left: 6px; }
.sd-agency { color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.sd-delta { font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; min-width: 56px; }
.sd-delta.up, .sd-delta.good { color: var(--success, #16a34a); }
.sd-delta.down, .sd-delta.bad { color: var(--danger, #dc2626); }
.sd-delta.zero, .sd-delta.flat { color: var(--text-soft); }

.dept-list { display: grid; gap: 13px; }
.dept-row { min-width: 0; }
.dept-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.dept-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dept-meta { font-size: 12px; color: var(--text-muted); flex: 0 0 auto; }
.dept-meta b { color: var(--success); }
.dept-bar { height: 9px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.dept-bar-fill { height: 100%; background: #e0e7ff; border-radius: 6px; position: relative; }
.dept-bar-imp { position: absolute; left: 0; top: 0; height: 100%; background: var(--success); border-radius: 6px; }

.ql-wrap { padding: 18px 20px; }
.ql-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ql-card { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); transition: border-color .15s, box-shadow .15s, transform .15s; }
.ql-card:hover { border-color: var(--brand-500); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.ql-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; box-shadow: 0 6px 14px -6px rgba(79,70,229,.5); }
.ql-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.ql-txt b { font-size: 14px; font-weight: 600; color: var(--text); }
.ql-txt span { font-size: 12px; color: var(--text-muted); }

@media (max-width: 980px) {
    .ov-grid { grid-template-columns: 1fr; }
    .ql-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .snap-body { flex-direction: column; align-items: stretch; }
    .snap-chart { width: 100%; }
    .ql-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Manage Users (form bits)
   ============================================================ */
.inline-row { display: flex; gap: 8px; align-items: center; }
.field-hint { display: block; font-size: 12px; margin-top: 5px; color: var(--text-soft); }
.field-hint.ok { color: var(--success); }
.field-hint.err { color: var(--danger); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); cursor: pointer; user-select: none; height: 40px; }
.switch input { width: 16px; height: 16px; accent-color: var(--brand-600); cursor: pointer; }
.role-block { margin-top: 18px; }
.role-block > label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--text-soft); margin-bottom: 8px; }
.role-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 9px 16px; max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; background: var(--surface-2); }
.role-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.role-item input { accent-color: var(--brand-600); cursor: pointer; flex: 0 0 auto; }

/* permission matrix (Category / Page access) */
.perm-table th.pc, .perm-table td.pc { text-align: center; width: 44px; padding: 7px 4px; }
.perm-table th.pc { font-size: 10.5px; }
.perm-table input[type=checkbox] { accent-color: var(--brand-600); cursor: pointer; }
.perm-table td { white-space: nowrap; }

/* per-page field-role assignment (Page Access) */
.fr-row { display: flex; gap: 14px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--border); }
.fr-row:last-child { border-bottom: none; }
.fr-menu { flex: 0 0 170px; font-size: 13px; font-weight: 600; color: var(--text); padding-top: 6px; }
.fr-chips { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.fr-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px 6px 3px 11px; font-size: 12.5px; }
.fr-chip button { background: none; border: none; cursor: pointer; color: var(--text-soft); font-size: 12px; line-height: 1; padding: 0 2px; }
.fr-chip button:hover { color: var(--danger); }
.fr-add { min-width: 170px; }

/* Reports */
.report-actions { display: flex; gap: 8px; align-items: center; }
.data-table th.num { text-align: right; }

/* print / PDF — show only the report content */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .app { display: block; }
    .main { margin: 0; }
    .content { padding: 0; }
    html, body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #cbd0db; }
    .data-table th { background: #eef0f6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .data-table td, .data-table th { white-space: normal; }
}

/* ============================================================
   KPI COMPARE — grid checkbox column + Compare button
   ============================================================ */
.grid-head-actions { display: flex; align-items: center; gap: 10px; }
.btn-compare {
    background: var(--brand-600); color: #fff; border: none; border-radius: 8px;
    padding: 7px 15px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn-compare:hover:not(:disabled) { background: var(--brand-700); }
.btn-compare:disabled { background: #cbd0dc; cursor: not-allowed; }
.kpi-grid th.c-chk, .kpi-grid td.c-chk { width: 36px; text-align: center; padding-left: 8px; padding-right: 4px; }
.kpi-grid .kpi-cb, .kpi-grid .kpi-cb-all { width: 16px; height: 16px; accent-color: var(--brand-600); cursor: pointer; vertical-align: middle; }
.kpi-grid tr.kpi-row { cursor: pointer; }
