/* ==========================================================
   OmniBSIC Internal Audit Console -- main stylesheet
   One shared stylesheet, no framework, no build step.

   Design direction: an internal control-room tool for a bank's
   audit function. Ink navy carries the institutional weight, a
   single brass accent marks what matters (active nav, key
   figures), and a serif is reserved for headings and numbers so
   the dense data screens still read as gravitas, not generic
   SaaS. Everything else stays quiet: hairlines over shadows,
   restrained radius, one accent spent carefully.
   ========================================================== */

/* Self-hosted fonts -- no CDN, no external request, the woff2 files ship
   in styles/fonts/ (SIL Open Font License, see the LICENSE-*.txt files
   next to them). System-font stacks stay as the fallback in --font-serif
   / --font-sans below, so the page still looks right the instant it
   loads and even if these files are ever missing. */
@font-face {
    font-family: 'Source Serif Var';
    src: url('fonts/source-serif-400.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Source Serif Var';
    src: url('fonts/source-serif-600.woff2') format('woff2');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Source Serif Var';
    src: url('fonts/source-serif-700.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Inter Var';
    src: url('fonts/inter-400.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Inter Var';
    src: url('fonts/inter-500.woff2') format('woff2');
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Inter Var';
    src: url('fonts/inter-600.woff2') format('woff2');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Inter Var';
    src: url('fonts/inter-700.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}

/* ==========================================================
   DESIGN TOKENS (v3)
   Palette is unchanged: deep indigo ink, violet accent, brass
   highlight, cool canvas. Everything below refines radii, layered
   elevation, spacing, motion and focus so components stay consistent.
   Dark mode re-maps the same tokens under :root[data-theme="dark"].
   ========================================================== */
:root {
    color-scheme: light;

    /* -- Core palette -- */
    --color-ink: #15162B;            /* sidebar, headings, primary dark */
    --color-ink-soft: #262842;       /* hover state on dark surfaces */
    --color-accent: #6C5CE7;         /* interactive violet: links, primary actions */
    --color-accent-strong: #5646D6;  /* pressed / darker accent */
    --color-accent-soft: #EEECFB;
    --color-brass: #D89B4A;          /* the one warm accent: active markers, key figures */
    --color-brass-soft: #FBF0DF;
    --color-report-accent: #1B4F8C;  /* formal blue used only in the printed audit report doc, not the app chrome */

    --color-canvas: #F6F5FB;
    --color-surface: #FFFFFF;
    --color-surface-2: #FAF9FE;      /* quiet raised/sunken surface: table heads, hovers */
    --color-border: #E5E3F0;
    --color-border-soft: #EEECF6;    /* row hairlines inside tables and lists */
    --color-border-strong: #CFCBE4;
    --color-text: #1B1B2F;
    --color-text-muted: #6E6C88;
    --color-hover: rgba(108, 92, 231, 0.06);

    --color-success: #17A673;
    --color-success-soft: #E1F7EF;
    --color-warning: #DB8A2E;
    --color-warning-soft: #FBEEDC;
    --color-danger: #E1493F;
    --color-danger-soft: #FCE8E6;

    /* -- Type -- */
    --font-serif: 'Source Serif Var', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter Var', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-display: var(--font-sans);   /* headings + big numbers; serif stays for brand/auth/landing */
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    /* -- Radius scale -- */
    --radius-xs: 6px;      /* small chips, kbd, checkboxes */
    --radius-sm: 10px;     /* inputs, buttons, menu items */
    --radius-md: 14px;     /* cards, tables, dropdowns */
    --radius-lg: 18px;     /* KPI tiles, modals, palette */
    --radius-xl: 24px;     /* hero panels */
    --radius-pill: 999px;

    /* -- Spacing scale (4px base) -- */
    --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
    --space-5: 20px; --space-6: 24px; --space-7: 32px; --space-8: 40px; --space-9: 56px;

    /* -- Layered elevation: tight contact shadow + soft ambient, tinted indigo -- */
    --shadow-xs: 0 1px 2px rgba(21, 22, 43, 0.05);
    --shadow-sm: 0 1px 2px rgba(21, 22, 43, 0.05), 0 2px 6px rgba(21, 22, 43, 0.05);
    --shadow-md: 0 2px 4px rgba(21, 22, 43, 0.04), 0 8px 20px rgba(21, 22, 43, 0.08);
    --shadow-lg: 0 4px 8px rgba(21, 22, 43, 0.04), 0 16px 36px rgba(21, 22, 43, 0.13);
    --shadow-xl: 0 8px 16px rgba(21, 22, 43, 0.06), 0 32px 64px rgba(21, 22, 43, 0.22);
    --accent-glow: rgba(108, 92, 231, 0.38);

    /* -- Motion -- */
    --ease-out: cubic-bezier(.2, .8, .2, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --dur-fast: 120ms;
    --dur: 200ms;
    --dur-slow: 320ms;

    /* -- Focus ring: accent at ~25% opacity -- */
    --ring-color: rgba(108, 92, 231, 0.25);
    --ring: 0 0 0 3px var(--ring-color);
    --ring-danger: 0 0 0 3px rgba(225, 73, 63, 0.22);
    --ring-success: 0 0 0 3px rgba(23, 166, 115, 0.22);

    /* -- Form controls -- */
    --input-h: 42px;
    --input-bg: var(--color-surface);
    --input-border: #DAD7EC;
    --input-border-hover: #B9B4DA;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E6C88' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

    /* -- Buttons -- */
    --btn-primary-from: #7A6BF0;
    --btn-primary-to: #6656E0;
    --btn-danger-from: #EA5D53;
    --btn-danger-to: #D63E34;
    --btn-success-from: #22B584;
    --btn-success-to: #139C6B;

    /* -- Glass: translucent + blurred surfaces for floating chrome -- */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: 16px;
    --glass-ink-bg: rgba(21, 22, 43, 0.86);
    --glass-ink-border: rgba(255, 255, 255, 0.08);
    --nav-bg: rgba(246, 245, 251, 0.78);
    --overlay-bg: rgba(15, 15, 34, 0.48);

    /* -- Card/table surfaces that need a theme-aware translucent tint -- */
    --card-glass-bg: rgba(255, 255, 255, 0.94);
    --kpi-glass-bg: rgba(255, 255, 255, 0.9);
    --table-head-bg: #F8F7FD;
    --table-head-bg-to: #F1F0FA;
    --row-stripe-bg: rgba(108, 92, 231, 0.028);

    /* -- Sidebar (always a dark surface, both themes) -- */
    --sb-bg-from: #1A1B36;
    --sb-bg-to: #121328;
    --sb-text: #B7B5D6;
    --sb-muted: #7C7AA4;
    --sb-border: rgba(255, 255, 255, 0.07);
    --sb-hover: rgba(255, 255, 255, 0.06);
    --sb-active: linear-gradient(90deg, rgba(140, 124, 255, 0.26), rgba(140, 124, 255, 0.10));
    --sb-icon-active: #B9AEFF;

    /* -- Layout -- */
    --sidebar-width: 252px;
    --sidebar-rail: 72px;
    --navbar-h: 60px;
    --content-pad: 28px;
    --content-max: 1560px;
    --shell-gap: 0px;      /* legacy token: the shell is docked now, kept so older rules that read it still resolve */
    --z-nav: 25;
    --z-sidebar: 30;
    --z-dropdown: 60;
    --z-modal: 300;
    --z-toast: 350;
    --z-palette: 400;
    --z-progress: 500;

    /* -- Aliases for older class names still referenced inline in a few pages -- */
    --color-primary: var(--color-ink);
    --color-primary-light: var(--color-ink-soft);
    --color-bg: var(--color-canvas);
}

/* -- Dark mode: same tokens, re-mapped, so every rule that reads a
   var(--color-*) picks it up automatically. Toggled by app.js via
   [data-theme] on <html>, persisted per-browser in localStorage. -- */
:root[data-theme="dark"] {
    color-scheme: dark;

    --color-ink: #ECEBF8;
    --color-ink-soft: #C9C7E6;
    --color-accent: #9C8CFF;
    --color-accent-strong: #B3A7FF;
    --color-accent-soft: #2A2650;
    --color-brass: #E7B476;
    --color-brass-soft: #3A2E1C;
    --color-report-accent: #4C82C4;

    --color-canvas: #101122;
    --color-surface: #181930;
    --color-surface-2: #1D1E39;
    --color-border: #2C2D4A;
    --color-border-soft: #25263F;
    --color-border-strong: #3C3D60;
    --color-text: #E7E6F5;
    --color-text-muted: #9C9AC0;
    --color-hover: rgba(156, 140, 255, 0.10);

    --color-success: #34C994;
    --color-success-soft: #163B2E;
    --color-warning: #E7A94E;
    --color-warning-soft: #3D2E14;
    --color-danger: #F0685E;
    --color-danger-soft: #3B1B18;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), 0 2px 6px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25), 0 8px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.28), 0 16px 36px rgba(0, 0, 0, 0.45);
    --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.30), 0 32px 64px rgba(0, 0, 0, 0.60);
    --accent-glow: rgba(140, 124, 255, 0.34);

    --ring-color: rgba(156, 140, 255, 0.32);
    --ring-danger: 0 0 0 3px rgba(240, 104, 94, 0.28);
    --ring-success: 0 0 0 3px rgba(52, 201, 148, 0.26);

    --input-bg: #14152B;
    --input-border: #37385C;
    --input-border-hover: #50517F;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239C9AC0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

    --btn-primary-from: #7E6FF3;
    --btn-primary-to: #6656E4;
    --btn-danger-from: #E4584E;
    --btn-danger-to: #C93A31;
    --btn-success-from: #1FAE7F;
    --btn-success-to: #12946A;

    --glass-bg: rgba(24, 25, 48, 0.72);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-ink-bg: rgba(8, 8, 18, 0.88);
    --glass-ink-border: rgba(255, 255, 255, 0.06);
    --nav-bg: rgba(16, 17, 34, 0.74);
    --overlay-bg: rgba(4, 4, 14, 0.62);

    --card-glass-bg: rgba(24, 25, 48, 0.92);
    --kpi-glass-bg: rgba(29, 30, 57, 0.88);
    --table-head-bg: #1C1D38;
    --table-head-bg-to: #202140;
    --row-stripe-bg: rgba(255, 255, 255, 0.022);

    --sb-bg-from: #0E0F22;
    --sb-bg-to: #0A0B19;
    --sb-border: rgba(255, 255, 255, 0.06);
}
:root[data-theme="dark"] .donut-chart { filter: drop-shadow(0 6px 14px rgba(0,0,0,0.4)); }


* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-canvas);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
    outline: 2px solid var(--color-brass);
    outline-offset: 2px;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; color: var(--color-ink); margin: 0 0 6px; }


/* ---------------- Content area ---------------- */

.content { padding: 24px 28px 40px; }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 { font-size: 23px; }
.page-header p { margin: 2px 0 0; color: var(--color-text-muted); font-size: 13px; }

/* ---------------- Cards / KPI tiles ---------------- */

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

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.heat-map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    margin: 10px 0 6px;
}
.heat-map-tile-link { text-decoration: none; display: block; }
.heat-map-tile {
    border-radius: var(--radius-sm);
    padding: 10px 8px;
    color: #fff;
    text-align: center;
    transition: transform .12s ease, box-shadow .12s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.heat-map-tile-link:hover .heat-map-tile { transform: translateY(-2px) scale(1.03); box-shadow: var(--shadow-sm); }
.heat-map-tile .hmt-score { font-size: 17px; font-weight: 700; line-height: 1.2; }
.heat-map-tile .hmt-label { font-size: 10.5px; font-weight: 600; opacity: .95; margin-top: 2px; line-height: 1.25; }

.kpi-tile {
    position: relative;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.75));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    padding: 18px 18px 16px;
    overflow: hidden;
    transition: box-shadow .15s ease, transform .15s ease;
}
.kpi-tile:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.kpi-tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--color-brass);
    opacity: .7;
}
.kpi-tile .kpi-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 600;
    color: var(--color-ink);
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}
.kpi-tile .kpi-value.danger { color: var(--color-danger); }
.kpi-tile .kpi-value.warning { color: var(--color-warning); }
.kpi-tile .kpi-value.success { color: var(--color-success); }
.kpi-tile .kpi-label { font-size: 11.5px; color: var(--color-text-muted); margin-top: 5px; font-weight: 500; }

.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}
.quick-link-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: block;
    transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.quick-link-card:hover {
    border-color: var(--color-brass);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
}
.quick-link-card .qlc-title { font-family: var(--font-display); font-weight: 600; color: var(--color-ink); font-size: 16px; margin-bottom: 5px; }
.quick-link-card .qlc-desc { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.5; }

/* ---------------- Tables ---------------- */

table.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
}
table.data-table th, table.data-table td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
    text-align: left;
    vertical-align: middle;
}
table.data-table th {
    background: linear-gradient(180deg, var(--color-canvas), var(--table-head-bg-to));
    color: var(--color-text-muted);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--color-border-strong);
    position: sticky;
    top: 0;
    z-index: 1;
}
table.data-table tbody tr { transition: background .12s ease; }
table.data-table tbody tr:nth-child(even) td { background: var(--row-stripe-bg); }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover td { background: var(--color-accent-soft); }

/* Full-bleed table inside a .card -- drop the card's own padding around
   just the table so header/rows reach the card edges, while everything
   else in the card (headings, pagination) keeps its normal padding. */
.table-scroll { overflow-x: auto; margin: 4px -20px -20px; }
.table-scroll table.data-table { border-left: none; border-right: none; border-bottom: none; border-radius: 0; }
@media (max-width: 600px) {
    .table-scroll { margin: 4px -12px -12px; }
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
}
.badge-open { background: var(--color-accent-soft); color: var(--color-accent); }
.badge-closed { background: var(--color-success-soft); color: var(--color-success); }
.badge-overdue { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-high { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-medium { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-low { background: var(--color-success-soft); color: var(--color-success); }

/* ---------------- Forms ---------------- */

form.stack-form { display: flex; flex-direction: column; gap: 15px; max-width: 640px; }

/* ---------------- Flash messages ---------------- */

.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    border-left: 3px solid transparent;
}
.flash-success { background: var(--color-success-soft); color: #135436; border-left-color: var(--color-success); }
.flash-error { background: var(--color-danger-soft); color: #7A251C; border-left-color: var(--color-danger); }

/* ---------------- Simple SVG chart helpers ---------------- */

.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--color-text-muted); }
.chart-legend .legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ---------------- Auth screen (login) ---------------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-ink);
    background-image:
        radial-gradient(circle at 15% 15%, rgba(216, 155, 74, 0.12), transparent 45%),
        linear-gradient(160deg, #1F2140 0%, #17182F 60%, #0F1022 100%);
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 36px 32px 30px;
    animation: authCardIn .55s cubic-bezier(.16,1,.3,1);
}
@keyframes authCardIn {
    from { opacity: 0; transform: translateY(18px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-mark {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--color-ink);
    color: var(--color-brass);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 19px;
    margin-bottom: 18px;
    animation: authMarkIn .5s cubic-bezier(.34,1.56,.64,1) .15s both;
}
@keyframes authMarkIn {
    from { opacity: 0; transform: scale(.5) rotate(-10deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
    .auth-card, .auth-mark { animation: none; }
}

.auth-card h2 { font-size: 20px; margin-bottom: 4px; }
.auth-card .auth-sub { color: var(--color-text-muted); font-size: 13px; margin: 0 0 22px; line-height: 1.5; }

/* ---------------- Reusable glass utility ---------------- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--glass-border);
}

/* ---------------- Responsive ---------------- */

/* Tablet: sidebar narrows before disappearing, grids drop to 2 columns */
@media (max-width: 1100px) {
    .three-col { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}


/* Phone: tighten spacing, stack page-header actions, scroll tables horizontally */
@media (max-width: 600px) {
    .content { padding: 12px; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header > form { flex-wrap: wrap; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi-tile .kpi-value { font-size: 26px; }
    table.data-table { display: block; overflow-x: auto; white-space: nowrap; }
    /* .audit-report-doc's tables hold multi-sentence prose (findings,
       management responses, recommendations), and nowrap on prose forces
       the whole row onto one very long unreadable line -- this was the
       "detailed exception view is not responsive" issue on the audit
       report's Section 8. Overridden back to a normal wrapping table,
       just smaller, instead of the horizontal-scroll treatment above. */
    .audit-report-doc table.data-table { display: table; white-space: normal; font-size: 12.5px; width: 100%; }
    .audit-report-doc table.data-table th, .audit-report-doc table.data-table td { padding: 6px 8px; white-space: normal; word-wrap: break-word; }
    .quick-links { grid-template-columns: 1fr; }
    .auth-card { padding: 28px 22px 24px; }
}

/* ==========================================================
   Dashboard redesign (dashboard.php) -- hero, icon KPI tiles,
   charts row, icon quick-links, paginated activity table.
   Built on the existing tokens above; no new color values.
   ========================================================== */

.icon { display: block; flex-shrink: 0; }

/* ---------------- Hero banner ---------------- */

.dash-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background-image:
        radial-gradient(circle at 85% 12%, rgba(216, 155, 74, 0.22), transparent 45%),
        linear-gradient(135deg, var(--color-ink) 0%, #23253F 55%, #0F1022 100%);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    color: #fff;
    box-shadow: var(--shadow-md);
    margin-bottom: 22px;
    overflow: hidden;
    flex-wrap: wrap;
}
.dash-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #E8C97A;
    font-weight: 600;
    margin-bottom: 6px;
}
.dash-hero h1 { color: #fff; font-size: 25px; margin-bottom: 4px; }
.dash-hero p { color: #C7D4E4; font-size: 13px; margin: 0; }
.dash-hero-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-meta-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 9px 14px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    color: #EAF0F8;
    backdrop-filter: blur(6px);
    white-space: nowrap;
}
.dash-meta-chip .icon { color: var(--color-brass); }

/* ---------------- KPI tiles: icon badge + trailing link ---------------- */

.kpi-tile { display: flex; flex-direction: column; gap: 10px; }
.kpi-tile-top { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi-icon-badge {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-accent-soft); color: var(--color-accent);
    flex-shrink: 0;
}
.kpi-icon-badge.warning { background: var(--color-warning-soft); color: var(--color-warning); }
.kpi-icon-badge.success { background: var(--color-success-soft); color: var(--color-success); }
.kpi-icon-badge.danger  { background: var(--color-danger-soft);  color: var(--color-danger); }

.kpi-tile-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    margin-top: auto;
}
.kpi-tile-link:hover { color: var(--color-ink); text-decoration: none; }
.kpi-tile-link .icon { width: 12px; height: 12px; transition: transform .15s ease; }
.kpi-tile-link:hover .icon { transform: translateX(2px); }

/* ---------------- Charts row ---------------- */

.dash-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 6px;
}
.chart-card { display: flex; flex-direction: column; }
.chart-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.chart-card-head h3 { margin: 0; font-size: 14.5px; }
.chart-card-head .chart-total { font-family: var(--font-display); font-size: 20px; color: var(--color-ink); font-weight: 600; }
.chart-card-body { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.chart-card-body > svg { flex-shrink: 0; }
.chart-card .chart-legend { flex-direction: column; gap: 8px; margin-top: 0; flex: 1; min-width: 150px; }
.chart-card .legend-item {
    font-size: 12.5px;
    color: var(--color-text);
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    background: var(--color-canvas);
    font-weight: 500;
}

/* ---------------- Quick links: icon + hover arrow ---------------- */

.quick-link-card { position: relative; display: flex; flex-direction: column; gap: 9px; padding-right: 44px; }
.qlc-icon {
    width: 38px; height: 38px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-brass-soft); color: var(--color-brass);
}
.qlc-arrow {
    position: absolute; top: 22px; right: 18px;
    display: flex;
    color: var(--color-border-strong);
    transition: transform .15s ease, color .15s ease;
}
.quick-link-card:hover .qlc-arrow { transform: translateX(3px); color: var(--color-brass); }

/* ---------------- Section headings between dashboard blocks ---------------- */

.dash-section-head { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; flex-wrap: wrap; gap: 8px; }
.dash-section-head h3 { margin: 0; color: var(--color-primary); }

/* ---------------- Activity card + table ---------------- */

.activity-card { margin-bottom: 20px; }
.activity-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.activity-row-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--color-accent-soft); color: var(--color-accent);
    flex-shrink: 0;
}
.activity-row-icon.success { background: var(--color-success-soft); color: var(--color-success); }
.activity-row-icon.warning { background: var(--color-warning-soft); color: var(--color-warning); }
.activity-row-icon.danger  { background: var(--color-danger-soft);  color: var(--color-danger); }
.activity-action-cell { display: flex; align-items: center; gap: 10px; }
.activity-action-text { display: flex; flex-direction: column; }
.activity-action-text .a-title { font-weight: 600; color: var(--color-ink); font-size: 12.8px; }
.activity-action-text .a-desc { font-size: 11.5px; color: var(--color-text-muted); }
.activity-empty { padding: 34px 10px; text-align: center; color: var(--color-text-muted); font-size: 13px; }

/* ---------------- Pagination ---------------- */

.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 32px; height: 32px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 12.5px; font-weight: 600;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}
.pagination a:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }
.pagination .current { background: var(--color-ink); color: #fff; border-color: var(--color-ink); }
.pagination .disabled { opacity: .4; pointer-events: none; }
.pagination-info { text-align: center; font-size: 11.5px; color: var(--color-text-muted); margin-top: 6px; }

/* ---------------- Responsive ---------------- */

@media (max-width: 1100px) {
    .dash-charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .dash-hero { flex-direction: column; align-items: flex-start; padding: 20px; }
    .dash-hero h1 { font-size: 21px; }
    .chart-card-body { flex-direction: column; align-items: stretch; }
    .quick-link-card { padding-right: 20px; }
    .qlc-arrow { display: none; }
}


/* ==========================================================
   Shared page-level theming for interior pages (exceptions,
   admin, calendar, etc): an icon badge in the page header, a
   clean filter-select, and a reusable pagination-friendly
   sizing for badges. Purely additive classes -- nothing here
   changes markup contracts (names, csrf fields, SQL).
   ========================================================== */

.page-header-heading { display: flex; align-items: flex-start; gap: 14px; }
.page-icon {
    width: 42px; height: 42px; flex-shrink: 0;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-brass-soft); color: var(--color-brass);
    margin-top: 2px;
}
.page-icon.accent  { background: var(--color-accent-soft); color: var(--color-accent); }
.page-icon.danger  { background: var(--color-danger-soft); color: var(--color-danger); }
.page-icon.warning { background: var(--color-warning-soft); color: var(--color-warning); }
.page-icon.success { background: var(--color-success-soft); color: var(--color-success); }

.filter-select, select.filter-select {
    padding: 9px 34px 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-strong);
    background-color: var(--color-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236E85A4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text);
    cursor: pointer;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.filter-select:hover { border-color: var(--color-accent); }
.filter-select:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar label { font-size: 12.5px; color: var(--color-text-muted); font-weight: 500; }

/* Bulk-action toolbar: appears above a list's table once >=1 row checkbox
   is ticked (tasks_list.php / exceptions_list.php / requirements_list.php).
   Reuses .filter-select / .btn so it matches the rest of the design system. */
.bulk-action-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    background: var(--color-accent-soft);
    border: 1px solid var(--color-accent);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
}
.bulk-action-bar .bulk-count { font-size: 13px; font-weight: 600; color: var(--color-ink); margin-right: 4px; }

/* Icon-only buttons used inline in tables (save/delete/toggle/refresh) get
   the same treatment as the navbar's .btn-icon, just slightly smaller. */
.btn-icon-sm {
    border: none; background: transparent; cursor: pointer;
    color: var(--color-text-muted);
    padding: 5px 7px; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .12s ease, color .12s ease;
}
.btn-icon-sm:hover { background: var(--color-canvas); color: var(--color-ink); }
.btn-icon-sm.danger:hover { background: var(--color-danger-soft); color: var(--color-danger); }

/* Standalone print-style pages (board report, 403) get a lighter glass card */
.print-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }

/* ==========================================================
   Shared polish utilities -- small button variant, an inline
   form "panel" background (replaces one-off inline styles
   scattered across training_plan.php / workpapers.php / audit
   plan & universe's add-entry forms), and fixed-column KPI/
   form grids that still collapse properly on phone width
   (a plain inline style="grid-template-columns:repeat(3,1fr)"
   can't be overridden by the .kpi-grid responsive rules below
   it, since inline styles always win -- these classes fix
   that for every page that needs more than the auto-fit default).
   ========================================================== */

.form-panel {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 14px;
    margin-bottom: 16px;
    background: var(--color-canvas);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}
.form-panel .form-row { margin-bottom: 0; }

.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

@media (max-width: 900px) {
    .kpi-grid-3, .kpi-grid-4, .kpi-grid-5 { grid-template-columns: repeat(2, 1fr); }
    .form-grid-3, .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .kpi-grid-3, .kpi-grid-4, .kpi-grid-5 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; gap: 10px; }
    .form-panel { flex-direction: column; align-items: stretch; }
}

/* A fourth risk tier, darker than .badge-high, for pages that forecast or
   rate a "Critical" band above High (risk_forecast.php) -- keeps those
   pages on the same semantic badge system instead of inline hex colors. */
.badge-critical { background: #7A1F1A; color: #FCE8E6; }
:root[data-theme="dark"] .badge-critical { background: #B23A2E; color: #FCE8E6; }

/* Search page's icon-embedded input (search.php) */
.search-input-wrap { position: relative; max-width: 600px; }
.search-input-icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: var(--color-text-muted); pointer-events: none; display: flex;
}
.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border-strong);
    font-size: 14px;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
}
.search-input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }


/* ==========================================================
   Table quick-filter + sortable headers -- client-side only,
   applied to any table[data-filterable]. No server round trip,
   no new query parameters.
   ========================================================== */
.table-toolbar {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
}
.table-toolbar .search-input-wrap { flex: 1; max-width: 360px; margin: 0; }
.table-toolbar .search-input { padding: 9px 14px 9px 40px; font-size: 13px; }
.table-toolbar .search-input-icon { left: 14px; }
.table-toolbar .table-count { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; }

table.data-table th[data-sortable] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
}
table.data-table th[data-sortable]:hover { color: var(--color-ink); }
table.data-table th[data-sortable]::after {
    content: '';
    position: absolute; right: 8px; top: 50%;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 5px solid var(--color-border-strong);
    transform: translateY(-6px);
}
table.data-table th[data-sortable].sort-asc::after {
    border-bottom: 5px solid var(--color-brass);
    border-top: none;
    transform: translateY(-6px);
}
table.data-table th[data-sortable].sort-desc::after {
    border-bottom: none;
    border-top: 5px solid var(--color-brass);
    transform: translateY(-1px);
}
table.data-table tbody tr.filtered-out { display: none; }
@media (max-width: 480px) {
    .table-toolbar { flex-direction: column; align-items: stretch; }
    .table-toolbar .search-input-wrap { max-width: none; }
    .table-toolbar .table-count { text-align: right; }
}

/* ==========================================================
   Charts v2 -- donut with center total, gradient horizontal
   bars, animated grouped columns. Rendered by includes/charts.php.
   All entrance animation is one-shot (grow/fade in on load via
   the .grown class, toggled once by app.js) -- nothing loops.
   ========================================================== */

.chart-empty { color: var(--color-text-muted); font-size: 13px; padding: 20px 0; text-align: center; }

/* -- Reveal animation primitives, shared by every chart type -- */
.chart-fade { opacity: 0; transition: opacity .55s cubic-bezier(.16,1,.3,1); }
.chart-fade.grown { opacity: 1; }
.chart-grow-x { transform: scaleX(0); transform-origin: left; transition: transform .6s cubic-bezier(.16,1,.3,1); }
.chart-grow-x.grown { transform: scaleX(1); }
.chart-grow-y { transform: scaleY(0); transform-origin: bottom; transition: transform .6s cubic-bezier(.16,1,.3,1); }
.chart-grow-y.grown { transform: scaleY(1); }
@media (prefers-reduced-motion: reduce) {
    .chart-fade, .chart-grow-x, .chart-grow-y { transition: none; opacity: 1; transform: none; }
}

/* -- Donut -- */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-chart { flex-shrink: 0; filter: drop-shadow(0 6px 14px rgba(21,22,43,0.10)); }
.donut-chart .donut-seg { transition: opacity .55s cubic-bezier(.16,1,.3,1); }
.donut-total { font-family: var(--font-display); font-weight: 700; font-size: 26px; fill: var(--color-ink); }
.donut-total-label { font-size: 10.5px; fill: var(--color-text-muted); text-transform: uppercase; letter-spacing: .06em; }
.donut-legend { flex-direction: column; gap: 9px; flex: 1; min-width: 170px; margin-top: 0; }
.donut-legend .legend-item {
    display: grid; grid-template-columns: auto 1fr auto auto;
    align-items: center; gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--color-canvas);
    font-size: 12.5px;
}
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.legend-label { color: var(--color-text); font-weight: 500; }
.legend-value { font-weight: 700; color: var(--color-ink); }
.legend-pct { color: var(--color-text-muted); font-size: 11.5px; min-width: 40px; text-align: right; }

