/* ==========================================================================
   HRMS & Payroll — design system v2 ("Aurora").
   A premium, modern-SaaS UI: layered surfaces, a confident single accent,
   crisp typography, soft depth, and calm motion. Self-hosted (CSP-safe).
   Every legacy class name is preserved so all 340 views inherit the upgrade;
   new component classes are additive. Light/dark aware; per-tenant --brand
   flows through every accent via color-mix.
   ========================================================================== */

/* ---- Design tokens ------------------------------------------------------- */
:root {
    /* Brand — overridden per-tenant. */
    --brand: #5b5bf0;
    --brand-2: color-mix(in srgb, var(--brand), #8b5cf6 50%);
    --brand-ink: color-mix(in srgb, var(--brand), #1b1240 24%);
    --on-brand: #fff;
    --grad-brand: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);

    /* Brand tints — one soft, one glow, one hairline. */
    --accent-soft: color-mix(in srgb, var(--brand), transparent 90%);
    --accent-softer: color-mix(in srgb, var(--brand), transparent 95%);
    --accent-glow: color-mix(in srgb, var(--brand), transparent 60%);
    --accent-line: color-mix(in srgb, var(--brand), transparent 78%);

    /* Neutrals — cool, slightly desaturated. */
    --bg: #eef0f7;
    --bg-grad:
        radial-gradient(1200px 620px at 100% -10%, color-mix(in srgb, var(--brand), #fff 82%) 0%, transparent 56%),
        radial-gradient(900px 500px at -8% 8%, color-mix(in srgb, #22d3ee, #fff 84%) 0%, transparent 55%),
        #eef0f7;
    --surface: #ffffff;
    --surface-2: #f4f6fb;
    --surface-3: #eceff7;
    --surface-hover: #f0f2fa;
    --sidebar-bg: #ffffff;
    --glass: color-mix(in srgb, #ffffff 78%, transparent);

    --text: #171a26;
    --text-muted: #5a6178;
    --text-faint: #8b93a8;
    --border: #e6e9f2;
    --border-strong: #d3d8e6;

    /* Semantic. */
    --green: #15a34a; --green-soft: color-mix(in srgb, var(--green), transparent 88%);
    --amber: #d97706; --amber-soft: color-mix(in srgb, var(--amber), transparent 86%);
    --red:   #dc2626; --red-soft:   color-mix(in srgb, var(--red),   transparent 88%);
    --sky:   #0ea5e9; --sky-soft:   color-mix(in srgb, var(--sky),   transparent 88%);
    --violet:#8b5cf6;
    --danger: var(--red); --danger-bg: var(--red-soft);
    --success: var(--green); --success-bg: var(--green-soft);
    --warning: var(--amber);

    /* Geometry. */
    --radius-xs: 7px; --radius-sm: 10px; --radius: 14px; --radius-lg: 20px; --radius-xl: 26px;

    /* Depth — soft, layered, low-contrast. */
    --shadow-xs: 0 1px 2px rgba(19,26,45,.05);
    --shadow-sm: 0 1px 3px rgba(19,26,45,.06), 0 1px 2px rgba(19,26,45,.04);
    --shadow:    0 6px 20px -8px rgba(19,26,45,.16), 0 2px 6px -2px rgba(19,26,45,.07);
    --shadow-md: 0 14px 34px -12px rgba(19,26,45,.22), 0 4px 10px -4px rgba(19,26,45,.10);
    --shadow-lg: 0 32px 60px -18px rgba(19,26,45,.30);
    --ring: 0 0 0 3.5px var(--accent-line);

    /* Layout. */
    --sidebar-w: 264px; --topbar-h: 62px; --content-max: 1520px;

    /* Type. */
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: "SFMono-Regular", ui-monospace, "Cascadia Code", "Segoe UI Mono", Menlo, Consolas, monospace;

    /* Motion. */
    --ease: cubic-bezier(.32,.72,.24,1);
    --ease-spring: cubic-bezier(.22,1.2,.36,1);
    --t-fast: .13s; --t: .2s; --t-slow: .32s;
}

@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
    --brand-ink: color-mix(in srgb, var(--brand), #fff 20%);
    --accent-soft: color-mix(in srgb, var(--brand), transparent 84%);
    --accent-softer: color-mix(in srgb, var(--brand), transparent 91%);
    --accent-line: color-mix(in srgb, var(--brand), transparent 68%);
    --bg: #080b14;
    --bg-grad:
        radial-gradient(1200px 620px at 100% -12%, color-mix(in srgb, var(--brand), #000 50%) 0%, transparent 54%),
        radial-gradient(900px 520px at -6% 6%, color-mix(in srgb, #0e7490, #000 55%) 0%, transparent 52%),
        #080b14;
    --surface: #121623; --surface-2: #171c2b; --surface-3: #1e2436;
    --surface-hover: #1c2233; --sidebar-bg: #0b0f1a; --glass: color-mix(in srgb, #0b0f1a 74%, transparent);
    --text: #e9ebf3; --text-muted: #9aa2b8; --text-faint: #667089;
    --border: #232a3d; --border-strong: #313a52;
    --green-soft: color-mix(in srgb, var(--green), transparent 82%);
    --amber-soft: color-mix(in srgb, var(--amber), transparent 80%);
    --red-soft:   color-mix(in srgb, var(--red),   transparent 82%);
    --sky-soft:   color-mix(in srgb, var(--sky),   transparent 82%);
    --shadow-xs: 0 1px 2px rgba(0,0,0,.5);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
    --shadow:    0 10px 28px -10px rgba(0,0,0,.6), 0 3px 8px -3px rgba(0,0,0,.5);
    --shadow-md: 0 18px 40px -14px rgba(0,0,0,.68);
    --shadow-lg: 0 36px 68px -20px rgba(0,0,0,.75);
}}
:root[data-theme="dark"] {
    --brand-ink: color-mix(in srgb, var(--brand), #fff 20%);
    --accent-soft: color-mix(in srgb, var(--brand), transparent 84%);
    --accent-softer: color-mix(in srgb, var(--brand), transparent 91%);
    --accent-line: color-mix(in srgb, var(--brand), transparent 68%);
    --bg: #080b14;
    --bg-grad:
        radial-gradient(1200px 620px at 100% -12%, color-mix(in srgb, var(--brand), #000 50%) 0%, transparent 54%),
        radial-gradient(900px 520px at -6% 6%, color-mix(in srgb, #0e7490, #000 55%) 0%, transparent 52%),
        #080b14;
    --surface: #121623; --surface-2: #171c2b; --surface-3: #1e2436;
    --surface-hover: #1c2233; --sidebar-bg: #0b0f1a; --glass: color-mix(in srgb, #0b0f1a 74%, transparent);
    --text: #e9ebf3; --text-muted: #9aa2b8; --text-faint: #667089;
    --border: #232a3d; --border-strong: #313a52;
    --green-soft: color-mix(in srgb, var(--green), transparent 82%);
    --amber-soft: color-mix(in srgb, var(--amber), transparent 80%);
    --red-soft:   color-mix(in srgb, var(--red),   transparent 82%);
    --sky-soft:   color-mix(in srgb, var(--sky),   transparent 82%);
    --shadow-xs: 0 1px 2px rgba(0,0,0,.5);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
    --shadow:    0 10px 28px -10px rgba(0,0,0,.6), 0 3px 8px -3px rgba(0,0,0,.5);
    --shadow-md: 0 18px 40px -14px rgba(0,0,0,.68);
    --shadow-lg: 0 36px 68px -20px rgba(0,0,0,.75);
}

/* ---- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text-muted), transparent 60%) transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body {
    margin: 0; padding: 0; min-height: 100%;
    font-family: var(--font); font-size: 14.5px; line-height: 1.55;
    color: var(--text); background: var(--bg-grad); background-attachment: fixed;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility; font-feature-settings: "cv02","cv03","cv04","ss01";
}
a { color: var(--brand); text-decoration: none; transition: color var(--t-fast); }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.018em; font-weight: 700; }
h2 { font-size: 1.4rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
small { font-size: .8rem; }
code, kbd, pre { font-family: var(--mono); }
::selection { background: var(--accent-glow); color: var(--brand-ink); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-muted), transparent 64%); border-radius: 999px; border: 2.5px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-muted), transparent 40%); background-clip: padding-box; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ---- Auth ---------------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero { background: var(--grad-brand); color: #fff; padding: 3.5rem 3.2rem; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-hero::before { content:""; position:absolute; inset:0; background:
    radial-gradient(680px 340px at 82% 18%, rgba(255,255,255,.22), transparent 60%),
    radial-gradient(560px 300px at 8% 92%, rgba(0,0,0,.16), transparent 60%); }
.auth-hero::after { content:""; position:absolute; inset:0; opacity:.5;
    background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent); }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero h1 { font-size: 2.3rem; margin: 0 0 .8rem; letter-spacing: -.03em; }
.auth-hero p { opacity: .94; max-width: 42ch; font-size: 1.04rem; }
.auth-hero .badge-row { margin-top: 2.2rem; display: flex; gap: .55rem; flex-wrap: wrap; }
.auth-hero .badge { background: rgba(255,255,255,.16); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.18); padding: .38rem .85rem; border-radius: 999px; font-size: .82rem; font-weight: 500; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 2.6rem; }
.auth-card h2 { margin: 0 0 .3rem; font-size: 1.55rem; }
.auth-card .sub { color: var(--text-muted); margin: 0 0 1.6rem; font-size: .93rem; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* ---- Forms --------------------------------------------------------------- */
.field { margin-bottom: 1.1rem; }
.field label, .form-label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .42rem; color: var(--text); letter-spacing: -.005em; }
.field .hint, .form-hint { font-size: .76rem; color: var(--text-muted); margin-top: .32rem; }
.input, .textarea, select.input, input[type="text"].input, input[type="email"].input {
    width: 100%; padding: .58rem .78rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font-size: .92rem; font-family: inherit; line-height: 1.4;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .textarea:hover { border-color: color-mix(in srgb, var(--brand), var(--border-strong) 55%); }
.input:focus, .textarea:focus, .input:focus-visible, .textarea:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--ring); background: var(--surface); }
.textarea { min-height: 96px; resize: vertical; }
select.input { cursor: pointer; padding-right: 2.2rem;
    background-image: 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='%238b93a8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .7rem center; }
.input-group { display: flex; }
.input-group .addon { display: flex; align-items: center; padding: 0 .8rem; background: var(--surface-2); border: 1px solid var(--border-strong); border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--text-muted); font-size: .85rem; white-space: nowrap; }
.input-group .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
input[type="color"] { height: 42px; padding: .2rem; cursor: pointer; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 16px; height: 16px; cursor: pointer; }
input[type="file"] { font-size: .88rem; color: var(--text-muted); }
/* Toggle switch (opt-in via .switch on a checkbox). */
.switch { appearance: none; width: 40px; height: 23px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background var(--t); flex: none; }
.switch::after { content:""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform var(--t) var(--ease); }
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(17px); }
/* Form layout — responsive field grids + action footer (collapse to 1 col on mobile). */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: start; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.3rem; padding-top: 1.1rem; border-top: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.form-actions .btn { width: auto; }
.form-actions .grow { flex: 1; }
@media (max-width: 720px) { .form-grid, .form-grid-3 { grid-template-columns: 1fr; } }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .6rem 1.05rem; border: 1px solid transparent; border-radius: var(--radius-sm);
    background: var(--grad-brand); color: var(--on-brand); font-size: .89rem; font-weight: 600; font-family: inherit;
    cursor: pointer; width: 100%; letter-spacing: -.005em; white-space: nowrap;
    box-shadow: 0 6px 16px -9px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.16);
    transition: transform var(--t-fast), box-shadow var(--t), filter var(--t-fast);
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { text-decoration: none; transform: translateY(-1px); filter: brightness(1.05) saturate(1.05); box-shadow: 0 12px 24px -10px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.2); }
.btn:active { transform: translateY(0); filter: brightness(.98); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }
.btn-primary { background: var(--grad-brand); color: var(--on-brand); }
.btn-ghost, .btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); width: auto; box-shadow: var(--shadow-xs); }
.btn-ghost:hover, .btn-secondary:hover { background: var(--surface-hover); border-color: color-mix(in srgb, var(--brand), var(--border-strong) 35%); color: var(--brand); filter: none; box-shadow: var(--shadow-sm); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 6px 16px -9px rgba(220,38,38,.7); }
.btn-danger:hover { box-shadow: 0 12px 24px -10px rgba(220,38,38,.6); }
.btn-success { background: linear-gradient(135deg, #22c55e, var(--green)); color: #fff; box-shadow: 0 6px 16px -9px rgba(22,163,74,.6); }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; border-radius: var(--radius-xs); }
.btn-lg { padding: .78rem 1.4rem; font-size: .98rem; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: none; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* ---- Alerts / toasts ----------------------------------------------------- */
.alert { padding: .82rem 1rem; border-radius: var(--radius-sm); font-size: .87rem; margin-bottom: 1.1rem; display: flex; gap: .6rem; align-items: center; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xs); }
.alert::before { font-size: 1rem; line-height: 1; }
.alert-error { background: var(--red-soft); color: color-mix(in srgb, var(--red), var(--text) 12%); border-color: color-mix(in srgb, var(--red), transparent 72%); }
.alert-error::before { content: "⚠"; }
.alert-success { background: var(--green-soft); color: color-mix(in srgb, var(--green), var(--text) 12%); border-color: color-mix(in srgb, var(--green), transparent 70%); }
.alert-success::before { content: "✓"; }
.alert-warning { background: var(--amber-soft); color: color-mix(in srgb, var(--amber), var(--text) 12%); border-color: color-mix(in srgb, var(--amber), transparent 68%); }
.alert-info { background: var(--accent-soft); color: var(--brand-ink); border-color: var(--accent-line); }

/* ---- App shell ----------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; z-index: 40; }
.sidebar .brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.05rem .85rem; }
.sidebar .brand .logo { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; background: var(--grad-brand); box-shadow: 0 6px 16px -7px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25); }
.sidebar .brand .bt { font-weight: 750; font-size: 15.5px; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav { padding: .3rem .6rem .6rem; overflow-y: auto; flex: 1; }
.sidebar nav a { position: relative; display: flex; align-items: center; gap: .7rem; padding: .5rem .62rem; border-radius: 10px; color: var(--text-muted); font-size: .875rem; font-weight: 550; margin-bottom: 1px; letter-spacing: -.006em; transition: background var(--t-fast), color var(--t-fast); }
.sidebar nav a svg { width: 18px; height: 18px; flex: none; opacity: .74; transition: opacity var(--t-fast), transform var(--t-fast); }
.sidebar nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.sidebar nav a:hover svg { opacity: 1; }
.sidebar nav a.active { background: var(--accent-soft); color: var(--brand-ink); font-weight: 650; }
.sidebar nav a.active svg { opacity: 1; color: var(--brand); }
.sidebar nav a.active::before { content:""; position: absolute; left: -6px; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--grad-brand); }
.sidebar .navlabel { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-faint); padding: 15px 10px 5px; font-weight: 700; }
.sidebar .foot { padding: .7rem; border-top: 1px solid var(--border); }
.sidebar .spacer { flex: 1; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 1.5rem; border-bottom: 1px solid var(--border); background: var(--glass); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); position: sticky; top: 0; z-index: 30; }
.topbar .page-title { font-size: 15.5px; font-weight: 700; letter-spacing: -.015em; }
.topbar .spacer { flex: 1; }
/* Optional global search box in the topbar. */
.topbar .top-search { position: relative; display: flex; align-items: center; gap: .5rem; max-width: 360px; flex: 1; height: 38px; padding: 0 .8rem; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast); }
/* Live omnisearch dropdown. */
.search-menu { display: none; position: absolute; left: 0; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 60vh; overflow-y: auto; padding: .4rem; z-index: 50; }
.search-menu.open { display: block; animation: page-in .16s var(--ease) both; }
.search-menu a { display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border-radius: 10px; color: var(--text); }
.search-menu a:hover, .search-menu a.sel { background: var(--accent-soft); text-decoration: none; }
.search-menu a .st { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.search-menu a .sm { min-width: 0; } .search-menu a .sm .stitle { font-weight: 600; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-menu a .sm .slabel { font-size: .76rem; color: var(--text-muted); text-transform: capitalize; }
.search-menu .empty-hint { padding: .8rem .7rem; color: var(--text-muted); font-size: .84rem; }
.topbar .top-search:focus-within { border-color: var(--brand); box-shadow: var(--ring); background: var(--surface); }
.topbar .top-search svg { width: 16px; height: 16px; flex: none; }
.topbar .top-search input { border: none; background: none; outline: none; width: 100%; font: inherit; font-size: .88rem; color: var(--text); }
.topbar .top-search kbd { font-size: .68rem; padding: .1rem .35rem; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-faint); }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); display: grid; place-items: center; cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast), transform var(--t-fast); }
.icon-btn:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand), var(--border) 35%); background: var(--accent-soft); text-decoration: none; transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--violet), var(--brand)); cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 4px 10px -5px var(--accent-glow); transition: transform var(--t-fast); }
.avatar:hover { text-decoration: none; transform: translateY(-1px); }
.content { padding: 1.7rem 1.8rem; max-width: var(--content-max); width: 100%; animation: page-in .34s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head h2 { margin: 0; }
.page-head .sub { color: var(--text-muted); font-size: .88rem; margin-top: .15rem; }

/* Breadcrumb + toolbar (additive, optional). */
.breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--text-faint); margin-bottom: .5rem; }
.breadcrumb a { color: var(--text-muted); } .breadcrumb .sep { opacity: .5; }
.toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.toolbar .grow { flex: 1; }

