/* CHAPTER 1: Main */
/* =====================================================================
   Chapter 1: Design tokens
   Dark is the default. [data-theme="light"] switches (theme-init.js).
   Business colours are tokens too: [data-color="coral"] sets --biz.
   ===================================================================== */
:root {
  color-scheme: dark;
  --bg: #0e0f12; --bg-side: #121317; --surface: #16181d; --surface-2: #1d2027; --surface-3: #262a33;
  --border: #272a32; --border-strong: #3a3f4a;
  --text: #f3f4f6; --text-2: #bcc0ca; --text-3: #9096a2;
  /* Floating layers (menus, dialogs, palette) rise to a lighter surface in dark mode; fields get an edge that reads as an input */
  --surface-pop: #1b1d23; --ring-pop: 0 0 0 1px rgba(255, 255, 255, .05) inset; --field-bg: var(--surface-2); --field-border: #343842;
  --radius-lg: 16px; --radius-md: 10px;
  --dur: .15s; --dur-slow: .22s;
  --accent: #7aa7ff; --accent-ink: #08101f; --accent-soft: rgba(122, 167, 255, .14);
  --series-1: #4f8df0; --series-2: #f0875a;
  --good: #4cc98a; --good-soft: rgba(76, 201, 138, .14); --warn: #ecb04a; --warn-soft: rgba(236, 176, 74, .14); --bad: #f27b7b; --bad-soft: rgba(242, 123, 123, .14);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset; --shadow-pop: 0 24px 60px rgba(0, 0, 0, .55);
  --radius: 12px; --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7; --bg-side: #ffffff; --surface: #ffffff; --surface-2: #f3f4f7; --surface-3: #e8eaef;
  --border: #e3e5ea; --border-strong: #c9ced7;
  --text: #14161a; --text-2: #4b505b; --text-3: #626874;
  --surface-pop: #ffffff; --ring-pop: 0 0 0 0 transparent; --field-bg: #ffffff; --field-border: #d3d7df;
  --accent: #2459c9; --accent-ink: #ffffff; --accent-soft: rgba(36, 89, 201, .09);
  --series-1: #2a6fdb; --series-2: #e5622f;
  --good: #0a7040; --good-soft: rgba(10, 112, 64, .1); --warn: #8a5700; --warn-soft: rgba(138, 87, 0, .1); --bad: #b42323; --bad-soft: rgba(180, 35, 35, .08);
  --shadow: 0 1px 2px rgba(16, 20, 30, .05), 0 4px 14px rgba(16, 20, 30, .04); --shadow-pop: 0 24px 60px rgba(16, 20, 30, .22);
}
[data-color="coral"]  { --biz: #f2704a; } [data-color="violet"] { --biz: #a566f5; } [data-color="green"] { --biz: #2fb67c; }
[data-color="blue"]   { --biz: #4f8df0; } [data-color="amber"]  { --biz: #e8a526; } [data-color="pink"]  { --biz: #ec5f9d; }
[data-color="teal"]   { --biz: #22b5c4; } [data-color="slate"]  { --biz: #8791a6; }

/* =====================================================================
   Chapter 2: Base
   ===================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
@media (hover: hover) { a:hover { text-decoration: underline; } }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.012em; }
p { margin: 0 0 .6em; }
.h1 { font-size: 22px; } .h2 { font-size: 17px; } .h3 { font-size: 14px; }
.muted { color: var(--text-3); font-weight: 400; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.small { font-size: 12px; color: var(--text-2); }
.spacer { flex: 1; }
.late { color: var(--bad); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
kbd { font: 11px var(--mono); padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; color: var(--text-3); background: var(--surface-2); }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); }
/* Scrollbars in the theme's own greys (thin where there is a mouse) */
@media (hover: hover) and (pointer: fine) {
  html, .sidebar, .dialog-body, .pal-list, .table-wrap, .menu { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
}
/* Figures that line up: amounts, counts and dates in tiles, tables, totals and badges */
.tile-value, .table td, .totals, .biz-stats dd, .badge, .sb-chip, .tag, .split-list, .brief-list, kbd, .kpi-value, .sumtile b, .dv-tile b, .dv-h-num, .dv-lim b, .dv-flow-head b, .hc-val, .tm-stats dd, .pv-big b { font-variant-numeric: tabular-nums; }

/* =====================================================================
   Chapter 3: Controls (buttons, fields, tags, segmented)
   ===================================================================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid var(--field-border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), filter var(--dur) var(--ease), transform .1s var(--ease); white-space: nowrap; }
.btn .ic { width: 16px; height: 16px; }
@media (hover: hover) { .btn:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; } }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (hover: hover) { .btn-primary:hover { background: var(--accent); filter: brightness(1.08); border-color: var(--accent); } }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger-ghost { background: none; border-color: transparent; color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-soft); border-color: transparent; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--surface-2); border-color: var(--border); color: var(--text-3); cursor: not-allowed; filter: none; transform: none; }
.btn:disabled .ic { opacity: .75; }
.btn:not(.btn-primary):not(.btn-danger):disabled { background: transparent; } /* a quiet disabled button ("Today" on today), not a filled tile */
.btn-ghost:disabled, .btn-danger-ghost:disabled { background: transparent; border-color: transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--text-2); cursor: pointer; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); color: var(--text); } }
.icon-btn.xs { width: 26px; height: 26px; } .icon-btn.xs .ic { width: 15px; height: 15px; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; background: transparent; color: var(--text-2); }
.icon-btn.is-danger:hover { background: var(--bad-soft); color: var(--bad); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.chip { height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; }
@media (hover: hover) { .chip:hover { color: var(--text); border-color: var(--border-strong); } }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }
input, select, textarea { font: inherit; color: var(--text); background: var(--field-bg); border: 1px solid var(--field-border); border-radius: 9px; padding: 7px 11px; min-height: 36px; width: 100%; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
:where(input[type=date], input[type=time], input[type=month], input[type=datetime-local]) { height: 36px; } /* the picker icon made these 2 px taller than a text field or select beside them; min-height still wins on touch */
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
@media (hover: hover) { input:hover, select:hover, textarea:hover { border-color: var(--border-strong); } }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; background: var(--surface-2); border-color: var(--border); }
input[readonly], textarea[readonly] { background: var(--surface-2); border-color: var(--border); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; cursor: pointer; } .check > input[type=checkbox], .check > input[type=radio] { flex: none; margin: 3px 0 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.form-msg { min-height: 1.2em; margin: 4px 0 10px; color: var(--bad); font-size: 13px; }
.form-msg.ok { color: var(--good); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.6; }
.tag .ic { width: 12px; height: 12px; }
.tag.good { background: var(--good-soft); color: var(--good); } .tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); } .tag.info { background: var(--accent-soft); color: var(--accent); }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: var(--accent-ink); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; margin-left: 6px; }
:root[data-theme="light"] .badge { color: #fff; } /* dark: the light red fill takes dark text (7:1); light: the dark red takes white */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; padding: 3px; background: var(--surface-2); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 4px 13px; border-radius: 7px; cursor: pointer; font-weight: 500; color: var(--text-2); font-size: 13px; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.seg-flush { margin-bottom: 4px; }
div.seg { margin-bottom: 14px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches input { position: absolute; opacity: 0; }
.swatches .sw { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; background: var(--surface-2); }
.swatches input:checked + .sw { border-color: var(--text); }
.swatches input:focus-visible + .sw { outline: 2px solid var(--accent); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--biz, var(--text-3)); flex: none; }
.dot.big { width: 14px; height: 14px; }
.sw .dot { width: 16px; height: 16px; }
/* Loading: a quiet skeleton (the "Loading…" text stays for screen readers) */
.loading { position: relative; min-height: 64px; padding: 0; color: transparent; font-size: 0; overflow: hidden; border-radius: 8px; }
.loading::before, .loading::after { content: ""; position: absolute; left: 0; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.loading::before { top: 10px; width: 46%; } .loading::after { top: 34px; width: 78%; height: 10px; animation-delay: .12s; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .45; } }
.empty { color: var(--text-2); font-size: 13px; padding: 28px 16px; text-align: center; } /* a one-line empty state reads like the line of UI.empty (.es-text) */
.empty .ic { width: 28px; height: 28px; margin-bottom: 8px; opacity: .6; }
.empty .btn .ic { width: 18px; height: 18px; margin-bottom: 0; opacity: 1; }
.hint { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 10px; }
.hint .ic { color: var(--accent); margin-top: 2px; }
.alert { display: block; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; }
.alert.bad { background: var(--bad-soft); color: var(--bad); } .alert.warn { background: var(--warn-soft); color: var(--warn); } .alert.info { background: var(--accent-soft); color: var(--accent); }
.prose p { margin: 0 0 .7em; } .prose h4 { margin: .8em 0 .3em; } .prose ul { margin: 0 0 .7em; padding-left: 20px; }
.sec-title { margin: 18px 0 10px; text-transform: uppercase; letter-spacing: .06em; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.sec-title:first-child { margin-top: 0; }

/* =====================================================================
   Chapter 4: App shell (sidebar = the one navigation tree, top bar, page header)
   The sidebar folds into a 64px rail (.is-rail), and becomes a drawer on phones.
   ===================================================================== */
.boot-note { padding: 40px; color: var(--text-3); }
.app-shell { display: grid; grid-template-columns: var(--sb-w, 264px) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; transition: grid-template-columns .2s var(--ease); }
.app-shell.is-rail { --sb-w: 64px; }
.scrim { display: none; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 10px; padding: 14px 10px 12px; background: var(--bg-side); border-right: 1px solid var(--border); scrollbar-width: thin; }
.sb-top { display: flex; align-items: center; gap: 6px; padding: 0 2px 0 6px; min-height: 36px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; font-weight: 650; font-size: 15px; color: var(--text); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #a566f5); flex: none; }
.brand-logo img { display: block; max-height: 30px; max-width: 170px; width: auto; height: auto; object-fit: contain; }
.brand-mini { display: none; }
.sb-fold { flex: none; color: var(--text-3); width: 30px; height: 30px; }
.sb-close { display: none; }
.sb-search { flex: none; display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font: inherit; cursor: pointer; transition: border-color .15s var(--ease), color .15s var(--ease); }
@media (hover: hover) { .sb-search:hover { border-color: var(--border-strong); color: var(--text-2); } }
.sb-search .sb-name { flex: 1; text-align: left; }
.sb-search .ic { width: 16px; height: 16px; }
.sb-nav { display: flex; flex-direction: column; gap: 1px; }
.sb-item { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 5px 8px; border-radius: 9px; color: var(--text-2); font-weight: 500; position: relative; transition: background .12s var(--ease), color .12s var(--ease); }
@media (hover: hover) { .sb-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; } }
.sb-item.is-active { background: var(--surface-3); color: var(--text); }
/* A business whose Overview is open is the active entry; while another of its pages is open the row stays "open": same ink, no fill */
.sb-item.is-open { color: var(--text); } .sb-item.is-open .sb-name { font-weight: 600; }
@media (hover: hover) { .sb-item.is-open:hover { background: var(--surface-2); } }
.sb-mark { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 6px; }
.sb-mark .dot { width: 9px; height: 9px; }
.sb-mark.has-logo { background: #fff; overflow: hidden; } .sb-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.sb-mark-co { color: var(--accent); } .sb-mark-co .ic { width: 17px; height: 17px; }
.sb-all { font-weight: 600; color: var(--text); }
.sb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-children { display: flex; flex-direction: column; gap: 1px; }
.sb-pages { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 16px; padding-left: 7px; border-left: 1px solid var(--border); }
.sb-page { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 4px 8px; border-radius: 8px; color: var(--text-3); font-size: 13px; font-weight: 500; transition: background .12s var(--ease), color .12s var(--ease); }
@media (hover: hover) { .sb-page:hover { background: var(--surface-2); color: var(--text); text-decoration: none; } }
.sb-page.is-active { color: var(--text); background: var(--accent-soft); }
.sb-page.is-active .sb-pic { color: var(--accent); }
.sb-pic { width: 15px; height: 15px; flex: none; color: var(--text-3); }
.sb-page .badge { margin-left: 0; }
.sb-lock { color: var(--text-3); display: inline-flex; } .sb-lock .ic { width: 14px; height: 14px; }
.sb-empty { margin: 4px 8px; font-size: 12px; color: var(--text-3); }
.sb-label { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 8px; border: 0; background: none; color: var(--text-3); font: inherit; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; border-radius: 8px; }
@media (hover: hover) { .sb-label:hover { color: var(--text); background: var(--surface-2); } }
.sb-label .ic { width: 14px; height: 14px; flex: none; } .sb-label b { margin-left: auto; font-weight: 500; }
/* The tree a widget offers (folders and documents), under the open page */
.sb-tree { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 4px; }
.sb-tree[hidden] { display: none; }
.sb-tree-home { margin: 2px 0 4px 16px; padding-left: 7px; border-left: 1px solid var(--border); }
.sb-leaf { display: flex; align-items: center; gap: 5px; min-height: 28px; padding: 3px 6px 3px 2px; border-radius: 7px; color: var(--text-3); font-size: 12.5px; cursor: pointer; outline-offset: -2px; }
@media (hover: hover) { .sb-leaf:hover { background: var(--surface-2); color: var(--text); } }
.sb-leaf.is-active { background: var(--accent-soft); color: var(--text); font-weight: 550; } .sb-leaf.is-active .sb-pic { color: var(--accent); }
.sb-leaf.is-muted { font-style: italic; }
.sb-leaf.lv-1 { padding-left: 14px; } .sb-leaf.lv-2 { padding-left: 26px; } .sb-leaf.lv-3 { padding-left: 38px; } .sb-leaf.lv-4 { padding-left: 50px; } .sb-leaf.lv-5 { padding-left: 62px; } .sb-leaf.lv-6 { padding-left: 74px; }
.sb-caret { display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; border: 0; padding: 0; background: none; color: var(--text-3); cursor: pointer; border-radius: 4px; }
.sb-caret:hover { background: var(--surface-3); color: var(--text); } .sb-caret .ic { width: 12px; height: 12px; }
.sb-leaf .sb-pic { width: 14px; height: 14px; }
.sb-chip { flex: none; font-size: 10.5px; line-height: 1; padding: 3px 5px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.sb-chip.good { background: var(--good-soft); color: var(--good); } .sb-chip.info { background: var(--accent-soft); color: var(--accent); } .sb-chip.warn { background: var(--warn-soft); color: var(--warn); }
/* Footer: the user menu */
.sb-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 6px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
@media (hover: hover) { .me:hover { background: var(--surface-2); } } .me[aria-expanded="true"] { background: var(--surface-2); }
.me .pav, .me .avatar { flex: none; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 12px; }
.me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; } .me-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .me-text span { font-size: 12px; color: var(--text-3); }
.me-chev { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.inline-form { display: inline; margin: 0; }
/* The rail: icons only */
.is-rail .sidebar { padding: 14px 8px 12px; gap: 8px; align-items: stretch; }
.is-rail .sb-top { flex-direction: column; gap: 8px; padding: 0; }
.is-rail .brand .sb-name, .is-rail .brand-logo img, .is-rail .sb-search .sb-name, .is-rail .sb-search kbd, .is-rail .sb-pages, .is-rail .sb-name, .is-rail .sb-label .sb-name, .is-rail .sb-label b, .is-rail .sb-lock, .is-rail .me-text, .is-rail .me-chev, .is-rail .sb-empty { display: none; }
.is-rail .brand-mini { display: block; }
.is-rail .brand { justify-content: center; }
.is-rail .sb-search { justify-content: center; padding: 0; width: 46px; margin: 0 auto; }
.is-rail .sb-item, .is-rail .sb-label { justify-content: center; padding: 6px 0; }
.is-rail .sb-item.is-active::after { content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--biz, var(--accent)); }
.is-rail .sb-item.is-open::after { content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--biz, var(--accent)); opacity: .4; }
.is-rail .sb-label { padding: 4px 0; } .is-rail .sb-label .ic { display: none; }
.is-rail .sb-label::before { content: ""; display: block; width: 24px; height: 1px; background: var(--border-strong); }
.is-rail .me { justify-content: center; padding: 6px 0; }
.is-rail .sb-children { gap: 2px; }
/* Every rail row stays centred in every state (default, hover, open, active, focused). The open business (and the company while it is open) gets
   a gear, and .sb-row.has-gear .sb-item keeps 36px on the right for it: the rail hides the gear, so that room pushed the selected icon to the
   left. The tree under an open Overview (#sb-tree) and the counts are not drawn in the rail either (its pages are not). */
@media (min-width: 861px) {
  .is-rail .sb-row.has-gear .sb-item { padding-right: 0; }
  .is-rail .sb-tree, .is-rail .sb-item .badge, .is-rail .sb-item .tag { display: none; }
  .is-rail .sb-item, .is-rail .me { gap: 0; }
}
/* Main column and top bar */
.main { min-width: 0; padding-bottom: 60px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 10px 32px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.menu-btn { display: none; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--text-3); font-size: 13px; min-width: 0; }
.crumb { display: inline-flex; align-items: center; gap: 4px; max-width: 260px; padding: 4px 8px; border: 0; border-radius: 8px; background: none; color: var(--text-3); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb:hover, .crumb[aria-expanded="true"] { background: var(--surface-2); color: var(--text); text-decoration: none; }
.crumb b { color: var(--text); font-weight: 600; font-size: 15px; } .crumb .ic { width: 14px; height: 14px; color: var(--text-3); }
.crumb-biz { font-size: 13.5px; color: var(--text-2); gap: 7px; } .crumb-biz .dot { width: 8px; height: 8px; } .crumb-biz .tag { margin-left: 4px; }
.crumb-logo { width: 20px; height: 20px; object-fit: contain; border-radius: 5px; background: #fff; padding: 1px; }
.crumbs .sep { opacity: .5; }
.topbar .save-state { margin-right: 4px; }
/* Page header: eyebrow (business), title (page), tagline on the first page */
.pagehead { padding: 0 32px; } .pagehead:empty { display: none; }
.ph-title { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.ph-text { min-width: 0; }
.ph-eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.ph-eyebrow .dot { width: 9px; height: 9px; } .ph-eyebrow .tag { margin-left: 2px; }
.ph-logo { width: 26px; height: 26px; object-fit: contain; border-radius: 7px; background: #fff; padding: 2px; flex: none; }
.ph-title h1 { font-size: 26px; letter-spacing: -0.022em; line-height: 1.15; }
.ph-sub { margin: 4px 0 0; color: var(--text-3); }
.ptabs { display: none; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.ptabs.is-manager { display: flex; }
.ptabs::-webkit-scrollbar { display: none; }
.tab-wrap { display: flex; align-items: center; position: relative; flex: none; }
.ptab { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 500; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: 6px 6px 0 0; }
@media (hover: hover) { .ptab:hover { color: var(--text); background: var(--surface-2); } }
.tab-wrap.is-active .ptab { color: var(--text); border-bottom-color: var(--biz, var(--accent)); }
.ptools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0 10px; } .ptools-label { color: var(--text-3); font-size: 13px; margin-right: 4px; }
.tab-arrow { margin: 0 2px; flex: none; width: 30px; height: 30px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
@media (hover: hover) { .tab-arrow:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); } }
.tab-wrap.is-moving { background: var(--surface-2); border-radius: 10px 10px 0 0; padding: 0 4px; }
.add-tab { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); } .add-tab .ic { width: 15px; height: 15px; }
.viewonly { display: flex; gap: 10px; align-items: center; margin: 4px 32px 0; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text-2); font-size: 13px; }
.editbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 32px 0; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.eb-text { display: flex; gap: 10px; align-items: center; color: var(--text-2); font-size: 13px; flex: 1 1 320px; min-width: 0; } .editbar #add-widget { flex: none; margin-left: auto; }
.save-state { font-size: 12px; color: var(--text-3); white-space: nowrap; } .save-state[data-state="Saved"] { color: var(--good); } .save-state[data-state="Not saved"] { color: var(--bad); } .save-state[data-state="Unsaved changes"] { color: var(--warn); }
.canvas { padding: 10px 32px 0; outline: none; }
/* Anchored menus (user menu, page switcher, "New", "More") */
.menu { position: fixed; z-index: 120; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); padding: 6px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--ring-pop), var(--shadow-pop); animation: pop var(--dur) var(--ease); }
/* Floating layers sit on --surface-pop: everything inside that paints "var(--surface)" (sticky bars, fades) follows it */
.menu, .dialog, .palette, .wtools-edit, .wtools-pos, .popover, .dh-menu, .dh-selbar, .hc-pop, .ms-pop, .inv-client-list, .lang-list, .gal-tip, .ag-pick, .install-card { --surface: var(--surface-pop); }
.menu-head { padding: 7px 10px 6px; font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 7px 10px; border: 0; border-radius: var(--radius-sm); transition: background var(--dur) var(--ease); background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
.menu-item:disabled { opacity: .5; cursor: default; }
.menu-item .ic { width: 16px; height: 16px; color: var(--text-3); flex: none; } .menu-item:hover .ic { color: var(--text); }
.menu-item.is-danger { color: var(--bad); } .menu-item.is-danger .ic { color: var(--bad); }
.menu-item.is-current { background: var(--accent-soft); } .menu-item.is-current .ic { color: var(--accent); }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item small { color: var(--text-3); font-size: 11.5px; white-space: nowrap; }
.menu-check { color: var(--accent) !important; }
.menu-gap { width: 16px; flex: none; }
.menu-sep { height: 1px; margin: 5px 6px; background: var(--border); }

/* =====================================================================
   Chapter 5: Widget grid
   ===================================================================== */
.wgrid { --wgap: 16px; position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--wgap); align-items: start; }
/* Sizes: Small (S) = 2 of 6 units = a third, Wide (W) = 4 = two thirds, Full (F) = 6; so a row is always filled exactly. .span-3 (Half) only exists in pages saved
   before; they still render and are tidied up when the page is opened for editing. */
.span-2 { grid-column: span 2; --n: 2; } .span-3 { grid-column: span 3; --n: 3; } .span-4 { grid-column: span 4; --n: 4; } .span-6 { grid-column: span 6; --n: 6; }
/* Masonry (assets/js/app/masonry.js): once the script has measured the widgets it adds .is-masonry and gives every widget its place as
   custom properties: --mc first column, --mr first row, --mrs rows (rows are 1px high, the gap is part of the widget's rows),
   --mh minimum height (a widget evened out with its neighbours). The grid then ends one gap too low, which the negative margin takes back.
   Without the script, on phones and in print the plain grid above stays. */
.wgrid.is-masonry { row-gap: 0; grid-auto-rows: 1px; margin-bottom: calc(-1 * var(--wgap)); }
.wgrid.is-masonry > .widget { grid-column: var(--mc) / span var(--n); grid-row: var(--mr) / span var(--mrs); min-height: var(--mh, 0px); }
.widget { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; animation: rise .24s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.widget.bare { background: none; border: 0; box-shadow: none; padding: 0; }
/* Bare widgets that stretch in the masonry grid (tiles, briefing): their inner cards grow to fill the space instead of leaving a hole. */
.widget.bare[data-type="stats"], .widget.bare[data-type="attention"], .widget.bare[data-type="fin-kpis"] { display: flex; flex-direction: column; }
.widget.bare[data-type="stats"] > .wbody, .widget.bare[data-type="attention"] > .wbody, .widget.bare[data-type="fin-kpis"] > .wbody { flex: 1; display: flex; flex-direction: column; }
.widget.bare[data-type="stats"] .tiles, .widget.bare[data-type="fin-kpis"] .tiles { flex: 1; align-content: stretch; }
.widget.bare[data-type="attention"] .brief { flex: 1; }
.whead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.whead h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.wtools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.wtools input[type=search], .wtools select { width: auto; min-width: 140px; min-height: 32px; padding: 4px 10px; }
.wtools .seg { margin: 0; } .wtools .seg span { padding: 2px 11px; }
.btn .lbl { display: inline; }
.wgrid.is-editing { --wgap: 48px; margin-top: 46px; } /* the first row's toolbars sit above it */ /* room between the widgets for the two toolbars that sit on their edges */
.is-editing .widget { outline: 1.5px dashed var(--border-strong); outline-offset: 3px; cursor: grab; }
.is-editing .widget.bare { outline-offset: 6px; padding-top: 8px; padding-bottom: 8px; } /* room for the toolbars: a bare widget has no card padding to hide it in */
.is-editing .widget:hover { outline-color: var(--accent); }
.is-editing .widget .wbody { pointer-events: none; opacity: .75; }
.widget.dragging { opacity: .35; } .widget.drop-here { outline: 2px solid var(--accent); }
.widget.drop-before { box-shadow: 0 -3px 0 0 var(--accent), var(--shadow); } .widget.drop-after { box-shadow: 0 3px 0 0 var(--accent), var(--shadow); }
.widget:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Column guides: three soft columns over the page while a widget is dragged; the one under the pointer lights up. */
.col-guides { display: none; position: absolute; inset: 0; z-index: 4; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--wgap); pointer-events: none; }
.wgrid.is-dragging > .col-guides { display: grid; }
.col-guides > i { border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 3%, transparent); border: 1.5px dashed color-mix(in srgb, var(--accent) 28%, transparent); transition: background .12s, border-color .12s; position: relative; }
.col-guides > i::after { content: attr(data-n); position: absolute; top: 8px; left: 50%; transform: translateX(-50%); font: 600 11px var(--font); color: var(--accent); opacity: .7; letter-spacing: .04em; }
.col-guides > i.is-hot { background: color-mix(in srgb, var(--accent) 13%, transparent); border-color: var(--accent); }
.col-guides > i.is-hot::after { opacity: 1; }
.col-guides > i.is-no { opacity: .4; }
.newrow-zone { display: none; align-items: center; justify-content: center; gap: 8px; min-height: 56px; margin-top: 22px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-3); font-size: 13px; font-weight: 500; }
.wgrid-wrap.is-dragging > .newrow-zone { display: flex; }
.newrow-zone.is-hot { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--accent); }
.pin-mark { position: absolute; bottom: -14px; left: 12px; z-index: 5; display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px 0 6px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 999px; background: var(--surface); color: var(--accent); font: 600 11px var(--font); cursor: pointer; box-shadow: var(--shadow-pop); }
.pin-mark .ic { width: 13px; height: 13px; } .pin-mark:hover { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 1100px) { .pin-mark { padding: 0 5px; } .pin-mark span { display: none; } } /* narrow cards: the pin alone (its name is in the tooltip) */
.icon-btn.is-on { background: var(--accent); color: var(--accent-ink); }
.wtools-edit { position: absolute; top: -38px; right: 12px; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 3px 5px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: var(--ring-pop), 0 4px 14px rgba(0, 0, 0, .18); }
.wtools-pos { position: absolute; bottom: -38px; left: 12px; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 3px 5px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: var(--ring-pop), 0 4px 14px rgba(0, 0, 0, .18); }
.grip { color: var(--text-3); display: inline-grid; place-items: center; width: 22px; cursor: grab; }
.sizes { display: inline-flex; gap: 2px; margin: 0 4px; }
.size { width: 24px; height: 24px; border-radius: 6px; border: 0; background: var(--surface-2); color: var(--text-3); font: 600 11px var(--font); cursor: pointer; }
.size.is-on { background: var(--accent); color: var(--accent-ink); }
.blank { text-align: center; padding: 70px 20px; color: var(--text-3); border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }
.blank h2 { color: var(--text); margin: 10px 0 6px; } .blank-ic .ic { width: 34px; height: 34px; opacity: .6; }