/* -- Horizontal bars (single-series + stacked) -- */
.hbar-chart { display: flex; flex-direction: column; gap: 11px; }
.hbar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.hbar-label { width: 130px; flex-shrink: 0; text-align: right; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track {
    flex: 1; min-width: 0;
    background: var(--color-canvas);
    border-radius: var(--radius-pill);
    overflow: hidden;
    height: 24px;
    display: flex;
}
.hbar-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    display: flex; align-items: center; justify-content: flex-end;
    padding-right: 10px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.hbar-value { color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.hbar-track-stacked { display: flex; border-radius: var(--radius-pill); }
.hbar-seg { height: 100%; display: flex; align-items: center; justify-content: center; }
.hbar-seg:first-child { border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.hbar-seg:last-child { border-radius: 0 var(--radius-pill) var(--radius-pill) 0; }
.hbar-seg-value { color: #fff; font-size: 10.5px; font-weight: 700; }
.hbar-total { width: 30px; flex-shrink: 0; font-weight: 700; color: var(--color-ink); font-size: 12.5px; }

/* -- Grouped vertical columns -- */
.gcol-chart { display: flex; align-items: flex-end; gap: 16px; padding-top: 10px; position: relative; overflow-x: auto; }
.gcol-gridline { position: absolute; left: 0; right: 0; bottom: 26px; border-bottom: 1px dashed var(--color-border); }
.gcol-group { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; min-width: 40px; }
.gcol-bars { display: flex; align-items: flex-end; gap: 4px; position: relative; z-index: 1; }
.gcol-bar { width: 15px; border-radius: 5px 5px 2px 2px; }
.gcol-cat { font-size: 10.5px; color: var(--color-text-muted); margin-top: 8px; white-space: nowrap; }

/* ==========================================================
   Auth v2 -- split-screen sign-in / verify-code layout.
   Distinct from the plain centered card: a dark brand panel
   with the product story on one side, a clean light form panel
   on the other. 403.php keeps the older centered .auth-card
   style on purpose -- an error page doesn't need a brand story.
   ========================================================== */

.auth-split { min-height: 100vh; display: flex; }

.auth-brand-panel {
    flex: 1 1 45%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px 58px;
    color: #fff;
    background-image:
        radial-gradient(circle at 18% 20%, rgba(108, 92, 231, 0.32), transparent 46%),
        radial-gradient(circle at 88% 82%, rgba(216, 155, 74, 0.20), transparent 50%),
        linear-gradient(165deg, #1F2140 0%, #17182F 55%, #0F1022 100%);
}
.auth-brand-content { max-width: 420px; position: relative; z-index: 1; }
.auth-brand-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em;
    color: #E8C97A; font-weight: 700; margin-bottom: 20px;
}
.auth-brand-title { font-family: var(--font-serif); font-size: 33px; line-height: 1.2; color: #fff; margin: 0 0 16px; }
.auth-brand-desc { color: #C3C1E0; font-size: 14px; line-height: 1.65; margin: 0 0 32px; }
.auth-brand-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-brand-features li { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: #DFDEF2; }
.auth-brand-features .feat-icon {
    width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.10);
    display: flex; align-items: center; justify-content: center; color: var(--color-brass);
}

.auth-form-panel {
    flex: 1 1 55%;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-canvas);
    padding: 40px 24px;
}
.auth-form-wrap { width: 100%; max-width: 380px; animation: authCardIn .55s cubic-bezier(.16,1,.3,1); }
.auth-form-eyebrow {
    display: inline-block; font-size: 11.5px; text-transform: uppercase;
    letter-spacing: .08em; color: var(--color-accent); font-weight: 700; margin-bottom: 10px;
}
.auth-form-wrap h2 { font-size: 24px; margin-bottom: 6px; }
.auth-form-wrap .auth-sub { color: var(--color-text-muted); font-size: 13.5px; margin: 0 0 26px; line-height: 1.55; }
.auth-form-wrap .auth-mark { animation: authMarkIn .5s cubic-bezier(.34,1.56,.64,1) .15s both; }

@media (max-width: 900px) {
    .auth-split { flex-direction: column; }
    .auth-brand-panel { padding: 40px 28px 34px; min-height: 0; }
    .auth-brand-title { font-size: 24px; }
    .auth-brand-desc { margin-bottom: 20px; }
    .auth-brand-features { display: none; }
    .auth-form-panel { padding: 32px 20px 48px; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-form-wrap, .auth-form-wrap .auth-mark { animation: none; }
}



/* ==========================================================
   Risk Heat Map (risk_heatmap.php) -- CSS grid instead of a
   raw HTML table, one clear set of axis labels, visible score
   per cell, and a real empty state.
   ========================================================== */

.heatmap-intro { font-size: 13px; color: var(--color-text-muted); line-height: 1.65; max-width: 680px; margin: 0 0 22px; }
.heatmap-intro strong { color: var(--color-ink); }

.heatmap-empty-state {
    text-align: center; padding: 50px 20px;
    color: var(--color-text-muted);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.heatmap-empty-state .icon { color: var(--color-border-strong); }
.heatmap-empty-state p { margin: 0; font-size: 13.5px; }

.heatmap-outer { display: flex; gap: 6px; }
.heatmap-axis-y-label {
    writing-mode: vertical-rl; transform: rotate(180deg);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: var(--color-text-muted);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.heatmap-grid-wrap { flex: 1; overflow-x: auto; }
.heatmap-axis-x-label {
    text-align: center; margin-left: 74px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: var(--color-text-muted);
    padding-top: 8px;
}
.heatmap-grid {
    display: grid;
    grid-template-columns: 66px repeat(5, minmax(96px, 1fr));
    gap: 4px;
    min-width: 560px;
}
.heatmap-corner { }
.heatmap-col-label, .heatmap-row-label {
    display: flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 700; color: var(--color-ink);
    background: var(--color-canvas); border-radius: var(--radius-sm);
    min-height: 30px;
}
.heatmap-cell {
    border-radius: var(--radius-sm);
    padding: 10px;
    min-height: 92px;
    display: flex; flex-direction: column; gap: 3px;
    transition: transform .15s ease, box-shadow .15s ease;
    position: relative;
}
.heatmap-cell:hover { transform: scale(1.035); box-shadow: var(--shadow-md); z-index: 2; }
.heatmap-cell-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 2px; }
.heatmap-cell-count { font-family: var(--font-display); font-weight: 700; font-size: 19px; color: #33291c; }
.heatmap-cell-score { font-size: 10px; color: rgba(51,41,28,0.6); font-weight: 600; }
.heatmap-cell-item {
    display: block; font-size: 11px; color: #33291c; text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.heatmap-cell-item:hover { text-decoration: underline; }
.heatmap-cell-more { font-size: 10px; color: rgba(51,41,28,0.65); font-weight: 600; margin-top: 1px; }
.heatmap-cell-empty { color: rgba(51,41,28,0.22); font-size: 13px; margin: auto; }

@media (max-width: 700px) {
    .heatmap-outer { gap: 4px; }
    .heatmap-axis-x-label { margin-left: 50px; }
}

/* ==========================================================
   File upload dropzone -- replaces the bare native <input
   type="file">. The real input is still there (same name
   attribute, still required, still submits normally) just
   visually hidden under a styled drop area; native browsers
   already support dropping a file directly onto a file input,
   so drag-and-drop works with no extra plumbing.
   ========================================================== */
.file-drop {
    position: relative;
    border: 2px dashed var(--color-border-strong);
    border-radius: var(--radius-md);
    padding: 28px 20px;
    text-align: center;
    background: var(--color-canvas);
    transition: border-color .15s ease, background .15s ease;
}
.file-drop:hover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.file-drop.dragging { border-color: var(--color-accent); background: var(--color-accent-soft); border-style: solid; }
.file-drop.has-file { border-color: var(--color-success); border-style: solid; background: var(--color-success-soft); }
.file-drop-input {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.file-drop-icon {
    width: 42px; height: 42px; margin: 0 auto 10px;
    border-radius: 12px;
    background: var(--color-accent-soft); color: var(--color-accent);
    display: flex; align-items: center; justify-content: center;
}
.file-drop.has-file .file-drop-icon { background: var(--color-success-soft); color: var(--color-success); }
.file-drop-text { font-size: 13px; color: var(--color-text); line-height: 1.5; pointer-events: none; }
.file-drop-text strong { color: var(--color-ink); }
.file-drop-hint { display: block; font-size: 11.5px; color: var(--color-text-muted); margin-top: 2px; }
.file-drop-selected {
    display: none; align-items: center; justify-content: center; gap: 7px;
    margin-top: 12px; font-size: 12.5px; font-weight: 600; color: var(--color-success);
}
.file-drop.has-file .file-drop-selected { display: flex; }
.file-drop.has-file .file-drop-text { display: none; }

/* ==========================================================
   Calendar (calendar.php) -- CSS grid instead of a raw table,
   today-highlighting, and capped event chips so a busy day
   doesn't blow out the cell height.
   ========================================================== */

.cal-legend { margin-bottom: 14px; }
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.cal-weekday {
    font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--color-text-muted); font-weight: 700;
    padding: 6px 8px 10px;
    text-align: left;
}
.cal-day {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    min-height: 76px;
    padding: 8px;
    display: flex; flex-direction: column; gap: 6px;
    background: var(--color-surface);
    transition: box-shadow .12s ease, border-color .12s ease;
}
.cal-day:hover { box-shadow: var(--shadow-sm); }
.cal-day-empty { background: transparent; border-color: transparent; }
.cal-day-today { border-color: var(--color-accent); background: var(--color-accent-soft); box-shadow: inset 0 0 0 1px var(--color-accent); }
.cal-day-num { font-weight: 700; color: var(--color-ink); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.cal-today-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-accent); }
.cal-day-has-events { cursor: pointer; }
.cal-day-has-events:hover { border-color: var(--color-accent); }
.cal-day-has-events:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }

/* Calm day-cell indicators: one dot per event TYPE present (not per event)
   plus a compact count badge -- replaces the old always-visible event chips.
   Full detail (titles, times, links) lives in the click-through modal. */
.cal-day-dots { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.cal-dot-task { background: var(--color-accent); }
.cal-dot-req { background: #2B6CB0; }
.cal-dot-exc { background: var(--color-warning); }
.cal-dot-ext { background: var(--color-warning); }
.cal-dot-training { background: #2F855A; }
.cal-dot-plan { background: #6B46C1; }
.cal-day-badge {
    align-self: flex-start;
    font-size: 10.5px; font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-canvas);
    border-radius: 999px;
    padding: 2px 8px;
    margin-top: auto;
}
.cal-day-badge-overdue { color: var(--color-danger); background: var(--color-danger-soft); }

/* Day-breakdown modal list (populated client-side from data-cal-events). */
.cal-modal-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; }
.cal-modal-row {
    display: flex; align-items: flex-start; gap: 8px;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    text-decoration: none;
    background: var(--color-canvas);
    border: 1px solid var(--color-border);
    transition: box-shadow .12s ease;
}
.cal-modal-row:hover { text-decoration: none; box-shadow: var(--shadow-sm); }
.cal-modal-row .cal-dot { margin-top: 5px; }
.cal-modal-row-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cal-modal-row-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--color-text-muted); }
.cal-modal-row-label { font-size: 13px; color: var(--color-text); word-break: break-word; }
.cal-modal-row.cal-event-overdue .cal-modal-row-type { color: var(--color-danger); }

@media (max-width: 700px) {
    .cal-grid { gap: 4px; }
    .cal-day { min-height: 58px; padding: 6px; gap: 4px; }
    .cal-weekday { font-size: 9.5px; padding: 4px 4px 8px; text-align: center; }
    .cal-day-badge { font-size: 9.5px; padding: 1px 6px; }
}

/* ==========================================================
   Training Plan (training_plan.php) -- real tabs instead of
   three always-stacked cards, and rarely-used add/edit forms
   collapsed behind a <details> disclosure instead of always
   taking up screen space.
   ========================================================== */
.tp-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tp-tab-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font: inherit; font-size: 13px; font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.tp-tab-btn:hover { color: var(--color-ink); border-color: var(--color-accent); }
.tp-tab-btn.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.tp-panel-hidden { display: none; }

.tp-add-details { margin-bottom: 16px; }
.tp-add-summary {
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600;
    color: var(--color-accent);
    padding: 6px 2px;
    list-style: none;
}
.tp-add-summary::-webkit-details-marker { display: none; }
.tp-add-details[open] .tp-add-summary { margin-bottom: 10px; }

@media (max-width: 700px) {
    .tp-tabs { gap: 6px; }
    .tp-tab-btn { padding: 7px 12px; font-size: 12px; }
}

/* ==========================================================
   Auth v7 -- "executive" concept. Professional, not dark: uses
   the app's own institutional palette (ink navy, violet accent,
   brass highlight, serif headings) instead of a separate dark
   theme. Single centered card on a soft ivory canvas, a brass
   sweep-line as the one signature motion moment, and a live
   verification checklist instead of bullet copy. Wired into
   signin.php / verify-otp.php.
   ========================================================== */

.auth-body {
    margin: 0; min-height: 100vh;
    background:
        radial-gradient(circle at 15% 10%, rgba(108,92,231,0.06), transparent 45%),
        radial-gradient(circle at 88% 90%, rgba(216,155,74,0.08), transparent 50%),
        var(--color-canvas);
    display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
}

.auth-shell { position: relative; width: 100%; display: flex; align-items: center; justify-content: center; }

.auth-card-v7 {
    width: 100%; max-width: 440px;
    background: rgba(255,255,255,0.86);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0; transform: translateY(14px);
    animation: authCardIn7 .5s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes authCardIn7 { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .auth-card-v7 { animation: none; opacity: 1; transform: none; } }

/* -- The one signature motion: a brass/violet line that sweeps in
   above the card once, like a hairline being drawn under a signature -- */
.auth-card-v7::before {
    content: '';
    display: block; height: 3px;
    background: linear-gradient(90deg, var(--color-brass), var(--color-accent));
    transform: scaleX(0); transform-origin: left;
    animation: authSweep7 .7s cubic-bezier(.65,0,.35,1) .15s forwards;
}
@keyframes authSweep7 { to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .auth-card-v7::before { animation: none; transform: scaleX(1); } }

.auth-card-v7-inner { padding: 40px 38px 34px; }

.auth-left-top { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.auth-left-mark {
    width: 42px; height: 42px; border-radius: var(--radius-sm); flex-shrink: 0;
    background: var(--color-ink); color: var(--color-brass);
    display: flex; align-items: center; justify-content: center;
}
.auth-left-name { font-family: var(--font-serif); font-weight: 700; font-size: 16px; color: var(--color-ink); line-height: 1.3; }
.auth-left-sub { font-size: 11px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .08em; }

.auth-form-head h2 { font-size: 22px; margin-bottom: 6px; }
.auth-form-head .auth-sub { color: var(--color-text-muted); font-size: 13px; line-height: 1.55; margin: 0; }
.otp-expiry { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--color-text-muted); margin: 10px 0 4px; font-variant-numeric: tabular-nums; }

.auth-form { margin-top: 20px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--color-text); }
.input-icon-wrap { position: relative; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; display: flex; }
.auth-body .input-with-icon {
    width: 100%; padding: 11px 14px 11px 42px;
    border-radius: var(--radius-sm); border: 1px solid var(--color-border-strong);
    font-size: 14px; font-family: inherit; background: var(--color-surface); color: var(--color-text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-body .input-with-icon:focus, .auth-body .otp-box:focus {
    outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft);
}

/* -- Segmented one-time-code input -- */
.otp-boxes { display: flex; gap: 9px; justify-content: space-between; }
.otp-box {
    width: 100%; aspect-ratio: 1 / 1; max-width: 52px;
    font-family: var(--font-serif); font-size: 21px; font-weight: 700; text-align: center;
    border-radius: var(--radius-sm); border: 1px solid var(--color-border-strong);
    background: var(--color-surface); color: var(--color-ink);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.otp-box.is-filled { border-color: var(--color-brass); background: var(--color-brass-soft); transform: translateY(-1px); }
@media (max-width: 420px) { .otp-box { font-size: 17px; } .otp-boxes { gap: 6px; } }
.otp-input {
    width: 100%; padding: 13px; letter-spacing: 9px; font-size: 22px; text-align: center; font-weight: 700;
    border-radius: var(--radius-sm); border: 1px solid var(--color-border-strong);
    font-family: var(--font-serif); background: var(--color-surface); color: var(--color-ink); margin-top: 8px;
}

.auth-submit { width: 100%; justify-content: center; gap: 8px; margin-top: 20px; padding: 12px; font-size: 14px; }
.auth-trust-row { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 24px; font-size: 11.5px; color: var(--color-text-muted); }
.auth-link { font-size: 12.5px; color: var(--color-accent); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.auth-link-btn { background: none; border: none; padding: 0; font-size: 12.5px; color: var(--color-accent); cursor: pointer; font-family: inherit; }
.auth-link-btn:hover { text-decoration: underline; }
.auth-resend-form { text-align: center; margin-top: 14px; }

/* -- Live verification checklist, replaces the old boot-sequence /
   ticker gimmicks with something that reads as professional rather
   than theatrical: a short list that ticks off with real checkmarks. -- */
.auth-checklist { list-style: none; margin: 0 0 26px; padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; background: var(--color-canvas); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.auth-checklist li { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--color-text-muted); opacity: 0; animation: authCheckIn7 .3s ease forwards; }
.auth-checklist li:nth-child(1) { animation-delay: .35s; }
.auth-checklist li:nth-child(2) { animation-delay: .55s; }
.auth-checklist li:nth-child(3) { animation-delay: .75s; }
@keyframes authCheckIn7 { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: translateX(0); } }
.auth-check-icon { width: 16px; height: 16px; border-radius: 50%; background: var(--color-success-soft); color: var(--color-success); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) { .auth-checklist li { animation: none; opacity: 1; transform: none; } }

.auth-body .flash { border-radius: var(--radius-sm); }

.auth-footer-v7 { text-align: center; margin-top: 18px; font-size: 11px; color: var(--color-text-muted); }

@media (max-width: 480px) {
    .auth-card-v7-inner { padding: 32px 24px 28px; }
}

/* ---------------- Auth v7 additions: step indicator, code-box shake,
   resend cooldown, device/session info line ---------------- */

.auth-steps { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 22px; }
.auth-step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-border-strong); transition: background .2s ease, transform .2s ease; }
.auth-step-dot.is-done { background: var(--color-brass); }
.auth-step-dot.is-active { background: var(--color-accent); transform: scale(1.3); }
.auth-step-line { width: 26px; height: 1px; background: var(--color-border-strong); }
.auth-step-line.is-done { background: var(--color-brass); }
.auth-step-label { font-size: 10.5px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .06em; margin-left: 4px; }

@keyframes authShake7 {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}
.otp-boxes.is-shaking { animation: authShake7 .45s cubic-bezier(.36,.07,.19,.97); }
.otp-boxes.is-shaking .otp-box { border-color: #C0392B; }
@media (prefers-reduced-motion: reduce) { .otp-boxes.is-shaking { animation: none; } .otp-boxes.is-shaking .otp-box { border-color: #C0392B; } }

.auth-link-btn:disabled { color: var(--color-text-muted); cursor: default; }
.auth-link-btn:disabled:hover { text-decoration: none; }

.auth-device-info {
    display: flex; align-items: flex-start; gap: 8px;
    background: var(--color-canvas); border: 1px solid var(--color-border); border-radius: var(--radius-md);
    padding: 11px 13px; margin: 4px 0 18px; font-size: 11.5px; color: var(--color-text-muted); line-height: 1.55;
}
.auth-device-info .icon { flex-shrink: 0; margin-top: 1px; color: var(--color-text-muted); }
.auth-device-info strong { color: var(--color-text); font-weight: 600; }

/* ---------------- Auth v7 additions: hijack-logout notice, remaining-attempts note ---------------- */
.auth-body .flash-info { background: var(--color-accent-soft); color: var(--color-accent); border-left-color: var(--color-accent); }
.flash-note { margin-top: 6px; font-size: 11.5px; font-weight: 500; opacity: .9; }


/* ---------------- Trust-this-device checkbox + honeypot ---------------- */
.auth-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.auth-trust-check {
    display: flex; align-items: center; gap: 8px;
    margin: 14px 0 0; font-size: 12.5px; color: var(--color-text-muted); cursor: pointer;
}
.auth-trust-check input { width: 15px; height: 15px; accent-color: var(--color-accent); cursor: pointer; }

/* ==========================================================
   Add-on for audit_report.php -- append to main.css.
   Uses your existing --color-* variables, so it automatically
   matches whatever palette you're currently running (navy/brass,
   navy/violet, or anything else) instead of hardcoded hex.
   ========================================================== */
.audit-draft-banner {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--color-danger-soft);
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .03em;
}
.audit-area-row td {
    font-weight: 700;
    background: var(--color-accent-soft);
}
/* If .report-section isn't already defined (it was originally added for
   board_report.php), this gives audit_report.php's ten sections a
   consistent vertical rhythm instead of relying on bare <h3>/<p> margins. */
.audit-report-doc .report-section { margin-bottom: 32px; }
.audit-report-doc .report-section:last-child { margin-bottom: 0; }
.audit-report-doc .report-section p { text-align: justify; }
.audit-report-doc table.data-table { table-layout: fixed; word-wrap: break-word; }

/* Classification banner + logo strip shown at the top of the printed/
   on-screen report document. */
.audit-report-letterhead {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--color-report-accent);
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    background: color-mix(in srgb, var(--color-report-accent) 8%, transparent);
}
.audit-report-letterhead td {
    padding: 8px 14px;
    vertical-align: middle;
}
.audit-report-letterhead .arl-logo-cell {
    text-align: left;
    width: 1%;
    white-space: nowrap;
}
.audit-report-letterhead .arl-logo {
    display: block;
    height: 64px;
    width: auto;
}
.audit-report-letterhead .arl-classification-cell {
    text-align: right;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .06em;
    color: var(--color-report-accent);
    text-transform: uppercase;
    white-space: nowrap;
}

/* ---- Print: landscape, hide app chrome, repeat the letterhead ---- */
@media print {
    @page { size: A4 landscape; margin: 14mm; }
    .no-print, .sidebar, .navbar, .toast-stack { display: none !important; }
    body, .content { background: #fff !important; margin: 0 !important; padding: 0 !important; }
    .audit-report-doc { box-shadow: none !important; border: none !important; max-width: none !important; padding: 0 !important; }
    .audit-report-doc .report-section { page-break-inside: avoid; }
}

/* ---------------- Idle-session warning toast ---------------- */
.flash-info { background: var(--color-accent-soft); color: var(--color-accent); border-left: 3px solid var(--color-accent); }
.session-warning-toast { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.session-stay-btn {
    background: var(--color-accent); color: #fff; border: none; border-radius: var(--radius-sm);
    padding: 5px 12px; font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer; flex-shrink: 0;
}
.session-stay-btn:hover { opacity: .9; }

/* ---------------- Documentation page (documentation.php) ---------------- */

.doc-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0;
}
.doc-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 14px;
    cursor: pointer;
    transition: color .12s ease, border-color .12s ease;
}
.doc-tab-btn:hover { color: var(--color-ink); }
.doc-tab-btn.active { color: var(--color-accent); border-bottom-color: var(--color-accent); }

.doc-panel { display: none; }
.doc-panel.active { display: block; }

.doc-content {
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.7;
    max-width: 860px;
}
.doc-content h1 {
    font-size: 21px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 10px;
    margin-bottom: 16px;
}
.doc-content h2 {
    font-size: 17px;
    margin-top: 30px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
}
.doc-content h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.doc-content h3 { font-size: 14.5px; margin-top: 20px; }
.doc-content p { margin: 0 0 12px; }
.doc-content ul, .doc-content ol { margin: 0 0 14px; padding-left: 22px; }
.doc-content li { margin-bottom: 5px; }
.doc-content hr { border: none; border-top: 1px solid var(--color-border); margin: 22px 0; }
.doc-content a { color: var(--color-accent); }
.doc-content code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12.5px;
    background: var(--color-accent-soft);
    color: var(--color-ink);
    padding: 1px 5px;
    border-radius: 4px;
}
.doc-content pre {
    background: var(--color-ink);
    color: #E7E6F5;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0 0 14px;
}
.doc-content pre code { background: none; color: inherit; padding: 0; }
.doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 16px;
    font-size: 13px;
}
.doc-content th, .doc-content td {
    border: 1px solid var(--color-border);
    padding: 8px 10px;
    text-align: left;
}
.doc-content th { background: var(--color-canvas); font-weight: 700; }
.doc-content strong { color: var(--color-ink); }


/* ==========================================================
   DESIGN SYSTEM v3
   Everything from here down refines or adds to the rules above.
   Sections: 1 base, 2 shell (sidebar, navbar), 3 buttons,
   4 form controls, 5 cards / KPI / chips, 6 tables / badges /
   pagination, 7 overlays (modal, dropdown, palette, toast,
   tooltip), 8 tabs / avatar / progress / skeleton / empty state,
   9 layout primitives, 10 motion + print.
   ========================================================== */

/* ---------------- 1. Base ---------------- */

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html.theme-transition *, html.theme-transition *::before, html.theme-transition *::after {
    transition: background-color .28s ease, border-color .28s ease, color .2s ease, box-shadow .28s ease, fill .2s ease !important;
}
body {
    font-size: 14px;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}
body.has-modal, body.sidebar-open { overflow: hidden; }
::selection { background: rgba(108, 92, 231, 0.28); color: inherit; }
:root[data-theme="dark"] ::selection { background: rgba(156, 140, 255, 0.36); }

a { transition: color var(--dur-fast) var(--ease-out); }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }
:where(input, select, textarea):focus-visible { outline: none; }

h1, h2, h3, h4 { letter-spacing: -0.012em; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin-top: 0; }
kbd {
    font-family: var(--font-sans); font-size: 10.5px; font-weight: 600; line-height: 1;
    padding: 3px 6px; border-radius: var(--radius-xs);
    background: var(--color-surface); color: var(--color-text-muted);
    border: 1px solid var(--color-border-strong); border-bottom-width: 2px;
}
img, svg { max-width: 100%; }

/* Nicer scrollbars: thin, tinted, no chunky arrows */
* { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--color-border-strong); border-radius: 10px;
    border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); background-clip: content-box; }

.skip-link {
    position: fixed; left: 12px; top: -60px; z-index: 1000;
    background: var(--color-accent); color: #fff; padding: 9px 14px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 13px; transition: top var(--dur) var(--ease-out);
}
.skip-link:focus { top: 12px; text-decoration: none; outline: none; box-shadow: var(--ring); }

/* ---------------- 2. Shell: docked sidebar + glass topbar ---------------- */

.app-shell { display: flex; min-height: 100vh; }
.app-main {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--dur-slow) var(--ease-out);
    background-image: radial-gradient(900px 320px at 78% -80px, rgba(108, 92, 231, 0.075), transparent 70%);
    background-repeat: no-repeat;
}
:root[data-theme="dark"] .app-main {
    background-image: radial-gradient(900px 320px at 78% -80px, rgba(140, 124, 255, 0.10), transparent 70%);
}

.content {
    flex: 1; width: 100%; min-width: 0;
    max-width: var(--content-max); margin: 0 auto;
    padding: var(--space-6) var(--content-pad) 56px;
    background: none;
    outline: none;
    animation: pageIn .38s var(--ease-out);
}
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* -- Sidebar -- */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    padding: 0;
    display: flex; flex-direction: column; gap: 0;
    background: linear-gradient(180deg, var(--sb-bg-from) 0%, var(--sb-bg-to) 100%);
    border-right: 1px solid var(--sb-border);
    border-radius: 0;
    color: #fff;
    box-shadow: none;
    overflow: visible;
    z-index: var(--z-sidebar);
    transition: width var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out), box-shadow var(--dur-slow) var(--ease-out);
}
.sidebar::before { content: none; }

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 16px 16px 14px; min-height: var(--navbar-h); }
.brand-mark {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, #E4AC5E, #B87B32);
    color: #15162B;
    box-shadow: 0 4px 14px rgba(216, 155, 74, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
    font-family: var(--font-serif); font-weight: 600; font-size: 14.5px; line-height: 1.25;
    color: #F3F1FF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { font-size: 10px; color: var(--sb-muted); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }

/* Search / jump trigger (opens the command palette; still a real form for no-JS) */
.nav-filter-wrap {
    display: flex; align-items: center; gap: 8px; position: relative;
    margin: 0 12px 8px;
    padding: 0 10px; height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--sb-border);
    border-radius: var(--radius-sm);
    cursor: text;
    transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.nav-filter-wrap:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.13); }
.nav-filter-wrap:focus-within { border-color: rgba(156, 140, 255, 0.7); box-shadow: 0 0 0 3px rgba(156, 140, 255, 0.2); }
.nav-filter-icon { color: var(--sb-muted); display: flex; flex-shrink: 0; }
.nav-filter-input {
    flex: 1; min-width: 0; width: 100%; height: auto; min-height: 0;
    background: none; border: none; outline: none; box-shadow: none; padding: 0; border-radius: 0;
    color: #EEEDFB; font-size: 12.5px; font-family: inherit;
}
.nav-filter-input:hover, .nav-filter-input:focus { border: none; box-shadow: none; background: none; }
.nav-filter-input::placeholder { color: var(--sb-muted); }
.nav-filter-input::-webkit-search-cancel-button { display: none; }
.nav-kbd { flex-shrink: 0; background: rgba(255, 255, 255, 0.07); color: var(--sb-muted); border-color: rgba(255, 255, 255, 0.12); }

.sidebar-scroll {
    flex: 1; min-height: 0;
    overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column; gap: 2px;
    padding: 4px 10px 12px;
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 16px), transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 16px), transparent 100%);
}
.sidebar-scroll::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border: 2px solid transparent; background-clip: content-box; }
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); background-clip: content-box; }

/* Group headings (collapsible) */
.sidebar .nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.sidebar .nav-group-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
    color: var(--sb-muted);
    padding: 10px 10px 6px; margin: 0; border: none;
    cursor: pointer; user-select: none;
    border-radius: 6px;
    transition: color var(--dur-fast) var(--ease-out);
}
.sidebar .nav-group-label:hover { color: #D2D0EE; }
.sidebar .nav-group-label::after {
    content: ''; margin-left: auto; width: 12px; height: 12px; flex-shrink: 0;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    opacity: 0; transition: transform var(--dur) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.sidebar .nav-group-label:hover::after, .sidebar .nav-group.collapsed > .nav-group-label::after { opacity: .8; }
.sidebar .nav-group.collapsed > .nav-group-label::after { transform: rotate(-90deg); }
.sidebar .nav-group.collapsed > :not(.nav-group-label) { display: none; }
.sidebar.is-filtering .nav-group.collapsed > :not(.nav-group-label) { display: block; }

.sidebar .nav-section { display: flex; flex-direction: column; gap: 1px; }
.sidebar .nav-section-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 11.5px; font-weight: 600; letter-spacing: 0; text-transform: none;
    color: #9997BF;
    padding: 9px 10px 4px; margin: 0;
    border-radius: 6px;
}
.sidebar .nav-section-toggle { cursor: pointer; user-select: none; }
.sidebar .nav-section-toggle:hover { color: #E0DEF5; }
.nav-section-chevron { display: inline-flex; margin-left: auto; color: var(--sb-muted); flex-shrink: 0; transition: transform var(--dur) var(--ease-out); }
.nav-section.collapsed .nav-section-chevron { transform: rotate(-90deg); }
.nav-section.collapsed > a.nav-item { display: none; }
.nav-item-hidden { display: none !important; }

/* Nav items: pill highlight, left accent bar, icon tint, hover slide */
.sidebar a.nav-item {
    position: relative;
    display: flex; align-items: center; gap: 11px;
    min-height: 36px; padding: 6px 30px 6px 10px; margin: 0;
    border-radius: 9px;
    color: var(--sb-text);
    font-size: 13.2px; font-weight: 500; line-height: 1.3;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur) var(--ease-out);
}
.sidebar a.nav-item:hover { background: var(--sb-hover); color: #fff; text-decoration: none; transform: translateX(2px); }
.sidebar a.nav-item:active { transform: translateX(2px) scale(.985); }
.sidebar a.nav-item:focus-visible { outline: 2px solid rgba(156, 140, 255, 0.85); outline-offset: -2px; }
.sidebar a.nav-item.active { background: var(--sb-active); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(156, 140, 255, 0.16); }
.sidebar a.nav-item.active:hover { transform: none; }
.sidebar a.nav-item.active::before {
    content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
    border-radius: 0 4px 4px 0; background: var(--color-brass);
    box-shadow: 0 0 10px rgba(216, 155, 74, 0.55);
    animation: navBarIn .3s var(--ease-out);
}
@keyframes navBarIn { from { transform: scaleY(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 20px; flex-shrink: 0; }
.sidebar a.nav-item .icon { opacity: .78; transition: opacity var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur) var(--ease-out); }
.sidebar a.nav-item:hover .icon { opacity: 1; }
.sidebar a.nav-item.active .icon { opacity: 1; color: var(--sb-icon-active); }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-pin-btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: none; padding: 4px; margin: 0;
    color: var(--sb-muted); opacity: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border-radius: 6px;
    transition: opacity var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.sidebar a.nav-item:hover .nav-pin-btn, .sidebar a.nav-item:focus-within .nav-pin-btn { opacity: .75; }
.nav-pin-btn:hover { opacity: 1 !important; color: var(--color-brass); background: rgba(255, 255, 255, 0.1); }
.nav-pin-btn.pinned { opacity: 1; color: var(--color-brass); }
.nav-pin-btn.pinned svg { fill: currentColor; }
.nav-pinned-group { display: none; margin-bottom: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--sb-border); }
.nav-pinned-group.has-pins { display: flex; flex-direction: column; gap: 1px; }
.nav-pinned-group.has-pins::before {
    content: 'Pinned'; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
    color: var(--sb-muted); padding: 6px 10px 6px;
}

.sidebar-footer { flex-shrink: 0; padding: 10px 12px 12px; border-top: 1px solid var(--sb-border); }
.status-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.045); border: 1px solid var(--sb-border);
    font-size: 11.5px; color: #B9B7D8; font-weight: 500;
}
.status-dot-pulse { width: 7px; height: 7px; border-radius: 50%; background: #3FC583; flex-shrink: 0; animation: statusPulse 2.4s ease-out infinite; }
@keyframes statusPulse {
    0%   { box-shadow: 0 0 0 0 rgba(63, 197, 131, 0.55); }
    70%  { box-shadow: 0 0 0 6px rgba(63, 197, 131, 0); }
    100% { box-shadow: 0 0 0 0 rgba(63, 197, 131, 0); }
}

/* Collapse rail button on the sidebar edge (desktop) */
.sidebar-collapse-btn {
    position: absolute; top: 19px; right: -12px;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--color-surface); color: var(--color-text-muted);
    border: 1px solid var(--color-border-strong);
    display: flex; align-items: center; justify-content: center; padding: 0;
    cursor: pointer; box-shadow: var(--shadow-sm); z-index: 2;
    transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.sidebar-collapse-btn:hover { color: var(--color-accent); border-color: var(--color-accent); transform: scale(1.08); }
.sidebar-collapse-btn .icon { width: 13px; height: 13px; transition: transform var(--dur) var(--ease-out); }

/* Rail (collapsed) mode: desktop only */
@media (min-width: 901px) {
    body.sidebar-collapsed .sidebar { width: var(--sidebar-rail); }
    body.sidebar-collapsed .app-main { margin-left: var(--sidebar-rail); }
    body.sidebar-collapsed .sidebar-collapse-btn .icon { transform: rotate(180deg); }
    body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .nav-label,
    body.sidebar-collapsed .nav-section-label,
    body.sidebar-collapsed .nav-pin-btn,
    body.sidebar-collapsed .nav-kbd,
    body.sidebar-collapsed .nav-filter-input,
    body.sidebar-collapsed .status-chip span:last-child,
    body.sidebar-collapsed .sidebar-title { display: none; }
    body.sidebar-collapsed .nav-filter-wrap { justify-content: center; margin-left: 14px; margin-right: 14px; padding: 0; cursor: pointer; }
    body.sidebar-collapsed .sidebar .nav-group-label { height: 1px; padding: 0; margin: 8px 8px 8px; background: var(--sb-border); font-size: 0; cursor: default; }
    body.sidebar-collapsed .sidebar .nav-group-label::after { display: none; }
    body.sidebar-collapsed .sidebar .nav-group.collapsed > :not(.nav-group-label) { display: flex; }
    body.sidebar-collapsed .sidebar .nav-section.collapsed > a.nav-item { display: flex; }
    body.sidebar-collapsed .sidebar a.nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
    body.sidebar-collapsed .sidebar a.nav-item:hover { transform: none; }
    body.sidebar-collapsed .sidebar a.nav-item.active::before { left: -10px; }
    body.sidebar-collapsed .status-chip { justify-content: center; padding-left: 0; padding-right: 0; }
    body.sidebar-collapsed .nav-pinned-group.has-pins::before { content: ''; padding: 0; }
}

/* Mobile drawer with blurred backdrop */
.sidebar-backdrop {
    position: fixed; inset: 0; z-index: calc(var(--z-sidebar) - 1);
    background: var(--overlay-bg);
    -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
    opacity: 0; visibility: hidden;
    transition: opacity var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow);
}
@media (max-width: 900px) {
    .app-main { margin-left: 0; }
    .sidebar {
        width: min(300px, 86vw);
        transform: translateX(-104%);
        visibility: hidden;
        transition: transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow), box-shadow var(--dur-slow) var(--ease-out);
    }
    body.sidebar-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-xl); transition-delay: 0s; }
    body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; transition-delay: 0s; }
    .sidebar-collapse-btn { display: none; }
    .sidebar a.nav-item { min-height: 42px; }
    .sidebar a.nav-item .nav-pin-btn { opacity: .5; }
}