/* ---- KPI cards ----------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.2rem; box-shadow: var(--shadow-sm); overflow: hidden; transition: transform var(--t) var(--ease), box-shadow var(--t), border-color var(--t); }
.kpi::before { content:""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(180deg,#6366f1,#8b5cf6); opacity: .9; }
.kpi:nth-child(6n+2)::before { background: linear-gradient(180deg,#0ea5e9,#22d3ee); }
.kpi:nth-child(6n+3)::before { background: linear-gradient(180deg,#10b981,#34d399); }
.kpi:nth-child(6n+4)::before { background: linear-gradient(180deg,#f59e0b,#f97316); }
.kpi:nth-child(6n+5)::before { background: linear-gradient(180deg,#ec4899,#f43f5e); }
.kpi:nth-child(6n+6)::before { background: linear-gradient(180deg,#14b8a6,#0ea5e9); }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.kpi .label { color: var(--text-muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .045em; font-weight: 650; }
.kpi .value { font-size: 1.85rem; font-weight: 800; margin-top: .3rem; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .value.grad { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi .delta { font-size: .78rem; font-weight: 600; margin-top: .35rem; display: inline-flex; align-items: center; gap: .25rem; }
.kpi .delta.up { color: var(--green); } .kpi .delta.down { color: var(--red); }

/* ---- Cards / panels ------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.35rem 1.4rem; box-shadow: var(--shadow-sm); transition: box-shadow var(--t), border-color var(--t); }
.card:hover { box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: -.2rem 0 1rem; }
.card-head h3 { margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.35rem; box-shadow: var(--shadow-sm); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.2rem 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.2rem 0; }
.dash-chart { margin-top: .6rem; }
.dash-chart svg { width: 100%; height: auto; display: block; }

/* Empty state (additive). */
.empty { text-align: center; padding: 2.6rem 1.5rem; color: var(--text-muted); }
.empty .ico { width: 54px; height: 54px; margin: 0 auto .8rem; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-faint); }
.empty .ico svg { width: 26px; height: 26px; }
.empty h3 { color: var(--text); margin: 0 0 .3rem; }

