/* CaptrixOS shell: sidebar + top bar, slate and emerald (Institutional Platform look). Loaded after app.css. */
:root {
  --bg: #f8fafc; --surface: #ffffff; --sub: #f1f5f9; --ink: #0f172a; --muted: #64748b; --body: #475569; --line: #e2e8f0;
  --brand: #14284B; --brand-hover: #0c1b35; --brand-ink: #ffffff; --brand-soft: #e8edf6;
  --warn: #92400e; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2; --good: #15803d; --good-soft: #dcfce7;
  --blue: #1d4ed8; --blue-soft: #eff6ff; --purple: #6d28d9; --purple-soft: #f5f3ff;
  --radius: 12px; --shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --rail: 264px;
}
html[data-theme="dark"] { --bg: #0b1220; --surface: #111a2b; --sub: #17223a; --ink: #e8edf6; --muted: #94a3b8; --body: #b6c2d4; --line: #223049;
    --brand: #8fb0f2; --brand-hover: #b4cbf7; --brand-ink: #0b1a33; --brand-soft: #14223d; --warn: #f4b860; --warn-soft: #33260c;
    --bad: #fb8a8a; --bad-soft: #3b1518; --good: #4ade80; --good-soft: #0f2b1a; --blue: #7aa7ff; --blue-soft: #14233f; --purple: #b7a1ff; --purple-soft: #231a40; --shadow: none; }
body { font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); -webkit-font-smoothing: antialiased; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; } h2 { font-size: 17px; font-weight: 600; } h3 { font-size: 15px; font-weight: 600; }
.mono, code, kbd { font-family: "JetBrains Mono", ui-monospace, monospace; }