/* Rail-mode + generic tooltips are drawn by app.js (position:fixed, so the
   scrolling sidebar can't clip them). */

/* -- Topbar: blurred glass, title + breadcrumb slot -- */
.navbar {
    position: sticky; top: 0; z-index: var(--z-nav);
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    height: var(--navbar-h); padding: 0 var(--content-pad);
    margin: 0; border-radius: 0;
    background: var(--nav-bg);
    -webkit-backdrop-filter: blur(16px) saturate(1.7); backdrop-filter: blur(16px) saturate(1.7);
    border: none; border-bottom: 1px solid var(--color-border);
    box-shadow: none;
    transition: box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.navbar.is-scrolled { box-shadow: 0 6px 20px -8px rgba(21, 22, 43, 0.16); }
:root[data-theme="dark"] .navbar.is-scrolled { box-shadow: 0 6px 24px -8px rgba(0, 0, 0, 0.6); }
.navbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.navbar-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.navbar-title-wrap { display: flex; flex-direction: column; justify-content: center; line-height: 1.2; min-width: 0; }
.navbar .navbar-title {
    font-family: var(--font-display); font-weight: 650; font-size: 15px; letter-spacing: -0.012em;
    color: var(--color-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.navbar-clock { font-size: 11px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.navbar-title-wrap.has-crumbs .navbar-clock { display: none; }
/* Breadcrumb-friendly slot: app.js fills .navbar-crumbs from the active nav
   item; a page can also drop a .breadcrumb into the same spot. */
.navbar-crumbs, .breadcrumb {
    display: flex; align-items: center; gap: 4px; min-width: 0;
    font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden;
}
.navbar-crumbs .crumb-sep, .breadcrumb .crumb-sep, .breadcrumb > * + *::before { opacity: .6; }
.navbar-crumbs .crumb-sep { display: inline-flex; }
.breadcrumb { font-size: 12.5px; margin-bottom: 6px; }
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-accent); text-decoration: none; }
.breadcrumb > * + *::before { content: '/'; margin-right: 4px; }
.breadcrumb [aria-current], .breadcrumb .is-current { color: var(--color-text); font-weight: 600; }

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center; position: relative;
    width: 36px; height: 36px; padding: 0;
    border: none; background: transparent; cursor: pointer;
    color: var(--color-text-muted); font-size: 17px; line-height: 1;
    border-radius: var(--radius-sm);
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.btn-icon:hover { background: var(--color-hover); color: var(--color-accent); text-decoration: none; }
.btn-icon:active { transform: scale(.94); }
.btn-icon:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-icon .icon { display: block; }

#themeToggleBtn { position: relative; display: inline-flex; align-items: center; justify-content: center; }
#themeToggleBtn .theme-icon-dark { display: none; }
:root[data-theme="dark"] #themeToggleBtn .theme-icon-light { display: none; }
:root[data-theme="dark"] #themeToggleBtn .theme-icon-dark { display: inline-flex; }

/* Search pill: app.js adds .navbar-search + label + kbd to #navSearchBtn */
#navSearchBtn.navbar-search {
    width: auto; min-width: 200px; height: 36px; padding: 0 10px; gap: 8px; margin-right: 6px;
    justify-content: flex-start;
    background: var(--color-surface); color: var(--color-text-muted);
    border: 1px solid var(--color-border-strong); font-size: 13px; font-weight: 500;
}
#navSearchBtn.navbar-search:hover { border-color: var(--input-border-hover); color: var(--color-text); background: var(--color-surface); }
#navSearchBtn .navbar-search-label { flex: 1; text-align: left; }
#navSearchBtn .navbar-search kbd, #navSearchBtn kbd { margin-left: auto; }

.notif-btn { position: relative; }
.notif-dot {
    position: absolute; top: 2px; right: 1px;
    background: var(--color-danger); color: #fff;
    font-size: 9px; font-weight: 700; line-height: 1;
    border-radius: 999px; min-width: 16px; height: 16px; padding: 0 4px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px var(--color-canvas);
}

.user-chip {
    display: flex; align-items: center; gap: 9px; margin-left: 4px;
    padding: 3px 12px 3px 3px;
    background: transparent; border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font: inherit; text-align: left; cursor: pointer; color: inherit;
    -webkit-appearance: none; appearance: none;
    transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.user-chip:hover { background: var(--color-surface); border-color: var(--color-border); }
.user-chip:focus-visible { outline: none; box-shadow: var(--ring); }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.25; }
.user-chip-name { font-size: 12.5px; font-weight: 600; color: var(--color-ink); white-space: nowrap; }
.user-chip-role { font-size: 10.5px; color: var(--color-text-muted); white-space: nowrap; }
.status-dot { position: absolute; bottom: -1px; right: -1px; width: 9px; height: 9px; border-radius: 50%; background: #3FC583; border: 2px solid var(--color-canvas); }

@media (max-width: 900px) {
    :root { --content-pad: 18px; }
    .navbar-clock { display: none; }
    #navSearchBtn.navbar-search { min-width: 0; width: 36px; padding: 0; justify-content: center; margin-right: 0; border-color: transparent; background: transparent; }
    #navSearchBtn .navbar-search-label, #navSearchBtn kbd { display: none; }
}
@media (max-width: 600px) {
    :root { --content-pad: 16px; --navbar-h: 56px; }
    .user-chip { padding: 3px; }
    .user-chip-text { display: none; }
    .navbar-right { gap: 2px; }
    .navbar .navbar-title { font-size: 14.5px; }
}

/* ---------------- 3. Buttons ----------------
   .btn + variant: .btn-primary .btn-secondary .btn-ghost .btn-danger .btn-success
   sizes: .btn-xs .btn-sm (default 38px) .btn-lg   modifiers: .btn-block .btn-icon
   states: :disabled / [aria-disabled=true], .is-loading (spinner; app.js adds it
   to a form's submit button and blocks double submit), [data-ripple] (optional ripple). */

.btn {
    --btn-h: 38px;
    --btn-bg: var(--color-surface);
    --btn-fg: var(--color-text);
    --btn-border: var(--input-border);
    --btn-shadow: var(--shadow-xs);
    --btn-shadow-hover: var(--shadow-sm);
    --spin: var(--color-accent);
    position: relative; overflow: hidden; isolation: isolate;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--btn-h); padding: 7px 16px;
    border: 1px solid var(--btn-border); border-radius: var(--radius-sm);
    background: var(--btn-bg); color: var(--btn-fg);
    font-family: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.25; letter-spacing: -0.003em;
    text-align: center; cursor: pointer; user-select: none; -webkit-user-select: none;
    box-shadow: var(--btn-shadow);
    transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out),
                background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--btn-shadow-hover); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: var(--btn-shadow); transition-duration: 60ms; }
.btn:focus-visible { outline: none; box-shadow: var(--btn-shadow), var(--ring); }
.btn .icon, .btn svg { flex-shrink: 0; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary {
    --btn-bg: linear-gradient(180deg, var(--btn-primary-from), var(--btn-primary-to));
    --btn-fg: #fff;
    --btn-border: rgba(60, 46, 190, 0.55);
    --btn-shadow: 0 1px 2px rgba(50, 36, 170, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.20);
    --btn-shadow-hover: 0 8px 22px -4px var(--accent-glow), 0 2px 4px rgba(50, 36, 170, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    --spin: #fff;
}
.btn-primary:hover { filter: brightness(1.06) saturate(1.05); }
.btn-primary:active { filter: brightness(.96); }
.btn-secondary { --btn-bg: var(--color-surface); --btn-fg: var(--color-text); --btn-border: var(--input-border); --spin: var(--color-accent); }
.btn-secondary:hover { --btn-bg: var(--color-surface-2); --btn-border: var(--input-border-hover); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--color-text-muted); --btn-border: transparent; --btn-shadow: none; --btn-shadow-hover: none; --spin: var(--color-accent); }
.btn-ghost:hover { --btn-bg: var(--color-hover); --btn-fg: var(--color-accent); transform: none; }
.btn-ghost:focus-visible { box-shadow: var(--ring); }
.btn-danger {
    --btn-bg: linear-gradient(180deg, var(--btn-danger-from), var(--btn-danger-to));
    --btn-fg: #fff; --btn-border: rgba(160, 36, 28, 0.6);
    --btn-shadow: 0 1px 2px rgba(150, 30, 22, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    --btn-shadow-hover: 0 8px 22px -4px rgba(225, 73, 63, 0.5), 0 2px 4px rgba(150, 30, 22, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    --spin: #fff;
}
.btn-danger:hover { filter: brightness(1.05); }
.btn-danger:focus-visible { box-shadow: var(--btn-shadow), var(--ring-danger); }
.btn-success {
    --btn-bg: linear-gradient(180deg, var(--btn-success-from), var(--btn-success-to));
    --btn-fg: #fff; --btn-border: rgba(10, 110, 76, 0.6);
    --btn-shadow: 0 1px 2px rgba(10, 100, 68, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    --btn-shadow-hover: 0 8px 22px -4px rgba(23, 166, 115, 0.5), 0 2px 4px rgba(10, 100, 68, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    --spin: #fff;
}
.btn-success:hover { filter: brightness(1.05); }
.btn-success:focus-visible { box-shadow: var(--btn-shadow), var(--ring-success); }

.btn-xs { --btn-h: 26px; padding: 3px 9px; font-size: 11.5px; border-radius: 8px; gap: 5px; }
.btn-sm { --btn-h: 30px; padding: 4px 12px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-lg { --btn-h: 46px; padding: 10px 22px; font-size: 15px; border-radius: 12px; }
.btn-block { display: flex; width: 100%; }
/* Icon button: .btn-icon alone is the borderless topbar style; combine with .btn for a boxed one. */
.btn.btn-icon { width: var(--btn-h); padding: 0; color: var(--btn-fg); }
.btn.btn-icon.btn-primary { color: #fff; }
.btn.btn-icon:hover { color: var(--btn-fg); }
.btn.btn-icon.btn-ghost:hover { color: var(--color-accent); }

.btn:disabled, .btn[disabled], .btn[aria-disabled="true"], .btn.disabled {
    opacity: .5; cursor: not-allowed; pointer-events: none; transform: none; box-shadow: none; filter: grayscale(.25);
}
/* Loading: label hides, spinner draws in its place */
.btn.is-loading, .btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn.is-loading > *, .btn[aria-busy="true"] > * { opacity: 0; }
.btn.is-loading::after, .btn[aria-busy="true"]::after {
    content: ''; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
    border: 2px solid color-mix(in srgb, var(--spin) 30%, transparent); border-top-color: var(--spin);
    border-radius: 50%; animation: btnSpin .65s linear infinite;
}
.btn-lg.is-loading::after { width: 20px; height: 20px; margin: -10px 0 0 -10px; }
@keyframes btnSpin { to { transform: rotate(360deg); } }

.btn .ripple {
    position: absolute; z-index: -1; border-radius: 50%; pointer-events: none;
    background: rgba(255, 255, 255, 0.38); transform: scale(0); opacity: 1;
    animation: btnRipple .55s var(--ease-out) forwards;
}
.btn-secondary .ripple, .btn-ghost .ripple { background: var(--ring-color); }
@keyframes btnRipple { to { transform: scale(1); opacity: 0; } }

.btn-icon-sm {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    border: none; background: transparent; cursor: pointer;
    color: var(--color-text-muted); border-radius: 8px;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn-icon-sm:hover { background: var(--color-hover); color: var(--color-accent); }
.btn-icon-sm:active { transform: scale(.92); }
.btn-icon-sm:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-icon-sm.danger:hover { background: var(--color-danger-soft); color: var(--color-danger); }

.btn-group { display: inline-flex; }
.btn-group > .btn { border-radius: 0; margin-left: -1px; transform: none; }
.btn-group > .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group > .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group > .btn:hover, .btn-group > .btn:focus-visible { z-index: 1; }

/* ---------------- 4. Form controls ----------------
   Base look is applied to every bare input / select / textarea (zero
   specificity, so any page class still wins). Building blocks:
     .field                  wrapper: .field-label + control + .field-hint / .field-error
     .field-label.is-required  adds a red asterisk
     .field.is-invalid / input.is-invalid   danger border + ring; .is-valid = success
     .field-float            floating label (control needs placeholder=" " and the label AFTER it)
     .input-group            addon / icon + input: .input-icon (left icon), .input-addon (text)
     label.switch            toggle: <label class="switch"><input type="checkbox"><span class="switch-ui"></span><span>Text</span></label>
   Legacy .form-row / .stack-form keep working. */

:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="color"]), select, textarea) {
    font: inherit; font-size: 14px; line-height: 1.4;
    color: var(--color-text);
    min-height: var(--input-h); padding: 9px 13px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs);
    max-width: 100%;
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="color"]), select, textarea):hover { border-color: var(--input-border-hover); }
:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="color"]), select, textarea):focus {
    outline: none; border-color: var(--color-accent); box-shadow: var(--ring);
}
:where(input, select, textarea)::placeholder { color: var(--color-text-muted); opacity: .7; }
:where(input, select, textarea):disabled, :where(input, select, textarea)[readonly] {
    background-color: var(--color-canvas); color: var(--color-text-muted); cursor: not-allowed; box-shadow: none;
}
:where(input[readonly]) { cursor: default; }
:where(textarea) { min-height: 88px; resize: vertical; line-height: 1.5; }
/* Inline table-cell controls stay compact */
td :where(input:not([type="checkbox"], [type="radio"], [type="file"]), select), th :where(input:not([type="checkbox"], [type="radio"], [type="file"]), select) {
    min-height: 34px; padding: 5px 10px; font-size: 13px;
}

/* Custom select arrow (single selects only) */
:where(select:not([multiple], [size])) {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
    padding-right: 38px; cursor: pointer; text-overflow: ellipsis;
}
:where(select[multiple], select[size]) { padding: 6px; }
:where(select option) { background: var(--color-surface); color: var(--color-text); }

/* Date / time polish */
:where(input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], input[type="week"]) { min-width: 0; font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator, input[type="month"]::-webkit-calendar-picker-indicator {
    cursor: pointer; opacity: .55; border-radius: 6px; padding: 3px; margin-right: -4px; transition: opacity var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
input[type="date"]::-webkit-calendar-picker-indicator:hover, input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover { opacity: 1; background: var(--color-hover); }
input[type="date"]::-webkit-datetime-edit, input[type="datetime-local"]::-webkit-datetime-edit { padding: 0; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
input[type="range"] { accent-color: var(--color-accent); width: 100%; }
input[type="color"] { width: 44px; height: var(--input-h); padding: 3px; border: 1px solid var(--input-border); border-radius: var(--radius-sm); background: var(--input-bg); cursor: pointer; }

/* File input */
:where(input[type="file"]) {
    font: inherit; font-size: 13px; color: var(--color-text-muted); max-width: 100%;
    padding: 6px; background: var(--input-bg); border: 1px dashed var(--input-border); border-radius: var(--radius-sm);
    cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
:where(input[type="file"]):hover { border-color: var(--color-accent); background: var(--color-accent-soft); }
input[type="file"]::file-selector-button {
    margin-right: 12px; padding: 7px 13px; border: 0; border-radius: 8px;
    background: var(--color-accent-soft); color: var(--color-accent);
    font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
input[type="file"]:hover::file-selector-button { background: var(--color-accent); color: #fff; }

/* Checkbox + radio */
:where(input[type="checkbox"], input[type="radio"]) {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    flex-shrink: 0; width: 18px; height: 18px; min-width: 18px; min-height: 18px; margin: 0; vertical-align: -4px; /* min-* keeps legacy inline width:auto from collapsing the box */
    background: var(--input-bg) center / 78% no-repeat;
    border: 1.5px solid var(--input-border-hover);
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
:where(input[type="checkbox"]) { border-radius: 5px; }
:where(input[type="radio"]) { border-radius: 50%; }
:where(input[type="checkbox"], input[type="radio"]):hover { border-color: var(--color-accent); }
:where(input[type="checkbox"], input[type="radio"]):active { transform: scale(.92); }
:where(input[type="checkbox"], input[type="radio"]):checked, :where(input[type="checkbox"]):indeterminate {
    background-color: var(--color-accent); border-color: var(--color-accent);
}
:where(input[type="checkbox"]):checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
:where(input[type="checkbox"]):indeterminate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E"); }
:where(input[type="radio"]):checked { background-image: radial-gradient(circle, #fff 0 32%, transparent 36%); }
:where(input[type="checkbox"], input[type="radio"]):focus-visible { outline: none; box-shadow: var(--ring); }
:where(input[type="checkbox"], input[type="radio"]):disabled { opacity: .45; cursor: not-allowed; }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; user-select: none; }
.switch > input { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch-ui {
    position: relative; flex-shrink: 0; width: 38px; height: 22px; border-radius: 999px;
    background: var(--color-border-strong);
    transition: background-color var(--dur) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.switch-ui::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform var(--dur) var(--ease-spring);
}
.switch:hover .switch-ui { background: var(--input-border-hover); }
.switch > input:checked ~ .switch-ui { background: var(--color-accent); }
.switch > input:checked ~ .switch-ui::after { transform: translateX(16px); }
.switch > input:focus-visible ~ .switch-ui { box-shadow: var(--ring); }
.switch > input:disabled ~ * { opacity: .5; cursor: not-allowed; }
input[type="checkbox"].switch {
    width: 38px; height: 22px; min-width: 38px; min-height: 22px; border-radius: 999px; border: none; background: var(--color-border-strong); position: relative; vertical-align: middle;
}
input[type="checkbox"].switch::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform var(--dur) var(--ease-spring);
}
input[type="checkbox"].switch:checked { background: var(--color-accent); background-image: none; }
input[type="checkbox"].switch:checked::after { transform: translateX(16px); }

/* Check / radio rows: <label class="check"><input type="checkbox"> Label</label> */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; user-select: none; }

/* Field wrapper + labels + hints */
.field, .form-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-row { display: block; }
.form-row > label:first-child, .field-label {
    display: block; font-size: 12.5px; font-weight: 600; color: var(--color-text); margin-bottom: 6px; letter-spacing: 0;
}
.field > .field-label { margin-bottom: 0; }
.field-label.is-required::after, .is-required > .field-label::after { content: ' *'; color: var(--color-danger); }
.form-row :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"]), select, textarea),
.field :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"]), select, textarea) { width: 100%; }
.field-hint { font-size: 12px; line-height: 1.45; color: var(--color-text-muted); margin: 0; }
.field-error { display: flex; align-items: flex-start; gap: 5px; font-size: 12px; line-height: 1.45; font-weight: 500; color: var(--color-danger); margin: 0; animation: fieldErrIn var(--dur) var(--ease-out); }
.field-error[hidden] { display: none; }
@keyframes fieldErrIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* Validation states */
:where(input, select, textarea).is-invalid, :where(input, select, textarea)[aria-invalid="true"],
.is-invalid :where(input, select, textarea) {
    border-color: var(--color-danger);
}
:where(input, select, textarea).is-invalid:focus, :where(input, select, textarea)[aria-invalid="true"]:focus,
.is-invalid :where(input, select, textarea):focus { border-color: var(--color-danger); box-shadow: var(--ring-danger); }
:where(input, select, textarea).is-valid, .is-valid :where(input, select, textarea) { border-color: var(--color-success); }
:where(input, select, textarea).is-valid:focus, .is-valid :where(input, select, textarea):focus { border-color: var(--color-success); box-shadow: var(--ring-success); }
.is-invalid > .field-label { color: var(--color-danger); }

/* Floating labels */
.field-float { position: relative; display: block; }
.field-float > :where(input, select, textarea) { padding-top: 17px; padding-bottom: 5px; min-height: 48px; width: 100%; }
.field-float > textarea { padding-top: 22px; }
.field-float > label {
    position: absolute; left: 14px; top: 13px; margin: 0; max-width: calc(100% - 40px);
    font-size: 14px; font-weight: 500; color: var(--color-text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
    transform-origin: left top;
    transition: transform var(--dur) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.field-float > :where(input, textarea):focus ~ label, .field-float > :where(input, textarea):not(:placeholder-shown) ~ label, .field-float > select ~ label {
    transform: translateY(-9px) scale(.78); color: var(--color-text-muted);
}
.field-float > :where(input, select, textarea):focus ~ label { color: var(--color-accent); }
.field-float > .is-invalid ~ label { color: var(--color-danger); }

/* Input group: leading icon and/or text addons */
.input-group { position: relative; display: flex; align-items: stretch; width: 100%; }
.input-group > :where(input, select) { flex: 1; min-width: 0; width: 100%; }
.input-group > .input-icon {
    position: absolute; left: 0; top: 0; bottom: 0; width: 40px; transform: none;
    display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 1;
    color: var(--color-text-muted);
}
.input-group > .input-icon ~ :where(input, select) { padding-left: 40px; }
.input-group:focus-within > .input-icon { color: var(--color-accent); }
.input-group > .input-icon.is-right { left: auto; right: 0; }
.input-group > .input-icon.is-right ~ :where(input, select) { padding-left: 13px; padding-right: 40px; }
.input-group > .input-addon {
    display: flex; align-items: center; padding: 0 13px; white-space: nowrap;
    background: var(--color-surface-2); color: var(--color-text-muted); font-size: 13px; font-weight: 500;
    border: 1px solid var(--input-border);
}
.input-group > .input-addon:first-child { border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > .input-addon:last-child { border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group > .input-addon:first-child + :where(input, select) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > :where(input, select):has(+ .input-addon:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > :where(input, select):focus { position: relative; z-index: 2; }
/* Legacy auth input-with-icon wrapper keeps its own rules */
.input-icon-wrap { position: relative; }

/* Legacy filter select / search input restyled to match */
.filter-select, select.filter-select {
    min-height: 38px; padding: 7px 34px 7px 13px; border-radius: var(--radius-sm);
    border: 1px solid var(--input-border); background-color: var(--input-bg);
    background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
    font-size: 13px; font-weight: 500; box-shadow: var(--shadow-xs); color: var(--color-text);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.filter-select:hover { border-color: var(--input-border-hover); }
.filter-select:focus { outline: none; border-color: var(--color-accent); box-shadow: var(--ring); }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar label { font-size: 12.5px; color: var(--color-text-muted); font-weight: 500; }

.search-input-wrap { position: relative; max-width: 600px; }
.search-input-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; display: flex; }
.search-input {
    width: 100%; min-height: var(--input-h); padding: 9px 14px 9px 40px;
    border-radius: var(--radius-sm); border: 1px solid var(--input-border);
    font-size: 14px; font-family: inherit; background: var(--input-bg); color: var(--color-text); box-shadow: var(--shadow-xs);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.search-input:hover { border-color: var(--input-border-hover); }
.search-input:focus { outline: none; border-color: var(--color-accent); box-shadow: var(--ring); }
.search-input-wrap:focus-within .search-input-icon { color: var(--color-accent); }

/* Auth v7 inputs: same ring */
.auth-body .input-with-icon:focus, .auth-body .otp-box:focus { box-shadow: var(--ring); }
.auth-trust-check input[type="checkbox"] { width: 16px; height: 16px; }

form.stack-form { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.form-section-label {
    display: flex; align-items: center; gap: 10px; margin-top: 8px;
    font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-accent);
}
.form-section-label::after { content: ''; flex: 1; height: 1px; background: var(--color-border); }
.stack-form > .form-section-label:first-child, .stack-form > input[type="hidden"] + .form-section-label { margin-top: 0; }

@media (max-width: 600px) {
    /* 16px controls stop iOS Safari from zooming the page on focus */
    :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="color"]), select, textarea) { font-size: 16px; }
    td :where(input:not([type="checkbox"], [type="radio"], [type="file"]), select) { font-size: 14px; }
}

/* ---------------- 5. Cards, KPI tiles, chips ----------------
   .card                     surface; add .card-hover (interactive lift), .card-flush (no padding), .card-accent (top hairline)
   .card-header              title + actions row: <div class="card-header"><div><h3 class="card-title">..</h3><p class="card-subtitle">..</p></div><div class="card-actions">..</div></div>
   .card-footer              bordered footer strip
   .kpi-tile                 stat tile (.kpi-icon-badge chip, .kpi-value, .kpi-label, .kpi-trend)
   .kpi-trend / .trend       trend chip: add .up .down .flat
   .stat-chip                inline label + value pill: .success .warning .danger .neutral */

.card {
    position: relative;
    background: var(--card-glass-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    padding: var(--space-5);
    overflow: visible;
    transition: box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.card::before { content: none; }
.card:hover { box-shadow: var(--shadow-sm); }
.card-hover { cursor: pointer; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--color-border-strong); }
.card-flush { padding: 0; }
.card-accent::before { content: ''; position: absolute; top: -1px; left: 16px; right: 16px; height: 2px; border-radius: 0 0 4px 4px; background: linear-gradient(90deg, var(--color-brass), var(--color-accent)); }
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.card-header > div:first-child { min-width: 0; }
.card-title { font-size: 15px; font-weight: 650; margin: 0; color: var(--color-ink); }
.card-subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--color-text-muted); }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-footer { margin: var(--space-4) calc(var(--space-5) * -1) calc(var(--space-5) * -1); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border); background: var(--color-surface-2); border-radius: 0 0 var(--radius-md) var(--radius-md); }
.card-flush > .card-header { padding: var(--space-4) var(--space-5) 0; }

.glass {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3); backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--glass-border);
}

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.kpi-tile {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; gap: 8px; min-width: 0;
    background: var(--kpi-glass-bg);
    border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    padding: 18px 18px 16px;
    transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
    animation: tileIn .5s var(--ease-out) backwards;
}
.kpi-grid > .kpi-tile:nth-child(2) { animation-delay: 40ms; }
.kpi-grid > .kpi-tile:nth-child(3) { animation-delay: 80ms; }
.kpi-grid > .kpi-tile:nth-child(4) { animation-delay: 120ms; }
.kpi-grid > .kpi-tile:nth-child(5) { animation-delay: 160ms; }
.kpi-grid > .kpi-tile:nth-child(n+6) { animation-delay: 200ms; }
@keyframes tileIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.kpi-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--color-border-strong); }
.kpi-tile::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; opacity: .55;
    background: linear-gradient(90deg, var(--color-accent), color-mix(in srgb, var(--color-accent) 35%, var(--color-brass)));
    transform-origin: left; transition: opacity var(--dur) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.kpi-tile:hover::before { opacity: 1; }
.kpi-tile::after {
    content: ''; position: absolute; top: 0; right: 0; width: 140px; height: 110px; pointer-events: none; opacity: .5;
    background: radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--color-accent) 16%, transparent), transparent 70%);
}
.kpi-tile:has(.kpi-value.success)::before, .kpi-tile:has(.kpi-icon-badge.success)::before { background: linear-gradient(90deg, var(--color-success), color-mix(in srgb, var(--color-success) 40%, transparent)); }
.kpi-tile:has(.kpi-value.success)::after, .kpi-tile:has(.kpi-icon-badge.success)::after { background: radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--color-success) 16%, transparent), transparent 70%); }
.kpi-tile:has(.kpi-value.warning)::before, .kpi-tile:has(.kpi-icon-badge.warning)::before { background: linear-gradient(90deg, var(--color-warning), color-mix(in srgb, var(--color-warning) 40%, transparent)); }
.kpi-tile:has(.kpi-value.warning)::after, .kpi-tile:has(.kpi-icon-badge.warning)::after { background: radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--color-warning) 18%, transparent), transparent 70%); }
.kpi-tile:has(.kpi-value.danger)::before, .kpi-tile:has(.kpi-icon-badge.danger)::before { background: linear-gradient(90deg, var(--color-danger), color-mix(in srgb, var(--color-danger) 40%, transparent)); }
.kpi-tile:has(.kpi-value.danger)::after, .kpi-tile:has(.kpi-icon-badge.danger)::after { background: radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--color-danger) 16%, transparent), transparent 70%); }
.kpi-tile > * { position: relative; z-index: 1; }
.kpi-tile .kpi-value {
    font-family: var(--font-display); font-size: 30px; font-weight: 650; letter-spacing: -0.03em;
    color: var(--color-ink); line-height: 1.05; font-variant-numeric: tabular-nums;
}
.kpi-tile .kpi-value.danger { color: var(--color-danger); }
.kpi-tile .kpi-value.warning { color: var(--color-warning); }
.kpi-tile .kpi-value.success { color: var(--color-success); }
.kpi-tile .kpi-label { font-size: 12px; color: var(--color-text-muted); margin-top: 0; font-weight: 500; }
.kpi-tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kpi-icon-badge {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-accent-soft); color: var(--color-accent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 12%, transparent);
    transition: transform var(--dur) var(--ease-spring);
}
.kpi-tile:hover .kpi-icon-badge { transform: scale(1.08) rotate(-4deg); }
.kpi-tile-link { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--color-text-muted); margin-top: auto; }
.kpi-tile-link:hover { color: var(--color-accent); text-decoration: none; }

.kpi-trend, .trend {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: var(--radius-pill);
    font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.4;
    background: var(--color-canvas); color: var(--color-text-muted);
}
.kpi-trend.up, .trend.up { background: var(--color-success-soft); color: var(--color-success); }
.kpi-trend.down, .trend.down { background: var(--color-danger-soft); color: var(--color-danger); }
.kpi-trend.flat, .trend.flat { background: var(--color-canvas); color: var(--color-text-muted); }
.kpi-trend.up::before, .trend.up::before { content: '\2191'; }
.kpi-trend.down::before, .trend.down::before { content: '\2193'; }
.kpi-trend.flat::before, .trend.flat::before { content: '\2192'; }

.stat-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 500; line-height: 1.4; white-space: nowrap;
    background: var(--color-accent-soft); color: var(--color-accent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 14%, transparent);
}
.stat-chip b, .stat-chip strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-chip.success { background: var(--color-success-soft); color: var(--color-success); }
.stat-chip.warning { background: var(--color-warning-soft); color: var(--color-warning); }
.stat-chip.danger { background: var(--color-danger-soft); color: var(--color-danger); }
.stat-chip.neutral { background: var(--color-canvas); color: var(--color-text-muted); }