/* Skeleton loading (additive). */
.skeleton { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%); background-size: 220% 100%; border-radius: var(--radius-sm); animation: skl 1.3s infinite linear; }
@keyframes skl { to { background-position: -220% 0; } }

/* ---- Tables -------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: .885rem; }
.table th, .table td { text-align: left; padding: .68rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { font-size: .69rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table thead th:first-child { border-radius: 9px 0 0 0; } .table thead th:last-child { border-radius: 0 9px 0 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--accent-softer); }
.table tbody tr:last-child td { border-bottom: none; }
.table td { font-variant-numeric: tabular-nums; }
.table code { background: var(--surface-2); padding: .1rem .4rem; border-radius: 5px; font-size: .85em; }
.table--compact th, .table--compact td { padding: .42rem .6rem; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

/* ---- Pills / badges ------------------------------------------------------ */
.pill, .badge { display: inline-flex; align-items: center; gap: .32rem; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 650; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); text-transform: capitalize; white-space: nowrap; }
.pill::before, .badge-dot::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; flex: none; }
.pill { padding-left: .5rem; }
/* Status families — greens = good/active, ambers = pending, reds = negative, brand = in-flight. */
.pill-active, .pill-paid, .pill-completed, .pill-approved, .pill-received, .pill-resolved, .pill-closed, .pill-done, .pill-cleared, .pill-settled, .pill-won { background: var(--green-soft); color: color-mix(in srgb, var(--green), var(--text) 8%); border-color: color-mix(in srgb, var(--green), transparent 70%); }
.pill-trial, .pill-draft, .pill-open, .pill-confirmed, .pill-accepted, .pill-in_progress, .pill-review, .pill-sent, .pill-pending_approval { background: var(--accent-soft); color: var(--brand-ink); border-color: var(--accent-line); }
.pill-pending, .pill-on_hold, .pill-partial, .pill-overdue, .pill-at_risk, .pill-initiated, .pill-in_clearance, .pill-planned { background: var(--amber-soft); color: color-mix(in srgb, var(--amber), var(--text) 10%); border-color: color-mix(in srgb, var(--amber), transparent 66%); }
.pill-suspended, .pill-cancelled, .pill-rejected, .pill-lost, .pill-breached, .pill-terminated, .pill-expired, .pill-failed, .pill-unpaid { background: var(--red-soft); color: color-mix(in srgb, var(--red), var(--text) 8%); border-color: color-mix(in srgb, var(--red), transparent 70%); }
.pill-inactive, .pill-deleted, .pill-archived, .pill-closed_lost, .pill-low { background: var(--surface-3); color: var(--text-muted); border-color: var(--border); }
/* Priority family — low=neutral (above), medium=info, high=warning, urgent=danger. */
.pill-medium { background: var(--sky-soft); color: color-mix(in srgb, var(--sky), var(--text) 14%); border-color: color-mix(in srgb, var(--sky), transparent 68%); }
.pill-high { background: var(--amber-soft); color: color-mix(in srgb, var(--amber), var(--text) 10%); border-color: color-mix(in srgb, var(--amber), transparent 66%); }
.pill-urgent { background: var(--red-soft); color: color-mix(in srgb, var(--red), var(--text) 8%); border-color: color-mix(in srgb, var(--red), transparent 70%); }
.badge-success { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green), transparent 70%); }
.badge-danger { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red), transparent 70%); }
.badge-warning { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber), transparent 66%); }
.badge-info { background: var(--accent-soft); color: var(--brand-ink); border-color: var(--accent-line); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 550; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.chip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--brand-ink); }

