/* ==========================================================================
   TROVA Dashboard — app.css
   Token-driven. Light-default as of 2026-04-23 (contractor readability in
   bright outdoor / truck-cab light), dark still available via user pref.
   Accent color is overridden per-tenant via inline <style>:root{--accent:...}</style>
   in layout.php.

   Theme selection is driven by `data-theme` on <html>:
     data-theme="light"  → light tokens (default if no preference set)
     data-theme="dark"   → dark tokens
     data-theme="system" → follows prefers-color-scheme media query
   layout.php's <head> script reads localStorage("trova.theme") and sets
   the attribute before CSS paints, avoiding FOUC.
   ========================================================================== */

/* ── TROVA brand-constant tokens (same in light + dark) ─────────────────
   Per Brand Kit: Black #000000, Volt #B9D53F, Bioluminescent #01AED6,
   Vector #82C341, Hotlink #EE283E, White #FFFFFF.
   Volt is the primary action accent; Hotlink is destructive/alert;
   Bioluminescent and Vector are supporting palette colors used for
   chart/data visualization and contextual badges. */
:root {
    --volt:           #B9D53F;
    --volt-hover:     #c7e054;
    --bioluminescent: #01AED6;
    --vector:         #82C341;
    --hotlink:        #EE283E;
    --hotlink-hover:  #f04457;

    /* Typography stacks. Chakra Petch is a Google Fonts substitute for
       Manifold Extended (paid). Major Mono Display substitutes Havelock
       Titling. Inter remains the body face — close cousin to Neue Haas
       Grotesk. Swap to licensed faces when acquired. */
    --font-title:        'Chakra Petch', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono-display: 'Major Mono Display', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

/* ── Light-mode tokens ────────────────────────────────────────────────── */
:root,
:root[data-theme="light"] {
    --bg:             #ffffff;
    --bg-alt:         #f5f7fa;     /* sidebar, table header stripe */
    --card:           #ffffff;
    --card-hover:     #f5f7fa;
    --border:         rgba(0,0,0,0.09);
    --border-strong:  rgba(0,0,0,0.18);
    --orange:         #ff6b00;
    --orange-hover:   #ff8533;
    --green:          var(--vector);
    --blue:           var(--bioluminescent);
    --red:            var(--hotlink);
    --amber:          #d97706;
    --text:           #0f172a;
    --text-dim:       #334155;
    --muted:          #64748b;
    --muted-dim:      #94a3b8;
    --accent:         var(--volt);    /* TROVA brand default; overridden per-tenant via inline <style> */

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(15,23,42,0.06);
    --shadow:    0 4px 14px rgba(15,23,42,0.08);
    --shadow-lg: 0 12px 40px rgba(15,23,42,0.12);

    /* Tint overlays — contrast against --bg. Used for subtle raised
       surfaces (tags, inline-code, row stripes). Light mode uses
       darkened-black; dark mode uses whitened-white. */
    --tint-soft:      rgba(15,23,42,0.04);
    --tint-medium:    rgba(15,23,42,0.06);
    --tint-strong:    rgba(15,23,42,0.10);

    --sidebar-width: 244px;
    --sidebar-collapsed-width: 64px;
    --header-height: 64px;
}

/* ── Dark-mode tokens (the new default per Brand Kit) ─────────────────── */
:root[data-theme="dark"] {
    --bg:             #000000;     /* Brand Kit black */
    --bg-alt:         #0a0a0a;     /* sidebar, table header stripe — slight lift on pure black */
    --card:           #111111;
    --card-hover:     #1a1a1a;
    --border:         rgba(255,255,255,0.08);
    --border-strong:  rgba(255,255,255,0.16);
    --orange:         #ff6b00;
    --orange-hover:   #ff8533;
    --green:          var(--vector);
    --blue:           var(--bioluminescent);
    --red:            var(--hotlink);
    --amber:          #f59e0b;
    --text:           #f0f0f0;
    --text-dim:       #c0c0c0;
    --muted:          #888888;
    --muted-dim:      #555555;
    --accent:         var(--volt);   /* TROVA brand default; tenant override via inline <style> */

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow:    0 4px 14px rgba(0,0,0,0.5);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.55);

    --tint-soft:      rgba(255,255,255,0.04);
    --tint-medium:    rgba(255,255,255,0.06);
    --tint-strong:    rgba(255,255,255,0.10);
}

/* System mode: follow the OS via prefers-color-scheme, but only for
   users who've explicitly selected "system". Default (no data-theme or
   data-theme="light") stays light regardless of OS. */