.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: rgba(255,255,255,.92); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 14px; z-index: 40; }
.nav a.on { background: #eef2f9; color: #14284B; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(185,199,227,.9); }
.nav a.on .material-symbols-outlined { color: #14284B; font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.nav a.on .nb { background: #d1fae5; color: #065f46; }
.nb.hot { background: #fef3c7 !important; color: #92400e !important; border-radius: 999px; }
.rail-foot { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.rail-scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; position: relative; background: radial-gradient(900px 380px at 12% -40px, rgba(16,185,129,.10), transparent 70%), radial-gradient(800px 320px at 85% -60px, rgba(59,130,246,.08), transparent 70%), #f8fafc; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 24px; background: rgba(255,255,255,.72); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(226,232,240,.8); }
.burger { display: none; }
.gres { position: absolute; left: 0; right: 0; top: 44px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .16); max-height: 360px; overflow: auto; padding: 6px; z-index: 50; }
.gres a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.gres a:hover, .gres a.act { background: #ecfdf5; } .gres small { color: var(--muted); }
.rev.hidden, #compchip.hidden { display: none !important; } .rev:not(.hidden) { display: flex; }
.wrap.wide { max-width: 1320px; width: 100%; padding: 24px 24px 72px; margin: 0; }

/* Before sign-in: no rail, no top bar */
.shell:has(#nav.hidden) { grid-template-columns: 1fr; }
.shell:has(#nav.hidden) .rail, .shell:has(#nav.hidden) .topbar { display: none; }
.shell:has(#nav.hidden) .wrap.wide { margin: 0 auto; max-width: 560px; }

/* Components */
.card { border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
button, .btn { border-radius: 6px; padding: 8px 16px; font-weight: 600; font-size: 14px; line-height: 20px; transition: background .12s, border-color .12s; }
button:hover:not(:disabled), .btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
button.secondary, .btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
button.secondary:hover:not(:disabled), .btn.secondary:hover { background: var(--sub); border-color: var(--line); color: var(--ink); }
button.ghost:hover:not(:disabled) { background: var(--sub); border-color: transparent; color: var(--ink); }
button.small, .btn.small { padding: 4px 10px; font-size: 13px; }
input, select, textarea { height: 36px; padding: 6px 12px; border-radius: 6px; font-size: 14px; }
textarea { height: auto; min-height: 88px; }
input[type=checkbox], input[type=radio] { height: auto; }
label { font-size: 13px; font-weight: 600; color: var(--body); }
table { font-variant-numeric: tabular-nums; }
th { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--sub); }
th, td { padding: 8px 12px; } td { height: 40px; }
tr.click:hover, tr.click-row:hover { background: var(--brand-soft); }
.pill { padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--sub); color: var(--body); }
.pill.good, .pill.ok { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.muted { background: var(--sub); color: var(--muted); }
.pill.trk-A { background: var(--brand-soft); color: var(--brand); } .pill.trk-B { background: var(--blue-soft); color: var(--blue); }
.pill.trk-EQ { background: var(--purple-soft); color: var(--purple); } .pill.trk-SBA { background: var(--warn-soft); color: var(--warn); }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead h1 { margin: 0; }
.tile { background: var(--surface); border-radius: var(--radius); }
.tile .tv { font-variant-numeric: tabular-nums; }
.notice { border-radius: 8px; border-left: 4px solid var(--brand); }
.notice.warn { border-left-color: var(--warn); } .notice.bad { border-left-color: var(--bad); }
.warnbox { border-left: 4px solid var(--warn); border-radius: 8px; }
.meter > span { background: var(--brand); } .meter > span.bad { background: var(--bad); } .meter > span.warn { background: #d97706; }
a { color: var(--brand); }

/* Pipeline board */
.board { grid-auto-columns: minmax(250px, 1fr); gap: 14px; padding-bottom: 12px; }
.board .col { background: var(--sub); border: 0; border-radius: var(--radius); padding: 10px; }
.board .col h3 { display: flex; align-items: center; gap: 8px; font-size: 13px; text-transform: none; letter-spacing: 0; margin: 2px 4px 10px; }
.board .col h3 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, #94a3b8); }
.board .col h3 .muted { margin-left: auto; background: var(--surface); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.board .col h3 .est { font-size: 11px; font-weight: 500; color: var(--muted); }
.pcard { gap: 6px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.pcard:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.pcard .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard .top b { font-weight: 600; }
.pcard .pill { align-self: auto; }
.pcard .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sla .dot-p { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .sla .dot-p { animation: none; } }
.stepper { border-radius: var(--radius); }

/* Mobile */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 40px rgba(15, 23, 42, .25); }
  body.rail-open .rail { transform: none; }
  body.rail-open .rail-scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; }
  .burger { display: inline-block; } .topbar { padding: 0 12px; gap: 8px; } .gsearch kbd { display: none; }
  .rev .small, .rev .meter { display: none; } .who { display: none; }
  .wrap.wide { padding: 16px 12px 64px; }
}
@media print { .shell { display: block; } .rail, .topbar { display: none; } }
td input[type=checkbox], td input[type=radio] { width: auto; }
td:first-child:has(> input[type=checkbox]) { width: 36px; }
@media (max-width: 900px) { main#view .card { overflow-x: auto; } td { overflow-wrap: anywhere; } }

/* Dashboard command center */
.cap { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cmd { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.hero-dark { position: relative; border-radius: 16px; padding: 24px 28px; color: #e8f5ee; background: linear-gradient(135deg, #04281c 0%, #0a3a2c 55%, #0f2a3a 100%); display: grid; grid-template-columns: 1fr auto; gap: 14px 24px; }
.hero-dark .cap { color: #86d6b4; }
.hd-big { font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; } .hd-big span { font-size: 18px; font-weight: 500; color: #9fb7ad; letter-spacing: 0; }
.hd-chip { display: inline-block; padding: 5px 12px; border-radius: 8px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); font-size: 13px; margin: 6px 6px 0 0; }
.hd-r { display: flex; flex-direction: column; align-items: flex-end; } .hd-bar { grid-column: 1 / -1; display: flex; height: 10px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; }
.hd-bar i.c { background: #34d399; } .hd-bar i.p { background: #60a5fa; }
.hd-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: #c7d8d0; } .hd-foot .pace { margin-left: auto; color: #86efac; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; } .dot.c { background: #34d399; } .dot.p { background: #60a5fa; }
.kcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--k, var(--brand)); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.kcard .kbig { font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.k-green { --k: #0f6b4f; } .k-blue { --k: #2563eb; } .k-red { --k: #dc2626; } .k-purple { --k: #7c3aed; }
.dcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.dh { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; } .dh h2 { margin: 0; font-size: 16px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.qcard, .urow, .wrow { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; margin-bottom: 0; }
.qcard.crit { border-color: var(--bad); background: var(--bad-soft); } .qcard:hover, .urow:hover, .wrow:hover { border-color: var(--brand); }
.qcard .top, .urow .top, .wrow .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .top .amt { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.slabar { padding: 6px 10px; border-radius: 8px; background: var(--good-soft); color: var(--good); font-weight: 600; font-family: "JetBrains Mono", monospace; font-size: 12px; } .slabar.crit { background: var(--bad); color: #fff; }
.qcard .btn { text-align: center; }
.urow, .wrow { margin-bottom: 10px; }
.funnel { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(104px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.fcol { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 10px; color: var(--ink); text-decoration: none; }
.fcol .fn { font: 500 11px "JetBrains Mono", monospace; color: var(--muted); } .fcol .fc { font-size: 22px; font-weight: 600; }
@media (max-width: 900px) { .hero-dark { grid-template-columns: 1fr; padding: 18px; } .hd-r { align-items: flex-start; } .hd-big { font-size: 34px; } }

/* Contacts */
.cap + h1 { margin-top: 2px; } .pagehead h1 .pill { vertical-align: middle; margin-left: 6px; }
.seg { background: var(--sub); border: 0; border-radius: 8px; padding: 3px; }
.seg label { border-radius: 6px; padding: 6px 12px; font-size: 13px; }
.seg label.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.seg .cnt { margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 11px; }
.chip { font-size: 12px; padding: 4px 10px; background: var(--sub); border-color: transparent; } .chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.who-cell { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; color: #fff; background: #14284B; }
.avatar.a1 { background: #2563eb; } .avatar.a2 { background: #7c3aed; } .avatar.a3 { background: #d97706; } .avatar.a4 { background: #475569; }
tr.click td { height: 56px; }
td .mono, td:nth-child(2), td:nth-child(3) { font-variant-numeric: tabular-nums; }
#list td, #list th { white-space: nowrap; } #list td:nth-child(2) { min-width: 240px; } #list th:first-child, #list td:first-child { width: 36px; min-width: 0; padding-right: 0; }
#list .who-cell > span:last-child { white-space: normal; min-width: 170px; }
tr.click td { height: 52px; }

/* Page polish shared by Today, Tasks, Money, Invoices, KPIs, Lenders, Playbook, SOPs */
.tabs { display: flex; flex-wrap: nowrap; gap: 2px; padding: 4px; background: var(--sub); border-radius: 10px; margin-bottom: 14px; width: fit-content; max-width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; border-bottom: 0; }
.tabs a { white-space: nowrap; flex: 0 0 auto; margin-bottom: 0; border-bottom: 0; padding: 7px 11px; border-radius: 7px; color: var(--body); text-decoration: none; font-weight: 500; font-size: 13px; }
.tabs a:hover { color: var(--ink); } .tabs a.on { background: var(--surface); color: var(--brand); font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.12); }
.docrow { padding: 10px 0; border-bottom: 1px solid var(--sub); } .docrow:last-child { border-bottom: 0; }
.sopdoc, .toc a.on { border-radius: var(--radius); } .toc { list-style: none; padding: 0; margin: 0; } .toc a { display: block; padding: 7px 10px; border-radius: 7px; color: var(--body); text-decoration: none; } .toc a:hover { background: var(--sub); } .toc a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.bcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.bcard { border-top: 3px solid var(--brand); border-radius: var(--radius); }
.kcards { margin-bottom: 16px; }

/* Stage-gate drawer */
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(440px, 100vw); max-width: 100vw; border-radius: 0; border: 0; border-left: 1px solid var(--line); padding: 20px; overflow-y: auto; animation: slidein .18s ease-out; }
dialog.drawer::backdrop { background: rgba(15, 23, 42, .4); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.dr-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; } .dr-h h2 { margin: 2px 0 6px; }
.dr-f { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.gatecard { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--line); }
.gatecard.locked { background: #fffbeb; border-left: 4px solid var(--warn); color: #78350f; } .gatecard.open { background: var(--good-soft); border-left: 4px solid var(--good); }
html[data-theme="dark"] .gatecard.locked { background: var(--warn-soft); color: var(--warn); }

/* SOP document typography (Tailwind preflight is off) */
.sopdoc h2,.sopdoc h3,.sopdoc h4,.sopdoc h5{font-weight:700;color:#0f172a;margin:1.4em 0 .5em;line-height:1.25}
.sopdoc h2{font-size:1.5rem;margin-top:0}.sopdoc h3{font-size:1.2rem}.sopdoc h4{font-size:1.05rem}
.sopdoc p{margin:.6em 0;line-height:1.65}.sopdoc ul{list-style:disc;padding-left:1.4em;margin:.6em 0}.sopdoc ol{list-style:decimal;padding-left:1.4em;margin:.6em 0}
.sopdoc li{margin:.25em 0;line-height:1.6}.sopdoc code{background:#f1f5f9;padding:1px 5px;border-radius:5px;font-size:.88em}
.sopdoc table{width:100%;border-collapse:collapse;margin:.8em 0;font-size:.92rem}.sopdoc th{background:#f1f5f9;text-align:left}.sopdoc th,.sopdoc td{padding:8px 10px;border-bottom:1px solid #e2e8f0}

/* Bridge: legacy blocks inside redesigned (Tailwind) pages take the new panel look */
.tw .card{border:0;border-radius:1rem;box-shadow:0 1px 3px rgba(15,23,42,.06),0 1px 2px rgba(15,23,42,.04);padding:1.5rem;margin:0;background:#fff}
.tw .card>h2{font-size:1.125rem;font-weight:700;margin:0 0 .75rem}
.tw table th{font-size:.7rem;letter-spacing:.06em;text-transform:uppercase;color:#64748b;background:#f8fafc}
.tw .listrow{padding:.75rem 0;border-bottom:1px solid #f1f5f9}.tw .listrow:last-child{border:0}
.tw .row{display:flex;gap:.5rem;flex-wrap:wrap}
.tw .row input,.tw .row select{height:2.5rem;padding:0 .75rem;background:#f1f5f9;border-radius:.75rem;border:0}
.tw .banner{border-radius:1rem;padding:1rem}
:where(.tw input:not([type=checkbox]):not([type=radio]),.tw select){width:auto}
.tw .tablewrap td,.tw .tablewrap th{padding:.65rem .75rem;border-bottom:1px solid #f1f5f9;text-align:left}
.tw .tablewrap{overflow-x:auto}
.topbar #gq{width:100%}
@media (max-width:860px){.topbar .rev,.topbar #compchip,.topbar #whoami,.topbar #revchip{display:none!important}.topbar>*{min-width:0}.topbar #gq{min-width:0}.topbar .ml-auto{gap:.5rem}}
body{overflow-x:hidden}

/* While the sidebar waits for the signed-in person's role, keep its space but not its contents. */
.rail-wait .nav, .rail-wait #whoami, .rail-wait #newfile { visibility: hidden; }

/* Affiliate partners see a bare frame: only their five screens. */
.is-affiliate #newfile, .is-affiliate #asstbtn, .is-affiliate .gsearch, .is-affiliate #revchip, .is-affiliate #compchip, .is-affiliate #wsbox, .is-affiliate #wsbar, .is-affiliate #topbar a[href="#/today"] { display: none !important; }
