/* SadaWorks lead desk.
   Same design language as sadaworks.com: white cards on a cool grey ground,
   deep navy ink, one green accent, Manrope set heavy and tight for headings.
   Flat surfaces, hairline rules, no decoration. */

@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/manrope-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/manrope-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;

  /* grounds */
  --paper: #FFFFFF;
  --band: #F4F6F9;
  --panel: #0F1B2D;
  --panel-2: #172539;

  /* ink */
  --ink: #0F1B2D;
  --body: #3C4858;
  --muted: #677280;
  --on-panel: #FFFFFF;
  --on-panel-mut: #C9D2DE;

  /* accent */
  --green: #006D4B;
  --green-deep: #00583A;
  --green-tint: #DDF5E9;
  --green-edge: #009B69;
  --mint: #70DDB1;

  /* states */
  --attention: #8A5A00;
  --attention-tint: #FBF1DE;
  --alert: #A83A1E;
  --alert-deep: #8C2F17;
  --alert-tint: #F7E9E4;
  --slate-tint: #E6EBF2;

  /* rules */
  --line: #E2E7EE;
  --line-soft: #EDF1F5;
  --line-strong: #C9D2DE;
  --line-control: #85909C;
  --line-panel: #2A3850;

  --r: 8px;
  --r-sm: 6px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .04);
  --shadow-float: 0 12px 32px rgba(15, 27, 45, .16);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --fast: .16s;

  --side-w: 248px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--body);
  background: var(--band);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
a { color: var(--green); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color var(--fast) var(--ease), color var(--fast) var(--ease); }
a:hover { text-decoration-color: currentColor; color: var(--green-deep); }
strong { font-weight: 700; color: var(--ink); }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88em; background: var(--band); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--green-edge); outline-offset: 2px; border-radius: 4px; }

/* Class rules above would otherwise re-show an element the script has hidden. */
[hidden] { display: none !important; }