/* =====================================================================
   Chapter 6: Overview widgets (tiles, briefing, ownership, portfolio)
   ===================================================================== */
/* Tiles wrap and grow, so the last row is always full (no lonely tile with a hole beside it). */
.tiles { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 12px; }
.tiles > .tile { flex: 1 1 var(--tkb, 172px); min-width: 0; } /* --tkb: masonry.js balances the rows (5 tiles = 3 + 2) */
.tile { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
button.tile { cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
@media (hover: hover) { button.tile:hover { border-color: var(--border-strong); background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); } }
.tile.is-warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.tile-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.tile-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.15; }
.tile-value .line { display: block; font-size: 15px; font-weight: 600; letter-spacing: 0; line-height: 1.45; }
.tile-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.brief { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.brief-head { display: flex; gap: 14px; align-items: center; }
.brief-head h3 { font-size: 18px; letter-spacing: -0.015em; } .brief-head p { margin: 2px 0 0; color: var(--text-2); }
.brief-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; }
.brief-icon.good { background: var(--good-soft); color: var(--good); } .brief-icon.warn { background: var(--warn-soft); color: var(--warn); }
.brief-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.brief-list li { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--warn); }
.brief-list li.bad { border-left-color: var(--bad); }
.split-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-3); margin-bottom: 12px; gap: 2px; }
.split-bar span { flex: var(--w, 50) 1 0; }
.seg-0 { background: var(--accent); } .seg-1 { background: #a566f5; } .seg-2 { background: var(--good); } .seg-3 { background: var(--warn); }
.split-list { list-style: none; margin: 0 0 8px; padding: 0; }
.split-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 5px 0; } .split-list .split-hours { flex-basis: 100%; padding-left: 18px; color: var(--text-2); }
.split-list .name { flex: 1; } .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.split-edit { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.split-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.presets { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.viewonly-note { display: flex; gap: 8px; align-items: center; color: var(--text-3); font-size: 12px; }
.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 8px; }
.biz-card { display: flex; flex-direction: column; text-align: left; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-top: 3px solid var(--biz, var(--border)); border-radius: 12px; padding: 14px 16px; transition: transform .15s var(--ease), border-color .15s var(--ease); cursor: pointer; }
@media (hover: hover) { .biz-card:hover { transform: translateY(-2px); border-color: var(--biz, var(--accent)); text-decoration: none; } }
.biz-head { display: flex; align-items: center; gap: 9px; } .biz-head h3 { font-size: 16px; flex: 1; }
.biz-card p { margin: 4px 0 0; } .owners-line { margin-bottom: 10px !important; }
.biz-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 8px 0 0; }
.biz-stats dt { font-size: 11px; color: var(--text-3); } .biz-stats dd { margin: 0; font-weight: 600; font-size: 15px; }
.biz-new { align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed var(--border-strong); border-top-width: 1.5px; background: none; color: var(--text-3); min-height: 120px; }
.biz-new .ic { width: 22px; height: 22px; }

/* =====================================================================
   Chapter 7: Tables, lists, boards, cards
   ===================================================================== */
