:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #eef0f4; --ink: #121821; --muted: #5a6473; --line: #dfe3ea;
  --navy: #0f2a43; --navy-ink: #ffffff; --gold: #c99a2e; --gold-soft: #fbf3dd;
  --good: #14693f; --good-bg: #e3f4ea; --warn: #8a5a00; --warn-bg: #fdf0d2; --bad: #a3261f; --bad-bg: #fde8e6; --win: #5b2aa8; --win-bg: #efe7fb;
  --focus: #1a5fd0; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.08);
  --r: 12px; --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1118; --surface: #141b25; --surface-2: #1b2431; --ink: #eef1f6; --muted: #9aa5b6; --line: #2a3546;
    --navy: #e0b84f; --navy-ink: #14100a; --gold: #e0b84f; --gold-soft: #2a2412;
    --good: #5fd39a; --good-bg: #12301f; --warn: #f2c35b; --warn-bg: #33270b; --bad: #ff8d85; --bad-bg: #3a1614; --win: #c6a6ff; --win-bg: #2a1c47;
    --focus: #7db0ff; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: var(--navy-ink); padding: .5rem 1rem; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .error { color: var(--bad); font-weight: 600; }
.row { display: flex; align-items: center; } .gap { gap: .6rem; } .wrap { flex-wrap: wrap; } .end { justify-content: flex-end; } .between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 1rem; }