.icon { flex: none; display: inline-block; vertical-align: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r); }
.skip:focus { top: 12px; color: #fff; }
.muted { color: var(--muted); }
.ink { color: var(--ink); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.tl-tools { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-top: 8px; }
.is-bad { color: var(--alert); }
.is-due { color: var(--attention); font-weight: 700; }

/* ---- shell ---------------------------------------------------------------- */
.shell { display: flex; min-height: 100dvh; }
.side {
  width: var(--side-w); flex: none; background: var(--panel); color: var(--on-panel-mut);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line-panel) transparent;
}
.side-brand, .bare-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; color: var(--on-panel); text-decoration: none; }
.side-brand:hover { color: var(--on-panel); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; background: var(--mint); color: var(--panel);
  display: grid; place-items: center; font-weight: 800; font-size: 19px; letter-spacing: -.03em; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: inherit; font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.brand-text span { font-size: 12.5px; color: var(--on-panel-mut); }
.side-nav { padding: 6px 12px 16px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-section { font-size: 12px; font-weight: 700; color: #94A3B8; padding: 18px 10px 6px; letter-spacing: .02em; }
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: var(--r);
  color: var(--on-panel-mut); text-decoration: none; font-weight: 600; font-size: 14.5px; min-height: 38px;
  border: 0; background: none; width: 100%; text-align: left; cursor: pointer; position: relative;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.side-link:hover { background: var(--panel-2); color: var(--on-panel); }
.side-link.is-active { background: var(--panel-2); color: var(--on-panel); }
.side-link.is-active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--mint); }
.side-link:focus-visible, .side-user:focus-visible, .side-brand:focus-visible { outline-color: var(--mint); }
.side-link span:first-of-type { flex: 1; }
.badge { background: var(--mint); color: var(--panel); font-size: 12px; font-weight: 800; border-radius: 999px; min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.side-foot { border-top: 1px solid var(--line-panel); padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.side-user { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r); color: var(--on-panel); text-decoration: none; transition: background var(--fast) var(--ease); }
.side-user:hover { background: var(--panel-2); color: var(--on-panel); }
.side-user > span { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.side-user strong { color: inherit; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user span span { font-size: 12.5px; color: var(--on-panel-mut); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.demo-bar { background: var(--attention-tint); color: var(--attention); border-bottom: 1px solid #EAD9B4; padding: 9px 24px; font-size: 14px; display: flex; gap: 8px; align-items: flex-start; }
.demo-bar strong { color: inherit; }
.main { width: 100%; max-width: 1040px; margin: 0 auto; padding: 32px 32px 72px; display: flex; flex-direction: column; gap: 20px; }
.main-wide { max-width: 1320px; }
.main:focus { outline: none; }
.scrim { position: fixed; inset: 0; background: rgba(15, 27, 45, .5); z-index: 30; }
.scrim[hidden] { display: none; }

/* ---- page head ------------------------------------------------------------ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.page-title { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.025em; color: var(--ink); }
.page-sub { margin-top: 6px; color: var(--muted); max-width: 70ch; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-foot { color: var(--muted); font-size: 13.5px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; margin-bottom: 8px; }
.back-link:hover { color: var(--ink); }

/* ---- buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r); border: 1px solid transparent;
  font-weight: 700; font-size: 14.5px; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease);
  touch-action: manipulation;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-deep); color: #fff; }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--band); color: var(--ink); border-color: var(--line-control); }
.btn-danger { background: var(--alert); color: #fff; }
.btn-danger:hover { background: var(--alert-deep); color: #fff; }
.btn-danger-ghost { background: var(--paper); color: var(--alert); border-color: #E3BEB2; }
.btn-danger-ghost:hover { background: var(--alert-tint); color: var(--alert-deep); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
.btn-lg { min-height: 46px; padding: 10px 22px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: progress; }
.inline-form { display: inline-flex; }

/* ---- cards and layout helpers --------------------------------------------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 17px; line-height: 1.3; font-weight: 800; letter-spacing: -.015em; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.card-lead { color: var(--muted); margin-top: -8px; font-size: 14.5px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; font-weight: 800; display: inline-grid; place-items: center; flex: none; }
.danger-zone { border-color: #EBD3CA; }
.error-card { max-width: 560px; align-items: flex-start; }
.error-code { font-size: 15px; font-weight: 800; color: var(--muted); }

/* ---- chips and tags ------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 700; line-height: 1.55; white-space: nowrap; border: 1px solid transparent; }
.chip-plain { background: var(--line-soft); color: var(--body); }
.chip-info { background: var(--slate-tint); color: var(--ink); }
.chip-live { background: var(--green-tint); color: var(--green-deep); }
.chip-good { background: var(--green); color: #fff; }
.chip-bad { background: var(--alert-tint); color: var(--alert); }
.chip-warn { background: var(--attention-tint); color: var(--attention); }
.chip-quiet { background: var(--paper); color: var(--muted); border-color: var(--line-strong); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--body); background: var(--band); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 1px 8px; white-space: nowrap; }
.tag-quiet { background: none; color: var(--muted); }

/* ---- messages ------------------------------------------------------------- */
.flash, .notice { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--r); padding: 12px 14px; font-weight: 600; font-size: 14.5px; border: 1px solid; }
.flash .icon, .notice .icon { margin-top: 2px; }
.flash-ok { background: var(--green-tint); color: var(--green-deep); border-color: #B7E3CD; }
.flash-err, .notice-err { background: var(--alert-tint); color: var(--alert-deep); border-color: #EBD3CA; }
.flash-info, .notice-info { background: var(--slate-tint); color: var(--ink); border-color: var(--line-strong); }
.notice-warn { background: var(--attention-tint); color: var(--attention); border-color: #EAD9B4; }
.notice { font-weight: 500; }

.banner { display: flex; gap: 14px; align-items: flex-start; border-radius: var(--r-lg); padding: 16px 18px; border: 1px solid; margin-bottom: 12px; }
.banner > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.banner .icon { margin-top: 2px; }
.banner-title { font-weight: 800; font-size: 16px; color: inherit; letter-spacing: -.01em; }
.banner-facts { font-size: 14px; }
.banner-foot { font-size: 13.5px; }
.banner-block { background: var(--alert-tint); border-color: #E3BEB2; color: var(--alert-deep); }
.banner-confirm { background: var(--attention-tint); border-color: #EAD9B4; color: #6E4700; }
.banner-info { background: var(--slate-tint); border-color: var(--line-strong); color: var(--ink); }
.banner .check-label { color: inherit; }
.banner .check-hint { color: inherit; opacity: .85; }
#dup-banner:empty { display: none; }
/* A lead that cannot be added stays in view while the BD scrolls the form. */
#dup-banner:has(.banner-block, .banner-confirm) { position: sticky; top: 12px; z-index: 10; }
#dup-banner:has(.banner-block, .banner-confirm) .banner { box-shadow: var(--shadow-float); margin-bottom: 0; }

/* ---- forms ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.req { color: var(--alert); }
.input {
  width: 100%; min-height: 40px; padding: 8px 12px; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line-control); border-radius: var(--r);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.input::placeholder { color: #8A94A1; }
.input:hover { border-color: var(--ink); }
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 155, 105, .22); }
.input[disabled] { background: var(--band); color: var(--muted); cursor: not-allowed; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230F1B2D' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.45; }
.error { font-size: 13.5px; color: var(--alert); font-weight: 600; }
.has-error .input { border-color: var(--alert); }
.form-error { background: var(--alert-tint); border: 1px solid #EBD3CA; border-radius: var(--r); padding: 10px 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; align-items: start; }
/* Paired fields ("from … to …") line up on their inputs even when one label wraps. */
.form-grid-tight { gap: 12px; align-items: end; }
/* An amount with its currency beside it, on every screen width. */
.form-grid.money-field { grid-template-columns: minmax(0, 1fr) minmax(112px, 150px); }
.form-section { gap: 18px; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.owner-row { border-top: 1px solid var(--line-soft); padding-top: 18px; }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 4px 0; min-height: 32px; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--green); flex: none; cursor: pointer; }
.check > span { display: flex; flex-direction: column; gap: 2px; }
.check-label { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.check-hint { font-size: 13px; color: var(--muted); }
.field + .check { margin-top: 2px; }
.day-picker { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.day-picker legend { margin-bottom: 4px; }

.choice-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 12px 14px; cursor: pointer; background: var(--paper); transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease); }
.choice:hover { border-color: var(--line-control); }
.choice input { margin: 3px 0 0; width: 17px; height: 17px; accent-color: var(--green); flex: none; }
.choice span { display: flex; flex-direction: column; gap: 2px; }
.choice strong { font-size: 14.5px; }
.choice em { font-style: normal; font-size: 13px; color: var(--muted); line-height: 1.4; }
.choice:has(input:checked) { border-color: var(--green); background: #F3FBF7; box-shadow: inset 0 0 0 1px var(--green); }
.choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.choice:has(input:focus-visible) { outline: 2px solid var(--green-edge); outline-offset: 2px; }

.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.filters .field { min-width: 150px; }
.field-grow { flex: 1 1 240px; }

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.block-details { display: flex; flex-direction: column; }
.block-details[open] > summary, .inline-details[open] > summary { background: var(--band); }
.pop-form { margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: #FAFBFC; }
.inline-details { position: relative; }
.inline-details .pop-form { flex-wrap: nowrap; }

/* ---- tables --------------------------------------------------------------- */
.table-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; box-shadow: var(--shadow); }
.table-flush { border: 0; border-radius: 0; box-shadow: none; margin: 0 -24px -8px; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFBFC; }
.table th.num { text-align: right; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--body); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--fast) var(--ease); }
.table tbody tr:hover { background: #FAFBFC; }
.table-flush .table th:first-child, .table-flush .table td:first-child { padding-left: 24px; }
.table-flush .table th:last-child, .table-flush .table td:last-child { padding-right: 24px; }
.table-compact th, .table-compact td { padding: 7px 12px; font-size: 13.5px; }
.row-link { font-weight: 700; color: var(--ink); text-decoration: none; }
.row-link:hover { color: var(--green); text-decoration: underline; }
.cell-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 1px; }
.cell-sub.is-bad { color: var(--alert); }
.cell-actions { text-align: right; white-space: nowrap; }
.reach { display: inline-flex; gap: 8px; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager-note { color: var(--muted); font-size: 13.5px; }
.pager-links { display: flex; gap: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 10px 14px; font-weight: 700; font-size: 14.5px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--green); }

.empty { padding: 28px 16px; text-align: left; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.card .empty { padding: 6px 0; }
.empty-title { font-weight: 700; color: var(--ink); }
.empty-text { color: var(--muted); max-width: 60ch; }
.empty-action { margin-top: 8px; }

/* ---- stat tiles ----------------------------------------------------------- */
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); text-decoration: none; min-width: 0; }
a.kpi { transition: border-color var(--fast) var(--ease); }
a.kpi:hover { border-color: var(--line-control); }
.kpi-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.kpi-value { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; color: var(--ink); }
.kpi-note { font-size: 13px; color: var(--muted); }

/* ---- today ---------------------------------------------------------------- */
.task-list { display: flex; flex-direction: column; }
.task { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.task:last-child { border-bottom: 0; padding-bottom: 0; }
.task:first-child { padding-top: 0; }
.task-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--attention-tint); color: var(--attention); display: grid; place-items: center; flex: none; }
.task-icon-live { background: var(--green-tint); color: var(--green-deep); }
.task-icon-warn { background: var(--alert-tint); color: var(--alert); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 700; color: var(--ink); }
.task-title a { color: var(--ink); text-decoration: none; }
.task-title a:hover { color: var(--green); text-decoration: underline; }
.task-meta { font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.tel { font-weight: 700; white-space: nowrap; }
.plain-list { display: flex; flex-direction: column; }
.plain-list li { display: flex; flex-direction: column; gap: 1px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14.5px; }
.plain-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.plain-list li:first-child { padding-top: 0; }
.plain-list a { font-weight: 600; }
.plain-list .muted { font-size: 13px; }
.plain-list .is-unread a, .plain-list .is-unread > span:first-child { color: var(--ink); font-weight: 700; }
.plain-list .is-read a { color: var(--body); font-weight: 500; }

/* ---- lead page ------------------------------------------------------------ */
.lead-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.fu-list { display: flex; flex-direction: column; gap: 12px; }
.fu { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: #FAFBFC; }
.fu-due { border-color: #EAD9B4; background: #FFFBF3; }
.fu-failed { border-color: #EBD3CA; background: #FDF7F5; }
.fu-head { display: flex; flex-direction: column; gap: 4px; }
.fu-title { font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fu-when { font-size: 14.5px; }
.fu-hold { color: var(--attention); font-weight: 600; font-size: 14px; display: flex; gap: 6px; align-items: flex-start; }
.fu-failed .fu-hold { color: var(--alert); }
.fu-note { font-size: 14px; color: var(--body); }
.fu-tip { font-size: 14px; color: var(--body); display: flex; gap: 6px; align-items: flex-start; }
.fu-tip .icon { flex: none; margin-top: 2px; color: var(--muted); }
.fu-msg > summary { font-weight: 700; font-size: 13.5px; color: var(--green); }
.fu-msg > summary:hover { text-decoration: underline; }
.fu-msg[open] > summary { margin-bottom: 8px; }
.msg-subject { font-weight: 700; color: var(--ink); font-size: 14.5px; }
.msg-body { font-size: 14.5px; color: var(--body); overflow-wrap: anywhere; }
.msg-body p + p { margin-top: .7em; }
.fu-msg .msg-body, .fu-msg .msg-subject { background: var(--paper); border: 1px solid var(--line); padding: 12px 14px; }
.fu-msg .msg-subject { border-radius: var(--r) var(--r) 0 0; border-bottom: 0; }
.fu-msg .msg-body { border-radius: var(--r); }
.fu-msg .msg-subject + .msg-body { border-radius: 0 0 var(--r) var(--r); }
.copy-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.copy-row .muted { font-size: 13px; }
/* Whose words a follow-up uses (AI, standard, edited by hand) and the buttons that change it. */
.tag-ai { background: var(--green-tint); color: var(--green-deep); border-color: #B7E3CD; }
.fu-msg > summary .tag { margin-left: 6px; }
.msg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; }
.msg-source { flex-basis: 100%; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }
.msg-source .icon { margin-top: 2px; flex: none; }
.msg-source.is-warn { color: var(--attention); font-weight: 600; }
.msg-tools .block-details[open] { flex-basis: 100%; align-items: flex-start; }
.msg-tools .pop-form { width: 100%; }
.nowrap { white-space: nowrap; }
.note-text { min-height: 148px; line-height: 1.55; }
.fu-form { border-top: 1px solid var(--line); padding-top: 12px; }
.fu-controls { border-top: 1px solid var(--line-soft); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.fu-controls .block-details { width: 100%; align-items: flex-start; }
.fu-controls .pop-form { width: 100%; }
.fu-seq { font-size: 14.5px; }
.status-form .input { flex: 1; min-width: 0; }
.card .block-details > summary.btn-block { width: 100%; }

.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl-item { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.tl-out { background: var(--paper); margin-left: 28px; }
.tl-in { background: #F3FBF7; border-color: #B7E3CD; margin-right: 28px; }
.tl-bad { background: #FDF7F5; border-color: #EBD3CA; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-who { font-weight: 700; color: var(--ink); font-size: 14.5px; }
.tl-time { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.tl-foot { font-size: 13px; color: var(--muted); }
/* Messenger-style ticks on sent messages: two green ones when an email was opened or a WhatsApp read. */
.tag .icon { flex: none; }
.tag-read { background: var(--green-tint); color: var(--green-deep); border-color: #B7E3CD; }
.tag-read .icon { color: var(--green); stroke-width: 2.25; }
.tl-foot .is-read { color: var(--green-deep); font-weight: 600; }
.ticks-inline { display: inline-flex; color: var(--green); margin-left: 6px; vertical-align: -3px; }
.ticks-inline .icon { stroke-width: 2.25; }
.tl-more > summary { font-size: 14.5px; color: var(--body); }
.tl-more > summary::after { content: " Show all"; color: var(--green); font-weight: 700; font-size: 13.5px; }
.tl-more[open] > summary { display: none; }
.tl-event { border: 0; padding: 0 2px; flex-direction: row; align-items: baseline; gap: 10px; font-size: 13.5px; color: var(--muted); }
.tl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); flex: none; transform: translateY(-1px); }

.dl { display: flex; flex-direction: column; }
.dl-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14.5px; }
.dl-row:last-child { border-bottom: 0; }
.dl-row:first-child { padding-top: 0; }
.dl-row dt { color: var(--muted); font-size: 13.5px; padding-top: 1px; }
.dl-row dd { color: var(--ink); overflow-wrap: anywhere; }
.dl-top { border-top: 1px solid var(--line-soft); padding-top: 14px; }

/* ---- charts --------------------------------------------------------------- */
.chart-empty { color: var(--muted); padding: 8px 0; }
.barlist { display: flex; flex-direction: column; gap: 4px; }
.bar-row { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: center; gap: 12px; padding: 6px 6px; border-radius: var(--r-sm); margin: 0 -6px; }
.bar-row:hover, .bar-row:focus-visible { background: var(--band); }
.bar-label { font-size: 13.5px; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-plot { display: flex; align-items: center; gap: 8px; min-width: 0; border-left: 1px solid var(--line-strong); padding: 2px 0; }
.bar-fill { height: 14px; background: var(--green); border-radius: 0 4px 4px 0; min-width: 2px; flex: none; transition: background var(--fast) var(--ease); }
.bar-row:hover .bar-fill, .bar-row:focus-visible .bar-fill { background: var(--green-edge); }
.bar-value { font-size: 13.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.colchart { display: flex; flex-direction: column; gap: 6px; }
.colchart-frame { display: flex; gap: 8px; height: 190px; padding-top: 18px; }
.colchart-axis { position: relative; width: 30px; flex: none; }
.axis-tick { position: absolute; right: 0; transform: translateY(50%); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; }
.colchart-plot { position: relative; flex: 1; min-width: 0; }
.colchart-grid { position: absolute; inset: 0; }
.grid-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--line-soft); }
.grid-line.is-base { background: var(--line-strong); }
.colchart-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; min-width: 0; border-radius: 4px 4px 0 0; }
.col:hover, .col:focus-visible { background: rgba(15, 27, 45, .04); }
.col-bar { width: 100%; max-width: 22px; background: var(--green); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; transition: background var(--fast) var(--ease); }
.col-bar.is-zero { background: transparent; min-height: 0; }
.col:hover .col-bar, .col:focus-visible .col-bar { background: var(--green-edge); }
.col:hover .col-bar.is-zero, .col:focus-visible .col-bar.is-zero { background: transparent; }
.col-cap { position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -3px); font-size: 12px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.colchart-x { display: flex; gap: 2px; margin-left: 38px; }
.x-label { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; }
.table-view > summary { font-size: 13px; font-weight: 700; color: var(--green); margin-top: 6px; }
.table-view[open] > summary { margin-bottom: 8px; }
.table-view .table { border: 1px solid var(--line); border-radius: var(--r); }
.meter { display: inline-block; width: 64px; height: 8px; border-radius: 999px; background: var(--green-tint); overflow: hidden; vertical-align: middle; }
.meter-fill { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.meter-cell { display: inline-flex; align-items: center; gap: 8px; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: var(--r-sm); box-shadow: var(--shadow-float); max-width: 280px; transform: translate(-50%, calc(-100% - 8px)); }
.tip[hidden] { display: none; }

/* ---- admin ---------------------------------------------------------------- */
.health { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; }
.health-item { display: grid; grid-template-columns: 130px minmax(0, 1fr); align-items: center; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14.5px; }
.health-label { font-weight: 700; color: var(--ink); }
.health-value { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; }
.vars div { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.vars dt { flex: none; }
.vars dd { color: var(--muted); }
.bullets { display: flex; flex-direction: column; gap: 10px; padding-left: 18px; list-style: disc; }
.bullets li { padding-left: 2px; }
.bullets li::marker { color: var(--line-control); }
.wa-state { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.wa-number { font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.wa-link { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.qr-box { width: 304px; max-width: 100%; aspect-ratio: 1; border: 1px solid var(--line-strong); border-radius: var(--r-lg); display: grid; place-items: center; padding: 11px; background: #fff; }
.steps-list { list-style: decimal; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ---- sign-in -------------------------------------------------------------- */
.bare { background: var(--panel); }
.bare-main { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 32px 16px; }
.bare-brand { padding: 0; }
.bare-card { width: 100%; max-width: 420px; padding: 28px; gap: 18px; }
.bare .flash { width: 100%; max-width: 420px; }

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 1180px) {
  .kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lead-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 980px) {
  /* Off-screen until opened. Hidden as well, so the keyboard cannot tab into a menu nobody can see. */
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; transform: translateX(-100%); visibility: hidden; transition: transform .24s var(--ease), visibility 0s .24s; }
  .side.is-open { transform: none; visibility: visible; box-shadow: var(--shadow-float); transition: transform .24s var(--ease), visibility 0s; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); color: #fff; position: sticky; top: 0; z-index: 20; }
  .menu-btn { width: 44px; height: 44px; border: 0; background: none; color: #fff; display: grid; place-items: center; border-radius: var(--r); cursor: pointer; margin-left: -8px; }
  .menu-btn:hover { background: var(--panel-2); }
  .menu-btn:focus-visible { outline-color: var(--mint); }
  .topbar-brand { color: #fff; font-weight: 800; letter-spacing: -.02em; text-decoration: none; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-brand span { font-weight: 500; color: var(--on-panel-mut); }
  .main { padding: 22px 16px 64px; }
  .demo-bar { padding: 9px 16px; }
  #dup-banner:has(.banner-block, .banner-confirm) { top: 76px; }
  .lead-layout { grid-template-columns: minmax(0, 1fr); }
  .hide-md { display: none; }
  .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .kpis, .kpis-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .input { font-size: 16px; min-height: 44px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .page-title { font-size: 24px; }
  .card { padding: 18px 16px; }
  .table-flush { margin: 0 -16px -6px; }
  .table-flush .table th:first-child, .table-flush .table td:first-child { padding-left: 16px; }
  .table-flush .table th:last-child, .table-flush .table td:last-child { padding-right: 16px; }
  .form-grid, .vars, .health { grid-template-columns: minmax(0, 1fr); }
  .kpis-3 { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none; }
  .table th, .table td { padding: 10px 12px; }
  .tl-out { margin-left: 12px; }
  .tl-in { margin-right: 12px; }
  .tl-time { margin-left: 0; width: 100%; }
  .tl-event { flex-wrap: wrap; gap: 2px 10px; }
  .tl-event .tl-time { padding-left: 17px; }
  .task { align-items: flex-start; }
  .bar-row { grid-template-columns: 92px minmax(0, 1fr); }
  .filters .field { flex: 1 1 100%; }
  .inline-details .pop-form { flex-wrap: wrap; }
  .dl-row { grid-template-columns: 96px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .side, .topbar, .filters, .page-actions, .btn, .demo-bar { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
  .card, .table-wrap, .kpi { box-shadow: none; }
}