@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] {
        --bg:             #0a0a0a;
        --bg-alt:         #080808;
        --card:           #111111;
        --card-hover:     #161616;
        --border:         rgba(255,255,255,0.06);
        --border-strong:  rgba(255,255,255,0.12);
        --blue:           #5b9cff;
        --red:            #ef4444;
        --amber:          #f59e0b;
        --text:           #f0f0f0;
        --text-dim:       #c0c0c0;
        --muted:          #888888;
        --muted-dim:      #555555;

        --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
        --shadow:    0 4px 14px rgba(0,0,0,0.5);
        --shadow-lg: 0 12px 40px rgba(0,0,0,0.55);

        --tint-soft:      rgba(255,255,255,0.04);
        --tint-medium:    rgba(255,255,255,0.06);
        --tint-strong:    rgba(255,255,255,0.10);
    }
}

/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; color-scheme: light dark; }
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[x-cloak] { display: none !important; }

/* ── TROVA brand typography ───────────────────────────────────────────── */
/* Page + section titles use Chakra Petch (Manifold Extended substitute).
   Slightly tightened tracking + uppercase variants on the largest headings
   match the wordmark's geometric extended feel from the Brand Kit. */
h1, h2, h3,
.page-title,
.sidebar-brand,
.sidebar-company {
    font-family: var(--font-title);
    letter-spacing: -0.01em;
}
.sidebar-company {
    font-weight: 700;
    letter-spacing: 0.02em;     /* slight track-out for short brand text */
}

/* Brand-label class — bracket motif `[ LABEL ]` from Brand Kit section
   headers. Major Mono Display, thin tracked, uppercase, muted on dark. */
.brand-label {
    font-family: var(--font-title);  /* Phase 2.7 Slice 3 (S3-9): dropped Major Mono Display per Greg dogfood; brackets stay via ::before/::after */
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 400;
}
.brand-label::before { content: "[ "; opacity: 0.7; }
.brand-label::after  { content: " ]"; opacity: 0.7; }

/* ── Layout: auth mode ────────────────────────────────────────────────── */
.auth-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(ellipse at top, rgba(185,213,63,0.10), transparent 60%),
        var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}
.logo-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;        /* SVG-painted mark; no solid bg behind */
    color: var(--accent);            /* Volt — passed through to <svg> via currentColor */
    font-weight: 900;
    letter-spacing: -0.5px;
    font-size: 13px;
}
.sidebar-logomark svg { width: 32px; height: 32px; display: block; }
.logo-word { font-weight: 800; letter-spacing: -0.5px; font-size: 18px; }
.auth-title { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; margin-bottom: 6px; }
.auth-sub { color: var(--muted); margin-bottom: 28px; font-size: 14px; }
.auth-links {
    margin-top: 18px;
    text-align: center;
    font-size: 14px;
}
.auth-links a { color: var(--muted); }
.auth-links a:hover { color: var(--text); }
.auth-footer {
    margin-top: 32px;
    display: flex;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}
.auth-footer a:hover { color: var(--text); }

/* ── Layout: app mode ─────────────────────────────────────────────────── */
body.mode-app,
body.mode-platform { display: flex; min-height: 100vh; }
.app-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    transition: width 0.18s ease;
}
.app-sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.app-sidebar.collapsed .sidebar-label,
.app-sidebar.collapsed .sidebar-company,
.app-sidebar.collapsed .sidebar-lock,
.app-sidebar.collapsed .sidebar-foot { display: none; }