.table-wrap { position: relative; overflow-x: auto; /* soft edges show that a wide table scrolls sideways (they only appear while there is more to see) */
  background: linear-gradient(to right, var(--surface) 30%, transparent) 0 0 / 40px 100% no-repeat local, linear-gradient(to left, var(--surface) 30%, transparent) 100% 0 / 40px 100% no-repeat local,
    linear-gradient(to right, rgba(0, 0, 0, .28), transparent) 0 0 / 14px 100% no-repeat scroll, linear-gradient(to left, rgba(0, 0, 0, .28), transparent) 100% 0 / 14px 100% no-repeat scroll; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
/* Card tables: on phones a table with .cards turns every row into a small card (labels come from data-l on the cells; .c-full spans the whole card). */
@media (max-width: 640px) {
  .table.cards, .table.cards tbody { display: block; } .table.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table.cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 12px 2px; border-bottom: 1px solid var(--border); } .table.cards tr:last-child { border-bottom: 0; }
  .table.cards td, .table.cards tr:last-child td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; } .table.cards tbody tr.clickable:hover td { background: none; }
  .table.cards td[data-l]::before { content: attr(data-l); display: block; margin-bottom: 1px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
  .table.cards td.c-full { grid-column: 1 / -1; } .table.cards td.act-cell { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; width: auto; white-space: normal; }
  .table.cards td:empty { display: none; }
  .table.cards .age-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); } .table.cards .age-head th { display: block; padding: 0; border: 0; background: none; } .table.cards .age-head th:empty { display: none; } .table.cards .age-head th.r { margin-left: auto; }
  .table.cards .age-group.d60 .age-head, .table.cards .age-group.d90 .age-head { background: var(--bad-soft, var(--surface-2)); }
  .table.cards .age-group tr:not(.age-head):first-of-type, .table.cards .age-group tr.age-head + tr { border-top: 0; }
}
.act-cell > .btn, .act-cell > .icon-btn { vertical-align: middle; }
.table tbody tr.clickable { cursor: pointer; }
@media (hover: hover) { .table tbody tr.clickable:hover td { background: var(--surface-2); } }
.table td .small { margin-top: 2px; } .table td .small .tag { margin-right: 4px; }
.amount-in { color: var(--good); }
.totals { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin: 0 0 12px; }
.totals b { color: var(--text); font-weight: 600; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; min-height: 32px; padding: 4px 10px; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.mini-row:last-child { border-bottom: 0; } .mini-row.clickable { cursor: pointer; } @media (hover: hover) { .mini-row.clickable:hover { background: var(--surface-2); } }
.mini-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.rec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; } .rec-grid .wide { grid-column: 1 / -1; }
.rec-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.rec-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .15s var(--ease), transform .15s var(--ease); }
.rec-card:focus-visible { border-color: var(--accent); outline: none; } @media (hover: hover) { .rec-card:hover { border-color: var(--accent); transform: translateY(-1px); } }
.rec-card h3 { font-size: 14px; } .rec-excerpt { margin: 0; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.rec-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: auto; } .pin { color: var(--warn); }
.rec-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.rec-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px; min-height: 110px; transition: background .15s var(--ease), border-color .15s var(--ease); }
.rec-col.over { border-color: var(--accent); background: var(--accent-soft); }
.rec-col header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rec-col-body { display: flex; flex-direction: column; gap: 8px; }
.rec-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: var(--shadow); }
@media (hover: hover) { .rec-item:hover { border-color: var(--accent); } } .rec-item:focus-visible { border-color: var(--accent); outline: none; } .rec-item.dragging { opacity: .4; }
.rec-item-title { font-weight: 500; margin-bottom: 6px; overflow-wrap: anywhere; }
.rec-item .rec-meta { margin-top: 0; }

/* =====================================================================
   Chapter 8: Dialogs, editors, command palette, toast
   ===================================================================== */
.dialog { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); max-height: calc(var(--vvh, 100dvh) - 32px); background: var(--surface); color: var(--text); box-shadow: var(--ring-pop), var(--shadow-pop); overflow: hidden; }
.dialog.wide { width: min(780px, calc(100vw - 24px)); }
.dialog[open] { display: flex; flex-direction: column; animation: pop var(--dur-slow) var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.dialog::backdrop, .palette::backdrop { background: rgba(5, 6, 9, .55); backdrop-filter: blur(3px); animation: fade var(--dur-slow) var(--ease); }
:root[data-theme="light"] .dialog::backdrop, :root[data-theme="light"] .palette::backdrop { background: rgba(16, 20, 30, .32); }
@keyframes fade { from { opacity: 0; } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 6px; }
.dialog-body { padding: 8px 20px 20px; overflow-y: auto; }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
/* In a long form the buttons stay in view at the bottom of the window */
.dialog-body form > .dialog-actions:last-child, .dialog-body > .dialog-actions:last-child { position: sticky; bottom: -20px; margin-bottom: -20px; padding: 12px 0 20px; background: linear-gradient(to top, var(--surface) calc(100% - 12px), transparent); z-index: 2; } /* a fixed 12px fade, so two rows of buttons never sit on the form */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.pick { display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--text); padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); cursor: pointer; position: relative; }
@media (hover: hover) { .pick:hover { border-color: var(--accent); } } .pick .small { color: var(--text-3); }
.pick input { position: absolute; opacity: 0; } .pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pick:has(input:focus-visible) { outline: 2px solid var(--accent); }
.pick-ic { color: var(--accent); }
.fields-edit { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.fld { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.fld-main { display: grid; grid-template-columns: 1fr 160px auto; gap: 8px; align-items: center; }
.fld-btns { display: inline-flex; } .fld-extra { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; } .fld-extra > * { flex: 1; min-width: 140px; }
/* A calculated field with a formula (editor.js calcEditor): kind + format on one line, the formula with its "?" below, then the check and the keys. */
.fx-extra > .fx-line, .fx-extra > .fx-msg, .fx-extra > .fx-keys { flex: 1 1 100%; }
.fx-line { display: flex; align-items: center; gap: 6px; } .fx-line .fx { flex: 1; min-width: 0; font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace); } /* the input font size stays (16 px on phones: no zoom on focus) */
.fx-msg { margin: 0; min-height: 0; } .fx-msg:empty { display: none; } .fx-msg.is-bad { color: var(--bad); }
.fx-keys { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; } .fx-keys code { padding: 0 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; }
.fld-flags { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; } .fld-flags .check { margin: 0; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 14px; }
.palette { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 0; width: min(640px, calc(100vw - 24px)); margin: 12vh auto 0; background: var(--surface); color: var(--text); box-shadow: var(--ring-pop), var(--shadow-pop); overflow: hidden; }
.palette[open] { animation: pop var(--dur-slow) var(--ease); }
.pal-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.pal-input input { border: 0; background: none; min-height: 54px; font-size: 16px; padding: 0; } .pal-input input:focus { outline: none; }
.pal-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.pal-group { padding: 12px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
.pal-item { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
@media (hover: hover) { .pal-item:hover:not(.is-sel) { background: var(--surface-2); } }
.pal-item.is-sel { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); } .pal-ic { width: 16px; height: 16px; color: var(--text-3); flex: none; } .pal-item.is-sel .pal-ic { color: var(--accent); }
.pal-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-hint { color: var(--text-3); font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity var(--dur) var(--ease); } .pal-item.is-sel .pal-hint, .pal-item:hover .pal-hint { opacity: 1; } .pal-empty { padding: 20px; text-align: center; color: var(--text-3); }
.pal-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; } .pal-foot kbd { margin-right: 3px; }
.team-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; } .biz-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 10px; }
.keys td { padding: 8px 6px; } .keys-k { width: 150px; white-space: nowrap; } .keys-k kbd { font-size: 12px; padding: 2px 7px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(12px) scale(.98); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); z-index: 100; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast { display: flex; align-items: center; gap: 10px; max-width: min(92vw, 520px); }
.toast.has-action { pointer-events: auto; }
.toast .toast-ic { width: 18px; height: 18px; flex: none; }
.toast.is-error { background: var(--surface-pop); color: var(--text); border: 1px solid var(--bad); border-left-width: 4px; box-shadow: var(--shadow-pop); }
.toast.is-error .toast-ic { color: var(--bad); }
.toast .toast-action { flex: none; min-height: 36px; padding: 0 10px; margin: -6px -10px -6px 0; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.toast.is-error .toast-action { color: var(--accent); }

/* =====================================================================
   Chapter 9: Sign-in screens
   ===================================================================== */
/* One family for every signed-out screen (templates/dash-auth.php, dash-gate.php, dash-offline.php, index.php = 404): a centred
   400px card with the brand and the language menu, a title, one line of purpose, an alert, the fields, one primary action, one quiet
   link; the privacy link under the card. Phones: no card chrome, the content starts at the top (the keyboard never covers it).
   Selectors start with .auth so they win over the generic .nf-* / .brand rules of later chapters. */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--ring-pop), var(--shadow-pop); }
.auth > .auth-card { width: min(400px, calc(100vw - 32px)); }
:root[data-theme="light"] .auth-card { box-shadow: 0 1px 2px rgba(16, 20, 30, .05), 0 12px 40px rgba(16, 20, 30, .08); }
.auth-card .brand { margin-bottom: 28px; min-height: 36px; font-size: 14.5px; }
.auth-card .brand .muted { display: none; } /* the page title already says what this is; the company name keeps one line */
.auth .lang-menu > summary { min-height: 36px; }
.auth .auth-title, .auth .nf-title { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -.02em; margin: 0 0 6px; color: var(--text); }
.auth .auth-lead, .auth .nf-lead { font-size: 14px; line-height: 1.55; color: var(--text-2); margin: 0 0 22px; }
.auth .auth-other { margin-top: -10px; color: var(--text-3); }
.auth .nf-code { margin: 0 0 6px; }
.auth-alert { display: flex; align-items: flex-start; gap: 10px; margin: -6px 0 18px; padding: 10px 12px; border-radius: var(--radius-md); font-size: 13.5px; line-height: 1.45; color: var(--text); background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 32%, transparent); }
.auth-title + .auth-alert { margin-top: 16px; }
.auth-alert.is-ok { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 32%, transparent); }
.auth-alert:focus { outline: none; } .auth-alert:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-alert-ic { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: var(--bad); } .auth-alert.is-ok .auth-alert-ic { fill: var(--good); }
.auth-form .field { margin-bottom: 14px; gap: 6px; }
.auth-form .field > span, .auth-pass-row label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.auth-form .auth-check { align-items: center; margin: 2px 0 18px; font-size: 13.5px; color: var(--text-2); } .auth-form .auth-check > input[type=checkbox] { margin: 0; min-height: 0; } .auth-otp { font-variant-numeric: tabular-nums; letter-spacing: .32em; font-size: 18px; } /* the second step of a sign-in (inc/core/twofa.php) */
.auth-form input { min-height: 42px; } .auth-form .auth-check > input[type=checkbox] { min-height: 0; }
.auth-form input[aria-invalid="true"] { border-color: var(--bad); }
.auth-pass-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.auth-quiet { font-size: 12.5px; font-weight: 500; }
.auth-pass-box { position: relative; display: block; }
.auth-form .auth-pass-box input { width: 100%; min-height: 44px; }
.auth-pass-box:has(.auth-pass-toggle) input { padding-right: 46px; }
.auth-pass-toggle { position: absolute; top: 0; right: 0; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-md); background: none; color: var(--text-3); cursor: pointer; transition: color var(--dur) var(--ease); }
.auth-pass-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; }
.auth-pass-toggle .auth-eye-off, .auth-pass-toggle[aria-pressed="true"] .auth-eye { display: none; } .auth-pass-toggle[aria-pressed="true"] .auth-eye-off { display: block; }
.auth-pass-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
@media (hover: hover) { .auth-pass-toggle:hover { color: var(--text); } }
/* Busy: the button is disabled, keeps its width and shows a spinner in place of the label's colour */
.auth-submit.is-busy, .auth-submit.is-busy:disabled { position: relative; color: transparent; cursor: progress; opacity: .9; background: var(--accent); border-color: var(--accent); }
.auth-submit.is-busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent-ink) 35%, transparent); border-top-color: var(--accent-ink); animation: auth-spin .7s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .auth-submit.is-busy::after { animation-duration: 1.6s; } }
.auth-submit { height: 44px; margin-top: 8px; font-weight: 600; font-size: 14.5px; }
.auth-note { font-size: 12.5px; line-height: 1.5; color: var(--text-3); margin: 16px 0 0; }
.auth-switch { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--border); text-align: center; font-size: 13.5px; color: var(--text-3); }
.auth-switch a { font-weight: 550; }
.auth-foot { margin: 0; font-size: 12.5px; color: var(--text-3); text-align: center; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.auth-alert + .auth-switch { margin-top: 4px; }
.auth-product { font-weight: 550; }
.auth-foot a { color: var(--text-3); } @media (hover: hover) { .auth-foot a:hover { color: var(--text-2); } }
/* The gate, the 404 and the offline page: an icon, the title, what is true now, what happens next, one action */
.auth-ic { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 18px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.auth-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-gate.is-pending .auth-ic { background: var(--warn-soft); color: var(--warn); }
.auth-gate.is-none .auth-ic, .auth-gate.is-denied .auth-ic { background: var(--surface-2); color: var(--text-2); }
.auth .auth-gate .auth-lead { margin-bottom: 16px; }
.auth-next { margin: 0 0 16px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--surface-2); font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.auth-who { margin: 0 0 16px; font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.auth-actions { margin-top: 22px; } .auth-gate .auth-actions { margin-top: 6px; }
.auth-actions .inline-form { display: block; margin: 0; }
.auth-actions .link-btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 44px; border: 1px solid var(--field-border); border-radius: var(--radius-md); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14.5px; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
@media (hover: hover) { .auth-actions .link-btn:hover { border-color: var(--border-strong); background: var(--surface-3); } }
@media (prefers-reduced-motion: no-preference) {
  .auth > .auth-card { animation: auth-in var(--dur-slow) var(--ease) both; }
  @keyframes auth-in { from { opacity: 0; transform: translateY(6px); } }
}
/* Phones: the content starts at the top under the status bar, no card chrome, 44px targets; the brand keeps one line */
@media (max-width: 640px) {
  .auth { place-content: start stretch; justify-items: stretch; gap: 28px; padding-top: max(28px, calc(env(safe-area-inset-top) + 16px)); }
  .auth > .auth-card { width: 100%; max-width: 440px; justify-self: center; padding: 4px 4px 0; background: none; border: 0; box-shadow: none; }
  :root[data-theme="light"] .auth > .auth-card { box-shadow: none; }
  .auth-card .brand { margin-bottom: 32px; }
  .auth .auth-title, .auth .nf-title { font-size: 24px; }
  .auth .lang-menu > summary { min-height: 44px; padding: 0 12px; } .auth .lang-list a { min-height: 44px; }
  .auth .auth-submit, .auth .auth-actions .btn, .auth .auth-actions .link-btn { height: 48px; min-height: 48px; }
  .auth-quiet, .auth-switch a, .auth-foot a { display: inline-flex; align-items: center; min-height: 44px; }
  .auth-pass-row { align-items: center; margin: -12px 0 -10px; }
  .auth-switch { padding-top: 8px; margin-top: 20px; }
  .auth-foot { padding-bottom: 8px; }
}
/* Short screens (a phone on its side, an open keyboard): start at the top, keep it compact */
@media (max-height: 560px) { .auth { place-content: start center; } .auth-card .brand { margin-bottom: 18px; } }
.auth .tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.auth .tab { padding: 8px 2px; margin-right: 14px; font-weight: 500; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.auth .tab.is-active { color: var(--text); border-color: var(--accent); } .auth .tab:hover { text-decoration: none; color: var(--text); }
.fineprint { font-size: 12px; color: var(--text-3); margin: 16px 0 0; } .center { text-align: center; margin: 12px 0 0; }
.tl-body { min-height: 100vh; min-height: 100dvh; }

/* =====================================================================
   Chapter 10: Phones and tablets (mobile-first behaviours)
   ===================================================================== */
/* Tablets: down to 861px the page keeps its three columns (S a third, W two thirds, F all). Between 641px and 860px there is room for two:
   S is one of them, W and F take both (Half, from old pages, is one column too). A phone has one column (below). */
@media (max-width: 860px) { .wgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span-2, .span-3 { grid-column: span 1; --n: 1; } .span-4, .span-6 { grid-column: span 2; --n: 2; } .col-guides { grid-template-columns: repeat(2, minmax(0, 1fr)); } .col-guides > i:nth-child(3) { display: none; } }
@media (max-width: 860px) {
  .app-shell, .app-shell.is-rail { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .is-rail .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); padding: 14px 10px 12px; gap: 10px; z-index: 60; transform: translateX(-102%); transition: transform .25s var(--ease); box-shadow: var(--shadow-pop); }
  .drawer-open .sidebar { transform: none; }
  .is-rail .sb-top { flex-direction: row; padding: 0 2px 0 6px; } .is-rail .brand { justify-content: flex-start; } .is-rail .brand-mini { display: none; } .is-rail .brand-logo img { display: block; }
  .is-rail .brand .sb-name, .is-rail .sb-search .sb-name, .is-rail .sb-search kbd, .is-rail .sb-pages, .is-rail .sb-name, .is-rail .sb-label .sb-name, .is-rail .sb-label b, .is-rail .sb-lock, .is-rail .me-text, .is-rail .me-chev { display: revert; }
  .is-rail .sb-search { justify-content: flex-start; width: auto; padding: 0 10px; } .is-rail .sb-item, .is-rail .sb-label, .is-rail .me { justify-content: flex-start; padding: 5px 8px; } .is-rail .sb-label .ic { display: block; } .is-rail .sb-label::before { display: none; } .is-rail .sb-item.is-active::after, .is-rail .sb-item.is-open::after { display: none; }
  .sb-fold { display: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 6, 9, .55); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 55; }
  .drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .sb-close, .menu-btn { display: inline-grid; }
  .topbar { padding: 8px 14px; min-height: 52px; } .pagehead { padding: 8px 16px 0; } .canvas { padding: 14px 14px 0; } .viewonly, .editbar { margin: 12px 14px 0; }
  .ph-title h1 { font-size: 22px; } .ph-title { margin-bottom: 8px; } .btn .lbl { display: none; } .topbar .btn { padding: 0 11px; }
  .ptabs { display: flex; margin: 4px 0 2px; }
  /* the business stays in view as a small dot and a short name (Chapter 17); the page name is the page switcher */
}
@media (max-width: 640px) {
  .wgrid, .wgrid.is-masonry { grid-template-columns: minmax(0, 1fr); } .span-2, .span-3, .span-4, .span-6, .wgrid.is-masonry > .widget { grid-column: auto; }
  .wgrid.is-masonry { row-gap: var(--wgap); grid-auto-rows: auto; margin-bottom: 0; } .wgrid.is-masonry > .widget { grid-row: auto; min-height: 0; }
  .wgrid.is-dragging > .col-guides, .wgrid-wrap.is-dragging > .newrow-zone, .wtools-pos .pl, .pin-mark { display: none; } /* one column: nothing to choose */
  .grid-2, .grid-3, .rec-grid, .split-inputs { grid-template-columns: 1fr; }
  .fld-main { grid-template-columns: 1fr; } .rec-board { grid-auto-columns: 84%; }
  .widget { padding: 14px; } .tiles > .tile { flex-basis: calc(50% - 6px); } .tile-value { font-size: 22px; }
  /* dialogs become bottom sheets and the palette a full-width sheet at the top: Chapter 17 */
}

/* =====================================================================
   Chapter 11: Invoices in the booking dialog, wide settings card
   ===================================================================== */
.grid-half > .card-wide { grid-column: 1 / -1; }
.inv-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 4px 0 14px; background: var(--surface-2); }
.inv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.inv-head .seg { margin: 0; flex-wrap: wrap; }
.inv-line { display: grid; grid-template-columns: minmax(0, 1fr) 70px 80px 110px 34px; gap: 8px; margin-bottom: 8px; align-items: center; }
.inv-line-head { font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; }
.inv-line input { min-height: 34px; }
.inv-dates { margin-top: 12px; }
.inv-total { font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--surface-3); margin: 10px 0 6px; }
.inv-link { border: 0; cursor: pointer; font: inherit; font-size: 12px; }
.inv-issued .inv-head { margin-bottom: 4px; }
@media (max-width: 640px) { .inv-line { grid-template-columns: 1fr 1fr; } .inv-line .l-desc { grid-column: 1 / -1; } .inv-line-head { display: none; } }

