/* ============================================================================
   BenefitDesk — Core Stylesheet v2
   Driven by attributes on <html>:
     data-theme  = light | dark
     data-style  = modern | classic | minimal
     data-accent = (optional hex set by Settings, applied via inline style)
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;450;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- BRAND TOKENS ---------- */
:root {
    --brand-accent:     #2353E8;
    --brand-accent-600: #1B44C4;
    --brand-gold:       #C8922A;
    --green:#10B981; --amber:#F59E0B; --red:#EF4444;

    --font-display:'DM Serif Display', Georgia, serif;
    --font-serif:  'Fraunces', Georgia, serif;
    --font-body:   'Inter', system-ui, sans-serif;
    --font-mono:   'JetBrains Mono', monospace;

    --sidebar-w: 248px;
    --topbar-h:  64px;

    /* motion tokens — overridden per style */
    --ease: cubic-bezier(.2,.7,.2,1);
    --dur:  .22s;
    --lift: -2px;              /* hover lift distance */
    --hover-scale: 1.0;
}

/* ---------- LIGHT ---------- */
:root, [data-theme="light"] {
    --bg:#F4F6FB; --surface:#FFFFFF; --surface-2:#F1F4FA; --surface-3:#E9EEF7;
    --ink:#0E1119; --text:#3C4258; --muted:#8790A4; --rule:#E4E9F2;
    --sidebar-bg:#FFFFFF; --sidebar-ink:#4A5169;
    --topbar-bg:rgba(255,255,255,.82);
    --accent:var(--brand-accent); --accent-soft:#EDF2FE; --accent-ink:#1B44C4;
    --shadow-sm:0 1px 2px rgba(14,17,25,.05);
    --shadow:0 1px 3px rgba(14,17,25,.05), 0 8px 24px rgba(14,17,25,.06);
    --shadow-lg:0 4px 12px rgba(14,17,25,.08), 0 24px 48px rgba(14,17,25,.10);
    --glow:0 0 0 4px var(--accent-soft);
}
/* ---------- DARK ---------- */
[data-theme="dark"] {
    --bg:#090B10; --surface:#12161F; --surface-2:#171C27; --surface-3:#1F2634;
    --ink:#F3F6FC; --text:#BFC6D6; --muted:#7A8399; --rule:#232A38;
    --sidebar-bg:#0C0F15; --sidebar-ink:#A9B2C6;
    --topbar-bg:rgba(12,15,21,.82);
    --accent:#5A85FF; --accent-soft:rgba(90,133,255,.13); --accent-ink:#9FBAFF;
    --shadow-sm:0 1px 2px rgba(0,0,0,.4);
    --shadow:0 2px 6px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.5);
    --shadow-lg:0 8px 24px rgba(0,0,0,.5), 0 32px 64px rgba(0,0,0,.6);
    --glow:0 0 0 4px var(--accent-soft);
}

/* ---------- PER-STYLE PERSONALITY ---------- */
/* MODERN — smooth, soft, generous radius, lively hover */
[data-style="modern"] {
    --radius:18px; --radius-sm:12px; --radius-xs:8px;
    --dur:.24s; --lift:-3px; --hover-scale:1.0;
    --card-head-font:var(--font-body);
    --card-pad:22px;
    --card-border-w:1px;
    --card-shadow:var(--shadow);
    --h-weight:700; --h-spacing:-.02em;
}
/* MODERN — gradient accents, soft glow, generous rounded cards */
[data-style="modern"] .card,
[data-style="modern"] .stat {
    background:
        linear-gradient(var(--surface),var(--surface)) padding-box,
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%) border-box;
    border:1px solid transparent;
}
[data-style="modern"] .btn:not(.ghost):not(.danger) {
    background:linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #7c3aed));
    box-shadow:0 6px 18px color-mix(in srgb, var(--accent) 32%, transparent);
}
[data-style="modern"] .stat { position:relative; overflow:hidden; }
[data-style="modern"] .stat::before {
    content:""; position:absolute; top:0; left:0; right:0; height:3px;
    background:linear-gradient(90deg, var(--accent), transparent);
}

/* CLASSIC — editorial, serif, ruled borders, ledger feel, NO motion */
[data-style="classic"] {
    --radius:3px; --radius-sm:2px; --radius-xs:2px;
    --dur:0s; --lift:0px; --hover-scale:1.0;
    --card-head-font:var(--font-serif);
    --card-pad:24px;
    --card-border-w:1.5px;
    --card-shadow:none;
    --h-weight:500; --h-spacing:0;
}
[data-style="classic"] .card,
[data-style="classic"] .stat,
[data-style="classic"] .tbl-wrap {
    box-shadow:none;
    border:1.5px solid var(--ink);
}
[data-style="classic"] .card { border-width:1px; border-color:var(--rule); border-top:3px solid var(--ink); }
[data-style="classic"] .stat { border:1px solid var(--rule); border-left:3px solid var(--accent); }
[data-style="classic"] h1,[data-style="classic"] h2,[data-style="classic"] h3,
[data-style="classic"] .eyebrow { font-family:var(--font-serif); }
[data-style="classic"] .btn:not(.ghost) { border-radius:2px; }
[data-style="classic"] .eyebrow { letter-spacing:.12em; }