.quick-link-card {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow-xs);
    transition: box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.quick-link-card:hover { border-color: var(--color-accent); box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.quick-link-card .qlc-title { letter-spacing: -0.01em; }
.qlc-icon { background: var(--color-accent-soft); color: var(--color-accent); }
.quick-link-card:hover .qlc-arrow { color: var(--color-accent); }

.dash-hero { border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.dash-hero h1 { letter-spacing: -0.025em; }
.dash-meta-chip { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.chart-card .legend-item { border-radius: var(--radius-sm); }
.donut-legend .legend-item { border-radius: var(--radius-sm); }
.dash-section-head h3 { letter-spacing: -0.012em; }

/* Flash banners (server-rendered fallback; app.js upgrades them to toasts) */
.flash {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
    font-size: 13px; line-height: 1.5; border: 1px solid transparent; border-left-width: 3px;
}
.flash-success { background: var(--color-success-soft); color: #135436; border-color: color-mix(in srgb, var(--color-success) 25%, transparent); border-left-color: var(--color-success); }
.flash-error { background: var(--color-danger-soft); color: #7A251C; border-color: color-mix(in srgb, var(--color-danger) 25%, transparent); border-left-color: var(--color-danger); }
.flash-warning { background: var(--color-warning-soft); color: #6B4210; border-color: color-mix(in srgb, var(--color-warning) 28%, transparent); border-left-color: var(--color-warning); }
.flash-info { background: var(--color-accent-soft); color: var(--color-accent); border-color: color-mix(in srgb, var(--color-accent) 25%, transparent); border-left-color: var(--color-accent); }
:root[data-theme="dark"] .flash-success { color: #7FE0BB; }
:root[data-theme="dark"] .flash-error { color: #FFA9A2; }
:root[data-theme="dark"] .flash-warning { color: #F1C486; }

/* ---------------- 6. Tables, badges, pagination ----------------
   table.data-table          rounded wrapper, sticky header, row hover.
   modifiers: .is-dense (or body.dense-tables), .is-zebra, th/td.num (right aligned numbers)
   .table-scroll             horizontal scroll wrapper (unchanged); add .is-sticky for an inner-scroll region with a pinned header
   badges: .badge + .badge-open/closed/overdue/high/medium/low/critical, or generic
   .badge-success/.warning/.danger/.info/.accent/.neutral; add .badge-dot for a dot on any badge */

table.data-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    overflow: hidden; overflow: clip;
    box-shadow: var(--shadow-xs);
}
table.data-table th, table.data-table td {
    padding: 12px 16px; text-align: left; vertical-align: middle;
    font-size: 13px; border-bottom: 1px solid var(--color-border-soft);
}
table.data-table th {
    position: sticky; top: 0; z-index: 2;
    background: var(--table-head-bg);
    color: var(--color-text-muted);
    font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
    padding-top: 11px; padding-bottom: 11px;
    border-bottom: 1px solid var(--color-border);
}
@media (min-width: 601px) {
    table.data-table th { top: var(--navbar-h); }
    .table-scroll table.data-table th { top: 0; }
}
/* A table inside any scrolling box (marked by app.js) pins its heading to that box, never to the page: otherwise the heading is pushed down over the first rows */
table.data-table.in-scroller th, table.data-table.is-overflowing th { top: 0; }
table.data-table tbody tr { transition: background-color var(--dur-fast) var(--ease-out); }
table.data-table tbody tr:nth-child(even) td { background: transparent; }
table.data-table.is-zebra tbody tr:nth-child(even) td { background: var(--row-stripe-bg); }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover td { background: var(--color-hover); }
table.data-table tbody tr:has(input[type="checkbox"]:checked) td { background: color-mix(in srgb, var(--color-accent) 8%, transparent); }
table.data-table td.num, table.data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table td a { font-weight: 500; }
table.data-table.is-dense th, table.data-table.is-dense td, body.dense-tables table.data-table th, body.dense-tables table.data-table td { padding-top: 7px; padding-bottom: 7px; font-size: 12.5px; }
table.data-table th:has(input[type="checkbox"]), table.data-table td:has(input[type="checkbox"]:only-child) { width: 44px; padding-right: 8px; }
table.data-table.is-overflowing { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; }

.table-scroll { overflow-x: auto; margin: 4px calc(var(--space-5) * -1) calc(var(--space-5) * -1); -webkit-overflow-scrolling: touch; }
.table-scroll table.data-table { border-left: none; border-right: none; border-bottom: none; border-radius: 0; box-shadow: none; }
.card > .table-scroll:last-child { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.table-scroll.is-sticky { max-height: min(74vh, 780px); overflow-y: auto; }
.card-flush > .table-scroll { margin: 0; }

/* Sort affordance: a quiet chevron pair that lights up when active */
table.data-table th[data-sortable] { cursor: pointer; user-select: none; padding-right: 26px; position: sticky; transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out); }
table.data-table th[data-sortable]:hover { color: var(--color-ink); background: var(--table-head-bg-to); }
table.data-table th[data-sortable]::after {
    content: ''; position: absolute; right: 9px; top: 50%; width: 9px; height: 13px; margin-top: -6px;
    border: none; transform: none; opacity: .35;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 13'%3E%3Cpath d='M4.5 1 8 5H1zM4.5 12 1 8h7z'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 13'%3E%3Cpath d='M4.5 1 8 5H1zM4.5 12 1 8h7z'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: opacity var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
table.data-table th[data-sortable]:hover::after { opacity: .7; }
table.data-table th[data-sortable].sort-asc, table.data-table th[data-sortable].sort-desc { color: var(--color-accent); }
table.data-table th[data-sortable].sort-asc::after, table.data-table th[data-sortable].sort-desc::after { opacity: 1; border: none; transform: none; }
table.data-table th[data-sortable].sort-asc::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 13'%3E%3Cpath d='M4.5 3 8 8H1z'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 13'%3E%3Cpath d='M4.5 3 8 8H1z'/%3E%3C/svg%3E");
}
table.data-table th[data-sortable].sort-desc::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 13'%3E%3Cpath d='M4.5 10 1 5h7z'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 13'%3E%3Cpath d='M4.5 10 1 5h7z'/%3E%3C/svg%3E");
}
table.data-table tbody tr.filtered-out { display: none; }

.table-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.table-toolbar .search-input-wrap { flex: 1; max-width: 360px; min-width: 0; margin: 0; }
.table-toolbar .search-input { min-height: 36px; padding: 7px 12px 7px 36px; font-size: 13px; }
.table-toolbar .search-input-icon { left: 12px; }
.table-toolbar .table-count { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; margin-left: auto; font-variant-numeric: tabular-nums; }
.table-density-btn { flex-shrink: 0; }
.table-toolbar.is-flush { padding: 14px var(--space-5) 0; }
.pager-wrap.is-flush { padding: 0 var(--space-5) var(--space-4); }
@media (max-width: 600px) { .table-toolbar.is-flush { padding: 12px var(--space-4) 0; } .pager-wrap.is-flush { padding: 0 var(--space-4) var(--space-3); } }
.table-density-btn.is-on { color: var(--color-accent); background: var(--color-accent-soft); }
@media (max-width: 480px) {
    .table-toolbar .search-input-wrap { max-width: none; flex-basis: 100%; }
}

/* Badges / status pills */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px; border-radius: var(--radius-pill);
    font-size: 11.5px; font-weight: 600; line-height: 1.55; white-space: nowrap; letter-spacing: .005em;
    background: var(--color-canvas); color: var(--color-text-muted);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent);
}
.badge-open::before, .badge-closed::before, .badge-overdue::before, .badge-high::before, .badge-medium::before,
.badge-low::before, .badge-critical::before, .badge-dot::before, .badge-success::before, .badge-warning::before,
.badge-danger::before, .badge-info::before, .badge-accent::before, .badge-neutral::before, .pill::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0;
}
.badge-open, .badge-info, .badge-accent { background: var(--color-accent-soft); color: var(--color-accent); }
.badge-closed, .badge-low, .badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-overdue, .badge-high, .badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-medium, .badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-neutral { background: var(--color-canvas); color: var(--color-text-muted); }
.badge-brass { background: var(--color-brass-soft); color: var(--color-brass); }
.badge-critical { background: #7A1F1A; color: #FCE8E6; box-shadow: none; }
:root[data-theme="dark"] .badge-critical { background: #B23A2E; color: #FCE8E6; }
.badge-overdue::before, .badge-high::before, .badge-critical::before { animation: dotPulse 2.4s ease-out infinite; }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 50%, transparent); } 70% { box-shadow: 0 0 0 5px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: var(--space-4); flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 32px; height: 32px; padding: 0 9px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--color-text);
    border: 1px solid var(--color-border); background: var(--color-surface); cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.pagination a:hover { border-color: var(--color-accent); color: var(--color-accent); background: var(--color-accent-soft); text-decoration: none; }
.pagination a:active { transform: scale(.94); }
.pagination .current { background: linear-gradient(180deg, var(--btn-primary-from), var(--btn-primary-to)); color: #fff; border-color: transparent; box-shadow: 0 2px 8px -2px var(--accent-glow); cursor: default; }
.pagination .disabled { opacity: .4; pointer-events: none; }
.pagination-info { text-align: center; font-size: 11.5px; color: var(--color-text-muted); margin-top: 8px; }

.bulk-action-bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    background: var(--color-accent-soft); border: 1px solid color-mix(in srgb, var(--color-accent) 40%, transparent);
    border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px;
    animation: pageIn var(--dur) var(--ease-out);
}
.bulk-action-bar .bulk-count { font-size: 13px; font-weight: 600; color: var(--color-ink); margin-right: 4px; }
.form-panel { background: var(--color-surface-2); border-radius: var(--radius-md); }

/* ---------------- 7. Overlays ----------------
   Modal:    .modal-overlay(.open) > .modal-box | .modal-panel   (+ .modal-lg / .modal-sm)
             parts: .modal-header (.modal-title, .modal-close) .modal-body .modal-footer / .modal-actions
             JS: omni.openModal(el|selector), omni.closeModal(el), [data-modal-open="#id"], [data-modal-close]
   Dropdown: .dropdown > [data-dropdown-toggle] + .dropdown-menu (items: .dropdown-item, .dropdown-divider)
   Toast:    window.toast(message, type, opts) with type success | error | warning | info
   Tooltip:  any element with data-tip="text" (optional data-tip-pos="top|bottom|left|right")
   Palette:  Ctrl/Cmd+K, built from the sidebar links (app.js) */

.modal-overlay {
    position: fixed; inset: 0; z-index: var(--z-modal);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: var(--overlay-bg);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    opacity: 0; visibility: hidden;
    transition: opacity var(--dur) var(--ease-out), visibility 0s linear var(--dur);
}
.modal-overlay.open { opacity: 1; visibility: visible; transition-delay: 0s; }
.modal-box, .modal-panel {
    position: relative; width: 100%;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    transform: translateY(14px) scale(.96); opacity: 0;
    transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur) var(--ease-out);
}
.modal-overlay.open .modal-box, .modal-overlay.open .modal-panel { transform: none; opacity: 1; }
.modal-box { max-width: 400px; padding: 26px 24px 20px; }
.modal-panel { max-width: 540px; padding: 24px; max-height: min(88vh, 900px); overflow-y: auto; }
.modal-lg { max-width: 780px; }
.modal-sm { max-width: 340px; }
.modal-icon {
    width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-danger-soft); color: var(--color-danger);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--color-danger) 8%, transparent);
}
.modal-icon.accent { background: var(--color-accent-soft); color: var(--color-accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--color-accent) 8%, transparent); }
.modal-title { font-size: 16px; font-weight: 650; letter-spacing: -0.012em; color: var(--color-ink); margin: 0 0 6px; }
.modal-message { font-size: 13.5px; color: var(--color-text-muted); line-height: 1.6; margin: 0 0 22px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: var(--space-4); }
.modal-header .modal-title { margin: 0; font-size: 17px; }
.modal-close { flex-shrink: 0; margin: -6px -8px 0 0; }
.modal-body { font-size: 13.5px; }
.modal-footer, .modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-footer { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
dialog.modal { padding: 24px; max-width: min(540px, calc(100vw - 32px)); width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-xl); }
dialog.modal[open] { animation: modalIn var(--dur-slow) var(--ease-out); }
dialog.modal::backdrop { background: var(--overlay-bg); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* Dropdown menus (generic + the navbar's notification / user panels) */
.dropdown, .dropdown-wrap { position: relative; }
.dropdown-panel, .dropdown-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: var(--z-dropdown);
    width: 300px; max-width: calc(100vw - 24px); padding: 6px;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: top right;
    transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur) var(--ease-out), visibility 0s linear var(--dur);
    overflow: hidden;
}
.dropdown-menu { width: auto; min-width: 190px; }
.dropdown-menu.is-left { right: auto; left: 0; transform-origin: top left; }
.dropdown-panel.open, .dropdown.open > .dropdown-menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.dropdown-head { padding: 10px 12px 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); }
.dropdown-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; border: none; border-radius: 8px; background: none;
    color: var(--color-text); font-size: 13px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.dropdown-item .icon { color: var(--color-text-muted); }
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--color-hover); color: var(--color-accent); text-decoration: none; outline: none; }
.dropdown-item:hover .icon { color: var(--color-accent); }
.dropdown-item.danger { color: var(--color-danger); }
.dropdown-item.danger .icon { color: var(--color-danger); }
.dropdown-item.danger:hover { background: var(--color-danger-soft); color: var(--color-danger); }
.dropdown-item-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-dropdown .dropdown-item-text { white-space: normal; line-height: 1.4; }
.dropdown-item-form { margin: 0; }
.dropdown-item-btn { font: inherit; font-size: 13px; font-weight: 500; }
.dropdown-empty { padding: 22px 16px; text-align: center; color: var(--color-text-muted); font-size: 12.5px; }
.dropdown-footer {
    display: flex; align-items: center; gap: 5px; justify-content: center;
    margin: 6px -6px -6px; padding: 11px 16px; font-size: 12px; font-weight: 600;
    color: var(--color-accent); background: var(--color-surface-2); border-top: 1px solid var(--color-border);
}
.dropdown-footer:hover { text-decoration: none; background: var(--color-accent-soft); }
.dropdown-divider { height: 1px; background: var(--color-border); margin: 6px 4px; }
@media (max-width: 600px) { .dropdown-panel { position: fixed; top: calc(var(--navbar-h) + 6px); right: 8px; left: 8px; width: auto; max-width: none; } }

/* Command palette */
.palette-overlay {
    position: fixed; inset: 0; z-index: var(--z-palette);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 12vh 20px 20px;
    background: var(--overlay-bg); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    opacity: 0; visibility: hidden;
    transition: opacity var(--dur-fast) var(--ease-out), visibility 0s linear var(--dur-fast);
}
.palette-overlay.open { opacity: 1; visibility: visible; transition-delay: 0s; }
.palette-box {
    width: 100%; max-width: 620px; overflow: hidden;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    transform: translateY(-10px) scale(.97); transition: transform var(--dur) var(--ease-out);
}
.palette-overlay.open .palette-box { transform: none; }
.palette-search { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 56px; border-bottom: 1px solid var(--color-border); color: var(--color-text-muted); }
.palette-search input {
    flex: 1; min-width: 0; height: 100%; min-height: 0; padding: 0; border: none; border-radius: 0; box-shadow: none;
    outline: none; font-size: 16px; font-family: inherit; background: transparent; color: var(--color-text);
}
.palette-search input:hover, .palette-search input:focus { border: none; box-shadow: none; background: transparent; }
.palette-results { max-height: min(400px, 52vh); overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
.palette-group-label { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--color-text-muted); padding: 10px 10px 5px; }
.palette-item {
    display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px;
    color: var(--color-text); font-size: 13.5px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.palette-item-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--color-canvas); color: var(--color-text-muted); flex-shrink: 0; transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.palette-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item-label mark { background: none; color: var(--color-accent); font-weight: 700; }
.palette-item-hint { font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.palette-item-enter { display: none; }
.palette-item.active { background: var(--color-accent-soft); color: var(--color-accent); text-decoration: none; }
.palette-item.active .palette-item-icon { background: var(--color-accent); color: #fff; }
.palette-item.active .palette-item-enter { display: inline-flex; }
.palette-empty { padding: 28px 12px; text-align: center; color: var(--color-text-muted); font-size: 13px; }
.palette-footer { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--color-border); background: var(--color-surface-2); font-size: 11.5px; color: var(--color-text-muted); flex-wrap: wrap; }
.palette-footer kbd { margin-right: 4px; }
@media (max-width: 600px) { .palette-overlay { padding: 8vh 12px 12px; } .palette-item-hint { display: none; } .palette-footer span:nth-child(n+2) { display: none; } }

/* Toasts (JS-built, and upgraded server-rendered .flash banners) */
.toast-stack {
    position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast);
    display: flex; flex-direction: column; gap: 10px;
    width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.toast-stack .flash, .toast {
    --toast-c: var(--color-accent);
    position: relative; overflow: hidden; pointer-events: auto;
    display: flex; align-items: flex-start; gap: 11px;
    margin: 0; padding: 13px 12px 13px 14px;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); border-left-width: 1px; border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px; line-height: 1.5;
    animation: toastIn .34s var(--ease-out);
}
.toast-stack .flash-success, .toast-success { --toast-c: var(--color-success); }
.toast-stack .flash-error, .toast-error { --toast-c: var(--color-danger); }
.toast-stack .flash-warning, .toast-warning { --toast-c: var(--color-warning); }
.toast-stack .flash-info, .toast-info { --toast-c: var(--color-accent); }
.toast-stack .flash-success, .toast-stack .flash-error, .toast-stack .flash-warning, .toast-stack .flash-info { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.toast-ico { flex-shrink: 0; width: 24px; height: 24px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--toast-c) 14%, transparent); color: var(--toast-c); margin-top: 0; }
.toast-body { flex: 1; min-width: 0; padding-top: 2px; overflow-wrap: anywhere; }
.toast-title { font-weight: 650; color: var(--color-ink); margin-bottom: 1px; }
.toast-action { display: inline-block; margin-top: 6px; font-weight: 650; font-size: 12.5px; color: var(--toast-c); background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; }
.toast-action:hover { text-decoration: underline; }
.toast-close { flex-shrink: 0; margin: -4px -2px 0 0; width: 26px; height: 26px; }
.toast-timer {
    position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--toast-c); opacity: .55;
    transform-origin: left; animation: toastTimer var(--toast-dur, 5s) linear forwards;
}
.toast:hover .toast-timer, .toast-stack .flash:hover .toast-timer { animation-play-state: paused; }
@keyframes toastTimer { to { transform: scaleX(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.toast-stack .flash.toast-leaving, .toast.toast-leaving { opacity: 0; transform: translateX(24px) scale(.98); transition: opacity .26s var(--ease-out), transform .26s var(--ease-out); }
.session-warning-toast { align-items: center; flex-wrap: wrap; }
.session-stay-btn {
    background: var(--color-accent); color: #fff; border: none; border-radius: 8px; padding: 6px 12px;
    font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer; flex-shrink: 0; margin-left: auto;
}
.session-stay-btn:hover { filter: brightness(1.08); }
@media (max-width: 600px) { .toast-stack { right: 16px; left: 16px; bottom: 16px; width: auto; } }

/* Tooltip (element built by app.js) */
.tip-el {
    position: fixed; z-index: 700; pointer-events: none;
    max-width: 260px; padding: 6px 10px;
    background: #15162B; color: #F1F0FB; border-radius: 8px;
    font-size: 12px; font-weight: 500; line-height: 1.4; text-align: center;
    box-shadow: var(--shadow-md);
    opacity: 0; transform: scale(.96); transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.tip-el.show { opacity: 1; transform: none; }
:root[data-theme="dark"] .tip-el { background: #2B2C4E; color: #F1F0FB; border: 1px solid var(--color-border-strong); }
.tip-el kbd { background: rgba(255, 255, 255, 0.12); color: inherit; border-color: rgba(255, 255, 255, 0.2); margin-left: 6px; }

/* ---------------- 8. Tabs, avatars, progress, skeleton, empty state ----------------
   Tabs:     <div class="tabs" data-tabs> <button class="tab active" data-tab="a">A</button> ... </div>
             <div class="tab-panel" data-tab-panel="a">..</div>   (underline style; add .tabs-pill for segmented pills)
             the animated indicator is injected by app.js and also applied to the older .tp-tabs / .doc-tabs
   Avatar:   .avatar (+ .avatar-sm .avatar-lg .avatar-xl, .avatar-group)
   Progress: <div class="progress"><span class="progress-bar" style="--value:64%"></span></div>  (.success .warning .danger, .progress-sm/.progress-lg)
   Empty:    <div class="empty-state"><div class="empty-state-icon">svg</div><h3>Title</h3><p>Text</p><a class="btn btn-primary">Action</a></div>
   Skeleton: .skeleton (block) .skeleton-line (+ .w-40 .w-60 .w-80) .skeleton-circle .skeleton-card */

.tabs, .tp-tabs, .doc-tabs {
    position: relative; display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    box-shadow: inset 0 -1px 0 var(--color-border); margin-bottom: var(--space-5); padding: 0;
}
.tabs::-webkit-scrollbar, .tp-tabs::-webkit-scrollbar, .doc-tabs::-webkit-scrollbar { display: none; }
.tab, .tp-tab-btn, .doc-tab-btn {
    position: relative; display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
    padding: 10px 14px; margin: 0; background: none; border: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font: inherit; font-size: 13.5px; font-weight: 600; color: var(--color-text-muted);
    cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.tab:hover, .tp-tab-btn:hover, .doc-tab-btn:hover { color: var(--color-ink); background: var(--color-hover); text-decoration: none; }
.tab.active, .tab[aria-selected="true"], .tab.is-active, .tp-tab-btn.active, .doc-tab-btn.active { color: var(--color-accent); background: none; border: none; }
.tab:focus-visible, .tp-tab-btn:focus-visible, .doc-tab-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.tab-indicator {
    position: absolute; left: 0; bottom: 0; height: 2px; width: var(--ind-w, 0); border-radius: 2px;
    background: var(--color-accent); transform: translateX(var(--ind-x, 0));
    transition: transform var(--dur-slow) var(--ease-out), width var(--dur-slow) var(--ease-out), opacity var(--dur) var(--ease-out);
    pointer-events: none; opacity: 0;
}
.tabs.has-indicator .tab-indicator, .tp-tabs.has-indicator .tab-indicator, .doc-tabs.has-indicator .tab-indicator { opacity: 1; }
.tabs.has-indicator .tab.active, .tp-tabs.has-indicator .tp-tab-btn.active, .doc-tabs.has-indicator .doc-tab-btn.active { border-bottom-color: transparent; }
.tabs:not(.has-indicator) .tab.active, .tabs:not(.has-indicator) .tab[aria-selected="true"], .doc-tabs:not(.has-indicator) .doc-tab-btn.active { box-shadow: inset 0 -2px 0 var(--color-accent); }
.tab-panel { display: none; }
.tab-panel.active, .tab-panel.is-active { display: block; animation: pageIn var(--dur-slow) var(--ease-out); }
.doc-tab-btn.active { border-bottom-color: transparent; }

/* Pill / segmented tabs */
.tabs-pill, .tp-tabs {
    display: inline-flex; max-width: 100%; gap: 2px; padding: 4px;
    background: var(--color-canvas); border: 1px solid var(--color-border); border-radius: 12px; box-shadow: none;
}
.tp-tabs { display: flex; width: fit-content; }
.tabs-pill .tab, .tp-tabs .tp-tab-btn { padding: 7px 14px; border-radius: 9px; font-size: 13px; position: relative; z-index: 1; }
.tabs-pill .tab:hover, .tp-tabs .tp-tab-btn:hover { background: transparent; color: var(--color-ink); }
.tabs-pill .tab.active, .tabs-pill .tab[aria-selected="true"], .tp-tabs .tp-tab-btn.active { color: var(--color-ink); background: none; border: none; }
.tabs-pill .tab-indicator, .tp-tabs .tab-indicator {
    top: 4px; bottom: 4px; height: auto; border-radius: 9px; z-index: 0;
    background: var(--color-surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-border);
}
/* No JS fallback: the active pill paints its own background */
.tabs-pill:not(.has-indicator) .tab.active, .tp-tabs:not(.has-indicator) .tp-tab-btn.active { background: var(--color-surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-border); }

/* Avatars */
.avatar {
    position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(145deg, #7C6DF0, #5646D6); color: #fff;
    font-family: var(--font-sans); font-size: 12px; font-weight: 700; letter-spacing: .02em; line-height: 1;
    box-shadow: 0 0 0 2px var(--color-surface); overflow: visible; text-transform: uppercase;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }
.avatar.brass { background: linear-gradient(145deg, #E4AC5E, #B87B32); color: #15162B; }
.avatar.ink { background: linear-gradient(145deg, #34365A, #15162B); }
.avatar.success { background: linear-gradient(145deg, #2BC493, #139C6B); }
.avatar.danger { background: linear-gradient(145deg, #F0685E, #C93A31); }
.avatar-group { display: inline-flex; }
.avatar-group > .avatar { margin-left: -8px; }
.avatar-group > .avatar:first-child { margin-left: 0; }
.user-chip .avatar { width: 30px; height: 30px; font-size: 11px; box-shadow: none; }

/* Progress */
.progress { position: relative; width: 100%; height: 8px; border-radius: 999px; background: var(--color-canvas); box-shadow: inset 0 0 0 1px var(--color-border-soft); overflow: hidden; }
.progress-sm { height: 5px; }
.progress-lg { height: 12px; }
.progress-bar {
    display: block; height: 100%; width: var(--value, 0%); border-radius: inherit;
    background: linear-gradient(90deg, var(--color-accent), color-mix(in srgb, var(--color-accent) 60%, #fff));
    transition: width .7s var(--ease-out);
}
.progress.success .progress-bar { background: linear-gradient(90deg, var(--color-success), color-mix(in srgb, var(--color-success) 60%, #fff)); }
.progress.warning .progress-bar { background: linear-gradient(90deg, var(--color-warning), color-mix(in srgb, var(--color-warning) 60%, #fff)); }
.progress.danger .progress-bar { background: linear-gradient(90deg, var(--color-danger), color-mix(in srgb, var(--color-danger) 60%, #fff)); }
.progress.is-indeterminate .progress-bar { width: 40%; animation: progressSlide 1.3s var(--ease-out) infinite; }
@keyframes progressSlide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* Skeleton loaders */
.skeleton, .skeleton-line, .skeleton-circle {
    display: block; position: relative; overflow: hidden; border-radius: var(--radius-xs);
    background: var(--color-border-soft);
}
.skeleton::after, .skeleton-line::after, .skeleton-circle::after {
    content: ''; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--color-surface) 70%, transparent), transparent);
    animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton { min-height: 16px; }
.skeleton-line { height: 12px; margin: 8px 0; border-radius: 6px; width: 100%; }
.skeleton-line.w-40 { width: 40%; } .skeleton-line.w-60 { width: 60%; } .skeleton-line.w-80 { width: 80%; }
.skeleton-line.lg { height: 22px; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-card { min-height: 120px; border-radius: var(--radius-md); }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 44px 20px; color: var(--color-text-muted); }
.empty-state-icon {
    display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin-bottom: 8px;
    border-radius: 16px; background: var(--color-accent-soft); color: var(--color-accent);
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--color-accent) 7%, transparent);
}
.empty-state h3, .empty-state .empty-state-title { margin: 0; font-size: 15px; color: var(--color-ink); }
.empty-state p { margin: 0; max-width: 380px; font-size: 13px; line-height: 1.55; }
.empty-state .btn { margin-top: 12px; }
.activity-empty { padding: 34px 10px; text-align: center; color: var(--color-text-muted); font-size: 13px; }
.heatmap-empty-state { padding: 44px 20px; }

/* ---------------- 9. Layout primitives ----------------
   .page-header      title + subtitle + actions: <div class="page-header"><div class="page-header-heading">[.page-icon]<div><h1>..</h1><p>..</p></div></div><div class="page-header-actions">buttons</div></div>
   .toolbar          filters row: .toolbar > controls, .toolbar-spacer pushes the rest right, .toolbar-group clusters
   .form-section     titled block, description left (desktop), fields right: .form-section-head (.form-section-title, .form-section-desc) + .form-section-body
   .form-grid-2/3/4  responsive column grids (collapse to 2 then 1 column); .form-full spans every column
   .form-actions     save / cancel bar; sticks to the bottom of the viewport on phones (.form-actions-sticky forces it everywhere)
   .detail-grid      cards of label/value: .detail-item > .detail-label + .detail-value
   .detail-list      <dl class="detail-list"><dt>Label</dt><dd>Value</dd>...</dl> (two-column rows, stacked on phones)
   .timeline         vertical activity feed: .timeline-item > .timeline-dot + .timeline-content (.timeline-title, .timeline-meta, .timeline-body); dot variants .success .warning .danger
   .two-col / .three-col / .stack / .cluster / .muted / .text-right helpers */

.page-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
    flex-wrap: wrap; margin-bottom: var(--space-6);
}
.page-header-heading { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.page-header h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.022em; margin: 0; }
.page-header p, .page-subtitle { margin: 3px 0 0; color: var(--color-text-muted); font-size: 13.5px; line-height: 1.5; }
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.page-icon {
    width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; margin-top: 1px;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-accent-soft); color: var(--color-accent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 14%, transparent);
}
.page-icon.accent { background: var(--color-accent-soft); color: var(--color-accent); }
.page-icon.brass { background: var(--color-brass-soft); color: var(--color-brass); }
.page-icon.danger { background: var(--color-danger-soft); color: var(--color-danger); }
.page-icon.warning { background: var(--color-warning-soft); color: var(--color-warning); }
.page-icon.success { background: var(--color-success-soft); color: var(--color-success); }
.page-icon:not(.accent):not(.danger):not(.warning):not(.success):not(.brass) { background: var(--color-accent-soft); color: var(--color-accent); }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-4); }
.toolbar > * { min-width: 0; }
.toolbar-spacer { flex: 1 1 0; }
.toolbar-group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .search-input-wrap { flex: 1 1 220px; max-width: 360px; }
.toolbar :where(input:not([type="checkbox"], [type="radio"]), select) { min-height: 38px; }

.form-section {
    display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: var(--space-6) var(--space-8);
    padding: var(--space-6);
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-xs);
    margin-bottom: var(--space-4);
}
.form-section-head { min-width: 0; }
.form-section-title { margin: 0 0 4px; font-size: 15px; font-weight: 650; color: var(--color-ink); letter-spacing: -0.01em; }
.form-section-desc { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--color-text-muted); }
.form-section-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); min-width: 0; align-content: start; }
.form-grid-2, .form-grid-3, .form-grid-4 { display: grid; gap: var(--space-4); min-width: 0; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid-2 > .form-full, .form-grid-3 > .form-full, .form-grid-4 > .form-full, .form-section-body > .form-full { grid-column: 1 / -1; }

.form-actions {
    display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
    margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--color-border);
}
.form-actions.is-start { justify-content: flex-start; }
.form-actions .form-actions-note { margin-right: auto; font-size: 12.5px; color: var(--color-text-muted); }
.form-actions-sticky { position: sticky; bottom: 0; z-index: 10; margin-left: calc(var(--content-pad) * -1); margin-right: calc(var(--content-pad) * -1); padding: 12px var(--content-pad); background: var(--nav-bg); -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5); border-top: 1px solid var(--color-border); }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.detail-item { min-width: 0; padding: 12px 14px; background: var(--color-surface-2); border: 1px solid var(--color-border-soft); border-radius: var(--radius-sm); }
.detail-label { font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: 3px; }
.detail-value { font-size: 14px; font-weight: 500; color: var(--color-text); overflow-wrap: anywhere; }
.detail-list { margin: 0; display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); border-top: 1px solid var(--color-border-soft); }
.detail-list > dt, .detail-list > dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--color-border-soft); font-size: 13.5px; }
.detail-list > dt { font-weight: 600; color: var(--color-text-muted); padding-right: 16px; }
.detail-list > dd { color: var(--color-text); overflow-wrap: anywhere; }
.detail-list .detail-row { display: contents; }
.detail-list .detail-row > .detail-label, .detail-list .detail-row > .detail-value { padding: 11px 0; border-bottom: 1px solid var(--color-border-soft); margin: 0; text-transform: none; letter-spacing: 0; font-size: 13.5px; }
.detail-list .detail-row > .detail-label { font-weight: 600; }

.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.timeline-item { position: relative; display: flex; gap: 14px; padding: 0 0 var(--space-5) 0; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--color-border); border-radius: 2px; }
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    position: relative; flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-accent-soft); color: var(--color-accent);
    box-shadow: 0 0 0 4px var(--color-surface);
}
.timeline-dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.timeline-dot:has(svg)::after { display: none; }
.timeline-dot.success { background: var(--color-success-soft); color: var(--color-success); }
.timeline-dot.warning { background: var(--color-warning-soft); color: var(--color-warning); }
.timeline-dot.danger { background: var(--color-danger-soft); color: var(--color-danger); }
.timeline-content { flex: 1; min-width: 0; padding-top: 2px; }
.timeline-title { font-size: 13.5px; font-weight: 600; color: var(--color-ink); }
.timeline-meta { font-size: 12px; color: var(--color-text-muted); margin-top: 1px; }
.timeline-body { font-size: 13px; color: var(--color-text); margin-top: 6px; line-height: 1.55; overflow-wrap: anywhere; }

.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.two-col > *, .three-col > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.cluster { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.muted { color: var(--color-text-muted); }
.text-right { text-align: right; }
.print-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-grid > * { min-width: 0; }

/* -- Responsive -- */
@media (max-width: 1100px) {
    .three-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .two-col, .three-col { grid-template-columns: minmax(0, 1fr); }
    .kpi-grid-3, .kpi-grid-4, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-section { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); padding: var(--space-5); }
    .content { padding-top: var(--space-5); }
}
@media (max-width: 600px) {
    .content { padding-bottom: 40px; }
    .card { padding: var(--space-4); }
    .card-footer { margin: var(--space-4) calc(var(--space-4) * -1) calc(var(--space-4) * -1); padding: var(--space-3) var(--space-4); }
    .table-scroll { margin: 4px calc(var(--space-4) * -1) calc(var(--space-4) * -1); }
    .table-scroll.is-sticky { max-height: none; overflow-y: visible; }
    .page-header { flex-direction: column; align-items: stretch; margin-bottom: var(--space-5); }
    .page-header h1 { font-size: 21px; }
    .page-header-actions { margin-left: 0; }
    .page-header > form { flex-wrap: wrap; }
    .kpi-grid, .kpi-grid-3, .kpi-grid-4, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi-tile { padding: 14px 14px 12px; }
    .kpi-tile .kpi-value { font-size: 24px; }
    .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
    .form-section { padding: var(--space-4); }
    .form-actions { position: sticky; bottom: 0; z-index: 10; margin-left: calc(var(--content-pad) * -1); margin-right: calc(var(--content-pad) * -1); padding: 12px var(--content-pad); background: var(--nav-bg); -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5); border-top: 1px solid var(--color-border); }
    .form-actions .btn { flex: 1 1 auto; }
    .card .form-actions, .form-section .form-actions { position: static; margin-left: 0; margin-right: 0; padding: var(--space-4) 0 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; border-top: 1px solid var(--color-border); }
    .form-actions.form-actions-sticky, .card .form-actions.form-actions-sticky { position: sticky; }
    .detail-list { grid-template-columns: minmax(0, 1fr); }
    .detail-list > dt { padding: 11px 0 0; border-bottom: none; }
    .detail-list > dd { padding-top: 2px; }
    .detail-list .detail-row { display: block; }
    .toolbar .search-input-wrap { max-width: none; flex-basis: 100%; }
    .toolbar > :where(select, input:not([type="checkbox"], [type="radio"]), .filter-select) { flex: 1 1 140px; }
    .modal-overlay { padding: 12px; align-items: flex-end; }
    .modal-box, .modal-panel { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) var(--radius-md) var(--radius-md); }
    .modal-panel { max-height: 90vh; }
    table.data-table { display: block; overflow-x: auto; white-space: nowrap; }
    .quick-links { grid-template-columns: 1fr; }
    .auth-card { padding: 28px 22px 24px; }
}

/* ---------------- 10. Motion + print ---------------- */
.page-load-bar, #pageLoadBar {
    position: fixed; top: 0; left: 0; height: 2px; width: 0%; z-index: var(--z-progress);
    background: linear-gradient(90deg, var(--color-accent), var(--color-brass));
    box-shadow: 0 0 10px var(--accent-glow), 0 0 4px var(--color-accent);
    border-radius: 0 2px 2px 0;
    opacity: 0; pointer-events: none;
    transition: opacity .3s ease;
}
#pageLoadBar.active { opacity: 1; width: 80%; transition: width 8s cubic-bezier(.08,.6,.2,1), opacity .15s ease; }
#pageLoadBar.done { opacity: 0; width: 100%; transition: width .2s ease, opacity .4s ease .2s; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
    .content, .kpi-tile, .tab-panel.active, .bulk-action-bar { animation: none; }
    .btn.is-loading::after, .btn[aria-busy="true"]::after { animation: btnSpin 1.6s linear infinite !important; animation-duration: 1.6s !important; }
    .skeleton::after, .skeleton-line::after, .skeleton-circle::after { animation: none; }
    #pageLoadBar.active { width: 100%; transition: opacity .2s ease; }
}

@media print {
    .app-main { margin-left: 0 !important; background: none !important; }
    .sidebar-backdrop, #pageLoadBar, .palette-overlay, .modal-overlay, .tip-el, .skip-link { display: none !important; }
    .card, .kpi-tile, table.data-table { box-shadow: none !important; animation: none !important; }
    .content { animation: none !important; max-width: none !important; }
}

/* ---------------- Dark-mode parity fixes for legacy blocks that used --color-ink as a dark fill ---------------- */
.dash-hero {
    background-image:
        radial-gradient(circle at 88% 8%, rgba(216, 155, 74, 0.24), transparent 42%),
        radial-gradient(circle at 6% 110%, rgba(108, 92, 231, 0.38), transparent 50%),
        linear-gradient(135deg, #1B1C3A 0%, #23253F 55%, #0F1022 100%);
}
:root[data-theme="dark"] .doc-content pre, :root[data-theme="dark"] .auth-mark, :root[data-theme="dark"] .auth-left-mark { background: #0B0C1C; }
:root[data-theme="dark"] .heat-map-tile, :root[data-theme="dark"] .heatmap-cell { box-shadow: none; }
.sidebar a.nav-item .nav-pin-btn { outline: none; }
@media (max-width: 900px) { .sidebar a.nav-item .nav-pin-btn { opacity: .4; } }

.kpi-tile .kpi-trend, .kpi-tile .trend { align-self: flex-start; }
:root[data-theme="dark"] .avatar.ink { background: linear-gradient(145deg, #4B4D7E, #2B2C50); }

/* BATCH5 admin pages: users, roles, permissions, lookups, entities, programmes, logs, backup */
.b5-scroll { overflow-x: auto; max-width: 100%; }
.b5-scroll > table.data-table { border: none; border-radius: 0; box-shadow: none; }
.b5-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-4); align-items: start; }
.b5-split > * { min-width: 0; }
.b5-split-side { display: flex; flex-direction: column; gap: var(--space-4); }
.b5-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-4); }
.b5-usercell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.b5-usercell .avatar { box-shadow: none; }
.b5-usercell-name { font-weight: 600; color: var(--color-ink); display: block; overflow-wrap: anywhere; }
.b5-usercell-sub { font-size: 12px; color: var(--color-text-muted); display: block; overflow-wrap: anywhere; }
.b5-row-actions { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.b5-row-actions form { display: inline-flex; margin: 0; }
.b5-hint { font-size: 12px; color: var(--color-text-muted); }
.b5-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.b5-inline input[type="text"], .b5-inline select { min-height: 34px; padding: 6px 10px; font-size: 13px; width: auto; flex: 1 1 130px; }
.b5-inline .check { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; }
.b5-matrix { max-height: 70vh; overflow: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.b5-matrix table.data-table { border: none; border-radius: 0; box-shadow: none; min-width: 900px; display: table; overflow: visible; white-space: normal; }
.b5-matrix th:first-child, .b5-matrix td:first-child { position: sticky; left: 0; z-index: 3; background: var(--color-surface); box-shadow: 1px 0 0 var(--color-border-soft); min-width: 180px; font-weight: 600; }
.b5-matrix thead th { z-index: 4; }
.b5-matrix thead th:first-child { z-index: 5; }
.b5-matrix select { min-height: 30px; padding: 3px 26px 3px 8px; font-size: 11.5px; font-weight: 600; width: auto; }
.b5-matrix select.scope-all { background-color: var(--color-success-soft); color: var(--color-success); }
.b5-matrix select.scope-part { background-color: var(--color-warning-soft); color: var(--color-warning); }
.b5-matrix select.scope-none { color: var(--color-text-muted); }
.b5-lookup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-4); }
.b5-lookup-grid > .card { min-width: 0; }
.b5-value-list { list-style: none; margin: 0; padding: 0; }
.b5-value-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--color-border-soft); font-size: 13.5px; overflow-wrap: anywhere; }
.b5-value-list li:last-child { border-bottom: none; }
.b5-value-list form { margin: 0; flex-shrink: 0; }
.b5-step { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--color-border-soft); align-items: start; }
.b5-step:last-child { border-bottom: none; }
.b5-step.is-inactive .b5-step-text { opacity: .6; }
.b5-step-no { width: 28px; height: 28px; border-radius: 50%; background: var(--color-accent-soft); color: var(--color-accent); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.b5-step-text { display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.b5-step-text textarea { flex: 1; min-width: 0; }
.b5-step-actions { display: flex; align-items: center; gap: 2px; margin: 0; }
.b5-area-list { list-style: none; margin: 0; padding: 0; }
.b5-area-list a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--color-text); text-decoration: none; font-size: 13.5px; overflow-wrap: anywhere; }
.b5-area-list a:hover { background: var(--color-hover); }
.b5-area-list a.is-active { background: var(--color-accent-soft); color: var(--color-accent); font-weight: 600; }
.b5-callout { display: flex; gap: 12px; align-items: flex-start; }
.b5-callout .b5-callout-icon { flex-shrink: 0; }
.b5-callout.ok .b5-callout-icon { color: var(--color-success); }
.b5-callout.warn .b5-callout-icon { color: var(--color-warning); }
.b5-callout.bad .b5-callout-icon { color: var(--color-danger); }
.b5-callout p { margin: 0; }
.b5-prose p { font-size: 13.5px; line-height: 1.65; color: var(--color-text); }
.b5-prose p:last-child { margin-bottom: 0; }
.b5-logcell { max-width: 320px; overflow-wrap: anywhere; white-space: normal; }
.b5-link-btn { display: inline-flex; align-items: center; gap: 6px; }
@media (min-width: 1001px) { .b5-split.b5-split-narrow { grid-template-columns: 300px minmax(0, 1fr); } .b5-area-list { max-height: 70vh; overflow-y: auto; } }
@media (max-width: 1000px) { .b5-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
    .b5-lookup-grid { grid-template-columns: minmax(0, 1fr); }
    .b5-step { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .b5-step-text { flex-direction: column; }
    .b5-step-text .btn { align-self: flex-start; }
    .b5-inline input[type="text"], .b5-inline select { flex-basis: 100%; }
}

/* BATCH3 */
.bulk-action-bar[hidden] { display: none; }

/* BATCH2 exceptions module + analytics pages */
.tabs.tabs-pill { margin-bottom: var(--space-5); }
.b2-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-4); align-items: start; }
.b2-detail-layout > * { min-width: 0; }
.b2-side { position: sticky; top: 76px; }
.b2-filter-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-4); }
.b2-cell-clip { max-width: 360px; overflow-wrap: anywhere; }
.b2-num { font-variant-numeric: tabular-nums; }
.b2-inline-form { display: inline; margin: 0; }
.b2-check { width: auto; }
.b2-grow { flex: 1 1 260px; }
.b2-actions-col { width: 1%; white-space: nowrap; }
.b2-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.b2-mt { margin-top: var(--space-4); }
@media (max-width: 980px) {
    .b2-detail-layout { grid-template-columns: minmax(0, 1fr); }
    .b2-side { position: static; }
}