/* =====================================================================
   Chapter 12: Widget options, gallery, documents, numbers, AI widgets
   ===================================================================== */
.wsub { margin: 2px 0 0; font-size: 12px; color: var(--text-3); font-weight: 400; }
.whead { flex-wrap: wrap; } .whead h2 { flex: 0 1 auto; }
.wbody.h-s { max-height: 320px; overflow: auto; } .wbody.h-m { max-height: 480px; overflow: auto; } .wbody.h-l { max-height: 720px; overflow: auto; }
.gal-bar { position: sticky; top: -8px; z-index: 3; /* above the cards' info and delete buttons (z-index 2) */ background: var(--surface); padding-bottom: 8px; }
.gal-bar input[type=search] { width: 100%; margin-bottom: 8px; }
.gal-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.is-on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.sec-sub { margin: -4px 0 10px; }
.pick-wrap { position: relative; display: flex; } .pick-wrap > .pick { flex: 1; }
.pick-edit { position: absolute; top: 6px; right: 6px; }
.pick-by { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; color: var(--accent); } .pick-by .ic { width: 12px; height: 12px; }
.pick-ai { border-style: dashed; border-color: var(--accent); background: var(--accent-soft); }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; align-items: start; }
.opt-grid .wide, .opt-grid fieldset { grid-column: 1 / -1; }
.opt-extra { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
fieldset.checks.field { flex-direction: row; align-items: center; }
.opt-check { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; } .opt-check .check { margin: 0; } .opt-check > .small { margin: 0; padding-left: 28px; }
fieldset.checks { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
fieldset.checks legend { padding: 0 6px; font-size: 12px; font-weight: 500; color: var(--text-2); }
fieldset.checks .small { flex-basis: 100%; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; margin: 0; } .field.inline select { width: auto; }

/* Choices (statuses) editor */
.choice-extra { display: block; } .choice-extra > .check { margin: 0 0 8px; }
.choices { width: 100%; }
.choice-list { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.choice-list li { display: flex; align-items: center; gap: 8px; }
.choice-list .co-name { flex: 1; min-width: 0; } .choice-list .co-tone { width: auto; min-width: 90px; flex: none; } .choice-list .fld-btns { flex: none; }
.choice-list .check { margin: 0; font-size: 13px; white-space: nowrap; }
.ch-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--text-3); }
.ch-dot.good { background: var(--good); } .ch-dot.warn { background: var(--warn); } .ch-dot.bad { background: var(--bad); } .ch-dot.info { background: var(--accent); }
.choice-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* Documents */
.embed-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; } .embed-bar .ic { width: 16px; height: 16px; color: var(--accent); } .embed-kind { font-size: 13px; font-weight: 500; }
.embed-frame { width: 100%; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); display: block; }
.embed-frame.sz-s { height: 320px; } .embed-frame.sz-m { height: 480px; } .embed-frame.sz-l { height: 720px; } .embed-frame.sz-xl { height: min(960px, 70vh); }
.embed-frame.is-inert { pointer-events: none; }
.embed-hint { margin: 8px 0 0; }
.viewer .embed-frame { height: min(720px, 68vh); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.doc-card { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ic main" "act act"; gap: 8px 12px; align-items: start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.doc-ic { grid-area: ic; color: var(--accent); } .doc-ic .ic { width: 22px; height: 22px; }
.doc-main { grid-area: main; min-width: 0; } .doc-main h3 { font-size: 14px; margin: 0 0 4px; overflow-wrap: anywhere; }
.doc-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .doc-note { margin: 6px 0 0; font-size: 12px; color: var(--text-3); }
.doc-actions { grid-area: act; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.qlinks { display: grid; gap: 6px; }
.qlink { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 500; }
.qlink:hover { border-color: var(--accent); } .qlink .ic { width: 16px; height: 16px; color: var(--accent); }

/* Numbers */
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi-value { font-size: 34px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; }
.kpi-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.kpi-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; width: 0; }
.kpi-fill.p-0 { width: 0%; }
.kpi-fill.p-5 { width: 5%; }
.kpi-fill.p-10 { width: 10%; }
.kpi-fill.p-15 { width: 15%; }
.kpi-fill.p-20 { width: 20%; }
.kpi-fill.p-25 { width: 25%; }
.kpi-fill.p-30 { width: 30%; }
.kpi-fill.p-35 { width: 35%; }
.kpi-fill.p-40 { width: 40%; }
.kpi-fill.p-45 { width: 45%; }
.kpi-fill.p-50 { width: 50%; }
.kpi-fill.p-55 { width: 55%; }
.kpi-fill.p-60 { width: 60%; }
.kpi-fill.p-65 { width: 65%; }
.kpi-fill.p-70 { width: 70%; }
.kpi-fill.p-75 { width: 75%; }
.kpi-fill.p-80 { width: 80%; }
.kpi-fill.p-85 { width: 85%; }
.kpi-fill.p-90 { width: 90%; }
.kpi-fill.p-95 { width: 95%; }
.kpi-fill.p-100 { width: 100%; }

/* Timeline and activity */
.timeline, .feed { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: baseline; }
.tl-item:last-child, .feed-item:last-child { border-bottom: 0; } @media (hover: hover) { .tl-item:hover, .feed-item:hover { background: var(--surface-2); } }
.tl-when { flex: 0 0 96px; font-weight: 600; font-size: 13px; display: flex; flex-direction: column; } .tl-when small, .tl-main small, .feed-main small { font-weight: 400; color: var(--text-3); font-size: 12px; }
.tl-main { display: flex; flex-direction: column; min-width: 0; } .tl-main b { overflow-wrap: anywhere; font-weight: 500; }
.tl-item.is-late .tl-when { color: var(--bad); } .tl-item.is-today .tl-when { color: var(--warn); }
.feed-item { display: flex; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.feed-main { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; flex: none; }

/* AI widgets */
.cw-frame { display: block; width: 100%; height: 120px; border: 0; background: transparent; color-scheme: inherit; }
.cw-two { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; } @media (max-width: 860px) { .cw-two { grid-template-columns: 1fr; } }
.cw-preview { border: 1px dashed var(--border-strong); border-radius: 14px; padding: 12px; min-height: 160px; background: var(--surface); }
.cw-side .dialog-actions { flex-wrap: wrap; }
.cw-examples { gap: 6px; margin-bottom: 12px; } .cw-examples .chip { height: auto; padding: 4px 10px; text-align: left; white-space: normal; }
.ai-setup .steps { padding-left: 20px; display: grid; gap: 10px; } .code-block { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font: 12px var(--mono); overflow-x: auto; white-space: pre-wrap; user-select: all; }

/* =====================================================================
   Chapter 13: Brand, group hub, help popovers
   ===================================================================== */
.tm-head .ph-logo { width: 44px; height: 44px; border-radius: 10px; padding: 4px; }
.help { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 4px; padding: 0; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-3); font: 600 11px/1 var(--font); cursor: help; vertical-align: 1px; }
@media (hover: hover) { .help:hover { color: var(--accent); border-color: var(--accent); } } .help:focus-visible { color: var(--accent); border-color: var(--accent); }
.popover { position: fixed; z-index: 100; max-width: min(340px, calc(100vw - 16px)); padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-size: 13px; line-height: 1.5; color: var(--text-2); animation: pop .14s var(--ease); }
.popover p { margin: 0 0 6px; } .popover p:last-child { margin: 0; } .pop-title { display: block; margin-bottom: 4px; color: var(--text); font-size: 13px; }
details.more { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
details.more > summary { cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(-45deg); transition: transform .15s var(--ease); flex: none; margin: 0 2px; }
details.more[open] > summary::before { transform: rotate(45deg); }
details.more > summary small { font-weight: 400; color: var(--text-3); margin-left: auto; }
details.more > .more-body { padding: 2px 14px 14px; }

.prof-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; align-items: start; }
.profile .card { padding: 16px 18px; } .profile .card h2 { margin-bottom: 12px; }
.logo-row { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.logo-box { width: 132px; height: 84px; border: 1px dashed var(--border-strong); border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); overflow: hidden; flex: none; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 8px; }
.logo-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; flex: 1; min-width: 150px; }
.color-row { display: flex; gap: 8px; align-items: center; } .color-row .cf-hex { width: 110px; font-family: var(--mono); }
.cf-pick { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.swatch-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.csw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); padding: 0; cursor: pointer; display: grid; place-items: center; background: var(--biz); }
.csw .dot { display: none; } @media (hover: hover) { .csw:hover { transform: scale(1.12); } }
.inv-preview { --p: #4f8df0; --s: #d6dbe4; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: #fff; color: #1c2028; margin-top: 4px; }
.ip-band { height: 7px; background: var(--p); } .ip-body { padding: 12px 14px; display: grid; gap: 10px; }
.ip-brand { min-height: 30px; display: flex; align-items: center; } .ip-brand img { max-height: 30px; max-width: 160px; object-fit: contain; } .ip-brand b { font-size: 15px; color: #1c2028; }
.ip-lines { display: grid; gap: 5px; } .ip-lines i { display: block; height: 6px; border-radius: 3px; background: var(--s); } .ip-lines i:nth-child(1) { background: var(--p); width: 100%; height: 14px; border-radius: 3px; opacity: .92; } .ip-lines i:nth-child(2) { width: 82%; } .ip-lines i:nth-child(3) { width: 64%; }
.ip-total { height: 18px; width: 44%; margin-left: auto; border-radius: 4px; background: var(--p); }

.hub-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.hub-card:last-child { margin-bottom: 0; }
.hub-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.hub-tiles { margin-bottom: 16px; }
.hub-sec-head { margin-bottom: 12px; } .hub-sec-head h2 { margin-bottom: 2px; } .hub-sec-head p { margin: 0; }
.hub-biz { display: flex; align-items: center; gap: 8px; } .hub-biz .sb-mark { width: 24px; height: 24px; }
.hub-table td .small { display: block; margin-top: 2px; }
.hub-table tr.is-sel td { background: var(--accent-soft); }
@media (max-width: 640px) { .hub-table.cards tr.is-sel { background: var(--accent-soft); border-radius: 10px; padding: 12px 10px; } .hub-table.cards tr.is-sel td { background: none; } .hub-table.cards .hub-biz { flex-wrap: wrap; } }
.hub-brand .profile .card { background: var(--surface-2); box-shadow: none; }
.hub-brand .profile .row-actions { margin-top: 14px; }
.hub-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, 1fr); gap: 16px; align-items: start; } @media (max-width: 900px) { .hub-grid { grid-template-columns: 1fr; } }
.tm { position: relative; width: 100%; aspect-ratio: 100 / 56; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.tm-tile { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; justify-content: flex-end; padding: 10px 12px; overflow: hidden; text-align: left; border: 2px solid var(--surface); border-radius: 6px; cursor: pointer;
  background: var(--biz, var(--accent)); color: var(--ink, #fff); font: inherit; transition: filter .15s var(--ease), transform .15s var(--ease); }
@media (hover: hover) { .tm-tile:hover { filter: brightness(1.07); z-index: 2; } } .tm-tile:focus-visible { outline: 3px solid var(--text); outline-offset: -4px; z-index: 3; }
.tm-tile.is-sel { box-shadow: inset 0 0 0 3px var(--ink, #fff); z-index: 2; }
.tm-tile img { max-height: 38%; max-width: 70%; object-fit: contain; margin-bottom: auto; background: rgba(255, 255, 255, .86); border-radius: 8px; padding: 4px 6px; }
.tm-tile b { font-size: 15px; line-height: 1.2; } .tm-tile .num { font-size: 13px; opacity: .92; } .tm-tile small { font-size: 12px; opacity: .8; }
.tm-tile.is-sliver > * { display: none; } .tm-tile.is-small { opacity: .75; } .tm-tile.is-tiny { padding: 0 6px; justify-content: center; } .tm-tile.is-tiny b { font-size: 11px; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .tm-tile.is-tiny .num, .tm-tile.is-tiny small, .tm-tile.is-tiny img { display: none; }
.tm-panel { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--surface-2); border-top: 4px solid var(--biz, var(--accent)); }
.tm-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; } .tm-head h3 { margin: 0; font-size: 17px; }
.tm-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0 0 12px; } .tm-stats dt { font-size: 12px; color: var(--text-2); } .tm-stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -.02em; } .tm-stats small { color: var(--text-3); font-size: 12px; }
.neg { color: var(--bad); }

/* =====================================================================
   Chapter 14: Dividends summary, bookings, booking dialog, settings
   ===================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.act-cell { width: 1%; white-space: nowrap; } .act-cell .icon-btn { opacity: .35; } tr:hover .act-cell .icon-btn, .act-cell .icon-btn:focus-visible { opacity: 1; }
@media (pointer: coarse), (hover: none) { .act-cell .icon-btn { opacity: 1; } } /* no hover on a touch screen: the row actions are always there */
.sumtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 0 0 14px; }
.sumtile { padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 1px; }
.sumtiles.hub-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } @media (max-width: 860px) { .sumtiles.hub-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sumtile span { font-size: 12px; color: var(--text-2); } .sumtile b { font-size: 20px; font-weight: 600; letter-spacing: -.02em; } .sumtile small { font-size: 12px; color: var(--text-3); }
@media (max-width: 640px) { .sumtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sumtiles .sumtile:last-child:nth-child(odd) { grid-column: 1 / -1; } .sumtile b { font-size: 18px; } .sumtile { padding: 10px 12px; } }
@media (max-width: 640px) { .toolbar select, .wtools select { flex: 1 1 calc(50% - 5px); min-width: 0; } .toolbar input[type=search], .wtools input[type=search] { flex: 1 1 100%; } }
.amount-in { color: var(--good); }
.inline-more { border: 0; background: none; align-self: flex-start; } details.inline-more > summary { min-height: 32px; padding: 4px 11px 4px 9px; font-weight: 500; font-size: 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); } details.inline-more > summary:hover { border-color: var(--border-strong); } details.inline-more > .more-body { padding: 8px 0 0; }
.toolbar .badge { background: var(--accent); color: var(--accent-ink); }
.tx-adv { margin: 4px 0 12px; } .inv-more { margin: 10px 0; }
.client-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; } .client-row .field { flex: 1; min-width: 200px; }
.inv-step { margin-bottom: 14px; } .inv-step .sec-title { margin-top: 12px; }

