:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.04);
  --accent: #2a78d6;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --critical: #d03b3b;
  --serious: #ec835a;
  --warning: #fab219;
  --good: #006300;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a9890;
    --grid: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --wash: rgba(255, 255, 255, 0.05);
    --accent: #3987e5;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --good: #0ca30c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #9a9890;
  --grid: #2c2c2a;
  --axis: #383835;
  --ring: rgba(255, 255, 255, 0.10);
  --wash: rgba(255, 255, 255, 0.05);
  --accent: #3987e5;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --good: #0ca30c;
}


* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0 0 12px; }
p { margin: 0 0 8px; }
a { color: var(--accent); }
.lede { color: var(--ink-2); max-width: 760px; }
.note { color: var(--muted); font-size: 13px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 10px;
  padding: 18px;
  margin-top: 16px;
  min-width: 0;
}
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }

/* file input */
.drop {
  display: block;
  position: relative;
  border: 1.5px dashed var(--axis);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  background: var(--surface);
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--wash); }
.drop:focus-within { border-color: var(--accent); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop strong { display: block; }
.drop .file { color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; }
.controls label { font-size: 14px; color: var(--ink-2); }
input[type="date"], input[type="text"], input[type="search"], select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 6px;
  padding: 4px 8px;
  max-width: 100%;
}
.btn {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
}
.btn:hover { background: var(--wash); }
.errors { color: var(--critical); font-size: 14px; margin-top: 8px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 20px; }
.tile { background: var(--surface); border: 1px solid var(--ring); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.tile .label { color: var(--ink-2); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tile .value { font-size: 26px; font-weight: 650; line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* chart */
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; overflow: visible; }
.bars text { font-size: 13px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.bars text.value { fill: var(--ink); font-weight: 600; }
.bars rect.hit { fill: transparent; cursor: pointer; }
.bars g { outline: none; }
.bars g:hover .bar, .bars g:focus-visible .bar { opacity: 0.8; }
.bars g:focus-visible text.cat, .bars g.on text.cat { fill: var(--ink); font-weight: 600; }
.bars g.on rect.hit { fill: var(--wash); }
.tooltip {
  position: absolute;
  top: 0;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 8px 10px;
  font-size: 13px;
  min-width: 150px;
  z-index: 2;
}
.tooltip .when { color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
.tooltip .row { display: flex; align-items: center; gap: 8px; }
.tooltip strong { font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; }
.tooltip .name { color: var(--ink-2); }

.bars text.rate { fill: var(--muted); font-weight: 400; }
.bars rect.hit { cursor: default; }
.controls label.grow { display: flex; align-items: center; gap: 6px; flex: 1 1 320px; min-width: 0; }
.controls label.grow input { flex: 1; min-width: 0; }
.controls input[type="number"] { width: 72px; }
input[type="number"] {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 6px;
  padding: 4px 8px;
}
.head-actions { display: flex; align-items: baseline; gap: 12px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; margin-top: 16px; }
.grid-2 > .panel { margin-top: 0; }
.sub-title { margin-top: 20px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; vertical-align: top; }
th { color: var(--ink-2); font-weight: 600; font-size: 13px; vertical-align: bottom; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.small { font-size: 12px; color: var(--muted); }
td.todo { white-space: normal; min-width: 260px; color: var(--ink-2); }
td.company, td.contact { white-space: normal; min-width: 150px; }
td.check, th.check { width: 28px; padding-right: 0; }
td.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
tr.done td { color: var(--muted); }
tr.done td.company > div:first-child, tr.done td.todo { text-decoration: line-through; text-decoration-color: var(--axis); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.status svg { flex: none; }
.kind { font-size: 13px; color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.status-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding-bottom: 6px; border-bottom: 1px solid var(--grid); margin: 0; }
.day { padding: 10px 0; border-bottom: 1px solid var(--grid); }
.day:last-child { border-bottom: 0; }
.day-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.list { list-style: none; margin: 6px 0 0; padding: 0; }
.list li { padding: 6px 0 6px 20px; border-top: 1px dashed var(--grid); }
.list li:first-child { border-top: 0; }
.list li.note { padding-left: 0; }
.line { display: flex; justify-content: space-between; gap: 12px; }
.line strong { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
#stalled li, #cold li { padding-left: 0; }

details summary { cursor: pointer; color: var(--ink-2); font-size: 14px; }
.rules { margin: 10px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.rules li { margin-bottom: 4px; }
footer { margin-top: 28px; color: var(--muted); font-size: 13px; }

@media (max-width: 700px) {
  .today thead { display: none; }
  .today, .today tbody { display: block; }
  .today tr { display: grid; grid-template-columns: 28px auto minmax(0, 1fr); gap: 4px 10px; padding: 10px 4px; border-bottom: 1px solid var(--grid); }
  .today td { border: 0; padding: 0; white-space: normal; min-width: 0; }
  .today td.num { text-align: left; }
  .today td:nth-child(2) { display: none; }
  .today td.company, .today td.contact, .today td.todo { grid-column: 2 / -1; }
  .today td:nth-child(6), .today td:nth-child(8), .today td:nth-child(9) { grid-column: auto; font-size: 13px; color: var(--ink-2); }
  .today td:nth-child(6) { grid-column: 2; }
  .today td:nth-child(8):not(:empty)::before { content: "Value "; color: var(--muted); }
  .today td:nth-child(8):empty { display: none; }
  .today td:nth-child(9)::before { content: "Fit "; color: var(--muted); }
  .today td.check { grid-row: span 6; }
}
@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .panel { padding: 14px; }
  .tile .value { font-size: 22px; }
}