/* MINIMAL — flat, monochrome, hairline rules, no shadows, no fills */
[data-style="minimal"] {
    --radius:6px; --radius-sm:5px; --radius-xs:4px;
    --dur:.12s; --lift:0px; --hover-scale:1.0;
    --shadow:none; --shadow-lg:none; --shadow-sm:none;
    --card-head-font:var(--font-body);
    --card-pad:18px;
    --card-border-w:1px;
    --card-shadow:none;
    --h-weight:600; --h-spacing:-.01em;
}
[data-style="minimal"] .card,
[data-style="minimal"] .stat,
[data-style="minimal"] .tbl-wrap {
    box-shadow:none !important;
    border:1px solid var(--rule);
    background:transparent;
}
[data-style="minimal"] .stat { border:none; border-top:2px solid var(--ink); border-radius:0; padding-left:0; padding-right:0; }
[data-style="minimal"] .btn:not(.ghost):not(.danger) {
    background:var(--ink); color:var(--surface); box-shadow:none;
}
[data-style="minimal"] .st-ico,
[data-style="minimal"] .stat .st-ico { opacity:.35; }
[data-style="minimal"] .eyebrow { color:var(--muted); }

/* headings honour per-style weight/spacing */
h1,h2,h3 { font-weight:var(--h-weight, 600); letter-spacing:var(--h-spacing, -.01em); }

/* reduced motion always wins */
@media (prefers-reduced-motion: reduce) {
    * { transition:none !important; animation:none !important; }
}

/* ---------- RESET ---------- */
* { box-sizing:border-box; margin:0; padding:0; }
html { -webkit-text-size-adjust:100%; }
body {
    font-family:var(--font-body); background:var(--bg); color:var(--text);
    line-height:1.55; -webkit-font-smoothing:antialiased;
    transition:background var(--dur) var(--ease), color var(--dur) var(--ease);
}
h1,h2,h3,h4 { color:var(--ink); font-weight:600; line-height:1.18; letter-spacing:-.01em; }
[data-style="classic"] h1,[data-style="classic"] h2,[data-style="classic"] h3 {
    font-family:var(--font-serif); font-weight:500; letter-spacing:0; }
a { color:var(--accent); text-decoration:none; }

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

/* SIDEBAR — flex column so practice block pins to bottom */
.sidebar {
    width:var(--sidebar-w); flex-shrink:0; background:var(--sidebar-bg);
    border-right:1px solid var(--rule); position:fixed; inset:0 auto 0 0;
    display:flex; flex-direction:column; padding:18px 14px 16px;
    z-index:40; transition:transform var(--dur) var(--ease);
}
.sidebar .logo {
    display:flex; align-items:center; gap:10px; padding:6px 8px 20px;
    font-family:var(--font-display); font-size:1.32rem; color:var(--ink);
    max-width:100%; overflow:hidden;
}
[data-style="classic"] .sidebar .logo { font-family:var(--font-serif); font-weight:600; }
.sidebar .logo b { color:var(--accent); font-weight:400; }
/* Uploaded logo — HARD constrained so any image fits the box and never
   overflows or breaks the sidebar layout, regardless of original size. */
