/* ===== Hynex-style layer (branch ui-hynex): left sidebar, soft rounded cards, day/night themes in CKI colors.
   Loaded after style.css; layout/visual only. ===== */
:root, html[data-theme="light"] {
  --bg: #f2f4f3; --card: #ffffff; --card-2: #f7f8f7; --line: #e6e9e7; --ink: #121513; --ink-2: #4d5550; --ink-3: #6b736e;
  --brand: #00A651; --brand-dark: #007A3D; --brand-soft: #e7f5ec; --accent: #D4A843;
  --danger-soft: #fdecea; --warn-soft: #fff6d6; --ok-soft: #e9f6ec;
  --r-sm: 10px; --r-md: 18px; --r-lg: 24px;
  --shadow: 0 1px 2px rgba(16,24,20,.04), 0 8px 24px rgba(16,24,20,.06);
  --side-w: 244px; --side: #0a0a0a; --hover: #f4f6f5; --field: #ffffff; --chip: #eef1ef;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #070807; --card: #111413; --card-2: #161a18; --line: #232926; --ink: #edf1ee; --ink-2: #aab3ad; --ink-3: #8a938d;
  --brand: #19c26a; --brand-dark: #3fd486; --brand-soft: rgba(0,166,81,.16); --accent: #D4A843;
  --danger: #ff7b6e; --danger-soft: rgba(180,35,24,.22); --warn: #f0c75e; --warn-soft: rgba(212,168,67,.16); --ok: #5fd98f; --ok-soft: rgba(0,166,81,.16);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.45);
  --side: #050605; --hover: #181d1a; --field: #0c0f0d; --chip: #1c221f;
  color-scheme: dark;
}
html, body { max-width: 100%; overflow-x: hidden; }
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html[data-theme="dark"] body { background: radial-gradient(900px 500px at 85% -10%, rgba(0,166,81,.10), transparent 60%), var(--bg); background-attachment: fixed; }

/* ---------- sidebar (desktop) ---------- */
html body .site-header { position: fixed; inset: 0 auto 0 0; width: var(--side-w); height: 100vh; height: 100dvh; background: var(--side); border: 0; border-right: 1px solid rgba(255,255,255,.06); display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
html body .site-header::after { display: none; }
html body .site-header .header-row { display: flex; flex-direction: column; align-items: stretch; height: auto; gap: 6px; padding: 22px 16px 12px; max-width: none; margin: 0; flex-wrap: nowrap; }
html body .brand { flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 6px 6px 20px; border-bottom: 1px solid rgba(255,255,255,.07); margin-bottom: 10px; min-width: 0; }
html body .brand .crest { height: 84px !important; width: auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,.6)); }
html body .brand b { font-size: 14.5px !important; white-space: normal; line-height: 1.25; }
html body .brand small { font-size: 10.5px !important; letter-spacing: .2em !important; }
.side-label { font-family: var(--font-display); font-size: 10.5px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #6f7772; padding: 6px 12px 4px; }
html body .site-header .nav { display: flex; flex-direction: column; gap: 3px; width: 100%; overflow: visible; flex-wrap: nowrap; justify-content: flex-start; }
html body .site-header .nav-link { font-size: 14px !important; text-transform: none; letter-spacing: .01em; font-weight: 500; color: #c9d0cc; padding: 10px 14px; border-radius: 12px; min-height: 42px; justify-content: flex-start; position: relative; border: 1px solid transparent; max-width: 100%; }
html body .site-header .nav-link::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #3a413d; flex: 0 0 auto; margin-right: 4px; transition: background .15s; }
html body .site-header .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
html body .site-header .nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(0,166,81,.28), rgba(0,166,81,.06)); border-color: rgba(0,166,81,.35); box-shadow: 0 0 0 1px rgba(0,166,81,.08), 0 8px 20px rgba(0,166,81,.12); }
html body .site-header .nav-link.active::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
html body .site-header .nav-link .pill { margin-left: auto; }
.side-foot { margin-top: auto; padding: 16px 22px 22px; color: #5d655f; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; border-top: 1px solid rgba(255,255,255,.06); }

/* ---------- content shell + top bar ---------- */
.shell { margin-left: var(--side-w); min-width: 0; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar-row { display: flex; align-items: center; gap: 12px; height: 70px; max-width: 1360px; }
html body .topbar .search { margin-left: 0; margin-right: auto; flex: 0 1 420px; min-width: 0; position: relative; width: auto; }
.topbar .s-ic { position: absolute; left: 15px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
html body .topbar .search input { width: 100%; min-width: 0; padding: 11px 16px 11px 42px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); box-shadow: var(--shadow); font-size: 14px; }
html body .topbar .search input::placeholder { color: var(--ink-3); }
html body .topbar .search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
html body .topbar .user { display: flex; gap: 8px; align-items: center; margin-left: 0; flex: 0 0 auto; }
html body .topbar .who { color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; max-width: 170px; box-shadow: var(--shadow); display: inline-block; }
html body .topbar .user .nav-link { color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 12.5px; text-transform: none; letter-spacing: .02em; min-height: 38px; box-shadow: var(--shadow); }
html body .topbar .user .nav-link:hover { color: var(--danger); border-color: var(--danger); }
.theme-btn { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); padding: 0; transition: transform .2s, border-color .2s; }
.theme-btn:hover { border-color: var(--accent); transform: rotate(-12deg); }
.theme-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; grid-area: 1/1; }
.theme-btn .i-moon { fill: currentColor; stroke: none; }
html[data-theme="dark"] .theme-btn .i-moon, html:not([data-theme="dark"]) .theme-btn .i-sun { display: none; }
html[data-theme="dark"] .theme-btn { color: var(--accent); }
html body main, html body main.wrap { max-width: 1360px; padding: 30px 32px 56px; margin: 0 auto; }
html body .foot { max-width: 1360px; margin: 0 auto; padding-left: 32px; padding-right: 32px; color: var(--ink-3); }
.topbar .wrap { padding-left: 32px; padding-right: 32px; margin: 0 auto; }