/* ---- Row action buttons -------------------------------------------------- */
.act, button.act { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast), transform var(--t-fast); vertical-align: middle; }
.act:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand), var(--border) 30%); background: var(--accent-soft); text-decoration: none; transform: translateY(-1px); }
.act.danger:hover { color: var(--red); border-color: color-mix(in srgb, var(--red), var(--border) 30%); background: var(--red-soft); }
.act svg { width: 16px; height: 16px; }
.act-group { display: inline-flex; gap: .35rem; align-items: center; }

/* Tabs / segmented / sub-nav (additive; also styles common inline sub-navs). */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1.2rem; overflow-x: auto; }
.tabs a, .tabs button { padding: .6rem .9rem; font-size: .875rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.segmented a, .segmented button { padding: .38rem .8rem; border-radius: 8px; font-size: .82rem; font-weight: 600; color: var(--text-muted); background: none; border: none; cursor: pointer; }
.segmented a:hover, .segmented button:hover { color: var(--text); text-decoration: none; }
.segmented a.active, .segmented button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-xs); }

/* Sub-navigation — a light, wrapping pill row for module sub-sections.
   Replaces the old "pile of .btn-ghost buttons" pattern; far calmer with many items. */
.subnav { display: flex; flex-wrap: wrap; gap: .28rem; margin-bottom: 1.2rem; padding-bottom: .55rem; border-bottom: 1px solid var(--border); }
.subnav a, .subnav button { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .78rem; border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--text-muted); background: none; border: 1px solid transparent; cursor: pointer; letter-spacing: -.005em; white-space: nowrap; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.subnav a:hover, .subnav button:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.subnav a.active, .subnav button.active { background: var(--accent-soft); color: var(--brand-ink); border-color: var(--accent-line); }
.subnav a.active svg, .subnav button.active svg { color: var(--brand); }
.subnav .ico { font-size: .95em; opacity: .85; line-height: 1; }

