/* Xpert Platform: one calm shell, three module colours.
   Closr is amber (winning), the ATS is blue (delivering), IQ is green (money). Fraunces for titles, DM Sans for everything else. */
:root {
  --ink: #0B2A4A; --ink2: #44556A; --mute: #6B7A8C; --line: #DCE3EB; --line2: #EBF0F5;
  --paper: #EEF2F6; --panel: #FFFFFF; --rail: #0B2A4A; --rail2: #123A62;
  --closr: #B26A00; --closr-bg: #FFF3D6; --closr-fill: #FFC53D;
  --ats: #1763A0;   --ats-bg: #E3F0FA;   --ats-fill: #3F8CC6;
  --iq: #12795F;    --iq-bg: #DDF3EB;    --iq-fill: #2FA582;
  --good: #0A7A0A; --good-bg: #E3F4E3; --warn: #8A5A00; --warn-bg: #FFF1CC; --bad: #B02A2A; --bad-bg: #FBE4E4; --info: #14568F; --info-bg: #E3EFFA;
  --r: 10px; --rail-w: 88px; --nav-w: 232px; --dock-w: 404px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.45 var(--sans); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ats-fill); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4, p { margin: 0; }
.num, td.r, th.r { font-variant-numeric: tabular-nums; }

/* ---- frame --------------------------------------------------------------------------------- */
#app { display: grid; grid-template-columns: var(--rail-w) var(--nav-w) minmax(0, 1fr) 0; grid-template-rows: 100vh; height: 100vh; }
#app.dock-open { grid-template-columns: var(--rail-w) var(--nav-w) minmax(0, 1fr) var(--dock-w); }
#app.no-nav { grid-template-columns: var(--rail-w) 0 minmax(0, 1fr) 0; }
#app.no-nav.dock-open { grid-template-columns: var(--rail-w) 0 minmax(0, 1fr) var(--dock-w); }