/* ---------- typography ---------- */
h1, h2, h3 { color: var(--ink); letter-spacing: -.01em; }
html body .page-head h1, html body main h1 { font-size: 28px; font-weight: 700; }
.muted, .small.muted { color: var(--ink-2); }
a { color: var(--brand-dark); }
.label span { color: var(--brand-dark); }

/* ---------- surfaces (soft rounded cards) ---------- */
html body .card, html body .kpi, html body .vcard, html body .stat, html body .pay-stat, html body .inv-tile, html body .vtile, html body .itile, html body .lead, html body .lead-row, html body .acard, html body .ucard, html body .lead-bubble, html body details, html body .empty, html body .feed, html body .pay-row {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); color: var(--ink);
}
html body .card { padding: 22px 24px; }
html body .kpi, html body .stat, html body .pay-stat { border-radius: 20px; position: relative; overflow: hidden; }
html body .kpi b, html body .stat b { letter-spacing: -.02em; }
html body .kpi:hover, html body .vcard:hover, html body .inv-tile:hover, html body .vtile:hover, html body .itile:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: 0 14px 34px rgba(0,122,61,.14); }
html body details details, html body .card details { box-shadow: none; }
html body .empty { border-style: dashed; box-shadow: none; }
.section-title { font-size: 18px; }

