/*
 * Qubox design system (approved v3, 2026-10-16): calm light surfaces, one deep green, small soft colour
 * touches for kinds of things (contact types, message kinds, KPI icons). Sections, in order:
 *   fonts · tokens · base · layout (sidebar, top bar) · cards + KPIs · tables · forms · buttons · chips + tones
 *   · alerts · tabs · lists (rows, feed) · page bits (empty, pager, code, steps) · chat log · sign-in pages · phone
 */

/* ---------------------------------------------------------------- fonts (self-hosted, OFL) */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/inter-latin.woff2") format("woff2");
  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+20B9, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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; }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/playfair-latin.woff2") format("woff2"); }

/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #f4f4f2; --card: #fff; --line: #e8e8e5; --line-2: #f0f0ed; --ink: #161616; --ink-2: #3d3d38; --mute: #63635b; --fill: #f2f2ef;
  --g: #0f4c3a; --g-hover: #0b3b2d; --g2: #e6efe9; --focus: #1f7a52;
  --ok: #2a7348; --okb: #e8f3ec; --warn: #8a5d0b; --warnb: #fbf1dc; --bad: #b4362b; --badb: #fbe9e7;
  --sky: #1d5fb0; --skyb: #e5effc; --vio: #5a45ad; --viob: #eee9fb; --mint: #1f7a52; --mintb: #e3f1ea; --amb: #8f6212; --ambb: #fcefd9; --rose: #a3305a; --roseb: #fbe7ee;
  --r: 16px; --r-sm: 10px; --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --serif: "Playfair Display", Georgia, serif;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--g); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--g-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.icon { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; } /* the hidden attribute always wins over a layout rule (forms show/hide fields with it) */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--mute); }