/* ---- Kanban boards ------------------------------------------------------- */
.kanban { display: flex; gap: .85rem; overflow-x: auto; padding: .1rem .1rem 1.1rem; scroll-snap-type: x proximity; }
.kanban-col { min-width: 268px; flex: 0 0 268px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .6rem .3rem; display: flex; flex-direction: column; scroll-snap-align: start; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .3rem .35rem .55rem; font-size: .8rem; font-weight: 700; letter-spacing: -.01em; position: sticky; top: 0; }
.kanban-col-head .k-count { font-weight: 650; font-size: .72rem; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .05rem .45rem; font-variant-numeric: tabular-nums; }
.kanban-col-head .k-sum { color: var(--text-muted); font-weight: 650; font-variant-numeric: tabular-nums; }
.kanban-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .62rem .68rem; margin-bottom: .5rem; box-shadow: var(--shadow-xs); transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast); }
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--border-strong); text-decoration: none; }
.kanban-card .k-title { font-weight: 650; font-size: .87rem; color: var(--text); letter-spacing: -.01em; }
.kanban-card .k-meta { color: var(--text-muted); font-size: .77rem; margin-top: .1rem; }
.kanban-card .k-amount { font-size: .82rem; font-weight: 650; margin-top: .35rem; font-variant-numeric: tabular-nums; }
.kanban-card .k-foot { margin-top: .45rem; }
.kanban-col-empty { color: var(--text-faint); font-size: .78rem; text-align: center; padding: 1.1rem .4rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); margin-bottom: .35rem; }

