/* Valya workbench — the digest's palette (delivery/digest.py INK/MUTED/LINE/
   ACCENT/BG/CARD/GOLD/GREEN/RED) so the page looks like the e-mail Kevin
   already trusts. One column under 1000 px; wide tables scroll inside their
   own container so the page never scrolls sideways at 1366×768. */

:root {
  --ink: #23201d;
  --muted: #6b635c;
  --line: #e4dfd9;
  --accent: #8c4a2f;
  --bg: #f5f4f2;
  --card: #ffffff;
  --gold: #c9a227;
  --green: #2f7d4f;
  --red: #a8331f;
  --soft: #faf8f6;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
ul, ol { margin: 0 0 8px; padding-left: 20px; }
dl { margin: 0; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.caption { font-size: 12px; color: var(--muted); font-weight: 400; }
.upper { text-transform: uppercase; letter-spacing: .06em; font-weight: 700; font-size: 11px; }
.notice { background: var(--soft); border-left: 3px solid var(--gold); padding: 8px 12px; border-radius: 0 4px 4px 0; }
.error { color: var(--red); }
.error:empty { display: none; }
.saved { font-size: 12px; color: var(--green); margin-left: 8px; }
.prose { white-space: pre-wrap; }

/* header ------------------------------------------------------------------ */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 20px; min-height: 52px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--accent); text-decoration: none; font-size: 16px; }
.brand span { color: var(--muted); font-weight: 400; }
.pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pages a { padding: 6px 10px; text-decoration: none; color: var(--ink); border-radius: 4px; }
.pages a.active { background: var(--bg); font-weight: 700; }
.who { margin-left: auto; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.tab { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }

main { padding: 18px 0 40px; }
.foot { padding: 20px 16px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* cards, blocks ----------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin: 0 0 16px; }
.block { margin: 0 0 24px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-rule { border-top: 2px solid var(--line); padding-top: 12px; margin: 20px 0 8px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; }
.breadth { font-size: 14px; margin: 0 0 20px; }
.crumb { font-size: 12px; margin-bottom: 8px; }

/* chips ------------------------------------------------------------------- */
.chip {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 3px; vertical-align: middle;
  background: #f0eeec; color: var(--ink); white-space: nowrap; text-decoration: none;
}
.chip.accent { background: var(--accent); color: #fff; }
.chip.red { background: var(--red); color: #fff; }
.chip.green { background: var(--green); color: #fff; }
.chip.gold { background: var(--gold); color: #fff; }
.chip.outline { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.chip.choice { border: 1px solid var(--line); background: var(--card); cursor: pointer; font-family: var(--font); }
.chip.choice.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* tables ------------------------------------------------------------------ */
.scroll-x { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.rows { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table.rows th, table.rows td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.rows th { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
table.rows th .caption { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; }
table.rows td.num, table.rows th.num { text-align: right; }
table.rows tr.touched td { color: var(--muted); }
table.rows tr.touched td a { color: var(--accent); }
table.rows td.empty { text-align: center; padding: 20px; }
table.rows td.actions { white-space: nowrap; }
.prospects-table { min-width: 960px; }
.signals-table { min-width: 720px; }
.signals-table td.marker { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }

/* buttons and forms ------------------------------------------------------- */
button, .button {
  font-family: var(--font); font-size: 13px; padding: 7px 14px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.2;
}
button.small, .button.small { padding: 4px 9px; font-size: 12px; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
button.primary.green { background: var(--green); border-color: var(--green); }
button.outline.red { color: var(--red); }
button.selected { outline: 3px solid var(--gold); }
button.link { background: none; border: none; color: var(--accent); padding: 0 2px; text-decoration: underline; font-size: inherit; }
button[disabled] { opacity: .55; cursor: default; }
form.inline, label.inline { display: inline-flex; align-items: center; gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
label > input, label > select, label > textarea {
  display: block; width: 100%; margin-top: 3px; font-family: var(--font); font-size: 14px;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: var(--card);
}
label.inline > select, label.inline > input { display: inline-block; width: auto; margin-top: 0; }
label > textarea { resize: vertical; }
label > input[type="date"] { width: auto; display: inline-block; margin-right: 8px; }
fieldset.segmented { border: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 0; }
fieldset.segmented legend { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
fieldset.segmented label { margin: 0; }
fieldset.segmented input { position: absolute; opacity: 0; width: 0; height: 0; }
fieldset.segmented span { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); margin-left: -1px; cursor: pointer; font-size: 13px; color: var(--ink); background: var(--card); }
fieldset.segmented label:first-of-type span { border-radius: 5px 0 0 5px; margin-left: 0; }
fieldset.segmented label:last-of-type span { border-radius: 0 5px 5px 0; }
fieldset.segmented input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
fieldset.segmented input:focus-visible + span { outline: 2px solid var(--gold); }
.form-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.login { max-width: 420px; margin: 40px auto; }

/* prospect page ----------------------------------------------------------- */
.prospect-head { display: flex; gap: 24px; justify-content: space-between; flex-wrap: wrap; }
.head-main { flex: 1 1 520px; min-width: 0; }
.head-side { flex: 0 0 220px; }
.meta { margin: 0 0 4px; }
.score .big { font-size: 34px; font-weight: 700; line-height: 1; color: var(--accent); }
.factors { padding-left: 18px; margin: 6px 0; }
details.why summary, details.compare summary, details.echo summary { cursor: pointer; color: var(--accent); }
.status-control select { margin-top: 3px; }
.website-form[hidden] { display: none; }
.website-form input { width: 260px; max-width: 100%; display: inline-block; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; }
.distance { padding: 12px 18px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.col-main, .col-side { min-width: 0; }
.col-side .call-sheet { position: sticky; top: 12px; }

.brief-body { font-size: 14px; }
.brief-body a { color: var(--accent); }
.challenger { opacity: .85; border-left: 3px solid var(--line); padding-left: 12px; margin-top: 8px; }

.call-sheet h3 { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.call-sheet .label { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 0 2px; }
.reach { list-style: none; padding: 0; margin: 6px 0 0; }
.reach li { padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.reach .name { font-weight: 600; margin-right: 6px; }
.reach a { margin-right: 4px; }
.searches, .ask-for { padding-left: 18px; font-size: 13px; }
.verdict-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.verdict-reason[hidden] { display: none; }

.timeline-list { list-style: none; padding: 0; margin: 0; }
.timeline-list li { display: grid; grid-template-columns: 130px 90px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: start; }
.timeline-list .when { font-size: 12px; color: var(--muted); }
.timeline-list .notes { white-space: pre-wrap; margin-top: 2px; }
.timeline-list .done { color: var(--green); }
.timeline-list li.fresh { background: #fbf6e6; }

dl.facts { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 2px 10px; font-size: 13px; margin: 8px 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.dmr-line { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
tr.stormwater td.signal-cell strong { color: var(--muted); }

/* map --------------------------------------------------------------------- */
.map-panel { margin: 8px 0 16px; }
.map { height: 360px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
.map-body[hidden] { display: none; }
.map-fallback { margin: 6px 0; }
.pin-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; }
.pin-list li { padding: 3px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.home-marker { font-size: 18px; line-height: 1; text-align: center; color: var(--ink); text-shadow: 0 0 3px #fff; }
.pin-popup { font-size: 12px; line-height: 1.4; }

/* tenders ----------------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; }
.tender h3 { font-size: 15px; }
.tender.past { opacity: .7; }
.tender-facts { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 2px 10px; font-size: 13px; margin: 8px 0; }
.tender-facts dt { color: var(--muted); }
.tender-facts dd { margin: 0; overflow-wrap: anywhere; }
.tender-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.frame-card:empty { display: none; }
/* the proposal-frame partial (partials/frame.html) */
.frame-banner, .banner { background: #fbf1dc; border-left: 3px solid var(--gold); padding: 8px 12px; font-weight: 600; margin-bottom: 10px; border-radius: 0 4px 4px 0; }
.frame-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.button-secondary, .button.secondary, button.secondary { background: var(--card); }
.frame-inner { min-width: 0; }

/* the audit page (audit.html) */
.table-scroll { overflow-x: auto; max-width: 100%; }
table.audit { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); font-size: 13px; }
table.audit th, table.audit td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.audit th { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.audit-row summary { cursor: pointer; color: var(--accent); }
.audit-detail { background: var(--soft); padding: 8px 12px; border-radius: 6px; margin: 6px 0; }
.audit-text { white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; max-height: 360px; overflow: auto; }
.audit-dict { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 2px 10px; }
.audit-dict dt { color: var(--muted); }
.audit-dict dd { margin: 0; }
.frame-body h3 { margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.frame-body h4 { margin: 8px 0 4px; font-size: 13px; }
.frame-phase { background: var(--soft); border-radius: 6px; padding: 8px 12px; margin-bottom: 8px; }
.frame-phase-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.frame-verdict-go strong { color: var(--green); }
.frame-verdict-no_go strong { color: var(--red); }
.frame-verdict-clarify strong { color: var(--gold); }
.frame-history { list-style: none; padding: 0; font-size: 13px; }
.frame-history li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.chip-done { background: var(--green); color: #fff; }
.chip-running { background: var(--gold); color: #fff; }
.chip-failed, .chip-stale { background: var(--red); color: #fff; }

/* note from anywhere ------------------------------------------------------- */
/* Every note control is an icon plus a verb; the icon inherits currentColor. */
.note-link, .note-btn { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
a.note-link { text-decoration: none; }
a.note-link:hover, a.note-link:focus-visible { text-decoration: underline; }
button.note-btn.link { text-decoration: none; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.head-actions .button, .head-actions button { display: inline-flex; align-items: center; gap: 5px; }
.row-actions { margin-top: 4px; font-size: 12px; }
table.rows th.note-col, table.rows td.note-col { width: 1%; padding-left: 6px; padding-right: 6px; text-align: center; }
table.rows td.note-col .ico { width: 1.15em; height: 1.15em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pin-list .note-link { margin-left: 6px; font-size: 12px; }
.pin-popup .note-link { display: inline-flex; margin-top: 2px; }
/* The 600 ms flash when the form is reached: an outline, so the sticky call
   sheet's layout never shifts by a border width. */
form.record { border-radius: 8px; outline: 3px solid transparent; outline-offset: 6px; transition: outline-color .2s ease; }
form.record.flash { outline-color: var(--accent); }
/* Floating Note — bottom right, only while #record is out of view (JS). Above
   Leaflet's controls (z-index 1000) so a map never covers it. */
.note-float {
  position: fixed; right: 20px; bottom: 20px; z-index: 1100;
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 999px;
  background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; font-size: 14px;
  box-shadow: 0 4px 14px rgba(35, 32, 29, .25);
}
.note-float .ico { width: 1.15em; height: 1.15em; }
.note-float:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.note-float[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  form.record { transition: none; }
}

/* changes ----------------------------------------------------------------- */
.changes { list-style: none; padding: 0; }
.changes li { padding: 5px 0; border-bottom: 1px solid var(--line); }

/* one column under 1000 px --------------------------------------------------- */
@media (max-width: 999px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .col-side .call-sheet { position: static; }
  .head-side { flex-basis: 100%; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .timeline-list li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* print: the call sheet alone ------------------------------------------------ */
@media print {
  body { background: #fff; font-size: 12px; }
  .top, .foot, .distance, .brief, .timeline, .signals, .record, .verdict, .breadth, button, .map-panel, .note-float, .note-link, .head-actions { display: none !important; }
  .two-col { display: block; }
  .call-sheet { position: static !important; border: none; padding: 0; }
  .prospect-head { border: none; padding: 0; }
  a { color: var(--ink); text-decoration: none; }
  .reach a::after { content: ""; }
}

/* Verified prep — the "Prep this call" panel (2 Sep 2026). */
.prep { border-top: 1px solid var(--line, #e5e0d8); margin-top: 16px; padding-top: 12px; }
.prep .prep-verdict { margin: 8px 0; }
.prep .prep-correction { border-left: 3px solid #b4552f; padding: 6px 10px; margin: 8px 0; background: rgba(180, 85, 47, 0.06); }
.prep .prep-correction.sev-low { border-left-color: #c9a227; background: rgba(201, 162, 39, 0.07); }
.prep .prep-correction p { margin: 2px 0; }
.prep .prep-confirmed { margin: 4px 0 10px; padding-left: 18px; }
.prep .prep-contact { margin: 3px 0; }
.prep .label { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted, #6b635c); margin-top: 10px; font-weight: 700; }

/* Outreach drafts under a contact (23 Sep 2026). */
.contacts .reach .drafts { display: block; font-size: 12px; color: var(--muted, #6b635c); margin: 2px 0 0; }
.contacts .reach .drafts a { margin-left: 4px; }

/* Email this prospect (30 Sep 2026). Solid buttons: Kevin found the first,
   outlined version easy to miss. */
.email.card { margin-bottom: 16px; border-top: 4px solid var(--accent); }
.email.card h2 { margin-bottom: 4px; }
.email-contact { margin: 12px 0 0; padding: 12px; background: var(--soft); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; }
.email-contact p { margin: 4px 0; }
.email-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 8px !important; }
a.button.email-draft {
  display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box;
  padding: 10px 14px; font-size: 14px; font-weight: 600; text-decoration: none;
  background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 6px;
}
a.button.email-draft:hover, a.button.email-draft:focus-visible { background: #733c26; border-color: #733c26; }
.email-ico { font-size: 16px; line-height: 1; }
button.email-li {
  display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box;
  padding: 10px 14px; font-size: 14px; font-weight: 600;
  background: #0a66c2; color: #fff; border: 1px solid #0a66c2; border-radius: 6px;
}
button.email-li:hover, button.email-li:focus-visible { background: #084e96; border-color: #084e96; }
.li-badge { display: inline-block; background: #fff; color: #0a66c2; font-weight: 800; font-size: 11px; line-height: 1; padding: 2px 4px; border-radius: 3px; }
.email-linkedin { margin-top: 8px !important; }
a.button.email-jump { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; text-decoration: none; }
@media print { .email.card { display: none; } }