.small { font-size: 12.5px; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, #fff 0 235px, var(--line) 235px 236px, transparent 236px); } /* the white menu column runs the full page height */
.side { background: #fff; display: flex; flex-direction: column; gap: 16px; padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.logo { padding: 2px 10px 4px; font: 600 21px/1 var(--font); letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.logo em { font-family: var(--serif); font-weight: 600; font-style: italic; }
.proj { position: relative; }
.proj summary { display: flex; align-items: center; gap: 10px; border: 1px solid #f3d9c9; background: #fffaf6; border-radius: 12px; padding: 9px 10px; cursor: pointer; list-style: none; }
.proj summary::-webkit-details-marker { display: none; }
.proj summary span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.proj summary b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj small { color: var(--mute); font-size: 12px; }
.pdot { flex: 0 0 8px !important; height: 8px; border-radius: 50%; }
.proj-menu { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.08); }
.proj-menu button, .proj-menu a { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; font: inherit; color: var(--ink); text-align: left; cursor: pointer; text-decoration: none; }
.proj-menu button:hover, .proj-menu a:hover { background: var(--fill); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 999px; color: var(--ink-2); font-size: 13.5px; text-decoration: none; }
.nav a:hover { background: var(--fill); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--g2); color: var(--g); font-weight: 600; }
.navs { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-foot { margin-top: auto; }
.main { display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 14px 28px; border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; font: 600 24px/1.15 var(--serif); letter-spacing: -.01em; }
.who-am-i { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.who-am-i form { margin: 0; }
.body { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 20px; }
.page-intro { margin: -6px 0 0; color: var(--mute); max-width: 72ch; }

/* ---------------------------------------------------------------- cards + KPIs */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; font-weight: 600; }
.card-head a { font-weight: 600; font-size: 13px; text-decoration: none; }
.card h2 + p.muted { margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.col > *, .grid-2 > * { min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { position: relative; padding: 18px 20px; }
.kpi p { margin: 0 0 6px; color: var(--mute); font-size: 13px; padding-right: 40px; }
.kpi strong { font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.kpi .kt { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.kpi .kt .icon { width: 16px; height: 16px; }
.kpi small { display: block; color: var(--mute); font-size: 12px; margin-top: 2px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--mute); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
a.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
a.row-link:hover { color: var(--g); text-decoration: underline; }
a.row-link.plain { font-weight: 400; }

/* ---------------------------------------------------------------- forms */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 900px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: 13.5px; }
.optional { color: var(--mute); font-weight: 400; }
.input, select.input, textarea.input { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #d9d9d4; border-radius: var(--r-sm); padding: 9px 12px; min-height: 40px; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.hint { color: var(--mute); font-size: 12.5px; margin: 0; }
.error { color: var(--bad); font-size: 12.5px; margin: 0; font-weight: 500; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--g); }
fieldset { border: 0; padding: 0; margin: 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; margin: 0; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 13.5px var(--font); border-radius: var(--r-sm); padding: 9px 16px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; min-height: 40px; white-space: nowrap; transition: background-color .15s, transform .15s; }
.btn:hover { background: var(--fill); color: var(--ink); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--g); border-color: var(--g); color: #fff; }
.btn-primary:hover { background: var(--g-hover); color: #fff; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--badb); color: var(--bad); }
.btn-sm { padding: 6px 11px; min-height: 32px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; background: transparent; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:active { transform: none; } }

/* ---------------------------------------------------------------- chips + tones */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; background: var(--fill); color: #5f5f58; }
.chip .icon { width: 13px; height: 13px; }
.tile { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--fill); color: #5f5f58; }
.ok { background: var(--okb); color: var(--ok); } .warn { background: var(--warnb); color: var(--warn); } .bad { background: var(--badb); color: var(--bad); }
.sky { background: var(--skyb); color: var(--sky); } .vio { background: var(--viob); color: var(--vio); } .mint { background: var(--mintb); color: var(--mint); }
.amb { background: var(--ambb); color: var(--amb); } .rose { background: var(--roseb); color: var(--rose); } .mute { background: var(--fill); color: #5f5f58; }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); }
.ava { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; background: #1f2b26; color: #fff; }
.ava.big { width: 60px; height: 60px; font-size: 18px; }
.p0 { background: #eceee9; color: #56605a; } .p1 { background: #fbe7ee; color: #a3305a; } .p2 { background: #e2eefa; color: #1d65a8; } .p3 { background: #fcefd9; color: #8f6212; } .p4 { background: #ece8fb; color: #5a45ad; } .p5 { background: #e3f1ea; color: #1f7a52; }

/* ---------------------------------------------------------------- alerts */
.flash, .alert { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); background: #fff; }
.flash p, .alert p { margin: 0; }
.flash-success, .alert-ok, .alert-success { background: var(--okb); border-color: #cfe6d7; color: #1d5a37; }
.flash-error, .alert-bad, .alert-error { background: var(--badb); border-color: #f2cfc9; color: #8a2a21; }
.flash-info, .alert-info { background: var(--skyb); border-color: #cfe0f6; color: #1a4f8f; }
.alert-warn, .alert-warning { background: var(--warnb); border-color: #f0dfb5; color: #6b4a0b; }

/* ---------------------------------------------------------------- tabs */
.seg { display: inline-flex; background: var(--fill); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; color: #5f5f58; text-decoration: none; white-space: nowrap; }
.seg a[aria-current="page"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { min-width: 160px; }

/* ---------------------------------------------------------------- lists */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.rows li:first-child { border-top: 0; }
.rows .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rows small { color: var(--mute); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows small.wrap { white-space: normal; overflow-wrap: anywhere; } /* v0.7.3: a delivery error shown in full */
/* list rename (0.1.8): the Rename button opens a small form on its own line */
.rows li:has(.list-rename) { flex-wrap: wrap; }
.list-rename { order: 3; }
.list-rename > summary { list-style: none; cursor: pointer; }
.list-rename > summary::-webkit-details-marker { display: none; }
.list-rename[open] { flex-basis: 100%; }
.list-rename[open] > summary { display: none; }
.list-rename form { margin: 4px 0 0; align-items: flex-end; }
.rows .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; }
.dl { margin: 0; display: grid; gap: 8px; font-size: 13.5px; }
.dl div { display: flex; justify-content: space-between; gap: 12px; }
.dl dt { color: var(--mute); } .dl dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- page bits */
.empty { text-align: center; padding: 36px 16px; color: var(--mute); }
.empty .tile { margin: 0 auto 10px; width: 44px; height: 44px; }
.empty h2 { color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.pager { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; color: var(--mute); }
/* pager() helper (0.1.8): "Showing 51–100 of 230" + page numbers; wraps on phones */
.pager { flex-wrap: wrap; }
.pager-info { margin: 0; }
.pager-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pager-pages .btn { min-width: 34px; justify-content: center; font-variant-numeric: tabular-nums; }
.pager-gap { padding: 0 2px; color: var(--mute); }
/* name + avatar in the top bar link to My account (0.2) */
.who-link { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; border-radius: 999px; }
.who-link:hover .who-name { text-decoration: underline; }
/* buttons in a table row (Team, 0.2) */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
/* Clients → a test business: Billiton’s accounts to lend (v0.5.1): the account on the left, its button on the right */
.lend-row { justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.lend-row > span { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
/* v0.6.0 Plan & billing: usage meters, plan choice, GST documents */
.meters { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 14px; }
.meter-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.meters meter { width: 100%; height: 10px; }
.plan-pick { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.plan-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; }
.plan-opt:has(input:checked) { border-color: var(--g); background: var(--g2); }
.plan-opt input { margin-top: 4px; }
.checkout .dl { margin-bottom: 16px; }
.doc-page { background: var(--bg); padding: 24px 16px; }
.gst-doc { max-width: 820px; margin: 0 auto; display: grid; gap: 16px; }
.gst-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.gst-title { text-align: right; }
.gst-title h1 { margin: 0 0 4px; font-size: 22px; }
@media print { .doc-page { background: #fff; padding: 0; } .gst-doc { border: 0; box-shadow: none; } .no-print { display: none; } }
@media (max-width: 480px) { .pager { justify-content: center; text-align: center; } }
.secret { display: flex; gap: 8px; align-items: center; background: var(--fill); border-radius: 10px; padding: 10px 12px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }
.secret code { flex: 1; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.checklist li div { flex: 1; }
.checklist li p { margin: 0; color: var(--mute); font-size: 12.5px; }
.code-block { background: #14201b; color: #d9efe4; border-radius: 12px; padding: 14px 16px; font: 12.5px/1.6 ui-monospace, Consolas, monospace; overflow-x: auto; white-space: pre; margin: 0; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; }

/* ---------------------------------------------------------------- template preview (phone bubble) */
.wa-preview { background: #efe9e2; border-radius: 14px; padding: 16px; }
.wa-bubble { background: #fff; border-radius: 10px; padding: 8px 10px; max-width: 320px; box-shadow: 0 1px 1px rgba(0,0,0,.08); font-size: 13.5px; overflow-wrap: anywhere; }
.wa-text { white-space: pre-wrap; }
.wa-bubble .wa-head { font-weight: 700; margin-bottom: 4px; }
.wa-bubble .wa-media { height: 120px; border-radius: 8px; background: #dfe7e2; display: grid; place-items: center; color: #567163; margin-bottom: 6px; }
.wa-bubble .wa-foot { color: #8a8a83; font-size: 12px; margin-top: 4px; }
/* limited-time offer strip in the preview (0.3) */
.wa-offer { display: flex; flex-direction: column; gap: 2px; background: #f0f6f2; border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.wa-offer[hidden], .wa-offer [hidden] { display: none; }
.wa-offer span { color: #5d6b72; font-size: 12px; }
.wa-btn { max-width: 320px; background: #fff; border-radius: 10px; margin-top: 8px; padding: 8px; text-align: center; color: #1d74c4; font-weight: 600; font-size: 13px; }

/* ---------------------------------------------------------------- message log detail */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; background: #c9c9c3; flex: none; }
.timeline .on .dot { background: var(--ok); }
.timeline .fail .dot { background: var(--bad); }
.bubble { max-width: 520px; padding: 10px 14px; border-radius: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.in { background: #fff; border: 1px solid var(--line); border-top-left-radius: 4px; }
.bubble.out { background: var(--g2); color: #15342a; border-top-right-radius: 4px; margin-left: auto; }

/* ---------------------------------------------------------------- sign-in pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.auth-card .logo { display: block; padding: 0; margin-bottom: 18px; font-size: 24px; }
.auth-card h1 { font: 600 26px/1.2 var(--serif); margin-bottom: 6px; }

/* ---------------------------------------------------------------- phone */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app { background: none; }
  .side { position: static; height: auto; border-bottom: 1px solid var(--line); flex-direction: column; gap: 12px; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .navs { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 2px; scrollbar-width: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav a { white-space: nowrap; padding: 8px 12px; }
  .nav-foot { margin-top: 0; }
  .top { padding: 12px 16px; } .top h1 { font-size: 24px; } .who-name, .who-out { display: none; }
  .body { padding: 16px 16px 32px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .table.stack thead { display: none; }
  .table.stack tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; }
  .table.stack td::before { content: attr(data-label); color: var(--mute); font-size: 12px; font-weight: 600; }
  .table.stack td.num { text-align: right; }
}
@media (max-width: 520px) { .kpi { padding: 14px; } .kpi strong { font-size: 22px; } .kpi .kt { top: 12px; right: 12px; width: 28px; height: 28px; } .kpi p { padding-right: 32px; } }

/* ---------------------------------------------------------------- project colours (Projects::COLOURS order) */
.pc0 { background: #c2410c; } .pc1 { background: #2563eb; } .pc2 { background: #0f766e; } .pc3 { background: #7c3aed; }
.pc4 { background: #be185d; } .pc5 { background: #a16207; } .pc6 { background: #334155; } .pcg { background: var(--g); }

/* ---------------------------------------------------------------- change pills (delta_pill() in core/helpers.php) */
.delta { font-size: 12px; font-weight: 600; margin-left: 6px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); } .delta.new, .delta.flat { color: var(--mute); }

/* ---------------------------------------------------------------- helpers used across pages */
.grow { flex: 1; min-width: 0; }
ol.col, ul.col { list-style: none; margin: 0; padding: 0; }
.bubble a { color: inherit; text-decoration: none; } .bubble a:hover { text-decoration: underline; }
.bubble[aria-current="true"] { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------------- installer (modules/Install/views) */
.install { max-width: 760px; margin: 0 auto; padding: 28px 16px 48px; display: flex; flex-direction: column; gap: 20px; }
.install h1 { font: 600 26px/1.2 var(--serif); margin-bottom: 6px; }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: step; }
.stepper li { counter-increment: step; font-size: 12.5px; padding: 6px 10px; border-radius: 999px; background: var(--fill); color: var(--mute); }
.stepper li::before { content: counter(step) ". "; }
.stepper li.done { background: var(--okb); color: var(--ok); } .stepper li.current { background: var(--g); color: #fff; font-weight: 600; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }

/* ---------------------------------------------------------------- public legal pages (modules/Legal) */
.legal { max-width: 820px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 20px; }
.legal-head { display: flex; justify-content: space-between; align-items: center; }
.legal-head .logo { padding: 0; }
.legal-body { padding: 28px 32px; font-size: 15px; line-height: 1.65; }
.legal-body h1 { font: 600 32px/1.2 var(--serif); margin-bottom: 4px; }
.legal-body h2 { font-size: 18px; font-weight: 600; margin: 28px 0 8px; }
.legal-body ul, .legal-body ol { padding-left: 22px; margin: 0 0 12px; display: grid; gap: 6px; }
.legal-foot { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
.legal-foot nav { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; font-size: 13.5px; }
.legal-foot a[aria-current="page"] { font-weight: 600; text-decoration: none; color: var(--ink); }
.auth-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 16px; font-size: 12.5px; }
@media (max-width: 520px) { .legal-body { padding: 20px 18px; } .legal-body h1 { font-size: 26px; } }
.register { margin: 4px 0 10px; } .register summary { cursor: pointer; color: var(--g); font-weight: 600; width: max-content; }
.register form { margin-top: 8px; }

/* ---------------------------------------------------------------- icons: two-tone bodies (core/Icons.php FILLS) */
.icon .i-fill { display: none; }
.nav a[aria-current="page"] .i-fill { display: inline; fill: currentColor; stroke: none; opacity: .22; }
.kpi .kt .i-fill, .tile .i-fill { display: inline; fill: currentColor; stroke: none; opacity: .16; }

/* ---------------------------------------------------------------- sub-cards: a group inside a card (template buttons, consent purposes) */
.sub-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fcfcfb; display: flex; flex-direction: column; gap: 12px; }
.sub-card + .sub-card { margin-top: 10px; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wa-text.wa-empty { color: #8a8a83; font-style: italic; }
.history-h { margin-top: 18px; }
.toolbar > .btn { align-self: flex-end; }
.toolbar .field.grow { flex: 1 1 240px; }
.msg-line { display: inline-flex; gap: 8px; align-items: flex-start; }
.dir { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; flex: none; margin-top: 1px; }
.dir .icon { width: 13px; height: 13px; }
.dir.out { background: var(--skyb); color: var(--sky); } .dir.in { background: var(--viob); color: var(--vio); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.seg { align-self: flex-start; max-width: 100%; }
.toolbar > .input { width: auto; flex: 1 1 220px; min-width: 0; }
.card-head > .toolbar { flex-wrap: nowrap; }
.top h1 { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 860px) { .top h1 { font-size: 22px; } .top .chip { display: none; } }
dd.secret, dl.col dd { margin: 0; }
.secret code { word-break: break-all; }
.hint + .dl, .chips + .hint { margin-top: 8px; }
.dl + .form-actions, .dl + form, .card-head + .form-actions { margin-top: 14px; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: #fff; }
@media (max-width: 860px) {
  /* stacked tables: the first cell is the row's title (name + number), shown full width without a label */
  .table.stack td:first-child { display: block; padding: 2px 0 6px; font-size: 14.5px; }
  .table.stack td:first-child::before { content: none; }
  .table.stack td { align-items: center; }
  /* filter rows: search full width, the other filters two by two */
  .toolbar .field { flex: 1 1 calc(50% - 10px); min-width: 0; }
  .toolbar .field:first-child { flex-basis: 100%; }
  .toolbar > .grow { display: none; }
}
.field > label.check, label.check { font-weight: 400; }
legend { padding: 0; }
@media (max-width: 860px) { .card-head { flex-wrap: wrap; } .card-head > .toolbar { width: 100%; } }

/* colour picker (project colour): the dot is the choice, a ring shows the chosen one */
.colour-pick { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 13px; background: #fff; }
.colour-pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.colour-pick .swatch { width: 16px; height: 16px; }
.colour-pick:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); font-weight: 600; }
.colour-pick:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.table td { vertical-align: middle; }
code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .9em; background: var(--fill); padding: 1px 5px; border-radius: 5px; }
pre code, .secret code, .code-block code { background: none; padding: 0; }
.table-wrap + form, .table-wrap + .form { margin-top: 18px; }

/* spacing inside cards: every block after the first gets the same gap (headings carry no margin of their own) */
.card.pad > * + * { margin-top: 14px; }
.card-head { margin-bottom: 0; }
.bubble { white-space: normal; width: fit-content; }
.bubble-text { white-space: pre-wrap; }
.bubble[aria-current="true"] { outline: 0; box-shadow: 0 0 0 2px var(--g) inset; }
.dl dt { flex: none; }
.dl dd { flex: 1; min-width: 0; }
@media (min-width: 1101px) { .sticky-side { position: sticky; top: 20px; } }
.auth-card .form + .form-actions, .auth-card .form + form { margin-top: 14px; }
.auth-card .chip + h1 { margin-top: 10px; }
.rows b.tabular, .tabular.nowrap { white-space: nowrap; }
input[type="file"].input { padding: 6px 8px; }
input[type="file"]::file-selector-button { font: 600 13px var(--font); border: 1px solid var(--line); background: var(--fill); color: var(--ink); border-radius: 8px; padding: 6px 12px; margin-right: 10px; cursor: pointer; }

/* ---------------------------------------------------------------- inbox (0.2) */
/* three panes on a laptop: chats, the open chat, contact; the thread and the list scroll inside, the page does not */
.inbox { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) minmax(240px, 280px); gap: 16px; height: calc(100dvh - 150px); min-height: 520px; }
.inbox:not(.has-chat) { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
.inbox > .card { min-height: 0; }
.inbox-list { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.inbox-list-head { padding: 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line-2); }
.seg-wrap { flex-wrap: wrap; }
.seg .count { font-size: 12px; color: var(--mute); margin-left: 2px; }
.inbox-search .input { width: 100%; }
[data-chat-list] { flex: 1; overflow-y: auto; }
.chat-list { list-style: none; margin: 0; padding: 4px 0; }
.chat-list a { display: flex; gap: 10px; padding: 10px 12px; text-decoration: none; color: inherit; border-left: 3px solid transparent; }
.chat-list a:hover { background: var(--fill); }
.chat-list a[aria-current="true"] { background: var(--g2); border-left-color: var(--g); }
.chat-line { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.chat-top, .chat-bottom { display: flex; align-items: center; gap: 8px; justify-content: space-between; min-width: 0; }
.chat-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.chat-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.chip.tiny { font-size: 12px; padding: 1px 6px; }
.icon.tiny { width: 13px; height: 13px; vertical-align: -2px; }
.badge-count, .nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--g); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.nav-badge { margin-left: auto; }
.nav-badge[hidden] { display: none; }
.small-empty { padding: 28px 16px; }
.inbox-list .pager { padding: 0 12px 12px; }
.inbox-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; margin: 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.inbox-foot a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
[data-alerts-toggle][aria-pressed="true"] { color: var(--g); font-weight: 600; }

.inbox-chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.inbox-placeholder { justify-content: center; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.chat-head h2 { font-size: 16px; margin: 0; }
.chat-head .grow { min-width: 0; flex: 1 1 160px; }
.chat-head { flex-wrap: wrap; } /* v0.7.3: the chips go under the name when there is no room */
.chat-head .chip { white-space: nowrap; }
.chat-back { display: none; }
.thread { flex: 1; overflow-y: auto; padding: 16px; background: #efe9e2; display: flex; flex-direction: column; gap: 8px; } /* 8 px: the layout audit's minimum between stacked items (v0.8.3) */
.thread-day { text-align: center; margin: 10px 0 4px; }
.thread-day span { background: #fff; color: var(--mute); font-size: 12px; padding: 3px 10px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.thread-more { text-align: center; margin: 0 0 6px; }
.msg { display: flex; }
.msg.out { justify-content: flex-end; }
.msg .bubble { max-width: min(560px, 82%); padding: 7px 10px 5px; border-radius: 10px; box-shadow: 0 1px 1px rgba(0,0,0,.08); border: 0; }
.msg .bubble.in { background: #fff; border-top-left-radius: 2px; }
.msg .bubble.out { background: #d9fdd3; border-top-right-radius: 2px; }
.msg .bubble-text { margin: 0; }
.msg-tag { margin: 0 0 3px; color: var(--mute); display: flex; align-items: center; gap: 4px; }
.msg-img { display: block; max-width: 260px; width: 100%; height: auto; border-radius: 8px; margin-bottom: 4px; }
.msg audio { max-width: 260px; }
.msg-meta { margin: 2px 0 0; color: #5d6b72; text-align: right; display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.msg-error { margin: 4px 0 0; color: var(--bad); }
/* ticks: clock while waiting, one tick sent, two ticks delivered, blue ticks read, alert when failed */
.tick .icon { display: none; }
.tick-queued .t-wait, .tick-sending .t-wait { display: inline; }
.tick-accepted .t-one, .tick-sent .t-one { display: inline; }
.tick-delivered .t-two, .tick-read .t-two { display: inline; }
.tick-read .t-two { color: #1d74c4; }
.tick-failed .t-fail { display: inline; color: var(--bad); }
.note-card { align-self: center; width: min(560px, 92%); background: #fff7d6; border: 1px solid #f2e2a3; border-radius: 10px; padding: 8px 12px; }
.note-meta { margin: 0 0 2px; color: #6d5a1d; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.note-body { margin: 0; }
.note-edit summary { cursor: pointer; color: #6d5a1d; margin-top: 4px; }
.note-edit form { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }

.composer { border-top: 1px solid var(--line-2); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--card); position: relative; }
.composer .seg button { padding: 6px 12px; border-radius: 8px; color: #5f5f58; background: none; border: 0; cursor: pointer; font: inherit; font-size: 12.5px; }
.composer .seg button[aria-current="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.composer-form { display: flex; flex-direction: column; gap: 8px; }
.composer-form[hidden] { display: none; }
.composer-form textarea { resize: vertical; min-height: 44px; max-height: 200px; }
.composer-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer-row .hint { margin: 0; }
.note-input { background: #fffbe8; }
.file-pick { position: relative; overflow: hidden; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-pick:has(input:disabled) { opacity: .5; }
.saved-pick { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); max-height: 240px; overflow-y: auto; list-style: none; margin: 0; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 5; }
.saved-pick[hidden], .saved-pick li[hidden] { display: none; }
.saved-pick li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.saved-pick li:hover, .saved-pick li[aria-selected="true"] { background: var(--g2); }
.small-preview { padding: 10px; }

.inbox-side { overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 1280px) {
  .inbox, .inbox:not(.has-chat) { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
  .inbox.has-chat { height: auto; }
  .inbox.has-chat .inbox-list { grid-row: span 2; max-height: calc(100dvh - 150px); align-self: start; }
  .inbox.has-chat .inbox-chat { height: calc(100dvh - 150px); min-height: 520px; }
  .inbox-side { grid-column: 2; }
}
@media (max-width: 860px) {
  /* phone: the list, or the open chat full screen with a back button */
  .inbox, .inbox:not(.has-chat) { display: block; height: auto; min-height: 0; }
  .inbox.has-chat .inbox-list, .inbox:not(.has-chat) .inbox-placeholder { display: none; }
  .inbox-list { max-height: none; }
  /* the chat fills the screen (inbox.js scrolls it into view), so the reply box is always at the bottom edge */
  .inbox.has-chat .inbox-chat { height: calc(100dvh - 8px); min-height: 420px; margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; scroll-margin-top: 0; }
  .inbox-side { margin-top: 16px; }
  .chat-back { display: inline-flex; }
  .msg .bubble { max-width: 88%; }
  .chat-head .chip { display: none; }
  /* the menu row must not grow to fill a short page (the stretched Inbox pill, 0.2) */
  .side .navs { flex: none; align-items: center; }
}

/* ------------------------------------------------------------------ campaigns (0.3) */
.wa-quote { white-space: pre-wrap; background: var(--fill); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; }
.value-row { align-items: end; }
.tick-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 12px; }
.kpis-3 .kpi { background: var(--fill); border-radius: 10px; padding: 12px 14px; }
.kpis-3 .kpi p { padding-right: 0; }
.kpis-3 .kpi strong { font-size: 22px; }
.progress { display: block; width: 100%; height: 8px; margin: 4px 0 6px; border: 0; border-radius: 99px; overflow: hidden; background: var(--fill); appearance: none; accent-color: var(--g); }
.progress::-webkit-progress-bar { background: var(--fill); }
.progress::-webkit-progress-value { background: var(--g); border-radius: 99px; }
.progress::-moz-progress-bar { background: var(--g); border-radius: 99px; }
.card .label { margin: 14px 0 4px; font-size: 13px; }
.form-actions form { display: contents; }
@media (max-width: 520px) { .kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card .label + .rows li:first-child { padding-top: 6px; }

/* ------------------------------------------------------------------ carousel + location previews (0.3.1) */
.wa-cards { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.wa-cards[hidden] { display: none; }
.wa-card { flex: 0 0 200px; background: #fff; border-radius: 10px; padding: 6px; scroll-snap-align: start; font-size: 13px; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.wa-card .wa-media { height: 110px; border-radius: 8px; background: #dfe7e2; display: grid; place-items: center; color: #567163; }
.wa-card .wa-text { padding: 6px 4px 0; overflow-wrap: anywhere; }
.wa-card .wa-btn { margin-top: 8px; box-shadow: none; border-top: 1px solid var(--line-2); border-radius: 0; padding: 8px 4px 2px; }
.wa-media.wa-map { background: repeating-linear-gradient(45deg, #e3ece6 0 12px, #d7e3da 12px 24px); color: #3c5a48; font-weight: 600; }.wa-card .msg-img { display: block; width: 100%; height: 110px; object-fit: cover; border-radius: 8px; }

/* ------------------------------------------------------------------ chatbot (0.4) */
.narrow { max-width: 720px; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.btn-row form { display: contents; }
.bot-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bot-step { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; scroll-margin-top: 80px; }
.bot-step:target { border-color: var(--g); box-shadow: 0 0 0 3px rgba(31,122,77,.12); }
.bot-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bot-step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.bot-step-text { margin: 6px 0 8px; overflow-wrap: anywhere; }
.add-step { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.add-step .label { margin: 0 0 8px; }
.kw-form { align-items: end; margin-top: 12px; }
.kw-form .form-actions { margin: 0; }
.choice-row { align-items: end; border-top: 1px solid var(--line-2); padding-top: 10px; }
.choice-row:first-of-type { border-top: 0; padding-top: 0; }
.test-chat .thread { min-height: 320px; max-height: 60vh; border-radius: 10px; margin-bottom: 12px; }
.test-note { align-self: center; background: #fff8e6; color: #6b5310; border-radius: 8px; padding: 6px 10px; margin: 4px 0; display: flex; gap: 6px; align-items: center; }
.test-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.test-choices form { display: block; }
.test-tap { display: block; width: 100%; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 13px; color: #1d74c4; background: #fff; margin: 0; }
.test-tap:hover { background: #f4f8fc; }
.test-tap:focus-visible { outline: 2px solid var(--g); outline-offset: 2px; }
.test-say { display: flex; gap: 8px; }
.test-say .input { flex: 1; min-width: 0; }
.hours-grid { display: flex; flex-direction: column; gap: 8px; }
.hours-grid[hidden] { display: none; }
.hours-row { display: grid; grid-template-columns: 130px minmax(0, 120px) auto minmax(0, 120px); align-items: center; gap: 8px; }
.hours-row .error { grid-column: 1 / -1; }
@media (max-width: 520px) { .hours-row { grid-template-columns: 1fr 1fr; } .hours-row .check { grid-column: 1 / -1; } .hours-row > span.muted { display: none; } }

/* ------------------------------------------------------------------ v0.6.3 design review: phone menu + inbox */
.tabbar, .chat-info { display: none; }
.take-chat { margin: 0; }
.window-note { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--warnb); color: #6b4a0b; font-size: 13.5px; line-height: 1.45; }
@media (max-width: 860px) {
  /* the menu moves to a tab bar at the bottom: Inbox, Contacts, Campaigns + More */
  .side .navs { display: none; }
  .side { flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px; }
  .side .proj { flex: 1; min-width: 0; }
  .side .proj summary { padding: 6px 10px; }
  .tabbar { display: flex; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar > a, .tab-more > summary { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px;
    border-radius: 12px; color: var(--ink-2); font-size: 12px; text-decoration: none; list-style: none; cursor: pointer; position: relative; }
  .tab-more > summary::-webkit-details-marker { display: none; }
  .tabbar > a[aria-current="page"], .tab-more > summary[aria-current="page"] { color: var(--g); font-weight: 600; background: var(--g2); }
  .tabbar .nav-badge { position: absolute; top: 4px; left: calc(50% + 6px); }
  .tab-more { flex: 1; display: flex; }
  .tab-sheet { position: fixed; left: 8px; right: 8px; bottom: calc(64px + env(safe-area-inset-bottom)); background: #fff; border: 1px solid var(--line);
    border-radius: 16px; box-shadow: 0 -8px 32px rgba(0,0,0,.12); padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; max-height: 70vh; overflow: auto; }
  .tab-sheet a { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 14px; }
  .tab-sheet a[aria-current="page"] { background: var(--g2); color: var(--g); font-weight: 600; }
  .body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* an open chat fills the screen; the reply box stays at the bottom edge */
  body.chat-open .side, body.chat-open .top, body.chat-open .tabbar { display: none; }
  body.chat-open .body { padding: 0; }
  .inbox.has-chat .inbox-chat { position: fixed; inset: 0; z-index: 30; height: 100dvh; min-height: 0; margin: 0; border: 0; border-radius: 0; }
  .inbox.has-chat .inbox-side { display: none; }
  .chat-info { display: block; }
  .chat-info > summary { list-style: none; }
  .chat-info > summary::-webkit-details-marker { display: none; }
  .chat-sheet { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-height: 82dvh; overflow: auto; background: #fff; border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgba(0,0,0,.18); padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
  .sheet-title { font-size: 16px; margin: 0; }
  .take-chat span { display: none; }
  .composer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  .chat-info[open] .chat-sheet, .tab-more[open] .tab-sheet { animation: sheet-up .22s cubic-bezier(.23, 1, .32, 1); }
}
@keyframes sheet-up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* v0.6.3: failed message reason + Try again inline; template name as a small chip under the words */
.msg-error { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.msg-error form { display: inline; margin: 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; min-height: 24px; }
.link-btn:hover { color: var(--brand); }
.tpl-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-family: inherit; }

/* v0.6.3: inbox list — one filter row with an Unread switch; unread chats in bold; who said the last thing */
.chat-filters { display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chat-filters .seg { flex: none; }
.unread-toggle { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-weight: 600; font-size: 13px; text-decoration: none; }
.unread-toggle[aria-pressed="true"] { background: var(--g); border-color: var(--g); color: #fff; }
.unread-toggle[aria-pressed="true"] .count { color: #fff; }
.chat-list a.is-unread .chat-top b, .chat-list a.is-unread .chat-preview { font-weight: 700; color: var(--ink); }
.who-said { color: var(--mute); font-weight: 600; }
.chat-list a.is-unread .who-said { color: var(--ink-2); }

/* v0.6.3: template form — checks under the preview */
.checks-h { font-size: 14px; margin: 16px 0 6px; }
.tpl-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.tpl-checks .ok-line { color: var(--ok); }
.tpl-checks .bad-line { color: var(--bad); font-weight: 600; }

/* v0.6.3: consent history as a timeline */
.consent-timeline li { align-items: flex-start; position: relative; padding-bottom: 2px; }
.consent-timeline .dot { margin-top: 5px; }

/* v0.6.3: "On this page" links on long pages (Settings → General) */
.jump { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
.jump a { color: var(--ink-2); padding: 6px 0; min-height: 32px; }
[id$="-h"], #account { scroll-margin-top: 16px; }
.chat-filters { flex-wrap: wrap; overflow: visible; }
.chat-filters .seg { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.msg-error { white-space: nowrap; flex-wrap: wrap; }
.msg-error > span { white-space: normal; flex-basis: 100%; }
.chat-filters .seg a { padding: 6px 8px; }
.chat-filters .unread-toggle { min-height: 32px; padding: 4px 12px; }

/* ---------------------------------------------------------------- v0.6.4 reports */
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.report-filters .field { min-width: 180px; margin: 0; }
.report-csv { margin-left: auto; }
.report-parts { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.report-range { margin: -4px 0 0; }
.chart { margin: 0; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .stroke-sky { stroke: var(--sky); } .chart .stroke-mint { stroke: var(--mint); } .chart .stroke-vio { stroke: var(--vio); }
.chart .fill-sky { fill: var(--sky); }
.chart .hit-area { fill: transparent; }
.chart .hit:hover .hit-area { fill: rgba(0,0,0,.04); }
.chart-legend { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key { width: 14px; height: 3px; border-radius: 2px; }
.key-sky { background: var(--sky); } .key-mint { background: var(--mint); } .key-vio { background: var(--vio); }
@media (max-width: 860px) { .report-filters .field { min-width: 0; flex: 1 1 140px; } .report-csv { margin-left: 0; } .chart-svg { height: 160px; } .chart-y { height: 160px; } }
/* chart: marks stretch in the SVG, labels stay real text (v0.6.4) */
.chart-body { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; }
.chart-svg { grid-column: 2; display: block; width: 100%; height: 200px; overflow: visible; }
.chart .grid { vector-effect: non-scaling-stroke; }
.chart-y { grid-column: 1; grid-row: 1; height: 200px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; font-size: 12px; color: var(--mute); }
.chart-y span { line-height: 0; }
.chart-x { grid-column: 2; display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--mute); }
.chart-x span { white-space: nowrap; }@media (max-width: 860px) { .chart-svg, .chart-y { height: 160px; } }

/* ---------------------------------------------------------------- v0.6.5 chat links */
.qr-box { display: grid; place-items: center; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr-box svg { width: 100%; max-width: 220px; height: auto; }
.poster { max-width: 148mm; margin: 0 auto; background: #fff; border-radius: 16px; padding: 32px 24px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.poster-name { margin: 0; font-size: 18px; font-weight: 600; color: var(--ink-2); }
.poster-title { margin: 0; font: 600 30px/1.15 var(--serif); }
.poster-qr svg { width: 72mm; max-width: 100%; height: auto; }
.poster-msg { margin: 0; font-size: 15px; color: var(--ink-2); max-width: 110mm; }
.poster-link { margin: 0; font-size: 14px; font-family: ui-monospace, Consolas, monospace; color: var(--mute); overflow-wrap: anywhere; }
.doc-page > .no-print { text-align: center; margin-top: 16px; }
@media print { .poster { border-radius: 0; padding: 12mm 8mm; } @page { size: A5; margin: 10mm; } }
.input-num { max-width: 100px; }

/* ---------------------------------------------------------------- v0.7.0 Qubox for Shopify (inside Shopify admin) */
.shopify-app { background: var(--bg); }
.shopify-main { max-width: 760px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.shopify-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.shopify-head .logo { margin: 0; padding: 0; }
.shopify-head p { margin: 0; }
.shopify-main form { display: grid; gap: 8px; justify-items: start; margin-top: 8px; }
.shopify-done { max-width: 480px; margin: 40px auto; text-align: center; display: grid; gap: 8px; }
.shopify-done h1 { font: 600 24px/1.2 var(--serif); margin: 0; }
.shopify-main > * { min-width: 0; overflow-wrap: anywhere; }
.plan-pick { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
ol.steps-list { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; }
