/* One System. Layout: fixed sidebar + one working column; tables scroll inside their own box. */
:root {
  --paper: #f4f7f5;
  --card: #ffffff;
  --ink: #15211d;
  --muted: #5b6b65;
  --line: #d6dfda;
  --accent: #0d6a58;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe9;
  --side: #10231e;
  --side-ink: #dbe8e3;
  --side-muted: #8ea69e;
  --good: #1f7a4a; --good-bg: #dff2e6;
  --warn: #8a5a00; --warn-bg: #fbecc8;
  --bad: #a3312b;  --bad-bg: #f8dedb;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0f1614; --card: #17211e; --ink: #e6efeb; --muted: #9bb0a8; --line: #2a3a35;
    --accent: #3fb79f; --accent-ink: #06231d; --accent-soft: #173a33;
    --side: #0a120f; --side-ink: #dbe8e3; --side-muted: #7f978f;
    --good: #6fd39b; --good-bg: #153524; --warn: #f0c060; --warn-bg: #3b2d0c; --bad: #f09088; --bad-bg: #40191a;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.7rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.break { word-break: break-all; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.9em; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100%; }
.side { background: var(--side); color: var(--side-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; color: inherit; padding: 0 8px; }
.side .brand:hover { text-decoration: none; }
.client { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border: 1px solid #ffffff1f; border-radius: 8px; }
.client-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--side-muted); }
.client-name { font-weight: 600; }
.client-switch { font-size: 0.82rem; color: #7fd6c2; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { color: var(--side-ink); padding: 7px 8px; border-radius: 6px; }
.nav-item:hover { background: #ffffff14; text-decoration: none; }
.nav-item.is-active { background: #ffffff22; font-weight: 600; }
.who { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid #ffffff1f; display: flex; flex-direction: column; gap: 2px; }
.who-name { color: var(--side-ink); font-weight: 600; }
.who-role { color: var(--side-muted); font-size: 0.82rem; }
.link-button { background: none; border: 0; padding: 4px 0; color: #7fd6c2; font: inherit; cursor: pointer; text-align: left; }
.main { padding: 28px 32px 60px; display: flex; flex-direction: column; gap: 20px; min-width: 0; max-width: 1240px; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.crumb { font-size: 0.88rem; }

/* building blocks */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel.flush { padding: 0; gap: 0; overflow: hidden; }
.panel.narrow { max-width: 460px; }
.pad { padding: 16px 18px 10px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: inherit; }
a.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile b { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile span { color: var(--muted); font-size: 0.86rem; }
.scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; background: var(--paper); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 7px 4px; }
.table td.num { text-align: left; }
.clip { max-width: 420px; overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 26px 14px; text-align: center; }
.pager { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; }
.pager-links { display: flex; gap: 14px; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.pill-good { color: var(--good); background: var(--good-bg); }
.pill-warn { color: var(--warn); background: var(--warn-bg); }
.pill-bad { color: var(--bad); background: var(--bad-bg); }
.pill-plain { color: var(--muted); background: var(--paper); border: 1px solid var(--line); }
.note { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 6px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.note.ok { border-left-color: var(--good); }
.note.bad { border-left-color: var(--bad); color: var(--bad); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.transcript { display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow-y: auto; }
.turn { padding: 8px 12px; border-radius: 8px; max-width: 78ch; }
.turn b { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.turn-agent { background: var(--accent-soft); }
.turn-lead { background: var(--paper); border: 1px solid var(--line); }

/* forms */
label { font-weight: 600; font-size: 0.88rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; }
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; }
.hint { color: var(--muted); font-size: 0.82rem; margin-top: -6px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .button { align-self: flex-start; margin-top: 6px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input[type="search"] { max-width: 340px; }
.filters select { width: auto; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form select { width: auto; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; align-items: end; }
.grid-form > div { display: flex; flex-direction: column; gap: 6px; }
.button { font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 6px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.button:hover { filter: brightness(1.08); }
.button.secondary { background: transparent; color: var(--accent); }
.button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.client-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.client-card .button { align-self: flex-start; }

/* sign-in */
.auth-body { display: grid; place-items: center; padding: 24px 16px; min-height: 100%; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-card .brand { color: var(--accent); padding: 0; }
.auth-card .stack .button { align-self: stretch; }
.auth-foot { font-size: 0.9rem; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .who { margin: 0; border: 0; padding: 0; flex-direction: row; gap: 10px; align-items: center; }
  .main { padding: 18px 16px 48px; }
}
@media (prefers-reduced-motion: no-preference) { .nav-item, .tile, .button { transition: background-color .12s, border-color .12s, filter .12s; } }

/* ---- phase 3: workspace ---- */
.head-row { flex-direction: row; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.head-row > div:first-child { display: flex; flex-direction: column; gap: 6px; }
a.button { display: inline-block; }
a.button:hover { text-decoration: none; }
.small-button { padding: 4px 10px; font-size: 0.84rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; background: var(--card); color: var(--ink); font-size: 0.88rem; }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .num { opacity: 0.75; }
.chart { width: 100%; min-width: 520px; height: 190px; display: block; }
.chart-bar { fill: var(--accent-soft); }
.chart-bar-strong { fill: var(--accent); }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 0.84rem; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: baseline; }
.key-all { background: var(--accent-soft); border: 1px solid var(--line); }
.key-strong { background: var(--accent); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); }
.steps li.is-done { color: var(--ink); }
.steps li.is-done::marker { color: var(--good); }
.steps li.is-stopped { color: var(--bad); }
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task-list li { display: flex; gap: 10px; align-items: flex-start; }
.task-list li.is-done b { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; align-items: start; }
.board-col { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.board-col h2 { display: flex; justify-content: space-between; }
.board-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: var(--paper); }
.month { width: 100%; min-width: 760px; border-collapse: collapse; table-layout: fixed; }
.month th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px; text-align: left; background: var(--paper); border-bottom: 1px solid var(--line); }
.month td { height: 104px; vertical-align: top; padding: 6px; border: 1px solid var(--line); }
.month td.is-other { background: var(--paper); color: var(--muted); }
.month td.is-today .day-number { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; }
.day-number { font-size: 0.82rem; font-weight: 600; display: inline-block; margin-bottom: 4px; }
.event { display: block; font-size: 0.78rem; border-radius: 4px; padding: 2px 6px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.event-booking { background: var(--accent); color: var(--accent-ink); }
.event-follow_up { background: var(--accent-soft); border: 1px solid var(--line); }
a.event:hover { text-decoration: none; filter: brightness(1.08); }
input[type="file"] { padding: 6px; }

/* Agency console */
.nav-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--side-muted); padding: 4px 8px 2px; }
.tile.is-plain { cursor: default; }
.tile small { color: var(--muted); font-size: 0.8rem; }
.attention { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.attention li { display: flex; gap: 10px; align-items: baseline; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; transform: translateY(-1px); }
.dot-bad { background: var(--bad); } .dot-warn { background: var(--warn); } .dot-good { background: var(--good); }
.table td.sub, .table .sub { color: var(--muted); font-size: 0.84rem; }
.table tr.is-off td { color: var(--muted); }
.form-section { border: 0; border-top: 1px solid var(--line); padding: 16px 0 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section legend { font-weight: 700; padding: 0; font-size: 1.02rem; }
.form-section .grid-form { align-items: start; }
.wide { max-width: 760px; }
.next-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.table td.name-cell { min-width: 200px; }
.table .sub { white-space: nowrap; }
.table.tight th, .table.tight td { padding: 9px 10px; }
.form-section legend { margin-bottom: 4px; padding-right: 10px; }
.table.connections td { vertical-align: top; }
.table.connections td:nth-child(2) { white-space: nowrap; }
.fact-list { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.88rem; display: flex; flex-direction: column; gap: 2px; }

/* Control centre charts. Two series colours only, checked for colour-blind separation on these surfaces. */
:root { --series-1: #199e6e; --series-2: #2a78d6; --grid: #e6ecea; }
@media (prefers-color-scheme: dark) { :root { --series-1: #199e70; --series-2: #3987e5; --grid: #24322d; } }
.plot { display: block; max-width: none; }
.plot-grid { stroke: var(--grid); stroke-width: 1; }
.plot-base { stroke: var(--line); }
.plot-tick { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.plot-value { fill: var(--ink); font-size: 11px; font-weight: 600; font-family: var(--sans); }
.plot-hit { fill: transparent; }
a .plot-hit { cursor: pointer; }
.plot-col:hover path { opacity: 0.78; }
.series-connected, .series-rate, .series-charge { fill: var(--series-1); }
.series-missed { fill: var(--series-2); }
.plot-legend { display: flex; gap: 16px; margin: 0; font-size: 0.86rem; color: var(--muted); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.series-bg-connected, .series-bg-rate, .series-bg-charge { background: var(--series-1); }
.series-bg-missed { background: var(--series-2); }
.rowchart td { vertical-align: middle; }
.rowchart-label { width: 36%; }
.rowchart-bar { width: 42%; }
.rowbar { display: block; width: 100%; height: 12px; }
.plot-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--card); border-radius: 6px; padding: 6px 10px; font-size: 0.82rem; max-width: 300px; box-shadow: 0 4px 14px #0003; }
.plot-tip[hidden] { display: none; }
.plot-tip-head { font-weight: 600; }
.filter-row { gap: 10px; }
.panel-head { display: flex; align-items: center; }
details > summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; width: max-content; }
details[open] > summary { margin-bottom: 8px; }

/* CRM: pipeline board, sent badges, lead timeline, rights switches */
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font-size: 0.78rem; color: var(--muted); white-space: nowrap; line-height: 1.5; }
.tag-good { color: var(--good); border-color: var(--good); }
.tag-bad { color: var(--bad); border-color: var(--bad); }
.pipeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 12px; align-items: start; padding-bottom: 6px; }
.pipe-col { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pipe-col.is-closing { background: transparent; border-style: dashed; }
.pipe-col h2 { font-size: 0.92rem; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin: 0; }
.pipe-card { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: inherit; background: var(--paper); font-size: 0.88rem; }
.pipe-card:hover { border-color: var(--accent); text-decoration: none; }
.pipe-facts { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--muted); font-size: 0.82rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 150px 84px 1fr; gap: 10px; padding: 8px 0 8px 12px; border-left: 3px solid var(--line); border-bottom: 1px solid var(--line); align-items: baseline; }
.timeline li:last-child { border-bottom: 0; }
.timeline .tl-good { border-left-color: var(--good); }
.timeline .tl-warn { border-left-color: var(--warn); }
.timeline .tl-bad { border-left-color: var(--bad); }
.tl-kind { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tl-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 720px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }
.rights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 16px; }
.check.is-fixed { color: var(--muted); }

/* Boards: cards that can be moved */
.pipe-card a { color: inherit; }
.pipe-card a:hover { color: var(--accent); }
[data-card] { cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
[data-card] input, [data-card] select { -webkit-user-select: auto; user-select: auto; }
[data-card].is-dragging { opacity: 0.4; }
[data-drop].is-over { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pipe-move { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.pipe-move select { padding: 3px 6px; font-size: 0.82rem; min-width: 0; }
.pipe-move.is-auto button { display: none; }
.pipe-ghost { position: fixed; z-index: 60; pointer-events: none; opacity: 0.92; box-shadow: 0 10px 28px #0005; transform: rotate(1.5deg); border-color: var(--accent); }
[data-card].is-sending { opacity: 0.4; pointer-events: none; }
/* A column is a drop target for its whole height, so a card can be dropped under a short or empty column. */
.pipeline, .board[data-board] { align-items: stretch; }
dialog.ask { border: 1px solid var(--line); border-radius: 10px; padding: 18px; background: var(--card); color: var(--ink); max-width: 320px; width: calc(100% - 32px); }
dialog.ask::backdrop { background: #0007; }
dialog.ask h2 { margin: 0; font-size: 1.05rem; }
/* the small player in the calls list */
.mini-player { height: 32px; width: 230px; max-width: 46vw; vertical-align: middle; }
/* callers: the script as written, the price list's small forms */
.script { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 0.92rem; line-height: 1.5; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0; max-height: 440px; overflow: auto; }
.price-form { display: flex; gap: 6px; align-items: center; }
.price-form input { width: 110px; font-family: var(--mono); }
.panel.flush > .pad { padding: 14px 16px 10px; }
.panel.flush > .note.pad { margin: 0 16px 12px; padding: 10px 14px; }
.plain-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
/* callers, step 2: the edit form and the side-by-side check */
.stack-wide { display: flex; flex-direction: column; gap: 20px; }
.two-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.two-fields input { width: 100%; }
.script-part { display: flex; flex-direction: column; gap: 6px; }
.script-part textarea { width: 100%; font: inherit; font-size: 0.92rem; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); resize: vertical; }
.script.compare { white-space: normal; display: block; }
.script.compare span { display: block; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.5em; padding: 1px 4px; border-radius: 3px; }
.sample-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.script.compare .line-gone { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
.script.compare .line-new { background: var(--good-bg); color: var(--good); font-weight: 600; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { margin-top: 4px; }

/* My service (21 Nov 2026) */
.caller-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.script-text { white-space: pre-wrap; font: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 0; max-height: 320px; overflow: auto; }
.proposal-diff { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