.dv-bar { display: grid; grid-template-columns: 140px 190px minmax(240px, 1fr); gap: 14px; align-items: end; margin: 6px 0 14px; } @media (max-width: 860px) { .dv-bar { grid-template-columns: 1fr 1fr; } .dv-bar .dv-pct { grid-column: 1 / -1; } }
.dv-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; } @media (max-width: 900px) { .dv-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); } } @media (max-width: 640px) { .dv-tile { padding: 12px 12px; } .dv-tile b { font-size: 18px; } .dv-hero { gap: 10px; } }
.dv-tile { padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 3px; }
.dv-tile.dv-main { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.dv-tile small .tag { font-size: 11px; padding: 0 7px; margin-right: 4px; line-height: 1.4; }
.dv-label { font-size: 12.5px; color: var(--text-2); } .dv-tile b { font-size: 25px; font-weight: 650; letter-spacing: -.025em; line-height: 1.15; } .dv-tile small { font-size: 12px; color: var(--text-3); }
.alert.dv-hours { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; color: var(--text-2); line-height: 1.5; } .dv-hours > .ic { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--accent); } .dv-hours b { color: var(--text); } .dv-hours > span { min-width: 0; }
#settle-personal { margin: 14px 0 16px; }
.dv-owners { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 0; }
.owner-card .oc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; } .owner-card .oc-head .name { margin: 0; font-size: 15px; }
.owner-card .oc-main { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; } .owner-card .oc-main b { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.owner-card .oc-line { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 13px; color: var(--text-2); }
.owner-card details.more { margin-top: 10px; } .owner-card .oc-rows .row { gap: 12px; }
.dv-foot { margin: 12px 0; } .dv-stack { display: grid; gap: 10px; margin: 14px 0; }
.settings-stack { display: grid; gap: 10px; }
.savebar { position: sticky; bottom: 0; display: flex; gap: 14px; align-items: center; justify-content: flex-end; padding: 12px 0; background: linear-gradient(to top, var(--surface) 70%, transparent); } .savebar .form-msg { margin: 0; flex: 1; }

.hub-top + .hint { margin: 0 0 14px; }
.tm-panel .row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.profile .row-actions { margin-top: 14px; }
.toolbar input[type=search] { flex: 1 1 220px; min-width: 200px; }

/* =====================================================================
   Chapter 15: Language menu, Google accounts, invoice preview, sign-in branding
   ===================================================================== */
.lang-menu { position: relative; }
.lang-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 12.5px; letter-spacing: .04em; }
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu > summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg) translateY(-2px); }
.lang-menu > summary:hover, .lang-menu[open] > summary { border-color: var(--border-strong); }
.lang-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; list-style: none; margin: 0; padding: 6px; min-width: 190px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-pop); }
.lang-list a, .lang-list button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; text-decoration: none; }
.lang-list a:hover, .lang-list button:hover { background: var(--surface-2); text-decoration: none; }
.lang-list [aria-current] { background: var(--accent-soft); } .lang-list b { width: 24px; font-size: 12px; letter-spacing: .05em; color: var(--text-2); }
.auth-card .brand .lang-menu { margin-left: auto; } .auth-card .brand { gap: 10px; }
.brand-logo-img { display: block; max-height: 40px; max-width: 220px; width: auto; height: auto; object-fit: contain; }

.gacct { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; } .gacct select { width: auto; min-height: 28px; padding: 2px 8px; font-size: 12.5px; max-width: 240px; }
.ga-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.ga-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.ga-add { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; } .ga-add .field { flex: 1; min-width: 220px; margin: 0; }
.embed-bar { flex-wrap: wrap; }

.pdf-frame { width: 100%; height: min(72vh, 780px); border: 1px solid var(--border); border-radius: 10px; background: #fff; display: block; }
.inv-revise { display: grid; gap: 6px; margin: 4px 0 8px; }
.inv-head { flex-wrap: wrap; gap: 10px; }

/* Phones: the top bar keeps only what fits (edit buttons become icons) */
@media (max-width: 640px) {
  .topbar .btn span { display: none; } .topbar .btn { padding: 0 11px; }
  .ptools-label { flex-basis: 100%; }
}

/* Getting started (the onboarding checklist, a company widget) */

/* =====================================================================
   Chapter: Getting started (the setup checklist on the company overview)
   ===================================================================== */
.ob-sum { margin: 0 0 8px; color: var(--text-2); } .ob-sum b { color: var(--text); }
.ob-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ob-step { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); min-width: 0; }
.ob-step.is-done { background: transparent; color: var(--text-3); }
.ob-mark { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border-strong); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.ob-step.is-done .ob-mark { background: var(--good); border-color: var(--good); color: #fff; } .ob-step.is-done .ob-mark svg { width: 13px; height: 13px; }
.ob-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; } .ob-main b { font-weight: 600; } .ob-main small { color: var(--text-3); }
.ob-step.is-done .ob-main b { font-weight: 500; text-decoration: line-through; }
.ob-step .btn { flex: none; }
.ob-done { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text-2); } .ob-done > svg { width: 20px; height: 20px; color: var(--good); flex: none; } .ob-done p { margin: 0; flex: 1; min-width: 160px; }
@media (max-width: 640px) { .ob-step { flex-wrap: wrap; } .ob-step .ob-main { flex: 1 1 calc(100% - 40px); } .ob-step .btn { margin-left: 34px; } } /* the button goes under the text, the text keeps the row */

/* =====================================================================
   Chapter 17: Phones, tablets and touch screens
   Two breakpoints: 640px (phone: one column, bottom sheets) and 860px (tablet: the sidebar is a drawer, two columns).
   A touch screen (pointer: coarse) gets 44px targets whatever its width: the hit area grows (padding, or an invisible
   ::after) while the look stays compact. Safe areas (notch, home bar) come from env(safe-area-inset-*) (viewport-fit=cover);
   --vvh (the height that is really visible) and --kb (what the on-screen keyboard covers) are set by ui.js.
   ===================================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; /* no double-tap zoom on iOS */ }
* { -webkit-tap-highlight-color: transparent; }
a, button, input, select, textarea, label, summary, [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="treeitem"] { touch-action: manipulation; } /* no double-tap zoom wait */
/* Installed on an iOS home screen the status bar text is white (black-translucent): in the light theme the strip under it stays dark */
@media (display-mode: standalone) { :root[data-theme="light"] body::before { content: ""; position: fixed; z-index: 70; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); background: #14161a; pointer-events: none; } }

/* Safe areas */
.topbar { padding-top: max(10px, env(safe-area-inset-top)); padding-right: max(32px, env(safe-area-inset-right)); }
.canvas, .pagehead { padding-right: max(32px, env(safe-area-inset-right)); }
.main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
.sidebar { padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); padding-left: max(10px, env(safe-area-inset-left)); }
/* The page behind a dialog, the open drawer or a bottom sheet does not scroll (ui.js syncLock) */
@media (max-width: 860px), (pointer: coarse) { html.is-locked, html.is-locked body { overflow: hidden; } }

/* Fields: 16px text (iOS zooms the page into anything smaller), date and time fields that fit their column, room above the keyboard and sticky buttons */
@media (max-width: 860px), (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select:not([multiple]), textarea { font-size: 16px; }
  input, select { min-height: 42px; }
  .toolbar input, .toolbar select, .wtools input[type=search], .wtools select, .inv-line input, .field.inline select { min-height: 40px; }
  .gacct select { font-size: 16px; min-height: 40px; max-width: 100%; }
  input[type=date], input[type=time], input[type=datetime-local], input[type=month] { min-width: 0; -webkit-appearance: none; appearance: none; display: block; text-align: left; }
  input::-webkit-date-and-time-value { text-align: left; }
  input:focus, select:focus, textarea:focus { scroll-margin-top: 90px; scroll-margin-bottom: 120px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .check { min-height: 40px; align-items: center; } .check > input[type=checkbox], .check > input[type=radio] { margin-top: 0; }
}

/* Touch targets: 44px to hit, compact to look at */
@media (pointer: coarse), (max-width: 860px) {
  :where(.btn, .icon-btn, .chip, .help, .size, .crumb, .link-btn, .sb-caret, .pin-mark, .csw) { position: relative; }
  .btn { height: 40px; } .btn-sm { height: 34px; }
  .btn::after, .crumb::after, .link-btn::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: max(100%, 44px); transform: translateY(-50%); }
  .icon-btn { width: 40px; height: 40px; } .icon-btn.xs { width: 32px; height: 32px; }
  .icon-btn::after, .chip::after, .size::after, .sb-caret::after, .pin-mark::after, .csw::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
  .help { width: 20px; height: 20px; font-size: 11.5px; } .help::after { content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%); }
  .chip { min-height: 30px; } .size { width: 30px; height: 30px; }
  .tab-arrow { width: 40px; height: 40px; }
  .seg span { padding: 9px 14px; } .wtools .seg span { padding: 7px 12px; }
  .menu-item { min-height: 44px; }
  .sb-item { min-height: 44px; } .sb-page { min-height: 42px; font-size: 14px; } .sb-leaf { min-height: 40px; font-size: 13.5px; }
  .sb-caret { width: 26px; height: 26px; }
  .sb-search { height: 42px; } .sb-search kbd { display: none; } .me { min-height: 48px; }
  .crumb { min-height: 40px; }
  .ptab { min-height: 44px; }
  .pal-item { min-height: 44px; }
  .rec-col header .icon-btn, .pick-edit, .pick-del, .pick-info { width: 36px; height: 36px; }
}