.sidebar-head {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.sidebar-logomark {
    display: grid;
    place-items: center;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 900;
    font-size: 12px;
    flex-shrink: 0;
}
.sidebar-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.sidebar-company {
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.sidebar-toggle:hover { color: var(--text); border-color: var(--border-strong); }

.sidebar-nav {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
    position: relative;
}
.sidebar-link:hover { background: var(--card-hover); color: var(--text); }
.sidebar-link.is-active {
    background: rgba(255,107,0,0.08);
    color: var(--text);
    box-shadow: inset 2px 0 0 var(--accent);
}
.sidebar-link.is-locked { color: var(--muted-dim); }
.sidebar-link.is-locked:hover { color: var(--text-dim); }
.sidebar-icon {
    width: 16px; height: 16px;
    flex-shrink: 0;
    display: inline-block;
    opacity: 0.8;
}
.sidebar-lock {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 6px;
    background: var(--tint-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-foot {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tier-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.tier-starter { background: rgba(91,156,255,0.12); color: var(--blue); }
.tier-growth  { background: rgba(255,107,0,0.12); color: var(--orange); }
.tier-scale   { background: rgba(22,163,74,0.12); color: var(--green); }

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.app-header {
    height: var(--header-height);
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-header-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.2px;
}
.app-header-right { position: relative; }
/* 2026-05-15 — restyle user dropdown to match TROVA brand. Role is now
   a bracket-motif uppercase chip (matches "[ PIPELINE SUMMARY ]" headers
   throughout the dashboard) instead of a plain dim subtitle. Avatar gets
   a hairline ring so it doesn't look like a chat reaction.
   Greg called the prior styling out as off-brand 2026-05-15. */
.user-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 3px 10px 3px 3px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text);
    transition: border-color 0.12s ease, background 0.12s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.user-btn:hover { border-color: #B9D53F; background: rgba(185,213,63,0.06); }
.user-avatar {
    width: 28px; height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #B9D53F;          /* VOLT — TROVA brand accent */
    color: #1a1f29;                /* near-black for legibility on VOLT */
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.02em;
}
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; gap: 1px; }
.user-name { font-weight: 600; font-size: 13px; color: var(--text); }
.user-role {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #5b6573;
    font-family: 'Chakra Petch', 'Inter', sans-serif;
}

.user-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 200px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
}
.user-menu-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-dim);
    border-radius: 6px;
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
}
.user-menu-item:hover { background: var(--card-hover); color: var(--text); }
.user-menu-btn { padding: 8px 12px; }
.user-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

.app-content {
    flex: 1;
    padding: 32px;
    max-width: 1400px;
    width: 100%;
}

/* ── Forms ────────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="url"],
input[type="search"], input[type="date"], input[type="time"],
select, textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.12s, background 0.12s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    background: var(--card);
}
input:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.06s;
    border: 1px solid transparent;
    line-height: 1;
}
.btn-primary:active, .btn-secondary:active, .btn-ghost:active, .btn-danger:active { transform: translateY(1px); }
.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--orange-hover); border-color: var(--orange-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary {
    background: var(--card);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--card-hover); }
.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-danger {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.btn-block { width: 100%; }

/* ── Flash messages ───────────────────────────────────────────────────── */
.flash-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    max-width: 420px;
}
.auth-main .flash-stack { position: static; margin-bottom: 16px; }
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow);
    font-size: 14px;
}
.flash-success { border-color: rgba(22,163,74,0.45); color: var(--green); }
.flash-error   { border-color: rgba(239,68,68,0.45); color: var(--red); }
.flash-info    { border-color: rgba(91,156,255,0.45); color: var(--blue); }
.flash-warn    { border-color: rgba(245,158,11,0.45); color: var(--amber); }
.flash-message { flex: 1; }
.flash-close {
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    opacity: 0.6;
}
.flash-close:hover { opacity: 1; }

/* ── Banner ───────────────────────────────────────────────────────────── */
.banner {
    padding: 12px 32px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.banner-warn { background: rgba(245,158,11,0.08); color: var(--amber); }
.banner-cta { margin-left: auto; color: inherit; font-weight: 700; text-decoration: underline; }

/* ── Cards / Welcome ──────────────────────────────────────────────────── */
.welcome-panel {
    max-width: 860px;
}
.welcome-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(22,163,74,0.12);
    color: var(--green);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.pulse-dot {
    width: 8px; height: 8px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(22,163,74,0.6);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(22,163,74,0.5); }
    70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); }
    100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}
.welcome-title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 12px;
}
.welcome-company { color: var(--accent); }
.welcome-tier { color: var(--accent); text-transform: capitalize; }
.welcome-sub { color: var(--muted); max-width: 620px; margin-bottom: 32px; }

.welcome-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}
.kv-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kv-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    font-weight: 600;
}
.kv-value {
    font-size: 18px;
    font-weight: 700;
}