/* ---- Utilities ----------------------------------------------------------- */
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; } .wrap { flex-wrap: wrap; }
.text-right { text-align: right; } .text-center { text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.num { font-variant-numeric: tabular-nums; }
.good { color: var(--green); } .bad { color: var(--red); } .warn { color: var(--amber); }
@media (max-width: 820px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---- Mobile shell -------------------------------------------------------- */
.nav-toggle { display: none; width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text); place-items: center; cursor: pointer; }
.nav-toggle:hover { color: var(--brand); border-color: var(--brand); }
.nav-toggle svg { width: 20px; height: 20px; }
.nav-backdrop { display: none; }

@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .nav-toggle { display: grid; }
    .sidebar { position: fixed; top: 0; left: 0; z-index: 85; width: 288px; max-width: 86vw; height: 100dvh; transform: translateX(-100%); transition: transform var(--t-slow) var(--ease); box-shadow: var(--shadow-lg); }
    .app.nav-open .sidebar { transform: none; }
    .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(8,11,20,.5); backdrop-filter: blur(2px); z-index: 80; opacity: 0; pointer-events: none; transition: opacity var(--t); }
    .app.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
    .content { padding: 1.15rem 1.05rem; }
    .topbar { padding: 0 1rem; gap: 9px; }
    .topbar .page-title { font-size: 15px; }
    .topbar .top-search { display: none; }
}
@media (max-width: 680px) {
    .card { overflow-x: auto; }
    .content { padding: 1rem .85rem; }
    .kpi .value { font-size: 1.55rem; }
    .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
    .page-head h2 { font-size: 1.2rem; }
}