/* BATCH4 */
.b4-nowrap { white-space: nowrap; }
.b4-small { font-size: 12.5px; }
.b4-title-cell { min-width: 200px; }
.b4-cat-strip { margin-bottom: var(--space-4); }
.b4-grow { flex: 1 1 200px; min-width: 0; }
.b4-repeat { display: flex; flex-direction: column; gap: 8px; }
.b4-repeat:empty { display: none; }
.b4-finding-row { display: flex; gap: 6px; align-items: center; }
.b4-apx-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; background: var(--color-surface-2); border: 1px solid var(--color-border-soft); border-radius: var(--radius-sm); }
.b4-apx-type { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; flex-basis: 100%; }
.b4-apx-row input[type="file"] { flex: 1 1 200px; min-width: 0; }
.b4-flat-scroll { margin: 0; border: 1px solid var(--color-border-soft); border-radius: var(--radius-sm); overflow-x: auto; }
.b4-panel { margin-top: var(--space-5); }
.b4-panel-note { margin: 0 0 var(--space-4); }
.b4-progress-meta { min-width: 180px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.b4-progress-meta .progress { width: 100%; }
.b4-status-cell { min-width: 210px; }
.b4-inline-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.b4-inline-form select, .b4-inline-form input { min-height: 30px; padding: 3px 8px; font-size: 12px; width: auto; max-width: 100%; }
.b4-edit-cell { padding-top: 0 !important; }
.b4-details > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--color-accent); list-style-position: inside; }
.b4-details.b4-add { margin-top: var(--space-4); padding: var(--space-4); background: var(--color-surface-2); border: 1px solid var(--color-border-soft); border-radius: var(--radius-sm); }
.b4-details.b4-add > summary { font-size: 13.5px; }
.b4-details-body { margin-top: var(--space-3); }
.b4-mb { margin-bottom: var(--space-3); }
.b4-panel .card-title { display: flex; align-items: center; gap: 8px; }
.b4-details.b4-add > summary { display: flex; align-items: center; gap: 8px; }
.b4-block { margin-bottom: var(--space-4); }
.b4-callout { margin-bottom: var(--space-4); border-left: 3px solid var(--color-accent); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.b4-callout[id], .b4-callout-warning { display: block; }
.b4-callout-warning { border-left-color: var(--color-warning); }
.b4-callout-main { display: flex; align-items: flex-start; gap: 10px; min-width: 0; flex: 1 1 320px; }
.b4-icon-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.b4-list { margin: 0; padding-left: 18px; font-size: 13px; }
.b4-narrow { max-width: 220px; }
.b4-col-days { width: 140px; }
.b4-num { width: 100px; }
.b4-num-wide { width: 110px; }
.b4-inline { display: inline-flex; gap: 4px; align-items: center; }
.b4-status-select { border: none; font: inherit; cursor: pointer; }
.b4-notes-cell { min-width: 180px; max-width: 280px; }
.b4-notes { font-size: 12.5px; color: var(--color-text-muted); white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.b4-card-danger { border-color: var(--color-danger); }
.b4-h4 { margin: var(--space-6) 0 var(--space-2); font-size: 14px; font-weight: 650; color: var(--color-ink); }
.b4-mt { margin-top: var(--space-3); }
.b4-util-cell { min-width: 130px; }
.b4-form-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-3); align-items: end; margin-bottom: var(--space-4); padding: var(--space-4); background: var(--color-surface-2); border: 1px solid var(--color-border-soft); border-radius: var(--radius-sm); }
.b4-form-btn { display: flex; }
.b4-mini-select { padding: 4px 28px 4px 8px; font-size: 12px; min-height: 30px; width: auto; }
.b4-legend { margin-top: var(--space-5); }
.b4-rank { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.b4-rank .field-hint { margin-top: 2px; }
.b4-col-role { width: 180px; }
#branchPick, #deptPick { flex-direction: column; }
.b4-checks { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 2px; }
.page-header p a svg { display: inline; vertical-align: -2px; }
/* /BATCH4 */
.b3-flag { margin-top: 8px; font-size: 12.5px; line-height: 1.5; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border-soft); }
.b3-link-form { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--color-border); }
.b3-subhead { margin: 0 0 var(--space-3); font-size: 13px; font-weight: 650; color: var(--color-ink); }
.b3-link-form .form-actions { border-top: none; padding-top: 0; }

/* BATCH1 */
.profile-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-4); align-items: start; }
.profile-layout > * { min-width: 0; }
.profile-layout > aside { order: 0; position: sticky; top: 80px; }
.inline-form { display: inline; margin: 0; }
tr.row-current > td { background: var(--color-success-soft); }
.feed-url { width: 100%; font-family: ui-monospace, monospace; font-size: 12px; }
@media (max-width: 1100px) {
    .profile-layout { grid-template-columns: minmax(0, 1fr); }
    .profile-layout > aside { position: static; order: -1; }
}
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mt-3 { margin-top: var(--space-3); }
.center-note { text-align: center; color: var(--color-text-muted); }
.list-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 8px; margin: 0 -8px; border-bottom: 1px solid var(--color-border-soft); text-decoration: none; color: inherit; border-radius: var(--radius-sm); transition: background-color var(--dur-fast) var(--ease-out); }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--color-hover); text-decoration: none; }
.list-row-text { font-size: 13.5px; padding-top: 4px; }
.list-row-chev { margin-left: auto; color: var(--color-text-muted); padding-top: 5px; flex-shrink: 0; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.b2-mb { margin-bottom: var(--space-4); }
.b3-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-5); align-items: start; }
.b3-main, .b3-side { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.b3-prose { font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.b3-inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--space-4); }
.b3-inline-form > .field { min-width: 0; }
.b3-grow { flex: 1 1 240px; }
.b3-w-sm { flex: 0 1 110px; }
.b3-w-md { flex: 0 1 170px; }
.b3-evidence-form { margin-bottom: var(--space-4); }
.b3-row-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.b3-row-form select, .b3-row-form input[type="text"] { min-height: 32px; padding: 4px 10px; font-size: 12.5px; }
.b3-timeline { margin-top: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--color-border-soft); }
.b3-tight { margin: 0; font-size: 13px; }
.b3-reqs { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-3); font-size: 13px; line-height: 1.5; }
.b3-reqs li { padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-border-soft); overflow-wrap: anywhere; }
.b3-reqs li:last-child { border-bottom: none; padding-bottom: 0; }
.b3-grade { margin-bottom: var(--space-4); }
.b3-grade-val { font-size: 20px; font-weight: 650; color: var(--color-ink); }
.b3-grade-form { padding-top: var(--space-4); margin-top: var(--space-4); border-top: 1px solid var(--color-border-soft); }
@media (max-width: 1100px) {
    .b3-split { grid-template-columns: minmax(0, 1fr); }
    .b3-side { order: -1; }
}
.card > .empty-state { padding: var(--space-6) var(--space-4); }
.b3-nowrap { white-space: nowrap; }
.auth-card-center { text-align: center; }
.auth-mark-center { margin: 0 auto 18px; background: var(--color-accent-soft); color: var(--color-accent); }
.auth-mark-center.is-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.auth-card .text-danger { color: var(--color-danger); }
.b3-intro { margin: 0 0 var(--space-4); font-size: 13px; }
.b3-actions-row { margin-top: var(--space-5); align-items: start; }
.b3-req-summary { margin-bottom: var(--space-4); }
.b3-ok { color: var(--color-success); margin: 0; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.b3-fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); align-items: end; padding: var(--space-5); background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--space-4); }
.b3-fgrid > .field { min-width: 0; }
.b3-fgrid > .b3-full { grid-column: 1 / -1; }
.b3-fgrid .form-actions { margin-top: 0; }
.b3-small { font-size: 12px; }
.b3-cpe { min-width: 140px; }
.b3-att { background: var(--color-surface-2); }
.b3-att .data-table { margin-top: var(--space-2); }
@media (max-width: 900px) { .b3-fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .b3-fgrid { grid-template-columns: minmax(0, 1fr); padding: var(--space-4); } }
.card > .table-scroll:not(:last-child) { margin-bottom: var(--space-4); }
.card > .table-scroll:not(:last-child) table.data-table { border-bottom: 1px solid var(--color-border); }
.cal-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; }

/* =========================================================================
   GLASS THEME PASS
   Frosted, translucent surfaces over a soft ambient wash built from the
   theme colours (violet accent, brass, indigo ink), so the glass has colour
   to pick up. Purely additive: loads last, overrides surface tokens only.
   Falls back to solid surfaces where backdrop-filter is unsupported.
   Classes: .glass (any element), .glass-strong, .glass-tint-accent/-brass.
   ========================================================================= */
:root {
    --glass-blur: 18px;
    --glass-sat: 160%;
    --card-glass-bg: rgba(255, 255, 255, 0.62);
    --kpi-glass-bg: rgba(255, 255, 255, 0.58);
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.7);
    --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    --glass-shadow: 0 1px 2px rgba(21, 22, 43, 0.04), 0 10px 30px -8px rgba(60, 50, 140, 0.16);
    --wash-1: rgba(108, 92, 231, 0.28);
    --wash-2: rgba(216, 155, 74, 0.22);
    --wash-3: rgba(76, 130, 220, 0.18);
}
:root[data-theme="dark"] {
    --card-glass-bg: rgba(28, 29, 55, 0.55);
    --kpi-glass-bg: rgba(255, 255, 255, 0.05);
    --glass-bg: rgba(24, 25, 48, 0.55);
    --glass-border: rgba(255, 255, 255, 0.09);
    --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 36px -10px rgba(0, 0, 0, 0.55);
    --wash-1: rgba(124, 108, 255, 0.24);
    --wash-2: rgba(231, 180, 118, 0.10);
    --wash-3: rgba(76, 130, 220, 0.14);
}

/* Ambient colour wash behind everything (fixed, so it does not scroll) */
body {
    background:
        radial-gradient(900px 520px at 8% -6%, var(--wash-1), transparent 62%),
        radial-gradient(760px 480px at 100% 4%, var(--wash-2), transparent 60%),
        radial-gradient(900px 600px at 70% 108%, var(--wash-3), transparent 62%),
        var(--color-canvas);
    background-attachment: fixed;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .card, .kpi-tile, .form-section, .empty-state, .toolbar, .detail-grid > *, .list-row,
    .stat-chip, .modal-box, .modal-panel, .dropdown-menu, .dropdown-panel, .toast,
    .palette-box, .tabs-pill, .glass {
        -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
        backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    }
    .navbar {
        background: var(--glass-bg);
        -webkit-backdrop-filter: blur(22px) saturate(180%);
        backdrop-filter: blur(22px) saturate(180%);
    }
}
.card, .kpi-tile, .form-section {
    background: var(--card-glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-edge), var(--glass-shadow);
}
.kpi-tile { background: var(--kpi-glass-bg); }
.card-hover:hover, .kpi-tile:hover {
    box-shadow: var(--glass-edge), 0 2px 4px rgba(21, 22, 43, 0.05), 0 18px 40px -10px rgba(90, 70, 220, 0.28);
    border-color: rgba(108, 92, 231, 0.35);
}
.glass { background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--glass-edge), var(--glass-shadow); border-radius: var(--radius-md); }
.glass-strong { background: var(--card-glass-bg); }
.glass-tint-accent { background: linear-gradient(135deg, rgba(108, 92, 231, 0.16), rgba(108, 92, 231, 0.05)); }
.glass-tint-brass  { background: linear-gradient(135deg, rgba(216, 155, 74, 0.20), rgba(216, 155, 74, 0.05)); }

/* Tables inside glass cards: translucent header and rows, not opaque blocks */
/* Header cells must be solid: a see-through header lets the rows show through while the table scrolls */
.card table.data-table thead th { background: color-mix(in srgb, var(--color-accent) 7%, var(--color-surface)); background-clip: padding-box; z-index: 5; box-shadow: 0 1px 0 var(--color-border), 0 4px 8px -6px rgba(31, 34, 55, .28); }
:root[data-theme="dark"] .card table.data-table thead th { background: rgba(255, 255, 255, 0.05); }
.card table.data-table tbody tr:hover { background: rgba(108, 92, 231, 0.06); }

/* Inputs: frosted, accent-tinted focus */
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea {
    background-color: rgba(255, 255, 255, 0.7);
}
:root[data-theme="dark"] input:not([type=checkbox]):not([type=radio]):not([type=range]),
:root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background-color: rgba(255, 255, 255, 0.05); }