.sidebar .logo .brand-logo {
    height:36px; width:auto; max-width:150px; max-height:36px;
    object-fit:contain; flex-shrink:0; display:block;
}
.sidebar .logo .brand-logo-lg {   /* "logo only" mode — slightly larger */
    height:44px; max-height:44px; max-width:170px;
}
.sidebar .logo span {             /* practice name text — never pushes width */
    min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.logo .mark {
    width:32px; height:32px; border-radius:9px; flex-shrink:0;
    background:linear-gradient(145deg,#20B5EE,#0E76BA 58%,#174584);
    display:grid; place-items:center; color:#fff; font-weight:700;
    font-family:var(--font-serif, Georgia), serif; font-size:1rem;
    box-shadow:0 6px 16px rgba(0,151,222,.30), inset 0 1px 0 rgba(255,255,255,.25);
}
.nav-scroll { flex:1; overflow-y:auto; margin:0 -4px; padding:0 4px; }
.nav-group { margin-bottom:16px; }
.nav-group .label {
    font-family:var(--font-mono); font-size:.6rem; text-transform:uppercase;
    letter-spacing:.13em; color:var(--muted); padding:0 10px 6px;
}
.nav-item {
    display:flex; align-items:center; gap:11px; padding:9px 11px;
    border-radius:var(--radius-sm); color:var(--sidebar-ink);
    font-size:.895rem; font-weight:500; margin-bottom:2px;
    position:relative; transition:background var(--dur) var(--ease),
        color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.nav-item:hover { background:var(--surface-2); color:var(--ink); text-decoration:none; }
[data-style="modern"] .nav-item:hover { transform:translateX(2px); }
.nav-item.active { background:var(--accent); color:#fff; box-shadow:0 4px 12px rgba(35,83,232,.28); }
[data-style="minimal"] .nav-item.active { box-shadow:none; }
[data-style="classic"] .nav-item.active { box-shadow:none; }
.nav-item.active svg { stroke:#fff; }
.nav-item svg { width:17px; height:17px; stroke:var(--muted); flex-shrink:0;
    transition:stroke var(--dur) var(--ease); }
.nav-item:hover svg { stroke:var(--accent); }
.nav-item.active:hover svg { stroke:#fff; }

/* PRACTICE — pinned to bottom */
.sidebar .practice {
    margin-top:14px; padding:13px 13px; border-radius:var(--radius-sm);
    background:var(--surface-2); border:1px solid var(--rule);
}
.sidebar .practice .pl { font-family:var(--font-mono); font-size:.58rem;
    text-transform:uppercase; letter-spacing:.1em; color:var(--muted); }
.sidebar .practice .pn { color:var(--ink); font-weight:600; font-size:.86rem; margin-top:3px; }
.sidebar .practice .pf { color:var(--muted); font-size:.72rem; margin-top:1px; }

/* ---------- MAIN ---------- */
.main { flex:1; margin-left:var(--sidebar-w); min-width:0; display:flex; flex-direction:column; }
.topbar {
    height:var(--topbar-h); background:var(--topbar-bg);
    backdrop-filter:saturate(180%) blur(14px); -webkit-backdrop-filter:saturate(180%) blur(14px);
    border-bottom:1px solid var(--rule);
    display:flex; align-items:center; justify-content:space-between;
    padding:0 28px; position:sticky; top:0; z-index:30;
}
.topbar .crumbs { font-size:.84rem; color:var(--muted); display:flex; align-items:center; gap:8px; }
.topbar .tools { display:flex; align-items:center; gap:12px; }

/* content: premium centered column that grows comfortably on wide screens */
.content { flex:1; width:100%; max-width:1360px; margin:0 auto; padding:30px 34px 40px; }
@media (min-width:1700px){ .content { max-width:1480px; } }

/* ---------- BUTTONS / ICONS ---------- */
.icon-btn {
    width:38px; height:38px; border-radius:var(--radius-sm);
    border:1px solid var(--rule); background:var(--surface);
    display:grid; place-items:center; cursor:pointer; color:var(--text);
    transition:background var(--dur) var(--ease), border-color var(--dur) var(--ease),
        transform var(--dur) var(--ease);
}
.icon-btn:hover { background:var(--surface-2); border-color:var(--accent); color:var(--accent); }
[data-style="modern"] .icon-btn:hover { transform:translateY(-1px); }
.icon-btn svg { width:18px; height:18px; }

.avatar { width:36px; height:36px; border-radius:50%; background:var(--accent-soft);
    color:var(--accent-ink); display:grid; place-items:center; font-weight:600; font-size:.85rem; }

.btn { display:inline-flex; align-items:center; gap:7px; background:var(--accent);
    color:#fff; border:none; border-radius:var(--radius-sm); padding:10px 17px;
    font-size:.88rem; font-weight:600; font-family:inherit; cursor:pointer;
    transition:transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur); }
.btn:hover { text-decoration:none; }
[data-style="modern"] .btn:hover { transform:translateY(var(--lift)); box-shadow:0 8px 20px rgba(35,83,232,.32); }
[data-style="minimal"] .btn:hover { opacity:.9; }
.btn:active { transform:translateY(0); }
.btn svg { width:16px; height:16px; }
.btn.ghost { background:transparent; border:1px solid var(--rule); color:var(--text); }
.btn.ghost:hover { border-color:var(--accent); color:var(--accent); background:var(--surface-2); }
.btn.danger { background:var(--red); }
[data-style="modern"] .btn.danger:hover { box-shadow:0 8px 20px rgba(239,68,68,.3); }
.btn.sm { padding:7px 11px; font-size:.8rem; }

/* ---------- PAGE HEADER ---------- */
.page-head { display:flex; align-items:flex-end; justify-content:space-between;
    gap:18px; margin-bottom:24px; flex-wrap:wrap; }
.eyebrow { font-family:var(--font-mono); font-size:.65rem; text-transform:uppercase;
    letter-spacing:.13em; color:var(--brand-gold); margin-bottom:7px; }
.page-head h1 { font-size:1.85rem; }
[data-style="classic"] .page-head h1 { font-size:2.15rem; }
.page-head p { color:var(--muted); font-size:.9rem; margin-top:5px; max-width:60ch; }

/* ---------- CARDS ---------- */
.card { background:var(--surface); border:1px solid var(--rule);
    border-radius:var(--radius); box-shadow:var(--shadow);
    transition:transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
        border-color var(--dur) var(--ease); }
.card-pad { padding:22px; }
.card-hover:hover { border-color:color-mix(in srgb, var(--accent) 40%, var(--rule)); }
[data-style="modern"] .card-hover:hover { transform:translateY(var(--lift)); box-shadow:var(--shadow-lg); }

/* ---------- STAT CARDS ---------- */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr));
    gap:16px; margin-bottom:24px; }
.stat { background:var(--surface); border:1px solid var(--rule); border-radius:var(--radius);
    padding:19px 20px; box-shadow:var(--shadow); position:relative; overflow:hidden;
    transition:transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
[data-style="modern"] .stat:hover { transform:translateY(var(--lift)); box-shadow:var(--shadow-lg); }
.stat .st-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:11px; }
.stat .st-label { font-size:.78rem; color:var(--muted); }
.stat .st-value { font-size:1.9rem; font-weight:700; color:var(--ink); letter-spacing:-.025em; }
[data-style="classic"] .stat .st-value { font-family:var(--font-serif); font-weight:500; }
.stat .st-sub { font-size:.76rem; color:var(--muted); margin-top:5px; }
.stat .st-ico { width:36px; height:36px; border-radius:10px; display:grid; place-items:center;
    background:var(--accent-soft); color:var(--accent); }
.stat .st-ico svg { width:18px; height:18px; }

/* accent stat variants (used on dashboard/compliance) */
.stat.accent-red   { background:var(--red);   color:#fff; }
.stat.accent-red .st-value, .stat.accent-red .st-label, .stat.accent-red .st-sub { color:#fff; }
.stat.accent-green { background:var(--green); color:#fff; }
.stat.accent-green .st-value, .stat.accent-green .st-label, .stat.accent-green .st-sub { color:#fff; }

/* clickable stat cards (dashboard) */
a.stat { text-decoration:none; display:block; }
a.stat:hover { text-decoration:none; }
a.stat .st-arrow { position:absolute; top:15px; right:14px; opacity:0;
    transition:opacity var(--dur) var(--ease); color:var(--muted); }
a.stat:hover .st-arrow { opacity:.55; }
a.stat .st-arrow svg { width:15px; height:15px; }

/* ---------- TABLE ---------- */
.tbl-wrap { background:var(--surface); border:1px solid var(--rule);
    border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
table { width:100%; border-collapse:collapse; }
thead th { text-align:left; font-family:var(--font-mono); font-size:.64rem;
    text-transform:uppercase; letter-spacing:.07em; color:var(--muted);
    padding:14px 18px; border-bottom:1px solid var(--rule); background:var(--surface-2); }
tbody td { padding:15px 18px; border-bottom:1px solid var(--rule); font-size:.9rem; }
tbody tr:last-child td { border-bottom:none; }
tbody tr { transition:background var(--dur) var(--ease); }
tbody tr:hover { background:var(--surface-2); }
.cell-title { font-weight:600; color:var(--ink); }
.cell-sub { font-size:.78rem; color:var(--muted); margin-top:2px; }

/* ---------- BADGES ---------- */
.badge { display:inline-flex; align-items:center; gap:5px; font-family:var(--font-mono);
    font-size:.63rem; text-transform:uppercase; letter-spacing:.04em;
    padding:4px 10px; border-radius:20px; font-weight:500; }
[data-style="classic"] .badge { border-radius:3px; }
.badge.active   { background:rgba(16,185,129,.14); color:var(--green); }
.badge.prospect { background:var(--accent-soft); color:var(--accent-ink); }
.badge.lapsed   { background:rgba(239,68,68,.14); color:var(--red); }

/* ---------- FORMS ---------- */
.field { margin-bottom:16px; }
.field label { display:block; font-size:.82rem; font-weight:600; color:var(--ink); margin-bottom:6px; }
.field input,.field select,.field textarea { width:100%; padding:10px 13px; border:1px solid var(--rule);
    border-radius:var(--radius-sm); font-family:inherit; font-size:.9rem;
    background:var(--surface); color:var(--ink);
    transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.field input:focus,.field select:focus,.field textarea:focus { outline:none;
    border-color:var(--accent); box-shadow:var(--glow); }

/* ---------- CUSTOM SELECT (app-wide, replaces ugly native dropdown) ----------
   Removes the native arrow and draws our own so <select> matches the design. */
select {
    -webkit-appearance:none; -moz-appearance:none; appearance:none;
    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='%238A90A4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-size:16px 16px;
    background-repeat:no-repeat; background-position:right 11px center;
    padding-right:34px !important; cursor:pointer;
    background-color:var(--surface); color:var(--ink);
    border:1px solid var(--rule); border-radius:var(--radius-sm);
    font-family:inherit; font-size:.9rem;
    transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
select:hover { border-color:color-mix(in srgb, var(--accent) 45%, var(--rule)); }
select:focus { outline:none; border-color:var(--accent); box-shadow:var(--glow); }
/* dark-mode arrow colour */
[data-theme="dark"] select {
    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='%23A9B2C6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-size:16px 16px;
}

/* Compact inline select — used in table rows (e.g. renewal stage) */
select.select-inline {
    padding:7px 30px 7px 11px !important; font-size:.82rem; font-weight:500;
    background-position:right 9px center; min-width:150px;
}
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.grid-3 { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }

/* ---------- TABLE ----------
   Used by plans, regulatory (CDD, CPD, Section 14) and the PDF views.
   Previously referenced by markup but never defined, so those tables
   rendered as unstyled browser-default tables. */
.table { width:100%; border-collapse:collapse; font-size:.88rem; }
.table th { text-align:left; font-family:'JetBrains Mono',ui-monospace,monospace;
    font-size:.68rem; letter-spacing:.08em; text-transform:uppercase;
    color:var(--muted); font-weight:600; padding:12px 14px;
    border-bottom:1px solid var(--rule); white-space:nowrap; }
.table td { padding:13px 14px; border-bottom:1px solid var(--rule);
    vertical-align:middle; color:var(--ink); }
.table tbody tr:last-child td { border-bottom:0; }
.table tbody tr:hover { background:var(--surface-2,rgba(35,83,232,.03)); }
.table .num { text-align:right; font-variant-numeric:tabular-nums; }
.table-wrap { width:100%; overflow-x:auto; overflow-y:hidden;
    -webkit-overflow-scrolling:touch; }

/* ---------- FLASH ---------- */
.flash { background:var(--accent-soft); color:var(--accent-ink); border:1px solid var(--accent);
    border-radius:var(--radius-sm); padding:12px 16px; margin-bottom:20px; font-size:.88rem; }
.flash.err { background:rgba(239,68,68,.08); border-color:var(--red); color:var(--red); }

/* ---------- FOOTER (elegant) ---------- */
.site-footer { border-top:1px solid var(--rule); background:var(--surface);
    padding:22px 34px; margin-top:8px; }
.site-footer .frow { max-width:1360px; margin:0 auto; display:flex; align-items:center;
    justify-content:space-between; gap:16px; flex-wrap:wrap; }
.site-footer .fbrand { display:flex; align-items:center; gap:9px;
    font-family:var(--font-display); font-size:1rem; color:var(--ink); }
[data-style="classic"] .site-footer .fbrand { font-family:var(--font-serif); font-weight:600; }
.site-footer .fbrand .mark { width:24px; height:24px; font-size:.72rem; border-radius:7px; }
.site-footer .flinks { display:flex; gap:20px; font-size:.8rem; }
.site-footer .flinks a { color:var(--muted); }
.site-footer .flinks a:hover { color:var(--accent); }
.site-footer .fnote { font-size:.74rem; color:var(--muted); font-family:var(--font-mono);
    letter-spacing:.03em; }

/* ---------- SETTINGS ---------- */
.set-grid { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.opt-row { display:flex; gap:12px; flex-wrap:wrap; }
.opt-card { flex:1; min-width:130px; border:1.5px solid var(--rule); border-radius:var(--radius-sm);
    padding:15px; cursor:pointer; background:var(--surface);
    transition:border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.opt-card:hover { border-color:var(--accent); }
[data-style="modern"] .opt-card:hover { transform:translateY(-2px); }
.opt-card.sel { border-color:var(--accent); box-shadow:var(--glow); }
.opt-card .oc-title { font-weight:600; color:var(--ink); font-size:.9rem; margin-bottom:3px; }
.opt-card .oc-desc { font-size:.76rem; color:var(--muted); }
.swatch-row { display:flex; gap:10px; flex-wrap:wrap; }
.swatch { width:38px; height:38px; border-radius:10px; cursor:pointer; border:2px solid transparent;
    transition:transform var(--dur) var(--ease); }
.swatch:hover { transform:scale(1.08); }
.swatch.sel { border-color:var(--ink); }

/* ---------- RESPONSIVE FORMS (any screen) ----------
   Flex layout: fields grow to fill space, the button hugs its own text and
   sits on the same baseline as the fields. */
.filter-bar { display:flex; flex-wrap:wrap; gap:14px; align-items:flex-end; }
.filter-bar .field { flex:1 1 200px; margin:0; min-width:160px; }
.filter-bar .field.grow { flex:3 1 260px; }          /* main search field grows more */
.filter-bar .check-inline { display:flex; align-items:center; gap:8px;
    font-size:.85rem; white-space:nowrap; height:42px; flex:0 0 auto; }
.filter-bar .btn { flex:0 0 auto; align-self:flex-end; height:42px;
    padding:0 22px; justify-content:center; }        /* auto width, aligned height */

/* ---------- MOBILE ---------- */
.hamburger { display:none; }
.sidebar-overlay { display:none; }
.topbar-mobile-brand { display:none; }
.drawer-tools { display:none; }

/* Tablet + down: sidebar becomes a drawer */
@media (max-width:980px){
    .sidebar { transform:translateX(-100%); box-shadow:var(--shadow-lg); width:270px; }
    .sidebar.open { transform:translateX(0); }
    .main { margin-left:0; }
    .hamburger { display:grid; }
    .sidebar-overlay.show { display:block; position:fixed; inset:0; background:rgba(0,0,0,.45);
        z-index:35; backdrop-filter:blur(2px); }
    .grid-2,.set-grid,.grid-3 { grid-template-columns:1fr; }
    /* Wide tables scroll horizontally inside their card rather than
       forcing the whole page wide, or being clipped and unreachable. */
    .table-wrap > .table { min-width:640px; }
    .content { padding:22px 18px 30px; }
    .site-footer { padding:20px 18px; }
    .site-footer .frow { flex-direction:column; text-align:center; gap:12px; }

    /* ----- CLEAN MOBILE TOP BAR: only ☰ + centered logo ----- */
    .topbar { padding:0 14px; position:relative; }
    .topbar .crumbs { display:none; }               /* hide crumb text on mobile */
    .topbar .tools { display:none; }                /* hide desktop tools cluster */
    .topbar-mobile-brand {
        display:flex; align-items:center; gap:8px; position:absolute;
        left:50%; top:50%; transform:translate(-50%,-50%);
        font-family:var(--font-display); font-size:1.15rem; color:var(--ink);
    }
    [data-style="classic"] .topbar-mobile-brand { font-family:var(--font-serif); font-weight:600; }
    .topbar-mobile-brand b { color:var(--accent); font-weight:400; }
    .topbar-mobile-brand .mark { width:26px; height:26px; font-size:.78rem; border-radius:7px; }

    /* ----- tools live inside the drawer now ----- */
    .drawer-tools {
        display:flex; align-items:center; justify-content:space-between;
        gap:10px; padding:12px 11px; margin-top:12px;
        border-top:1px solid var(--rule);
    }
    .drawer-tools .dt-left { display:flex; align-items:center; gap:10px; }
    .drawer-tools .avatar { width:32px; height:32px; font-size:.8rem; }
    .drawer-tools .dt-name { font-size:.85rem; }
    .drawer-tools .dt-name b { color:var(--ink); font-weight:600; display:block; font-size:.88rem; }
    .drawer-tools .dt-name span { color:var(--muted); font-size:.72rem; }
    .drawer-tools .dt-actions { display:flex; gap:8px; }
}

/* Phone: TABLES REFLOW INTO STACKED CARDS + premium header/cards */
@media (max-width:720px){
    /* header: give the title room, premium spacing, no clipping */
    .page-head { flex-direction:column; align-items:stretch; gap:16px; margin-bottom:22px; }
    .page-head h1 { font-size:1.6rem; line-height:1.15; }
    [data-style="classic"] .page-head h1 { font-size:1.8rem; }
    .page-head p { font-size:.88rem; }
    .page-head .btn { width:100%; justify-content:center; padding:12px 16px; }

    /* search bar: proper gap so the button never fuses to the field */
    .filter-bar { grid-template-columns:1fr; gap:16px; }
    .filter-bar .btn { width:100%; justify-content:center; margin-top:2px; padding:12px 16px; }
    .filter-bar .check-inline { padding-bottom:0; }

    /* table → cards */
    .tbl-wrap { border:none; box-shadow:none; background:transparent; overflow:visible; }
    table, thead, tbody, th, td, tr { display:block; }
    thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
    tbody tr {
        background:var(--surface); border:1px solid var(--rule);
        border-radius:var(--radius); box-shadow:var(--shadow);
        margin-bottom:12px; padding:6px 4px;
    }
    tbody tr:hover { background:var(--surface); }
    tbody td {
        display:flex; justify-content:space-between; align-items:center; gap:14px;
        padding:11px 16px; border-bottom:1px solid var(--rule); text-align:right;
    }
    tbody tr td:last-child { border-bottom:none; }
    tbody td::before {
        content:attr(data-label); text-align:left; flex-shrink:0;
        font-family:var(--font-mono); font-size:.62rem; text-transform:uppercase;
        letter-spacing:.06em; color:var(--muted); font-weight:500;
    }
    tbody td.cell-title, tbody td:first-child { font-size:.98rem; }
    tbody td.td-actions { justify-content:flex-end; }
    tbody td.td-actions::before { content:""; }

    /* Clients: the first cell holds company name + (optional) email.
       Stack it as a clean left-aligned block so name & email never cram
       against each other on the right. */
    tbody td.cell-stack {
        display:flex; flex-direction:column; align-items:flex-start;
        text-align:left; gap:2px;
    }
    tbody td.cell-stack::before { margin-bottom:2px; }
    tbody td.cell-stack .cell-title { line-height:1.25; }
    tbody td.cell-stack .cell-sub { word-break:break-word; }

    .stat-grid { grid-template-columns:1fr 1fr; gap:12px; }
    .stat .st-value { font-size:1.5rem; }

    /* Dashboard: keep compact so key numbers fit without endless scroll */
    .dash-stats { grid-template-columns:1fr 1fr !important; gap:10px !important; }
    .dash-stats .stat { padding:14px 15px; }
    .dash-stats .stat .st-value { font-size:1.45rem; }
    .dash-stats .stat .st-sub { font-size:.7rem; }
    .dash-stats .stat .st-ico { width:30px; height:30px; }
    /* renewal windows: 3 tight columns across */
    .dash-windows { grid-template-columns:repeat(3,1fr) !important; gap:9px !important; }
    .dash-windows .stat { padding:12px 12px; }
    .dash-windows .stat .st-value { font-size:1.5rem; }
    .dash-windows .stat .st-label { font-size:.68rem; }
    .dash-windows .stat .st-sub { display:none; }   /* hide subtext on tiny window cards */
    .dash-windows .stat .st-ico { display:none; }

    /* ===== INTERACTION CARDS — clean mobile layout ===== *
       Desktop: [icon] [body........] [meta]
       Mobile:  [icon] [body........]   ← icon + body stay side by side
                ─────────────────────
                date            [edit][del]  ← meta drops full-width below
    */
    .it-card-row { flex-wrap:wrap; }
    .it-icon-wrap { flex-shrink:0; }
    .it-card-body { flex:1 1 auto; min-width:0; }
    .it-card-meta {
        flex:1 1 100%; order:3;
        display:flex; align-items:center; justify-content:space-between;
        width:100%; margin-top:12px; padding-top:12px;
        border-top:1px solid var(--rule); text-align:left !important;
    }
    .it-card-meta .it-date { font-size:.78rem; }
    .it-card-meta .it-actions { margin-top:0 !important; }
}

/* Very small phones */
@media (max-width:420px){
    .stat-grid:not(.dash-stats):not(.dash-windows) { grid-template-columns:1fr; }
    .topbar-mobile-brand { font-size:1.05rem; }
}

/* ---------- UTIL ---------- */
.muted { color:var(--muted); }
.empty { text-align:center; padding:48px 20px; color:var(--muted); }
.fade-in { animation:fadeIn .4s var(--ease) both; }
[data-style="classic"] .fade-in { animation:none; }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ============================================================================
   DARK MODE HOVER SAFETY — guarantees readable text/icons on hover
   ============================================================================ */
[data-theme="dark"] .nav-item:hover { background:var(--surface-3); color:var(--ink); }
[data-theme="dark"] .nav-item:hover svg { stroke:var(--accent); }
[data-theme="dark"] tbody tr:hover { background:var(--surface-2); color:var(--ink); }
[data-theme="dark"] tbody tr:hover td { color:var(--text); }
[data-theme="dark"] .card-hover:hover,
[data-theme="dark"] a.card:hover { background:var(--surface-2); }
[data-theme="dark"] .btn.ghost:hover { background:var(--surface-3); color:var(--accent); border-color:var(--accent); }
[data-theme="dark"] .icon-btn:hover { background:var(--surface-3); color:var(--accent); }
/* selects + inputs stay readable in dark */
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea { background:var(--surface-2); color:var(--ink); }
[data-theme="dark"] select { background-color:var(--surface-2); color:var(--ink); }
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color:var(--muted); }


/* ============================================================================
   ENHANCED STYLE PERSONALITIES (Round 14)
   Each interface style gets a distinct hover/motion character.
   ============================================================================ */

/* ---- MODERN: lively, floaty, gradient glow, springy hover ---- */
[data-style="modern"] .card,
[data-style="modern"] .stat {
    transition:transform .28s cubic-bezier(.2,.8,.2,1), box-shadow .28s ease, border-color .28s ease;
}
[data-style="modern"] .stat:hover {
    transform:translateY(-4px);
    box-shadow:0 14px 40px color-mix(in srgb, var(--accent) 18%, transparent);
}
[data-style="modern"] .card-hover:hover,
[data-style="modern"] a.card:hover { transform:translateY(-3px); box-shadow:var(--shadow-lg); }
[data-style="modern"] .btn:not(.ghost):hover { transform:translateY(-2px); filter:brightness(1.05); }
[data-style="modern"] .badge { border-radius:20px; }

/* ---- CLASSIC: stately, no motion, underline reveals, serif polish ---- */
[data-style="classic"] * { transition:none !important; }
[data-style="classic"] .card { border-radius:3px; }
[data-style="classic"] .stat:hover { border-left-width:6px; }
[data-style="classic"] .nav-item.active { background:var(--ink); color:var(--surface); }
[data-style="classic"] .nav-item.active svg { stroke:var(--surface); }
[data-style="classic"] .btn:not(.ghost) { text-transform:uppercase; letter-spacing:.06em; font-size:.82rem; }
[data-style="classic"] .eyebrow { border-bottom:1px solid var(--rule); padding-bottom:4px; display:inline-block; }
[data-style="classic"] h1 { font-size:2rem; }

/* ---- MINIMAL: flat, monochrome, quiet, precise, subtle underline hover ---- */
[data-style="minimal"] .card,
[data-style="minimal"] .stat { transition:border-color .12s ease; }
[data-style="minimal"] .stat:hover { border-top-color:var(--accent); }
[data-style="minimal"] .card-hover:hover,
[data-style="minimal"] a.card:hover { border-color:var(--ink); }
[data-style="minimal"] .nav-item.active { background:transparent; color:var(--ink); border-left:2px solid var(--ink); border-radius:0; padding-left:9px; }
[data-style="minimal"] .nav-item.active svg { stroke:var(--ink); }
[data-style="minimal"] .btn:not(.ghost):hover { filter:brightness(1.15); }
[data-style="minimal"] .badge { border-radius:3px; text-transform:uppercase; font-size:.66rem; letter-spacing:.05em; }
[data-style="minimal"] h1,[data-style="minimal"] h2 { font-weight:600; }
[data-style="minimal"] .eyebrow { font-size:.68rem; letter-spacing:.14em; }

/* ============================================================================
   PROFILE CHIP (top bar) — clickable circular avatar + name
   ============================================================================ */
.profile-chip {
    display:inline-flex; align-items:center; gap:9px; text-decoration:none;
    padding:4px 10px 4px 4px; border-radius:24px; transition:background var(--dur) var(--ease);
}
.profile-chip:hover { background:var(--surface-2); text-decoration:none; }
.avatar-img {
    width:34px; height:34px; border-radius:50%; overflow:hidden; flex-shrink:0;
    display:grid; place-items:center; background:var(--accent); color:#fff;
    font-weight:700; font-size:.9rem;
}
.avatar-img img { width:100%; height:100%; object-fit:cover; display:block; }
.profile-name { font-size:.85rem; font-weight:600; color:var(--ink); white-space:nowrap; max-width:150px; overflow:hidden; text-overflow:ellipsis; }

/* Mobile: show the image, hide the name */
@media (max-width:640px){
    .profile-name { display:none; }
    .profile-chip { padding:4px; }
}

/* Circular avatar for the Users list */
.user-avatar {
    width:38px; height:38px; border-radius:50%; overflow:hidden; flex-shrink:0;
    display:grid; place-items:center; background:var(--accent); color:#fff;
    font-weight:700; font-size:.95rem; text-decoration:none;
}
.user-avatar img { width:100%; height:100%; object-fit:cover; display:block; }

/* ============================================================================
   SETTINGS PAGE RESPONSIVENESS (Round 29 fix)
   ============================================================================ */
.style-picker { grid-template-columns:repeat(3,1fr); }
.theme-picker { grid-template-columns:repeat(3,1fr); }
/* Interface-style + theme picker cards: 3 cols on desktop, wrap on mobile */
@media (max-width:640px){
    .style-picker { grid-template-columns:1fr 1fr; }
    .theme-picker { grid-template-columns:1fr 1fr 1fr; }
}
@media (max-width:420px){
    .style-picker { grid-template-columns:1fr; }
}

/* Role Access: on mobile, let the table scroll but keep the first column
   (module name) visible and readable, and add a subtle scroll hint. */
@media (max-width:640px){
    .role-access-table { min-width:0 !important; }
    .role-access-table th, .role-access-table td { font-size:.8rem; padding:7px 4px !important; }
    .role-access-wrap { position:relative; }
}

/* ============================================================
   Round 35 — Global search bar + reveal animation
   ============================================================ */

/* Global search in the top bar */
.global-search {
    display:flex; align-items:center; gap:8px;
    background:var(--surface-2, rgba(0,0,0,.04));
    border:1px solid var(--rule);
    border-radius:10px; padding:7px 12px;
    min-width:220px; max-width:340px; flex:1;
    transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.global-search:focus-within {
    border-color:var(--accent);
    box-shadow:0 0 0 3px var(--accent-soft, rgba(35,83,232,.15));
}
.global-search .gs-ico { color:var(--muted); display:flex; }
.global-search input {
    border:none; background:none; outline:none; flex:1;
    font-size:.86rem; color:var(--ink); font-family:inherit; min-width:0;
}
.global-search input::placeholder { color:var(--muted); }
@media (max-width:900px){ .global-search { min-width:150px; } }

/* Reveal animation — driven by --reveal-dur (set from Animation settings).
   Cards stagger using their inline --d (1..n). Off = instant. */
.reveal {
    opacity:0;
    animation:bdReveal var(--reveal-dur, .24s) var(--ease, ease) forwards;
    animation-delay:calc(var(--d, 0) * 60ms);
}
@keyframes bdReveal {
    from { opacity:0; transform:translateY(10px); }
    to   { opacity:1; transform:none; }
}
[data-anim="off"] .reveal {
    opacity:1 !important; animation:none !important; transform:none !important;
}
@media (prefers-reduced-motion: reduce){
    .reveal { opacity:1 !important; animation:none !important; transform:none !important; }
}
@media (max-width:900px){ .global-search { display:none; } }

/* ============================================================
   Round 36 — search icon fix, live dropdown, mobile search +
   profile icon, smaller mobile greeting
   ============================================================ */

/* Fix: the icon SVG had no intrinsic size, so it collapsed. */
.global-search .gs-ico svg,
.nav-search .ns-ico svg { width:16px; height:16px; display:block; }
.global-search .gs-ico { color:var(--muted); display:flex; align-items:center; }

/* Search wrap holds the input + the live dropdown */
.global-search-wrap { position:relative; flex:1; max-width:360px; }
.global-search { width:100%; max-width:none; }

/* Live results dropdown */
.gs-dropdown {
    position:absolute; top:calc(100% + 6px); left:0; right:0; z-index:1200;
    background:var(--surface); border:1px solid var(--rule); border-radius:12px;
    box-shadow:0 12px 40px rgba(0,0,0,.18); overflow:hidden;
    max-height:min(70vh,460px); overflow-y:auto; padding:6px;
}
.gs-group-label {
    font-size:.68rem; text-transform:uppercase; letter-spacing:.08em;
    color:var(--muted); font-weight:700; padding:8px 10px 4px;
}
.gs-item { display:block; padding:8px 10px; border-radius:8px; text-decoration:none; color:var(--ink); }
.gs-item:hover { background:var(--surface-2, rgba(0,0,0,.04)); }
.gs-item-title { font-size:.86rem; font-weight:600; }
.gs-item-sub { font-size:.74rem; color:var(--muted); margin-top:1px; }
.gs-empty { padding:16px 12px; color:var(--muted); font-size:.85rem; text-align:center; }
.gs-all {
    display:block; width:100%; text-align:left; margin-top:4px;
    padding:10px; border:none; border-top:1px solid var(--rule);
    background:none; color:var(--accent); font-weight:600; font-size:.82rem;
    cursor:pointer; font-family:inherit;
}
.gs-all:hover { background:var(--surface-2, rgba(0,0,0,.04)); }

/* Sidebar (mobile) search — hidden on desktop, shown in the drawer on mobile */
.nav-search { display:none; }

/* Mobile profile icon in the top bar — hidden on desktop */
.topbar-mobile-profile { display:none; }

@media (max-width:900px){
    /* top-bar live search is hidden on mobile; the sidebar search takes over */
    .global-search-wrap { display:none; }

    /* show the sidebar search at the top of the drawer nav */
    .nav-search {
        display:flex; align-items:center; gap:8px; margin:4px 10px 12px;
        background:var(--surface-2, rgba(0,0,0,.04)); border:1px solid var(--rule);
        border-radius:10px; padding:9px 12px;
    }
    .nav-search .ns-ico { color:var(--muted); display:flex; }
    .nav-search input {
        border:none; background:none; outline:none; flex:1; min-width:0;
        font-size:.9rem; color:var(--ink); font-family:inherit;
    }
    .nav-search input::placeholder { color:var(--muted); }

    /* profile icon top-right */
    .topbar-mobile-profile {
        display:flex; align-items:center; justify-content:center;
        width:36px; height:36px; border-radius:50%; overflow:hidden;
        background:var(--accent); color:#fff; font-weight:700; font-size:.9rem;
        text-decoration:none; flex-shrink:0;
    }
    .topbar-mobile-profile img { width:100%; height:100%; object-fit:cover; }

    /* balance the top bar: hamburger left, brand center, profile right */
    .topbar-mobile-brand { position:absolute; left:50%; transform:translateX(-50%); }
}

/* Smaller, tighter greeting on mobile so it doesn't dominate the screen */
@media (max-width:640px){
    .dash-hero h1, .page-head h1 { font-size:1.5rem !important; line-height:1.2 !important; }
    .dash-hero .eyebrow, .page-head .eyebrow { font-size:.7rem; }
    .dash-hero p, .page-head p { font-size:.88rem; }
}
