/* Aeg Vaba CRM. Brand tokens from brand/identity-v1.md (direction A, Töökoda). */

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/static/fonts/hanken-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/static/fonts/hanken-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #ffffff;
  --ink: #1f2328;
  --muted: #4f5962;
  --accent: #1e5a3c;
  --accent-soft: rgb(30 90 60 / 0.09);
  --panel: #eeede7;
  --line: #d9d7d0;
  --error: #b23a2e;
  --error-soft: rgb(178 58 46 / 0.09);
  --font: "Hanken Grotesk", system-ui, sans-serif;
  --radius: 6px;
  --gutter: clamp(16px, 3vw, 32px);
  --fast: 150ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 1px 0 var(--line), 0 8px 24px -16px rgb(31 35 40 / 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
/* iPhone Safari: the page never pans sideways (clip, not hidden, so the sticky top bar still works),
   and long words, links and emails wrap instead of pushing the page wider. */
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.5 var(--font); min-height: 100dvh; overflow-wrap: break-word; }
button, input, select, textarea { font: inherit; color: inherit; }
/* Under 16px iOS zooms in on a tapped field and stays zoomed, so the page then scrolls side to side. */
input, select, textarea { font-size: max(16px, 1em); }
.facts dd, .row__title, .desk__company { overflow-wrap: anywhere; min-width: 0; }
a { color: var(--accent); }
h1 { font-size: clamp(26px, 2.4vw + 14px, 36px); letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 4px; font-weight: 700; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.error { color: var(--error); min-height: 1.4em; margin: 0; }
.empty { color: var(--muted); margin: 8px 0 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
.label, .card__title, .block__title, .field > span {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 10px var(--gutter); background: rgb(255 255 255 / 0.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 19px; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand span { color: var(--accent); }
.brand small { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); margin-left: 4px; }
.brand--big { font-size: 30px; margin: 0 0 24px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav__link {
  padding: 10px 12px; border-radius: var(--radius); color: var(--muted); text-decoration: none; font-weight: 600;
  white-space: nowrap; transition: color var(--fast), background var(--fast);
}
.nav__link:hover { background: var(--panel); color: var(--ink); }
.nav__link[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.user { display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }
.is-logged-out .topbar, .is-logged-out .fab { display: none; }
.main { padding: 24px var(--gutter) 120px; max-width: 1240px; margin: 0 auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform var(--fast) var(--ease), background var(--fast), border-color var(--fast);
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #174a31; border-color: #174a31; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn--danger { color: var(--error); border-color: var(--error); }
.btn--small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.fab {
  position: fixed; right: var(--gutter); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 20;
  min-height: 52px; padding: 0 22px; border-radius: 26px; border: 0; background: var(--ink); color: #fff;
  font-weight: 700; box-shadow: 0 10px 30px -10px rgb(31 35 40 / 0.6); cursor: pointer;
}
.fab:hover { background: var(--accent); }

/* Page head, chips, search */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px 24px; margin-bottom: 20px; }
.page-head__side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search { min-height: 44px; min-width: min(360px, 100%); padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filters { display: flex; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.filter { display: flex; flex-direction: column; gap: 4px; font-size: 14px; flex: 1 1 220px; max-width: 360px; }
.filter__label { color: var(--muted); font-weight: 600; }
.filter__select { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); width: 100%; }
.segment-table { overflow-x: auto; }
.segment-table table { border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; width: 100%; }
.segment-table th, .segment-table td { padding: 6px 12px 6px 0; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.segment-table th:first-child { text-align: left; white-space: normal; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  font-size: 14px; font-weight: 600; min-height: 36px; display: inline-flex; align-items: center;
}
.chip:hover { border-color: var(--ink); }
a.row__main { color: inherit; text-decoration: none; }
button.chip { background: transparent; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; }
.chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Funnel strip on Today */
.funnel { list-style: none; display: flex; gap: 0; padding: 0; margin: 0 0 32px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.funnel li { flex: 1 0 auto; border-right: 1px solid var(--line); }
.funnel li:last-child { border-right: 0; }
.funnel a { display: grid; gap: 2px; padding: 12px 16px; text-decoration: none; color: var(--ink); transition: background var(--fast); }
.funnel a:hover { background: var(--panel); }
.funnel strong { font-size: 26px; letter-spacing: -0.02em; line-height: 1; }
.funnel span { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Sections and lists */
.block { margin-bottom: 36px; }
.block__title { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.block__note { margin: 0 0 8px; font-size: 14px; }
.count { background: var(--panel); color: var(--ink); border-radius: 999px; padding: 1px 8px; letter-spacing: 0; }
.rows { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.row {
  display: flex; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap; padding: 14px 4px;
  border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; transition: background var(--fast);
}
a.row:hover { background: var(--panel); }
.row--static { align-items: center; }
.row__main { display: grid; gap: 2px; min-width: 0; flex: 1 1 280px; }
.row__title { font-weight: 700; letter-spacing: -0.01em; }
.row__meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.row__side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.row__next { font-size: 14px; }
.row__next.is-overdue { color: var(--error); font-weight: 600; }
.quote { margin-top: 6px; padding-left: 10px; border-left: 3px solid var(--line); white-space: pre-wrap; font-size: 14px; }

/* Stage badges: the green family for progress, plain for waiting, red for closed-lost */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel); white-space: nowrap; }
.badge--replied, .badge--talking, .badge--proposal { background: var(--accent-soft); color: var(--accent); }
.badge--agreed, .badge--paid { background: var(--accent); color: #fff; }
.badge--no, .badge--optout, .badge--bounced { background: var(--error-soft); color: var(--error); }
.tag { display: inline-block; padding: 1px 8px; border-radius: var(--radius); background: var(--panel); font-size: 12px; font-weight: 600; text-decoration: none; color: var(--ink); margin-right: 4px; }
.tag--warn { background: var(--error-soft); color: var(--error); }
.tag--open { background: var(--accent-soft); color: var(--accent); }
.opens { margin: 8px 0 0; }
.visits { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.visit { padding: 6px 0 6px 16px; border-left: 2px solid var(--accent); }
.visit--filter { border-left-color: var(--line); color: var(--muted); }
/* Care plan and go-live setup (lead-care.js, clients-view.js) */
.badge--care-free { background: var(--accent-soft); color: var(--accent); }
.badge--care-paying { background: var(--accent); color: #fff; }
.badge--care-cancelled { background: var(--error-soft); color: var(--error); }
.care-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.care-auto { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.care-auto input[name="care_hold"] { flex: 1; min-width: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 12px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.facts dd.facts__text { white-space: pre-wrap; font-weight: 400; }
.setup { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.setup-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.setup-row__label { grid-column: 1 / -1; font-size: 14px; }
.setup-row input[name="value"] { min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.setup-row.is-done .setup-row__label::before { content: "✓ "; color: var(--accent); }
.setup-row--static { grid-template-columns: 1fr; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Lead page */
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; font-weight: 600; }
.lead-head { margin-bottom: 24px; }
.sent-text { margin-top: 6px; }
.sent-text summary { cursor: pointer; font-weight: 600; }
.sent-text__body { white-space: pre-wrap; padding: 10px 12px; border-left: 3px solid var(--line); background: var(--panel); }
.desk-banner { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-left-color: var(--error); }
.call-banner { margin: 0 0 16px; padding: 12px 16px; border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.lead-head__stage { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.stage-select { min-height: 44px; padding: 0 12px; border-radius: var(--radius); border: 2px solid var(--accent); background: var(--bg); font-weight: 700; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.lead-grid__main, .lead-grid__side { display: grid; gap: 20px; min-width: 0; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--bg); box-shadow: var(--shadow); }
.lead-grid__side .card { background: #fbfaf7; box-shadow: none; }
.card__title { margin: 0 0 12px; }
.switches { list-style: none; margin: 12px 0 0; padding: 0; display: grid; }
.switches li + li { border-top: 1px solid var(--line); }
.switch { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; min-height: 44px; cursor: pointer; }
.switch input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.switch span { display: grid; gap: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.field { display: grid; gap: 4px; }
.field--wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.quick { display: flex; gap: 4px; }
.quick .btn { white-space: nowrap; padding: 0 10px; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 0; min-height: 32px; }
details[open] > summary { margin-bottom: 8px; }
.contacts { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 14px; }
.contact__links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.touch { padding: 12px 0 12px 16px; border-left: 2px solid var(--line); position: relative; }
.touch::before { content: ""; position: absolute; left: -6px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.touch--email_in::before, .touch--call::before, .touch--meeting::before { background: var(--accent); }
.touch__head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.touch__body { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.history { font-size: 13px; color: var(--muted); }
.history ul { padding-left: 18px; margin: 0; }

/* Login */
.login { max-width: 400px; margin: 10vh auto 0; display: grid; gap: 14px; }
.login__title { font-size: 22px; }

/* Dialog */
.sheet { border: 0; border-radius: 10px; padding: 24px; width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-shadow: 0 30px 80px -20px rgb(31 35 40 / 0.5); }
.sheet::backdrop { background: rgb(31 35 40 / 0.45); }
.sheet__title { grid-column: 1 / -1; margin: 0; font-size: 22px; letter-spacing: -0.02em; }

/* Toasts */
.toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius); font-weight: 600; animation: rise 200ms var(--ease); }
.toast--error { background: var(--error); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 820px) {
  .lead-grid { grid-template-columns: 1fr; }
  .topbar { gap: 12px; }
  .brand small, .user { display: none; }
  .row__side { align-items: flex-start; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Dashboard (dashboard.js): one hue, the accent; text stays in ink tokens */
.links-row { display: flex; flex-wrap: wrap; gap: 8px; }
.goals, .tiles, .hbars { list-style: none; margin: 0; padding: 0; }
.goals { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.goal { display: grid; gap: 6px; }
.goal__head { display: grid; gap: 2px; }
.goal__value { font-variant-numeric: tabular-nums; font-weight: 600; }
.goal__when { font-size: 13px; }
.meter { height: 10px; border-radius: 999px; background: var(--panel); overflow: hidden; }
.meter__fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.goal--upcoming .meter__fill { background: var(--muted); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 8px; }
.tile { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.tile__label { font-size: 13px; color: var(--muted); }
.tile__value { font-size: 28px; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile__note { font-size: 13px; color: var(--muted); }
.hbars { display: grid; gap: 6px; max-width: 720px; }
.hbar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 14px; }
.hbar__track { height: 14px; }
.hbar__fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar__value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.cols { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; align-items: end; height: 140px; max-width: 720px; border-bottom: 1px solid var(--line); }
.col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.col__bar { width: 100%; max-width: 28px; background: var(--accent); border-radius: 4px 4px 0 0; }
.col__day { position: relative; top: 18px; font-size: 11px; color: var(--muted); height: 0; }
.table-view { margin-top: 26px; }
.table-view table { border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { padding: 4px 14px 4px 0; text-align: left; border-bottom: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }
/* Prototypes (prototypes-view.js) */
.proto__links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
@media (max-width: 520px) { .hbar { grid-template-columns: 110px minmax(0, 1fr) 36px; font-size: 13px; } }
/* Six tabs do not fit beside the brand on a phone: the nav gets its own row, tabs share the width. */
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 4px 12px; padding-bottom: 0; }
  .topbar .brand { order: 1; }
  .user { order: 2; margin-left: auto; }
  .nav { order: 3; flex: 1 0 100%; gap: 0; }
  .nav__link { flex: 1 0 auto; padding: 10px 4px; text-align: center; font-size: 13px; }
}

/* Invoices on a client's lead page (lead-invoices.js) */
.invoices { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
.invoice { padding: 8px 0; border-bottom: 1px solid var(--line); }
.invoice__head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.invoice__meta { margin: 2px 0 6px; font-size: 13px; }
.invoice__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.invoice-new > summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.invoice-lines { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.invoice-line { display: grid; grid-template-columns: minmax(0, 1fr) 64px 64px 96px auto; gap: 6px; align-items: center; }
.invoice-line input, .invoice-line select { min-width: 0; min-height: 40px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.invoice-line input:focus, .invoice-line select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.invoice-total { margin: 0; }
@media (max-width: 520px) {
  .invoice-line { grid-template-columns: 1fr 1fr 1fr auto; }
  .invoice-line [name="description"] { grid-column: 1 / -1; }
}

/* Reply desk approve page (/desk/<id>, app/desk.py): one column, thumb-sized buttons */
.desk { max-width: 680px; display: grid; gap: 14px; padding-bottom: 48px; }
.desk__company { font-size: 24px; margin: 0; letter-spacing: -0.02em; }
.desk__label { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 8px; }
.desk__text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.desk__draft { font-size: 16px; line-height: 1.55; }
.desk__why { margin: 12px 0 0; font-size: 14px; }
.desk__actions { display: grid; gap: 10px; }
.desk__form { display: grid; gap: 10px; margin: 0; }
.desk__form .btn, .desk__edit > summary.btn, .desk__call { width: 100%; min-height: 52px; font-size: 17px; justify-content: center; }
.desk__edit > summary.btn { display: flex; align-items: center; list-style: none; color: var(--ink); padding: 0 16px; }
.desk__edit > summary::-webkit-details-marker { display: none; }
.desk__edit .field textarea { font: inherit; font-size: 16px; line-height: 1.5; }
.desk__call { display: flex; align-items: center; text-decoration: none; }
.desk__done { font-size: 18px; font-weight: 700; color: var(--accent); margin: 8px 0; }
.desk__message { font-weight: 600; }

/* Enquiry records (enquiries-view.js) */
.badge--enquiry-new { background: var(--accent); color: #fff; }
.badge--enquiry-seen { background: var(--accent-soft); color: var(--accent); }
.enquiry__snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.enquiry__contact { font-weight: 600; overflow-wrap: anywhere; margin: 0 0 16px; }
.enquiry__text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 16px; }

/* Staging instance (deploy/staging): a band so it is never mistaken for the live CRM */
.is-staging .topbar { border-bottom: 4px solid #b8860b; }
.is-staging .brand small::after { content: " STAGING"; color: #8a6508; }

/* Sales call brief (brief-view.js): reading width */
.brief { max-width: 680px; font-size: 16px; line-height: 1.6; }
.brief__h { font-size: 20px; letter-spacing: -0.01em; margin: 28px 0 8px; }
.brief__list { padding-left: 20px; }
.brief__list li { margin-bottom: 6px; }

/* Reply desk card on an enquiry (combo step 4) */
.enquiry-reply { margin-top: 16px; }
.enquiry-reply textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); line-height: 1.5; margin: 8px 0 12px; }

/* Quote draft on an enquiry card (quote-card.js) and the customer's page /p/<token> (app/quotes.py) */
.quote-demo { margin: 0 0 12px; padding: 8px 12px; background: var(--error); color: #fff; font-weight: 700; border-radius: var(--radius); }
.quote-page .quote-demo { margin: 0; border-radius: 0; text-align: center; font-size: 14px; }
.quote-learned { margin: 0 0 12px; padding: 10px 12px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); }
.quote-decide { margin: 0 0 12px; padding: 10px 12px; background: #fff6d6; border: 1px solid #e6c65c; border-radius: var(--radius); }
.quote-decide .card__title { color: #6b5200; margin: 0 0 4px; }
.quote-notes { margin: 0; padding-left: 18px; }
.quote-notes li { margin: 2px 0; }
.quote-edit { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; }
.quote-line { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 8px; min-width: 0; }
.quote-line.is-flagged { border-color: #e6c65c; }
.quote-line textarea, .quote-line input, .quote-card select, .quote-card .field textarea, .quote-card .field input {
  width: 100%; min-width: 0; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.quote-line textarea { margin: 0; resize: vertical; }
.quote-line input.is-missing { border-color: var(--error); background: var(--error-soft); }
.quote-line__nums { display: grid; grid-template-columns: 72px 96px minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.quote-line__nums label { display: grid; gap: 2px; font-size: 12px; color: var(--muted); min-width: 0; }
.quote-line__sum { font-weight: 700; text-align: right; padding-bottom: 8px; white-space: nowrap; }
.quote-card select { min-height: 44px; margin: 0 0 12px; }
.quote-card .field { display: grid; gap: 4px; margin: 0 0 10px; }
.quote-sum { margin: 6px 0 4px; }
.quote-sum p { margin: 0 0 2px; }
.quote-sum__total, .quote__total { display: flex; justify-content: space-between; font-size: 18px; }
.quote-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
@media (max-width: 420px) {
  .quote-line__nums { grid-template-columns: 1fr 1fr; }
  .quote-line__sum { text-align: left; padding-bottom: 0; align-self: center; }
}
.quote-page .btn--primary:hover { background: var(--accent-dark, var(--accent)); border-color: var(--accent-dark, var(--accent)); }
.quote-doc { max-width: 720px; margin: 0 auto; font-size: 16px; display: grid; gap: 14px; padding-bottom: 48px; }
.quote__title { font-size: 26px; margin: 8px 0 0; }
.quote__facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 0; }
.quote__facts dt { color: var(--muted); }
.quote__facts dd { margin: 0; overflow-wrap: anywhere; }
.quote__hello, .quote__intro { margin: 0; white-space: pre-wrap; }
.quote__hello { font-weight: 700; }
.quote__lines { list-style: none; margin: 0 0 12px; padding: 0; }
.quote__section { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); padding: 12px 0 4px; }
.quote__line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.quote__desc { grid-column: 1; overflow-wrap: anywhere; }
.quote__calc { grid-column: 1; font-size: 14px; }
.quote__sum { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; white-space: nowrap; }
.quote__total { margin: 8px 0 4px; padding-top: 8px; border-top: 2px solid var(--ink); }
.quote__vat { margin: 0 0 4px; }
.quote__steps { margin: 0; padding-left: 20px; }
.quote__accept { display: grid; gap: 12px; }
.quote__accept .field { display: grid; gap: 4px; }
.quote__accept .field input { min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.quote__accept .check { display: flex; gap: 10px; align-items: flex-start; }
.quote__accept .btn { min-height: 52px; font-size: 17px; justify-content: center; }
.quote__contact p { margin: 0 0 6px; }

/* Kampaaniad (app/campaigns.py, campaigns-view.js): the warm-reply queue, steps, companies; phone first. */
.camp-calls, .camp-steps, .camp-contacts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.camp-call, .camp-step { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; min-width: 0; }
.camp-call__head, .camp-step__head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.camp-call__text { margin: 0; overflow-wrap: anywhere; }
.camp-call__meta, .camp-step__subject { margin: 0; overflow-wrap: anywhere; }
.camp-call__actions, .camp-call__outcomes { display: flex; flex-wrap: wrap; gap: 8px; }
.camp-call__phone { min-height: 48px; font-size: 16px; justify-content: center; flex: 1 1 200px; }
.camp-call__later { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.camp-call input[type="text"], .camp-call input[type="date"], .camp-assign select {
  min-height: 40px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); max-width: 100%;
}
.camp-assign { display: flex; gap: 8px; align-items: center; }
.camp-tiles { margin-bottom: 8px; }
.camp-contact { border-bottom: 1px solid var(--line); }
.camp-contact__sum { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 12px 4px; cursor: pointer; min-height: 44px; }
.camp-contact__name { font-weight: 600; overflow-wrap: anywhere; }
.camp-contact__detail { padding: 0 4px 12px; display: grid; gap: 6px; }
.camp-timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; overflow-wrap: anywhere; }
.camp-step pre, .camp-new, .camp-import { white-space: pre-wrap; overflow-wrap: anywhere; }
.camp-new summary, .camp-import summary { font-weight: 600; cursor: pointer; min-height: 32px; }
.camp-call__more { display: grid; gap: 8px; }
.camp-call__more summary { cursor: pointer; color: var(--muted); font-size: 14px; min-height: 32px; }
.camp-call__more[open] { display: grid; }
.camp-call__outcomes .btn--small { flex: 1 1 auto; }
.camp-steps + .btn, section.card[aria-label="Simuleeri vastus"] { margin-bottom: 28px; }
/* Meeldetuletused (comeback-view.js) */
.cb-rule { margin-bottom: 20px; overflow-wrap: anywhere; }
.cb-rule--off { opacity: .7; }
.cb-rule__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cb-switch { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; font-weight: 600; cursor: pointer; flex: none; }
.cb-switch input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.cb-next { margin: 8px 0; }
.cb-label { margin: 12px 0 4px; font-weight: 600; }
.cb-due, .cb-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.cb-due > li { border-bottom: 1px solid var(--line); }
.cb-due__sum { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 10px 2px; min-height: 44px; cursor: pointer; }
.cb-due__name { font-weight: 600; }
.cb-list > li { padding: 4px 0; }
.cb-list .btn--small { margin-left: 6px; }
.cb-more { margin: 8px 0; }
.cb-more > summary { cursor: pointer; font-weight: 600; min-height: 40px; display: flex; align-items: center; }
.cb-mail { display: grid; gap: 6px; margin: 6px 0 10px; }
.cb-mail__subject { margin: 0; font-weight: 700; }
.cb-mail__body { margin: 0; font: inherit; font-size: 15px; overflow-wrap: anywhere; }
.cb-extra { margin: 8px 0; }
.cb-day { margin-bottom: 20px; }
.cb-day__pick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.cb-day__pick input { min-height: 44px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font: inherit; font-size: 16px; }
.cb-chips { align-items: center; margin: 8px 0; }
.cb-day__sum { margin: 10px 0; }
.cb-today { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); font-weight: 600; }

/* Täna board on a demo CRM (today-board.js): tiles, the Tee kohe list, side column; phone: tiles 2 by 2, side under */
.tiles { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 0; margin: 0 0 28px; }
.tile { display: grid; gap: 2px; align-content: start; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: border-color var(--fast); }
a.tile:hover { border-color: var(--ink); }
.tile__value { font-size: 30px; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tile__label { font-size: 14px; font-weight: 600; }
.tile__note { font-size: 13px; color: var(--muted); }
.board { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.board__main { min-width: 0; }
.do-list { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.do { display: flex; gap: 12px 16px; align-items: center; padding: 12px 4px 12px 10px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.do--g0 { border-left-color: var(--accent); background: var(--accent-soft); }
.do--g1 { border-left-color: var(--accent); }
.do--g2 { border-left-color: var(--ink); }
.do__main { display: grid; gap: 3px; min-width: 0; flex: 1 1 auto; color: inherit; text-decoration: none; }
.do__main:hover .do__title { text-decoration: underline; }
.do__head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.do__title { font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.do__chip { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.do__meta { font-size: 13px; color: var(--muted); }
.do__line { font-size: 14px; overflow-wrap: anywhere; }
.do__fields { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 14px; }
.do__label { color: var(--muted); }
.do__side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.do__age { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.do__side .btn { min-width: 150px; }
.board__side { display: grid; gap: 20px; }
.side-block { padding: 16px; background: var(--panel); border-radius: var(--radius); }
.side-block__title { font-size: 16px; margin: 0 0 8px; }
.side-block__empty, .side-block__more { margin: 0; font-size: 14px; color: var(--muted); }
.side-block__more { margin-top: 10px; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li + li { border-top: 1px solid var(--line); }
.side-list a { display: grid; gap: 1px; padding: 8px 0; color: inherit; text-decoration: none; }
.side-list a:hover .side-list__what { text-decoration: underline; }
.side-list__when { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-list__what { font-weight: 600; }
.side-list__meta { font-size: 13px; color: var(--muted); }
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .board { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 520px) {
  .tile { padding: 12px; }
  .tile__value { font-size: 26px; }
  .do { flex-wrap: wrap; padding-left: 8px; }
  .do__side { flex: 1 1 100%; flex-direction: row-reverse; justify-content: space-between; align-items: center; }
  .do__side .btn { min-width: 0; flex: 0 1 auto; }
}
.quote-next { margin: 0 0 14px; padding: 12px; border: 1px solid var(--accent); border-radius: var(--radius); }
.quote-next p { margin: 8px 0; }
.quote-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.quote-steps li { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel); color: var(--muted); }
.quote-steps li.is-done { background: var(--accent); color: #fff; }
.camp-cards { list-style: none; margin: 16px 0 24px; padding: 0; display: grid; gap: 12px; }
.camp-card { display: grid; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; transition: border-color var(--fast); }
.camp-card:hover { border-color: var(--ink); }
.camp-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.camp-card__name { font-weight: 700; font-size: 17px; margin-right: auto; }
.camp-funnel { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; border-top: 1px solid var(--line); }
.camp-funnel li { display: grid; gap: 2px; padding: 10px 8px 0 0; }
.camp-funnel li + li { border-left: 1px solid var(--line); padding-left: 12px; }
.camp-funnel strong { font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.camp-funnel span { font-size: 12px; color: var(--muted); }
.quote-from { margin: 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); font-size: 14px; }

/* Slot calendar (calendar-view.js, app/slots.py): day list of 30-minute slots, week grid that scrolls sideways */
.cal-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cal-bar .chips { margin: 0; }
.cal-bar__nav { display: flex; gap: 6px; }
.cal-bar__nav .btn { min-width: 44px; min-height: 40px; }
.cal-title { margin-bottom: 8px; }
.slots-day { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.slot { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; min-height: 44px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.slot__time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.slot--taken .slot__time { color: var(--ink); }
.slot__free { color: var(--muted); font-size: 13px; }
.slot__items { display: grid; gap: 6px; }
.slot-booking { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 8px 10px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); }
.slot-booking--done { border-left-color: var(--line); background: var(--panel); }
.slot-booking__main { display: grid; color: var(--ink); text-decoration: none; min-width: 0; }
.slot-booking__main span { color: var(--muted); font-size: 13px; }
.slot-booking__side { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.week-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
.week { display: grid; grid-template-columns: 44px repeat(7, minmax(84px, 1fr)); min-width: 640px; }
.week__corner { grid-column: 1; grid-row: 1; }
.week__head { padding: 6px 4px; text-align: center; font-weight: 600; font-size: 13px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.week__head--today { box-shadow: inset 0 -3px 0 var(--accent); }
.week__time { grid-column: 1; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; transform: translateY(-7px); }
.week__cell { border-left: 1px solid var(--line); border-bottom: 1px dotted var(--line); }
.week__cell--closed { background: var(--panel); }
.week__booking { z-index: 1; margin: 1px 2px; padding: 2px 4px; overflow: hidden; font-size: 12px; line-height: 1.25; color: #fff; background: var(--accent); border-radius: 4px; text-decoration: none; white-space: nowrap; text-overflow: ellipsis; }
.week__booking--done { background: var(--muted); }

/* An invoice's explanation block (D:CRM-20261109-3) */
.invoice__note { white-space: pre-line; font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
/* Create on the New invoice form (lead-invoices.js): the email and the invoice to check before Send */
.mail-preview { display: grid; gap: 10px; justify-items: start; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--panel); }
.mail-preview > .mail-preview__head, .mail-preview > .mail-preview__body { justify-self: stretch; }
.review__lead { margin: 0; font-weight: 600; }
.mail-preview__head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 0; font-size: 14px; }
.mail-preview__head dt { color: var(--muted); }
.mail-preview__head dd { margin: 0; overflow-wrap: anywhere; }
.mail-preview__body { white-space: pre-line; font-size: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.mail-preview[hidden] { display: none; }