/* Sidebar: deep indigo glass with a violet-brass glow at the edges */
.sidebar {
    background:
        radial-gradient(360px 260px at 0% 0%, rgba(108, 92, 231, 0.35), transparent 70%),
        radial-gradient(300px 240px at 100% 100%, rgba(216, 155, 74, 0.14), transparent 70%),
        linear-gradient(180deg, rgba(23, 24, 48, 0.94), rgba(17, 18, 38, 0.96));
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .sidebar { -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
}
.sidebar a.nav-item.active {
    background: linear-gradient(90deg, rgba(108, 92, 231, 0.34), rgba(108, 92, 231, 0.10));
    box-shadow: inset 0 0 0 1px rgba(156, 140, 255, 0.22), 0 6px 16px -8px rgba(108, 92, 231, 0.6);
}

/* Theme-colour touches: brass accents on key figures and active markers */
.page-header h1 { background: linear-gradient(90deg, var(--color-text), var(--color-accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.page-header h1 a, .page-header h1 .btn { -webkit-text-fill-color: initial; }
.kpi-tile::before { background: linear-gradient(90deg, var(--color-accent), var(--color-brass)); }
.tabs-pill .tab.active, .tabs-pill .tab[aria-selected="true"] { background: linear-gradient(135deg, rgba(108, 92, 231, 0.9), rgba(140, 120, 255, 0.85)); color: #fff; }

/* Modals: heavier blur behind, glass panel */
.modal-overlay { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal-box, .modal-panel { background: var(--card-glass-bg); border: 1px solid var(--glass-border); }
:root:not([data-theme="dark"]) .modal-box, :root:not([data-theme="dark"]) .modal-panel { background: rgba(255, 255, 255, 0.82); }

/* Print and reduced-transparency: solid, ink-friendly surfaces */
@media print {
    body { background: #fff !important; }
    .card, .kpi-tile, .form-section { background: #fff !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; box-shadow: none !important; }
    .page-header h1 { -webkit-text-fill-color: initial; background: none; }
}
@media (prefers-reduced-transparency: reduce) {
    :root { --card-glass-bg: #FFFFFF; --kpi-glass-bg: #FFFFFF; --glass-bg: #FFFFFF; }
    :root[data-theme="dark"] { --card-glass-bg: #191A30; --kpi-glass-bg: #1D1E39; --glass-bg: #181930; }
    * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
/* DRD */
/* Department follow-up and self-assessment (dept_followup.php, dept_self_assessment*.php). Prefix .drd- */
/* ---- Follow-up matrix (dept_followup.php) ---- */
.drd-warn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.drd-warn-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--color-danger) 7%, transparent); border: 1px solid color-mix(in srgb, var(--color-danger) 22%, transparent); }
.drd-warn-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.drd-warn-score { font-variant-numeric: tabular-nums; color: var(--color-text-muted); display: inline-flex; align-items: center; gap: 4px; }
.drd-warn-score b { color: var(--color-danger); }
.drd-warn-card .card-title { display: inline-flex; align-items: center; gap: 8px; }
.drd-inline { margin: 0; }
.drd-ok { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--color-text-muted); font-size: 13.5px; }
.drd-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 12.5px; color: var(--color-text-muted); margin: 0 0 12px; }
.drd-legend > span { display: inline-flex; align-items: center; gap: 7px; }
/* status dots */
.drd-cell, .drd-dot-static { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; background: none; border-radius: 50%; }
.drd-cell > i, .drd-dot-static > i { display: block; width: 13px; height: 13px; border-radius: 50%; background: var(--drd-dot); box-shadow: 0 0 0 3px var(--drd-halo); transition: transform var(--dur-fast) var(--ease-out); }
button.drd-cell { cursor: pointer; }
button.drd-cell:hover > i, button.drd-cell:focus-visible > i { transform: scale(1.3); }
button.drd-cell:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.drd-dot-open { --drd-dot: var(--color-warning); --drd-halo: color-mix(in srgb, var(--color-warning) 24%, transparent); }
.drd-dot-closed { --drd-dot: var(--color-success); --drd-halo: color-mix(in srgb, var(--color-success) 24%, transparent); }
.drd-dot-overdue { --drd-dot: var(--color-danger); --drd-halo: color-mix(in srgb, var(--color-danger) 28%, transparent); }
.drd-dot-none { --drd-dot: transparent; --drd-halo: var(--color-border-strong); }
.drd-dot-none > i { width: 9px; height: 9px; box-shadow: 0 0 0 1.5px var(--color-border-strong) inset; background: transparent; }
.drd-dot-static.drd-dot-none > i { box-shadow: 0 0 0 1.5px var(--color-border-strong) inset; }
/* matrix */
.drd-matrix-card { overflow: hidden; }
.drd-scroll { overflow: auto; max-height: min(74vh, 820px); max-width: 100%; overscroll-behavior-x: contain; }
.drd-table.data-table { min-width: 1240px; border: 0; border-radius: 0; box-shadow: none; }
.drd-table.data-table th { white-space: nowrap; top: 0; }
.drd-warn-card { margin-bottom: var(--space-4); }
.drd-table th.drd-mh, .drd-table td.drd-m { text-align: center; padding-left: 4px; padding-right: 4px; width: 46px; }
.drd-table td.drd-m { padding-top: 8px; padding-bottom: 8px; }
.drd-table .is-current { background: color-mix(in srgb, var(--color-accent) 7%, transparent); }
.drd-table th.is-current { color: var(--color-accent); }
.drd-table th.drd-sticky, .drd-table td.drd-sticky { position: sticky; left: 0; width: 290px; min-width: 290px; max-width: 290px; box-shadow: 1px 0 0 var(--color-border); }
.drd-table th.drd-sticky { z-index: 4; }
.drd-table td.drd-sticky { z-index: 1; }
table.data-table.drd-table tbody tr td.drd-sticky { background: var(--color-surface); }
table.data-table.drd-table tbody tr:hover td.drd-sticky { background: color-mix(in srgb, var(--color-accent) 7%, var(--color-surface)); }
.drd-table tr.drd-row-overdue td.drd-sticky { box-shadow: inset 3px 0 0 var(--color-danger), 1px 0 0 var(--color-border); }
.drd-first { display: flex; align-items: flex-start; gap: 8px; }
.drd-first-body { min-width: 0; }
.drd-ref { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.drd-text { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.drd-dept { width: 230px; min-width: 230px; max-width: 230px; font-size: 12.5px; white-space: normal; }
.drd-dept .drd-dn { font-weight: 600; }
.drd-dept .muted { font-size: 12px; line-height: 1.35; }
.drd-target { white-space: nowrap; }
.drd-target.is-overdue { color: var(--color-danger); font-weight: 600; }
.drd-over { font-size: 11.5px; color: var(--color-danger); font-weight: 600; }
.drd-checkall { margin-right: 8px; }
.drd-bulk-only { display: none !important; }
.is-bulk .drd-bulk-only { display: inline-block !important; }
.drd-matrix-card.is-bulk .drd-checkall { display: inline-flex !important; }
.drd-bulkbar { position: sticky; bottom: 12px; z-index: 30; display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin-top: 14px; padding: 12px 16px; border-radius: var(--radius-lg); background: var(--card-glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur)); }
.drd-bulkbar[hidden] { display: none; }
.drd-bulkbar label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--color-text-muted); }
.drd-bulkbar input[type="text"] { flex: 1 1 220px; min-width: 0; }
/* segmented radio */
.drd-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--color-canvas); border: 1px solid var(--color-border); }
.drd-seg label { position: relative; margin: 0; cursor: pointer; }
.drd-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.drd-seg span { display: block; padding: 5px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.drd-seg input:checked + span { background: var(--color-surface); color: var(--color-accent); box-shadow: var(--shadow-xs); }
.drd-seg input:focus-visible + span { outline: 2px solid var(--color-accent); }
.drd-modal .form-group { margin-bottom: 14px; }
.drd-modal input[type="date"], .drd-modal textarea { width: 100%; }
/* mobile card list */
.drd-cards { display: none; }
@media (max-width: 699px) {
    .drd-scroll { display: none; }
    .drd-cards { display: grid; gap: 10px; padding: 12px; }
    .drd-card-item { padding: 14px; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface); }
    .drd-card-item.is-overdue { border-left: 3px solid var(--color-danger); }
    .drd-ci-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
    .drd-ci-text { margin: 8px 0 4px; font-size: 13px; line-height: 1.45; }
    .drd-ci-meta { margin: 2px 0; font-size: 12px; color: var(--color-text-muted); }
    .drd-ci-meta.drd-over { color: var(--color-danger); font-weight: 600; }
    .drd-strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0; margin: 12px 0; }
    .drd-strip-m { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--color-text-muted); }
    .drd-strip-m.is-current span { color: var(--color-accent); font-weight: 700; }
    .drd-strip .drd-cell { width: 100%; max-width: 24px; }
    .drd-bulkbar { bottom: 8px; }
}
/* ---- Self assessment (dept_self_assessment.php, dept_self_assessment_edit.php) ---- */
.drd-small { font-size: 12px; }
.drd-of { font-size: 14px; font-weight: 500; color: var(--color-text-muted); }
.drd-list .drd-comp { min-width: 170px; }
.drd-list .drd-comp .progress { margin-bottom: 4px; }
.drd-var-pos { color: var(--color-danger); font-weight: 600; }
.drd-var-ok { color: var(--color-success); font-weight: 600; }
.drd-sum { margin-bottom: var(--space-4); }
.drd-sum-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 20px; align-items: center; }
.drd-sum-label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 8px; color: var(--color-text-muted); }
.drd-sum-label b { color: var(--color-text); }
.drd-stat { padding-left: 18px; border-left: 1px solid var(--color-border); }
.drd-stat-v { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--color-ink); }
.drd-stat-v.is-bad { color: var(--color-danger); }
.drd-stat-l { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.drd-note { margin: 14px 0 0; }
.drd-area-card { margin-bottom: var(--space-4); }
.drd-subs { display: grid; gap: 0; }
.drd-sub { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 16px 0; border-top: 1px solid var(--color-border-soft); }
.drd-sub:first-child { border-top: 0; padding-top: 4px; }
.drd-sub-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drd-sub-name { font-weight: 600; font-size: 14px; }
.drd-saved { margin-left: auto; font-size: 12px; color: var(--color-success); min-height: 1em; }
.drd-saved.is-bad { color: var(--color-danger); }
.drd-side { display: grid; gap: 8px; min-width: 0; }
.drd-side textarea, .drd-side input[type="text"], .drd-notes { width: 100%; }
.drd-aud { padding: 12px 14px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--color-accent) 6%, transparent); border: 1px dashed color-mix(in srgb, var(--color-accent) 30%, transparent); }
.drd-aud-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-accent); }
.drd-ro { margin: 0; font-size: 13px; line-height: 1.5; }
.drd-rate { flex-wrap: wrap; justify-self: start; max-width: 100%; }
.drd-rate input:disabled + span { cursor: default; }
.drd-rate label[data-r="Effective"] input:checked + span { background: var(--color-success-soft); color: var(--color-success); }
.drd-rate label[data-r="Partially effective"] input:checked + span { background: var(--color-warning-soft); color: var(--color-warning); }
.drd-rate label[data-r="Ineffective"] input:checked + span { background: var(--color-danger-soft); color: var(--color-danger); }
.drd-rate label[data-r="Not applicable"] input:checked + span { background: var(--color-border); color: var(--color-text); }
@media (min-width: 900px) {
    .drd-sub { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
    .drd-sub-head { grid-column: 1 / -1; }
}
@media (max-width: 899px) {
    .drd-sum-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .drd-sum-progress { grid-column: 1 / -1; }
    .drd-stat { padding-left: 0; border-left: 0; }
}
.drd-gap[hidden] { display: none; }
@media (min-width: 900px) {
    .drd-solo .drd-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
    .drd-solo .drd-side > .drd-rate { grid-column: 1 / -1; }
}
.drd-ro svg { display: inline-block; vertical-align: -2px; margin-right: 4px; }
@media (max-width: 500px) { .drd-seg span { padding: 5px 9px; } }
/* DRD end */

/* DRC: department risk administration, plan chips, dashboard tile, board section */
.drc-area { margin-bottom: var(--space-4); }
.drc-area.drc-inactive, .drc-sub-row.drc-inactive { opacity: .62; }
.drc-area-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.drc-area-title { display: flex; gap: 12px; align-items: flex-start; min-width: 0; flex: 1 1 260px; }
.drc-area-title .card-title { margin-bottom: 6px; overflow-wrap: anywhere; }
.drc-order { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--color-accent-soft); color: var(--color-accent); display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; }
.drc-area-actions { display: flex; gap: 4px; align-items: center; }
.drc-indicators { font-size: 12.5px; color: var(--color-text-muted); margin: 0 0 var(--space-3); }
.drc-sub-list { display: flex; flex-direction: column; margin-top: var(--space-3); border-top: 1px solid var(--color-border-soft); }
.drc-sub-row { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--color-border-soft); }
.drc-sub-name { display: flex; gap: 6px; align-items: center; flex: 1 1 260px; min-width: 0; }
.drc-sub-name input { flex: 1 1 auto; min-width: 0; min-height: 34px; padding: 5px 10px; font-size: 13px; }
.drc-sub-move { display: flex; gap: 6px; align-items: center; }
.drc-sub-move select { min-height: 32px; padding: 3px 8px; font-size: 12px; width: auto; max-width: 190px; }
.drc-sub-count { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; }
.drc-sub-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.drc-add-sub { display: flex; gap: 8px; align-items: flex-start; margin-top: var(--space-3); }
.drc-add-sub textarea { flex: 1 1 auto; min-height: 38px; }
.drc-preview-table td, .drc-preview-table th { white-space: nowrap; }
.drc-after { color: var(--color-accent); font-weight: 700; }
.drc-preview-note { margin-top: var(--space-2); }
.drc-warn { display: flex; gap: 8px; align-items: center; margin-bottom: var(--space-3); }
.drc-suggest-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: 8px 0; border-top: 1px solid var(--color-border-soft); flex-wrap: wrap; }
.drc-errlist { margin: 6px 0 0 18px; padding: 0; }
.drc-basis { display: grid; gap: var(--space-3); }
.drc-basis-row { display: flex; flex-direction: column; gap: 8px; padding: var(--space-3); border: 1px solid var(--color-border-soft); border-radius: var(--radius-sm); }
.drc-basis-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.drc-weight { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.drc-weight input { width: 72px; min-height: 32px; }
.drc-bandbar { display: flex; width: 100%; border-radius: var(--radius-sm); overflow: hidden; margin: var(--space-3) 0; font-size: 12px; font-weight: 600; }
.drc-bandbar span { padding: 8px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.drc-band-high { background: #E1493F; } .drc-band-medium { background: #DB8A2E; } .drc-band-low { background: #17A673; }
.drc-bandtable input { min-height: 34px; min-width: 80px; }
.drc-chip { display: inline-block; font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 7px; border-radius: 999px; white-space: nowrap; text-decoration: none; }
.drc-chip-high { background: var(--color-danger-soft); color: var(--color-danger); }
.drc-chip-medium { background: var(--color-warning-soft); color: var(--color-warning); }
.drc-chip-low { background: var(--color-success-soft); color: var(--color-success); }
.drc-propose td .field-hint { margin: 2px 0 0; }
.drc-quarters { display: flex; gap: 10px; flex-wrap: wrap; }
.drc-dash-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; }
.drc-dash-list li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.drc-dash-split { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.drc-tiles { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.drc-tile { display: block; padding: 12px; border-radius: var(--radius-sm); text-decoration: none; color: #1B1B2F; border: 1px solid rgba(0,0,0,.06); }
.drc-tile b { display: block; font-size: 20px; }
.drc-tile span { display: block; font-size: 12px; overflow-wrap: anywhere; }
.drc-tile-high { background: #F9DAD7; } .drc-tile-medium { background: #FAEBD3; } .drc-tile-low { background: #DCF3EA; } .drc-tile-none { background: #ECEBF4; }
@media (max-width: 640px) {
    .drc-sub-actions { margin-left: 0; }
    .drc-add-sub { flex-direction: column; align-items: stretch; }
    .drc-bandbar { flex-direction: column; }
    .drc-bandbar span { width: 100% !important; }
}
/* DRC end */

/* DRB -- Department risk pages (dept_risk.php, dept_risk_view.php, glossary.php). Prefix .drb- */
.drb-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.drb-year { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); margin: 0; }
.drb-half { margin: 0; }
.drb-inline-form { display: inline; margin: 0; }
.drb-muted-sm { font-size: 12px; color: var(--color-text-muted); margin: 6px 0 0; }
.drb-warn { color: var(--color-warning); font-weight: 600; }
.drb-nowrap { white-space: nowrap; }
.drb-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--color-text-muted); margin-bottom: 6px; }
.drb-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--color-accent-soft); color: var(--color-accent); font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.drb-count.warn { background: var(--color-warning-soft); color: var(--color-warning); }
.drb-badge-lg { font-size: 13px; padding: 5px 14px; }
.kpi-grid-5 .kpi-tile .kpi-value { font-size: 30px; }

/* Heat strip */
.drb-heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.drb-heat-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 8px 4px; border-radius: 10px; color: #fff; text-decoration: none; border: 1px solid transparent; transition: transform .15s ease, box-shadow .15s ease; }
.drb-heat-cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; color: #fff; }
.drb-heat-code { font-size: 10px; font-weight: 600; opacity: .9; letter-spacing: .03em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drb-heat-score { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.drb-heat-cell.lv-low { background: linear-gradient(160deg, var(--color-success), color-mix(in srgb, var(--color-success) 65%, #000)); }
.drb-heat-cell.lv-medium { background: linear-gradient(160deg, var(--color-warning), color-mix(in srgb, var(--color-warning) 65%, #000)); }
.drb-heat-cell.lv-high { background: linear-gradient(160deg, var(--color-danger), color-mix(in srgb, var(--color-danger) 65%, #000)); }
.drb-heat-cell.lv-none { background: var(--color-text-muted); }
.drb-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--color-text-muted); }
.drb-lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--color-text-muted); }
.drb-lg.low::before { background: var(--color-success); } .drb-lg.medium::before { background: var(--color-warning); } .drb-lg.high::before { background: var(--color-danger); }

/* League table */
.drb-league td { vertical-align: middle; }
.drb-rank { font-weight: 700; color: var(--color-text-muted); width: 44px; font-variant-numeric: tabular-nums; }
.drb-dept a { color: var(--color-text); }
.drb-dept a:hover { color: var(--color-accent); }
.drb-dept-meta { display: block; font-size: 11.5px; color: var(--color-text-muted); margin-top: 1px; }
.drb-scorecell { min-width: 130px; }
.drb-score-num { display: inline-block; min-width: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
.drb-bar { display: inline-block; vertical-align: middle; width: 70px; height: 7px; border-radius: 4px; background: var(--color-border-soft); overflow: hidden; }
.drb-bar-fill { display: block; height: 100%; width: var(--w); background: var(--c); border-radius: 4px; }
.drb-trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.drb-trend.t-up { color: var(--color-success); } .drb-trend.t-down { color: var(--color-danger); } .drb-trend.t-flat { color: var(--color-text-muted); }

/* Hero */
.drb-hero { display: grid; grid-template-columns: auto 1fr minmax(200px, 260px); gap: 24px; align-items: center; margin-bottom: 18px; background: var(--card-glass-bg); overflow: hidden; }
.drb-hero::after { content: ""; position: absolute; inset: 0 0 auto auto; width: 320px; height: 220px; pointer-events: none; background: radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--drb-c, var(--color-accent)) 18%, transparent), transparent 70%); }
.drb-hero.lv-low { --drb-c: var(--color-success); } .drb-hero.lv-medium { --drb-c: var(--color-warning); } .drb-hero.lv-high { --drb-c: var(--color-danger); }
.drb-hero > * { position: relative; z-index: 1; }
.drb-ring { display: block; max-width: 100%; height: auto; }
.drb-ring-arc { transition: stroke-dasharray .6s var(--ease-out, ease); }
.drb-ring-num { font-size: 30px; font-weight: 700; fill: var(--color-text); font-variant-numeric: tabular-nums; }
.drb-ring-unit { font-size: 10px; fill: var(--color-text-muted); text-transform: uppercase; letter-spacing: .1em; }
.drb-hero-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.drb-freq { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-text-muted); }
.drb-freq strong { color: var(--color-text); }
.drb-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.drb-stats > div { padding: 10px 12px; border-radius: 12px; background: var(--color-surface-2); border: 1px solid var(--color-border-soft); }
.drb-stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; color: var(--color-text); }
.drb-stats span { font-size: 11.5px; color: var(--color-text-muted); }
.drb-stats .is-warn b { color: var(--color-warning); }
.drb-note { display: flex; gap: 6px; align-items: flex-start; margin: 12px 0 0; font-size: 12px; color: var(--color-text-muted); }
.drb-spark { display: block; max-width: 100%; height: auto; }
.drb-spark-cap { font-size: 11.5px; color: var(--color-text-muted); margin-top: 4px; }

/* Tabs and layout */
#drbTabs { margin-top: 16px; }
#drbTabs .card { margin-bottom: 16px; }
.drb-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.drb-two > .card { margin-bottom: 0 !important; }

/* Glossary / basis */
.drb-basis { display: grid; gap: 10px; }
.drb-basis-item, .drb-basis-card { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--color-border-soft); background: var(--color-surface-2); }
.drb-basis-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.drb-basis-item p, .drb-basis-card p { margin: 0; font-size: 12.5px; color: var(--color-text-muted); line-height: 1.55; }
.drb-w { font-size: 11.5px; font-weight: 600; color: var(--color-text-muted); }
.drb-basis-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.drb-basis-card { padding: 16px; box-shadow: var(--shadow-xs); }
.drb-basis-card.lv-critical { border-top: 3px solid #B23A2E; } .drb-basis-card.lv-high { border-top: 3px solid var(--color-danger); }
.drb-basis-card.lv-medium { border-top: 3px solid var(--color-warning); } .drb-basis-card.lv-low { border-top: 3px solid var(--color-success); }
.drb-bands { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.drb-band { padding: 16px; border-radius: 14px; border: 1px solid var(--color-border-soft); background: var(--color-surface-2); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.drb-band-range { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.drb-band-freq { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--color-text-muted); }
.drb-band.lv-low { border-left: 4px solid var(--color-success); } .drb-band.lv-medium { border-left: 4px solid var(--color-warning); } .drb-band.lv-high { border-left: 4px solid var(--color-danger); }
.drb-details summary { cursor: pointer; list-style: none; }
.drb-details summary::-webkit-details-marker { display: none; }
.drb-details summary::before { content: "\25B8"; display: inline-block; margin-right: 6px; color: var(--color-text-muted); transition: transform .15s ease; }
.drb-details[open] summary::before { transform: rotate(90deg); }
.drb-sublist { margin: 8px 0 4px 22px; padding: 0; font-size: 12.5px; color: var(--color-text-muted); }
.drb-sublist li { margin-bottom: 3px; }
.drb-search-row { display: grid; grid-template-columns: minmax(0, 1fr) 240px 150px; gap: 10px; }
.drb-search-row .search-input-wrap { margin: 0; max-width: none; }
.drb-search-meta { font-size: 12px; color: var(--color-text-muted); margin-top: 8px; min-height: 16px; }
.drb-g-dept { margin-bottom: 14px; }
.drb-g-area { padding: 12px 0; border-top: 1px solid var(--color-border-soft); }
.drb-g-area-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drb-g-area-name { font-weight: 600; color: var(--color-text); }
.drb-g-area-name:hover { color: var(--color-accent); }
.drb-g-subs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.drb-g-subs li { padding: 3px 10px; border-radius: 999px; font-size: 12px; background: var(--color-surface-2); border: 1px solid var(--color-border-soft); color: var(--color-text-muted); }
.drb-g-dept mark, .drb-g-area mark { background: color-mix(in srgb, var(--color-brass) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
[hidden].drb-g-dept, [hidden].drb-g-area, .drb-g-subs li[hidden], #glEmpty[hidden] { display: none !important; }

/* Ratings matrix */
.drb-matrix td { vertical-align: middle; }
tr.drb-area-row td { background: var(--color-accent-soft) !important; }
.drb-sub-name { padding-left: 28px !important; color: var(--color-text-muted); }
tr.drb-sub-row.has-ex .drb-sub-name { color: var(--color-text); font-weight: 600; }
.drb-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--color-border-strong); vertical-align: 0; }
.drb-dot.on { background: var(--color-danger); box-shadow: 0 0 0 3px var(--color-danger-soft); }
.drb-waterfall { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.drb-wf-row { display: grid; grid-template-columns: 1fr 78px; grid-template-areas: "label val" "track track" "note note"; gap: 4px 10px; }
.drb-wf-label { grid-area: label; font-weight: 600; font-size: 13px; }
.drb-wf-val { grid-area: val; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.drb-wf-track { grid-area: track; position: relative; height: 12px; border-radius: 6px; background: var(--color-border-soft); overflow: hidden; }
.drb-wf-seg { position: absolute; top: 0; bottom: 0; left: var(--l); width: var(--w); border-radius: 6px; background: var(--color-accent); }
.drb-wf-note { grid-area: note; font-size: 12px; color: var(--color-text-muted); line-height: 1.5; }
.drb-wf-row.is-neg .drb-wf-seg { background: var(--color-danger); } .drb-wf-row.is-neg .drb-wf-val { color: var(--color-danger); }
.drb-wf-row.is-pos .drb-wf-seg { background: var(--color-success); } .drb-wf-row.is-pos .drb-wf-val { color: var(--color-success); }
.drb-wf-row.is-base .drb-wf-seg { background: var(--color-text-muted); opacity: .55; }
.drb-wf-row.is-end { padding-top: 10px; border-top: 1px dashed var(--color-border-strong); }
.drb-wf-row.is-end.lv-low .drb-wf-seg { background: var(--color-success); } .drb-wf-row.is-end.lv-medium .drb-wf-seg { background: var(--color-warning); } .drb-wf-row.is-end.lv-high .drb-wf-seg { background: var(--color-danger); }
.drb-wf-row.is-end .drb-wf-val { font-size: 18px; }
.drb-marks .form-group { margin-bottom: 10px; }
.drb-formula { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--color-border-soft); }
.drb-formula h4 { font-size: 13px; margin: 0 0 8px; }
.drb-formula ol { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--color-text-muted); line-height: 1.6; }
.drb-formula li { margin-bottom: 4px; }

/* Findings */
.drb-unmapped { border-color: color-mix(in srgb, var(--color-warning) 55%, var(--color-border)); }
.drb-unmapped .card-title { display: flex; align-items: center; gap: 8px; color: var(--color-warning); }
.drb-find-sub { margin-top: 12px; }
.drb-find-sub-head { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.drb-find-list { display: grid; gap: 8px; }
.drb-find { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--color-surface-2); border: 1px solid var(--color-border-soft); }
.drb-find-main { min-width: 0; }
.drb-find-id { font-weight: 700; margin-right: 6px; }
.drb-find-text { margin: 6px 0 0; font-size: 12.5px; color: var(--color-text-muted); line-height: 1.5; overflow-wrap: anywhere; }
.drb-assign { display: flex; gap: 8px; align-items: center; }
.drb-assign select { max-width: 260px; }

/* Simulator */
.drb-sim { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.drb-sim-panel { position: sticky; top: 76px; }
.drb-sim-score { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.drb-sim-delta { font-size: 12.5px; margin-top: 6px; font-weight: 600; color: var(--color-text-muted); }
.drb-sim-delta.t-up { color: var(--color-success); } .drb-sim-delta.t-down { color: var(--color-danger); }
.drb-sim-sliders { display: grid; gap: 12px; margin-bottom: 14px; }
.drb-sim-sliders label { display: block; font-size: 12.5px; font-weight: 600; }
.drb-sim-sliders output { float: right; font-variant-numeric: tabular-nums; color: var(--color-accent); }
.drb-sim-sliders input[type=range] { width: 100%; margin-top: 6px; accent-color: var(--color-accent); }
.drb-sim-area { margin-bottom: 14px; }
.drb-sim-area-head { padding: 6px 0; border-bottom: 1px solid var(--color-border-soft); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.drb-sim-sub { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 4px; border-radius: 8px; cursor: pointer; font-size: 13px; margin: 0; }
.drb-sim-sub:hover { background: var(--color-hover); }
.drb-sim-sub input { width: 16px; height: 16px; accent-color: var(--color-danger); }
.drb-sim-name { overflow-wrap: anywhere; }
.drb-sim-cost { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--color-text-muted); }
.drb-sim-sub:has(input:checked) .drb-sim-name { font-weight: 600; }
.drb-sim-sub:has(input:checked) .drb-sim-cost { color: var(--color-danger); font-weight: 700; }

/* Suggestions */
.drb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
#drbTabs .drb-cards .card { margin-bottom: 0; }
.drb-suggest { display: flex; flex-direction: column; gap: 8px; }
.drb-suggest h3 { font-size: 15px; margin: 0; line-height: 1.35; }
.drb-suggest-head { display: flex; align-items: center; gap: 8px; }
.drb-arrow { color: var(--color-text-muted); display: inline-flex; }
.drb-reason { margin: 0; font-size: 13px; }
.drb-suggest form { margin-top: auto; padding-top: 6px; }

@media (max-width: 1100px) {
    .drb-hero { grid-template-columns: auto 1fr; }
    .drb-hero-spark { grid-column: 1 / -1; }
    .drb-basis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .drb-sim { grid-template-columns: minmax(0, 1fr); }
    .drb-sim-panel { position: static; }
}
@media (max-width: 860px) {
    .drb-two { grid-template-columns: minmax(0, 1fr); }
    .drb-bands { grid-template-columns: minmax(0, 1fr); }
    .drb-search-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .drb-hero { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 14px; }
    .drb-hero-main, .drb-hero-spark { width: 100%; }
    .drb-hero-top { justify-content: center; }
    .drb-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .drb-basis-grid { grid-template-columns: minmax(0, 1fr); }
    .drb-find { grid-template-columns: minmax(0, 1fr); }
    .drb-assign { flex-wrap: wrap; } .drb-assign select { max-width: none; flex: 1 1 100%; }
    .drb-heat { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
    .drb-controls { gap: 8px; }
    #drbTabs .tabs { max-width: 100%; }
}
.drb-league .drb-dept { min-width: 200px; max-width: 320px; }
.drb-league .drb-dept-meta { overflow-wrap: anywhere; }
.drb-find > * { min-width: 0; }
.drb-assign select { min-width: 0; }
@media (max-width: 640px) { .drb-assign, .drb-assign select { width: 100%; max-width: 100%; } }

/* BG -- Branch glossary (glossary.php Branches view, admin_branch_glossary.php, exception hint). Prefix .bg- */
.bg-toggle { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--color-surface-2); border: 1px solid var(--color-border-soft); margin-bottom: 16px; }
.bg-toggle a { padding: 7px 18px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--color-text-muted); text-decoration: none; }
.bg-toggle a:hover { color: var(--color-text); }
.bg-toggle a.active { background: var(--color-accent); color: #fff; }
.bg-tier-title { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 22px 0 10px; }
.bg-tier-title .bg-tier-meta { font-size: 12.5px; font-weight: 500; color: var(--color-text-muted); }
.bg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; align-items: start; margin-bottom: 6px; }
.bg-card { margin-bottom: 0 !important; min-width: 0; }
.bg-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.bg-card-name { font-size: 14.5px; font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.bg-w { display: inline-block; padding: 2px 9px; border-radius: 10px; background: var(--color-surface-2); border: 1px solid var(--color-border-soft); font-size: 11.5px; font-weight: 600; color: var(--color-text-muted); overflow-wrap: anywhere; }
.bg-w.bg-warn { color: var(--color-warning); }
.bg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.bg-list { margin: 10px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.55; color: var(--color-text); }
.bg-list li { overflow-wrap: anywhere; }
.bg-list li[hidden], .bg-card[hidden], .bg-tier[hidden] { display: none; }
.bg-card mark, .bg-list mark { background: color-mix(in srgb, var(--color-warning) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.bg-basis-note { font-size: 12.5px; color: var(--color-text-muted); margin: 0 0 12px; }
.bg-manage { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bg-kpis { margin-bottom: 16px; }
.bg-note { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; margin-bottom: 16px; }
.bg-note > span { min-width: 0; overflow-wrap: anywhere; }
.bg-add-form .form-actions, .bg-details-body .form-actions { margin-top: 12px; }
.bg-area { margin-bottom: 14px; }
.bg-area.is-off, .bg-item.is-off { opacity: .6; }
.bg-area-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bg-area-main { min-width: 0; flex: 1 1 260px; }
.bg-actions, .bg-item-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bg-inline { display: inline; margin: 0; }
.bg-details { margin: 12px 0; border: 1px solid var(--color-border-soft); border-radius: 12px; background: var(--color-surface-2); }
.bg-details > summary { cursor: pointer; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--color-accent); }
.bg-details-body { padding: 4px 14px 14px; }
.bg-items { list-style: none; margin: 0; padding: 0; }
.bg-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--color-border-soft); flex-wrap: wrap; }
.bg-item-edit { display: flex; gap: 8px; align-items: center; flex: 1 1 260px; min-width: 0; margin: 0; }
.bg-item-edit input { flex: 1; min-width: 0; }
.bg-item-add { display: flex; gap: 8px; align-items: center; margin: 12px 0 0; flex-wrap: wrap; }
.bg-item-add input { flex: 1 1 200px; min-width: 0; }
.bg-hint { display: none; white-space: nowrap; margin-top: 6px; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--color-text-muted); }
.bg-hint.is-on { display: flex; }
@media (max-width: 640px) { .bg-toggle { display: flex; } .bg-toggle a { flex: 1; text-align: center; padding: 8px 6px; } }

/* AL -- Workbook Reconciliation (dept_risk_reconcile.php). Prefix .al- */
.al-kpis .kpi-label { overflow-wrap: anywhere; }
.al-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.al-table td, .al-table th { vertical-align: middle; }
.al-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.al-dept { min-width: 190px; }
.al-code { display: block; font-size: 11px; color: var(--color-text-muted); letter-spacing: .03em; overflow-wrap: anywhere; }
.al-diff { font-weight: 700; color: var(--color-warning); }
.al-levels { white-space: nowrap; }
.al-arrow { display: inline-flex; vertical-align: middle; margin: 0 2px; color: var(--color-text-muted); }
.al-row.is-diff td:first-child { box-shadow: inset 3px 0 0 var(--color-warning); }
.al-toggle svg { transition: transform .15s ease; }
.al-toggle.is-open svg { transform: rotate(180deg); }
.al-cause[hidden] { display: none; }
.al-cause > td { background: var(--color-surface-2); padding: 0 !important; }
.al-cause-body { padding: 12px 16px 14px; max-width: 980px; font-size: 13px; line-height: 1.6; }
.al-cause-body p { margin: 6px 0 0; overflow-wrap: anywhere; }
.al-quirk { display: inline-block; padding: 2px 10px; border-radius: 10px; background: var(--color-warning-soft); color: var(--color-warning); font-size: 11.5px; font-weight: 700; }
.al-changed { color: var(--color-danger); }
.al-struct { margin-bottom: 16px; padding: 0; }
.al-struct-sum { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; cursor: pointer; padding: 14px 18px; font-weight: 700; font-size: 14px; list-style: none; }
.al-struct-sum::-webkit-details-marker { display: none; }
.al-struct-sum > span:first-child { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.al-struct[open] .al-struct-sum { border-bottom: 1px solid var(--color-border-soft); }
.al-struct-body { padding: 14px 18px 18px; }
.al-struct-scroll { margin: 8px 0 14px; }
.al-h4 { font-size: 13.5px; margin: 16px 0 8px; }
.al-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.al-nowrap { white-space: nowrap; }
@media (max-width: 640px) {
    .al-hide-sm { display: none; }
    .al-dept { min-width: 0; max-width: 84px; }
    .al-table th.al-num { white-space: normal; }
    .al-table th { white-space: normal; letter-spacing: 0; font-size: 10.5px; }
    .al-table .badge { padding: 2px 6px; font-size: 11px; }
    .al-code { display: none; }
    .al-table th, .al-table td { padding-left: 4px; padding-right: 4px; }
    table.data-table.al-table { display: table; white-space: normal; width: 100%; table-layout: fixed; }
    .al-table th:nth-child(1) { width: 32%; }
    .al-table th:nth-child(2) { width: 19%; }
    .al-table th:nth-child(3) { width: 15%; }
    .al-table th:nth-child(5) { width: 22%; }
    .al-table th:nth-child(7) { width: 12%; }
    .al-table th { font-size: 9.5px; }
    .al-dept strong { overflow-wrap: break-word; font-size: 12px; }
    .al-table .al-toggle { padding: 4px 0; width: 26px; min-width: 0; justify-content: center; }
    .al-table td:last-child, .al-table th:last-child { padding-right: 4px; }
    .al-table th:nth-child(2) { font-size: 9px; }
    .al-table th, .al-table td { font-size: 12.5px; }
    .al-levels { white-space: normal; }
    .al-struct-sum, .al-struct-body { padding-left: 14px; padding-right: 14px; }
}
/* AL end */

/* R2 management and assurance reports: audit coverage, resolution, self-assessment variance, CAE executive brief */
.r2-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.r2-controls label { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); margin: 0; }
.r2-def { margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--color-border-soft); border-left: 3px solid var(--color-accent); border-radius: 10px; background: var(--color-surface); font-size: 12.5px; color: var(--color-text-muted); line-height: 1.55; }
.r2-def summary { cursor: pointer; font-weight: 700; color: var(--color-text); font-size: 13px; }
.r2-def ul { margin: 8px 0 0; padding-left: 18px; }
.r2-def li { margin-bottom: 4px; }
.r2-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.r2-grid-2 > .card { min-width: 0; }
.r2-page > .card, .r2-page > .r2-grid-2, .r2-page > .kpi-grid, .r2-brief > .card, .r2-brief > .r2-grid-2, .r2-brief > .kpi-grid { margin-bottom: 16px; }
.r2-grid-2 > .card { margin-bottom: 0; }
.r2-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r2-name { min-width: 150px; font-weight: 600; }
.r2-muted { color: var(--color-text-muted); font-size: 12px; }
.r2-bar { display: inline-block; width: 90px; height: 8px; border-radius: 6px; background: var(--color-border-soft); overflow: hidden; vertical-align: middle; }
.r2-bar > span { display: block; height: 100%; background: var(--color-accent); border-radius: 6px; }
.r2-bar.ok > span { background: var(--color-success); }
.r2-bar.warn > span { background: var(--color-warning); }
.r2-bar.bad > span { background: var(--color-danger); }
.r2-pcell { display: inline-flex; align-items: center; gap: 8px; }
.r2-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.r2-heat td.r2-h { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.r2-heat td.r2-h0 { color: var(--color-text-muted); font-weight: 500; }
table.data-table.r2-heat tbody tr td.r2-h1 { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
table.data-table.r2-heat tbody tr td.r2-h2 { background: color-mix(in srgb, var(--color-accent) 26%, transparent); }
table.data-table.r2-heat tbody tr td.r2-h3 { background: color-mix(in srgb, var(--color-accent) 42%, transparent); }
table.data-table.r2-heat tbody tr td.r2-h4 { background: color-mix(in srgb, var(--color-accent) 60%, transparent); color: var(--color-text); }
table.data-table.r2-heat tbody tr td.r2-bad.r2-h1 { background: color-mix(in srgb, var(--color-danger) 14%, transparent); }
table.data-table.r2-heat tbody tr td.r2-bad.r2-h2 { background: color-mix(in srgb, var(--color-danger) 28%, transparent); }
table.data-table.r2-heat tbody tr td.r2-bad.r2-h3 { background: color-mix(in srgb, var(--color-danger) 44%, transparent); }
table.data-table.r2-heat tbody tr td.r2-bad.r2-h4 { background: color-mix(in srgb, var(--color-danger) 62%, transparent); color: var(--color-text); }
.r2-months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.r2-month { border: 1px solid var(--color-border-soft); border-radius: 10px; padding: 8px 4px; text-align: center; background: var(--color-surface); min-width: 0; }
.r2-month b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.r2-month span { display: block; font-size: 10.5px; color: var(--color-text-muted); }
.r2-month.is-future { opacity: .45; }
.r2-month.ok b { color: var(--color-success); } .r2-month.warn b { color: var(--color-warning); } .r2-month.bad b { color: var(--color-danger); }
/* Executive brief */
.r2-brief { max-width: 980px; }
.r2-brief-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 2px solid var(--color-accent); }
.r2-brief-head h2 { margin: 0; font-size: 20px; }
.r2-brief-head p { margin: 2px 0 0; color: var(--color-text-muted); font-size: 12.5px; }
.r2-conf { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--color-danger); }
.r2-ap { list-style: none; counter-reset: ap; margin: 0; padding: 0; display: grid; gap: 10px; }
.r2-ap li { counter-increment: ap; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 14px; line-height: 1.5; }
.r2-ap li::before { content: counter(ap); display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--color-accent); color: #fff; font-weight: 700; font-size: 12px; }
.r2-brief h3.r2-sec { font-size: 13.5px; margin: 0 0 8px; }
.r2-email-form { display: inline-flex; margin: 0; }
.r2-brief .r2-tight td, .r2-brief .r2-tight th { padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 900px) { .r2-grid-2 { grid-template-columns: minmax(0, 1fr); } .r2-months { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 640px) { .r2-name { min-width: 120px; } .r2-bar { width: 56px; } .r2-brief-head h2 { font-size: 17px; } }
@media print {
    .r2-controls, .r2-links, .page-header-actions, .r2-noprint { display: none !important; }
    .r2-brief { max-width: none; }
    .r2-brief .card { break-inside: avoid; border: 1px solid #ccc; box-shadow: none !important; }
    .sidebar, .navbar, .topbar { display: none !important; }
}
/* R2 end */

/* R1 -- Department report set and Report Centre (dept_report_*.php, reports_hub.php). Prefixes .dr- and .rc- */
.dr-sr { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dr-controls { align-items: center; }
.dr-presets { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.dr-defs { margin-top: 16px; }
.dr-note { display: flex; gap: 6px; align-items: center; margin: 0 0 14px; }
.dr-sub { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--color-text-muted); }
.dr-none { margin: 0 0 6px; font-size: 13px; }
.dr-two { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.dr-two > .card { margin-bottom: 0 !important; min-width: 0; }
table.dr-table tfoot th { position: static; background: var(--color-surface-2); color: var(--color-text); font-size: 12.5px; text-transform: none; letter-spacing: 0; border-top: 2px solid var(--color-border); }
table.dr-table tfoot th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.dr-table td a { color: var(--color-text); }
table.dr-table td a:hover { color: var(--color-accent); }
.dr-wrap { min-width: 180px; white-space: normal; font-size: 12.5px; color: var(--color-text-muted); }
.dr-cell.is-blank { background: var(--color-surface-2); }
.dr-cell.is-done { color: var(--color-success); font-weight: 700; }
.dr-months td.num, .dr-months th.num { min-width: 46px; }

/* bars */
.dr-bar { display: inline-block; vertical-align: middle; width: 100%; max-width: 140px; height: 7px; border-radius: 4px; background: var(--color-border-soft); overflow: hidden; }
.dr-bar-fill { display: block; height: 100%; width: var(--w); background: var(--c); border-radius: 4px; }
.dr-ratecell { white-space: nowrap; min-width: 150px; }
.dr-rate-n { display: inline-block; min-width: 36px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--color-text-muted); }

/* stacked chart */
.dr-chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--color-text-muted); margin-bottom: 10px; }
.dr-lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dr-lg.high::before, .dr-seg.high { background: var(--color-danger); }
.dr-lg.medium::before, .dr-seg.medium { background: var(--color-warning); }
.dr-lg.low::before, .dr-seg.low { background: var(--color-success); }
.dr-lg.nr::before, .dr-seg.not_rated { background: var(--color-text-muted); opacity: .55; }
.dr-chart-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dr-chart-row { display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) 32px; gap: 10px; align-items: center; font-size: 12.5px; }
.dr-chart-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text); }
.dr-chart-track { display: flex; height: 20px; border-radius: 6px; overflow: hidden; background: var(--color-surface-2); }
.dr-seg { display: flex; align-items: center; justify-content: center; width: var(--w); min-width: 3px; color: #fff; font-size: 11px; font-weight: 700; }
.dr-seg-n { line-height: 1; }
.dr-chart-total { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
    .dr-chart-row { grid-template-columns: minmax(0, 1fr) 30px; }
    .dr-chart-name { grid-column: 1 / -1; white-space: normal; }
    .dr-chart-track { grid-column: 1; }
}

/* movement */
.dr-mx { font-weight: 700; font-variant-numeric: tabular-nums; }
.dr-mx.is-better { background: var(--color-success-soft); color: var(--color-success); }
.dr-mx.is-worse { background: var(--color-danger-soft); color: var(--color-danger); }
.dr-mx.is-same { background: var(--color-surface-2); }
.dr-mx.is-neutral { background: var(--color-surface-2); color: var(--color-text-muted); }
.dr-matrix th[scope="row"] { position: static; text-transform: none; letter-spacing: 0; }
.dr-movers { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.dr-movers li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--color-surface-2); border: 1px solid var(--color-border-soft); font-size: 13px; }
.dr-mv-lv { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.dr-narr { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; }

/* hotspots */
.dr-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.dr-rank li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.dr-rank-n { width: 24px; height: 24px; border-radius: 50%; background: var(--color-accent-soft); color: var(--color-accent); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.dr-rank-body { min-width: 0; display: grid; gap: 3px; }
.dr-rank-title { font-weight: 600; font-size: 13.5px; color: var(--color-text); overflow-wrap: anywhere; }
.dr-rank-meta { font-size: 12px; color: var(--color-text-muted); }
.dr-rank-body .dr-bar { max-width: none; }
.dr-rank-v { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.dr-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dr-plain li { display: grid; gap: 1px; font-size: 13px; }
.dr-plain-meta { font-size: 12px; color: var(--color-text-muted); }

/* scorecards */
.dr-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 8px; }
.dr-pick-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--color-border-soft); border-radius: 10px; background: var(--color-surface-2); cursor: pointer; font-size: 13px; margin: 0; }
.dr-pick-item:hover { border-color: var(--color-accent); }
.dr-pick-item:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.dr-pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-pick-score { font-variant-numeric: tabular-nums; color: var(--color-text-muted); font-size: 12px; }
.dr-pick-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dr-pick-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.dr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; margin-top: 16px; }
.dr-sc { margin-bottom: 0 !important; border-top: 3px solid var(--color-border); min-width: 0; }
.dr-sc.lv-high { border-top-color: var(--color-danger); } .dr-sc.lv-medium { border-top-color: var(--color-warning); } .dr-sc.lv-low { border-top-color: var(--color-success); }
.dr-sc-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.dr-sc-head h3 { margin: 0 0 6px; font-size: 16px; overflow-wrap: anywhere; }
.dr-sc-head h3 a { color: var(--color-text); }
.dr-sc-freq, .dr-sc-prev { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.dr-sc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.dr-sc-stats > div { padding: 8px 6px; border-radius: 10px; background: var(--color-surface-2); border: 1px solid var(--color-border-soft); text-align: center; }
.dr-sc-stats b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.dr-sc-stats span { font-size: 10.5px; color: var(--color-text-muted); }
.dr-sc-tiers { display: grid; gap: 6px; }
.dr-sc-tier { display: grid; grid-template-columns: 62px minmax(0, 1fr) 48px; gap: 8px; align-items: center; font-size: 12px; }
.dr-sc-tier .dr-bar { max-width: none; }
.dr-sc-tier b { text-align: right; font-variant-numeric: tabular-nums; }
.dr-focus { margin: 0; padding-left: 18px; font-size: 12.5px; display: grid; gap: 4px; color: var(--color-text); }

/* Report Centre */
.rc-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.rc-search { flex: 1 1 280px; max-width: 460px; margin: 0; }
.rc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.rc-chip { font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); cursor: pointer; }
.rc-chip:hover { border-color: var(--color-accent); color: var(--color-accent); }
.rc-chip:focus-visible, .rc-card:focus-visible, .rc-reset:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.rc-chip.is-on { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
.rc-group { margin-bottom: 26px; }
.rc-group[hidden], .rc-card[hidden], #rcEmpty[hidden] { display: none !important; }
.rc-group-title { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-muted); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.rc-group-n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--color-accent-soft); color: var(--color-accent); font-size: 11px; line-height: 18px; text-align: center; }
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.rc-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; border: 1px solid var(--color-border-soft); background: var(--card-glass-bg, var(--color-surface)); color: var(--color-text); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; min-width: 0; }
.rc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--color-accent); text-decoration: none; color: var(--color-text); }
.rc-card-top { display: flex; align-items: center; gap: 10px; }
.rc-card-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--color-accent-soft); color: var(--color-accent); }
.rc-card-title { font-weight: 650; font-size: 14.5px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rc-card-desc { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.5; flex: 1; }
.rc-card-formats { display: flex; gap: 5px; flex-wrap: wrap; }
.rc-fmt { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: var(--color-surface-2); border: 1px solid var(--color-border-soft); color: var(--color-text-muted); }
.rc-fmt-pdf { color: var(--color-danger); } .rc-fmt-xlsx, .rc-fmt-csv { color: var(--color-success); } .rc-fmt-word { color: var(--color-accent); }
.rc-reset { font: inherit; background: none; border: 0; padding: 0; color: var(--color-accent); text-decoration: underline; cursor: pointer; }
@media (max-width: 900px) { .dr-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
    .dr-sc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dr-controls .btn, .rc-search { max-width: none; }
    .dr-movers li { grid-template-columns: minmax(0, 1fr) auto; }
    .dr-movers .dr-mv-lv { grid-column: 1 / -1; order: 3; }
}
.dr-sc .drb-ring-num { font-size: 22px; } .dr-sc .drb-ring-unit { font-size: 7px; }
/* R1 end */

/* F1: department assessed status (Not assessed) */
.f1-yearnote { align-self: center; font-size: 12px; color: var(--color-text-muted); }
.drb-lg.f1-lg-na { color: var(--color-text-muted); }
.f1-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md, 12px); border: 1px solid var(--color-border); background: var(--color-canvas); color: var(--color-text); margin-bottom: 16px; }
.f1-banner.is-warn { border-color: var(--color-warning); background: var(--color-warning-soft); }
.f1-banner strong { font-weight: 600; }
.f1-na-hero { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 132px; height: 132px; border-radius: 50%; border: 12px solid var(--color-border); color: var(--color-text-muted); font-size: 13px; text-align: center; box-sizing: border-box; }
.f1-check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.f1-check input { margin-top: 3px; }
.f1-na { color: var(--color-text-muted); font-style: normal; }
/* F1 end */