.welcome-features {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.welcome-feat-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.feat-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.feat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
}
.feat-row:hover { background: var(--card-hover); }
.feat-icon {
    width: 18px; height: 18px;
    display: grid; place-items: center;
    font-size: 12px;
    font-weight: 700;
    border-radius: 4px;
    flex-shrink: 0;
}
.feat-on .feat-icon  { background: rgba(22,163,74,0.15); color: var(--green); }
.feat-off .feat-icon { background: rgba(136,136,136,0.12); color: var(--muted); }
.feat-off { color: var(--muted); }
.feat-label { flex: 1; }
.feat-upgrade {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Error pages ──────────────────────────────────────────────────────── */
body.mode-error {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at top, rgba(239,68,68,0.06), transparent 60%),
        var(--bg);
}
.error-main {
    text-align: center;
    padding: 40px;
    max-width: 500px;
}
.error-code {
    font-size: 96px;
    font-weight: 900;
    letter-spacing: -4px;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 16px;
}
.error-upgrade { font-size: 72px; }
.error-title { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.error-sub { color: var(--muted); margin-bottom: 24px; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.error-debug {
    margin-top: 32px;
    text-align: left;
    font-size: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}
.error-debug pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: var(--text-dim);
    max-height: 300px;
    overflow: auto;
}

/* ── Utilities ────────────────────────────────────────────────────────── */
.muted   { color: var(--muted); }
/* .mono — STRICT: code-like identifiers ONLY (SKUs, slugs, IDs, hashes, API keys,
   UUIDs). Never for emails, names, dollar amounts, counts, or anything a user
   reads as language. Those are body text → Inter. Dollar amounts that need
   column-alignment use .num (tabular-nums Inter) instead. */
.mono    { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
/* .num — Inter with tabular figures so dollars + counts column-align in tables
   without the mechanical look of full monospace. Use on $ amounts, counts,
   percentages. */
.num     { font-variant-numeric: tabular-nums; }
.hidden  { display: none !important; }

/* ── Mobile navigation (hamburger + sidebar + scrim) ──────────────────── */
/* B1 fix (2026-04-23): below 900px the sidebar was sliding offscreen with
   no way to bring it back. Header now owns a hamburger button that toggles
   .open on #app-sidebar and .visible on .sidebar-scrim. Both elements live
   alongside the sidebar in the layout — wired by app.js. */

.app-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* ── Header scope switcher (2026-05-17) ───────────────────────────────────
   Inline location picker between the page title and the Ask box. Renders
   only when the tenant has >1 location (controlled in PHP). Brand-locked
   styling: bracket motif on the eyebrow, Chakra Petch label, hover VOLT. */
.scope-switcher { position: relative; margin-left: 4px; }
.scope-switcher-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
    transition: border-color 0.12s ease, background 0.12s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.scope-switcher-btn:hover { border-color: #B9D53F; background: rgba(185,213,63,0.06); }
.scope-switcher-icon { display: inline-flex; color: #5b6573; }
.scope-switcher-label {
    display: flex; flex-direction: column;
    align-items: flex-start; line-height: 1.1; gap: 1px;
}
.scope-switcher-eyebrow {
    font-family: 'Chakra Petch', 'Inter', sans-serif;
    font-size: 9px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: #5b6573;
}
.scope-switcher-value { font-size: 13px; font-weight: 600; color: var(--text); }
.scope-switcher-menu {
    position: absolute;
    left: 0; top: calc(100% + 6px);
    min-width: 240px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    padding: 4px;
    box-shadow: var(--shadow-lg, 0 12px 28px rgba(0,0,0,0.12));
    z-index: 60;
}
.scope-switcher-form { margin: 0; }
.scope-switcher-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 8px 10px;
    background: none; border: 0; cursor: pointer;
    text-align: left; border-radius: 5px;
    font-family: 'Inter', sans-serif; font-size: 13px;
    color: var(--text);
}
.scope-switcher-item:hover { background: rgba(185,213,63,0.08); }
.scope-switcher-item.is-active {
    background: rgba(185,213,63,0.14);
    color: var(--text);
}
.scope-switcher-item-name { flex: 1; font-weight: 500; }
.scope-switcher-item-meta { font-size: 11px; color: var(--muted, #5b6573); }
.scope-switcher-item-tag {
    font-family: 'Chakra Petch', monospace;
    font-size: 8px; font-weight: 700; letter-spacing: 0.08em;
    color: #1a1f29; background: #B9D53F;
    padding: 1px 5px; border-radius: 3px;
}

/* ── BU filter chip row — pipeline/schedule (2026-05-17) ──────────────── */
.bu-chip-row {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin: 0 0 14px 0;
    font-family: 'Inter', sans-serif;
}
.bu-chip-eyebrow {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 9px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: #5b6573;
    align-self: center; margin-right: 4px;
}
.bu-chip {
    display: inline-flex; align-items: center;
    padding: 5px 11px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}
.bu-chip:hover { border-color: #B9D53F; }
.bu-chip.is-active {
    background: #1a1f29; color: #fff;
    border-color: #1a1f29;
}
.bu-chip-form { display: inline; margin: 0; }
.app-header-menu {
    display: none;                 /* desktop default; revealed at ≤ 900px */
    background: none;
    border: 0;
    padding: 10px;
    margin-left: -8px;             /* optical offset so icon aligns with sidebar edge */
    min-width: 44px;
    min-height: 44px;
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
}
.app-header-menu:hover { background: var(--card-hover); }
.app-header-menu:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.sidebar-scrim {
    display: none;                 /* inert on desktop; revealed at ≤ 900px */
    position: fixed;
    inset: 0;
    z-index: 39;                   /* below sidebar (40), above content */
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    border: 0;
    padding: 0;
    cursor: pointer;
}
.sidebar-scrim.visible {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 900px) {
    .app-sidebar {
        position: fixed;
        left: 0; top: 0;
        z-index: 40;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    .app-sidebar.open { transform: translateX(0); }
    .app-header-menu { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar-scrim    { display: block; }
    .app-header { padding: 0 16px; }
    .app-content { padding: 16px; }
    .welcome-title { font-size: 24px; }
    .auth-card { padding: 24px; }
    /* Prevent background scroll when the sidebar drawer is open. The JS
       toggle adds .sidebar-open to <body>. */
    body.sidebar-open { overflow: hidden; }
}

/* ── /settings/appearance — theme picker ──────────────────────────────── */
.appearance-page .appearance-options {
    border: 0;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}
.appearance-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.appearance-option:hover { background: var(--card-hover); }
.appearance-option.is-selected {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}
.appearance-option input[type="radio"] { accent-color: var(--accent); }
.appearance-swatch {
    width: 48px;
    height: 32px;
    border-radius: 6px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
}
.appearance-swatch-light {
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 50%, #f5f7fa 50%, #f5f7fa 100%);
}
.appearance-swatch-dark {
    background: linear-gradient(135deg, #0a0a0a 0%, #0a0a0a 50%, #111111 50%, #111111 100%);
}
.appearance-swatch-system {
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 50%, #0a0a0a 50%, #0a0a0a 100%);
}
.appearance-label { display: flex; flex-direction: column; gap: 2px; }
.appearance-title { font-weight: 600; }
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0,0,0,0); border: 0;
}


/* ── Mobile bottom nav (Phase 2 dashboard simplification) ───────────────
   Renders a fixed 5-icon bar on small screens. Mirrors the sidebar's
   5 surfaces. Hidden on >= 768px (sidebar takes over). */
.bottom-nav {
    display: none;
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    padding: 6px 2px 4px;
    color: var(--muted, #5b6573);
    text-decoration: none;
    font-size: 10px;
    line-height: 1.1;
    position: relative;
    min-width: 0;
}
.bottom-nav-item.is-active {
    color: var(--accent, #ff6b00);
}
.bottom-nav-item.is-disabled {
    color: var(--muted, #5b6573);
    opacity: 0.55;
    cursor: not-allowed;
}
.bottom-nav-icon {
    width: 22px;
    height: 22px;
    display: inline-block;
}
.bottom-nav-label {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.bottom-nav-soon {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #eef0f3;
    color: #5b6573;
    font-size: 8px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

@media (max-width: 767px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 30;
        background: var(--bg, #fff);
        border-top: 1px solid var(--border, #ecf0f3);
        padding: 6px 4px max(env(safe-area-inset-bottom), 6px);
        box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
    }
    /* Add bottom padding so the page content isn't hidden behind the nav. */
    .app-content {
        padding-bottom: 80px !important;
    }
}

[data-theme="dark"] .bottom-nav {
    background: #111;
    border-top-color: #222;
}
[data-theme="dark"] .bottom-nav-soon {
    background: #1f2125;
    color: #aab1ba;
}

/* ── Generic .icon class — used by Session 2a surfaces (Today briefing,
   customers detail timeline, Settings cards, Pricebook UI). Sidebar +
   bottom-nav use their own classes (.sidebar-icon / .bottom-nav-icon)
   that pre-date this. The painted SVG fills 100% of this container, so
   set width/height inline (or via a sizing helper class) on each usage.

   Without display:inline-block the painted SVG falls back to its default
   300x150 viewport — caused the giant Refresh icon bug Greg reported
   2026-04-28. Defining the class fixes every Session 2a icon site.    */
.icon {
    display: inline-block;
    line-height: 1;
    flex-shrink: 0;
    vertical-align: middle;
}

@media (max-width: 720px) {
    .user-btn .user-meta { display: none; }
    .user-btn { padding: 3px; }
    .user-btn > svg { display: none; }
}
