/* CRM styles. Colors that change per client come from theme.css (built from crm.config.json).
   Design notes: docs/design.md. Big type, strong contrast, 48px+ tap targets, no drag. */

@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("/fonts/atkinson-next-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Mono"; src: url("/fonts/atkinson-mono-latin.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --ink: #1c2230;
  --ink-muted: #4a5266;
  --paper: #ffffff;
  --drawer: #edf0f4;
  --rule: #cbd2dc;
  --today: #fde68a;
  --focus: #ffd84d;
  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, Menlo, monospace;
  --text: clamp(1.125rem, 1.05rem + 0.25vw, 1.25rem);
  --small: 1rem;
  --h1: clamp(1.875rem, 1.5rem + 1.5vw, 2.5rem);
  --h2: clamp(1.25rem, 1.15rem + 0.4vw, 1.5rem);
  --tap: 3rem;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--drawer); color: var(--ink); font: 400 var(--text)/1.55 var(--font); }
h1, h2, h3, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
a { color: var(--primary); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.money { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(100% - 2rem, 76rem); margin-inline: auto; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus); }
.skip-link { position: absolute; left: 1rem; top: -4rem; background: var(--paper); padding: 0.75rem 1rem; z-index: 20; }
.skip-link:focus { top: 0.5rem; }