/* ---- Getting-Started guide ----------------------------------------------- */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 1rem; margin-top: 1rem; }
.guide-card { display: flex; flex-direction: column; gap: .6rem; text-decoration: none; color: inherit; }
.guide-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.guide-card .g-top { display: flex; align-items: center; gap: .6rem; }
.guide-card .g-ico { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 11px; flex: none; background: var(--accent-soft); color: var(--brand); }
.guide-card .g-title { font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; }
.guide-card .g-more { color: var(--brand); font-size: .85rem; font-weight: 650; margin-top: auto; display: inline-flex; align-items: center; gap: .3rem; }
.guide-card .g-more .arw { transition: transform var(--t) var(--ease); }
.guide-card:hover .g-more .arw { transform: translateX(4px); }
/* Numbered step list (also used by the guide detail page). */
.guide-steps { margin: 0; padding-left: 0; list-style: none; counter-reset: step; }
.guide-steps li { display: flex; gap: .75rem; padding: .5rem 0; align-items: flex-start; counter-increment: step; line-height: 1.5; }
.guide-steps li + li { border-top: 1px solid var(--border); }
.guide-steps .guide-num { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .82rem; }
.guide-steps .guide-num::before { content: counter(step); }
.guide-hero-ico { display: inline-flex; width: 46px; height: 46px; align-items: center; justify-content: center; border-radius: 13px; flex: none; background: var(--accent-soft); color: var(--brand); }