/* F1 needs mapping */
a.f1-map-badge { text-decoration: none; white-space: nowrap; }
a.f1-map-badge:hover { text-decoration: underline; }
.f1-cov { display: block; font-size: 0.75rem; color: var(--color-text-muted); margin-top: 2px; }
.f1-cov.is-low { color: var(--color-warning); font-weight: 600; }
.f1-lowcov { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; background: var(--color-warning-soft); color: var(--color-warning); }
.f1-sugg-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--color-border); }
.f1-sugg-row:first-child { border-top: 0; }
.f1-sugg-body { flex: 1 1 auto; min-width: 0; }
.f1-sugg-body select { max-width: 100%; }
.f1-sugg-txt { overflow-wrap: anywhere; }
.f1-sugg-note { font-size: 0.75rem; color: var(--color-text-muted); }
.f1-sugg-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
/* F1 needs mapping end */
.kpi-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpi-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .kpi-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.drb-heat-cell.lv-map { background: var(--color-warning); }
.f1-backlog-list { margin: 4px 0 0; padding: 0; list-style: none; font-size: 0.75rem; line-height: 1.5; }
.f1-backlog-list a { text-decoration: none; overflow-wrap: anywhere; }
.f1-backlog-list li { overflow-wrap: anywhere; }
/* F1 needs mapping end 2 */

/* Q1 review: the glass "Inputs: frosted" rule (specificity 0,3,1 and 0,5,1 in dark) beat the transparent search fields
   of the sidebar and the command palette, leaving a grey block behind the placeholder. Re-assert transparency. */