/* ---- top bar ---- */
.topbar { background: var(--primary); color: #fff; }
.topbar-in { display: flex; align-items: center; gap: 0.75rem 1.25rem; min-height: 4rem; flex-wrap: wrap; }
.biz { color: #fff; font-weight: 800; font-size: 1.25rem; text-decoration: none; letter-spacing: -0.01em; }
.demo-tag { background: #fff; color: var(--ink); font-weight: 800; font-size: var(--small); padding: 0.1rem 0.55rem; border-radius: 4px; }
.tabs { display: none; margin-left: auto; gap: 0.25rem; }
.tabs a { color: #fff; text-decoration: none; padding: 0.6rem 0.9rem; border-radius: var(--radius); font-weight: 600; min-height: var(--tap); display: inline-flex; align-items: center; }
.tabs a:hover { background: rgb(255 255 255 / 0.12); }
.tabs a[aria-current="page"] { background: #fff; color: var(--ink); }
.signout { margin-left: auto; }
.tabs + .signout { margin-left: 0; }
.linkish { background: none; border: 0; color: #fff; font: inherit; font-size: var(--small); text-decoration: underline; cursor: pointer; min-height: var(--tap); }
.demo-note .wrap { display: block; }
.demo-note { background: var(--paper); border-bottom: 1px solid var(--rule); font-size: var(--small); padding: 0.6rem 0; color: var(--ink); }

/* bottom bar (phones) */
.bottombar { position: fixed; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper); border-top: 2px solid var(--ink); z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
.bottombar a { display: flex; align-items: center; justify-content: center; min-height: 3.5rem; color: var(--ink); text-decoration: none; font-weight: 600; font-size: var(--small); }
.bottombar a[aria-current="page"] { color: var(--primary); box-shadow: inset 0 4px 0 var(--primary); font-weight: 800; }
body:has(.bottombar) .main { padding-bottom: 6rem; }
@media (min-width: 52rem) {
  .tabs { display: flex; }
  .bottombar { display: none; }
  body:has(.bottombar) .main { padding-bottom: 4rem; }
}

/* ---- page ---- */
.main { padding-block: 1.75rem 4rem; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: var(--h1); line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.page-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.page-sub { margin-top: 0.35rem; color: var(--ink-muted); }
.back { margin-bottom: 0.5rem; font-size: var(--small); }
h2 { font-size: var(--h2); line-height: 1.25; font-weight: 800; }
.flash { background: var(--paper); border-left: 6px solid var(--primary); padding: 0.75rem 1rem; margin-bottom: 1rem; }
.error { background: var(--paper); border-left: 6px solid var(--due); color: var(--due); font-weight: 700; padding: 0.75rem 1rem; margin-bottom: 1rem; }
.hint { font-size: var(--small); color: var(--ink-muted); margin-top: 0.35rem; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: var(--tap); padding: 0.55rem 1.1rem; border-radius: var(--radius); border: 2px solid var(--ink); background: var(--paper); color: var(--ink); font: 700 var(--text)/1.2 var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--drawer); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-quiet { border-width: 1px; border-color: var(--rule); font-weight: 600; }
.btn-small { min-height: 2.75rem; padding: 0.4rem 0.9rem; font-size: var(--small); }
.btn-wide { width: 100%; }
.btn-call { font-size: 1.125rem; }
.btn-call .mono { font-weight: 600; }

/* ---- due tags ---- */
.due { display: inline-block; font-size: var(--small); font-weight: 700; padding: 0.05rem 0.5rem; border-radius: 4px; white-space: nowrap; }
.due-overdue { color: #fff; background: var(--due); }
.due-today { background: var(--today); color: var(--ink); }
.due-soon, .due-later { color: var(--ink-muted); padding-inline: 0; }
.due-none { color: var(--ink-muted); font-weight: 400; padding-inline: 0; }
.stage-tag { font-size: var(--small); color: var(--ink-muted); margin-left: 0.6rem; }

/* ---- Today sheet (the one raised paper object) ---- */
.sheet { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 0 3px 0 var(--ink); }
.sheet-h { padding: 0.9rem 1.1rem; border-bottom: 2px solid var(--ink); }
.call-row { position: relative; display: grid; gap: 1rem; padding: 1.1rem; border-bottom: 1px solid var(--rule); }
.call-row:last-child { border-bottom: 0; }
.call-due { margin-bottom: 0.35rem; }
.call-who { font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem); line-height: 1.2; font-weight: 800; }
.call-who a { color: var(--ink); text-decoration: none; }
.call-who a:hover { text-decoration: underline; }
.call-what { margin-top: 0.25rem; }
.call-note { margin-top: 0.5rem; padding-left: 0.8rem; border-left: 3px solid var(--rule); color: var(--ink-muted); }
.call-actions { display: grid; gap: 0.75rem; align-content: start; }
.call-actions .btn-call { width: 100%; }
.done-form legend { font-size: var(--small); font-weight: 700; margin-bottom: 0.4rem; }
.choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.choice-row .btn { padding-inline: 0.4rem; font-size: var(--small); }
@media (min-width: 52rem) {
  .call-row { grid-template-columns: minmax(0, 1fr) 20rem; gap: 2rem; padding: 1.25rem 1.5rem; }
}
.empty { padding: 2rem 1.1rem; text-align: center; }
.empty-big { font-size: var(--h2); font-weight: 800; margin-bottom: 0.4rem; }

/* the Done stamp: the one orchestrated motion */
.call-row.is-done { overflow: hidden; }
.stamp { position: absolute; top: 50%; right: 1.5rem; translate: 0 -50%; rotate: -8deg; border: 4px solid var(--primary); color: var(--primary); font: 800 1.75rem/1 var(--font); letter-spacing: 0.06em; padding: 0.3rem 0.8rem; border-radius: 6px; background: rgb(255 255 255 / 0.92); animation: stamp 0.35s cubic-bezier(.2,1.4,.4,1) both; pointer-events: none; }
.stamp small { display: block; font-size: 0.85rem; letter-spacing: 0; font-weight: 700; margin-top: 0.15rem; }
@keyframes stamp { from { scale: 1.8; opacity: 0; } to { scale: 1; opacity: 1; } }
.call-row.is-folding { animation: fold 0.45s ease 0.9s forwards; }
@keyframes fold { to { opacity: 0; max-height: 0; padding-block: 0; } }
@media (prefers-reduced-motion: reduce) {
  .stamp, .call-row.is-folding { animation: none; }
}

/* ---- rows (customers, coming up, lists) ---- */
.soon { margin-top: 2rem; }
.soon h2 { margin-bottom: 0.75rem; }
.rows { background: var(--paper); border-top: 2px solid var(--ink); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 1rem; align-items: center; padding: 0.85rem 0.25rem; border-bottom: 1px solid var(--rule); }
.row > a:first-child { color: var(--ink); text-decoration: none; display: flex; flex-wrap: wrap; gap: 0 0.6rem; align-items: baseline; min-height: var(--tap); align-content: center; }
.row > a:first-child span { color: var(--ink-muted); }
.row > a:first-child:hover strong { text-decoration: underline; }
.panel .rows { border-top-width: 1px; }
.row-3 { grid-template-columns: minmax(0, 1fr) auto; }
.row-3 > :last-child { grid-column: 1 / -1; justify-self: start; margin-top: -0.4rem; }
.call-line { margin-bottom: 1rem; }
@media (min-width: 40rem) { .row-3 { grid-template-columns: minmax(0, 1fr) auto 8rem; } .row-3 > :last-child { grid-column: auto; justify-self: end; margin-top: 0; } }
.people .row { grid-template-columns: minmax(0, 1fr) auto; }
.people .row .muted { grid-column: 1 / -1; font-size: var(--small); margin-top: -0.6rem; }
.people .phone { font-size: var(--small); }
@media (min-width: 52rem) {
  .rows .row { padding-inline: 1rem; }
  .people .row { grid-template-columns: minmax(0, 1fr) 12rem 9rem; }
  .people .row .muted { grid-column: auto; margin-top: 0; text-align: right; }
}

/* ---- board ---- */
.jump { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.jump a { display: inline-flex; gap: 0.4rem; align-items: center; min-height: 2.75rem; padding: 0.3rem 0.8rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); text-decoration: none; font-size: var(--small); font-weight: 600; }
.board { display: grid; gap: 1.5rem; align-items: start; }
.lane { background: var(--drawer); scroll-margin-top: 1rem; }
.lane-h { display: flex; justify-content: space-between; align-items: baseline; padding: 0.5rem 0.1rem 0.6rem; border-bottom: 3px solid var(--ink); }
.count { font-size: var(--small); color: var(--ink-muted); font-weight: 600; }
.cards { display: grid; gap: 0.6rem; margin-top: 0.75rem; }
.card { background: var(--paper); border: 1px solid var(--rule); border-left: 5px solid var(--primary); border-radius: var(--radius); padding: 0.85rem 0.9rem; transition: background-color 0.3s; }
.card.is-moved { background: #fff8d6; }
.card-who { font-weight: 800; color: var(--ink); text-decoration: none; font-size: 1.125rem; }
.card-who:hover { text-decoration: underline; }
.card-what { color: var(--ink-muted); font-size: var(--small); margin-top: 0.15rem; }
.card-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 0.75rem; margin-top: 0.4rem; font-size: var(--small); }
.move-form { margin-top: 0.7rem; }
.move-form label { display: block; font-size: var(--small); font-weight: 700; margin-bottom: 0.25rem; }
.move-row { display: flex; gap: 0.5rem; }
.move-row select { flex: 1; min-width: 0; min-height: 2.75rem; font-size: var(--small); }
.lane-empty { color: var(--ink-muted); font-size: var(--small); padding: 0.9rem 0.1rem; }
.closed-links { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; font-weight: 700; }
@media (min-width: 52rem) {
  .jump { display: none; }
  .board { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.25rem; }
}

/* ---- panels, facts, forms ---- */
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1.25rem; }
.panel > h2, .panel-head { margin-bottom: 0.85rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.split { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 60rem) { .split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); } .panel { padding: 1.4rem; } }
.facts { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.facts div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 0.75rem; align-items: baseline; border-bottom: 1px dashed var(--rule); padding-bottom: 0.4rem; }
.facts dt { color: var(--ink-muted); font-size: var(--small); }
.facts dd { overflow-wrap: anywhere; }
.panel .done-form { margin-top: 1rem; }
details.edit { margin-top: 1rem; }
details.edit summary { cursor: pointer; font-weight: 700; color: var(--primary); min-height: var(--tap); display: flex; align-items: center; }
details.panel.edit summary { min-height: auto; }
details.edit[open] summary { margin-bottom: 0.85rem; }
.field { display: grid; gap: 0.3rem; }
.field label { font-weight: 700; font-size: var(--small); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--paper); border: 2px solid var(--ink-muted); border-radius: var(--radius); padding: 0.55rem 0.7rem; min-height: var(--tap); width: 100%; }
textarea { min-height: 6rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--ink); }
.grid-form { display: grid; gap: 1rem; }
@media (min-width: 40rem) { .grid-form { grid-template-columns: 1fr 1fr; } .field-wide { grid-column: 1 / -1; } }
.search { display: grid; gap: 0.3rem; margin-bottom: 1.25rem; max-width: 36rem; }
.search label { font-weight: 700; font-size: var(--small); }
.search-row { display: flex; gap: 0.5rem; }
.note-form { display: grid; gap: 0.75rem; margin-bottom: 1.25rem; }
.note-form .btn { justify-self: start; }

/* ---- notes timeline ---- */
.notes { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem; }
@media (min-width: 60rem) { .notes { padding: 1.4rem; } }
.notes h2 { margin-bottom: 0.85rem; }
.timeline { border-left: 3px solid var(--rule); margin-left: 0.35rem; }
.note { position: relative; padding: 0 0 1rem 1.1rem; }
.note::before { content: ""; position: absolute; left: -0.5rem; top: 0.45rem; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--paper); border: 3px solid var(--primary); }
.note-stage::before, .note-followup::before { border-color: var(--rule); }
.note-when { font-size: var(--small); color: var(--ink-muted); }
.note-job { font-family: var(--font); margin-left: 0.4rem; }
.note-stage .note-body, .note-followup .note-body { color: var(--ink-muted); font-size: var(--small); }

/* ---- export, login, messages ---- */
.export-list { display: grid; gap: 0.75rem; max-width: 26rem; }
.export-list .btn { width: 100%; }
.login { max-width: 28rem; margin: 2rem auto; display: grid; gap: 1rem; }
.login h1, .message h1 { font-size: var(--h1); line-height: 1.1; }
.login form { display: grid; gap: 1rem; }
.login pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--drawer); padding: 0.75rem; border-radius: var(--radius); font-size: var(--small); }
.message { max-width: 40rem; display: grid; gap: 1rem; }

/* ---- toast (demo and saved messages) ---- */
.toast { position: fixed; left: 50%; bottom: 5rem; translate: -50% 0; width: min(100% - 2rem, 32rem); background: var(--ink); color: #fff; padding: 0.85rem 1.1rem; border-radius: var(--radius); font-size: var(--small); z-index: 30; box-shadow: 0 4px 0 rgb(0 0 0 / 0.25); }
@media (min-width: 52rem) { .toast { bottom: 2rem; } }