.rail { background: var(--rail); color: #fff; display: flex; flex-direction: column; align-items: stretch; padding: 14px 0; gap: 4px; }
.rail .brand { display: grid; place-items: center; height: 52px; margin-bottom: 8px; }
.rail .brand svg { display: block; }
.rail a.ri { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 11px 4px 9px; text-decoration: none; color: rgba(255,255,255,.72); position: relative; font-size: 12.5px; font-weight: 500; }
.rail a.ri:hover { color: #fff; background: rgba(255,255,255,.06); }
.rail a.ri.on { color: #fff; background: var(--rail2); }
.rail a.ri.on::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--mc, #fff); }
.rail a.ri svg { width: 26px; height: 26px; }
.rail a.ri .depth { font-size: 10.5px; font-weight: 400; color: rgba(255,255,255,.52); margin-top: -2px; }
.rail a.ri.lite svg { opacity: .62; }
.rail .grow { flex: 1; }
.rail .ver { font-size: 10.5px; color: rgba(255,255,255,.42); text-align: center; padding: 0 6px; }

.nav { background: var(--panel); border-right: 1px solid var(--line); overflow: hidden auto; padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; }
#app.no-nav .nav, .nav.hide { padding: 0; border: 0; overflow: hidden; visibility: hidden; }
.nav h2 { font: 600 24px/1.15 var(--serif); padding: 4px 10px 2px; }
.nav .blurb { padding: 0 10px 14px; color: var(--mute); font-size: 13.5px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; font-weight: 500; color: var(--ink2); }
.nav a:hover { background: var(--paper); color: var(--ink); }
.nav a.on { background: var(--mbg); color: var(--mc); font-weight: 700; }
.nav .count { margin-left: auto; font-size: 12.5px; color: var(--mute); font-weight: 500; font-variant-numeric: tabular-nums; }
.nav .note { margin-top: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; font-size: 13px; color: var(--ink2); background: var(--paper); }
.nav .note b { display: block; color: var(--ink); margin-bottom: 2px; }

.main { overflow: auto; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; min-height: 60px; }
.top .firm { font: 600 18px/1 var(--serif); }
.top .firm small { font: 400 13px var(--sans); color: var(--mute); margin-left: 10px; }
.top .sp { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; background: var(--panel); }
.who label { font-size: 12.5px; color: var(--mute); }
.who select { border: 0; background: transparent; font-weight: 600; padding: 4px 2px; cursor: pointer; max-width: 340px; }
.rolepill { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--paper); color: var(--ink2); }
.shbtn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 999px; padding: 7px 16px 7px 12px; font-weight: 600; cursor: pointer; }
.shbtn:hover { background: #12406C; }
.shbtn svg { width: 18px; height: 18px; }
.page { padding: 26px 28px 56px; display: flex; flex-direction: column; gap: 20px; max-width: 1480px; width: 100%; }
.ph { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ph h1 { font: 600 32px/1.1 var(--serif); letter-spacing: -.005em; }
.ph .sub { color: var(--ink2); margin-top: 6px; max-width: 100ch; }
.ph .acts { margin-left: auto; display: flex; gap: 10px; }
.crumb { font-size: 13.5px; color: var(--mute); margin-bottom: 6px; }
.crumb a { text-decoration: none; } .crumb a:hover { color: var(--ink); text-decoration: underline; }
.litebar { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--r); background: var(--paper); border: 1px dashed #B8C4D2; color: var(--ink2); font-size: 14px; }
.litebar b { color: var(--ink); }

/* ---- primitives ------------------------------------------------------------------------------ */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.panel-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0; }
.panel-h h3 { font: 600 17px/1.2 var(--sans); }
.panel-r { margin-left: auto; color: var(--mute); font-size: 13.5px; }
.panel-b { padding: 14px 20px 18px; } .panel-b.flush { padding: 8px 0 4px; }
.grid { display: grid; gap: 20px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.kpi-l { color: var(--ink2); font-size: 14px; }
.kpi-v { font: 600 34px/1.1 var(--sans); margin-top: 6px; letter-spacing: -.01em; }
.kpi-s { color: var(--mute); font-size: 13.5px; margin-top: 6px; }
.kpi.warn .kpi-v { color: var(--bad); }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; font-size: 14.5px; }
.btn:hover { border-color: #AEBBCB; background: #F8FAFC; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); } .btn.primary:hover { background: #12406C; }
.btn.m-closr { background: var(--closr-fill); border-color: var(--closr-fill); color: #3B2600; } .btn.m-closr:hover { background: #FFD266; }
.btn.m-iq { background: var(--iq); border-color: var(--iq); color: #fff; } .btn.m-iq:hover { background: #0F664F; }
.btn.m-ats { background: var(--ats); border-color: var(--ats); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.lnk { color: var(--ats); font-weight: 600; text-decoration: none; } .lnk:hover { text-decoration: underline; }

table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-weight: 500; color: var(--mute); font-size: 13.5px; padding: 8px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td.nw, .t th.nw { white-space: nowrap; }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: #F7F9FC; }
.t .r { text-align: right; } .t td.strong { font-weight: 600; } .t .mut { color: var(--mute); font-size: 13.5px; }
.t td small { display: block; color: var(--mute); font-size: 13px; }
.t tr.click { cursor: pointer; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 10px; } .row.sp { justify-content: space-between; } .wrap { flex-wrap: wrap; }

.av { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #D5E3F2; color: var(--ink); font-size: 11.5px; font-weight: 700; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.c-good { color: var(--good); background: var(--good-bg); } .c-warn { color: var(--warn); background: var(--warn-bg); } .c-bad { color: var(--bad); background: var(--bad-bg); }
.c-info { color: var(--info); background: var(--info-bg); } .c-mute { color: var(--mute); background: var(--paper); } .c-mute i { background: transparent; border: 1.5px solid currentColor; }
.mtag { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 4px; }
.mtag.m-closr { color: var(--closr); background: var(--closr-bg); } .mtag.m-ats { color: var(--ats); background: var(--ats-bg); } .mtag.m-iq { color: var(--iq); background: var(--iq-bg); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--paper); font-size: 13px; color: var(--ink2); }
.empty { padding: 28px; text-align: center; color: var(--mute); display: flex; flex-direction: column; gap: 4px; }
.empty b { color: var(--ink); }

/* ---- the thread (one engagement across all three modules) ---------------------------------------------- */
.thread { padding: 4px 0 2px; }
.th-row { display: grid; grid-template-columns: repeat(5, 1fr); }
.th-step { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding-top: 22px; }
.th-step b { font-size: 14px; font-weight: 600; } .th-step small { color: var(--mute); font-size: 13px; min-height: 18px; }
.th-node { position: absolute; top: 0; left: 0; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--c); background: var(--panel); z-index: 1; }
.th-step::before { content: ''; position: absolute; top: 7px; left: 16px; right: -0px; height: 2px; background: var(--line); }
.th-step:last-child::before { display: none; }
.th-step.done .th-node { background: var(--c); } .th-step.done::before { background: var(--c); opacity: .55; }
.th-step.now .th-node { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); } .th-step.now b { color: var(--c); }
.th-step.todo b { color: var(--mute); font-weight: 500; }
.th-step.m-closr { --c: var(--closr-fill); } .th-step.m-closr .th-node { border-color: #D99A00; } .th-step.m-closr.done .th-node { background: var(--closr-fill); }
.th-step.m-ats { --c: var(--ats); } .th-step.m-iq { --c: var(--iq); }
.th-money { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.th-bill { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; } .th-bill small { color: var(--iq); font-weight: 600; font-size: 12.5px; }
.thread.compact .th-step { padding-top: 20px; } .thread.compact .th-step b { font-size: 13px; }

/* ---- boards ---------------------------------------------------------------------------------------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(212px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.col { background: #E7EDF3; border-radius: var(--r); padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.col > header { display: flex; align-items: baseline; gap: 8px; padding: 4px 4px 0; }
.col > header b { font-size: 14.5px; } .col > header span { color: var(--mute); font-size: 13px; margin-left: auto; font-variant-numeric: tabular-nums; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; display: flex; flex-direction: column; gap: 5px; text-align: left; width: 100%; cursor: pointer; }
.card:hover { border-color: #9DB1C7; }
.card b { font-size: 14.5px; line-height: 1.3; } .card small { color: var(--mute); font-size: 13px; line-height: 1.35; } .card .money { font-weight: 700; font-size: 14px; }
.card .meta { display: flex; align-items: center; gap: 8px; color: var(--ink2); font-size: 13px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 14px; text-decoration: none; font-weight: 600; color: var(--mute); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg a { padding: 6px 14px; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink2); }
.seg a.on { background: var(--ink); color: #fff; }

.feed { display: flex; flex-direction: column; margin: 0; padding: 0; } .feed li { list-style: none; display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line2); }
.feed li:last-child { border: 0; } .feed time { color: var(--mute); font-size: 13px; padding-top: 2px; } .feed .tx { display: flex; gap: 8px; align-items: flex-start; } .feed .tx > span:last-child { flex: 1; min-width: 0; } .feed .tx .mtag { flex: none; margin-top: 2px; }
.legend { display: flex; gap: 18px; margin-top: 6px; color: var(--ink2); font-size: 13.5px; } .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; } svg.chart path:hover { filter: brightness(1.08); }
.todo-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 11px 20px; border-bottom: 1px solid var(--line2); }
.todo-row:last-child { border: 0; } .todo-row b { font-weight: 600; } .todo-row small { color: var(--mute); display: block; font-size: 13.5px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 14.5px; } .facts dt { color: var(--mute); } .facts dd { margin: 0; font-weight: 500; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; } .tags span { background: var(--paper); border-radius: 4px; padding: 1px 8px; font-size: 12.5px; color: var(--ink2); }

/* ---- Shreyas dock ------------------------------------------------------------------------------------ */
.dock { display: none; background: var(--panel); border-left: 1px solid var(--line); flex-direction: column; min-height: 0; }
#app.dock-open .dock { display: flex; }
.dock-h { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.dock-h .t1 { display: flex; align-items: center; gap: 10px; font: 600 22px var(--serif); } .dock-h .t1 svg { width: 24px; height: 24px; }
.dock-h .t1 button { margin-left: auto; border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--mute); padding: 4px 8px; }
.dock-h p { color: var(--ink2); font-size: 13.5px; }
.chat { flex: 1; overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 95%; } .msg.me { align-self: flex-end; background: var(--ink); color: #fff; border-radius: 14px 14px 4px 14px; padding: 9px 14px; }
.msg.sh { align-self: flex-start; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.msg.sh .body { display: flex; flex-direction: column; gap: 8px; } .msg.sh ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.msg.sh .scope { font-size: 12.5px; color: var(--mute); border-top: 1px solid var(--line2); padding-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.msg.sh .scope a { text-decoration: none; background: var(--paper); border-radius: 4px; padding: 1px 8px; color: var(--ats); font-weight: 600; } .msg.sh .scope a:hover { text-decoration: underline; }
.msg.sh .deny { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.sug { padding: 8px 18px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.sug button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; cursor: pointer; text-align: left; } .sug button:hover { border-color: var(--ats); color: var(--ats); }
.ask { display: flex; gap: 8px; padding: 12px 18px 16px; }
.ask input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; background: var(--paper); } .ask input:focus { background: #fff; outline-offset: 0; }
.ask button { border: 0; background: var(--ink); color: #fff; border-radius: 999px; padding: 0 18px; font-weight: 600; cursor: pointer; }
.typing { color: var(--mute); }

/* ---- sign in, modal, toast, tooltip ---------------------------------------------------------------------- */
.gate { min-height: 100vh; display: grid; place-items: center; background: var(--rail); padding: 24px; }
.gate-card { background: #fff; border-radius: 14px; padding: 32px; width: min(460px, 100%); display: flex; flex-direction: column; gap: 14px; }
.gate-card h1 { font: 600 28px var(--serif); } .gate-card p { color: var(--ink2); }
.gate-card input { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
.persona { display: grid; gap: 8px; } .persona button { text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fff; cursor: pointer; display: flex; gap: 12px; align-items: center; } .persona button:hover { border-color: var(--ats); background: var(--ats-bg); }
.persona small { display: block; color: var(--mute); }
.modal { display: none; position: fixed; inset: 0; background: rgba(11,42,74,.45); z-index: 40; place-items: center; padding: 20px; } .modal.open { display: grid; }
.modal-card { background: #fff; border-radius: 14px; padding: 24px; width: min(520px, 100%); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px rgba(11,42,74,.3); }
.modal-card h2 { font: 600 24px var(--serif); } .modal-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; } .modal-card input, .modal-card select { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-weight: 400; }
.modal-card .acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.modal-card .sum { background: var(--paper); border-radius: 8px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; font-size: 14.5px; } .modal-card .sum b { font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 10px; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 80vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.bad { background: var(--bad); }
.tip { position: fixed; z-index: 80; background: var(--ink); color: #fff; border-radius: 8px; padding: 7px 11px; font-size: 13px; display: none; flex-direction: column; gap: 2px; pointer-events: none; max-width: 260px; } .tip.show { display: flex; } .tip strong { font-weight: 700; } .tip span { color: #C8D6E6; }

@media (max-width: 1500px) { :root { --nav-w: 208px; --dock-w: 380px; } .page { padding: 22px 20px 48px; } }
@media (max-width: 1180px) { #app { grid-template-columns: var(--rail-w) 0 minmax(0, 1fr) 0 !important; } .nav { padding: 0; border: 0; overflow: hidden; visibility: hidden; } .g2, .g3, .g21, .g12 { grid-template-columns: 1fr; } #app.dock-open .dock { position: fixed; right: 0; top: 0; bottom: 0; width: min(var(--dock-w), 100vw); z-index: 30; box-shadow: -10px 0 30px rgba(11,42,74,.2); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* small screens: keep the top bar to one row */
@media (max-width: 760px) { .top { padding: 10px 14px; gap: 8px; } .top .firm small { display: none; } .top .firm { font-size: 15px; } .page { padding-left: 16px; padding-right: 16px; } }
