/* CaptrixOS polish layer. Loaded last. Quiet, ledger-like surfaces; the dashboard runway banner is the one bold element.
   User choices (Settings > Appearance) arrive as data attributes on <html>: data-density, data-radius, data-font, data-sidebar, data-card. */

:root {
  --r-s: 6px; --r-m: 10px; --r-l: 14px;
  --pad-card: 18px; --pad-cell-y: 9px; --row-h: 48px; --nav-y: 8px; --gap: 16px;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: var(--font-ui);
  --lift: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 14px rgba(15, 23, 42, .05);
  --ring: color-mix(in srgb, var(--brand) 45%, transparent);
  --side-bg: var(--surface); --side-ink: var(--body); --side-mute: var(--muted); --side-line: var(--line);
  --side-hover: var(--sub); --side-on-bg: var(--brand-soft); --side-on-ink: var(--brand);
}
html[data-theme="dark"] { --lift: 0 1px 0 rgba(255, 255, 255, .03); }

/* ---- Customization hooks ------------------------------------------------ */
html[data-density="compact"] { --pad-card: 12px; --pad-cell-y: 5px; --row-h: 36px; --nav-y: 5px; --gap: 10px; }
html[data-density="roomy"] { --pad-card: 24px; --pad-cell-y: 12px; --row-h: 58px; --nav-y: 10px; --gap: 22px; }
html[data-radius="sharp"] { --r-s: 3px; --r-m: 5px; --r-l: 7px; }
html[data-radius="round"] { --r-s: 10px; --r-m: 16px; --r-l: 22px; }
html[data-font="humanist"] { --font-ui: Seravek, "Gill Sans Nova", Calibri, "Trebuchet MS", ui-sans-serif, system-ui, sans-serif; }
html[data-font="rounded"] { --font-ui: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", Quicksand, "Segoe UI", system-ui, sans-serif; }
html[data-font="serif"] { --font-head: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
html[data-font="mono"] { --font-ui: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
html[data-card="flat"] { --lift: none; }
html[data-card="elevated"] .card, html[data-card="elevated"] .dcard, html[data-card="elevated"] .kcard { border-color: transparent; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .08); }
html[data-card="elevated"][data-theme="dark"] .card, html[data-card="elevated"][data-theme="dark"] .dcard, html[data-card="elevated"][data-theme="dark"] .kcard { box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }

html[data-sidebar="dark"] { --side-bg: #101a16; --side-ink: #c5d3cb; --side-mute: #7f948a; --side-line: #22312a; --side-hover: rgba(255, 255, 255, .06); --side-on-bg: rgba(255, 255, 255, .1); --side-on-ink: #ffffff; }
html[data-sidebar="accent"] { --side-bg: var(--brand); --side-ink: rgba(255, 255, 255, .88); --side-mute: rgba(255, 255, 255, .62); --side-line: rgba(255, 255, 255, .18); --side-hover: rgba(255, 255, 255, .12); --side-on-bg: rgba(255, 255, 255, .22); --side-on-ink: #ffffff; }
html[data-sidebar="accent"][data-theme="dark"] { --side-bg: color-mix(in srgb, var(--brand) 55%, #131110); }

/* ---- Type --------------------------------------------------------------- */
body { font-family: var(--font-ui); font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, .hd-big, .kbig { font-family: var(--font-head); }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.015em; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.005em; }
.dh h2, .card > h2 { font-size: 15px; }
:where(.num, .kbig, td, .hd-big) { font-variant-numeric: tabular-nums; }

/* Small caption labels: sentence case, quiet, no tracking */
.cap, .navgrp > div:first-child, .sg-h { text-transform: none !important; letter-spacing: 0 !important; font-size: 12px !important; font-weight: 500 !important; color: var(--muted); }
th { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; background: transparent; color: var(--muted); border-bottom: 1px solid var(--line); }
.hero-dark .cap { color: #f7c978; }

/* ---- Surfaces ----------------------------------------------------------- */
.main { background: var(--bg); }
.topbar { background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom: 1px solid var(--line); }
.card, .dcard, .kcard, .bcard { border-radius: var(--r-l); box-shadow: var(--lift); }
.card { padding: var(--pad-card); margin-bottom: var(--gap); }
.dcard { padding: var(--pad-card); }
.kcard, .bcard, .fcol { border-top-width: 1px; }
.kcard { padding: var(--pad-card); gap: 4px; }
.kcard .kbig { font-size: 26px; font-weight: 650; }
.kcard .cap { display: flex; align-items: center; gap: 6px; }
.kcard .cap::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--k, var(--brand)); flex: none; }
.fcol { border-radius: var(--r-m); }
.fcol .fn { display: none; }
.fcol .fc { font-size: 20px; }
.fcol::before { content: ""; width: 22px; height: 3px; border-radius: 2px; background: var(--c, var(--brand)); margin-bottom: 4px; }
.qcard, .urow, .wrow { border-radius: var(--r-m); }
.hero-dark { border-radius: var(--r-l); background: linear-gradient(120deg, #1d3a6b 0%, #14284B 55%, #0c1b35 100%); }
.gres, .dlg, .modal { border-radius: var(--r-l); }
.pill { border-radius: 999px; }
.avatar { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }

/* ---- Tables ------------------------------------------------------------- */
th, td { padding: var(--pad-cell-y) 12px; }
td { height: auto; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
tr.click td { height: var(--row-h); }
tr.click:hover, tr.click-row:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
tbody tr:last-child td { border-bottom: 0; }

/* ---- Controls ----------------------------------------------------------- */
button, .btn { border-radius: var(--r-s); }
input, select, textarea { border-radius: var(--r-s); background: var(--surface); }
select { padding-right: 28px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, .btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
input:hover:not(:focus):not([type=checkbox]):not([type=radio]), select:hover:not(:focus) { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.seg, .tabs { border-radius: var(--r-m); } .seg label, .tabs a { border-radius: var(--r-s); }
.chip { border-radius: 999px; }

/* Dashboard and other Tailwind-built panels follow the same scale */
.rounded-2xl { border-radius: var(--r-l); } .rounded-xl { border-radius: var(--r-m); } .rounded-lg { border-radius: var(--r-s); }
.font-label-caps { text-transform: none !important; letter-spacing: 0 !important; font-size: 12px; font-weight: 500 !important; }
.font-headline-md { font-size: 16px; line-height: 22px; font-weight: 600; font-family: var(--font-head); }
.p-space-lg { padding: var(--pad-card); }
.group > .absolute.top-0.h-1 { display: none; }
.shadow-sm { box-shadow: var(--lift); }
section.rounded-2xl.shadow-md { box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 25%, transparent); }

/* ---- Sidebar ------------------------------------------------------------ */
.rail { background: var(--side-bg); border-right-color: var(--side-line); }
.rail .nav { flex-wrap: nowrap; flex-direction: column; gap: 14px; }
.rail .navgrp { width: 100%; margin: 0; }
.rail .nav > * { margin-top: 0 !important; }
.rail .nv { padding-top: var(--nav-y); padding-bottom: var(--nav-y); border-radius: var(--r-s); color: var(--side-ink); }
.rail .nv .material-symbols-outlined { color: var(--side-mute); }
.rail .nv:hover { background: var(--side-hover); color: var(--side-on-ink); }
.rail .nv:hover .material-symbols-outlined { color: var(--side-on-ink); }
.nav a.on { background: var(--side-on-bg); color: var(--side-on-ink); box-shadow: none; }
.nav a.on .material-symbols-outlined { color: var(--side-on-ink); }
.nav a.on .nb { background: color-mix(in srgb, var(--side-on-ink) 16%, transparent); color: var(--side-on-ink); }
.rail .navgrp > div:first-child { color: var(--side-ink) !important; opacity: .85; font-size: 12.5px !important; font-weight: 700 !important; letter-spacing: .01em !important; padding-bottom: 2px; }
.rail .navgrp + .navgrp { border-top: 1px solid var(--side-line); padding-top: 12px; }
.rail .text-slate-900, .rail .text-slate-500, .rail .text-slate-400 { color: inherit; }
.rail .rail-top span.font-bold { color: var(--side-on-ink) !important; }
html[data-sidebar="dark"] .rail .bg-white, html[data-sidebar="accent"] .rail .bg-white { background: var(--side-hover); border-color: var(--side-line); }
html[data-sidebar="dark"] .rail .text-slate-500, html[data-sidebar="accent"] .rail .text-slate-500,
html[data-sidebar="dark"] .rail strong, html[data-sidebar="accent"] .rail strong { color: var(--side-ink) !important; }
.rail .newfile { background: var(--brand); background-image: none; border-radius: var(--r-s); box-shadow: none; }
.rail .newfile:hover { background: var(--brand-hover); }
html[data-sidebar="accent"] .rail .newfile { background: #fff; color: var(--brand); }
.rail-top > .vb-box { background: var(--brand); background-image: none; border-radius: var(--r-m); }
html[data-sidebar="accent"] .rail-top > .vb-box { background: rgba(255, 255, 255, .2); }
.rail .rail-top span.rounded-full { background: var(--side-hover); color: var(--side-ink); border-color: var(--side-line); }

/* ---- Simple menu: hidden nav items (set by appearance.js) ---------------- */

/* ---- Appearance page ---------------------------------------------------- */
.ap-sw { display: flex; flex-wrap: wrap; gap: 10px; }
.ap-sw button { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 2px solid transparent; background: var(--c); box-shadow: inset 0 0 0 2px var(--surface); }
.ap-sw button[aria-pressed="true"] { border-color: var(--ink); }
.ap-opt { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-opt button { background: var(--surface); color: var(--ink); border: 1px solid var(--line); padding: 7px 14px; font-weight: 500; }
.ap-opt button:hover:not(:disabled) { background: var(--sub); border-color: var(--line); }
.ap-opt button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.ap-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 20px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.ap-row:first-of-type { border-top: 0; }
.ap-row > b { font-weight: 600; font-size: 13px; padding-top: 6px; }
.ap-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 16px; }
.ap-menu label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 0; font-weight: 500; }
.ap-menu input { width: auto; height: auto; }
@media (max-width: 700px) { .ap-row { grid-template-columns: 1fr; } .ap-row > b { padding-top: 0; } }

/* ---- Assistant (the copilot drawer) ------------------------------------- */
#asstbtn, #reportbtn { background: transparent; border: 0; color: var(--muted); padding: 6px; border-radius: var(--r-s); display: grid; place-items: center; }
#asstbtn:hover:not(:disabled), #reportbtn:hover:not(:disabled) { background: var(--sub); color: var(--brand); border: 0; }
.as-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(450px, 100vw); z-index: 70; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -16px 0 40px rgba(15, 23, 42, .14); font-size: 13.5px; line-height: 20px; }
.as-panel[hidden] { display: none; }
.as-panel .material-symbols-outlined { font-size: 20px; line-height: 1; font-variation-settings: 'FILL' 0, 'wght' 400; }
.as-panel .as-fill { font-variation-settings: 'FILL' 1, 'wght' 400; }
.as-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; min-height: 76px; }
.as-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.as-logo { position: relative; width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; box-shadow: 0 1px 2px rgba(15,23,42,.18); }
.as-logo::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--good); border: 2px solid var(--surface); }
.as-title { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 16px; color: var(--ink); letter-spacing: -.01em; }
.as-tag { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: var(--brand-soft); color: var(--brand); padding: 1px 6px; border-radius: 5px; }
.as-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-sub b { color: var(--brand); font-weight: 600; }
.as-ctl { display: flex; gap: 2px; flex: none; }
.as-ib { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: transparent; border: 0; color: var(--muted); padding: 0; cursor: pointer; }
.as-ib:hover:not(:disabled) { background: var(--sub); color: var(--ink); border: 0; }
.as-chips { display: flex; gap: 6px; padding: 8px 14px; background: var(--sub); overflow-x: auto; scrollbar-width: none; flex: none; }
.as-chips::-webkit-scrollbar { display: none; }
.as-chip { flex: none; display: inline-flex; align-items: center; gap: 5px; background: var(--surface); color: var(--ink); border: 0; border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.08); cursor: pointer; white-space: nowrap; }
.as-chip:hover:not(:disabled) { background: var(--brand-soft); border: 0; }
.as-chip .material-symbols-outlined { font-size: 15px; color: var(--brand); }
.as-body { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 16px; background: color-mix(in srgb, var(--sub) 55%, var(--surface)); }
.as-urow { align-self: flex-end; max-width: 86%; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.as-u { background: var(--brand); color: var(--brand-ink); padding: 9px 14px; border-radius: 18px 18px 4px 18px; white-space: pre-wrap; box-shadow: 0 1px 2px rgba(15,23,42,.12); }
.as-meta { font-size: 11px; color: var(--muted); padding: 0 4px; }
.as-brow { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; max-width: 100%; }
.as-who { display: flex; align-items: center; gap: 7px; padding-left: 2px; }
.as-av { width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.as-av .material-symbols-outlined { font-size: 12px; }
.as-who b { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink); }
.as-who span { font-size: 11px; color: var(--muted); }
.as-b { background: var(--surface); color: var(--ink); padding: 11px 14px; border-radius: 4px 18px 18px 18px; box-shadow: 0 1px 2px rgba(15,23,42,.08); max-width: 100%; overflow-wrap: anywhere; }
.as-b p { margin: 0 0 .55em; } .as-b p:last-child { margin-bottom: 0; }
.as-b ul { margin: .35em 0 .6em; padding: 0; list-style: none; } .as-b li { position: relative; padding-left: 16px; margin: .3em 0; } .as-b li::before { content: ''; position: absolute; left: 3px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.as-b b { font-weight: 650; } .as-b code { background: var(--sub); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, 'JetBrains Mono', monospace; font-size: 12px; }
.as-b.live::after { content: ''; display: inline-block; width: 7px; height: 14px; margin-left: 2px; vertical-align: -2px; background: var(--brand); border-radius: 1px; animation: as-blink 1s steps(2) infinite; }
.as-typing { display: flex; align-items: center; gap: 9px; background: var(--surface); padding: 12px 14px; border-radius: 4px 18px 18px 18px; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.as-dots { display: inline-flex; gap: 4px; } .as-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); opacity: .35; animation: as-bounce 1.2s infinite ease-in-out; } .as-dots i:nth-child(2) { animation-delay: .16s; } .as-dots i:nth-child(3) { animation-delay: .32s; }
.as-step { font-size: 12px; color: var(--muted); }
.as-e { background: var(--bad-soft); color: var(--bad); padding: 9px 13px; border-radius: 12px; }
.as-card { display: block; border: 0; border-left: 3px solid var(--line); border-radius: 12px; padding: 11px 13px; background: var(--surface); box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.as-card ul { margin: .3em 0 .6em 1.1em; padding: 0; list-style: disc; }
.as-card.open { border-left-color: var(--brand); } .as-card.no { opacity: .6; } .as-card.done { background: var(--brand-soft); border-left-color: var(--good); }
.as-hi { padding: 4px 2px 8px; } .as-hi h3 { font-size: 18px; margin: 0 0 4px; letter-spacing: -.015em; }
.as-acts { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.as-act { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; width: 100%; background: var(--surface); color: var(--ink); border: 0; border-radius: 12px; padding: 10px 12px; font-weight: 500; font-size: 13px; box-shadow: 0 1px 2px rgba(15,23,42,.08); cursor: pointer; }
.as-act:hover:not(:disabled) { background: var(--brand-soft); border: 0; }
.as-act span.l { display: flex; align-items: center; gap: 9px; } .as-act .material-symbols-outlined { color: var(--brand); font-size: 18px; }
.as-comp { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 7px; flex: none; }
.as-ctxrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }
.as-ctx { display: inline-flex; align-items: center; gap: 6px; min-width: 0; background: var(--sub); padding: 3px 8px; border-radius: 7px; color: var(--ink); }
.as-ctx i { width: 6px; height: 6px; border-radius: 50%; background: var(--good); animation: as-pulse 1.8s infinite; flex: none; }
.as-ctx strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-ctx button { background: none; border: 0; padding: 0; color: var(--muted); display: grid; place-items: center; cursor: pointer; } .as-ctx button .material-symbols-outlined { font-size: 14px; }
.as-form { background: var(--sub); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; border: 1px solid transparent; }
.as-form:focus-within { border-color: var(--brand); background: var(--surface); }
.as-form textarea, .as-form textarea:focus, .as-form textarea:hover { width: 100%; background: transparent !important; border: 0 !important; outline: 0 !important; box-shadow: none !important; resize: none; padding: 6px 8px; min-height: 44px; height: auto; font: inherit; color: var(--ink); }
.as-form .as-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 2px 8px; font-size: 11px; color: var(--muted); }
.as-send { height: 32px; padding: 0 12px 0 14px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); border: 0; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.as-send:hover:not(:disabled) { filter: brightness(1.12); border: 0; } .as-send:disabled { opacity: .5; cursor: default; } .as-send .material-symbols-outlined { font-size: 17px; }
.as-foot { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 0 4px; margin-top: 2px; } .as-foot span { display: inline-flex; align-items: center; gap: 4px; } .as-foot .material-symbols-outlined { font-size: 13px; color: var(--brand); }
.as-tools { display: inline-flex; gap: 2px; } .as-tb { width: 30px; height: 30px; border-radius: 8px; background: transparent; border: 0; color: var(--muted); display: grid; place-items: center; padding: 0; cursor: pointer; }
.as-tb:hover:not(:disabled) { background: var(--surface); color: var(--ink); border: 0; } .as-tb .material-symbols-outlined { font-size: 19px; }
.as-tb.on { background: var(--bad-soft); color: var(--bad); animation: as-pulse 1.1s infinite; }
.as-att { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 6px 0; } .as-att:empty { display: none; }
.as-file { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px 4px 3px 7px; font-size: 12px; } .as-file > span:not(.material-symbols-outlined) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.as-file .material-symbols-outlined { font-size: 15px; color: var(--brand); } .as-file button { background: none; border: 0; padding: 0; color: var(--muted); display: grid; place-items: center; cursor: pointer; } .as-file button .material-symbols-outlined { color: inherit; font-size: 14px; }
.as-fl { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; } .as-fl span { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,.16); border-radius: 7px; padding: 2px 7px; font-size: 12px; } .as-fl .material-symbols-outlined { font-size: 14px; }
.as-picker { margin: 0 14px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 24px rgba(15,23,42,.12); padding: 6px; } .as-picker[hidden] { display: none; }
.as-picker input { width: 100%; height: 34px; margin-bottom: 4px; }
.as-plist { display: flex; flex-direction: column; max-height: 220px; overflow-y: auto; } .as-plist button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; background: none; border: 0; border-radius: 8px; padding: 6px 8px; cursor: pointer; color: var(--ink); } .as-plist button:hover { background: var(--brand-soft); border: 0; } .as-plist button span { font-size: 11.5px; color: var(--muted); }
@keyframes as-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes as-blink { 50% { opacity: 0; } }
@keyframes as-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes as-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.as-urow, .as-brow, .as-card { animation: as-in .22s ease-out; }
@media (min-width: 1100px) { html.as-open .main { margin-right: 450px; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Rows: tw.css ships a Tailwind ".inline{display:inline}" that beat the app's own flex row. Restore it. */
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > input, .inline > select { width: auto; flex: 1 1 140px; }
.inline > select[style*="width:auto"] { flex: 0 0 auto; }

/* Pick lists: one result per row, action on the right */
.picklist { display: flex; flex-direction: column; margin: 8px 0; border: 1px solid var(--line, rgba(127,127,127,.25)); border-radius: var(--r-m, 10px); overflow: hidden; }
.picklist .pick { background: none; border-width: 0; border-radius: 0; box-shadow: none; display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 0; }
.picklist .pick + .pick { border-top: 1px solid var(--line, rgba(127,127,127,.2)); }
.picklist .pick:hover { background: rgba(127,127,127,.06); }
.picklist .pick .main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.picklist .pick .main b { font-variant-numeric: tabular-nums; font-size: 15px; }
.picklist .pick .main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picklist .pick button { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 520px) { .picklist .pick { flex-wrap: wrap; } .picklist .pick button { width: 100%; } }

/* Two-factor and idle sign-out */
.mfa-ov { position: fixed; inset: 0; z-index: 1000; background: rgba(15,20,18,.55); display: grid; place-items: center; padding: 16px; overflow: auto; }
.mfa-ov.solid { background: var(--bg, #f9fafb); }
.mfa-box { width: 100%; max-width: 460px; max-height: 94vh; overflow: auto; }
.mfa-qr { width: 200px; max-width: 100%; margin: 10px 0; background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--line, #e5e7eb); }
.mfa-qr svg { width: 100%; height: auto; display: block; }
.mfa-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.mfa-codes code { background: var(--soft, #f3f4f6); border-radius: 8px; padding: 10px 12px; text-align: center; letter-spacing: .08em; font-size: 15px; user-select: all; }
.idle-warn { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1001; background: var(--card, #fff); border: 1px solid var(--line2, #d1d5db); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 14px 18px; display: flex; gap: 16px; align-items: center; max-width: calc(100vw - 32px); }
.idle-warn p { margin: 0; }


/* Settings: same look as the rest of the app (panels, icon menu, soft inputs) */
.setgrid { grid-template-columns: 248px minmax(0, 1fr); gap: 20px; margin-top: 16px; }
.sgpanel { background: rgb(var(--c-surface-container-lowest)); border-radius: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05); padding: 10px 8px !important; border: 0 !important; width: auto !important; }
.sgpanel .sg-h { padding: 14px 12px 4px !important; font-size: 12px !important; font-weight: 600 !important; color: rgb(var(--c-on-surface-variant)) !important; opacity: .85; }
.sgpanel .sg-h:first-child { padding-top: 6px !important; }
.sgpanel a { display: flex !important; align-items: center; gap: 10px; padding: 8px 12px !important; margin: 1px 0; border-radius: 10px !important; font-size: 14px; font-weight: 500; color: rgb(var(--c-on-surface)); text-decoration: none; }
.sgpanel a .material-symbols-outlined { font-size: 19px; color: rgb(var(--c-on-surface-variant)); }
.sgpanel a:hover { background: rgb(var(--c-surface-container-low)); }
.sgpanel a.on { background: rgb(var(--c-primary-fixed)); color: rgb(var(--c-primary)); font-weight: 600; box-shadow: none; }
.sgpanel a.on .material-symbols-outlined { color: rgb(var(--c-primary)); }
#sp > .card, #sp > div > .card { background: rgb(var(--c-surface-container-lowest)); border: 0; border-radius: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05); padding: 24px; margin-bottom: 16px; }
#sp .card .card { background: rgb(var(--c-surface-container-low)); border: 0; box-shadow: none; border-radius: 12px; padding: 16px; }
#sp .card > h2:first-child, #sp h2 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 6px; }
#sp h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
#sp .card > .small.muted:first-of-type, #sp h2 + .small.muted, #sp h3 + .small.muted { max-width: 70ch; margin-bottom: 14px; }
#sp label { font-size: 13px; font-weight: 600; color: rgb(var(--c-on-surface)); margin-bottom: 4px; display: block; }
#sp label.check, #sp label.inline { font-weight: 500; display: flex; }
#sp input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]), #sp select, #sp textarea { height: 40px; background: rgb(var(--c-surface-container-low)); border: 1px solid transparent; border-radius: 12px; padding: 8px 12px; color: rgb(var(--c-on-surface)); }
#sp textarea { height: auto; min-height: 88px; }
#sp input:not([type=checkbox]):not([type=radio]):hover, #sp select:hover, #sp textarea:hover { border-color: rgb(var(--c-outline-variant)); }
#sp input:not([type=checkbox]):not([type=radio]):focus, #sp select:focus, #sp textarea:focus { background: rgb(var(--c-surface-container-lowest)); border-color: rgb(var(--c-primary)); outline: 3px solid rgb(var(--c-primary) / .18); outline-offset: 0; }
#sp button:not(.ghost):not(.secondary):not(.small) { border-radius: 12px; padding: 9px 18px; box-shadow: 0 1px 2px rgba(15,23,42,.12); }
#sp button.secondary { border-radius: 12px; background: rgb(var(--c-surface-container-lowest)); border: 1px solid rgb(var(--c-outline-variant)); color: rgb(var(--c-on-surface)); }
#sp button.secondary:hover:not(:disabled) { background: rgb(var(--c-surface-container-low)); }
#sp button.small { border-radius: 10px; }
#sp .tablewrap { border: 1px solid rgb(var(--c-outline-variant)); border-radius: 12px; overflow: auto; }
#sp .tablewrap table { margin: 0; }
#sp th { background: rgb(var(--c-surface-container-low)); color: rgb(var(--c-on-surface-variant)); font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; padding: 10px 14px; }
#sp td { padding: 10px 14px; border-top: 1px solid rgb(var(--c-outline-variant)); }
#sp tbody tr:hover td { background: rgb(var(--c-surface-container-low) / .6); }
#sp .cv-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; background: rgb(var(--c-surface-container-low)); border-radius: 12px; border: 0; margin-bottom: 16px !important; max-width: 100%; }
#sp .cv-tabs a { padding: 7px 14px; border-radius: 9px; border: 0; color: rgb(var(--c-on-surface-variant)); font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; margin: 0; }
#sp .cv-tabs a:hover { color: rgb(var(--c-on-surface)); }
#sp .cv-tabs a.on { background: rgb(var(--c-surface-container-lowest)); color: rgb(var(--c-primary)); font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.12); }
#sp .notice { border-radius: 12px; }
#sp .kv { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 8px 16px; padding: 12px 14px; background: rgb(var(--c-surface-container-low)); border-radius: 12px; margin: 8px 0 12px; }
#sp .kv > span:nth-child(odd) { color: rgb(var(--c-on-surface-variant)); }
@media (max-width: 760px) {
  .setgrid { grid-template-columns: 1fr; gap: 12px; }
  .sgpanel { display: flex !important; flex-wrap: nowrap; overflow-x: auto; padding: 6px !important; position: static !important; max-height: none !important; }
  .sgpanel .sg-h { display: none !important; }
  .sgpanel a { white-space: nowrap; flex: 0 0 auto; }
  #sp > .card, #sp > div > .card { padding: 16px; }
}

/* Bell drop-down and dashboard header */
#bellmenu { position: absolute; right: -6px; top: calc(100% + 8px); width: 320px; max-width: 92vw; max-height: 70vh; overflow: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 12px 32px rgba(15,23,42,.14); padding: 6px; z-index: 60; }
html[data-theme="dark"] #bellmenu { background: #1e1c1b; border-color: #373534; }
#bellmenu .bm-h { display: flex; justify-content: space-between; padding: 10px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
#bellmenu .bm-h i { font-style: normal; background: #f1f5f9; color: #334155; border-radius: 999px; padding: 0 7px; }
#bellmenu .bm-row { display: block; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: inherit; }
#bellmenu .bm-row:hover, #bellmenu .bm-all:hover, #bellmenu .bm-more:hover { background: rgba(100,116,139,.12); }
#bellmenu .bm-row b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bellmenu .bm-row span { display: block; font-size: 12px; color: #64748b; } #bellmenu .bm-row span.hot { color: #dc2626; font-weight: 600; }
#bellmenu .bm-more { display: block; padding: 4px 10px 6px; font-size: 12px; color: #64748b; text-decoration: none; border-radius: 8px; }
#bellmenu .bm-empty { margin: 0; padding: 18px 12px; text-align: center; color: #64748b; font-size: 13px; }
#bellmenu .bm-all { display: block; margin-top: 4px; padding: 10px; text-align: center; font-size: 13px; font-weight: 600; border-top: 1px solid rgba(100,116,139,.2); text-decoration: none; color: inherit; border-radius: 0 0 10px 10px; }
.pagehead .actions { flex-wrap: nowrap; align-items: center; }
.pagehead .actions select { width: auto; min-width: 150px; }
.pagehead:has(#rg) { min-height: 84px; }

/* "Zero upfront fees" note in the sidebar: readable in both themes, and not picked up by text selection colors */
.rail .zerofee { background: #e8f6ef; border: 1px solid #b6e3cf; color: #0b5d43; }
.rail .zerofee b { color: #0b4f3a !important; font-weight: 700; }
.rail .zerofee small { color: #2f6b57 !important; }
.rail .zerofee .material-symbols-outlined { color: #0f8a62; }
html[data-theme="dark"] .rail .zerofee, html[data-sidebar="dark"] .rail .zerofee { background: #12362c; border-color: #25604c; color: #9ae8c6; }
html[data-theme="dark"] .rail .zerofee b, html[data-sidebar="dark"] .rail .zerofee b { color: #e8fff4 !important; }
html[data-theme="dark"] .rail .zerofee small, html[data-sidebar="dark"] .rail .zerofee small { color: #a9dcc6 !important; }
html[data-theme="dark"] .rail .zerofee .material-symbols-outlined, html[data-sidebar="dark"] .rail .zerofee .material-symbols-outlined { color: #7fe0b7; }
.rail .zerofee ::selection { background: #0f8a62; color: #fff; }

/* Table pager: one line, filled buttons, readable in both themes */
.pgr label { white-space: nowrap; flex-wrap: nowrap; }
.pgr select { height: 32px; min-width: 64px; padding: 0 28px 0 10px !important; background-color: var(--surface) !important; border: 1px solid var(--line) !important; color: var(--ink); border-radius: 8px; font-size: 13px; }
.pgr button { border: 1px solid transparent !important; background: var(--sub) !important; color: var(--ink) !important; box-shadow: none; }
.pgr button:hover:not(:disabled) { background: var(--line) !important; }
.pgr button:disabled { opacity: .45; cursor: default; }
.pgr button.bg-primary { background: var(--brand) !important; color: #fff !important; }
html[data-theme="dark"] .pgr button { background: #2c2a29 !important; }
html[data-theme="dark"] .pgr button.bg-primary { background: #b6b4b3 !important; color: #151312 !important; }
.flex-wrap > .rounded-full { max-width: 100%; white-space: normal; } .grid > * { min-width: 0; }
html:not([data-theme="dark"]) span.text-outline-variant { color: #a8a29e; } html:not([data-theme="dark"]) .material-symbols-outlined.absolute.left-3 { color: #64748b; }

/* Role box = workspace switcher */
#wsbox{display:none!important}
.rolebtn:not(:disabled):hover{filter:none;border-color:var(--brand)}
.rolebtn:disabled{opacity:1}
#rolemenu .rolerow{background:transparent;color:var(--ink);border:0;cursor:pointer;text-decoration:none}
#rolemenu .rolerow:hover{background:var(--sub);filter:none}
#rolemenu .rolerow[aria-selected="true"]{color:var(--brand)}

/* Sidebar: second quick-add */
.rail .newcontact{background:transparent;border:1px solid var(--line,var(--border,#d9d6d0));color:var(--ink);text-decoration:none}
.rail .newcontact:hover{background:var(--sub);filter:none}
.rail-wait #newcontact,.is-affiliate #newcontact{visibility:hidden}
.is-affiliate #newcontact{display:none!important}

/* Page-switch strip (Pipeline / Deals, Invoices / Commissions) */
.subtab{padding:6px 14px;border-radius:999px;font-size:13px;font-weight:500;color:var(--muted);background:var(--sub);text-decoration:none;border:1px solid transparent}
.subtab:hover{color:var(--ink)}
.subtab.on{background:var(--brand);color:var(--brand-ink);font-weight:600}

/* Reserve the scrollbar space so content does not shift sideways when a page grows past the screen. */
html { scrollbar-gutter: stable; }

@keyframes flashring { 0% { box-shadow: 0 0 0 0 rgba(236,78,10,.55); } 100% { box-shadow: 0 0 0 14px rgba(236,78,10,0); } }
.flash { animation: flashring 1.1s ease-out 2; }

/* sidebar: group headlines in the brand color, every label starts each word with a capital */
.rail .navgrp > div:first-child { color: #c2570c !important; opacity: 1; font-weight: 700 !important; font-size: 12.5px !important; letter-spacing: .02em !important; }
html[data-sidebar="dark"] .rail .navgrp > div:first-child, html[data-sidebar="accent"] .rail .navgrp > div:first-child { color: var(--side-on-ink) !important; }
.rail .nl, .rail .navgrp > div:first-child { text-transform: capitalize; }
