/* SmokoBooks — renderer stylesheet. Light theme only (desktop app). */

:root {
  --black: #0B0F14;
  --charcoal: #1F2937;
  --steel: #5C6675;
  --paper: #F7F8FA;
  /* Brand accent. app.js overwrites these four on the root element from settings.branding.accent
     (applyAccent) — amber is only the fallback before settings load or when no accent is saved.
     --accent-ink is black or white depending on the accent's luminance so primary buttons stay readable. */
  --accent: #F5B300;
  --accent-ink: #0B0F14;
  --accent-hover: #FFC21A;
  --accent-ring: rgba(245, 179, 0, 0.35);
  --amber: var(--accent);
  --amber-dark: #C99200;
  --green: #15803D;
  --red: #B91C1C;
  --warn: #B45309;
  --blue: #1D4ED8;
  --white: #FFFFFF;
  --text: #111827;
  --muted: #5C6675;
  --line: #E3E6EB;
  --line-strong: #C9CFD8;
  --hover: #F1F3F6;
  --rail-w: 232px;
  --rail-w-collapsed: 60px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 8px 28px rgba(11, 15, 20, 0.16);
  --font: -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 10px; }
a { color: var(--blue); }
button { font: inherit; }
.num, .money, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1 1 auto; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mb16 { margin-bottom: 16px; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
/* Every inline icon produced by icon() in app.js. Sized here so it can never inherit a layout width. */
svg.ic { width: 15px; height: 15px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }

/* ---------- Shell ---------- */
#app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  height: 100vh;
  width: 100vw;
  min-width: 800px;
}
body.rail-collapsed #app { grid-template-columns: var(--rail-w-collapsed) 1fr; }