/* ---- Co-pilot — right-docked slide-in panel ------------------------------ */
.copilot-fab { position: fixed; right: 24px; bottom: 24px; width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer; background: var(--grad-brand); color: #fff; box-shadow: 0 16px 38px -10px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25); display: grid; place-items: center; z-index: 60; transition: transform var(--t) var(--ease-spring); }
.copilot-fab::after { content:""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--accent-glow); opacity: 0; animation: fab-pulse 3.5s ease-out infinite; }
@keyframes fab-pulse { 0% { opacity: .5; transform: scale(1); } 70%,100% { opacity: 0; transform: scale(1.4); } }
.copilot-fab:hover { transform: translateY(-2px) scale(1.05); }
.copilot-fab svg { width: 24px; height: 24px; }
.copilot-panel { position: fixed; top: 0; right: 0; height: 100vh; width: 404px; max-width: 92vw; z-index: 70; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--t-slow) var(--ease); }
.copilot-panel.open { transform: none; }
.copilot-head { display: flex; align-items: center; gap: 11px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.copilot-head .cp-logo { width: 34px; height: 34px; border-radius: 10px; background: var(--grad-brand); color: #fff; display: grid; place-items: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.copilot-head .cp-logo svg { width: 18px; height: 18px; }
.copilot-head .t { font-weight: 700; font-size: 14.5px; }
.copilot-head .s { font-size: 11.5px; color: var(--text-muted); }
.copilot-head .x { margin-left: auto; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; font-size: 18px; }
.copilot-head .x:hover { color: var(--brand); border-color: var(--brand); }
.cp-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.cp-msg { display: flex; gap: 10px; max-width: 92%; }
.cp-msg .cp-av { width: 28px; height: 28px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.cp-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.cp-msg.user .cp-av { background: var(--surface-hover); color: var(--text-muted); }
.cp-msg.bot .cp-av { background: var(--grad-brand); color: #fff; }
.cp-bubble { padding: 10px 13px; border-radius: 15px; font-size: 13.5px; line-height: 1.55; }
.cp-msg.user .cp-bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.cp-msg.bot .cp-bubble { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.cp-suggest { display: flex; gap: .4rem; flex-wrap: wrap; padding: .6rem 1rem; border-top: 1px solid var(--border); }
.cp-suggest button { font-size: .76rem; padding: .34rem .62rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast); }
.cp-suggest button:hover { border-color: var(--brand); color: var(--brand); }
.cp-foot { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--border); background: var(--surface); }
.cp-foot .input { flex: 1; }
.cp-link { display: block; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); margin-top: .4rem; transition: border-color var(--t-fast); }
.cp-link:hover { border-color: var(--brand); text-decoration: none; }

/* --- Pagination ------------------------------------------------------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.pager-count { font-size: .82rem; }
.pager-links { display: flex; align-items: center; gap: .25rem; }
.pager-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2rem; height: 2rem; padding: 0 .5rem;
    border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
    background: var(--surface); color: var(--text);
    font-size: .82rem; text-decoration: none; box-shadow: var(--shadow-xs);
    transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
a.pager-btn:hover { background: var(--surface-hover); border-color: color-mix(in srgb, var(--brand), var(--border-strong) 35%); color: var(--brand); }
.pager-btn.is-current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager-btn.is-off { opacity: .35; box-shadow: none; }
.pager-gap { padding: 0 .15rem; color: var(--text-faint); font-size: .82rem; }
@media (max-width: 640px) {
    .pager { justify-content: center; }
    .pager-count { width: 100%; text-align: center; }
}

/* --- Searchable select (progressive enhancement over <select>) --------- */
.ss { position: relative; display: block; }
.ss-native { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.ss-btn {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    width: 100%; text-align: left; cursor: pointer; font: inherit;
}
.ss-btn:disabled { opacity: .55; cursor: not-allowed; }
.ss-btn[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--accent-soft); }
.ss-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-label.is-placeholder { color: var(--text-faint); }
.ss-caret { color: var(--text-muted); font-size: .7rem; flex: none; }
.ss-panel {
    position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
}
.ss-search {
    width: 100%; border: 0; border-bottom: 1px solid var(--border);
    padding: .55rem .7rem; font: inherit; font-size: .85rem;
    background: transparent; color: var(--text); outline: none;
}
.ss-list { list-style: none; margin: 0; padding: .25rem; max-height: 15rem; overflow-y: auto; }
.ss-opt {
    padding: .45rem .6rem; border-radius: var(--radius-xs); cursor: pointer;
    font-size: .85rem; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ss-opt.is-active { background: var(--accent-soft); color: var(--brand); }
.ss-opt[aria-selected="true"] { font-weight: 600; }
.ss-opt[aria-selected="true"]::after { content: '✓'; float: right; color: var(--brand); }
.ss-opt.is-disabled { opacity: .45; cursor: not-allowed; }
.ss-group {
    padding: .4rem .6rem .2rem; font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint);
}
.ss-empty { padding: .6rem; font-size: .82rem; color: var(--text-muted); text-align: center; }