/* logo + login */
.logo { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: #0f2a43; color: #e0b84f; font-weight: 800; font-size: 1.5rem; letter-spacing: .5px; }
.logo.sm { width: 32px; height: 32px; border-radius: 9px; font-size: .95rem; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 2rem; box-shadow: var(--shadow); text-align: center; }
.login-card label { display: block; text-align: left; font-weight: 600; margin: 1rem 0 .35rem; }

/* shell */
.shell { min-height: 100vh; padding-bottom: 5.5rem; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; white-space: nowrap; }
.nav { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: .5rem .85rem; border-radius: 999px; text-decoration: none; font-weight: 600; color: var(--muted); white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--navy); color: var(--navy-ink); }
.nav .badge { margin-left: .35rem; }
main#main { max-width: 1180px; margin: 0 auto; padding: 1.25rem; outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head p { margin: 0; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.sm { min-height: 36px; padding: .25rem .7rem; font-size: .875rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.callbtn { background: var(--good); color: #fff; border-color: var(--good); }
@media (prefers-color-scheme: dark) { .callbtn { color: #07210f; } }
input, select, textarea { width: 100%; min-height: 44px; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
textarea { min-height: 96px; resize: vertical; }
label { font-weight: 600; font-size: .9rem; }
label > input, label > select, label > textarea { margin-top: .3rem; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters > * { width: auto; flex: 1 1 150px; }
.filters .search { flex: 3 1 240px; }

/* cards + lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .85rem 1rem; }
.kpi b { display: block; font-size: 1.8rem; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: .85rem; font-weight: 600; }
.kpi.accent { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.kpi.accent span { color: inherit; opacity: .85; }
.list { list-style: none; margin: 0; padding: 0; }
.todo { display: flex; align-items: center; gap: .6rem; padding: .65rem .25rem; border-top: 1px solid var(--line); }
.todo:first-child { border-top: 0; }
.todo-main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: .25rem; cursor: pointer; border-radius: 8px; }
.todo-main:hover { background: var(--surface-2); }
.todo-name { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-meta { color: var(--muted); font-size: .85rem; display: block; }
.todo.done .todo-name { text-decoration: line-through; color: var(--muted); }
.check { position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; }
.check input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.check span { width: 26px; height: 26px; border: 2px solid var(--muted); border-radius: 8px; display: grid; place-items: center; background: var(--surface); }
.check input:checked + span { background: var(--good); border-color: var(--good); }
.check input:checked + span::after { content: ""; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem .5rem; }

/* chips + badges */
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.chip.good { background: var(--good-bg); color: var(--good); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.win { background: var(--win-bg); color: var(--win); } .chip.gold { background: var(--gold-soft); color: var(--warn); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: #1a1405; font-size: .72rem; font-weight: 800; }
.stars { color: var(--warn); font-weight: 700; }

/* table */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
tbody tr:hover { background: var(--surface-2); }
td .link { background: none; border: 0; padding: 0; font-weight: 700; cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }

/* pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--r); padding: .6rem; }
.col h3 { display: flex; justify-content: space-between; padding: .25rem .4rem .5rem; }
.pcard { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; margin-bottom: .5rem; cursor: pointer; }
.pcard:hover { border-color: var(--muted); }

/* drawer + modal */
dialog { color: var(--ink); background: var(--surface); border: 0; padding: 0; }
dialog::backdrop { background: rgba(8, 12, 20, .55); }
.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: none; max-width: 100vw; width: min(620px, 100vw); box-shadow: var(--shadow); }
.drawer[open] { display: flex; flex-direction: column; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; gap: .75rem; align-items: start; }
.drawer-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.sec { margin-bottom: 1.5rem; }
.sec > h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.modal { border-radius: 16px; width: min(560px, calc(100vw - 2rem)); padding: 1.25rem; margin: auto; box-shadow: var(--shadow); }
.outcomes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.oc { text-align: left; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); padding: .55rem .75rem; cursor: pointer; min-height: 58px; }
.oc b { display: block; } .oc span { font-size: .8rem; color: var(--muted); }
.oc[aria-pressed="true"] { border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus) inset; }
.oc.good b { color: var(--good); } .oc.bad b { color: var(--bad); } .oc.win b { color: var(--win); }
.panel { background: var(--surface-2); border-radius: 10px; padding: .9rem; margin-top: .75rem; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: .25rem .75rem; font-size: .95rem; }
.kv dt { color: var(--muted); font-weight: 600; } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .5rem 0 .5rem .9rem; border-left: 2px solid var(--line); margin-left: .35rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .85rem; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.quote { border-left: 3px solid var(--gold); background: var(--gold-soft); padding: .7rem .9rem; border-radius: 0 10px 10px 0; white-space: pre-wrap; }

/* coach */
.coach { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1rem; align-items: start; }
.chat { display: flex; flex-direction: column; gap: .75rem; min-height: 320px; }
.msg { padding: .8rem 1rem; border-radius: 12px; max-width: 100%; overflow-wrap: anywhere; }
.msg.user { background: var(--navy); color: var(--navy-ink); align-self: flex-end; max-width: 85%; }
.msg.ai { background: var(--surface); border: 1px solid var(--line); }
.msg.ai h4 { margin: 1rem 0 .3rem; font-size: 1rem; } .msg.ai h4:first-child { margin-top: 0; }
.msg.ai ul { margin: .25rem 0 .5rem; padding-left: 1.25rem; } .msg.ai p { margin: .3rem 0; }
.msg-actions { display: flex; gap: .4rem; margin-top: .75rem; flex-wrap: wrap; }
.composer { display: flex; gap: .5rem; align-items: end; position: sticky; bottom: 4.6rem; background: var(--bg); padding-top: .5rem; }
.composer textarea { min-height: 52px; }
details.play { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .75rem 1rem; margin-top: 1rem; }
details.play summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* proof */
.proof { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

.toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: .7rem 1.1rem; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 200; max-width: calc(100vw - 2rem); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  main#main { padding: .9rem; }
  .cols, .coach, .grid2 { grid-template-columns: 1fr; }
  .topbar { padding: .5rem .75rem; }
  .brand span:last-child { display: none; }
  .composer { bottom: .75rem; }
  .drawer { width: 100vw; }
  .outcomes { grid-template-columns: 1fr; }
  table { min-width: 0; } thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
  td { border: 0; padding: .15rem 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
