:root {
  --ink: #17171a; --text: #3a3832; --muted: #6b675f; --paper: #fbfaf7; --card: #ffffff; --line: #e2ded5; --line-strong: #cfcbc2; --field: #8a867d;
  --red: #c7372b; --yellow: #ffd84a; --blue: #2633c9; --good: #1d7a46;
  --display: "Big Shoulders Display", Impact, sans-serif; --body: "Public Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--text); font: 15px/1.5 var(--body); -webkit-text-size-adjust: 100%; }
h1, h2, h3, p { margin: 0; }
h1 { font: 900 36px/1.05 var(--display); color: var(--ink); text-transform: uppercase; letter-spacing: .01em; }
.head h1 { display: inline; box-shadow: inset 0 -.3em 0 var(--yellow); }
.head .muted { margin-top: 6px; }
.head > div > small:first-child { display: block; margin-bottom: 6px; }
.head > div > .row { margin-top: 8px; }
h2 { font-size: 15px; font-weight: 700; color: var(--ink); }
a { color: var(--blue); }
ul { list-style: none; margin: 0; padding: 0; }
small, .muted { color: var(--muted); font-size: 13px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Buttons and fields */
button, input, select, textarea { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 14px; font-weight: 600; background: var(--card); border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.danger { color: var(--red); }
.btn.sm { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; text-decoration: underline; font-size: 13px; }
.link.danger { color: var(--red); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink); }
input, select, textarea { width: 100%; min-height: 38px; padding: 7px 10px; font-weight: 400; background: #fff; border: 1px solid var(--field); border-radius: 8px; }
::placeholder { color: var(--muted); opacity: 1; }
textarea { min-height: 76px; resize: vertical; }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.fields { display: grid; gap: 12px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* Shell */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100%; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 20px 14px; background: var(--ink); color: #fff; }
.mark { font: 900 26px/1 var(--display); letter-spacing: .02em; color: var(--yellow); padding: 0 8px; }
.mark span { display: block; margin-top: 3px; font: 600 11px/1 var(--body); letter-spacing: .08em; color: #b9b5ab; }
.nav { display: grid; gap: 2px; }
.nav a { padding: 9px 10px; border-radius: 8px; color: #dcd9d1; text-decoration: none; font-weight: 600; }
.nav a:hover { background: #2a2a2f; }
.nav a[aria-current="page"] { background: var(--yellow); color: var(--ink); }
.who { margin-top: auto; padding: 0 8px; font-size: 13px; color: #b9b5ab; overflow-wrap: anywhere; }
.who strong { display: block; color: #fff; }
.who .link { color: #dcd9d1; }
.main { padding: 28px 30px 60px; min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }

/* Cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card > .body { padding: 14px 16px; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font: 900 34px/1.05 var(--display); color: var(--ink); }
.stat:first-child { background: var(--yellow); border-color: var(--yellow); }
.stat:first-child small { color: var(--ink); }
.start { margin-bottom: 16px; }
.start ol { margin: 0; padding: 14px 16px 14px 34px; display: grid; gap: 6px; }
.start .link { font-size: inherit; }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.list > li:last-child { border-bottom: 0; }
.list .grow { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.empty { padding: 16px; color: var(--muted); font-size: 14px; }
.tag { display: inline-block; padding: 1px 8px; font-size: 12px; font-weight: 600; color: var(--ink); background: #f1eee6; border-radius: 20px; white-space: nowrap; }
.tag.quiz { background: var(--yellow); }
.tag.jarvis { background: #dfe2fb; color: var(--blue); }
.tag.won { background: #dcefe3; color: #166238; }
.tag.lost, .tag.stop { background: #f8e0dd; color: #a32a20; }
.overdue { color: var(--red); font-weight: 600; }
.done { text-decoration: line-through; color: var(--muted); }

/* Leads table */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table a { font-weight: 600; color: var(--ink); }
.search { max-width: 300px; }

/* Pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 214px; gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.column { background: #f1eee6; border-top: 3px solid var(--ink); border-radius: 10px; padding: 10px; min-height: 180px; }
.column[data-stage="won"] { border-top-color: var(--good); }
.column[data-stage="lost"] { border-top-color: var(--red); }
.column-empty { padding: 4px; font-size: 13px; color: var(--muted); }
.column.over { outline: 2px solid var(--blue); }
.column > h2 { display: flex; justify-content: space-between; padding: 2px 4px 8px; }
.column > h2 small { font-weight: 500; }
.deal { display: grid; gap: 4px; padding: 10px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; cursor: grab; }
.deal a { font-weight: 700; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.deal a:hover { text-decoration: underline; }
.deal select { min-height: 30px; padding: 3px 6px; font-size: 13px; }

/* Stage buttons, filters */
.steps { display: flex; flex-wrap: wrap; gap: 4px; }
.step { min-height: 30px; padding: 3px 10px; font-size: 13px; font-weight: 600; color: var(--text); background: #f1eee6; border: 1px solid transparent; border-radius: 20px; cursor: pointer; }
.step:hover { border-color: var(--ink); }
.step[aria-current] { background: var(--ink); color: #fff; }
.step.won[aria-current] { background: var(--good); }
.step.lost[aria-current] { background: var(--red); }
.chips { margin-bottom: 12px; }
.head .chips { margin-bottom: 0; }
.chip { min-height: 32px; padding: 4px 12px; font-size: 13px; font-weight: 600; color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: 20px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Getting past the menu, screen-reader-only text, first load */
.skip { position: fixed; left: 12px; top: -60px; z-index: 20; padding: 8px 12px; font-weight: 600; background: var(--yellow); color: var(--ink); border: 0; border-radius: 8px; }
.skip:focus { top: 12px; }
.main:focus { outline: none; }
.hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.booting { padding: 40px; text-align: center; color: var(--muted); }

/* Sign-in pages */
.gate { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; justify-items: center; gap: 24px; padding: 24px; background: var(--ink); }
.gate-brand { color: #dcd9d1; font-size: 18px; }
.wordmark { font: 900 clamp(56px, 8vw, 104px)/.9 var(--display); letter-spacing: .01em; color: var(--yellow); }
.gate-brand p { margin-top: 10px; }
.gate .card { width: min(400px, 100%); padding: 26px; display: grid; gap: 16px; }
.gate h1 { font: 700 20px/1.2 var(--body); text-transform: none; letter-spacing: 0; }
.phone-only { display: none; }
.error { color: var(--red); font-size: 14px; font-weight: 500; }

/* Dialog and toasts */
dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 12px; color: var(--text); }
dialog::backdrop { background: rgba(23, 23, 26, .5); }
dialog form { display: grid; gap: 14px; padding: 20px; }
dialog h2 { font-size: 18px; }
.secret { padding: 10px; background: #f1eee6; border-radius: 8px; font: 13px/1.4 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 10; display: grid; gap: 8px; max-width: min(340px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 8px; font-size: 14px; }
.toast.bad { background: var(--red); }

/* Reports */
.stats.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat .note { display: block; margin-top: 2px; }
.stats.six .stat b { font-size: 30px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.team-table { margin-top: 16px; overflow-x: auto; }
.card > header small { display: block; font-weight: 400; }
.chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { font: 11px var(--body); fill: var(--muted); }
.chart .hit { fill: transparent; }
.bar { fill: var(--blue); }
.mark:hover .bar, .hbars li:hover .bar { fill: #1b2596; }
.hbars { display: grid; gap: 8px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 14px; }
.hlabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hvalue { min-width: 2ch; text-align: right; font-weight: 600; color: var(--ink); }
.numbers { margin-top: 8px; font-size: 13px; color: var(--muted); }
.numbers summary { cursor: pointer; }
.numbers .table td, .numbers .table th { padding: 5px 8px; }
#tip { position: fixed; z-index: 30; padding: 5px 9px; font-size: 13px; color: #fff; background: var(--ink); border-radius: 6px; pointer-events: none; }
#tip[hidden] { display: none; }

/* Alerts, filters, the audit answers */
.badge { display: inline-block; min-width: 20px; padding: 0 6px; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; color: var(--ink); background: var(--yellow); border-radius: 10px; }
.badge[hidden] { display: none; }
.nav a[aria-current="page"] .badge { background: var(--ink); color: #fff; }
.list > li.fresh { background: #fff8d9; }
.filters { margin-bottom: 12px; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.facts div:last-child:nth-child(4), .facts div:last-child:nth-child(1) { grid-column: 1 / -1; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.attribution { padding: 8px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.tag.webhook, .tag.find, .tag.csv { background: #eceaf9; color: #2a2f8a; }

@media (pointer: coarse) {
  .btn, input, select { min-height: 44px; }
  .btn.sm, .step, .chip { min-height: 40px; }
  .link { display: inline-block; padding: 8px 0; }
  input[type="checkbox"] { width: 24px; height: 24px; min-height: 24px; }
}

@media (max-width: 860px) {
  .gate { grid-template-columns: minmax(0, 1fr); align-content: center; }
  .wordmark { font-size: 56px; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; overflow-x: visible; }
  .column { min-height: 0; }
  .column:has(.column-empty) { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; overflow-x: auto; }
  .mark span, .who { display: none; }
  .phone-only { display: inline-flex; }
  .mark { padding: 0; font-size: 22px; }
  .nav { grid-auto-flow: column; }
  .nav a { padding: 6px 9px; white-space: nowrap; }
  .main { padding: 18px 16px 48px; }
  .cols, .stats { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat b { font-size: 24px; }
  .stats.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .facts { grid-template-columns: minmax(0, 1fr); }
  .table td, .table th { padding-left: 12px; padding-right: 12px; }
  .fields.two { grid-template-columns: minmax(0, 1fr); }
  .table th:nth-child(n+3), .table td:nth-child(n+3) { display: none; }
  .search { max-width: none; }
}

@media (max-width: 480px) {
  .side .mark { display: none; }
  .nav { width: 100%; justify-content: space-between; }
}
