:root {
  --paper: #EDF1EE;
  --surface: #FFFFFF;
  --ink: #15262A;
  --muted: #5C6E70;
  --line: #D3DBD6;
  --pine: #1F5C4D;
  --pine-deep: #173F37;
  --marigold: #E9A100;
  --brick: #B23A26;
  --head: 'Geologica', system-ui, sans-serif;
  --body: 'Commissioner', system-ui, sans-serif;
  --nav-w: 208px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--head); margin: 0; line-height: 1.2; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 20px; }
h2 { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--marigold); outline-offset: 2px; }
.quiet { color: var(--muted); max-width: 68ch; }
.n { font: 500 13px var(--body); color: var(--muted); margin-left: 4px; }
.bad { color: var(--brick); font-weight: 600; }
.due { color: #8A5F00; font-weight: 600; }
.r { text-align: right; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* shell */
.app { display: flex; min-height: 100vh; }
.nav { width: var(--nav-w); flex: none; background: var(--pine-deep); color: #DCE9E3; padding: 22px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font: 700 22px var(--head); letter-spacing: -0.02em; color: #fff; padding: 0 8px 22px; }
.brand span { font-weight: 500; color: var(--marigold); }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-link { background: none; border: 0; text-align: left; padding: 9px 10px; border-radius: 6px; color: inherit; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
.nav-link:hover { background: rgba(255, 255, 255, .08); }
.nav-link.on { background: #fff; color: var(--pine-deep); }
.count { background: var(--marigold); color: #2B1E00; border-radius: 10px; padding: 0 7px; font-size: 12px; line-height: 20px; }
.nav-foot { margin-top: auto; font-size: 12.5px; padding: 0 8px; display: grid; gap: 6px; }
.mode::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--marigold); margin-right: 7px; }
.mode.cloud::before { background: #6FD3A7; }
.nav-foot .link { color: #DCE9E3; justify-self: start; }
.main { flex: 1; min-width: 0; }
.top { display: flex; gap: 10px; padding: 14px 28px; position: sticky; top: 0; background: var(--paper); border-bottom: 1px solid var(--line); z-index: 5; }
.search { flex: 1; min-width: 0; max-width: 460px; }
.view { padding: 26px 28px 80px; max-width: 1280px; outline: none; }
.view section { margin-bottom: 32px; }

/* controls */
input, select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; min-height: 38px; }
textarea { resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--pine); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 13px; min-height: 38px; cursor: pointer; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--pine); }
.btn.primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn.primary:hover { background: var(--pine-deep); }
.link { background: none; border: 0; padding: 0; color: var(--pine); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; text-align: left; }
.link.danger, .link.x { color: var(--brick); }
.link.x { font-size: 12.5px; margin-left: auto; }
.f { display: grid; gap: 4px; margin-bottom: 12px; }
.f > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.chips, .filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.chip:hover { border-color: var(--pine); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* stage colours */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--c); flex: none; }
.s-found { --c: #9AA8A6; } .s-researched { --c: #5F8DA8; } .s-demo { --c: #7A6BB5; }
.s-pitched { --c: #E9A100; } .s-negotiating { --c: #D9682B; } .s-won { --c: #1F5C4D; } .s-lost { --c: #B23A26; }

/* today: the round sheet */
.round { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.round-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-left: 4px solid var(--marigold); }
.round-row + .round-row { border-top: 1px solid var(--line); }
.round-row.late { border-left-color: var(--brick); }
.round-row:first-child { border-top-left-radius: 8px; } .round-row:last-child { border-bottom-left-radius: 8px; }
.round-main { flex: 1; min-width: 0; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; display: grid; grid-template-columns: 96px 1fr; column-gap: 12px; }
.when { grid-row: span 2; font: 600 14px var(--head); align-self: center; }
.late .when { color: var(--brick); }
.who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.what { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round-acts { display: flex; gap: 6px; flex: none; }
.track { display: flex; gap: 3px; margin-bottom: 8px; }
.seg { border: 0; background: var(--c); color: #fff; padding: 10px 10px 8px; min-width: 0; cursor: pointer; text-align: left; display: grid; }
.seg:first-child { border-radius: 8px 0 0 8px; } .seg:last-child { border-radius: 0 8px 8px 0; }
.seg b { font: 700 22px var(--head); line-height: 1; }
.seg span { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg.s-found, .seg.s-pitched { color: #1D1600; }
.figures { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.figures div { padding: 14px 16px; }
.figures div + div { border-left: 1px solid var(--line); }
.figures dt { font-size: 13px; color: var(--muted); }
.figures dd { margin: 2px 0 0; font: 700 24px var(--head); letter-spacing: -0.01em; }
.figures dd.warn { color: var(--brick); }
.empty { max-width: 520px; padding: 48px 0; }

/* pipeline */
.board { display: grid; grid-template-columns: repeat(7, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: #E2E8E4; border-radius: 8px; padding: 10px 8px; min-height: 140px; }
.col.over { outline: 2px dashed var(--pine); }
.col h2 { font-size: 14px; display: flex; align-items: center; padding: 0 4px; }
.col h2 .n { margin-left: auto; }
.col-empty { color: var(--muted); font-size: 13px; padding: 0 4px; }
.card { background: var(--surface); border-radius: 6px; padding: 10px; margin-bottom: 6px; cursor: grab; box-shadow: 0 1px 0 var(--line); }
.card:hover { box-shadow: 0 0 0 1px var(--pine); }
.card h3 { font-size: 14px; }
.card p { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.card footer { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.r { text-align: right; }
.table td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tr:first-child td { border-top: 0; }
.table td:nth-child(1), .table td:nth-child(2) { white-space: normal; }
.table small { display: block; color: var(--muted); font-size: 13px; }
tr[data-open] { cursor: pointer; }
tr[data-open]:hover { background: #F4F7F5; }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-width: 640px; }
.bars li { display: grid; grid-template-columns: 84px 1fr 90px; align-items: center; gap: 10px; }
.bars i { height: 14px; background: var(--pine); border-radius: 2px; min-width: 2px; }
.bars b { text-align: right; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(21, 38, 42, .35); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--paper); z-index: 21; overflow-y: auto; padding: 0 22px 40px; box-shadow: -8px 0 30px rgba(21, 38, 42, .18); }
.d-head { position: sticky; top: 0; background: var(--paper); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 18px 0 12px; z-index: 1; }
.d-head h2 { font-size: 22px; font-weight: 700; margin: 0; }
.d-head p { margin: 2px 0 0; color: var(--muted); }
.d-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.d-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 6px; margin-bottom: 12px; }
.d-sec h3 { margin-bottom: 12px; }
.d-sec > .btn, .d-sec > .row { margin-bottom: 10px; }
.timeline { list-style: none; margin: 0 0 10px; padding: 0; }
.timeline li { border-left: 3px solid var(--line); padding: 2px 0 10px 12px; }
.timeline li.t-call { border-color: #5F8DA8; } .timeline li.t-visit { border-color: var(--pine); } .timeline li.t-message { border-color: #7A6BB5; }
.timeline div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.timeline em { font-style: normal; color: var(--muted); }
.timeline time { color: var(--muted); font-size: 13px; }
.timeline p { margin: 2px 0 0; white-space: pre-wrap; }
.pays { list-style: none; padding: 0; margin: 0 0 8px; }
.pays li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }

/* dialog, toast, login */
.dlg { border: 0; border-radius: 10px; padding: 22px; width: min(480px, calc(100% - 24px)); background: var(--paper); color: var(--ink); }
.dlg::backdrop { background: rgba(21, 38, 42, .5); }
.dlg h2 { font-size: 20px; margin-bottom: 4px; }
.dlg-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; z-index: 50; max-width: calc(100% - 32px); }
.toast.bad { background: var(--brick); }
.login { min-height: 100vh; display: grid; place-items: center; background: var(--pine-deep); padding: 16px; }
.login form { background: var(--paper); padding: 26px; border-radius: 10px; width: min(360px, 100%); }
.login .brand { color: var(--pine-deep); padding-left: 0; }
.login .err { color: var(--brick); min-height: 1.5em; }

/* phone */
@media (max-width: 820px) {
  .app { flex-direction: column; }
  .nav { position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: auto; height: auto; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); z-index: 10; flex-direction: row; }
  .nav .brand, .nav-foot { display: none; }
  .nav-links { flex-direction: row; flex: 1; }
  .nav-link { flex: 1; justify-content: center; gap: 4px; padding: 11px 2px; font-size: 13px; }
  .top { padding: 10px 16px; }
  .view { padding: 18px 16px 96px; }
  h1 { font-size: 24px; margin-bottom: 14px; }
  .round-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .round-main { grid-template-columns: 1fr; }
  .when { grid-row: auto; }
  .round-acts { flex-wrap: wrap; }
  .round-acts .btn { flex: 1; }
  .figures { grid-template-columns: 1fr 1fr; }
  .figures div:nth-child(3) { border-left: 0; }
  .figures div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .track { flex-wrap: wrap; }
  .seg { flex: 1 1 30% !important; border-radius: 6px !important; }
  .board { grid-template-columns: repeat(7, 78vw); scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 12px; }
  .col { scroll-snap-align: center; }
  .grid2 { grid-template-columns: 1fr; }
  .drawer { padding: 0 16px 40px; }
  .toast { bottom: 76px; }
  input, select, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .drawer:not([hidden]) { animation: slide .18s ease-out; }
  @keyframes slide { from { transform: translateX(24px); opacity: 0; } }
}