#rail {
  background: var(--black);
  color: #C9D1DB;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid #000;
}
.rail-head {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-bottom: 1px solid #1a222c;
  background: #000;
}
.rail-head img { max-width: 100%; max-height: 52px; width: auto; height: auto; display: block; object-fit: contain; }
body.rail-collapsed .rail-head img { max-width: 40px; max-height: 40px; }
/* Wordmark used when no logo is uploaded: initials in an accent tile + the business name. */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: #fff; text-decoration: none; }
.brand .brand-tile { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 15px; letter-spacing: 0.02em; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; }
.brand .brand-name { font-weight: 650; font-size: 14px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand .brand-sub { display: block; font-size: 10.5px; color: #8b95a3; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
body.rail-collapsed #rail .brand .brand-name, body.rail-collapsed #rail .brand .brand-sub { display: none; }
@media (max-width: 959px) { #rail .brand .brand-name, #rail .brand .brand-sub { display: none; } }
/* First-run wizard: the rail is hidden and #main takes the full window. */
body.setup-mode #app { grid-template-columns: 1fr; }
body.setup-mode #rail { display: none; }
.rail-new { padding: 14px 12px 6px; }
.rail-new .btn { width: 100%; justify-content: center; }
body.rail-collapsed .rail-new .btn .lbl { display: none; }
body.rail-collapsed .rail-new .btn { padding: 9px 0; }
.rail-nav { display: flex; flex-direction: column; padding: 6px 8px; gap: 2px; }
.rail-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: #C9D1DB; text-decoration: none; font-weight: 500;
  border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer;
}
.rail-link:hover { background: #161d26; color: #fff; }
.rail-link.active { background: var(--charcoal); color: #fff; box-shadow: inset 3px 0 0 var(--amber); }
.rail-link svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail-link .lbl { white-space: nowrap; overflow: hidden; }
body.rail-collapsed .rail-link { justify-content: center; padding: 10px 0; }
body.rail-collapsed .rail-link .lbl { display: none; }
.rail-foot { margin-top: auto; padding: 10px 12px 12px; border-top: 1px solid #1a222c; font-size: 12px; color: #8b95a3; display: flex; align-items: center; gap: 8px; }
.rail-foot .biz { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.rail-collapsed .rail-foot .biz { display: none; }
/* Business name + "Made by …" stacked; both vanish with the collapsed rail. */
.rail-foot .rail-foot-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rail-foot .rail-foot-txt .biz { flex: none; }
.rail-foot .made-by { font-size: 10.5px; color: #6f7a88; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-foot .made-by:hover { color: #C9D1DB; text-decoration: underline; }
body.rail-collapsed .rail-foot .rail-foot-txt, body.rail-collapsed .rail-foot .made-by { display: none; }
@media (max-width: 959px) { .rail-foot .rail-foot-txt, .rail-foot .made-by { display: none; } }
.rail-toggle { background: transparent; border: 1px solid #2a3440; color: #aab3bf; border-radius: 6px; width: 28px; height: 28px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.rail-toggle:hover { color: #fff; border-color: #55616f; }
.rail-toggle svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

@media (max-width: 959px) {
  #app { grid-template-columns: var(--rail-w-collapsed) 1fr; }
  .rail-head img { max-width: 40px; max-height: 40px; }
  .rail-new .btn .lbl, .rail-link .lbl, .rail-foot .biz { display: none; }
  .rail-new .btn { padding: 9px 0; }
  .rail-link { justify-content: center; padding: 10px 0; }
  .rail-toggle { display: none; }
}

#main { min-width: 0; min-height: 0; overflow: auto; position: relative; }
.page { padding: 22px 28px 40px; max-width: 1360px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.loading { padding: 60px 20px; text-align: center; color: var(--muted); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(0,0,0,0.15); border-top-color: var(--charcoal); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -3px; }
.btn .spinner { border-color: rgba(0,0,0,0.2); border-top-color: currentColor; width: 13px; height: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid var(--line-strong); background: var(--white); }
.banner.warn { border-color: #F3D9A4; background: #FFF8E6; color: #7A4A00; }
.banner.ok { border-color: #BBE3C7; background: #EEFBF2; color: #14532D; }
.banner.err { border-color: #F3BFBF; background: #FFF1F1; color: #7F1D1D; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--white); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap; line-height: 1.2;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--hover); border-color: #AEB6C2; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-dark { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.btn-dark:hover { background: #111827; border-color: #111827; }
.btn-danger { color: var(--red); border-color: #E8B4B4; }
.btn-danger:hover { background: #FFF1F1; border-color: var(--red); }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #991B1B; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.btn-icon { padding: 6px; width: 30px; height: 30px; justify-content: center; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; text-transform: capitalize; border: 1px solid transparent; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.s-draft { background: #EEF0F3; color: var(--steel); }
.pill.s-sent { background: #E7EEFC; color: var(--blue); }
.pill.s-accepted, .pill.s-paid, .pill.s-completed { background: #E7F6EC; color: var(--green); }
.pill.s-declined { background: #FCE8E8; color: var(--red); }
.pill.s-expired { background: #FDF0E0; color: var(--warn); }
.pill.s-overdue { background: #FCE8E8; color: var(--red); }
.pill.s-expiring { background: #FDF0E0; color: var(--warn); }
.pill.s-new { background: #FFF6D6; color: #7A4A00; }
.pill.plain::before { display: none; }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); color: var(--text); cursor: pointer; font-size: 13px; font-weight: 500; }
.chip:hover { background: var(--hover); }
.chip.active { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.chip .cnt { opacity: 0.7; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Panels ---------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 14px; }
.panel-body { padding: 16px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 220px; max-width: 360px; }

/* ---------- Tables ---------- */
.tbl-wrap { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; background: #FBFBFC; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .sort-ind { display: inline-block; margin-left: 4px; opacity: 0.6; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.actions { width: 44px; text-align: right; padding-right: 8px; }
.tbl .strong { font-weight: 600; }
.tbl-empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.tbl-empty .btn { margin-top: 12px; }

/* ---------- Forms ---------- */
label { font-size: 12.5px; font-weight: 600; color: var(--charcoal); display: block; margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="time"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--white);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 10px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--charcoal); box-shadow: 0 0 0 3px var(--accent-ring); }
input:read-only, input[readonly] { background: #F3F4F6; color: var(--steel); }
input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }
input.invalid, textarea.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15); }
textarea { resize: vertical; min-height: 60px; }
select { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235C6675' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }
.field { margin-bottom: 14px; min-width: 0; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .err { font-size: 12px; color: var(--red); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; row-gap: 0; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; column-gap: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--text); cursor: pointer; margin: 0; }
.check input { width: 16px; height: 16px; accent-color: var(--charcoal); margin: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; padding: 4px 0; }
.radios { display: flex; flex-wrap: wrap; gap: 6px; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-pill span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); cursor: pointer; font-weight: 500; font-size: 13px; }
.radio-pill input:checked + span { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.radio-pill input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.radio-pill span:hover { background: var(--hover); }
.radio-pill input:checked + span:hover { background: #111827; }
.input-money { position: relative; }
.input-money::before { content: "$"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-money input { padding-left: 22px; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row > * { min-width: 0; }
.input-row .btn { flex: 0 0 auto; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
@media (min-width: 1360px) { .kpis { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .k-value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.2; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi.alert .k-value { color: var(--warn); }
.kpi.danger .k-value { color: var(--red); }
.kpi.good .k-value { color: var(--green); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.board-col { background: var(--paper); border-radius: var(--radius-sm); min-height: 120px; padding: 8px; min-width: 0; }
.board-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); display: flex; justify-content: space-between; margin: 2px 4px 8px; }
.board-col h4 .cnt { font-variant-numeric: tabular-nums; color: var(--text); }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 6px; cursor: pointer; min-width: 0; }
.card:hover { border-color: var(--line-strong); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.card .c-no { font-weight: 650; font-size: 13px; display: flex; justify-content: space-between; gap: 6px; }
.card .c-no .age { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.card .c-cust { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .c-total { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; margin-top: 2px; }
.board-empty { color: var(--muted); font-size: 12.5px; padding: 12px 6px; text-align: center; }
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.attn li:last-child { border-bottom: 0; }
.attn li:hover { background: var(--hover); }
.attn .a-main { flex: 1; min-width: 0; }
.attn .a-title { font-weight: 600; font-size: 13px; }
.attn .a-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.activity li:last-child { border-bottom: 0; }
.activity .when { color: var(--muted); font-size: 12px; white-space: nowrap; flex: 0 0 88px; font-variant-numeric: tabular-nums; }
.activity .what a { color: var(--text); font-weight: 600; text-decoration: none; }
.activity .what a:hover { text-decoration: underline; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 10px; }
.chart { position: relative; padding: 8px 12px 6px; }
.chart svg { width: 100%; height: auto; display: block; font-family: var(--font); }
.chart .bar { cursor: pointer; }
.chart .bar:hover { opacity: 0.85; }
.chart-tip { position: absolute; pointer-events: none; background: var(--black); color: #fff; padding: 6px 9px; border-radius: 6px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow); z-index: 2; }
.chart-tip b { font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: var(--sw); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.tpl-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tpl-opt { text-align: left; background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; }
.tpl-opt:hover { border-color: var(--charcoal); background: var(--hover); }
.tpl-opt b { display: block; font-size: 14px; }
.tpl-opt span { color: var(--muted); font-size: 12.5px; }
@media (max-width: 700px) { .tpl-picker { grid-template-columns: 1fr; } }

/* ---------- Customers ---------- */
.cust-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.cust-list { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 220px); overflow: auto; }
.cust-list li { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.cust-list li:last-child { border-bottom: 0; }
.cust-list li:hover { background: var(--hover); }
.cust-list li.active { background: #FFF6D6; box-shadow: inset 3px 0 0 var(--amber); }
.cust-list .c-name { font-weight: 600; }
.cust-list .c-meta { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .cust-layout { grid-template-columns: 1fr; } .cust-list { max-height: 260px; } }

/* ---------- Editor ---------- */
.editor { max-width: 1040px; padding-bottom: 90px; }
.ed-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.ed-head .ttl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ed-head .no { font-family: var(--mono); font-size: 14px; background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 3px 8px; }
.ed-head .no.pending { color: var(--muted); font-style: italic; font-family: var(--font); font-size: 12.5px; }
.ed-meta { display: grid; grid-template-columns: 180px 1fr auto; gap: 16px; align-items: end; }
.ed-meta .field { margin-bottom: 0; }
.sec { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.sec-head { padding: 11px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-head h2 { font-size: 14px; }
.sec-body { padding: 16px 18px 4px; }
.sec-body.tight { padding: 12px 18px; }
.cust-block .linked { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--green); font-weight: 600; }
.suggest { position: relative; }
.suggest-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 260px; overflow: auto; margin-top: 4px; }
.suggest-list button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 12px; cursor: pointer; }
.suggest-list button:hover, .suggest-list button.hl { background: var(--hover); }
.suggest-list .s-name { font-weight: 600; }
.suggest-list .s-meta { color: var(--muted); font-size: 12px; }
.suggest-list .s-none { padding: 10px 12px; color: var(--muted); font-size: 13px; }

.grid-wrap { overflow-x: auto; }
.grid { border-collapse: collapse; width: 100%; }
.grid th, .grid td { padding: 4px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; text-align: left; padding-bottom: 6px; white-space: nowrap; }
.grid th.num { text-align: right; }
.grid input, .grid select { padding: 6px 8px; }
.grid td.ro { text-align: right; font-variant-numeric: tabular-nums; padding-right: 10px; color: var(--charcoal); font-weight: 500; }
.grid td.rm { width: 34px; text-align: center; }
.grid td.rown { width: 28px; color: var(--muted); font-size: 12px; text-align: right; }
.grid .btn-icon { width: 26px; height: 26px; padding: 0; border-color: transparent; color: var(--muted); }
.grid .btn-icon:hover { color: var(--red); background: #FFF1F1; }
.grid-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 12px; flex-wrap: wrap; }
.grid-foot .note { color: var(--warn); font-size: 12.5px; font-weight: 500; }
.totals { margin-left: auto; min-width: 280px; }
.totals .row { display: flex; justify-content: space-between; gap: 20px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.totals .row.total { border-top: 1px solid var(--line-strong); margin-top: 4px; padding-top: 6px; font-weight: 700; font-size: 15px; }
.totals .row .lbl { color: var(--muted); }
.totals .row.total .lbl { color: var(--text); }
.totals .gst-note { font-size: 12px; color: var(--muted); }
.grid-empty { padding: 14px 0; color: var(--muted); font-size: 13px; }

.visual { border-collapse: collapse; width: 100%; }
.visual th, .visual td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.visual th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.visual td.lbl { font-size: 13px; width: 38%; }
.visual td.st { white-space: nowrap; width: 200px; }
.visual .radios { flex-wrap: nowrap; gap: 4px; }
.visual .radio-pill span { padding: 4px 9px; font-size: 12px; min-width: 34px; text-align: center; }
.visual input[type="text"] { padding: 5px 8px; font-size: 13px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--paper); }
.photo img { width: 100%; height: 120px; object-fit: cover; display: block; background: #E5E7EB; }
.photo .p-body { padding: 8px; }
.photo input { padding: 5px 8px; font-size: 13px; }
.photo .p-actions { display: flex; gap: 4px; margin-top: 6px; justify-content: flex-end; }
.photo .p-actions .btn { padding: 2px 7px; font-size: 12px; }
.photo-slot { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); min-height: 60px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12.5px; }

.sigpad { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--white); position: relative; touch-action: none; }
.sigpad canvas { display: block; width: 100%; height: 160px; cursor: crosshair; border-radius: var(--radius-sm); }
.sigpad .sig-line { position: absolute; left: 24px; right: 24px; bottom: 34px; border-top: 1px dashed var(--line-strong); pointer-events: none; }
.sigpad .sig-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.sig-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }

.actionbar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-top: 8px; box-shadow: 0 -6px 20px rgba(11, 15, 20, 0.08);
}
.actionbar .state { color: var(--muted); font-size: 12.5px; flex: 1 1 auto; }
.actionbar .state.dirty { color: var(--warn); font-weight: 600; }

.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 140px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.hist li:last-child { border-bottom: 0; }
.hist .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.hist .bad { color: var(--red); }
.hist .good { color: var(--green); }

/* ---------- Menus / popovers ---------- */
.menu { position: fixed; z-index: 60; background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 4px; min-width: 190px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; text-align: left; border: 0; background: transparent; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-weight: 500; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--red); }
.menu .sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu .mh { padding: 6px 12px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }

/* ---------- Modals ---------- */
.overlay { position: fixed; inset: 0; background: rgba(11, 15, 20, 0.5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--white); border-radius: 10px; box-shadow: var(--shadow); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.lg { max-width: 860px; }
.modal.xl { max-width: 1180px; height: calc(100vh - 40px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 18px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.modal-body.flush { padding: 0; display: flex; }
.modal-body iframe { border: 0; width: 100%; height: 100%; flex: 1; min-height: 400px; background: #525659; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .grow { flex: 1; }
.modal p.lead { font-size: 14px; }
.attach { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.attach svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { background: var(--black); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; animation: toastin 0.18s ease-out; border-left: 4px solid var(--amber); }
.toast.ok { border-left-color: #22C55E; }
.toast.err { border-left-color: #EF4444; }
.toast .t-close { background: transparent; border: 0; color: #9aa4b1; cursor: pointer; padding: 0 2px; font-size: 16px; line-height: 1; }
@keyframes toastin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Settings ---------- */
.settings { max-width: 900px; padding-bottom: 90px; }
.num-grid { border-collapse: collapse; width: 100%; }
.num-grid th, .num-grid td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.num-grid th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.num-grid input { padding: 6px 8px; }
.num-grid td.name { font-weight: 600; white-space: nowrap; }
.num-grid td.preview { font-family: var(--mono); color: var(--muted); font-size: 12px; white-space: nowrap; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ======================================================================
   Ledger, dashboard and drawer additions
   ====================================================================== */

/* Rail groups + overflow (13 links now) */
.rail-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.rail-grp { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: #6f7a88; font-weight: 600; padding: 12px 10px 4px; }
.rail-grp:empty { padding: 4px 0 0; border-top: 1px solid #1a222c; margin-top: 6px; }
/* Collapsed rail: the group label becomes a thin separator (font-size 0 so no clipped letters show). */
body.rail-collapsed .rail-grp { padding: 0; height: 6px; overflow: hidden; font-size: 0; }
body.rail-collapsed .rail-grp:not(:empty) { border-top: 1px solid #1a222c; margin-top: 6px; }
@media (max-width: 959px) { .rail-grp { padding: 0; height: 6px; overflow: hidden; font-size: 0; } .rail-grp:not(:empty) { border-top: 1px solid #1a222c; margin-top: 6px; } }

/* Sub-tabs (Contacts, Expenses) */
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.subtab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.subtab:hover { color: var(--text); }
.subtab.on { color: var(--text); border-bottom-color: var(--amber); }
.subtab .cnt { font-size: 11px; background: var(--hover); color: var(--muted); padding: 1px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; }

/* Ledger pills (plain = no status dot) */
.pill.plain { text-transform: none; }
.pill.p-ok { background: #E7F6EC; color: var(--green); }
.pill.p-warn { background: #FDF0E0; color: var(--warn); }
.pill.p-bad { background: #FCE8E8; color: var(--red); }
.pill.p-info { background: #E7EEFC; color: var(--blue); }
.pill.p-neutral { background: #EEF0F3; color: var(--steel); }
.pill.p-accent { background: #FFF4CC; color: #6B4B00; }
.flags { display: flex; gap: 4px; flex-wrap: wrap; }

/* Toolbar filters */
.toolbar select.filter { width: auto; min-width: 140px; padding: 7px 28px 7px 10px; font-size: 13px; }

/* Tables: reconcile toggle, document links, wrapping description cells */
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.reccell { width: 38px; padding-right: 0; }
.rec { border: 1px solid var(--line-strong); background: var(--white); border-radius: 999px; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.rec svg.ic { width: 14px; height: 14px; stroke: #9aa4b1; stroke-width: 2.4; }
.rec.on { background: var(--green); border-color: var(--green); }
.rec.on svg.ic { stroke: #fff; }
.rec:hover { border-color: var(--green); }
.rec:disabled { opacity: 0.5; cursor: wait; }
.tbl td.wrapcell { min-width: 180px; max-width: 360px; white-space: normal; }
.tbl td.pos { color: var(--green); }
.tbl td.neg { color: var(--red); }
.tbl td.dim { color: var(--muted); }
.tbl td.actions.wide { width: auto; white-space: nowrap; }
.tbl-wrap.flat { border: 0; border-radius: 0; }
.doclinks { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.doclink { font-family: var(--mono); font-size: 11.5px; background: var(--hover); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--text); text-decoration: none; }
.doclink:hover { border-color: var(--line-strong); text-decoration: underline; }
.listfoot { padding: 10px 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); font-size: 12.5px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; background: #FBFBFC; }
.listfoot b { color: var(--text); font-variant-numeric: tabular-nums; }
.tbl-wrap:has(+ .listfoot) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.tbl-empty b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.taxtbl th, .taxtbl td { white-space: nowrap; }
.taxtbl th .lbl { display: block; font-size: 10px; color: #8a93a0; letter-spacing: 0; text-transform: none; font-weight: 500; }
.taxtbl tr.total td { font-weight: 700; background: #FBFBFC; }
.taxtbl th:first-child, .taxtbl td:first-child { position: sticky; left: 0; background: var(--white); z-index: 1; }
.taxtbl th:first-child { background: #FBFBFC; z-index: 2; }
.taxtbl tr.total td:first-child { background: #FBFBFC; }
.tbl tbody tr.total { cursor: default; }
.tbl tbody tr.total:hover { background: #FBFBFC; }

/* Sections, definition lists, meters, stats */
.section { margin-top: 22px; }
.sec-title { font-size: 12.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.sec-title .r { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 16px; font-size: 13.5px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.dl dd.neg { color: var(--red); }
.dl dd.pos { color: var(--green); }
.dl .tot { grid-column: 1 / -1; border-top: 1px solid var(--line); margin-top: 2px; }
.dl.tot { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.dl dt.big, .dl dd.big { font-size: 16px; font-weight: 700; color: var(--text); }
.meter { height: 8px; border-radius: 4px; background: #E7EAEF; overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.meter.warn i { background: var(--warn); }
.meter.bad i { background: var(--red); }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0; }
.note + .note { margin-top: 4px; }
.stat3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat3 > div { background: var(--paper); border-radius: var(--radius-sm); padding: 8px 10px; min-width: 0; }
.stat3 .l { font-size: 11px; color: var(--muted); }
.stat3 .v { font-weight: 700; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mb8 { margin-bottom: 8px; }

/* Dashboard additions */
.page-head .today { color: var(--muted); font-size: 13px; }
.page-head .fyfield { margin: 0; display: flex; align-items: center; gap: 8px; }
.page-head .fyfield label { margin: 0; }
select.fysel { width: auto; padding: 6px 30px 6px 10px; font-weight: 600; font-size: 13px; }
.kpis.k7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.k6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; margin-bottom: 16px; }
/* Seven money tiles only fit one row on a wide window; below that they wrap 4 + 3 so no figure is ever clipped. */
@media (min-width: 1500px) { .kpis.k7 { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
@media (min-width: 1360px) { .kpis.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
a.kpi { text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: var(--line-strong); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.kpi .k-value { white-space: nowrap; font-size: clamp(18px, 1.7vw, 24px); }
.kpis.k7 .kpi .k-value, .kpis.k6 .kpi .k-value { font-size: clamp(17px, 1.5vw, 22px); }
.kpi.hero { background: var(--black); border-color: var(--black); color: #E5E8EC; }
.kpi.hero .k-label, .kpi.hero .k-sub { color: #AEB6C2; }
.kpi.hero .k-value { color: #fff; }
.attn .a-n { font-weight: 700; min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; color: var(--red); }
.dates { list-style: none; margin: 0; padding: 0; }
.dates li { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.dates li:last-child { border-bottom: 0; }
.dates .dd { text-align: center; border-radius: var(--radius-sm); background: var(--paper); padding: 4px 0; line-height: 1.1; }
.dates .dd b { display: block; font-size: 16px; }
.dates .dd span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.dates .lab { font-size: 13.5px; font-weight: 600; }
.dates .note { font-size: 12px; }
.dates li.soon .dd { background: #FFF4CC; }
.dates li.past .dd { background: #FCE8E8; }
.panel > .listfoot { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); margin: 0; }

/* Editor: ledger link line */
.tracked { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; }
.tracked a { color: inherit; }

/* Drawer forms */
.drawer-back { position: fixed; inset: 0; background: rgba(11, 15, 20, 0.45); z-index: 40; opacity: 0; transition: opacity 0.18s; }
.drawer-back.show { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 100vw; z-index: 41; background: var(--white); display: flex; flex-direction: column; box-shadow: var(--shadow); transform: translateX(100%); transition: transform 0.2s ease; }
.drawer.show { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 16px; }
.drawer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 18px 4px; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--white); }
.fsect { grid-column: 1 / -1; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #8a93a0; font-weight: 600; padding-top: 12px; margin: 2px 0 10px; border-top: 1px solid var(--line); }
.field .req { color: var(--red); margin-left: 2px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15); }
.seg { display: inline-grid; grid-auto-flow: column; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: var(--white); padding: 7px 14px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; min-height: 36px; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--charcoal); color: #fff; }
.seg button:hover:not(.on) { background: var(--hover); }
.pctrow { display: grid; grid-template-columns: 1fr 84px; gap: 10px; align-items: center; }
input[type="range"] { width: 100%; accent-color: var(--amber); margin: 0; }

/* ======================================================================
   SmokoBooks — setup wizard, branding controls, first-run empty state
   ====================================================================== */
.setup { max-width: 760px; margin: 0 auto; padding: 36px 28px 60px; min-height: 100vh; display: flex; flex-direction: column; }
.setup-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.setup-top .brand .brand-name { color: var(--text); }
.setup-top .brand .brand-sub { color: var(--muted); }
.setup-dots { display: flex; gap: 6px; align-items: center; }
.setup-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); display: block; transition: background 0.15s, transform 0.15s; }
.setup-dots i.done { background: var(--charcoal); }
.setup-dots i.on { background: var(--accent); transform: scale(1.35); }
.setup-card { background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 24px rgba(11, 15, 20, 0.06); padding: 28px 30px 8px; }
.setup-card .step-kicker { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.setup-card h1 { font-size: 24px; margin-bottom: 6px; }
.setup-card .lead { color: var(--muted); font-size: 14.5px; margin-bottom: 20px; }
.setup-welcome { text-align: center; padding: 30px 10px 26px; }
.setup-welcome .brand-mark { display: block; width: 72px; height: 72px; margin: 0 auto 14px; }
.setup-welcome .brand-tile { width: 64px; height: 64px; border-radius: 16px; font-size: 26px; margin: 0 auto 18px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.setup-welcome h1 { font-size: 28px; }
.setup-welcome .lead { max-width: 480px; margin: 8px auto 0; }
.setup-foot { display: flex; align-items: center; gap: 8px; padding: 18px 0 4px; }
.setup-foot .grow { flex: 1; }
.setup-foot .cancel { color: var(--muted); font-size: 13px; }
.field .warn-text { font-size: 12px; color: var(--warn); margin-top: 4px; }
.summary { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; font-size: 13.5px; margin: 0 0 12px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; }
.summary dd.dim { color: var(--muted); font-style: italic; }
/* Branding controls (wizard step 3 and Settings › Branding & documents) */
.logo-box { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--paper); margin-bottom: 14px; flex-wrap: wrap; }
.logo-box .logo-prev { width: 120px; height: 72px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 120px; }
.logo-box .logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.logo-box .logo-prev .none { color: var(--muted); font-size: 12px; }
.logo-box .logo-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.logo-box .logo-help { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.swatches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--white); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--charcoal); }
.swatches input[type="color"] { width: 44px; height: 30px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--white); cursor: pointer; }
.swatches .hex { font-family: var(--mono); font-size: 12px; color: var(--muted); }
/* HTML mock of the document header main draws on the PDF: logo/wordmark, name, ABN line, accent rule. */
.hdr-prev { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 14px; }
.hdr-prev .hp-band { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; }
.hdr-prev .hp-band.dark { background: var(--charcoal); color: #fff; }
.hdr-prev .hp-band.light { background: var(--white); color: var(--text); }
.hdr-prev .hp-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hdr-prev .hp-brand img { max-height: 44px; max-width: 150px; object-fit: contain; display: block; }
.hdr-prev .hp-tile { width: 40px; height: 40px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 40px; }
.hdr-prev .hp-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-prev .hp-sub { font-size: 11.5px; opacity: 0.8; }
.hdr-prev .hp-doc { text-align: right; flex: 0 0 auto; }
.hdr-prev .hp-doc b { display: block; font-size: 18px; letter-spacing: 0.06em; text-transform: uppercase; }
.hdr-prev .hp-doc span { font-size: 11.5px; opacity: 0.8; }
.hdr-prev .hp-rule { height: 5px; background: var(--accent); }
.hdr-prev .hp-body { padding: 12px 18px; background: var(--white); }
.hdr-prev .hp-line { height: 8px; border-radius: 4px; background: var(--hover); margin: 6px 0; }
/* Document-type checklist (wizard step 6 and Settings) */
.doc-types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.doc-type { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); cursor: pointer; margin: 0; font-weight: 500; }
.doc-type input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--charcoal); flex: 0 0 16px; }
.doc-type b { display: block; font-size: 13.5px; }
.doc-type span { color: var(--muted); font-size: 12px; font-weight: 400; }
.doc-type .tag { display: inline-block; font-size: 10.5px; color: var(--warn); background: #FDF0E0; padding: 0 6px; border-radius: 999px; margin-left: 6px; font-weight: 600; }
.doc-type.off { opacity: 0.6; }
@media (max-width: 760px) { .doc-types { grid-template-columns: 1fr; } }
.seg.wide button { min-width: 80px; }
/* First-run dashboard: three big "do this next" tiles */
.first-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.first-step { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; font: inherit; color: var(--text); }
.first-step:hover { border-color: var(--line-strong); box-shadow: 0 1px 6px rgba(0,0,0,0.06); }
.first-step .n { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.first-step b { font-size: 15px; }
.first-step span { color: var(--muted); font-size: 12.5px; }
@media (max-width: 900px) { .first-steps { grid-template-columns: 1fr; } }

/* ======================================================================
   Licence, help + tour, price list, schedule, reminders, receipts, statement
   ====================================================================== */

/* Toasts sit above the help button. */
#toasts { bottom: 72px; }

/* ---------- Licence ---------- */
.licence-key { font-family: var(--mono); letter-spacing: 0.12em; text-transform: uppercase; font-size: 15px; }
.licence-box .err { margin-top: 6px; }
.licence-box .where-key { font-size: 12.5px; color: var(--muted); }
.licence-box .where-note { margin-top: 6px; padding: 8px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.licence-ok { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid #BBE3C7; background: #EEFBF2; border-radius: var(--radius); color: #14532D; }
.licence-ok .tick { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; }
.licence-ok .tick svg.ic { width: 20px; height: 20px; stroke-width: 2.6; }
.licence-ok b { font-size: 15px; }
.licence-settings .kv dd .pill { vertical-align: middle; }
.lock-screen { position: fixed; inset: 0; z-index: 200; background: rgba(11, 15, 20, 0.92); display: flex; align-items: center; justify-content: center; padding: 20px; }
.lock-card { background: var(--white); border-radius: 12px; max-width: 520px; width: 100%; padding: 30px 32px 26px; box-shadow: var(--shadow); }
.lock-card .lock-icon { width: 52px; height: 52px; border-radius: 14px; background: #FCE8E8; color: var(--red); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.lock-card .lock-icon svg.ic { width: 26px; height: 26px; }
.lock-card h1 { font-size: 22px; }
.lock-card .lead { color: var(--muted); margin-top: 10px; }
body.locked .help-fab, body.locked .help-panel, body.locked .tour-offer { display: none; }
.grace-banner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 14px; border-radius: var(--radius-sm); border: 1px solid #F3D9A4; background: #FFF8E6; color: #7A4A00; box-shadow: var(--shadow); font-size: 13px; max-width: calc(100vw - 40px); }
.grace-banner svg.ic { stroke: var(--warn); }
.grace-banner .t-close { background: transparent; border: 0; color: #9a7a3a; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }

/* ---------- Help button + panel ---------- */
/* z-index 39: below the drawer backdrop (40) and modal overlay (50) so the button can never sit on top of a Save button. */
.help-fab { position: fixed; right: 18px; bottom: 18px; z-index: 39; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--black); color: #fff; font-weight: 800; font-size: 18px; cursor: pointer; box-shadow: var(--shadow); display: inline-flex; align-items: center; justify-content: center; }
.help-fab:hover { background: var(--charcoal); }
.help-fab[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); }
body.setup-mode .help-fab { bottom: 18px; }
.help-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100vw; z-index: 39; background: var(--white); border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: helpin 0.16s ease-out; }
@keyframes helpin { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.help-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.help-head h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.help-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 18px 80px; }
.help-body section { padding: 14px 0; border-bottom: 1px solid var(--line); }
.help-body section:last-child { border-bottom: 0; }
.help-body h3 { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.help-tips { margin: 0; padding: 0 0 0 18px; font-size: 13.5px; line-height: 1.5; }
.help-tips li { margin-bottom: 6px; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px; background: var(--white); }
.faq summary { cursor: pointer; padding: 8px 10px; font-weight: 600; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "›"; display: inline-block; transition: transform 0.12s; color: var(--muted); font-weight: 700; }
.faq details[open] summary::before { transform: rotate(90deg); }
.faq details p { margin: 0; padding: 0 12px 10px 26px; font-size: 13px; color: var(--text); line-height: 1.5; }
.shortcuts { border-collapse: collapse; width: 100%; font-size: 13px; }
.shortcuts td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.shortcuts tr:last-child td { border-bottom: 0; }
.shortcuts td:first-child { width: 78px; white-space: nowrap; }
kbd { font-family: var(--mono); font-size: 11.5px; background: var(--paper); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; }
/* Maker credit under every wizard step; support line on the welcome step */
.setup-madeby { text-align: center; font-size: 11.5px; color: var(--muted); padding: 10px 0 8px; border-top: 1px solid var(--line); margin-top: 6px; }
.setup-madeby a { color: var(--muted); }
.setup-madeby a:hover { color: var(--text); }
.setup-questions a { color: var(--blue); }
.need-help a { color: inherit; font-weight: 600; }
.help-contact .contact-maker { font-size: 14px; margin-bottom: 4px; }
.help-contact a { font-size: 13.5px; }
.about-line { font-size: 14px; margin-bottom: 4px; }
.about-licence { font-family: var(--mono); font-size: 12.5px; }
.tour-video { margin-top: 18px; text-align: left; }
.tour-video h2 { font-size: 15px; margin-bottom: 8px; text-align: center; }
.tour-video video { display: block; width: 100%; max-width: 720px; margin: 0 auto; background: #000; border-radius: var(--radius); aspect-ratio: 16 / 9; }
.tour-video .help { text-align: center; }
.setup-welcome .tour-video-none { margin-top: 18px; }

/* ---------- Guided tour ---------- */
.tour-block { position: fixed; inset: 0; z-index: 69; background: transparent; }
.tour-spot { position: fixed; z-index: 70; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(11, 15, 20, 0.62), 0 0 0 2px var(--accent); pointer-events: none; transition: left 0.15s, top 0.15s, width 0.15s, height 0.15s; }
.tour-tip { position: fixed; z-index: 71; background: var(--white); border-radius: 10px; box-shadow: var(--shadow); padding: 14px 16px 12px; }
.tour-tip .tt-step { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tour-tip h3 { font-size: 15px; margin: 4px 0 6px; }
.tour-tip p { font-size: 13.5px; line-height: 1.5; color: var(--text); margin: 0 0 12px; }
.tour-tip .tt-actions { display: flex; align-items: center; gap: 6px; }
.tour-offer { position: fixed; right: 70px; bottom: 18px; z-index: 39; background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: flex; align-items: center; gap: 16px; max-width: 420px; animation: toastin 0.18s ease-out; }

/* ---------- Quick search (Ctrl+K) ---------- */
.qs-list { margin-top: 10px; max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.qs-list:empty { border: 0; }
.qs-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: var(--white); padding: 8px 12px; cursor: pointer; font: inherit; }
.qs-item:last-child { border-bottom: 0; }
.qs-item:hover, .qs-item.hl { background: var(--hover); }
.qs-kind { flex: 0 0 82px; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.qs-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.qs-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-none { padding: 14px; color: var(--muted); font-size: 13px; }

/* ---------- Price list ---------- */
.pl-table tr.inactive td { color: var(--muted); }
.pl-desc { max-width: 420px; white-space: normal; }
.grid td.rm.rm2 { width: 60px; white-space: nowrap; }
.grid .pl-save { color: var(--muted); }
.grid .pl-save:hover { color: var(--blue); background: #E7EEFC; }
.pl-pick-list { margin-top: 10px; max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pl-pick-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: var(--white); padding: 9px 12px; cursor: pointer; font: inherit; }
.pl-pick-item:last-child { border-bottom: 0; }
.pl-pick-item:hover, .pl-pick-item.hl { background: var(--hover); }
.pl-pick-item .pl-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.pl-pick-item .pl-main > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-pick-item .pl-cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.pl-pick-item .pl-price { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }

/* ---------- Schedule ---------- */
.week-nav .week-label { font-size: 15px; margin-left: 6px; white-space: nowrap; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); min-height: 220px; min-width: 0; display: flex; flex-direction: column; }
.day.past { background: #FBFBFC; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.day-head { padding: 8px 10px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.day-head .dn { font-weight: 700; font-size: 13px; }
.day-head .dd { color: var(--muted); font-size: 12px; white-space: nowrap; }
.day-head .today-tag { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; background: var(--accent); color: var(--accent-ink); padding: 1px 6px; border-radius: 999px; font-weight: 700; }
.day-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.day-empty { color: var(--line-strong); text-align: center; padding: 14px 0; }
.job-card { display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--charcoal); border-radius: var(--radius-sm); padding: 7px 8px; cursor: pointer; font: inherit; color: var(--text); min-width: 0; }
.job-card:hover { border-color: var(--line-strong); border-left-color: var(--accent); background: var(--white); }
.job-card .jc-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.job-card .jc-cust { font-weight: 650; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-card .jc-desc { font-size: 12px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.job-card .jc-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 11.5px; margin-top: 3px; }
.job-card .jc-meta .pill { font-size: 10.5px; padding: 0 7px; line-height: 16px; }
.job-card .jc-who { color: var(--blue); font-weight: 600; }
.week-note { margin-top: 10px; }
.panel.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--accent-ring); } to { box-shadow: none; } }
@media (max-width: 1100px) { .day-head .dd { display: block; width: 100%; } .day-head .today-tag { margin-left: 0; } }

/* ---------- Receipt photos ---------- */
.photo-field { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.receipt-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: #E5E7EB; }
.receipt-large img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: var(--radius-sm); }
.receipt-clip { display: inline-flex; align-items: center; color: var(--muted); }
.receipt-clip svg.ic { width: 14px; height: 14px; }

/* ---------- Customer statement (printable) ---------- */
.statement-view { position: fixed; inset: 0; z-index: 48; background: #525659; display: flex; flex-direction: column; }
.st-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--white); border-bottom: 1px solid var(--line); }
.st-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 24px; }
.statement-view .sheet { background: var(--white); max-width: 820px; margin: 0 auto; padding: 36px 40px 30px; box-shadow: 0 6px 24px rgba(0,0,0,0.35); color: #111; font-size: 13px; }
.sheet .st-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; border-bottom: 3px solid var(--accent); padding-bottom: 14px; margin-bottom: 18px; }
.sheet .st-brand .brand { color: #111; }
.sheet .st-brand .brand-logo { max-height: 56px; max-width: 200px; display: block; }
.sheet .st-biz { color: var(--muted); font-size: 12px; margin-top: 8px; line-height: 1.5; }
.sheet .st-title { text-align: right; }
.sheet .st-title h1 { font-size: 24px; letter-spacing: 0.08em; text-transform: uppercase; }
.sheet .st-cust { margin-bottom: 16px; line-height: 1.5; }
.sheet .st-cust .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.sheet .st-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.sheet .st-kpis > div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
.sheet .st-kpis span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.sheet .st-kpis b { font-size: 18px; font-variant-numeric: tabular-nums; }
.sheet .st-kpis .due b { color: var(--red); }
.sheet h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 18px 0 6px; }
.st-tbl { width: 100%; border-collapse: collapse; }
.st-tbl th, .st-tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.st-tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.st-tbl th.num, .st-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-tbl td.neg { color: var(--red); }
.st-tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: 0; }
.sheet .st-pay { margin-top: 20px; padding: 10px 12px; background: var(--paper); border-radius: var(--radius-sm); line-height: 1.5; }
.sheet .st-foot { margin-top: 24px; text-align: center; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
@media print {
  body.printing-statement { overflow: visible; background: #fff; }
  body.printing-statement > *:not(.statement-view) { display: none !important; }
  .statement-view { position: static; background: #fff; display: block; }
  .statement-view .st-bar { display: none; }
  .statement-view .st-scroll { padding: 0; overflow: visible; }
  .statement-view .sheet { box-shadow: none; max-width: none; padding: 0; }
}

/* Reminder dialogs: no visual change, the class is a hook for tests and future styling. */
.send-reminder, .send-followup { display: block; }

/* Welcome-back card + sidebar plan chip (welcome.js) */
.welcome .plan-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.welcome .plan-name { font-weight: 700; font-size: 14px; color: var(--muted); }
.welcome .stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.welcome .stat { background: #F7F8FA; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.welcome .stat b { display: block; font-size: 18px; line-height: 1.2; }
.welcome .stat span { font-size: 12px; color: var(--muted); }
.welcome .optout { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); margin-top: 14px; cursor: pointer; }
.offer { border: 1px solid #F3D9A4; background: #FFF8E6; border-radius: 10px; padding: 12px 14px; margin-top: 12px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.offer b { display: block; margin-bottom: 2px; }
.plan-chip { display: inline-flex; align-items: center; margin-top: 4px; padding: 2px 8px; border-radius: 999px; border: 1px solid #2a3442; background: #141b25; color: #c7d0dc; font-size: 11px; font-weight: 600; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: inherit; }
.plan-chip:hover { border-color: #F5B300; color: #fff; }
.plan-chip.warn { border-color: #7a4a00; color: #F5B300; }
.plan-chip.bad { border-color: #7f1d1d; color: #fca5a5; }
body.rail-collapsed .plan-chip { display: none; }
/* Update status (update.js): sidebar chip + Settings › About row */
.update-chip { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; padding: 3px 8px; border-radius: 8px; border: 1px solid #2a3442; background: #141b25; color: #8b95a3; font-size: 11px; font-weight: 600; cursor: pointer; text-align: left; font-family: inherit; max-width: 100%; }
.update-chip .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.update-chip:hover { border-color: #F5B300; color: #fff; }
.update-chip.ok { color: #6ee7a0; border-color: #1f5136; }
.update-chip.busy { color: #c7d0dc; }
.update-chip.ready { color: #F5B300; border-color: #7a4a00; background: #1f1a0c; }
.update-chip.err { color: #8b95a3; border-style: dashed; }
.update-chip .bar, .update-row .bar { display: block; height: 4px; border-radius: 2px; background: #2a3442; overflow: hidden; }
.update-chip .bar i, .update-row .bar i { display: block; height: 100%; background: #F5B300; transition: width 0.3s; }
body.rail-collapsed .update-chip { display: none; }
.update-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.update-row .bar { flex: 1 1 140px; background: #E5E7EB; }
.update-row.ok .txt { color: var(--green); font-weight: 600; }
.update-row.ready .txt { color: #7A4A00; font-weight: 600; }

/* ---- Dashboard polish: hero + stat strips + first run ---- */
.hero-owed { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 0; background: #0f172a; color: #fff; border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; border: 1px solid #0f172a; }
.hero-owed .hero-main { padding: 20px 24px 18px; min-width: 0; }
.hero-owed .h-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #94a3b8; }
.hero-owed .h-value { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero-owed.has-late .h-value { color: #F5B300; }
.hero-owed.clear .h-value { color: #6ee7a0; }
.hero-owed .h-sub { font-size: 13px; color: #cbd5e1; margin-top: 4px; }
.hero-owed .h-sub .late { color: #fca5a5; font-weight: 600; }
.hero-owed ul.chase { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid rgba(255,255,255,0.1); }
.hero-owed ul.chase li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.08); cursor: pointer; }
.hero-owed ul.chase li:last-child { border-bottom: 0; }
.hero-owed ul.chase .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hero-owed ul.chase .who b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-owed ul.chase .who span { font-size: 12px; color: #94a3b8; }
.hero-owed ul.chase .amt { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; }
.hero-owed ul.chase .amt.late { color: #F5B300; }
.hero-owed .chase.btn { background: #F5B300; color: #0f172a; border-color: #F5B300; font-weight: 700; padding: 4px 12px; }
.hero-owed .chase.btn:hover { background: #ffc21a; }
.hero-owed .h-more { display: inline-block; margin-top: 10px; font-size: 12.5px; color: #cbd5e1; }
.hero-owed .hero-side { display: grid; grid-template-rows: repeat(3, 1fr); border-left: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.03); }
.hero-owed .h-stat { display: flex; flex-direction: column; justify-content: center; padding: 10px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); color: inherit; text-decoration: none; min-width: 0; }
.hero-owed .h-stat:last-child { border-bottom: 0; }
.hero-owed .h-stat:hover { background: rgba(255,255,255,0.05); }
.hero-owed .h-stat span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #94a3b8; font-weight: 600; }
.hero-owed .h-stat b { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hero-owed .h-stat em { font-style: normal; font-size: 12px; color: #cbd5e1; }
@media (max-width: 1000px) { .hero-owed { grid-template-columns: 1fr; } .hero-owed .hero-side { grid-template-rows: none; grid-template-columns: repeat(3, 1fr); border-left: 0; border-top: 1px solid rgba(255,255,255,0.1); } .hero-owed .h-stat { border-bottom: 0; border-right: 1px solid rgba(255,255,255,0.08); } }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.stats .stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; min-width: 0; color: inherit; text-decoration: none; border-right: 1px solid var(--line); }
.stats .stat:last-child { border-right: 0; }
.stats .stat:hover { background: var(--hover); }
.stats .s-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats .s-value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stats .s-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.stats .stat.alert .s-value { color: var(--warn); }
.stats .stat.danger .s-value { color: var(--red); }
.stats .stat.good .s-value { color: var(--green); }
.stats + .dash-grid { margin-top: 16px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stats .stat { border-bottom: 1px solid var(--line); } }
.first-run { background: var(--white); border: 1px solid var(--line); border-top: 4px solid #F5B300; border-radius: var(--radius); padding: 22px 24px 20px; margin-bottom: 16px; }
.first-run .fr-kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #B08000; }
.first-run h2 { font-size: 22px; letter-spacing: -0.01em; margin: 4px 0 4px; }
.first-run p { color: var(--muted); margin: 0 0 16px; max-width: 640px; }
.first-run .first-steps { margin-bottom: 0; }
.page.is-empty .quick { margin-bottom: 0; }
.dash-grid.empty-grid { grid-template-columns: 1fr 1fr; margin-top: 16px; }
@media (max-width: 900px) { .dash-grid.empty-grid { grid-template-columns: 1fr; } }