/* ---------- controls: pills ---------- */
html body .btn { border-radius: 999px; padding: 10px 20px; text-transform: none; letter-spacing: .02em; font-size: 13.5px; background: var(--brand-dark); color: #fff; box-shadow: 0 6px 16px rgba(0,122,61,.22); }
html[data-theme="dark"] body .btn { background: #00A651; color: #04130a; }
html body .btn:hover { background: var(--brand); }
html body .btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
html body .btn.ghost:hover { border-color: var(--brand); color: var(--brand-dark); }
html body .btn.sm { padding: 7px 14px; font-size: 12.5px; }
html body .seg { border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
html body .seg button { border-radius: 999px; color: var(--ink-2); white-space: nowrap; }
html body .seg button.on { background: var(--card); color: var(--brand-dark); box-shadow: var(--shadow); }
html[data-theme="dark"] body .seg button.on { background: var(--brand-soft); }
html body select, html body .field, html body input[type="search"], html body input[type="text"], html body input[type="password"], html body input:not([type]), html body .confirm-form input, html body .pay-search, html body #hq, html body .form-grid input, html body .form-grid select { background: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; max-width: 100%; }
html body .tag { border-radius: 999px; background: var(--chip); color: var(--ink-2); }
html body .tag.danger { background: var(--danger-soft); color: var(--danger); } html body .tag.warn { background: var(--warn-soft); color: var(--warn); } html body .tag.ok { background: var(--ok-soft); color: var(--ok); }
html body .chip, html body .pay-chip, html body .sev-chip { border-radius: 999px; }

/* ---------- tables ---------- */
html body .tablewrap { border-radius: 14px; max-width: 100%; }
html body table { color: var(--ink); }
html body th { color: var(--ink-3); border-bottom: 1px solid var(--line); background: var(--card-2); font-size: 11.5px; }
html body th:first-child { border-top-left-radius: 10px; } html body th:last-child { border-top-right-radius: 10px; }
html body td { border-bottom: 1px solid var(--line); }
html body tr:hover td { background: var(--hover); }
html body tr.acklines > td, html body tr.an-bars td { background: transparent; }

/* ---------- dark: neutralise hard-coded light colours from style.css ---------- */
html[data-theme="dark"] body .inv-note, html[data-theme="dark"] body .onetime, html[data-theme="dark"] body details.soft, html[data-theme="dark"] body .paid-banner, html[data-theme="dark"] body .pay-un-note, html[data-theme="dark"] body .press-note, html[data-theme="dark"] body .plans-note { background: var(--warn-soft) !important; color: var(--ink) !important; border-color: rgba(212,168,67,.35) !important; }
html[data-theme="dark"] body .temp { background: var(--field); color: var(--ink); }
html[data-theme="dark"] body .vbadge { background: var(--brand-soft); color: var(--brand-dark); border-color: rgba(0,166,81,.3); }
html[data-theme="dark"] body .vlogo, html[data-theme="dark"] body .gclogo, html[data-theme="dark"] body .inv-tile-logo img, html[data-theme="dark"] body .acard-logo img { background: #f4f5f4; border-color: transparent; }
html[data-theme="dark"] body .pay-uncleared, html[data-theme="dark"] body .pay-unmatched, html[data-theme="dark"] body .lr-body, html[data-theme="dark"] body .lead-det, html[data-theme="dark"] body .lead-contact, html[data-theme="dark"] body .stat-ic, html[data-theme="dark"] body .pay-ic, html[data-theme="dark"] body .feed-ic, html[data-theme="dark"] body .lead-more, html[data-theme="dark"] body .plans, html[data-theme="dark"] body .hist-group, html[data-theme="dark"] body .agroup, html[data-theme="dark"] body .sev-group, html[data-theme="dark"] body .claim-group, html[data-theme="dark"] body .gc-contact { background-color: var(--card-2); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] body mark { background: rgba(212,168,67,.35); color: #fff; }
html[data-theme="dark"] body .an-pos, html[data-theme="dark"] body .ok-text { color: var(--ok); }
html[data-theme="dark"] body .an-neg, html[data-theme="dark"] body .hot { color: var(--danger); }
html[data-theme="dark"] body .an-bar.in { background: #19c26a; } html[data-theme="dark"] body .an-bar.out { background: #D4A843; }
html[data-theme="dark"] body .chart-svg [fill="#007A3D"] { fill: #19c26a; } html[data-theme="dark"] body .chart-svg [fill="#B08A25"] { fill: #D4A843; }
html[data-theme="dark"] body .chart-svg [stroke="#d9d9d9"] { stroke: #2a312d; }
html[data-theme="dark"] body .chart-svg text { fill: var(--ink-2); }
html[data-theme="dark"] body .legend i[style*="#007A3D"] { background: #19c26a !important; }
html[data-theme="dark"] body .toast { background: #1b211e; }
/* invoice document stays "paper" in both themes so it reads like the real invoice and prints the same */
html[data-theme="dark"] body .invdoc { background: #fbfbfa; color: #1a1a1a; border-radius: 16px; --ink: #1a1a1a; --ink-2: #555; --ink-3: #6b6b6b; --line: #e5e5e5; --card: #fff; --card-2: #f7f7f7; --hover: #fafafa; --brand-dark: #007A3D; --chip: #f0f0f0; }
html[data-theme="dark"] body .invdoc h1, html[data-theme="dark"] body .invdoc h2, html[data-theme="dark"] body .invdoc h3, html[data-theme="dark"] body .invdoc td, html[data-theme="dark"] body .invdoc th { color: #1a1a1a; }

/* surfaces that style.css paints white with higher specificity */
html body main details:not(.agroup):not(.soft), html body .chip, html body .acard, html body .acard-logo, html body .empty-state, html body .props:not(.inv-props) > div, html body .plans, html body .lead-row, html body .lead-bubble, html body .ucard, html body .stat, html body .inv-tile { background: var(--card) !important; border-color: var(--line); }
html body .brand { order: 0; } html body .side-label { order: 1; } html body .site-header .nav { order: 2; }
html body .topbar .search { order: 0; } html body .topbar .theme-btn { order: 1; margin-left: auto; } html body .topbar .user { order: 2; }
html[data-theme="dark"] body { --tint: #0e1210; }
html[data-theme="dark"] body .tag.no-plans, html[data-theme="dark"] body .pill-s, html[data-theme="dark"] body .vt-stats > span { background: var(--chip); color: var(--ink-2); }
html[data-theme="dark"] body .pill-s.gold, html[data-theme="dark"] body .stat.gold .stat-ic { background: rgba(212,168,67,.18); color: var(--accent); }
html[data-theme="dark"] body .lead-bubble.empty, html[data-theme="dark"] body .lead.past, html[data-theme="dark"] body .lead-row.past, html[data-theme="dark"] body .lead.past .lead-contact { background: var(--card-2) !important; }
html[data-theme="dark"] body tr.is-paid td, html[data-theme="dark"] body .pay-table tfoot td, html[data-theme="dark"] body table.invtable, html[data-theme="dark"] body table.invtable tbody tr:nth-child(even) { background: transparent; }
html[data-theme="dark"] body tr.unmatched td { background: rgba(212,168,67,.07); }
html[data-theme="dark"] body .pay-unmatched, html[data-theme="dark"] body .pay-unmatched .pay-row > summary:hover, html[data-theme="dark"] body .pay-unmatched .pay-row[open] > summary, html[data-theme="dark"] body .pay-unmatched .pay-row .lr-body { background: rgba(212,168,67,.08) !important; }
html[data-theme="dark"] body .pay-uncleared, html[data-theme="dark"] body main details.pay-uncleared, html[data-theme="dark"] body main details[open].pay-uncleared { background: linear-gradient(180deg, rgba(180,35,24,.16), rgba(180,35,24,.08)) !important; border-color: rgba(255,123,110,.3) !important; }
html[data-theme="dark"] body .stat-ic, html[data-theme="dark"] body .feed-ic, html[data-theme="dark"] body .lead-contact { background: var(--brand-soft) !important; }
html[data-theme="dark"] body .btn.ghost:hover { background: var(--hover); }
html[data-theme="dark"] body .inv-filters select, html[data-theme="dark"] body #hq, html[data-theme="dark"] body .pay-search, html[data-theme="dark"] body .confirm-form input { background-color: var(--field) !important; color: var(--ink); }
html[data-theme="dark"] body .acard-logo, html[data-theme="dark"] body .inv-tile-logo .vlogo { background: #f4f5f4 !important; }

/* ---------- auth pages ---------- */
html body.auth { background: radial-gradient(1000px 600px at 50% -10%, rgba(0,166,81,.22), transparent 60%), #070807; }
html[data-theme="light"] body.auth { background: radial-gradient(1000px 600px at 50% -10%, rgba(0,166,81,.14), transparent 60%), #eef1ef; }
html body .auth-card { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-top: 0; border-radius: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.35); position: relative; overflow: hidden; }
html body .auth-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, #00A651, #D4A843); }
html body .auth-card input { background: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; }
html body .auth-card label { color: var(--ink-2); }
html body .auth-crest { height: 110px; filter: drop-shadow(0 8px 20px rgba(0,0,0,.35)); }
.auth-theme { position: fixed; top: 16px; right: 16px; z-index: 5; }

/* ---------- tablet: slimmer sidebar ---------- */
@media (max-width: 1180px) and (min-width: 901px) { :root, html[data-theme] { --side-w: 212px; } html body .brand .crest { height: 70px !important; } }

/* ---------- phone / small tablet: sidebar collapses to a compact top nav ---------- */
@media (max-width: 900px) {
  html body .site-header { position: sticky; top: 0; width: 100%; height: auto; flex-direction: column; overflow: visible; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.08); }
  html body .site-header .header-row { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px max(14px, env(safe-area-inset-left)) 8px; gap: 6px 10px; }
  html body .brand { flex-direction: row; text-align: left; padding: 0; border: 0; margin: 0; gap: 10px; flex: 1 1 auto; min-height: 44px; }
  html body .brand .crest { height: 40px !important; }
  html body .brand b { font-size: 14px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html body .brand span { min-width: 0; }
  .side-label, .side-foot { display: none; }
  html body .site-header .nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; width: 100%; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
  html body .site-header .nav::-webkit-scrollbar { display: none; }
  html body .site-header .nav-link { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.05); min-height: 40px; font-size: 13.5px !important; }
  html body .site-header .nav-link::before { display: none; }
  .shell { margin-left: 0; min-height: 0; }
  .topbar { position: static; }
  .topbar-row { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: nowrap; gap: 8px; }
  .topbar .wrap { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  html body .topbar .search { flex: 1 1 auto; }
  html body .topbar .search input { font-size: 16px; min-height: 44px; }
  html body .topbar .who { display: none; }
  .theme-btn { width: 44px; height: 44px; }
  html body main, html body main.wrap { padding: 18px 14px 40px; }
  html body .foot { padding-left: 14px; padding-right: 14px; }
  html body .card { padding: 18px 16px; }
}
@media (max-width: 420px) { html body .topbar .user .nav-link { padding: 8px 10px; font-size: 12px; } html body .brand small { display: none; } }
@media print { .site-header, .topbar, .theme-btn { display: none !important; } .shell { margin: 0 !important; } html body { background: #fff !important; color: #000; } }
@media (prefers-reduced-motion: reduce) { .theme-btn { transition: none; } }
html[data-theme="dark"] body .stat-body small, html[data-theme="dark"] body .stat-body .muted, html[data-theme="dark"] body .stat small, html[data-theme="dark"] body .pay-stat-s { color: var(--ink-3) !important; opacity: 1; }
@media (max-width: 480px) { html body .stat b, html body .pay-stat b { font-size: clamp(20px, 6.2vw, 28px); overflow-wrap: anywhere; } }

/* ===== HD + legibility pass (hx2) ===== */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-synthesis: none; }
body { font-size: 15px; font-weight: 400; }
html body .small, html body small { font-size: 13px; }
html body .tag, html body .pill, html body .pill-s { font-size: 11.5px; }
html body th { font-size: 11.5px; } html body .side-label { font-size: 11px; } html body .brand small { font-size: 11px !important; }
/* crest: HD master, sized by srcset, no blur */
html body .brand .crest, html body .auth-crest { image-rendering: auto; image-rendering: high-quality; -webkit-backface-visibility: hidden; transform: translateZ(0); }
html body .brand .crest { width: 63px !important; height: 84px !important; object-fit: contain; }
html body .auth-crest { width: 83px; height: 110px; object-fit: contain; }
@media (max-width: 1180px) and (min-width: 901px) { html body .brand .crest { width: 53px !important; height: 70px !important; } }
/* vendor logos: contain on a neutral light plate in both modes; initials fallback is always readable */
html body .vlogo { object-fit: contain; background: #fff !important; border: 1px solid rgba(0,0,0,.08); image-rendering: auto; }
html[data-theme="dark"] body .vlogo { background: #f5f6f5 !important; border-color: transparent; box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
html body .vbadge { font-weight: 800; letter-spacing: .02em; font-size: 13px; }
html[data-theme="light"] body .vbadge, html:not([data-theme="dark"]) body .vbadge { background: #e7f5ec; color: #00602f; border-color: #cfe8d8; }
html[data-theme="dark"] body .vbadge { background: #163323; color: #7fe3ac; border-color: #245a3b; }
/* AA contrast tokens */
:root, html[data-theme="light"] { --ink-2: #454c48; --ink-3: #59615c; --brand-dark: #006b35; --danger: #a8200f; --warn: #7a5c00; --ok: #22661a; }
html[data-theme="dark"] { --ink-2: #b9c2bc; --ink-3: #9da7a0; }
.side-label { color: #9aa39d; } .side-foot { color: #8b948e; }
html body .site-header .nav-link { color: #d5dbd7; }
html[data-theme="light"] body .tag, html:not([data-theme="dark"]) body .tag { background: #eceeed; color: #3f4642; }
html body .pill { background: #D4A843; color: #000; }
html body .label span { color: var(--brand-dark); }
html[data-theme="dark"] body .btn { background: #00A651; color: #021008; }
html[data-theme="light"] body .btn, html:not([data-theme="dark"]) body .btn { background: #006b35; }
html body .chart-svg text, html body .ch-lab, html body .ch-labs { fill: var(--ink-2); color: var(--ink-2); font-weight: 500; }
html[data-theme="dark"] body .stat-body small, html[data-theme="dark"] body .stat-body .muted, html[data-theme="dark"] body .stat small, html[data-theme="dark"] body .pay-stat-s { color: var(--ink-2) !important; }
/* phone header: company name beside the crest */
@media (max-width: 900px) {
  html body .site-header .brand > span { position: static; width: auto; height: auto; overflow: hidden; clip: auto; display: flex; flex-direction: column; min-width: 0; }
  html body .brand .crest { width: 32px !important; height: 42px !important; }
  html body .brand b { font-size: 15px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
  html body .brand small { display: block !important; font-size: 11px !important; }
}
/* AA fixes from contrast audit */
html[data-theme="dark"] body .sev-urgent { --sev: #ff8a7d; --sev-soft: rgba(180,35,24,.25); } html[data-theme="dark"] body .sev-action { --sev: #f0c75e; --sev-soft: rgba(212,168,67,.18); }
html[data-theme="dark"] body .sev-review { --sev: #5fd98f; --sev-soft: rgba(0,166,81,.18); } html[data-theme="dark"] body .sev-fyi { --sev: #c4ccc7; --sev-soft: #222a26; }
html body .chip.on { color: #fff; } html[data-theme="dark"] body .chip.on { color: #04100a; }
html body .chip.on:not([class*="sev-"]) { background: #121513; border-color: #121513; color: #fff; } html[data-theme="dark"] body .chip.on:not([class*="sev-"]) { background: #edf1ee; border-color: #edf1ee; color: #04100a; }
html body .chip.on .count { color: inherit; }
html body .btn.ghost, html body .btn.ghost.sm { color: var(--ink) !important; background: var(--card) !important; }
html body .btn.ghost.danger { color: var(--danger) !important; }
html body .avatar { background: #006b35; color: #fff; } html[data-theme="dark"] body .avatar { background: #00A651; color: #021008; }
html body .avatar.admin { background: #0a0a0a; color: #D4A843; }
html body .pill-s { background: #eceeed; color: #3f4642; } html[data-theme="dark"] body .pill-s { background: var(--chip); color: var(--ink-2); }
html body .uc-meta, html body .mono.small { color: var(--ink-2); }
html body .tag.warn { color: var(--warn); } html[data-theme="dark"] body .tag.warn { color: #f0c75e; }
html body .auth-foot { color: #a7b0aa; } html[data-theme="light"] body .auth-foot { color: #4d5550; }
html body .inv-tile-total { color: #6b5000; } html[data-theme="dark"] body .inv-tile-total { color: #e2bd62; }
html body .inv-tile-meta { color: var(--ink-2); }
html body .stat .approx { color: var(--ink-2); }
html body .an-tax { color: var(--ink-2); opacity: 1; } html[data-theme="dark"] body .an-tax .an-tag { background: var(--chip); border-color: #39413c; color: var(--ink-2); }
html body .lead-bubble.empty, html body .lead-bubble.empty small, html body .lead-bubble.empty b { color: var(--ink-2); opacity: 1; }
/* sidebar markers: CKI gold for every item, both modes; phone pills get a gold dot too */
html body .site-header .nav-link::before { background: #D4A843 !important; opacity: .9; }
html body .site-header .nav-link.active::before { opacity: 1; box-shadow: 0 0 8px #D4A843; }
@media (max-width: 900px) { html body .site-header .nav-link::before { display: inline-block !important; width: 6px; height: 6px; margin-right: 2px; } }
html body .chip.on:not([class*="sev-"]) { background: #121513 !important; color: #fff !important; } html[data-theme="dark"] body .chip.on:not([class*="sev-"]) { background: #edf1ee !important; color: #04100a !important; }
html body .chip.on[class*="sev-"] { background: var(--sev) !important; }
html body .ucard.dim { opacity: 1; border-style: dashed; } html body .ucard.dim .avatar { filter: grayscale(.6); background: #4d5550; color: #fff; }
html body tr.is-paid .tag, html body .is-paid .tag.warn { opacity: 1 !important; filter: none !important; }
html body .btn.sm { font-size: 13px; }
html body .an-tag { font-size: 11px; font-weight: 700; } html body .auth-foot, html body .pay-un-note { font-size: 13px; }
html body .topbar .user .nav-link { font-size: 13px !important; }
html[data-theme="dark"] body .vlogo { padding: 5px 8px !important; border-radius: 10px; box-sizing: content-box; }
html[data-theme="dark"] body .vt-stats > span { border-color: var(--line) !important; }
/* usernames: CKI green in day mode, CKI gold in night mode (AA) */
html body .topbar .who, html body .uc-id b, html body .uc-id .mono { color: #006b35 !important; }
html[data-theme="dark"] body .topbar .who, html[data-theme="dark"] body .uc-id b, html[data-theme="dark"] body .uc-id .mono { color: #D4A843 !important; }
html body th { color: var(--ink-2); }
html:not([data-theme="dark"]) body tr.unmatched .tag.warn { color: #5e4700 !important; background: #fff1c2 !important; }
/* phone: show signed-in name (row above search) */
@media (max-width: 900px) {
  html body .topbar-row { flex-wrap: wrap; }
  html body .topbar .user { order: -1; width: 100%; justify-content: space-between; gap: 8px; min-width: 0; }
  html body .topbar .user .who { display: inline-block !important; position: static; width: auto; height: auto; clip: auto; min-width: 0; max-width: calc(100% - 110px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; padding: 9px 14px; }
  html body .topbar .search { flex: 1 1 0; min-width: 0; }
  html body .topbar .theme-btn { margin-left: 0; }
}
/* ===== form fields: per-theme fields, focus, autofill (hx6) ===== */
html[data-theme="dark"] { color-scheme: dark; } html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
html[data-theme="dark"] body select, html[data-theme="dark"] body textarea,
html[data-theme="dark"] body input:focus, html[data-theme="dark"] body .auth-card input:focus, html[data-theme="dark"] body select:focus, html[data-theme="dark"] body textarea:focus {
  background-color: #0c0f0d !important; color: #edf1ee !important; border-color: #3a433e !important; caret-color: #D4A843; }
html[data-theme="dark"] body input::placeholder, html[data-theme="dark"] body textarea::placeholder { color: #9da7a0 !important; opacity: 1; }
html[data-theme="dark"] body select option { background: #111413; color: #edf1ee; }
html body input:focus, html body select:focus, html body textarea:focus { outline: none !important; border-color: #D4A843 !important; box-shadow: 0 0 0 3px rgba(212,168,67,.35) !important; }
html:not([data-theme="dark"]) body input:not([type="checkbox"]):not([type="radio"]), html:not([data-theme="dark"]) body select, html:not([data-theme="dark"]) body textarea { caret-color: #006b35; }
html:not([data-theme="dark"]) body input::placeholder { color: #59615c; opacity: 1; }
/* Chrome/Safari autofill paints its own background: cover it with an inset shadow */
html[data-theme="dark"] body input:-webkit-autofill, html[data-theme="dark"] body input:-webkit-autofill:hover, html[data-theme="dark"] body input:-webkit-autofill:focus, html[data-theme="dark"] body input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #0c0f0d inset !important; box-shadow: 0 0 0 1000px #0c0f0d inset !important; -webkit-text-fill-color: #edf1ee !important; caret-color: #D4A843; transition: background-color 9999s ease-out 0s; }
html[data-theme="dark"] body input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px #0c0f0d inset, 0 0 0 3px rgba(212,168,67,.35) !important; box-shadow: 0 0 0 1000px #0c0f0d inset, 0 0 0 3px rgba(212,168,67,.35) !important; }
html:not([data-theme="dark"]) body input:-webkit-autofill, html:not([data-theme="dark"]) body input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important; -webkit-text-fill-color: #121513 !important; transition: background-color 9999s ease-out 0s; }
html:not([data-theme="dark"]) body input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px #ffffff inset, 0 0 0 3px rgba(212,168,67,.35) !important; }
/* ===== Analytics on phones (hx7): stacked month cards; desktop unchanged ===== */
.an-mcards { display: none; }
@media (max-width: 900px) {
  html body .an-twrap { display: none; }
  .an-mcards { display: grid; gap: 14px; margin: 6px 0 4px; }
  .an-mcard { background: var(--card-2); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
  .an-mhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
  .an-mhead h3 { margin: 0; font-size: 17px; }
  .an-mnet { text-align: right; } .an-mnet span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
  .an-mnet b { font-family: var(--font-display); font-size: 22px; letter-spacing: -.01em; }
  .an-mbars { display: grid; gap: 6px; margin: 0 0 12px; }
  .an-mbars > div { display: flex; align-items: center; gap: 8px; } .an-mbars .an-bar { margin: 0; flex: 0 1 auto; min-width: 4px; height: 8px; max-width: calc(100% - 56px); }
  .an-mbars em { font-style: normal; font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
  .an-mrows { margin: 0; display: grid; gap: 0; }
  .an-mrows > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
  .an-mrows dt { color: var(--ink-2); min-width: 0; } .an-mrows dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
  .an-mrows .an-tax dt, .an-mrows .an-tax dd { color: var(--ink-2); font-weight: 500; }
  html body details.an-mbrk { margin: 8px 0 0; border: 0; background: transparent !important; box-shadow: none; }
  html body details.an-mbrk > summary { padding: 10px 0; font-weight: 700; font-size: 14px; color: var(--brand-dark); min-height: 44px; }
  html body details.an-mbrk .an-mrows > div { font-size: 13.5px; }
  html body .pay-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; }
  html body .pay-stat { padding: 16px 14px !important; } html body .pay-stat b { font-size: clamp(18px, 5.4vw, 24px) !important; overflow-wrap: anywhere; }
  html body .pay-bhead h2 { font-size: 18px; }
}
@media (max-width: 360px) { html body .pay-stats { grid-template-columns: 1fr !important; } }
html body table th { opacity: 1 !important; color: var(--ink-2) !important; }
@media (max-width: 900px) {
  html body .pay-stat b { overflow-wrap: normal !important; white-space: nowrap; }
  html body details.an-mbrk { border-left: 0 !important; padding: 0 !important; }
  html body details.an-mbrk > summary { padding-left: 0 !important; }
}
@media (max-width: 520px) { html body .pay-stats { grid-template-columns: 1fr !important; } html body .pay-stat b { font-size: 24px !important; } }
/* ===== phone tables as compact 2-line lists (hx9); desktop unchanged ===== */
@media (max-width: 900px) {
  html body table.mlist, html body table.mlist tbody, html body table.mlist tfoot { display: block; width: 100%; }
  html body table.mlist thead { display: none; }
  html body table.mlist tbody tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; row-gap: 2px; padding: 11px 2px; min-height: 56px; border-bottom: 1px solid var(--line); position: relative; }
  html body table.mlist tbody tr:last-child { border-bottom: 0; }
  html body table.mlist tbody tr::after { content: ''; order: 2; flex-basis: 100%; height: 0; }
  html body table.mlist tr:hover td { background: transparent; }
  html body table.mlist td, html body .pay-table.mlist td:nth-child(n) { display: block !important; padding: 0; border: 0; min-width: 0; text-align: left; white-space: nowrap; background: transparent; }
  html body .pay-table.mlist td.m-empty:nth-child(n) { display: none !important; }
  html body table.mlist td.m-title { order: 1; flex: 1 1 0; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: 15px; color: var(--ink); }
  html body table.mlist td.m-title .tag { font-size: 11px; padding: 1px 7px; margin-left: 4px; vertical-align: 1px; }
  html body table.mlist td.m-amt { order: 1; flex: 0 0 auto; text-align: right; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--ink); }
  html body table.mlist td.m-sub { order: 3; flex: 0 1 auto; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
  html body table.mlist td.m-sub:not(.m-first)::before { content: '\00B7\00A0'; white-space: pre; color: var(--ink-3); }
  html body table.mlist td[data-pre]::before { content: attr(data-pre); }
  html body table.mlist td.m-sub[data-pre]:not(.m-first)::before { content: '\00B7\00A0' attr(data-pre); }
  html body table.mlist td[data-suf]::after { content: attr(data-suf); }
  html body table.mlist td.m-sub .tag { font-size: 11px; padding: 0 6px; }
  html body table.mlist td.mono { font-family: var(--font-body); font-size: 13px; }
  /* ranked list (Top vendors): gold rank circle on the left spanning both lines */
  html body table.mlist-rank tbody tr { padding-left: 46px; }
  html body .pay-table.mlist-rank td.m-rank:nth-child(n) { position: absolute; left: 2px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; display: grid !important; place-items: center; padding: 0; font-size: 13px; font-weight: 800; background: rgba(212,168,67,.18); color: #6b5000; border: 1px solid rgba(212,168,67,.5); }
  html[data-theme="dark"] body table.mlist-rank td.m-rank { color: #e2bd62; }
  html body table.mlist-rank td.m-amt { order: 1; }
  html body table.mlist-rank tbody tr { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; }
  html body table.mlist-rank tbody tr::after { display: none; }
  html body table.mlist-rank td.m-title { grid-column: 1; grid-row: 1; }
  html body table.mlist-rank td.m-sub { grid-column: 1; grid-row: 2; }
  html body table.mlist-rank td.m-amt { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  /* tfoot totals: one clean line */
  html body table.mlist tfoot tr { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px 2px; border-top: 1px solid var(--line); }
  html body table.mlist tfoot td { display: block !important; padding: 0; border: 0; background: transparent !important; }
  html body table.mlist tfoot td:empty { display: none !important; }
  /* lists use the full card width: no inner scroll box / double padding */
  html body .pay-batch .tablewrap, html body .pay-row .lr-body .tablewrap, html body .pay-uncleared .tablewrap { border: 0; padding: 0; margin: 0; overflow: visible; }
  html body .pay-row .lr-body { padding-left: 0 !important; padding-right: 0 !important; }
}
@media (max-width: 900px) {
  html body table.mlist td.m-title .pay-un-note { display: inline; background: none !important; border: 0 !important; padding: 0; margin: 0 0 0 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2) !important; }
  html body table.mlist td.m-title .pay-un-note::before { content: '· '; }
  html body .pay-batch .tablewrap, html body .an-checks .tablewrap { border: 0 !important; box-shadow: none !important; border-radius: 0; }
}
@media (max-width: 900px) {
  html body table.pay-table.mlist { border: 0 !important; border-radius: 0; background: transparent !important; box-shadow: none !important; }
  html body table.mlist td.m-title .pay-un-note.m-moved { display: none !important; }
  html body table.mlist-rank td.m-title { white-space: normal; display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  html body table.mlist td.mono.m-sub:first-child:not([data-pre])::before { content: '#'; }
  html body table.mlist td.m-note { text-transform: capitalize; }
}
@media (max-width: 900px) { html body table.mlist tfoot td.m-empty { display: none !important; } }
@media (max-width: 900px) {
  html[data-theme="dark"] body .pay-table.mlist-rank td.m-rank:nth-child(n) { color: #e2bd62; background: rgba(212,168,67,.14); }
  html body .pay-table.mlist-rank td.m-title:nth-child(n) { white-space: normal; overflow: visible; }
  html body .pay-table.an-ct.mlist td[data-pre="Written "]:nth-child(n) { display: none !important; }
}
@media (max-width: 900px) { html body table.mlist:not(.mlist-rank) tbody tr { column-gap: 7px; } html body table.mlist td.m-amt { margin-left: 6px; } }
/* top-bar search: in-place filter (hx10) */
.q-hide { display: none !important; }
html body .topbar .search input { padding-right: 40px; }
html body .topbar .search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.q-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--chip); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; display: none; place-items: center; padding: 0; }
.search.has-q .q-clear { display: grid; }
.q-clear:hover { background: var(--brand-soft); color: var(--brand-dark); }
.q-empty { margin: 12px 0 18px; }
/* invoices tab: matching invoices from the top-bar search (hx11) */
.q-inv { margin: 0 0 18px; padding: 18px 20px; }
.q-inv-h { font-size: 17px; margin: 0 0 6px; display: flex; gap: 8px; align-items: baseline; }
.q-inv-list { display: grid; }
.q-inv-row { display: grid; gap: 2px; padding: 11px 4px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); min-width: 0; border-radius: 8px; }
.q-inv-row:hover { background: var(--hover); }
.q-l1 { display: flex; justify-content: space-between; gap: 12px; min-width: 0; font-size: 15px; }
.q-l1 > b:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-amt { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.q-l2 { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-flash { outline: 3px solid #D4A843 !important; outline-offset: 2px; transition: outline-color .4s; }
html[data-theme="dark"] body .pay-uncleared h2, html[data-theme="dark"] body .pay-uncleared .pay-total, html[data-theme="dark"] body .pay-uncleared summary { color: #ff9a8f !important; }
/* one search box: the top bar drives these lists' own search (hx13) */
#app #hq, #app #invq { display: none !important; }
/* bank clearing status tags (hx14) */
html body .tag.ck-cleared { background: #e3f4e8; color: #11592c; }
html body .tag.ck-uncleared { background: #fff1c2; color: #5e4700; }
html body .tag.ck-pending, html body .tag.ck-nodata { background: #eceeed; color: #3f4642; }
html body .tag.ck-void { background: #fde3e0; color: #8f1d12; text-decoration: line-through; text-decoration-thickness: 1px; }
html[data-theme="dark"] body .tag.ck-cleared { background: rgba(0,166,81,.18); color: #6fe0a0; }
html[data-theme="dark"] body .tag.ck-uncleared { background: rgba(212,168,67,.2); color: #f0c75e; }
html[data-theme="dark"] body .tag.ck-pending, html[data-theme="dark"] body .tag.ck-nodata { background: #222a26; color: #c4ccc7; }
html[data-theme="dark"] body .tag.ck-void { background: rgba(180,35,24,.25); color: #ff9a8f; }
.tag .ck-sub { font-weight: 600; opacity: .85; }
.pay-status { display: inline-flex; }
@media (max-width: 600px) { .pay-status .ck-sub { display: none; } }
/* other state tax payments note (hx15) */
.an-other-tax { margin: 14px 0 4px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; font-size: 13.5px; }
.an-other-tax ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.an-other-tax li { display: flex; justify-content: space-between; gap: 12px; }
.an-other-tax li span { min-width: 0; } .an-other-tax li b { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* analytics monthly breakdown (hx16) */
.an-bk-m { border: 1px solid var(--line) !important; border-radius: 14px !important; margin: 10px 0 0 !important; background: var(--card-2) !important; box-shadow: none !important; }
.an-bk-m > summary, .an-bk-g > summary { display: flex !important; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 14px !important; cursor: pointer; min-height: 48px; }
.an-bk-m > summary b:last-child, .an-bk-g > summary b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-bk-m > .an-bk-g { margin: 0 10px 8px !important; border: 1px solid var(--line) !important; border-radius: 12px !important; background: var(--card) !important; box-shadow: none !important; }
.an-bk-g > summary { font-size: 14.5px; font-weight: 700; }
.an-bk-g.bk-other > summary { color: var(--ink-2); }
.an-bk-list { list-style: none; margin: 0; padding: 0 14px 10px; }
.an-bk-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.an-bk-list .bk-l { min-width: 0; overflow-wrap: anywhere; } .an-bk-list small { display: block; color: var(--ink-2); font-size: 13px; }
.an-bk-list b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.an-bk-check { margin: 4px 14px 12px; font-size: 13px; font-weight: 700; } .an-bk-check.ok { color: var(--ok); } .an-bk-check.bad { color: var(--danger); }

.an-bk-m > summary > span:first-child, .an-bk-g > summary > span:first-child { flex: 1; text-align: left; min-width: 0; }
/* ---- performance (hx17): cheaper painting while scrolling ---- */
@media (max-width: 900px) {
  .topbar, html body .site-header { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .topbar { background: var(--bg) !important; }
  html body .card { box-shadow: 0 1px 2px rgba(0,0,0,.06) !important; }
}
/* Off-screen long-list items skip layout/paint until they scroll near (same look). */
.lead-list > .lead-row:not([open]), .an-bk-m:not([open]) { content-visibility: auto; contain-intrinsic-size: auto 120px; }
.an-bk-m:not([open]) { contain-intrinsic-size: auto 56px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.an-bk-list li.bk-sub { font-weight: 700; background: color-mix(in srgb, var(--ink) 4%, transparent); margin: 0 -14px; padding: 8px 14px; }
.an-bk-list .bk-nof { color: var(--ink-2); font-style: italic; font-weight: 400; }