/* The drawer (Chapter 10 puts it off screen up to 860px; shell.js opens, closes and swipes it) */
@media (max-width: 860px) {
  .sidebar, .is-rail .sidebar { padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); overscroll-behavior: contain; touch-action: pan-y; width: min(320px, 86vw); }
  .drawer-open .sidebar.is-swiping { transform: translateX(var(--swipe, 0px)); transition: none; }
  .scrim { overscroll-behavior: contain; touch-action: none; }
  .sb-close { width: 44px; height: 44px; margin-right: -6px; }
  /* The foot (assistant, account, sign out) stays at the bottom of the drawer while the page list scrolls above it */
  .sidebar .sb-foot { position: sticky; bottom: calc(-1 * max(12px, env(safe-area-inset-bottom))); z-index: 2; background: var(--bg-side); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .topbar { gap: 4px; min-height: 52px; padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 6px max(6px, env(safe-area-inset-left)); }
  .canvas { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .pagehead { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .menu-btn { width: 44px; height: 44px; }
  /* The business stays in view: its dot (or logo) and a short name; the page name next to it is the page switcher */
  .crumbs { flex: 1 1 auto; gap: 0; }
  .crumb { padding: 4px 6px; }
  .crumb-biz { flex: 0 1 auto; max-width: 36vw; gap: 6px; font-size: 13px; }
  .crumb-biz > span:not(.tag) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .crumb-biz .tag { display: none; }
  .crumb-page { flex: 0 1 auto; min-width: 0; max-width: none; }
  .crumb-page b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .crumbs .sep { flex: none; }
  /* Page tabs scroll sideways; the soft edges say there is more (shell.js fitTabs sets fade-l / fade-r) */
  .ptabs { --fl: 0px; --fr: 0px; margin: 4px calc(-1 * max(16px, env(safe-area-inset-left))) 2px; padding: 0 max(16px, env(safe-area-inset-left)); scroll-padding-inline: 16px; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent); mask-image: linear-gradient(to right, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent); }
  .ptabs.fade-l { --fl: 44px; } .ptabs.fade-r { --fr: 44px; }
  .ptab { padding: 10px 14px; }
}
@media (max-width: 640px) { .crumb-biz { max-width: 32vw; } .crumb b { font-size: 14.5px; } }

/* Anchored menus: never taller than what is visible (a long one scrolls); on a phone a bottom sheet with a dimmed page behind */
.menu { max-height: calc(var(--vvh, 100dvh) - 16px); overflow-y: auto; overscroll-behavior: contain; }
.menu-scrim { position: fixed; inset: 0; z-index: 119; background: rgba(5, 6, 9, .5); animation: fade-in .18s var(--ease); touch-action: none; }
.menu.is-sheet { left: 0; right: 0; top: auto; bottom: var(--kb, 0px); width: auto; min-width: 0; max-width: none; max-height: min(80vh, calc(var(--vvh, 100dvh) - 48px)); max-height: min(80dvh, calc(var(--vvh, 100dvh) - 48px));
  padding: 4px max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border-width: 1px 0 0; border-radius: 18px 18px 0 0; animation: sheet-up .24s var(--ease); }
.menu.is-sheet::before { content: ""; display: block; width: 36px; height: 4px; margin: 6px auto 6px; border-radius: 2px; background: var(--border-strong); }
.menu.is-sheet .menu-head { padding: 4px 12px 8px; }
.menu.is-sheet .menu-item { min-height: 48px; padding: 10px 12px; font-size: 15px; border-radius: 10px; }
.menu.is-sheet .menu-item .ic { width: 18px; height: 18px; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
.popover { max-height: calc(var(--vvh, 100dvh) - 16px); overflow-y: auto; overscroll-behavior: contain; }

/* Dialogs: on a phone a bottom sheet (with a handle to show what it is), its buttons above the home bar and the keyboard */
.dialog-body { --db-pb: 20px; padding-bottom: var(--db-pb); overscroll-behavior: contain; }
.pal-list { max-height: min(52vh, calc(var(--vvh, 100dvh) - 200px)); overscroll-behavior: contain; }
.dialog-body form > .dialog-actions:last-child, .dialog-body > .dialog-actions:last-child { bottom: calc(-1 * var(--db-pb)); margin-bottom: calc(-1 * var(--db-pb)); padding-bottom: var(--db-pb); }
@media (max-width: 640px) {
  .dialog, .dialog.wide, .dialog.dh-dialog-wide { width: 100%; max-width: 100%; max-height: calc(var(--vvh, 100dvh) - max(10px, env(safe-area-inset-top))); margin: auto 0 var(--kb, 0px); border-radius: 18px 18px 0 0; border-width: 1px 0 0; }
  .dialog[open] { animation: sheet-up .26s var(--ease); }
  .dialog[open]::before { content: ""; flex: none; align-self: center; width: 36px; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--border-strong); }
  .dialog-head { padding: 6px max(10px, env(safe-area-inset-right)) 4px max(18px, env(safe-area-inset-left)); gap: 10px; }
  .dialog-head .h2 { min-width: 0; overflow-wrap: anywhere; }
  .dialog-body { --db-pb: max(18px, calc(10px + env(safe-area-inset-bottom))); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .kb-open .dialog-body { --db-pb: 12px; } /* the keyboard covers the home bar */
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .btn { height: 44px; }
  .palette { width: calc(100% - 16px); max-width: none; margin: max(8px, env(safe-area-inset-top)) auto 0; border-radius: 14px; }
  .pal-list { max-height: calc(var(--vvh, 100dvh) - 150px); }
  .pal-foot { display: none; }
}
.pal-close { display: none; }
@media (max-width: 640px), (pointer: coarse) { .pal-input kbd { display: none; } .pal-close { display: inline-grid; flex: none; margin-right: -8px; } }

/* Landscape phones: dialogs take the whole screen, the page is one column */
@media (max-height: 500px) and (orientation: landscape) {
  .dialog, .dialog.wide, .dialog.dh-dialog-wide { width: 100%; max-width: 100%; height: var(--vvh, 100dvh); max-height: var(--vvh, 100dvh); margin: 0; border: 0; border-radius: 0; padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .dialog[open] { animation: fade-in .18s var(--ease); }
  .dialog[open]::before { display: none; }
  .dialog-body { --db-pb: max(14px, env(safe-area-inset-bottom)); }
  .wgrid, .wgrid.is-masonry { grid-template-columns: minmax(0, 1fr); } .span-2, .span-3, .span-4, .span-6, .wgrid.is-masonry > .widget { grid-column: auto; }
  .wgrid.is-masonry { row-gap: var(--wgap); grid-auto-rows: auto; margin-bottom: 0; } .wgrid.is-masonry > .widget { grid-row: auto; min-height: 0; }
  .wgrid.is-dragging > .col-guides, .wgrid-wrap.is-dragging > .newrow-zone, .wtools-pos .pl, .pin-mark { display: none; }
  .topbar { min-height: 46px; padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
  .palette { margin-top: 6px; } .pal-list { max-height: calc(var(--vvh, 100dvh) - 80px); } .pal-foot { display: none; }
  .menu.is-sheet { max-height: calc(var(--vvh, 100dvh) - 24px); }
}

/* Hover-only affordances need a different home on touch screens */
@media (hover: none) { .btn:active, .icon-btn:active, .menu-item:active, .sb-item:active, .sb-page:active, .pal-item:active, .chip:active { background: var(--surface-2); } .btn-primary:active { background: var(--accent); filter: brightness(.92); } }

/* Customize on a phone: one column, so no S / W / F; big arrows to reorder; Save and Cancel in a bar at the bottom of the screen */
.eb-phone { display: none; }
@media (max-width: 640px) {
  .wgrid.is-editing { --wgap: 118px; margin-top: 62px; }
  .is-editing .sizes, .is-editing .grip { display: none; }
  .wtools-edit { top: -58px; right: 8px; } .wtools-pos { bottom: -58px; left: 8px; right: auto; }
  .wtools-edit .icon-btn.xs, .wtools-pos .icon-btn.xs { width: 40px; height: 40px; } .wtools-edit .icon-btn.xs .ic, .wtools-pos .icon-btn.xs .ic { width: 18px; height: 18px; }
  .wtools-pos [data-wact="up"], .wtools-pos [data-wact="down"] { width: 44px; height: 44px; }
  .is-editing .widget.bare { padding-top: 6px; padding-bottom: 6px; }
  #app.is-editing .main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .editbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; margin: 0; gap: 8px; border-width: 1px 0 0; border-radius: 18px 18px 0 0; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    padding: 10px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); box-shadow: 0 -12px 32px rgba(0, 0, 0, .28); }
  .kb-open .editbar { display: none; }
  .eb-text { flex-basis: 100%; font-size: 12.5px; line-height: 1.4; }
  .editbar .spacer { display: none; }
  .editbar #add-widget { flex: 1 1 auto; height: 44px; }
  .eb-phone { display: flex; flex: 2 1 auto; gap: 8px; } .eb-phone .btn { flex: 1; height: 44px; }
  .topbar #cancel-edit, .topbar #toggle-edit.btn-primary { display: none; }
  .ptools { gap: 6px; } .ptools .btn { flex: 1 1 auto; }
}

/* Toast: above the home bar and the keyboard */
.toast { bottom: calc(22px + env(safe-area-inset-bottom) + var(--kb, 0px)); max-width: min(520px, calc(100% - 24px - env(safe-area-inset-left) - env(safe-area-inset-right))); }
@media (max-width: 640px) { .toast { bottom: calc(14px + env(safe-area-inset-bottom) + var(--kb, 0px)); font-size: 14px; padding: 12px 16px; } }

/* Card tables (phones). A table opts in with class "cards" and a data-l label on each cell; helpers on the cells:
   .c-full spans the card, .c-main is its title (no label, full width), .r / .num align numbers right, .c-hide is left out,
   .act-cell becomes a row of buttons at the foot of the card. ".cards.kv" puts every label beside its value instead. */
@media (max-width: 640px) {
  .table.cards tr { gap: 10px 14px; padding: 14px 2px; }
  .table.cards td { overflow-wrap: anywhere; line-height: 1.4; }
  .table.cards td[data-l]::before { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; } /* a longer Slovene label wraps instead of ending in … */
  .table.cards td[data-l=""]::before { display: none; }
  .table.cards td.r { text-align: right; }
  .table.cards td.num, .table.cards td .num { font-variant-numeric: tabular-nums; }
  .table.cards td.r.num { white-space: nowrap; }
  .table.cards td.c-main { grid-column: 1 / -1; font-weight: 600; font-size: 15px; } .table.cards td.c-main::before { display: none; }
  .table.cards td.c-hide, .table.cards th.c-hide { display: none; }
  .table.cards td .tag { white-space: normal; max-width: 100%; }
  .table.cards td.act-cell { justify-content: flex-end; align-items: center; gap: 6px; width: auto; margin-top: 2px; padding-top: 10px; border-top: 1px dashed var(--border); }
  .table.cards td.act-cell::before { display: none; }
  .table.cards td.act-cell .icon-btn { opacity: 1; border: 1px solid var(--border); background: var(--surface-2); }
  .table.cards tbody tr.clickable:active { background: var(--surface-2); }
  .table.cards tfoot { display: block; } .table.cards tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; padding: 12px 2px 0; border-top: 1px solid var(--border-strong); }
  .table.cards tfoot td, .table.cards tfoot th { display: block; padding: 0; border: 0; } .table.cards tfoot td:empty, .table.cards tfoot th:empty { display: none; }
  .table.cards.kv tr { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .table.cards.kv td[data-l] { display: grid; grid-template-columns: minmax(6.5em, 38%) minmax(0, 1fr); gap: 12px; align-items: baseline; }
  .table.cards.kv td[data-l]::before { margin: 0; white-space: normal; }
  .table.cards.kv td.r[data-l] > * { justify-self: end; }
  .table.cards.kv td.act-cell { display: flex; }
  /* the last card keeps the same alignment as the others (the "tr:last-child td" reset above is more specific than .r and .act-cell) */
  .table.cards tbody tr td.r { text-align: right; } .table.cards tbody tr td.act-cell { display: flex; }
  .table.cards.kv tbody tr td.r[data-l] { text-align: left; }
}
/* A table that scrolls sideways: the soft edges take the colour of what is behind (set --wrap-bg where it is not a card) */
.table-wrap { --wrap-bg: var(--surface); -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  background: linear-gradient(to right, var(--wrap-bg) 30%, transparent) 0 0 / 40px 100% no-repeat local, linear-gradient(to left, var(--wrap-bg) 30%, transparent) 100% 0 / 40px 100% no-repeat local,
    linear-gradient(to right, rgba(0, 0, 0, .28), transparent) 0 0 / 14px 100% no-repeat scroll, linear-gradient(to left, rgba(0, 0, 0, .28), transparent) 100% 0 / 14px 100% no-repeat scroll; }
.dialog .table-wrap { --wrap-bg: var(--surface); } .inv-box .table-wrap, .rec-col .table-wrap, .sumtile .table-wrap { --wrap-bg: var(--surface-2); }
:root[data-theme="light"] .table-wrap { background: linear-gradient(to right, var(--wrap-bg) 30%, transparent) 0 0 / 40px 100% no-repeat local, linear-gradient(to left, var(--wrap-bg) 30%, transparent) 100% 0 / 40px 100% no-repeat local,
    linear-gradient(to right, rgba(16, 20, 30, .12), transparent) 0 0 / 14px 100% no-repeat scroll, linear-gradient(to left, rgba(16, 20, 30, .12), transparent) 100% 0 / 14px 100% no-repeat scroll; }

/* No sideways scroll of the whole page on a phone: long words wrap, media and frames fit */
@media (max-width: 640px) {
  .main, .canvas, .widget { min-width: 0; }
  .widget img, .widget video, .widget iframe { max-width: 100%; }
  .whead h2, .tile-label, .brief-head h3, .mini-title { overflow-wrap: anywhere; }
}

/* =====================================================================
   Chapter 18: States and finish (empty / loading / error, field errors, focus rings, skip link)
   ui.js draws them: UI.empty() and UI.failed() (.es), UI.skeleton() (.skel), UI.invalid() (.is-invalid + .field-msg).
   One spacing scale (4 · 8 · 12 · 16 · 24), hairlines from --border, hover only where there is a mouse.
   ===================================================================== */
:root { --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; }
/* Empty and error states */
.empty.es { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); padding: 28px var(--sp-4); text-align: center; color: var(--text-3); }
.es-ic { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: var(--sp-2); border-radius: 14px; background: var(--surface-2); color: var(--text-3); }
.empty.es .es-ic .ic { width: 22px; height: 22px; margin: 0; opacity: 1; }
.es-title { margin: 0; color: var(--text); font-weight: 600; font-size: 14px; }
.es-text { margin: 0 auto; max-width: 42ch; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.empty.es .btn { margin-top: var(--sp-3); }
.empty.es.is-compact { padding: var(--sp-4) var(--sp-2); } .empty.es.is-compact .es-ic { width: 36px; height: 36px; border-radius: 11px; }
.empty.es.is-error .es-ic { background: var(--bad-soft); color: var(--bad); }
.empty.widget-error { color: var(--text-2); } .empty.widget-error > .ic { color: var(--bad); opacity: 1; }
.rec-col .empty.es, .dialog .empty.es { padding: var(--sp-4) var(--sp-2); }
/* Skeletons: the shape of what is coming */
.skel { display: flex; flex-direction: column; gap: var(--sp-3); padding: 2px 0; }
.skel i { display: block; flex: none; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skel-line { height: 11px; } .skel-line.skel-sub { height: 9px; margin-top: 6px; } .skel-line.skel-big { height: 22px; margin-top: 10px; } .skel-line.skel-head { height: 9px; opacity: .7; }
.skel .w-40 { width: 40%; } .skel .w-50 { width: 50%; } .skel .w-60 { width: 60%; } .skel .w-70 { width: 70%; } .skel .w-75 { width: 75%; } .skel .w-80 { width: 80%; } .skel .w-90 { width: 90%; } .skel .w-100 { width: 100%; }
.skel-row { display: flex; align-items: center; gap: var(--sp-3); } .skel-row > span { flex: 1; min-width: 0; }
.skel i.skel-dot { width: 28px; height: 28px; border-radius: 50%; }
.skel-trow { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-4); padding: 6px 0; border-top: 1px solid var(--border); }
.skel-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.skel-tile { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); min-height: 86px; }
.skel-board { display: flex; gap: var(--sp-3); overflow: hidden; }
.skel-col { flex: 1 0 200px; display: flex; flex-direction: column; gap: var(--sp-2); padding: 10px; border-radius: 12px; background: var(--surface-2); }
.skel-col i { background: linear-gradient(90deg, var(--surface-3) 25%, var(--border-strong) 50%, var(--surface-3) 75%); background-size: 200% 100%; }
.skel i.skel-card { height: 64px; border-radius: 10px; }
@media (max-width: 640px) { .skel-col:nth-child(n+2) { display: none; } }
/* Field errors (UI.invalid) */
input.is-invalid, select.is-invalid, textarea.is-invalid, .is-invalid > input, [aria-invalid="true"]:is(input, select, textarea) { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 6%, var(--surface-2)); }
input.is-invalid:focus, select.is-invalid:focus, textarea.is-invalid:focus { outline-color: var(--bad); }
fieldset.is-invalid, .is-invalid.cl-field, .is-invalid.ppl-field { border-radius: 10px; box-shadow: 0 0 0 1px var(--bad); padding: 6px 8px; }
.field-msg { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12.5px; font-weight: 500; color: var(--bad); }
.field-msg::before { content: "!"; display: inline-grid; place-items: center; width: 15px; height: 15px; flex: none; border-radius: 50%; background: var(--bad); color: var(--surface); font-size: 10.5px; font-weight: 700; }
/* Focus rings: one token-based ring for everything a keyboard can reach, in both themes */
:where(a, button, [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="treeitem"], summary, [tabindex]:not([tabindex="-1"])):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.table tbody tr[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; }
.table tbody tr[tabindex]:focus-visible td { background: var(--accent-soft); }
.mini-row:focus-visible, .dh-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.tile:focus-visible, .biz-card:focus-visible, .rec-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Skip link: the first Tab stop of the page jumps past the navigation */
.skip-link { position: fixed; z-index: 200; top: max(8px, env(safe-area-inset-top)); left: 8px; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; transform: translateY(-160%); transition: transform .15s var(--ease); }
.skip-link:focus, .skip-link:focus-visible { transform: none; outline: 2px solid var(--text); outline-offset: 2px; text-decoration: none; }
/* Hover looks only where there is a mouse (a phone keeps a tapped button looking normal) */
@media (hover: none) {
  .btn:not(.btn-primary):not(.btn-danger):not(.btn-ghost):not(.btn-danger-ghost):hover:not(:active) { background: var(--surface); border-color: var(--border); }
  .btn-ghost:hover:not(:active), .btn-danger-ghost:hover:not(:active) { background: transparent; border-color: transparent; } .btn-primary:hover:not(:active) { filter: none; }
  .icon-btn:not(.is-on):hover:not(:active) { background: transparent; color: var(--text-2); }
  .table tbody tr.clickable:hover td, .mini-row.clickable:hover, .tl-item:hover, .feed-item:hover { background: none; }
  .rec-item:hover { transform: none; box-shadow: var(--shadow); border-color: var(--border); }
}
/* Truncation: long names keep to one line where a row has no room (the full text is in the title attribute) */
.trunc { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Overview: trends and "Up next" */
.tile-trend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px; white-space: nowrap; margin-top: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-3); }
.tile-trend .ic { width: 13px; height: 13px; stroke-width: 2.4; }
.tile-trend.up { color: var(--good); } .tile-trend.down { color: var(--bad); } .tile-trend.is-cost.up { color: var(--bad); } .tile-trend.is-cost.down { color: var(--good); }
.tile-trend small { font-weight: 500; color: var(--text-3); }
.upnext { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.upnext li { display: flex; align-items: center; gap: var(--sp-3); min-height: 48px; padding: var(--sp-2) 2px; border-top: 1px solid var(--border); }
.upnext li:first-child { border-top: 0; }
.un-ic { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--surface-2); color: var(--text-2); } .un-ic .ic { width: 16px; height: 16px; }
.un-ic.bad { background: var(--bad-soft); color: var(--bad); } .un-ic.warn { background: var(--warn-soft); color: var(--warn); } .un-ic.info { background: var(--accent-soft); color: var(--accent); } .un-ic.good { background: var(--good-soft); color: var(--good); }
.un-main { flex: 1; min-width: 0; display: flex; flex-direction: column; } .un-main b { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .un-main small { font-size: 12px; color: var(--text-3); }
.un-when { flex: none; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); } .un-when.late { color: var(--bad); } .un-when.soon { color: var(--warn); }
.upnext .btn { flex: none; }
.un-count { flex: none; min-width: 28px; padding: 2px 9px; border-radius: 999px; text-align: center; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--text); }
.un-count.warn { background: var(--warn-soft); color: var(--warn); } .un-count.bad { background: var(--bad-soft); color: var(--bad); }
/* The records list: a menu button on each row and card (Move to…, Delete) */
.rec-more { opacity: 0; transition: opacity .12s var(--ease); }
tr:hover .rec-more, tr:focus-within .rec-more, .rec-item:hover .rec-more, .rec-item:focus-within .rec-more, .rec-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none), (pointer: coarse) { .rec-more { opacity: 1; } }
.rec-item .rec-more { position: absolute; top: 6px; right: 6px; z-index: 1; background: var(--surface); }
.rec-item:has(.rec-more) .rec-item-title, .rec-item:has(.rec-more) .rec-labels { padding-right: 26px; }
.table .act-cell .rec-more.icon-btn { opacity: 0; } .table tr:hover .act-cell .rec-more.icon-btn, .table tr:focus-within .act-cell .rec-more.icon-btn { opacity: 1; }
@media (hover: none), (pointer: coarse) { .table .act-cell .rec-more.icon-btn { opacity: 1; } }
.rec-item.is-pressing { transform: scale(.98); transition: transform .3s var(--ease); }
.rec-table .rec-title { font-weight: 600; } .rec-table td.c-main { min-width: 160px; }
@media (max-width: 640px) {
  .rec-table td.c-main { padding-right: 36px; position: relative; min-width: 0; }
  .rec-table tr { position: relative; } .table.cards.rec-table td.act-cell { position: absolute; top: 8px; right: 0; border: 0; margin: 0; padding: 0; } .table.cards.rec-table td.act-cell .icon-btn { border: 0; background: none; }
  .log-table td.log-what { order: -2; } .log-table td[data-l] { order: 0; }
}
/* The briefing: urgent rows, then "Up next" */
.brief .upnext { margin-top: var(--sp-3); }
.brief .upnext li { padding: var(--sp-2) 0; }
.brief-next { margin: var(--sp-4) 0 0; }
.brief .un-main > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .brief .un-main b.num { font-weight: 700; }
.upnext .un-main { flex: 1 1 0; } .upnext .un-when { white-space: nowrap; }
@media (max-width: 640px) { .brief .upnext li { gap: var(--sp-2); } .un-open-l { display: none; } .upnext .btn { padding: 0 8px; } .brief .un-main > span { white-space: normal; overflow-wrap: anywhere; } }
/* A deadline row (li.ob-task wraps, finance.css) on a phone: the title takes the first line beside its icon; when, "Mark as done" and the menu go
   to a second line under the title (with a basis of 0 they all fitted on line 1 and squeezed the title to a few pixels). */