:root .nav-filter-wrap input.nav-filter-input.nav-filter-input:not([type=checkbox]):not([type=radio]):not([type=range]),
:root .palette-search input:not([type=checkbox]):not([type=radio]):not([type=range]):not(.q1a):not(.q1b):not(.q1c) { background: transparent; background-color: transparent; }
/* The in-form warning under an area was a .flash, which app.js turns into a toast (one per area, stacking over the page). Now a static note. */
.drc-warn-inline { padding: 10px 14px; border-radius: var(--radius-sm); border-left: 3px solid var(--color-danger); background: var(--color-danger-soft); color: #7A251C; font-size: 13px; }
:root[data-theme="dark"] .drc-warn-inline { color: #FFA9A2; }
/* Persistent notices (a .flash would be turned into a 5 second toast by app.js) */
.q1-notice { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; border-left: 3px solid var(--color-accent); background: var(--color-accent-soft); color: var(--color-text); }
.q1-notice-error { border-left-color: var(--color-danger); background: var(--color-danger-soft); color: #7A251C; }
:root[data-theme="dark"] .q1-notice-error { color: #FFA9A2; }
.q1-notice ul { margin: 6px 0 0; padding-left: 18px; }
/* Q1 end */

/* BI: bulk import preview */
.bulk-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.bulk-kpis { margin-bottom: 16px; }
.bulk-preview td { vertical-align: top; max-width: 280px; }
.bulk-preview td.bulk-notes { min-width: 220px; color: var(--text-muted, #6b7280); font-size: 12.5px; }
.bulk-preview tr.bulk-error td { background: rgba(220, 38, 38, 0.06); }
.bulk-preview tr.bulk-warn td { background: rgba(245, 158, 11, 0.07); }
.bulk-preview tr.bulk-duplicate td { opacity: 0.7; }

/* BI2: printed-report tables read top-down like the signed report */
.audit-report-doc table.data-table td, .audit-report-doc table.data-table th { vertical-align: top; text-align: left; }
.audit-report-doc table.report-mini-table { width: auto; max-width: 100%; table-layout: auto; }
.audit-report-doc table.report-mini-table th, .audit-report-doc table.report-mini-table td { border: 1px solid var(--color-border, #e5e3f0); }

/* MD3: Google-style rounded design layer. Larger radii, pill buttons and
   controls, softer elevation. Token overrides first so every component that
   already uses the radius scale picks it up; specific rules after. */
:root {
    --radius-xs: 8px;
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 26px;
    --radius-xl: 34px;
    --radius-pill: 999px;
    --input-h: 46px;
}
.btn { --btn-h: 42px; border-radius: var(--radius-pill); padding: 8px 22px; font-size: 14px; }
.btn-sm { --btn-h: 34px; border-radius: var(--radius-pill); padding: 5px 16px; font-size: 13px; }
.btn-xs { --btn-h: 28px; border-radius: var(--radius-pill); padding: 3px 12px; font-size: 12px; }
.btn-lg { border-radius: var(--radius-pill); }
.btn-primary { box-shadow: 0 1px 2px rgba(60, 50, 140, .25), 0 6px 16px -6px rgba(108, 92, 231, .55); }
.btn-primary:hover { box-shadow: 0 2px 4px rgba(60, 50, 140, .28), 0 10px 22px -8px rgba(108, 92, 231, .65); }
.btn-secondary { --btn-border: var(--color-border-strong, var(--input-border)); }
.btn-icon, .btn-icon-sm { border-radius: 50%; }
.btn-icon-sm { border-radius: var(--radius-pill); }

:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="color"]), select) { border-radius: var(--radius-pill); padding-left: 18px; padding-right: 18px; }
select { padding-right: 38px; }
textarea { border-radius: var(--radius-md); padding: 12px 18px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: 0 0 0 4px var(--color-accent-soft); }

.card, .form-section, .kpi-card, .dash-card, .table-wrap, .data-table-wrap { border-radius: var(--radius-lg); }
.card, .form-section { box-shadow: 0 1px 2px rgba(40, 36, 90, .05), 0 8px 24px -14px rgba(40, 36, 90, .22); border-color: transparent; }
.page-icon { border-radius: 50%; }
.page-header h1 { letter-spacing: -0.02em; }
.badge, .pill, .chip { border-radius: var(--radius-pill); }
.flash { border-radius: var(--radius-md); }
.sidebar a.nav-item { border-radius: var(--radius-pill); margin: 0 6px; }
.sidebar a.nav-item.active::before { display: none; }
.sidebar-brand .brand-mark, .sidebar-brand img { border-radius: 14px; }
.navbar-search, #navSearchBtn.navbar-search { border-radius: var(--radius-pill); }
.modal, .modal-card, .palette, .dropdown-menu, .user-menu { border-radius: var(--radius-lg); }
.tabs .tab, .tab-btn, .tab-link, .segmented a, .segmented button { border-radius: var(--radius-pill); }
.file-drop { border-radius: var(--radius-lg); }
.pagination a, .pagination span, .pager a, .pager span { border-radius: var(--radius-pill); }
table.data-table, .table-wrap table { border-radius: var(--radius-md); }
.audit-report-doc, .audit-report-doc * { border-radius: 0; }
.audit-report-doc .badge { border-radius: var(--radius-pill); }

/* MD3 login */
.auth-body { background:
    radial-gradient(900px 500px at 12% 8%, rgba(108,92,231,.14), transparent 60%),
    radial-gradient(800px 500px at 90% 92%, rgba(216,155,74,.16), transparent 60%),
    var(--color-canvas); }
.auth-card-v7 { max-width: 460px; border-radius: 32px; border-color: transparent;
    box-shadow: 0 2px 6px rgba(40,36,90,.06), 0 30px 70px -24px rgba(40,36,90,.35); background: rgba(255,255,255,.94); }
.auth-card-v7::before { display: none; }
.auth-card-v7-inner { padding: 44px 40px 36px; }
.auth-left-top { margin-bottom: 22px; }
.auth-left-mark { border-radius: 50%; width: 46px; height: 46px; }
.auth-form-head h2 { font-size: 26px; letter-spacing: -.02em; }
.auth-checklist { border-radius: var(--radius-md); background: var(--color-accent-soft); border-color: transparent; }
.auth-body .input-with-icon { border-radius: var(--radius-pill); padding: 13px 18px 13px 46px; }
.auth-body .otp-box, .otp-input { border-radius: 16px; }
.auth-submit { border-radius: var(--radius-pill); padding: 14px; font-size: 15px; }
.auth-steps .auth-step-dot { border-radius: 50%; }
:root[data-theme="dark"] .auth-card-v7 { background: rgba(26,27,52,.92); }
:root[data-theme="dark"] .auth-checklist { background: rgba(108,92,231,.14); }
@media (max-width: 480px) { .auth-card-v7 { border-radius: 26px; } .auth-card-v7-inner { padding: 32px 22px 28px; } }

/* MD3 landing */
.landing-feature { border-radius: var(--radius-lg); }
.landing-feature .lf-icon { border-radius: 50%; width: 38px; height: 38px; }
.lv-card { border-radius: 34px; }
.lv-kpi { border-radius: 20px; }
.landing-nav .mark .badge-o { border-radius: 50%; }
.landing-cta a.btn-primary { padding: 15px 32px; box-shadow: 0 10px 28px -10px rgba(216,155,74,.6); }
.landing-eyebrow { border-radius: var(--radius-pill); }

/* EXC: exceptions list drill-down */
.exc-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.exc-kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); text-decoration: none; color: var(--color-text); transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur-fast); }
.exc-kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--color-accent); }
.exc-kpi.is-on { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.exc-kpi-n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.exc-kpi-l { font-size: 12px; color: var(--color-text-muted); }
.exc-kpi.is-warn .exc-kpi-n { color: #B7791F; } .exc-kpi.is-ok .exc-kpi-n { color: #1F8A54; } .exc-kpi.is-bad .exc-kpi-n { color: #C0392B; }
.exc-filters { padding: 18px 20px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 14px; }
.exc-year-row { display: flex; gap: 8px; flex-wrap: wrap; }
.exc-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; border-radius: var(--radius-pill); border: 1px solid var(--color-border-strong, var(--input-border)); background: var(--color-surface); color: var(--color-text); font-size: 13px; font-weight: 600; text-decoration: none; transition: background var(--dur-fast), border-color var(--dur-fast); }
.exc-pill:hover { text-decoration: none; border-color: var(--color-accent); background: var(--color-hover); }
.exc-pill.is-on { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
.exc-pill-n { font-size: 11.5px; font-weight: 600; opacity: .7; }
.exc-filter-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; }
.exc-filter-grid .exc-search { grid-column: span 6; }
.exc-more .exc-filter-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 12px; }
.exc-search { position: relative; display: block; }
.exc-search .icon, .exc-search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; }
.exc-search input { width: 100%; padding-left: 44px; }
.exc-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--color-text-muted); }
.exc-filters select, .exc-filters input[type="date"] { width: 100%; min-width: 0; }
.exc-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--color-accent); list-style: none; display: inline-flex; padding: 4px 2px; }
.exc-more > summary::-webkit-details-marker { display: none; }
.exc-filter-actions { display: flex; gap: 8px; }
.exc-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.exc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--radius-pill); background: var(--color-accent-soft); color: var(--color-accent); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.exc-chip:hover { text-decoration: none; filter: brightness(.95); }
.exc-sub { font-size: 11.5px; margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.exc-text-cell { min-width: 280px; max-width: 520px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
@media (max-width: 1100px) { .exc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .exc-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .exc-filter-grid .exc-search { grid-column: span 3; } .exc-more .exc-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .exc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .exc-filter-grid, .exc-more .exc-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .exc-filter-grid .exc-search { grid-column: span 2; } .exc-filters { padding: 14px; } .exc-text-cell { min-width: 0; } }

/* SF: saved views bar */
.sf-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.sf-label { font-size: 12px; font-weight: 600; color: var(--color-text-muted); margin-right: 2px; }
.sf-view { display: inline-flex; align-items: center; background: var(--color-accent-soft); border-radius: var(--radius-pill); }
.sf-view-link { padding: 6px 6px 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--color-accent); text-decoration: none; }
.sf-view-link:hover { text-decoration: underline; }
.sf-del { display: inline-flex; margin: 0; }
.sf-del button { background: none; border: 0; cursor: pointer; padding: 6px 10px 6px 4px; color: var(--color-accent); display: inline-flex; border-radius: var(--radius-pill); opacity: .7; }
.sf-del button:hover { opacity: 1; }
.sf-save { display: inline-flex; gap: 6px; align-items: center; margin: 0 0 0 auto; }
.sf-save input { width: 160px; min-height: 34px; padding: 5px 14px; font-size: 12.5px; }
.exc-table td.b2-num { white-space: nowrap; }

/* FD: finding detail blocks and evidence gallery */
.fd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fd-block { background: var(--color-surface-2, var(--color-canvas)); border-radius: var(--radius-md); padding: 16px 20px; border-left: 4px solid var(--color-accent-soft); }
.fd-wide { grid-column: 1 / -1; }
.fd-block h4 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--color-text-muted); }
.fd-body { font-size: 14px; line-height: 1.65; color: var(--color-text); overflow-wrap: anywhere; }
.ev-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin: 14px 0; }
.ev-card { display: flex; flex-direction: column; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.ev-thumb { display: block; height: 140px; background: var(--color-canvas); overflow: hidden; }
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur) var(--ease-out); }
.ev-thumb:hover img { transform: scale(1.04); }
.ev-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--color-text-muted); font-size: 12px; font-weight: 600; text-decoration: none; }
.ev-missing { color: #B7791F; text-align: center; padding: 0 12px; }
.ev-meta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.ev-title { font-size: 13px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ev-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.ev-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ev-by { font-size: 11.5px; }
.ev-add > summary { list-style: none; cursor: pointer; display: inline-flex; }
.ev-add > summary::-webkit-details-marker { display: none; }
@media (max-width: 700px) { .fd-grid { grid-template-columns: 1fr; } .ev-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fd-block { padding: 14px 16px; } }

/* Narrow side panels: label above value */
.b2-detail-layout > aside .detail-list, .b2-detail-layout > .stack ~ * .detail-list { grid-template-columns: 1fr; }
.b2-detail-layout > aside .detail-list > dt, .b2-detail-layout > .stack ~ * .detail-list > dt { padding: 10px 0 0; border-bottom: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.b2-detail-layout > aside .detail-list > dd, .b2-detail-layout > .stack ~ * .detail-list > dd { padding: 2px 0 10px; }

/* HO: handover and cover */
.ho-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.ho-list { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 6px 6px 8px; margin: 0 0 14px; max-height: 280px; overflow: auto; }
.ho-list legend { font-size: 13px; font-weight: 700; padding: 0 8px; display: flex; gap: 10px; align-items: center; }
.ho-all { font-size: 12px; font-weight: 600; color: var(--color-accent); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.ho-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; align-items: start; }
.ho-item:hover { background: var(--color-hover); }
.ho-item input { margin-top: 3px; grid-row: span 2; }
.ho-item-main { font-size: 13.5px; overflow-wrap: anywhere; }
.ho-item-meta { font-size: 12px; }
.ho-check { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: 13px; cursor: pointer; }
.ho-transfer { align-self: end; }
.ho-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ho-feed li { padding: 12px 0; border-bottom: 1px solid var(--color-border-soft, var(--color-border)); font-size: 13.5px; }
.ho-feed li:last-child { border-bottom: 0; }
.ho-reason { margin-top: 4px; padding: 8px 12px; background: var(--color-canvas); border-radius: var(--radius-sm); font-size: 13px; }
.ho-reason-cell { max-width: 340px; font-size: 13px; }
.ho-decide { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.ho-decide input { flex: 1; min-width: 120px; min-height: 32px; padding: 4px 12px; font-size: 12.5px; }
.ho-inline { display: inline-block; margin-left: 6px; }
.ho-sub { margin: 14px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--color-text-muted); }
.ho-empty { padding: 4px 0 8px; }
.ho-people { display: flex; flex-wrap: wrap; gap: 6px; }
.ho-person { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--radius-pill); background: var(--color-accent-soft); color: var(--color-accent); font-size: 12.5px; font-weight: 600; }
.ho-person.is-cover { background: #FBEEDC; color: #8A5A12; }
.ho-panel { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 14px 16px; margin-top: 10px; }
.ho-panel > summary { cursor: pointer; font-weight: 600; font-size: 13px; list-style: none; display: flex; align-items: center; gap: 8px; }
.ho-panel > summary::-webkit-details-marker { display: none; }
@media (max-width: 1000px) { .ho-grid { grid-template-columns: minmax(0, 1fr); } }

/* R2: settings, security, recycle bin, history, holds */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.set-wide { grid-column: 1 / -1; }
.set-card .card-subtitle { max-width: 70ch; }
.set-form { display: flex; flex-direction: column; gap: 14px; }
.set-form .form-actions { margin-top: 2px; }
.set-num { max-width: 160px; }
.set-state { display: inline-flex; align-items: center; margin-left: 10px; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--color-canvas); color: var(--color-text-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; vertical-align: middle; }
.set-state.is-on { background: var(--color-success-soft); color: var(--color-success); }
.sw { position: relative; display: inline-flex; flex: 0 0 auto; }
.sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.sw-track { width: 42px; height: 24px; border-radius: 999px; background: var(--color-border); transition: background var(--dur-fast); position: relative; }
.sw-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform var(--dur-fast) var(--ease-out); }
.sw input:checked + .sw-track { background: var(--color-accent); }
.sw input:checked + .sw-track::after { transform: translateX(18px); }
.sw input:focus-visible + .sw-track { outline: 3px solid var(--color-accent-soft); outline-offset: 2px; }
.sw input:disabled + .sw-track { opacity: .5; }
.sw-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer; }
.sw-row .sw-text { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.sw-row .sw-text .muted { font-size: 12.5px; }
.pin-input { letter-spacing: .35em; font-size: 20px; text-align: center; max-width: 220px; }
.auth-hint { margin: 2px 0 10px; font-size: 12px; color: var(--color-text-muted); line-height: 1.5; }
.danger-card { border-color: var(--color-danger-soft); }
.lh-card .lh-active { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.lh-reason { font-size: 13.5px; padding: 8px 12px; background: var(--color-canvas); border-radius: var(--radius-sm); }
.lh-form { display: flex; flex-direction: column; gap: 10px; }
.hist-table td { font-size: 13px; vertical-align: top; }
.hist-old { color: var(--color-text-muted); }
.hist-new { font-weight: 600; }
.hist-empty { padding: 4px 0 8px; }
.rb-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.rb-tab { display: inline-flex; gap: 8px; align-items: center; padding: 7px 16px; border-radius: var(--radius-pill); background: var(--color-surface); border: 1px solid var(--color-border); font-size: 13px; font-weight: 600; color: var(--color-text); text-decoration: none; }
.rb-tab b { color: var(--color-text-muted); font-weight: 700; }
.rb-tab.is-on { background: var(--color-accent-soft); border-color: transparent; color: var(--color-accent); }
.rb-tab.is-on b { color: var(--color-accent); }
.rb-tab:hover { text-decoration: none; }
.rb-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rb-actions form { margin: 0; }
.idle-overlay { position: fixed; inset: 0; background: rgba(15, 16, 32, .55); display: none; align-items: center; justify-content: center; z-index: 9999; padding: 16px; }
.idle-overlay.is-open { display: flex; }
.idle-box { background: var(--color-surface); border-radius: 24px; padding: 28px; max-width: 420px; width: 100%; box-shadow: var(--shadow-lg, 0 20px 60px rgba(0,0,0,.3)); }
.idle-box h3 { margin: 0 0 8px; font-size: 20px; }
.idle-box p { margin: 0 0 18px; color: var(--color-text-muted); line-height: 1.55; }
.idle-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 900px) { .set-grid { grid-template-columns: minmax(0, 1fr); } }

/* R2: shared small helpers */
.muted { color: var(--color-text-muted); }

/* R2: @mention picker and highlighted mentions */
.mention-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px; background: var(--color-surface, #fff); border: 1px solid var(--color-border); border-radius: 12px; box-shadow: 0 8px 24px rgba(20, 20, 60, .14); overflow: hidden; max-height: 260px; overflow-y: auto; }
.mention-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; cursor: pointer; font-size: 14px; }
.mention-item span { color: var(--color-text-muted); font-size: 12px; }
.mention-item.is-active, .mention-item:hover { background: var(--color-surface-alt, rgba(127, 127, 160, .12)); }
.mention-chip { color: var(--color-primary, #2f6fed); font-weight: 600; }

/* ---- Complete Regulatory Year ---- */
.rc-panel { margin-top: 20px; }
.rc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; padding: 4px 0 8px; }
.rc-wide { grid-column: 1 / -1; }
.rc-actions { justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.rc-link { width: 100%; min-width: 220px; }
.rc-text { max-width: 360px; }
.rc-note { margin: 0 0 14px; }
.rc-done { display: flex; align-items: center; gap: 8px; margin: 16px 0; }
@media (max-width: 720px) { .rc-grid { grid-template-columns: minmax(0, 1fr); } .rc-actions .btn { flex: 1 1 100%; } }
.rc-ref { white-space: nowrap; }

/* =====================================================================
   Deposits (deposit_*.php, deposits.php)
   ===================================================================== */
.dep-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.dep-kpi { min-width: 0; }
.dep-kpi-sub { font-size: 11.5px; color: var(--color-text-muted); margin-top: 2px; }
.dep-kpi-sub.is-up, .dep-up { color: var(--color-success); } .dep-kpi-sub.is-down, .dep-down { color: var(--color-danger); }
.dep-tabs { margin-bottom: 14px; }
.dep-field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; margin-top: 12px; }
details.dep-ms { position: relative; }
details.dep-ms > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: pointer; padding: 9px 12px; border: 1px solid var(--color-border-strong, var(--input-border)); border-radius: var(--radius-sm, 10px); background: var(--color-surface); font-size: 13px; min-height: 40px; }
details.dep-ms > summary::-webkit-details-marker { display: none; }
details.dep-ms > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--color-text-muted); border-bottom: 2px solid var(--color-text-muted); transform: rotate(45deg) translateY(-2px); flex: none; }
details.dep-ms[open] > summary { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
details.dep-ms.has-value > summary { border-color: var(--color-accent); background: var(--color-accent-soft); }
.dep-ms-title { font-weight: 600; white-space: nowrap; }
.dep-ms-count { margin-left: auto; color: var(--color-text-muted); font-size: 12px; white-space: nowrap; }
details.dep-ms.has-value .dep-ms-count { color: var(--color-accent); font-weight: 600; }
.dep-ms-pop { position: absolute; z-index: 40; left: 0; top: calc(100% + 6px); width: max(100%, 280px); max-width: 92vw; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-md, 0 12px 32px rgba(21, 22, 43, .18)); padding: 10px; }
.dep-ms-search { width: 100%; margin-bottom: 8px; }
.dep-ms-tools { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 6px; }
.dep-ms-clear { background: none; border: 0; color: var(--color-accent); font-weight: 600; cursor: pointer; padding: 2px 0; }
.dep-ms-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; }
.dep-ms-opt { display: flex; align-items: center; gap: 9px; padding: 6px 6px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.dep-ms-opt:hover { background: var(--color-hover); }
.dep-ms-opt input { flex: none; }
.dep-ms-lab { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-ms-opt em { font-style: normal; font-size: 11.5px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.dep-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.dep-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.dep-grid-2 > .card, .dep-grid-3 > .card { margin-bottom: 0; min-width: 0; }
.dep-hbars { display: flex; flex-direction: column; gap: 9px; }
.dep-hbar-row { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) 104px; gap: 10px; align-items: center; font-size: 12.5px; }
.dep-hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; color: var(--color-text); }
.dep-hbar-label a { color: inherit; text-decoration: none; } .dep-hbar-label a:hover { color: var(--color-accent); text-decoration: underline; }
.dep-hbar-track { height: 12px; background: var(--color-canvas); border-radius: var(--radius-pill); overflow: hidden; }
.dep-hbar-fill { height: 100%; border-radius: var(--radius-pill); }
.dep-hbar-val { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; text-align: right; min-width: 64px; }
.dep-hbar-val span, .dep-div-val span { display: block; font-size: 11px; font-weight: 500; color: var(--color-text-muted); }
.dep-cols { display: flex; align-items: flex-end; gap: 8px; }
.dep-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.dep-col-val { font-size: 11px; font-weight: 650; margin-bottom: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dep-col-bar { width: 100%; max-width: 54px; border-radius: 8px 8px 3px 3px; }
.dep-col-lab { font-size: 11px; color: var(--color-text-muted); text-align: center; margin-top: 7px; line-height: 1.25; min-height: 28px; }
.dep-trend { width: 100%; height: auto; max-height: 260px; }
.dep-axis { font-size: 11px; fill: var(--color-text-muted); } .dep-axis-val { fill: var(--color-ink); font-weight: 650; }
.dep-div { display: flex; flex-direction: column; gap: 9px; }
.dep-div-row { display: grid; grid-template-columns: minmax(90px, 30%) minmax(0, 1fr) 104px; gap: 10px; align-items: center; font-size: 12.5px; }
.dep-div-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.dep-div-label a { color: inherit; text-decoration: none; } .dep-div-label a:hover { color: var(--color-accent); }
.dep-div-track { display: grid; grid-template-columns: 1fr 1fr; height: 12px; background: var(--color-canvas); border-radius: var(--radius-pill); overflow: hidden; }
.dep-div-half { display: flex; height: 100%; } .dep-div-neg { justify-content: flex-end; }
.dep-div-fill { height: 100%; }
.dep-div-val { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; min-width: 70px; text-align: right; }
.dep-div-val.is-up { color: var(--color-success); } .dep-div-val.is-down { color: var(--color-danger); }
.dep-table td.num, .dep-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dep-share { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.dep-share-bar { flex: 1; height: 7px; background: var(--color-canvas); border-radius: var(--radius-pill); overflow: hidden; }
.dep-share-bar i { display: block; height: 100%; background: var(--color-accent); border-radius: var(--radius-pill); }
.dep-flag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dep-flag { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); text-decoration: none; color: var(--color-text); transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur-fast); }
.dep-flag:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--color-accent); }
.dep-flag.is-clear { opacity: .72; }
.dep-flag-n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.dep-flag-t { font-weight: 650; font-size: 14px; } .dep-flag-d { font-size: 12px; color: var(--color-text-muted); } .dep-flag-amt { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dep-flag.is-hit .dep-flag-n { color: #C0392B; } .dep-flag.is-clear .dep-flag-n { color: #1F8A54; }
.dep-job { text-align: center; padding: 36px 24px; }
.dep-progress { height: 14px; border-radius: var(--radius-pill); background: var(--color-canvas); overflow: hidden; max-width: 520px; margin: 18px auto 8px; }
.dep-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--color-accent), #8E6CEF); border-radius: var(--radius-pill); transition: width .6s var(--ease-out); }
.dep-pct { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.dep-drop { border: 2px dashed var(--color-border-strong, var(--input-border)); border-radius: var(--radius-md); padding: 34px 20px; text-align: center; background: var(--color-canvas); }
.dep-drop input[type="file"] { max-width: 100%; }
.dep-note { padding: 12px 16px; border-radius: var(--radius-md); background: var(--color-warning-soft); color: #8A5A12; font-size: 13px; margin-bottom: 12px; }
.dep-note.is-info { background: var(--color-accent-soft); color: var(--color-accent); }
.dep-note.is-bad { background: var(--color-danger-soft); color: #A02B22; }
.dep-warn-list { margin: 0; padding-left: 18px; } .dep-warn-list li { margin: 3px 0; }
.dep-mini { width: 100%; } .dep-mini td, .dep-mini th { padding: 7px 10px; font-size: 13px; }
.dep-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dep-cmp-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: end; }
.dep-cmp-arrow { padding-bottom: 10px; color: var(--color-text-muted); }
@media (max-width: 960px) {
    .dep-grid-2, .dep-grid-3 { grid-template-columns: 1fr; }
    .dep-hbar-row, .dep-div-row { grid-template-columns: minmax(70px, 38%) minmax(0, 1fr) auto; }
    .dep-cmp-head { grid-template-columns: 1fr; } .dep-cmp-arrow { display: none; }
    .dep-pair { grid-template-columns: 1fr; }
    .dep-ms-pop { width: min(320px, 92vw); }
}
.dep-ms-done { background: var(--color-accent); color: #fff; border: 0; border-radius: var(--radius-pill); padding: 4px 14px; font-weight: 600; font-size: 12px; cursor: pointer; }

/* ---- Deposits: filter bar, drawer, records list, account panel, profile pages ---- */
.dep-bar { margin-bottom: 16px; }
.dep-bar-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 0; }
.dep-bar-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dep-date { position: relative; display: flex; align-items: center; flex: 0 0 auto; margin: 0; }
.dep-date-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--color-accent); display: flex; pointer-events: none; z-index: 2; }
.dep-date select, .dep-date .ui-select, .dep-date .ui-select-btn { min-width: 250px; }
.dep-date select, .dep-date .ui-select-btn { height: 42px; border-radius: var(--radius-pill); padding-left: 40px; }
.dep-search { flex: 1 1 300px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 16px; border: 1px solid var(--color-border); border-radius: var(--radius-pill); background: var(--color-surface-2); color: var(--color-text-muted); margin: 0; transition: border-color .15s, box-shadow .15s, background .15s; }
.dep-search:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); background: var(--color-surface); }
.dep-search input { border: 0; background: transparent; outline: 0; box-shadow: none; flex: 1; min-width: 0; font: inherit; color: var(--color-text); padding: 0; height: 100%; }
.dep-filter-btn { height: 42px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; gap: 8px; }
.dep-badge { background: var(--color-accent); color: #fff; border-radius: var(--radius-pill); min-width: 20px; height: 20px; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.dep-views, .dep-active { display: flex; gap: 8px; align-items: center; }
.dep-views { overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.dep-active { flex-wrap: wrap; }
.dep-views-lab { font-size: 12px; color: var(--color-text-muted); font-weight: 650; white-space: nowrap; margin-right: 2px; }
.dep-view { white-space: nowrap; display: inline-flex; align-items: center; padding: 6px 13px; border-radius: var(--radius-pill); border: 1px solid var(--color-border); font-size: 12.5px; font-weight: 600; color: var(--color-text); text-decoration: none; background: var(--color-surface); transition: border-color .15s, background .15s, color .15s; }
.dep-view:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }
.dep-view.is-on { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
.dep-view[class*="tone-"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dv, #B7B5C9); margin-right: 7px; flex: none; }
.dep-view.is-on::before { background: #fff; }
.tone-bad { --dv: var(--color-danger); } .tone-warn { --dv: var(--color-warning); } .tone-info { --dv: var(--color-accent); } .tone-mute { --dv: #B7B5C9; }
.dep-views-sep { width: 1px; height: 20px; background: var(--color-border); flex: none; margin: 0 4px; }
.dep-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; background: var(--color-accent-soft); color: var(--color-accent-strong); border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.dep-chip:hover { text-decoration: none; background: var(--color-danger-soft); color: var(--color-danger); }
.dep-clear { font-size: 12.5px; font-weight: 650; margin-left: 4px; }

.dep-drawer[hidden] { display: none; }
.dep-drawer { position: fixed; inset: 0; z-index: 90; }
.dep-drawer-back, .dep-panel-back { position: absolute; inset: 0; background: rgba(21, 22, 43, .38); backdrop-filter: blur(2px); animation: depFade .2s ease both; }
.dep-drawer-panel, .dep-panel-box { position: absolute; right: 0; top: 0; bottom: 0; width: min(470px, 100vw); background: var(--color-surface); box-shadow: -24px 0 60px rgba(21, 22, 43, .22); display: flex; flex-direction: column; border-radius: 24px 0 0 24px; animation: depSlide .28s cubic-bezier(.2, .8, .2, 1) both; overflow: hidden; }
.dep-panel-box { width: min(520px, 100vw); }
@keyframes depFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes depSlide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dep-drawer-back, .dep-panel-back, .dep-drawer-panel, .dep-panel-box { animation: none; } }
.dep-drawer-head { padding: 22px 24px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; border-bottom: 1px solid var(--color-border-soft); }
.dep-drawer-head h3 { margin: 0; font-size: 19px; } .dep-drawer-head p { margin: 2px 0 0; font-size: 12.5px; }
.dep-x { background: var(--color-canvas); border: 0; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--color-text); font-size: 20px; line-height: 1; flex: none; }
.dep-x:hover { background: var(--color-accent-soft); color: var(--color-accent); }
.dep-drawer-body { flex: 1; overflow-y: auto; padding: 4px 24px 24px; }
.dep-drawer-foot { padding: 14px 24px; border-top: 1px solid var(--color-border-soft); display: flex; justify-content: space-between; gap: 10px; background: var(--color-surface); }
.dep-drawer-foot .btn-primary { flex: 1; max-width: 260px; }
.dep-fsec h4 { font-size: 13.5px; font-weight: 700; margin: 22px 0 10px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.dep-fsec h4 span { font-weight: 500; color: var(--color-text-muted); font-size: 12px; }
.dep-fsec details.dep-ms { margin-bottom: 8px; }
.dep-drawer .dep-ms-pop { position: static; width: auto; max-width: none; box-shadow: none; border: 1px solid var(--color-border-soft); background: var(--color-surface-2); margin-top: 6px; border-radius: var(--radius-sm); padding: 10px; }
.dep-drawer .dep-ms-list { max-height: 230px; }
.dep-drawer .dep-ms-done { display: none; }
.dep-seg { display: flex; background: var(--color-canvas); border-radius: var(--radius-pill); padding: 4px; gap: 2px; margin-bottom: 10px; }
.dep-seg label { flex: 1; text-align: center; cursor: pointer; position: relative; margin: 0; }
.dep-seg input { position: absolute; opacity: 0; pointer-events: none; }
.dep-seg span { display: block; padding: 7px 4px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); transition: background .15s, color .15s; }
.dep-seg input:checked + span { background: var(--color-surface); color: var(--color-accent); box-shadow: var(--shadow-sm); }
.dep-fld { display: flex; flex-direction: column; gap: 5px; margin: 0 0 8px; min-width: 0; }
.dep-fld > span { font-size: 12px; font-weight: 600; color: var(--color-text-muted); }
.dep-fld-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }

.dep-kpis-sm { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.dep-list-card { overflow: hidden; margin-bottom: 8px; }
.dep-list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--color-border-soft); flex-wrap: wrap; font-size: 13.5px; }
.dep-sortbar { margin: 0; } .dep-sortbar label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--color-text-muted); font-weight: 600; margin: 0; }
.dep-list-scroll { overflow-x: auto; }
.dep-list { width: 100%; border-collapse: collapse; min-width: 1000px; }
.dep-list th { text-align: left; padding: 11px 14px; font-size: 12px; font-weight: 650; color: var(--color-text-muted); background: var(--color-surface-2); border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.dep-list th a { color: inherit; text-decoration: none; } .dep-list th a:hover { color: var(--color-accent); }
.dep-list th.num, .dep-list td.num { text-align: right; }
.dep-list td { padding: 12px 14px; border-bottom: 1px solid var(--color-border-soft); vertical-align: middle; font-size: 13px; }
.dep-list tbody tr { cursor: pointer; transition: background .12s; }
.dep-list tbody tr:hover, .dep-list tbody tr:focus-visible { background: var(--color-hover); outline: 0; }
.dep-list tbody tr:hover td:first-child, .dep-list tbody tr:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--color-accent); }
.dep-list tbody tr.dep-empty-row { cursor: default; } .dep-list tbody tr.dep-empty-row:hover { background: none; box-shadow: none; }
.dep-list td a { color: inherit; font-weight: 550; text-decoration: none; } .dep-list td a:hover { color: var(--color-accent); text-decoration: underline; }
.dep-cust { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.dep-cust strong { font-size: 13.5px; font-weight: 650; display: block; }
.dep-sub { font-size: 11.5px; color: var(--color-text-muted); margin-top: 2px; white-space: nowrap; }
.dep-av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; flex: none; letter-spacing: .02em; }
.dep-bal { display: block; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dep-bal.is-neg { color: var(--color-danger); }
.dep-balbar { display: block; height: 4px; border-radius: var(--radius-pill); background: var(--color-canvas); margin: 6px 0 0 auto; overflow: hidden; width: 110px; max-width: 100%; }
.dep-balbar i { display: block; height: 100%; background: linear-gradient(90deg, #8E6CEF, var(--color-accent)); border-radius: var(--radius-pill); } .dep-balbar i.is-neg { background: var(--color-danger); }
.dep-idle { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.dep-idle i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, #B7B5C9); flex: none; }
.dep-idle.tone-ok { --c: var(--color-success); } .dep-idle.tone-fair { --c: #7CC37F; } .dep-idle.tone-warn { --c: var(--color-warning); } .dep-idle.tone-bad { --c: var(--color-danger); } .dep-idle.tone-none { --c: #B7B5C9; }
.dep-fb { display: inline-block; padding: 3px 9px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 650; margin: 0 4px 2px 0; white-space: nowrap; background: var(--color-canvas); color: var(--color-text-muted); }
.dep-fb.tone-bad { background: var(--color-danger-soft); color: #B23127; } .dep-fb.tone-warn { background: var(--color-warning-soft); color: #94590F; } .dep-fb.tone-info { background: var(--color-accent-soft); color: var(--color-accent-strong); }
.dep-sort { display: inline-block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; margin-left: 4px; vertical-align: middle; }
.dep-sort.is-asc { border-bottom: 5px solid var(--color-accent); } .dep-sort.is-desc { border-top: 5px solid var(--color-accent); }

.dep-panel[hidden] { display: none; } .dep-panel { position: fixed; inset: 0; z-index: 95; }
.dep-pn-head { display: flex; gap: 14px; align-items: center; padding: 22px 22px 16px; border-bottom: 1px solid var(--color-border-soft); }
.dep-pn-id { flex: 1; min-width: 0; } .dep-pn-id h3 { margin: 0; font-size: 18px; line-height: 1.25; overflow-wrap: anywhere; }
.dep-pn-sub { display: flex; gap: 8px; align-items: center; margin-top: 5px; font-size: 12.5px; flex-wrap: wrap; } .dep-pn-sub code { font-family: var(--font-mono); font-size: 12px; background: var(--color-canvas); padding: 2px 8px; border-radius: 6px; }
.dep-pn-body { flex: 1; overflow-y: auto; padding: 6px 22px 22px; }
.dep-pn-bal { padding: 16px 0 6px; } .dep-pn-bal-n { display: block; font-size: 30px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.dep-pn-bal.is-neg .dep-pn-bal-n { color: var(--color-danger); } .dep-pn-bal-n small { font-size: 13px; color: var(--color-text-muted); font-weight: 600; letter-spacing: 0; }
.dep-pn-bal-d { font-size: 12.5px; color: var(--color-text-muted); }
.dep-pn-trend { margin: 8px 0 0; } .dep-pn-trend .dep-trend { max-height: 150px; }
.dep-pn-h { font-size: 13px; font-weight: 700; margin: 22px 0 8px; }
.dep-pn-foot { padding: 14px 22px; border-top: 1px solid var(--color-border-soft); display: flex; gap: 8px; flex-wrap: wrap; }
.dep-pn-loading, .dep-pn-empty { padding: 40px 24px; text-align: center; color: var(--color-text-muted); }
.dep-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin: 0; }
.dep-facts > div { padding: 9px 0; border-bottom: 1px solid var(--color-border-soft); min-width: 0; }
.dep-facts dt { font-size: 11.5px; color: var(--color-text-muted); font-weight: 600; } .dep-facts dd { margin: 2px 0 0; font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }
.dep-facts dd a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--color-border-strong); } .dep-facts dd a:hover { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.dep-facts.is-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dep-flaglist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dep-flaglist li { padding: 10px 14px; border-radius: 12px; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; background: var(--color-canvas); border-left: 4px solid var(--dv, #B7B5C9); }
.dep-flaglist li strong { font-size: 13px; } .dep-flaglist li span { color: var(--color-text-muted); }
.dep-ok { display: flex; align-items: center; gap: 8px; color: var(--color-success); margin: 0; }

.dep-who { display: flex; align-items: center; gap: 16px; margin: 0 0 16px; }
.dep-who-n { font-size: 22px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; }
.dep-moves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dep-move { padding: 12px 14px; border-radius: 14px; background: var(--color-surface-2); display: flex; flex-direction: column; gap: 2px; }
.dep-move .n { font-size: 22px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; } .dep-move.is-up .n { color: var(--color-success); } .dep-move.is-down .n { color: var(--color-danger); }
.dep-move .l { font-size: 12.5px; } .dep-move .a { font-size: 12px; color: var(--color-text-muted); }
.dep-mini-list { list-style: none; margin: 0; padding: 0; }
.dep-mini-list li a { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; text-decoration: none; color: inherit; }
.dep-mini-list li a:hover { background: var(--color-hover); text-decoration: none; }
.dep-mini-list .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dep-mini-list .t strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .dep-mini-list .t em { font-style: normal; font-size: 11.5px; color: var(--color-text-muted); }
.dep-mini-list .v { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; } .dep-mini-list .v.is-neg { color: var(--color-danger); }
.dep-lists .card { min-width: 0; }

@media (max-width: 820px) {
    .dep-date select, .dep-date .ui-select, .dep-date .ui-select-btn { min-width: 0; width: 100%; }
    .dep-date { flex: 1 1 100%; } .dep-search { flex: 1 1 100%; } .dep-filter-btn { flex: 1 1 100%; justify-content: center; }
    .dep-drawer-panel, .dep-panel-box { width: 100vw; border-radius: 0; }
    .dep-facts.is-wide { grid-template-columns: 1fr 1fr; } .dep-moves { grid-template-columns: 1fr 1fr; }
    .dep-list { min-width: 0; } .dep-list thead { display: none; }
    .dep-list tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid var(--color-border-soft); }
    .dep-list td { display: block; padding: 0; border: 0; } .dep-list td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--color-text-muted); font-weight: 600; margin-bottom: 1px; }
    .dep-list td.c-cust { grid-column: 1; } .dep-list td.c-cust::before, .dep-list td.c-bal::before { display: none; }
    .dep-list td.c-bal { grid-column: 2; grid-row: 1; text-align: right; } .dep-list td.c-flags:empty { display: none; }
    .dep-list td.c-branch, .dep-list td.c-rm, .dep-list td.c-prod, .dep-list td.c-status, .dep-list td.c-used, .dep-list td.c-flags { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
    .dep-list td.c-branch::before, .dep-list td.c-rm::before, .dep-list td.c-prod::before, .dep-list td.c-status::before, .dep-list td.c-used::before, .dep-list td.c-flags::before { margin: 0; }
    .dep-list tbody tr:hover td:first-child { box-shadow: none; }
}

.dep-bar .dep-search input[type="search"] { border: 0; background: transparent !important; background-color: transparent !important; box-shadow: none; border-radius: 0; padding: 0; height: 100%; }
.dep-bar .dep-search input[type="search"]:focus { box-shadow: none; }
.dep-overlay .cw-fab { display: none !important; }
@media (min-width: 821px) { .dep-views { flex-wrap: wrap; overflow: visible; } }
.dep-list td.c-branch, .dep-list td.c-rm, .dep-list td.c-prod { white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.dep-list td.c-rm { max-width: 170px; } .dep-list td.c-status, .dep-list td.c-used { white-space: nowrap; }
.dep-list td.c-flags { white-space: nowrap; min-width: 130px; }
.dep-list th.c-bal, .dep-list td.c-bal { min-width: 150px; }
@media (max-width: 820px) { .dep-list td.c-branch, .dep-list td.c-rm, .dep-list td.c-prod { max-width: none; white-space: normal; } }

.dep-list { min-width: 920px; } .dep-list th, .dep-list td { padding-left: 12px; padding-right: 12px; }
.dep-list td.c-branch { max-width: 220px; } .dep-list td.c-branch a { font-weight: 600; }
.dep-list td.c-branch .dep-sub { overflow: hidden; text-overflow: ellipsis; } .dep-list td.c-branch .dep-sub a { font-weight: 500; color: var(--color-text-muted); }
.dep-list td.c-branch .dep-sub a:hover { color: var(--color-accent); }
.dep-cust { min-width: 200px; } .dep-cust > div { min-width: 0; } .dep-cust strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; }
.dep-list td.c-flags { min-width: 100px; } .dep-list th.c-bal, .dep-list td.c-bal { min-width: 130px; }
@media (max-width: 820px) { .dep-list td.c-branch { max-width: none; } .dep-list td.c-branch .dep-sub { white-space: normal; } .dep-cust strong { max-width: none; white-space: normal; } }

.dep-fb { max-width: 130px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.dep-list th, .dep-list td { padding-left: 10px; padding-right: 10px; }
.dep-list td.c-flags { white-space: normal; min-width: 120px; max-width: 150px; }
.dep-fb { max-width: 100%; }
@media (max-width: 640px) { .dep-kpis, .dep-kpis-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dep-tile-n { font-size: 24px; } .dep-tile { padding: 16px; border-radius: 22px; } }
.dep-ms-sort { background: var(--color-accent-soft); color: var(--color-accent-strong); border: 0; border-radius: var(--radius-pill); padding: 3px 10px; font-size: 11.5px; font-weight: 650; cursor: pointer; }
.dep-ms-sort:hover { filter: brightness(.96); }

/* Deposits summary tiles: the same pastel tiles and icon chips as the dashboard (colours come from modern.css --tint-N). */
.dep-kpis { gap: 14px; }
.dep-tile { --tile-bg: var(--tint-1); --tile-fg: var(--tint-1-fg); display: flex; flex-direction: column; gap: 3px; position: relative; overflow: hidden; min-width: 0; padding: 18px 20px; border-radius: 26px; border: 0;
    background: var(--tile-bg); color: var(--tile-fg); text-decoration: none; box-shadow: none; transition: transform .3s var(--ease-spring), box-shadow .3s; }
.dep-kpis > .dep-tile:nth-child(5n+2) { --tile-bg: var(--tint-2); --tile-fg: var(--tint-2-fg); }
.dep-kpis > .dep-tile:nth-child(5n+3) { --tile-bg: var(--tint-3); --tile-fg: var(--tint-3-fg); }
.dep-kpis > .dep-tile:nth-child(5n+4) { --tile-bg: var(--tint-4); --tile-fg: var(--tint-4-fg); }
.dep-kpis > .dep-tile:nth-child(5n+5) { --tile-bg: var(--tint-5); --tile-fg: var(--tint-5-fg); }
.dep-kpis > .dep-tile.is-ok { --tile-bg: var(--tint-3); --tile-fg: var(--tint-3-fg); }
.dep-kpis > .dep-tile.is-warn { --tile-bg: var(--tint-2); --tile-fg: var(--tint-2-fg); }
.dep-kpis > .dep-tile.is-bad { --tile-bg: var(--tint-5); --tile-fg: var(--tint-5-fg); }
.dep-tile::after { content: ""; position: absolute; right: -34px; bottom: -34px; width: 110px; height: 110px; border-radius: 50%; background: currentColor; opacity: .08; pointer-events: none; }
a.dep-tile:hover { transform: translateY(-4px); box-shadow: 0 18px 34px -18px color-mix(in srgb, var(--tile-fg) 55%, transparent); text-decoration: none; border: 0; }
.dep-tile-ic { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 14px; background: #fff; color: var(--tile-fg); margin-bottom: 8px; box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--tile-fg) 55%, transparent); }
:root[data-theme="dark"] .dep-tile-ic { background: rgba(255, 255, 255, .10); }
.dep-tile-n { font-size: clamp(24px, 2.4vw, 32px); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; color: var(--color-text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dep-tile-l { font-size: 12.5px; font-weight: 650; color: var(--tile-fg); }
.dep-tile .dep-kpi-sub { color: var(--tile-fg); opacity: .78; font-size: 11.5px; }
.dep-tile .dep-kpi-sub.is-up, .dep-tile .dep-kpi-sub.is-down { opacity: 1; }
.dep-rep-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding: 16px 18px; margin-bottom: 14px; }
.dep-rep-form .exc-field { flex: 1 1 240px; min-width: 0; margin: 0; }
.dep-rep-dl { display: flex; gap: 8px; margin-left: auto; }
.dep-tile-n { overflow-wrap: break-word; }

/* -- Smart sidebar: recent pages and collapse-all -- */
.nav-tools{display:flex;justify-content:flex-end;padding:2px 14px 4px}
.nav-tools button{background:none;border:0;color:var(--text-muted,#5f6368);font-size:12px;cursor:pointer;padding:3px 8px;border-radius:12px}
.nav-tools button:hover{background:rgba(0,0,0,.05)}
.nav-recent:empty{display:none}
.nav-recent{padding:2px 0 6px}
.nav-recent-label{font-size:12px;color:var(--text-muted,#5f6368);padding:4px 14px}
.nav-recent-item .nav-label{font-size:13px}

.sf-star button { padding: 6px 0 6px 10px; }
.sf-star button.on { opacity: 1; color: #d98a00; }
.sf-star button.on svg { fill: currentColor; }

/* -- Loading skeletons -- */
.skeleton{background:linear-gradient(90deg,rgba(0,0,0,.08) 25%,rgba(0,0,0,.15) 37%,rgba(0,0,0,.08) 63%);background-size:400% 100%;animation:skel 1.3s ease infinite;border-radius:10px}
@keyframes skel{0%{background-position:100% 50%}100%{background-position:0 50%}}
.sk-title{height:26px;width:55%;margin-bottom:16px}
.sk-line{height:14px;margin:10px 0}.sk-short{width:60%}
.sk-tiles{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:18px 0}.sk-tile{height:70px;border-radius:14px}
.dep-pn-loading[aria-busy]{text-align:left}
@media(prefers-reduced-motion:reduce){.skeleton{animation:none}}

/* -- Keyboard shortcut list -- */
.kb-help{position:fixed;inset:0;background:rgba(20,20,40,.35);z-index:1200;display:flex;align-items:center;justify-content:center;padding:16px}
.kb-help-box{background:var(--color-surface,#fff);border-radius:20px;padding:20px 22px;max-width:440px;width:100%;max-height:84vh;overflow:auto;box-shadow:0 20px 60px rgba(0,0,0,.25)}
.kb-help-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
.kb-help-x{background:none;border:0;cursor:pointer;padding:6px;border-radius:50%;color:inherit}
.kb-help-x:hover{background:rgba(0,0,0,.06)}
.kb-help-grid{display:grid;grid-template-columns:auto 1fr;gap:8px 16px;align-items:center;font-size:14px}
.kb-help-grid kbd{background:rgba(0,0,0,.06);border-radius:8px;padding:2px 9px;font-family:inherit;font-size:12.5px;justify-self:start}

/* -- Breathing room: sections stacked directly under each other never touch (margins collapse, so no double gap) -- */
.content > :where(.card, .dep-note, .kpi-grid, .dep-kpis, .chart-card) + :where(.card, .dep-note, .kpi-grid, .dep-kpis, .chart-card) { margin-top: 20px; }

/* -- Compact sidebar: the same look with less height (update 2026.10.15-6) -- */
@media (min-width: 901px) {
    .sidebar a.nav-item { min-height: 32px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
    .sidebar .nav-section-label { padding-top: 7px; padding-bottom: 3px; }
    .sidebar .nav-group-label { padding-top: 10px; margin-top: 2px; }
    .sidebar .nav-section { gap: 0; }
    .sidebar .nav-section-label .nav-dot { margin-left: 4px; }
}

/* -- Exceptions list in the Deposits look: pastel tiles, clickable rows, side panel -- */
.exc-kpi { border: 0; border-radius: 26px; padding: 16px 20px; background: var(--tint-1); color: var(--tint-1-fg); }
.exc-kpi.is-warn { background: var(--tint-2); color: var(--tint-2-fg); }
.exc-kpi.is-ok { background: var(--tint-3); color: var(--tint-3-fg); }
.exc-kpi.is-bad { background: var(--tint-5); color: var(--tint-5-fg); }
.exc-kpis > .exc-kpi:nth-child(5) { background: var(--tint-4); color: var(--tint-4-fg); }
.exc-kpi .exc-kpi-n, .exc-kpi.is-warn .exc-kpi-n, .exc-kpi.is-ok .exc-kpi-n, .exc-kpi.is-bad .exc-kpi-n { color: inherit; }
.exc-kpi .exc-kpi-l { color: inherit; opacity: .85; font-weight: 600; }
.exc-kpi.is-on { box-shadow: 0 0 0 3px rgba(0,0,0,.08); }
.exc-table tr.exc-click { cursor: pointer; }
.exc-table tr.exc-click:hover td { background: var(--color-canvas); }
.exc-table tr.exc-click:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.exc-pn-text { font-size: 13.5px; line-height: 1.6; margin: 0; overflow-wrap: anywhere; }
.exc-pn-actions { list-style: none; margin: 0; padding: 0; }
.exc-pn-actions li { padding: 8px 0; border-bottom: 1px solid var(--color-border-soft); display: flex; flex-direction: column; gap: 2px; font-size: 13px; }

/* -- Audit profile pages -- */
.prof-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 20px 0; }
.prof-card { padding: 18px 20px; }
.prof-h { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.prof-bar-row { display: grid; grid-template-columns: 110px 1fr 36px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.prof-bar-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof-bar-row b { text-align: right; font-variant-numeric: tabular-nums; }
.prof-bar { height: 10px; background: var(--color-canvas); border-radius: 6px; overflow: hidden; }
.prof-bar i { display: block; height: 100%; border-radius: 6px; background: var(--tint-1-fg); }
.prof-bar i.prof-critical, .prof-bar i.prof-high { background: #e8718d; }
.prof-bar i.prof-medium { background: #f0b45a; }
.prof-bar i.prof-low { background: #6fcf97; }
.prof-list, .prof-contacts { margin-top: 20px; }
.prof-contact { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
@media (max-width: 900px) { .prof-grid { grid-template-columns: 1fr; } }
.exc-entity-link { color: inherit; text-decoration: none; } .exc-entity-link:hover { color: var(--color-accent); text-decoration: underline; }
.dep-flag-card { display: flex; flex-direction: column; gap: 6px; }
.dep-flag-card > .dep-flag { flex: 1; }
.dep-flag-act { align-self: flex-start; }