@media (max-width: 640px) { .upnext li.ob-task > .un-main { flex: 1 1 calc(100% - 32px - var(--sp-2)); } .upnext li.ob-task > .un-when { margin-left: calc(32px + var(--sp-2)); margin-right: auto; } }
.tile-state { display: block; padding: 0; } .tile-state .empty.es { padding: 22px 16px; }
/* The 404 page (index.php) and the note without JavaScript */
.nf-card { text-align: left; } .nf-code { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.nf-title { font-size: 24px; letter-spacing: -.02em; margin: 0 0 8px; } .nf-lead { color: var(--text-2); margin: 0 0 20px; }
.boot-noscript { max-width: 520px; } .boot-noscript b { color: var(--text); }
.rec-item { -webkit-touch-callout: none; }

/* =====================================================================
   Chapter 16: Print (a page prints as a clean report: no navigation, no tools)
   ===================================================================== */
@media print {
  :root { color-scheme: light; --bg: #fff; --bg-side: #fff; --surface: #fff; --surface-2: #f4f5f7; --surface-3: #e8eaef; --border: #d9dce2; --border-strong: #c9ced7; --text: #111; --text-2: #333; --text-3: #666; --shadow: none; --shadow-pop: none; }
  .sidebar, .scrim, .topbar, .editbar, .viewonly, .ptabs, .wtools, .rec-filters, .toast, .menu, .wtools-edit, .wtools-pos, .pin-mark, .col-guides, .newrow-zone, .sb-fold { display: none !important; }
  .app-shell { display: block; } .main { padding: 0; } .pagehead, .canvas { padding: 0 0 12px; }
  .widget { break-inside: avoid; box-shadow: none; border-color: #d9dce2; }
  .wgrid, .wgrid.is-masonry { --wgap: 12px; gap: var(--wgap); grid-auto-rows: auto; margin-bottom: 0; } .wgrid.is-masonry > .widget { grid-column: span var(--n); grid-row: auto; min-height: 0; } a { color: inherit; text-decoration: none; }
}

/* =====================================================================
   Chapter 17b: The touch floor (October 2026 walkthrough)
   On a touch screen every control is at least 40px to look at and 44px to hit: buttons, icon buttons, the topbar, the close
   button of a dialog, form fields; the "?" is 28px with a 44px hit area; checkboxes and radios are 22px on a 44px row;
   interactive chips 36px with a 44px hit area. The hit area that is larger than the look is an invisible ::after.
   ===================================================================== */
@media (pointer: coarse) {
  .btn { min-height: 40px; height: auto; } .btn-sm { min-height: 40px; height: auto; }
  .btn::after, .link-btn::after, .crumb::after { left: 50%; right: auto; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
  .icon-btn, .icon-btn.xs, .rec-col header .icon-btn, .pick-edit, .pick-del, .pick-info { min-width: 40px; min-height: 40px; }
  .icon-btn::after { width: max(100%, 44px); height: max(100%, 44px); }
  .help { width: 28px; height: 28px; font-size: 13px; vertical-align: -3px; } .help::after { width: 44px; height: 44px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  .check, label.check { min-height: 44px; }
  :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select:not([multiple])) { min-height: 44px; }
  .topbar .btn, .topbar .icon-btn, .menu-btn { min-width: 44px; min-height: 44px; }
  .dialog-head [data-close], .pal-close { min-width: 44px; min-height: 44px; }
  .seg label { display: flex; } html .seg span { display: flex; align-items: center; min-height: 38px; } html .seg { padding: 2px; } /* the whole control is 44 px, as tall as the buttons beside it */
  :where(.chip, .pchip, .hc-bchip, button.tag, .asst-chip, .asst-depth-b, .sb-chip, .th-sort, .inv-link) { position: relative; }
  .chip, .pchip, .hc-bchip, button.tag, button.asst-chip, a.asst-chip, .asst-depth-b { min-height: 36px; }
  :is(.pchip, .hc-bchip, button.tag, button.asst-chip, a.asst-chip, .asst-depth-b, .th-sort, .toast-action)::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
  html summary, html details.inline-more > summary { position: relative; min-height: 44px; }
  html .hc-bchip, html .pchip, html .chip, html .ag-fchip, html .ch-tab, html .ib-tab { min-height: 36px; } /* every filter chip and tab: one height on touch (30 px with a mouse) */
  html .rec-add { min-height: 44px; }
  .th-sort { min-height: 40px; }
  .toast .toast-action { min-height: 44px; position: relative; }
  a.btn, .tab-arrow { min-height: 40px; }
}
/* "Just added" / "just saved": a soft ring that fades (UI.flash) */
.is-flash { animation: tl-flash 2s var(--ease) 1; }
@keyframes tl-flash { 0%, 55% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }
tr.is-flash td { animation: tl-flash-row 2s var(--ease) 1; }
@keyframes tl-flash-row { 0%, 55% { background: var(--accent-soft); } 100% { background: transparent; } }
/* The toast keeps clear of a bar of buttons at the bottom of the screen (a dialog's sticky actions on a phone, the Customize bar): --toast-lift is measured in dashboard-boot.js */
.toast { margin-bottom: var(--toast-lift, 0px); }
/* A phone on its side: the drawer's foot (mail, account) stays in view, in two columns */
@media (max-width: 860px) and (max-height: 500px) {
  .sidebar .sb-foot { position: sticky; bottom: calc(-1 * max(12px, env(safe-area-inset-bottom))); z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 6px; margin-top: auto; padding: 6px 0 max(8px, env(safe-area-inset-bottom)); background: var(--bg-side); }
  .sidebar .sb-foot .sb-mail { margin: 0; }
  .sidebar .sb-foot .me { min-height: 44px; padding: 4px 6px; }
  .sidebar .sb-foot .me-text span { display: none; }
  .sidebar .sb-foot > :only-child { grid-column: 1 / -1; }
  .sidebar { gap: 6px; }
}

/* Invoice design picker (Settings of a business, w-brand.js designPicker): one card per design with a real PDF preview */
.inv-designs { margin-top: 14px; }
.idz-logo { display: flex; align-items: center; gap: 6px; margin: 6px 0 12px; } .idz-logo .check { margin: 0; }
.idz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.idz-card { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; background: var(--surface, transparent); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.idz-card:hover { border-color: var(--accent); }
.idz-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.idz-card.is-sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.idz-card[aria-disabled="true"] { cursor: default; } .idz-card[aria-disabled="true"]:hover { border-color: var(--border-strong); } .idz-card[aria-disabled="true"].is-sel:hover { border-color: var(--accent); }
.idz-page { position: relative; aspect-ratio: 1 / 1.4142; border-radius: 6px; overflow: hidden; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; }
.idz-page iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; background: #fff; }
.idz-wait { color: #6b7280; padding: 8px; text-align: center; }
.idz-name { font-size: 13px; margin-top: 4px; } .idz-desc { line-height: 1.35; }
.idz-card.is-sel .idz-name::after { content: " ✓"; color: var(--accent); }
/* The selected design, large: above the cards, centred and no taller than the window; when the picker is wide enough (w-brand.js sets
   .is-split from a ResizeObserver; no container query, as rows rebuilt inside a size container may get no layout box in Chrome) the cards
   take the left column and the large view the whole right column, sticky under the top bar while the cards scroll. */
.idz-wrap { display: flex; flex-direction: column; gap: 16px; }
.idz-big { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.idz-big-page { width: min(100%, calc((100vh - 170px) / 1.4142)); min-width: min(100%, 260px); border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.idz-big-page iframe { inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); } /* crops the PDF viewer's dark margin around the page */
.idz-big-cap { max-width: 100%; text-align: center; line-height: 1.4; } .idz-big-cap .idz-name { font-size: 14px; } .idz-big-cap .idz-desc { display: block; }
.idz-wrap.is-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; gap: 20px; }
.idz-wrap.is-split .idz-grid { grid-column: 1; grid-row: 1; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.idz-wrap.is-split .idz-big { grid-column: 2; grid-row: 1; position: sticky; top: 72px; }
@media (max-width: 560px) { .idz-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .idz-card { padding: 6px; } } /* a phone: two small cards a row under the large view */

/* Unsaved changes on a settings page (UI.dirtyGuard): one bar at the bottom that saves every changed form of the page. */
.dirty-bar { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; width: min(560px, calc(100vw - 32px)); padding: 10px 12px 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 30px rgba(0, 0, 0, .28); }
.dirty-bar-msg { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; }
.dirty-bar-msg .ic { color: var(--warn); flex: none; }
.dirty-bar .spacer { flex: 1; }
@media (max-width: 480px) { .dirty-bar { flex-wrap: wrap; } .dirty-bar .spacer { display: none; } .dirty-bar-msg { flex: 1 1 100%; } }

/* =====================================================================
   Chapter 11: Native feel (phones and touch screens). Later rules win over the ones above.
   Tab bar (shell.js renderTabbar), offline bar, loading shell (.app-skel*), overscroll, selection, press states.
   ===================================================================== */
/* Rubber-band and horizontal drift: a pull at the top does not move the page (no reload gesture), a sheet's scroll stays in the sheet */
@media (max-width: 860px), (pointer: coarse) {
  html, body { overscroll-behavior-y: none; }
  body { overflow-x: clip; }
  .table-wrap, .rec-board, .ptabs, .asst-thread, .asst-hist, .code-block, .sb-tree, .pal-list, .menu, .popover, .dialog-body, .sidebar { overscroll-behavior-x: contain; }
  .dialog-body, .menu, .popover, .pal-list, .sidebar { overscroll-behavior-y: contain; }
}
/* Inputs: 16px or more on a phone or a touch screen (iOS zooms into anything smaller). Desktop keeps its density. */
@media (max-width: 860px), (pointer: coarse) {
  select[multiple], .asst-scope select, .asst-form textarea, .asst-set-sec textarea { font-size: 16px; }
}
/* Chrome is not copied from: the navigation, menus, tabs and buttons. Text, fields, code and table cells stay selectable. */
.sidebar, .topbar, .tabbar, .menu, .ptab, .btn, .icon-btn, .chip, .crumb, .sb-item, .sb-page, .sb-leaf, .sb-label, .sb-search, .me, .menu-item, .tbar, .pal-item, .size, .tab-arrow, .pin-mark, .help, .seg span, .sb-foot, .wtools-edit, .wtools-pos, .editbar, .dialog-actions { -webkit-user-select: none; user-select: none; }
@media (pointer: coarse), (max-width: 860px) {
  .sidebar, .topbar, .tabbar, .menu, .ptab, .btn, .icon-btn, .chip, .crumb, .sb-item, .sb-page, .sb-leaf, .sb-label, .sb-search, .me, .menu-item, .tbar, .pal-item, .size, .tab-arrow, .pin-mark, .help, .rec-item, .rec-card, .tile, .biz-card { -webkit-touch-callout: none; }
  .rec-item, .rec-card { -webkit-user-select: none; user-select: none; } /* a press and hold opens the item's menu (w-records.js): it must not select the words too */
}
/* Pressed states for touch: a tap shows at once, and the hover that sticks after a tap never does */
@media (pointer: coarse) {
  .sb-item:active, .sb-page:active, .sb-leaf:active, .ptab:active, .crumb:active, .me:active, .menu-item:active, .chip:active, .icon-btn:active, .btn:active { background: var(--surface-2); }
  .tile:active, .biz-card:active, .rec-card:active, .rec-item:active { transform: scale(.985); transition: transform .12s var(--ease); }
  .btn:active { transform: scale(.97); }
}

/* Tab bar: the four main pages of the open business and the business switcher (shell.js; app-mobile.css). Phones and touch screens up to 860px; hidden while the keyboard, a sheet, a dialog, the drawer or the customizing bar is on screen. */
.tabbar { display: none; }
@media (max-width: 640px), (max-width: 860px) and (pointer: coarse) {
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 2px; align-items: stretch; padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
  .tbar { position: relative; flex: 1 1 0; min-width: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 2px; border: 0; border-radius: 12px; background: none; color: var(--text-3); font: inherit; font-size: 11px; font-weight: 550; cursor: pointer; transition: transform .12s var(--ease), color .15s var(--ease); }
  .tbar:active { transform: scale(.93); }
  .tbar-ic { width: 22px; height: 22px; flex: none; }
  .tbar-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; text-align: center; line-height: 1.15; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; } /* two lines, so "Nastavitve družbe" is not cut */
  .tbar.is-active { color: var(--text); }
  .tbar.is-active .tbar-ic { color: var(--accent); }
  .tbar.is-active::before { content: ""; position: absolute; top: -7px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--biz, var(--accent)); }
  .tbar-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; }
  .main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .toast, .dirty-bar { bottom: calc(84px + env(safe-area-inset-bottom) + var(--kb, 0px)); }
  .kb-open .tabbar, #app.is-editing .tabbar, #app.drawer-open .tabbar, body:has(dialog[open]) .tabbar, body:has(.menu.is-sheet) .tabbar { display: none; }
}

/* Offline: a slim bar under the top bar (shell.js); it does not block the page */
.offline-bar { display: flex; align-items: center; gap: 8px; padding: 7px 32px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 550; border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.offline-bar .ic { width: 15px; height: 15px; flex: none; }
@media (max-width: 860px) { .offline-bar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); } }

/* Page change: a short fade and slide of the canvas where the View Transitions API is missing (shell.js go()) */
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
.canvas.is-entering { animation: page-in .18s var(--ease) both; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

/* Loading shell: the first paint, before the scripts draw the app (templates/dash-app.php uses these classes). buildFrame() replaces the whole #app, so the shell goes when the real UI mounts. */
.app-skel { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.app-skel-side, .app-skel-top, .app-skel-card { background-color: var(--surface-2); background-image: linear-gradient(90deg, transparent 0%, var(--surface-3) 50%, transparent 100%); background-size: 200% 100%; background-repeat: no-repeat; animation: shimmer 1.4s linear infinite; }
.app-skel-side { min-height: 100dvh; background-color: var(--bg-side); border-right: 1px solid var(--border); opacity: .7; }
.app-skel-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 0 32px 32px; }
.app-skel-top { height: 56px; margin: 0 -32px; background-color: var(--bg); border-bottom: 1px solid var(--border); }
.app-skel-card { min-height: 140px; border: 1px solid var(--border); border-radius: var(--radius); background-color: var(--surface); }
@media (max-width: 860px) { .app-skel { grid-template-columns: minmax(0, 1fr); } .app-skel-side { display: none; } .app-skel-main { padding: 0 14px 24px; } .app-skel-top { margin: 0 -14px; } }

/* Activity log: sentences grouped by day (w-overview.js, the "auditlog" widget) */
.act-bar { align-items: center; } .act-bar input[type=search] { flex: 1 1 220px; min-width: 0; } .act-bar select { flex: 0 1 190px; min-width: 0; }
.act-days { display: flex; flex-direction: column; gap: 14px; }
.act-day-h { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.act-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.act-item { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.act-time { padding-top: 2px; color: var(--text-2); }
.act-main { min-width: 0; }
.act-sentence { margin: 0; line-height: 1.45; overflow-wrap: anywhere; } .act-sentence q { quotes: "“" "”"; font-weight: 500; }
.act-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 4px 0 0; }
.act-open { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; } .act-go { width: 12px; height: 12px; }
.act-det { margin-top: 4px; } .act-det summary { cursor: pointer; color: var(--text-2); }
.act-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 6px 0 0; font-size: 12.5px; } .act-dl dt { color: var(--text-2); } .act-dl dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .act-item { grid-template-columns: 44px minmax(0, 1fr); gap: 8px; } .act-bar select { flex: 1 1 calc(50% - 5px); } }

/* The gear on the right of a business's name opens its Settings (logo, colours, contact, pages) */
.sb-row { position: relative; display: flex; flex-direction: column; }
.sb-row.has-gear .sb-item { padding-right: 36px; }
.sb-gear { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: var(--text-3); opacity: .55; transition: opacity .12s, background .12s, color .12s; }
.sb-gear .ic { width: 15px; height: 15px; }
.sb-gear:hover, .sb-gear:focus-visible, .sb-gear.is-active, .sb-row:hover .sb-gear { opacity: 1; }
.sb-gear:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.sb-gear.is-active { color: var(--accent); background: var(--accent-soft); }
@media (min-width: 861px) { .is-rail .sb-gear { display: none; } } /* the phone drawer is never a rail: its gears stay */
@media (hover: none) { .sb-gear { opacity: 1; width: 34px; height: 34px; } }

/* The icon library of the page icon picker */
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; max-height: 50vh; overflow: auto; padding: 2px; }
.icon-pick-btn { display: grid; place-items: center; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-pick-btn .ic { width: 20px; height: 20px; }
.icon-pick-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-pick-btn.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sb-row .sb-all { width: 100%; }

/* =====================================================================
   Chapter 19: The three icons on the right of the top bar and the Mail block of the sidebar
   Assistant, Customize, Search: the same size and spacing; Search is the strongest (darker ink, heavier stroke, a soft chip)
   because it is used most, the other two stay quiet. The pressed Customize icon (customizing) and the open assistant are lit.
   ===================================================================== */
.top-icons { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.topbar .top-ic { width: 36px; height: 36px; color: var(--text-2); }
.topbar .top-ic .ic { width: 19px; height: 19px; }
.topbar .top-ic.top-search { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.topbar .top-ic.top-search .ic { stroke-width: 2.4; }
.topbar .top-ic[aria-pressed="true"], .topbar .top-ic[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
@media (hover: hover) { .topbar .top-ic.top-search:hover { background: var(--surface-3); color: var(--text); } .topbar .top-ic[aria-pressed="true"]:hover { background: var(--accent-soft); color: var(--accent); } }
@media (pointer: coarse) { .topbar .top-ic { width: 44px; height: 44px; } }
/* The breadcrumb gives way first at narrow widths: it shrinks and truncates, the icons keep their size */
.topbar .crumbs { flex: 0 1 auto; overflow: hidden; } .topbar .crumb-page { min-width: 0; } .topbar .crumb-page b { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .top-icons { gap: 0; } .topbar .crumb-biz { max-width: 38vw; } .topbar .top-ic { width: 40px; min-width: 40px; } } /* 40 px wide (44 tall): the page name gets the room */

/* Mail at the bottom of the sidebar: "Mail" with the unread total, then the starred mailboxes with their own counts */
.sb-mail { display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px; }
.sb-mrow { display: flex; align-items: center; gap: 9px; min-height: 32px; padding: 4px 8px; border-radius: 9px; color: var(--text-2); font-size: 13px; font-weight: 500; position: relative; transition: background .12s var(--ease), color .12s var(--ease); }
.sb-mrow .sb-pic { width: 16px; height: 16px; }
@media (hover: hover) { .sb-mrow:hover { background: var(--surface-2); color: var(--text); text-decoration: none; } }
.sb-mrow.is-active { background: var(--surface-3); color: var(--text); } .sb-mrow.is-active .sb-pic { color: var(--accent); }
.sb-mrow .badge { margin-left: 0; flex: none; }
.sb-mboxes { display: flex; flex-direction: column; gap: 1px; margin: 0 0 0 16px; padding-left: 7px; border-left: 1px solid var(--border); }
.sb-mbox { min-height: 28px; padding: 3px 8px; font-size: 12.5px; color: var(--text-3); }
.sb-mbox .sb-pic { width: 14px; height: 14px; }
.sb-mlock { display: inline-flex; color: var(--text-3); flex: none; } .sb-mlock .ic { width: 12px; height: 12px; }
/* The rail: only the Mail icon, its count as a small badge on the corner */
.is-rail .sb-mboxes, .is-rail .sb-mlock { display: none; }
.is-rail .sb-mrow { justify-content: center; padding: 6px 0; min-height: 34px; }
.is-rail .sb-mrow .sb-pic { width: 18px; height: 18px; }
.is-rail .sb-mail-all .badge { position: absolute; top: 1px; left: calc(50% + 3px); min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; }
@media (max-width: 860px) {
  .is-rail .sb-mboxes { display: flex; } .is-rail .sb-mlock { display: inline-flex; }
  .is-rail .sb-mrow { justify-content: flex-start; padding: 4px 8px; } .is-rail .sb-mail-all .badge { position: static; }
}
@media (pointer: coarse) { .sb-mrow { min-height: 44px; } .sb-mbox { min-height: 40px; } }
/* A phone on its side: the drawer's foot is two columns (Mail | account) */
@media (max-width: 860px) and (max-height: 500px) { .sidebar .sb-foot .sb-mail { margin: 0; } .sidebar .sb-foot .sb-mboxes { display: none; } }
/* (The phone's More tab and its mail dot are gone: on a phone the mail icon of the top bar carries the count, app-mobile.css.) */
/* The phone drawer keeps its foot in view (sticky): many starred mailboxes scroll inside the block instead of pushing the account row away */
@media (max-width: 860px) { .sb-mboxes { max-height: 30vh; overflow-y: auto; overscroll-behavior: contain; } }

/* =====================================================================
   Chapter 20: Desktop finish (November 2026 polish round)
   Every page uses the full width the window gives it (owner, 17 Nov 2026: no centred column any more); only the outer gutter
   changes with the screen. Prose and single-column forms keep their own line length inside the full-width card. Desktop and
   tablet only; phones keep Chapters 10 and 17 and app-mobile.css Chapter 11.
   ===================================================================== */
@media (min-width: 861px) {
  .main { --gut: 32px; }
  .topbar, .pagehead, .canvas, .offline-bar { padding-left: var(--gut); padding-right: max(var(--gut), env(safe-area-inset-right)); }
  .viewonly, .editbar { margin-left: var(--gut); margin-right: var(--gut); }
}
@media (min-width: 1920px) { .main { --gut: 40px; } }
/* Small laptops and tablets in landscape: a slightly narrower sidebar gives the page the room */
@media (min-width: 861px) and (max-width: 1180px) { .app-shell:not(.is-rail) { --sb-w: 240px; } }
/* The top bar gets its hairline only once the page scrolls under it (scroll-driven, where the browser supports it) */
@supports (animation-timeline: scroll()) {
  @media (min-width: 861px) { .topbar { animation: topbar-edge linear both; animation-timeline: scroll(root); animation-range: 0 32px; } }
  @keyframes topbar-edge { from { box-shadow: 0 1px 0 transparent; } to { box-shadow: 0 1px 0 var(--border); } }
}

/* =====================================================================
   Chapter 21: Search everything, Help, Customize details (shell-ux round, 15 Nov 2026)
   The palette (shell.js Chapter 6): two-line results (name, then business dot · what it is · date), the amount and a status chip on the
   right, matches marked, group headings with a count, shimmer rows while the server looks, a quiet spinner in the field, an empty state.
   Help & shortcuts (Chapter 6b): search, three tabs, how-tos with "Take me there". Customize: the "+ Page" button stays visible at the end
   of the page strip, the width buttons draw the width they give.
   ===================================================================== */
.pal-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pal-text .pal-label { flex: none; }
.pal-sub { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.pal-sub > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.pal-sub .dot { width: 7px; height: 7px; } .pal-sep { opacity: .6; }
.pal-item mark { background: none; color: inherit; font-weight: 650; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.pal-amt { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.pal-item .tag { font-size: 11px; padding: 0 7px; }
.pal-keys { display: inline-flex; gap: 3px; } .pal-keys kbd { font-size: 11px; min-width: 18px; text-align: center; }
.pal-item.is-sel .pal-keys { display: none; } .pal-keys + .pal-hint { margin-left: -4px; }
.pal-group { display: flex; align-items: center; gap: 8px; }
.pal-count { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-3); background: var(--surface-2); border-radius: 999px; padding: 0 7px; font-size: 11px; line-height: 1.6; }
.pal-create .pal-ic, .pal-ask .pal-ic { color: var(--accent); }
.pal-empty { display: flex; align-items: center; justify-content: center; gap: 8px; } .pal-empty .ic { width: 16px; height: 16px; }
.pal-shimmer { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; }
.pal-shimmer i, .pal-shimmer span { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.pal-shimmer i { width: 16px; height: 16px; border-radius: 5px; flex: none; } .pal-shimmer span { width: 46%; }
.pal-shimmer + .pal-shimmer span { width: 34%; } .pal-shimmer + .pal-shimmer + .pal-shimmer span { width: 52%; }
.pal-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); flex: none; opacity: 0; transition: opacity var(--dur) var(--ease); }
.palette.is-loading .pal-spin { opacity: 1; animation: pal-spin .8s linear infinite; }
@keyframes pal-spin { to { transform: rotate(360deg); } }
.pal-foot { flex-wrap: wrap; } .pal-foot-tip { margin-left: auto; }
@media (prefers-reduced-motion: reduce) { .pal-shimmer i, .pal-shimmer span, .palette.is-loading .pal-spin { animation: none; } }

/* Help & shortcuts */
.help-panel { display: flex; flex-direction: column; gap: 14px; }
.help-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; position: sticky; top: -1px; z-index: 1; background: var(--surface); padding: 2px 0 8px; }
.help-search { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--field-border, var(--border)); border-radius: var(--radius-sm); background: var(--field-bg, var(--surface-2)); color: var(--text-3); }
.help-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.help-search input { border: 0; background: none; min-height: 38px; padding: 0; box-shadow: none; } .help-search input:focus { outline: none; box-shadow: none; }
.help-tabs { margin: 0; } .help-tabs button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-2); padding: 5px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.help-tabs button.is-on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.help-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.howto, .whatsnew { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.howto-item { display: flex; align-items: center; gap: 16px; padding: 12px 2px; border-bottom: 1px solid var(--border); }
.howto-item:last-child, .whatsnew li:last-child { border-bottom: 0; }
.howto-text { flex: 1; min-width: 0; } .howto-text b, .whatsnew b { display: block; font-weight: 600; }
.howto-text p, .whatsnew p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.howto-item .btn { flex: none; } .howto-item .btn .ic { width: 14px; height: 14px; margin: 0 -2px 0 2px; }
.whatsnew li { padding: 12px 2px; border-bottom: 1px solid var(--border); }
.help-pane .keys { margin: 0; }
.help-none { text-align: center; padding: 12px 0; margin: 0; }
.help-support { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); text-decoration: none; }
.help-support > span { flex: 1; display: flex; flex-direction: column; } .help-support .small { color: var(--text-3); }
@media (hover: hover) { .help-support:hover { background: var(--surface-2); } }
.help-about { margin: 14px 0 0; color: var(--text-3); text-align: center; }
@media (max-width: 640px) { .howto-item { flex-direction: column; align-items: stretch; gap: 8px; } .help-tabs { width: 100%; } .help-tabs button { flex: 1; padding: 6px 4px; } }

/* Customize: "+ Page" stays at the end of the strip (the tabs scroll under it); the width buttons show the width they give */
.ptabs .add-tab { flex: none; position: sticky; right: 0; z-index: 1; margin-left: auto; padding-left: 18px; background: linear-gradient(90deg, transparent, var(--bg) 14px); border-radius: 0; }
@media (hover: hover) { .ptabs .add-tab:hover { background: linear-gradient(90deg, transparent, var(--bg) 14px); color: var(--text); } }
.size { display: inline-grid; place-items: center; width: 28px; }
.sz { position: relative; display: block; width: 16px; height: 10px; border-radius: 2.5px; border: 1.5px solid currentColor; opacity: .75; }
.sz i { position: absolute; left: 1px; top: 1px; bottom: 1px; width: calc((100% - 2px) / 3); border-radius: 1px; background: currentColor; }
.sz[data-w="4"] i { width: calc((100% - 2px) * 2 / 3); } .sz[data-w="6"] i { width: calc(100% - 2px); }
.size.is-on .sz { opacity: 1; }
@media (hover: hover) { .size:not(.is-on):hover { color: var(--text); background: var(--surface-3); } }
.size:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Wide tables in dark mode: the painted cover of the scroll fade (--wrap-bg) does not match every card it sits on, which left a dark band at
   the left edge. In dark mode the edges fade with a mask instead (no colour to match), driven by the table's own sideways scroll where the
   browser has scroll timelines; elsewhere a dark table simply has no fade. Light mode keeps the painted fade (it matches its white cards). */
@property --tw-l { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --tw-r { syntax: "<length>"; inherits: false; initial-value: 0px; }
:root:not([data-theme="light"]) .table-wrap { background: none; }
@supports (animation-timeline: scroll()) {
  :root:not([data-theme="light"]) .table-wrap { -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--tw-l), #000 calc(100% - var(--tw-r)), transparent); mask-image: linear-gradient(to right, transparent, #000 var(--tw-l), #000 calc(100% - var(--tw-r)), transparent); animation: tw-edges linear both; animation-timeline: scroll(self inline); }
  @keyframes tw-edges { 0% { --tw-l: 0px; --tw-r: 28px; } 6% { --tw-l: 28px; } 94% { --tw-r: 28px; } 100% { --tw-l: 28px; --tw-r: 0px; } }
}
/* A chip never makes its row wider than the screen (a long status on a 360px phone): it shortens with an ellipsis instead. */
.tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* Customize: every widget's toolbars are quieter until the widget is pointed at or focused, so the page reads as the page and the tools of
   the one widget in hand stand out (pointer screens only; touch keeps them fully visible). */
@media (hover: hover) and (pointer: fine) {
  .wgrid.is-editing .widget .wtools-edit, .wgrid.is-editing .widget .wtools-pos { opacity: .5; transition: opacity var(--dur) var(--ease); }
  .wgrid.is-editing .widget:hover .wtools-edit, .wgrid.is-editing .widget:hover .wtools-pos, .wgrid.is-editing .widget:focus-within .wtools-edit, .wgrid.is-editing .widget:focus-within .wtools-pos, .wgrid.is-editing .widget.dragging .wtools-edit { opacity: 1; }
}
.sz { width: 20px; height: 11px; }
/* The palette on a phone: no hint or key column (there is no keyboard), and a long name may take two lines instead of being cut short */
@media (max-width: 640px) {
  .pal-hint, .pal-keys { display: none; }
  .pal-text .pal-label { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .pal-amt { font-size: 12px; }
}

/* =====================================================================
   Chapter 22: A page that does not exist (any more) (shell.js renderMissing, 16 Nov 2026): the calm empty state, a solid frame (nothing to
   drop here), the heading split evenly on a phone, the one way on below the text.
   ===================================================================== */
.blank-missing { border-style: solid; border-color: var(--border); }
.blank-missing h2, .blank-missing p { text-wrap: balance; max-width: 46ch; margin-left: auto; margin-right: auto; }
.blank-missing .btn { margin-top: 14px; }
