:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #14181f; --muted: #5b6574; --line: #dde1e7;
  --accent: #1f5fbf; --accent-ink: #ffffff; --ok: #1d7a46; --warn: #a15c00; --bad: #b42318;
  --ok-bg: #e7f5ec; --warn-bg: #fff4e0; --bad-bg: #fdecea; --chip: #eef1f5; --bar: #1f5fbf; --bar2: #9db7e3;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
:root[data-theme="dark"] {
    --bg: #0f1216; --panel: #171b21; --ink: #e6e9ee; --muted: #9aa4b2; --line: #2a313b;
    --accent: #6ea2f2; --accent-ink: #0b1220; --ok: #5cc98a; --warn: #f0b34a; --bad: #ff7b6e;
    --ok-bg: #123222; --warn-bg: #352710; --bad-bg: #3a1714; --chip: #222831; --bar: #6ea2f2; --bar2: #33507d;
  }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, "Segoe UI", sans-serif; }
a { color: var(--accent); }
.sandbox { background: var(--bad); color: #fff; padding: 6px 16px; font-weight: 600; font-size: 13px; }
.top { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 17px; }
.brand span { font-weight: 500; color: var(--muted); font-size: 13px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 6px; }
nav a.on { background: var(--chip); color: var(--ink); font-weight: 600; }
.who { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; outline: none; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
input, select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; min-width: 0; }
input[type=number] { width: 90px; }
button { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.comp td:first-child { padding-left: 22px; }
.k { font-family: var(--mono); font-size: 13px; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--chip); font-size: 12px; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.note { border-left: 3px solid var(--warn); background: var(--warn-bg); padding: 8px 12px; border-radius: 4px; font-size: 13px; margin: 8px 0; }
.note.bad { border-color: var(--bad); background: var(--bad-bg); }
.note.ok { border-color: var(--ok); background: var(--ok-bg); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); }
.tabs button.on { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.locked { color: var(--muted); font-style: italic; }
.users { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.users button { text-align: left; padding: 10px 12px; }
.users button small { display: block; color: var(--muted); }
svg text { fill: var(--muted); font-size: 11px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 8px 14px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin: 4px 0; }
/* ---------------------------------------------------------------- Sales Rep Dashboard */
:root { --grp-bg: #dff0e3; --grp-ink: #14532d; --st-closed: #b42318; --st-quote: #1f5fbf; --owed-due: #b42318; --owed-paid: #1d7a46; }
:root[data-theme="dark"] { --grp-bg: #16341f; --grp-ink: #a7e3b8; --st-closed: #ff7b6e; --st-quote: #8bb8ff; --owed-due: #ff7b6e; --owed-paid: #5cc98a; }
main.wide { max-width: none; }
.sd { display: grid; gap: 10px; min-width: 0; }
.sd-title { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.sd-title h1 { margin: 0; }
.sd-menu { display: flex; gap: 4px; align-items: flex-start; position: relative; }
.sd-menu summary, .sd-menulink { cursor: pointer; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--ink); text-decoration: none; font-size: 14px; list-style: none; }
.sd-menulink.off { color: var(--muted); cursor: default; }
.sd-reports ul { list-style: none; margin: 4px 0 0; padding: 6px; position: absolute; z-index: 5; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15); min-width: 220px; }
.sd-reports ul button { width: 100%; text-align: left; border: 0; }
.sd-reports p { position: absolute; top: 330px; z-index: 5; display: none; }
.sd-top, .sd-under { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: end; }
.sd-spacer { flex: 1; }
.sd-caption { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  border-bottom: 2px solid var(--line); padding-bottom: 4px; }
.sd-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sd-dirty { font-size: 12px; color: var(--warn); background: var(--warn-bg); padding: 2px 8px; border-radius: 99px; }
.sd-gridwrap { position: relative; min-width: 0; min-height: 320px; }
.sd-scroll { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.sd-table { table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.sd-table th { position: sticky; top: 0; z-index: 2; background: var(--chip); color: var(--ink); text-transform: none;
  letter-spacing: 0; font-size: 12px; cursor: pointer; user-select: none; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; border-right: 1px solid var(--line); padding: 6px 14px 6px 6px; }
.sd-table th:hover { background: var(--line); }
.sd-table th .arrow { margin-left: 4px; font-size: 10px; color: var(--accent); }
.sd-table th .rz { position: absolute; right: 0; top: 0; bottom: 0; width: 7px; cursor: col-resize; }
.sd-table th .rz:hover { background: var(--accent); opacity: .5; }
.sd-table td { padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line); }
.sd-table tr.grand td { font-weight: 700; background: var(--panel); border-bottom: 2px solid var(--ink); }
.sd-table tr.grp td { background: var(--grp-bg); color: var(--grp-ink); font-weight: 600; }
.sd-table tr.grp.lv1 td.lead { padding-left: 22px; }
.sd-table tr.data.d1 td:first-child { padding-left: 18px; }
.sd-table tr.data.d2 td:first-child { padding-left: 34px; }
.sd-table td.lead { overflow: visible; }
.sd-table .cnt { font-weight: 500; }
.sd-table button.tg { width: 20px; height: 20px; padding: 0; margin-right: 6px; line-height: 1; font-weight: 700; }
.st-closed { color: var(--st-closed); font-weight: 600; }
.st-quote { color: var(--st-quote); font-weight: 600; }
.owed-due { color: var(--owed-due); font-weight: 600; }
.owed-paid { color: var(--owed-paid); }
.sd-empty { padding: 30px 16px; color: var(--muted); text-align: center; }
.sd-count { font-weight: 600; }
.sd-bottom { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.sd-bottom fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: flex; flex-wrap: wrap;
  gap: 4px 12px; align-items: center; margin: 0; }
.sd-bottom legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
label.ck { display: inline-flex; gap: 5px; align-items: center; color: var(--ink); font-size: 13px; }
.sd-okprint { display: flex; gap: 6px; align-items: end; margin-left: auto; }
.sd-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); align-items: center; }
.sd-legend .lg { display: inline-flex; gap: 5px; align-items: center; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.sw.status-closed { background: var(--st-closed); } .sw.status-quote { background: var(--st-quote); }
.sw.owed-due { background: var(--owed-due); } .sw.owed-paid { background: var(--owed-paid); }
.sw.group { background: var(--grp-bg); border: 1px solid var(--grp-ink); }
.sd-small { font-size: 12px; color: var(--muted); margin: 2px 0; }
.sd-chart { position: absolute; top: 0; right: 0; width: min(600px, 100%); max-height: 100%; overflow: auto; z-index: 4;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: 0 8px 28px rgba(0,0,0,.2); }
.ch-head { display: flex; justify-content: space-between; align-items: center; }
.ch-radios { display: flex; gap: 12px; margin: 6px 0; }
.ch-body { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.ch-table { width: auto; font-size: 12px; }
.ch-table td { padding: 2px 6px; }
dialog.sd-picker { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink);
  width: min(620px, calc(100% - 32px)); padding: 16px; }
dialog.sd-picker::backdrop { background: rgba(0,0,0,.35); }
.pk-body { display: grid; grid-template-columns: 1fr 180px; gap: 12px; }
@media (max-width: 560px) { .pk-body { grid-template-columns: 1fr; } }
.pk-list { border: 1px solid var(--line); border-radius: 6px; max-height: 50vh; overflow: auto; }
.pk-head, .pk-row { display: grid; grid-template-columns: 1fr 64px; align-items: center; padding: 3px 8px; font-size: 13px; }
.pk-head { position: sticky; top: 0; background: var(--chip); font-weight: 600; font-size: 12px; }
.pk-row { cursor: pointer; } .pk-row.on { background: var(--accent); color: var(--accent-ink); }
.pk-row input { justify-self: center; }
.pk-btns { display: grid; gap: 6px; align-content: start; }
.pk-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
table.sortable th button.thsort { all: unset; cursor: pointer; font: inherit; color: inherit; text-transform: inherit; }
table.sortable th button.thsort:hover, table.sortable th button.thsort:focus-visible { color: var(--accent); text-decoration: underline; }
.catlist { overflow: visible; }
@media (max-width: 900px) { .catlist { overflow-x: auto; } }
.catsearch { position: sticky; top: 0; z-index: 3; box-shadow: 0 4px 10px -6px rgba(0,0,0,.25); }
.catlist table.sortable thead th { position: sticky; top: var(--catsearch-h, 0px); background: var(--panel); z-index: 2; }
/* ---------------------------------------------------------------- Counter System */
:root { --cs-open: #cdebd5; --cs-res: #fff1b8; --cs-owed: #d8f0dc; --cs-fee: #e6e8ec; --cs-sel: #dbe7fb; }
:root[data-theme="dark"] { --cs-open: #1d4a2c; --cs-res: #4a3f10; --cs-owed: #1d3f26; --cs-fee: #2a2f37; --cs-sel: #1f3355; }
.cs { display: grid; gap: 12px; min-width: 0; }
.cs > * { min-width: 0; }
.cs-menubar { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 4px; position: relative; }
.cs-mi { padding: 3px 10px; font-size: 14px; cursor: pointer; list-style: none; }
.cs-mi.off { color: var(--muted); cursor: default; }
.cp-tools ul { position: absolute; z-index: 6; list-style: none; margin: 2px 0 0; padding: 6px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15); min-width: 240px; }
.cp-tools ul button { width: 100%; text-align: left; border: 0; }
.cp-tools ul a.cs-mi { display: block; padding: 4px 8px; color: var(--ink); text-decoration: none; }
.cp-tools ul a.cs-mi:hover { background: var(--chip); }
.cs-main, .cs-chooser { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px 16px; margin: 0; }
.cs-main legend, .cs-chooser legend { font-weight: 600; padding: 0 6px; }
.cs-quit { text-align: center; margin-bottom: 10px; }
.cs-quit .x { color: var(--bad); }
.cs-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 900px) { .cs-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) { .cs-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cs-tile { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 4px;
  min-height: 72px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--chip);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
a.cs-tile:hover, a.cs-tile:focus-visible { border-color: var(--accent); background: var(--panel); }
.cs-tile.off { color: var(--muted); background: var(--panel); font-weight: 500; }
.cs-tile small { font-weight: 400; font-size: 11px; }
.cs-enter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.cs-enter label { display: inline-flex; gap: 6px; align-items: center; color: var(--ink); }
.cs-chooser { display: grid; gap: 6px; max-width: 320px; }
.cs-choice { display: block; text-align: center; padding: 8px; border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); text-decoration: none; background: var(--chip); }
.cs-choice.off { color: var(--muted); background: var(--panel); }
.cs-statusbar { display: flex; flex-wrap: wrap; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.cs-statusbar span { padding: 4px 10px; border-right: 1px solid var(--line); }
.cs-search { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.cs-search fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: 6px 10px; display: grid; gap: 4px; }
.cs-search legend { font-size: 12px; color: var(--muted); }
.cs-fields { display: grid; gap: 4px; }
.cs-2col { display: grid; grid-template-columns: auto auto; gap: 0 14px; }
.cs-2col > div { display: grid; gap: 2px; }
label.ck.locked { color: var(--muted); }
.cs-search > button { align-self: center; }
.cs-grid { max-height: 58vh; }
.cs-table td { vertical-align: top; }
.cs-table, .cp-items { table-layout: auto; width: auto; min-width: 100%; }
.cs-table tr.cs-row:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.cs-table tr.sel td { background: var(--cs-sel); }
.cs-merged { background: var(--panel); }
.cs-open { background: var(--cs-open); } .cs-res { background: var(--cs-res); }
.cs-owed { background: var(--cs-owed); } .cs-fee { background: var(--cs-fee); }
.sw.cs-open, .sw.cs-res, .sw.cs-owed, .sw.cs-fee, .sw.ln-res, .sw.ln-grey { border: 1px solid var(--line); }
.cs-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cs-btn { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink); background: var(--panel); }
.cs-btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cp-title { display: flex; gap: 10px; align-items: center; }
.cp-title h1 { margin: 0; }
.cp-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.cp-info { flex: 1 1 520px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin: 0; padding: 8px 12px; }
.cp-info legend { font-weight: 600; }
.cp-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; align-items: baseline; font-size: 14px; }
.cp-money { display: grid; gap: 3px 10px; align-items: baseline; font-size: 14px; margin-top: 8px; border-top: 1px solid var(--line);
  padding-top: 6px; grid-template-columns: repeat(3, auto minmax(90px, 1fr)); }
@media (max-width: 600px) { .cp-money { grid-template-columns: auto 1fr; } }
.cp-grid span, .cp-money span { color: var(--muted); font-size: 12px; }
.cp-due { color: var(--bad); }
.cp-dates { display: grid; gap: 6px; }
.cp-tab fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: 8px 12px; background: var(--panel); }
.cp-tab legend { font-weight: 600; font-size: 13px; }
.cp-f { display: grid; grid-template-columns: 150px 1fr; gap: 8px; padding: 2px 0; font-size: 14px; }
.cp-f span { color: var(--muted); }
.cp-f b { font-weight: 500; }
.ln-res { background: var(--cs-res); } .ln-grey { background: var(--cs-fee); }
/* ---------------------------------------------------------------- Day at a Glance */
.dag-controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.dag-date { display: inline-flex; gap: 2px; align-items: center; }
.dag-date button { padding: 4px 8px; }
.dag-tabs { gap: 0; }
.dag-tabs button { font-size: 13px; padding: 6px 8px; }
.dag-tabs button:disabled { color: var(--muted); opacity: .55; }
.dag-n { font-weight: 400; color: var(--muted); }
.dag-bold { font-weight: 700; }
.dag-conf { color: var(--bad); font-weight: 600; }
.dag-rep { font-weight: 600; }
tr.dag-line td { font-size: 12px; color: var(--muted); border-bottom-style: dashed; }
.dag .sd-table tr.grp td { background: var(--grp-bg); color: var(--grp-ink); }
.dag-ctx { position: fixed; z-index: 50; list-style: none; margin: 0; padding: 4px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.25); min-width: 230px; max-height: 90vh; overflow: auto; }
.dag-ctx button { display: block; width: 100%; text-align: left; border: 0; border-radius: 4px; padding: 4px 10px; font-size: 13px; background: none; }
.dag-ctx button:hover, .dag-ctx button:focus { background: var(--chip); outline: none; }
.dag-ctx button.gated, .dag-ctx button.unbuilt { color: var(--muted); }
.dag-ctx button.open { font-weight: 700; }
.dag-ctx small { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.dag-ctx .sep { border-top: 1px solid var(--line); margin: 4px 0; }
/* ---------------------------------------------------------------- Dispatch Center */
:root { --dsp-owed: #a8d5b3; --dsp-ontime: #e3e5e8; }
:root[data-theme="dark"] { --dsp-owed: #2f6b40; --dsp-ontime: #30353d; }
.dsp-panes { display: grid; grid-template-columns: minmax(200px, 250px) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 800px) { .dsp-panes { grid-template-columns: minmax(0, 1fr); } .dsp-tree { max-height: 240px; } }
.dsp-main { display: grid; gap: 8px; min-width: 0; }
.dsp-tree { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; max-height: 70vh; overflow: auto; }
.dsp-tree ul { list-style: none; margin: 0; padding: 0; }
.dsp-node { display: flex; align-items: center; gap: 4px; border-radius: 4px; }
.dsp-node.on { background: var(--cs-sel); }
.dsp-tree .tg { width: 20px; height: 20px; padding: 0; line-height: 1; font-weight: 700; flex: none; }
.dsp-tree .tg-sp { width: 20px; flex: none; }
.dsp-pick { border: 0; background: none; padding: 3px 4px; text-align: left; font-size: 13px; color: var(--ink); }
.dsp-pick.busy { color: var(--ok); }
.dsp-pick b { font-weight: 600; }
.dsp-owed { background: var(--dsp-owed); } .dsp-ontime { background: var(--dsp-ontime); color: var(--muted); }
.sw.dsp-owed, .sw.dsp-ontime { border: 1px solid var(--line); }
.dsp-side { border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: 8px 12px; background: var(--panel); }
.dsp-side.this { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dsp-side legend { font-weight: 600; }
.dsp-side small { font-weight: 400; color: var(--muted); }
.cs-table td small { color: var(--muted); }
/* ---------------------------------------------------------------- Warehouse (phone first) */
.wh { display: grid; gap: 12px; max-width: 640px; margin: 0 auto; }
.wh h1 { font-size: 22px; margin: 4px 0; }
.wh-date input { flex: 1; min-width: 0; }
.wh-date button, .wh button, .wh .cs-btn { min-height: 44px; min-width: 44px; }
.wh-card { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  color: var(--ink); text-decoration: none; }
.wh-card:hover, .wh-card:focus-visible { border-color: var(--accent); }
.wh-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.wh-rig { font-size: 18px; }
.wh-st { font-size: 13px; padding: 2px 10px; white-space: nowrap; }
.wh-prog { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; font-size: 14px; }
.wh-bar { display: block; height: 8px; border-radius: 99px; background: var(--chip); overflow: hidden; }
.wh-bar i { display: block; height: 100%; background: var(--ok); }
.wh-short { color: var(--bad); font-weight: 600; }
.wh-head { display: grid; gap: 4px; }
.wh-head .cs-btn { justify-self: start; }
.wh-head p { margin: 0; }
.wh-sum { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 15px; padding: 8px 0; }
.wh-line { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.wh-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.wh-step { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: 8px; }
.wh-step label { color: var(--ink); font-size: 15px; font-weight: 600; }
.wh-ctl { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; gap: 6px; }
.wh-ctl button { font-size: 22px; line-height: 1; padding: 0; }
.wh-ctl input { font-size: 20px; text-align: center; min-height: 44px; width: 100%; }
.wh-shortbox summary { cursor: pointer; color: var(--muted); min-height: 32px; }
.wh-shortbox[open] { display: grid; gap: 8px; }
.wh-actions { gap: 8px; }
.wh-actions button { flex: 1 1 120px; }
.wh-msg.bad { color: var(--bad); font-weight: 600; }
.wh-hist-list { padding-left: 18px; font-size: 13px; }
.wh-confirm { min-height: 52px; font-size: 18px; }
.nc { max-width: 520px; }
.nc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.nc-cols > div { display: grid; gap: 6px; }
.nq-row select { flex: 1 1 200px; min-width: 0; }
.nq-row input { width: 90px; }
.wh textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; width: 100%; }
.wh-tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; min-height: 44px; }
.wh-tabs a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.wh-line > button[data-gate] { justify-self: start; }
/* ---------------------------------------------------------------- Operations Dashboard */
.ops { display: grid; gap: 14px; }
.ops-top { display: grid; gap: 6px; }
.ops-top h1 { margin: 0; }
.ops-top .wh-date { flex-wrap: wrap; }
.ops-top .wh-date input { flex: 1 1 150px; min-width: 150px; }
.ops-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 12px; align-items: start; }
.ops-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; min-width: 0; }
.ops-head { display: flex; gap: 12px; align-items: center; }
.ops-head h2 { margin: 0; font-size: 16px; }
.ops-count { font-size: 30px; font-weight: 700; min-width: 56px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--chip); color: var(--ink); text-decoration: none; padding: 0 10px; font-variant-numeric: tabular-nums; }
.ops-count:hover, .ops-count:focus-visible { background: var(--accent); color: var(--accent-ink); }
.ops-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ops-list li { display: flex; gap: 8px; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 6px; }
.ops-row { flex: 1; min-width: 0; display: grid; gap: 2px; color: var(--ink); text-decoration: none; padding: 4px 2px; min-height: 44px; }
.ops-row:hover b, .ops-row:focus-visible b { color: var(--accent); text-decoration: underline; }
.ops-meta { font-size: 13px; color: var(--muted); }
.ops-c { font-size: 13px; padding: 6px 4px; white-space: nowrap; }
.ops-mini { align-self: start; }
/* ---------------------------------------------------------------- category-first catalog browser */
dialog.cb { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); padding: 0;
  width: min(900px, calc(100% - 24px)); height: min(88vh, 900px); max-height: 100dvh; }
dialog.cb[open] { display: flex; flex-direction: column; }
dialog.cb::backdrop { background: rgba(0,0,0,.4); }
@media (max-width: 600px) { dialog.cb { width: 100vw; max-width: 100vw; height: 100dvh; border-radius: 0; margin: 0; } }
.cb-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.cb-head h2 { margin: 0; }
.cb-crumbs { padding: 8px 14px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 14px; }
.cb-crumbs button { border: 0; background: none; color: var(--accent); padding: 6px 4px; min-height: 36px; text-decoration: underline; }
.cb-search { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 4px 14px 10px; border-bottom: 1px solid var(--line); }
.cb-search input[type=search] { flex: 1 1 200px; min-height: 40px; }
.cb-scope { display: flex; flex-wrap: wrap; gap: 4px 14px; width: 100%; }
.cb-head, dialog.cb .cb-crumbs, .cb-search { flex: none; height: auto; position: static; }
.cb-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 8px 14px 20px; }
.cb-cats { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 8px; }
.cb-cats button { width: 100%; text-align: left; display: grid; gap: 2px; padding: 10px 12px; min-height: 52px; background: var(--panel); }
.cb-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cb-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.cb-item.added { border-color: var(--ok); }
.cb-name { display: grid; gap: 2px; min-width: 0; flex: 1 1 220px; }
.cb-add { display: flex; gap: 6px; align-items: center; }
.cb-add input { width: 76px; min-height: 40px; text-align: center; }
.cb-add button { min-height: 40px; min-width: 76px; }
.cb-draft { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.cb-draft li { display: flex; gap: 8px; align-items: center; }
.cb-draft li span { flex: 1; min-width: 0; }
.cb-draft input { width: 80px; }
/* ---------------------------------------------------------------- quote Delivery tab (sales form) */
.sd-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 10px; }
.sd-form fieldset { margin: 0; min-width: 0; }
.sd-form .row { flex-wrap: wrap; }
.sd-form .row > label { flex: 1 1 140px; }
.sd-form textarea { width: 100%; box-sizing: border-box; }
.sd-del legend { background: #f5d76e; color: #222; padding: 2px 8px; border-radius: 4px; }
.sd-pu legend { background: #9be29b; color: #222; padding: 2px 8px; border-radius: 4px; }
.sd-pre { white-space: pre-wrap; margin: 4px 0; }
.sd-open { margin-top: 12px; }
/* ---------------------------------------------------------------- Program Menu [Codex 01] */
.pm { display: grid; gap: 10px; }
.pm-ws { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 14px; }
.pm-main { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #6f7f92; color: #fff; }
.pm-main legend { font-weight: 700; font-size: 20px; padding: 0 10px; background: var(--bg); color: var(--ink); border-radius: 6px; }
.pm-quit { text-align: center; margin-bottom: 8px; }
.pm-quit button { font-size: 18px; font-weight: 700; }
.pm-quit .x { color: var(--bad); }
.pm-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.pm-tile { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; gap: 4px;
  padding: 10px 6px; border-radius: 10px; color: #fff; font-weight: 700; text-decoration: none; min-height: 112px; }
.pm-tile:hover, .pm-tile:focus-visible { background: rgba(255,255,255,.15); outline: 2px solid #fff; }
.pm-tile .pm-ic { font-size: 44px; line-height: 1; }
.pm-tile.off { color: #d5dbe3; opacity: .75; font-weight: 500; }
.pm-tile small { font-weight: 400; font-size: 11px; }
.pm-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px;
  border-top: 1px solid rgba(255,255,255,.4); padding-top: 10px; }
.pm-foot a { color: #fff; font-weight: 700; }
.pm-foot input[type=text], .pm-foot input:not([type]) { width: 4em; }
.pm-enter { display: inline-flex; gap: 6px; align-items: center; color: #fff; font-weight: 700; }
.pm-main .ck { color: #fff; }
.pm-main .sd-small { color: #eef2f6; }
@media (max-width: 900px) { .pm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .pm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pm-tile { min-height: 96px; font-size: 13px; } .pm-tile .pm-ic { font-size: 34px; } }
.pmc { max-width: 360px; }
.pmc-cols { max-width: none; }
.pmc-btns { display: grid; gap: 6px; }
.pmc-cols .pmc-btns { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
@media (max-width: 700px) { .pmc-cols .pmc-btns { grid-template-columns: 1fr; } }
.cs-choice small { display: block; font-size: 11px; font-weight: 400; }
.pm-kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.pm-kv dt { color: var(--muted); }
.pm-kv dd { margin: 0; }
.cs-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.ws-chip { background: var(--chip); padding: 1px 6px; border-radius: 4px; }
.ct-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.ct-steps li { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--muted); }
.ct-steps li.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.tc-added td, i.sw.tc-added { background: #fff3b0; color: #222; }
.tc-remote td, i.sw.tc-remote { background: #c9f2c7; color: #222; }
.tk-over { background: #f6c7c7; color: #222; }
.rp-doc { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #fff; color: #111; }
.rp-tot { text-align: right; }
.qb { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 6px; }
@media print { .noprint, header, nav, .banner { display: none !important; } }
@media print { .sd-scroll { max-height: none; overflow: visible; border: 0; } .sd-chart { position: static; box-shadow: none; } }
@media print { .sandbox, .top, .noprint { display: none; } main { padding: 0; } .panel { border: 0; } }

/* hosted beta: sign-in, activation, Beta access */
main.signin { max-width: 420px; }
main.signin form { display: grid; gap: 12px; }
main.signin form[hidden] { display: none; }
main.signin input { padding: 10px; font-size: 16px; }
main.signin button.primary { padding: 10px; font-size: 16px; }
main.signin section.panel { display: grid; gap: 12px; }
main.signin section[hidden] { display: none; }
main.signin .setup-key { font-size: 15px; letter-spacing: 0.04em; word-break: break-all; user-select: all; }
main.signin .recovery-codes { font-size: 16px; line-height: 1.6; padding: 10px; margin: 0; user-select: all;
  border: 1px solid currentColor; border-radius: 4px; white-space: pre-wrap; }
.muted { color: var(--muted); font-weight: 500; font-size: 15px; }
.msg { color: var(--bad); font-size: 14px; min-height: 0; }
.msg:empty { display: none; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.invite-link { font-family: var(--mono); font-size: 13px; word-break: break-all; background: var(--chip); padding: 8px; border-radius: 6px; }

/* ---------------------------------------------------------------- Retro UI, T3 profile (restyled 2026-11-30)
   Same places, same order, same captions as the screens T3 knows, in RentalAF's own look: warm stone surfaces,
   a navy Program Menu, teal accents, flat table headers, rounded controls (David, 2026-11-30: "close enough to
   follow along with it, but not the same"). No colour here is sampled from another product. Dark is opt-in. */
.pm, .cs, #view[data-frame] {
  --bg: #f3f1ec; --panel: #fffdf9; --ink: #1d2430; --muted: #5a6270; --line: #d6d1c7; --chip: #ebe6dc;
  --accent: #1f6f78; --accent-ink: #ffffff; --cs-sel: #d7ece9;
  --ok: #1d7a46; --warn: #8a4b00; --bad: #b42318; --ok-bg: #e7f5ec; --warn-bg: #fff4d6; --bad-bg: #fdecea;
  --cs-open: #d9eedc; --cs-res: #fff3c4; --cs-owed: #e2f0e0; --cs-fee: #ece8e1;
  --rt-nav: #23384d; --rt-nav-ink: #f4f1ea; --rt-stone: #e7e1d6; --rt-stone-line: #cfc7b8; --rt-head: #ece7de;
  color: var(--ink); font-family: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
/* Program Menu: a navy panel with light captions */
.pm-main { background: var(--rt-nav); color: var(--rt-nav-ink); border: 1px solid #1a2a3a; border-radius: 10px; }
.pm-main legend { background: var(--rt-nav); color: var(--rt-nav-ink); font-size: 20px; font-weight: 600; padding: 2px 14px;
  border-radius: 999px; letter-spacing: .01em; }
.pm-tile { color: var(--rt-nav-ink); border-radius: 8px; }
.pm-tile:hover, .pm-tile:focus-visible { background: rgba(255,255,255,.10); outline: 2px solid #4fb3bc; outline-offset: -2px; }
.pm-tile.off { color: #b9c3cd; opacity: .55; }
.pm-foot { border-top: 1px solid rgba(255,255,255,.18); }
.pm-foot a { color: #9fd3d6; text-decoration: none; border-bottom: 1px solid currentColor; }
.pm-enter, .pm-main .ck { color: var(--rt-nav-ink); }
.pm-main .sd-small { color: #cdd5dc; }
.pm-quit button, .cs-quit button { background: transparent; border: 0; color: inherit; }
.pm-quit .x, .cs-quit .x { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 6px;
  background: #c2553f; color: #fff; font-size: .85em; }
/* Counter System and its sub-menus: a warm stone panel */
.cs-main, .cs-chooser { background: var(--rt-stone); color: var(--ink); border: 1px solid var(--rt-stone-line); border-radius: 10px; padding: 12px; }
.cs-main legend, .cs-chooser legend { background: var(--rt-stone); color: var(--ink); font-weight: 600; font-size: 20px; padding: 2px 14px; border-radius: 999px; }
.cs-main .cs-quit button { font-size: 18px; font-weight: 600; }
.cs-main .cs-tile { background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--ink); font-weight: 600;
  justify-content: flex-start; min-height: 108px; padding: 10px 6px; }
.cs-main a.cs-tile:hover, .cs-main a.cs-tile:focus-visible { background: #fffdf9; border-color: var(--rt-stone-line); outline: 2px solid var(--accent); outline-offset: -2px; }
.cs-main .cs-tile .pm-ic { font-size: 40px; line-height: 1; }
.cs-main .cs-tile.off { background: transparent; color: #6f6a61; opacity: .5; font-weight: 500; }
.cs-main .cs-enter { border-top: 1px solid var(--rt-stone-line); padding-top: 10px; justify-content: center; }
.cs-main .cs-enter label { color: var(--ink); font-weight: 600; font-size: 17px; }
.cs-main .cs-enter a { color: var(--accent); font-weight: 600; font-size: 17px; text-decoration: none; border-bottom: 1px solid currentColor; }
.cs-main .sd-small, .cs-chooser .sd-small { color: var(--muted); }
@media (max-width: 560px) { .cs-main .cs-tile { min-height: 92px; font-size: 13px; } .cs-main .cs-tile .pm-ic { font-size: 32px; } }
.cs-chooser .cs-choice { background: #fffdf9; color: var(--ink); border: 1px solid var(--rt-stone-line); border-radius: 8px; font-weight: 600; }
.cs-chooser a.cs-choice:hover, .cs-chooser a.cs-choice:focus-visible { background: #e3f1f0; border-color: var(--accent); }
.cs-chooser .cs-choice.off { background: #ddd7cc; color: #7a756c; border-color: #d2cbbe; }
.cs-chooser .cs-enter, .cs-chooser label { color: var(--ink); font-weight: 600; }
/* menu bar: a quiet text strip */
.cs-menubar { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 2px 0; }
.cs-mi { color: var(--ink); text-decoration: none; border-radius: 6px; padding: 3px 8px; }
.cs-mi:hover { background: var(--chip); }
/* status bar: a row of soft chips */
.cs-statusbar { background: transparent; color: var(--muted); border: 0; gap: 6px; }
.cs-statusbar span { flex: 1 1 auto; text-align: center; background: var(--chip); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
/* every other screen: a card with a title strip */
#view[data-frame] { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px 14px; margin-top: 14px;
  box-shadow: 0 1px 3px rgba(29,36,48,.08), 0 6px 18px rgba(29,36,48,.05); }
#view[data-frame]::before { content: attr(data-title); display: block; min-height: 1.3em; margin: 0 -14px 12px; padding: 9px 14px;
  background: #f7f5f0; color: var(--ink); font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line);
  border-radius: 12px 12px 0 0; box-shadow: inset 3px 0 0 var(--accent); }
#view[data-frame] .win-title-src { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 560px) {
  main#view[data-frame] { padding: 0 8px 12px; margin: 8px 6px 40px; }
  #view[data-frame]::before { margin: 0 -8px 10px; padding: 8px 10px; }
}
#view[data-frame] .panel { border-radius: 10px; border-color: var(--line); }
#view[data-frame] button, #view[data-frame] .cs-btn { background: #fffdf9; color: var(--ink); border: 1px solid #c9c2b4; border-radius: 6px; }
#view[data-frame] button:hover, #view[data-frame] .cs-btn:hover { background: #f1ede5; border-color: #b5ad9e; }
#view[data-frame] button.primary, #view[data-frame] .cs-btn.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid #185b63; font-weight: 600; }
#view[data-frame] button.primary:hover, #view[data-frame] .cs-btn.primary:hover { background: #185b63; }
#view[data-frame] input, #view[data-frame] select, #view[data-frame] textarea { background: #fff; color: var(--ink); border: 1px solid #bdb6a8; border-radius: 6px; }
#view[data-frame] input:focus-visible, #view[data-frame] select:focus-visible, #view[data-frame] textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
#view[data-frame] .tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); font-weight: 500; }
#view[data-frame] .tabs button.on { background: transparent; color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
/* grids: flat warm header, light rules, teal row highlight */
#view table { background: #fff; border: 1px solid var(--line); border-radius: 8px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
#view table th { background: var(--rt-head); color: #3a4150; text-transform: none; letter-spacing: 0;
  font-size: 12px; font-weight: 600; border: 0; border-bottom: 1px solid #ddd6ca; padding: 6px 8px; }
#view table td { padding: 4px 8px; border-bottom: 1px solid #eee9e0; border-right: 0; }
#view table tbody tr:hover > td { background: #e3f1f0; }
#view .tablewrap, #view .sd-scroll { background: #f7f5f0; }

/* ---------------------------------------------------------------- Dark mode (opt-in from Settings: html[data-theme=dark]) */
:root[data-theme="dark"] .pm, :root[data-theme="dark"] .cs, :root[data-theme="dark"] #view[data-frame] {
  --bg: #14181d; --panel: #1b2027; --ink: #e9e6df; --muted: #a3a9b3; --line: #343b45; --chip: #262c35;
  --accent: #4fb3bc; --accent-ink: #0d1a1c; --cs-sel: #1d3b3f;
  --ok: #5cc98a; --warn: #f0b34a; --bad: #ff7b6e; --ok-bg: #123222; --warn-bg: #352710; --bad-bg: #3a1714;
  --cs-open: #1d4a2c; --cs-res: #4a3f10; --cs-owed: #1d3f26; --cs-fee: #2a2f37;
  --rt-nav: #182635; --rt-nav-ink: #eef0f2; --rt-stone: #2a2620; --rt-stone-line: #4a443a; --rt-head: #232a33;
}
:root[data-theme="dark"] .pm-main { border-color: #0f1924; }
:root[data-theme="dark"] .cs-main .cs-tile.off { color: #9c968b; }
:root[data-theme="dark"] .cs-main a.cs-tile:hover, :root[data-theme="dark"] .cs-main a.cs-tile:focus-visible { background: #332e27; }
:root[data-theme="dark"] .cs-chooser .cs-choice { background: #2f2a23; color: var(--ink); }
:root[data-theme="dark"] .cs-chooser a.cs-choice:hover { background: #1d3b3f; }
:root[data-theme="dark"] .cs-chooser .cs-choice.off { background: #26231e; color: #7d786f; border-color: #3d382f; }
:root[data-theme="dark"] #view[data-frame]::before { background: #20262e; }
:root[data-theme="dark"] #view[data-frame] button, :root[data-theme="dark"] #view[data-frame] .cs-btn { background: #232a33; color: var(--ink); border-color: #434b57; }
:root[data-theme="dark"] #view[data-frame] button:hover, :root[data-theme="dark"] #view[data-frame] .cs-btn:hover { background: #2b333e; border-color: #56606d; }
:root[data-theme="dark"] #view[data-frame] button.primary, :root[data-theme="dark"] #view[data-frame] .cs-btn.primary { background: var(--accent); color: var(--accent-ink); border-color: #3a8f97; }
:root[data-theme="dark"] #view[data-frame] input, :root[data-theme="dark"] #view[data-frame] select,
:root[data-theme="dark"] #view[data-frame] textarea { background: #161a20; color: var(--ink); border-color: #434b57; }
:root[data-theme="dark"] #view table { background: #1b2027; }
:root[data-theme="dark"] #view table th { color: #cfd5dc; border-bottom-color: #343b45; }
:root[data-theme="dark"] #view table td { border-color: #2a3039; }
:root[data-theme="dark"] #view table tbody tr:hover > td { background: #1d3b3f; }
:root[data-theme="dark"] #view .tablewrap, :root[data-theme="dark"] #view .sd-scroll { background: #171b21; }
/* menu captions sit centred in the panel's top edge */
.pm-main > legend, .cs-main > legend, .cs-chooser > legend { margin-inline: auto; }
/* phone: tab rows and filter boxes fill the width (David, 2026-11-14) */
@media (max-width: 560px) {
  #view .tabs button, #view .dag-tabs button { flex: 1 1 auto; text-align: center; }
  #view .dag-controls, #view .dag-controls .row { display: grid; grid-template-columns: 1fr; width: 100%; }
  #view .dag-controls label:not(.ck) { width: 100%; }
  #view .dag-controls label:not(.ck) > input:not([type=checkbox]), #view .dag-controls label > select { width: 100%; }
  #view .dag-date { display: flex; width: 100%; }
  #view .dag-date input { flex: 1; }
  #view .cs-menubar { display: flex; }
  #view .cs-menubar > * { flex: 1 1 auto; text-align: center; }
}

/* phone header: brand on its own line at the top, menu links full width below it, then the signed-in line */
@media (max-width: 700px) {
  .top { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 16px; }
  .top .brand { order: 0; }
  .top nav { order: 1; flex: none; width: 100%; display: flex; flex-wrap: wrap; gap: 4px; }
  .top nav a { flex: 1 1 auto; text-align: center; padding: 8px 10px; background: var(--chip); white-space: nowrap; }
  .top nav a.on { outline: 2px solid var(--accent); outline-offset: -2px; }
  .top .who { order: 2; flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- Home: collapsible sections (2026-11-30) */
.hm { display: grid; gap: 12px; }
.hm-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.hm-head h1 { margin: 0; }
.hm-tools { margin-left: auto; display: flex; gap: 6px; }
.hm-tools button { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; color: var(--ink); cursor: pointer; }
.hm-tools button:hover { background: var(--chip); }
.hm-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.hm-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  font-weight: 600; background: #f7f5f0; border-bottom: 1px solid transparent; }
.hm-sec[open] > summary { border-bottom-color: var(--line); }
.hm-sec > summary::-webkit-details-marker { display: none; }
.hm-sec > summary::before { content: "▸"; color: var(--accent); transition: transform .15s; }
.hm-sec[open] > summary::before { transform: rotate(90deg); }
.hm-sec > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.hm-count { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--chip); border-radius: 999px; padding: 1px 9px; }
.hm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; padding: 10px; }
.hm-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--ink);
  text-decoration: none; font-weight: 500; border: 1px solid transparent; }
.hm-item:hover, .hm-item:focus-visible { background: #e3f1f0; border-color: #c4e0dd; outline: none; }
.hm-ic { font-size: 22px; line-height: 1; }
.hm-note { margin: 0; }
@media (max-width: 560px) { .hm-grid { grid-template-columns: 1fr 1fr; } .hm-item { padding: 8px; font-size: 14px; } }
:root[data-theme="dark"] .hm-sec > summary { background: #20262e; }
:root[data-theme="dark"] .hm-item:hover, :root[data-theme="dark"] .hm-item:focus-visible { background: #1d3b3f; border-color: #2c5458; }

/* ---------------------------------------------------------------- RentalAF branding (2026-11-30) */
.raf-brand { text-align: center; margin: 8px 0 18px; }
.raf-brand h1 { margin: 0; font-size: 34px; letter-spacing: -.01em; }
.raf-tag { margin: 2px 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.raf-lines { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
footer.powered { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 16px 24px; }
footer.powered b { color: var(--ink); font-weight: 600; }

/* Home: the Retro layout switch (2026-11-30) */
.hm-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--ink);
  padding: 4px 12px 4px 6px; border: 1px solid var(--line); border-radius: 999px; user-select: none; }
.hm-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hm-knob { width: 34px; height: 20px; border-radius: 999px; background: #c9c2b4; position: relative; transition: background .15s; flex: none; }
.hm-knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.hm-switch input:checked + .hm-knob { background: var(--accent); }
.hm-switch input:checked + .hm-knob::after { transform: translateX(14px); }
.hm-switch input:focus-visible + .hm-knob { outline: 2px solid var(--accent); outline-offset: 2px; }
.pm .hm-head { margin-bottom: 4px; }

/* Home: every section on one page as columns (2026-11-30, replaces the collapsible sections) */
.hm-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; align-items: start; }
.hm-col { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px 8px; }
.hm-col h2 { margin: 0 6px 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.hm-col ul { list-style: none; margin: 0; padding: 0; }
.hm-col .hm-item { padding: 6px 8px; gap: 9px; font-size: 14px; white-space: nowrap; }
.hm-col .hm-ic { font-size: 17px; width: 20px; text-align: center; }
@media (max-width: 560px) { .hm-cols { grid-template-columns: 1fr 1fr; } .hm-col .hm-item { white-space: normal; } }

/* ---------------------------------------------------------------- persistent sidebar (2026-11-30) */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); align-items: start; }
body.side-mini .shell { grid-template-columns: 60px minmax(0, 1fr); }
body.no-side .shell { grid-template-columns: minmax(0, 1fr); }
body.no-side .side, body.no-side .side-toggle { display: none; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--panel);
  border-right: 1px solid var(--line); }
.side-scroll { flex: 1; overflow-y: auto; padding: 10px 8px; }
.side-grp { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.side-h { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 2px 10px 4px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 999px; color: var(--ink);
  text-decoration: none; font-size: 14px; white-space: nowrap; }
.side-link:hover { background: var(--chip); }
.side-link.on { background: #dcefed; color: #0f4c53; font-weight: 600; }
.side-ic { width: 20px; text-align: center; font-size: 16px; flex: none; }
.side-tx { overflow: hidden; text-overflow: ellipsis; }
.side-mini-btn { border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--muted); padding: 10px 14px;
  display: flex; gap: 10px; align-items: center; cursor: pointer; font-size: 13px; }
.side-mini-btn:hover { color: var(--ink); }
body.side-mini .side-tx, body.side-mini .side-h { display: none; }
body.side-mini .side-link { justify-content: center; padding: 8px 0; }
body.side-mini .side-mini-btn span:first-child { transform: rotate(180deg); }
body.side-mini .side-mini-btn { justify-content: center; }
.side-toggle { display: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px;
  font-size: 18px; line-height: 1; padding: 6px 10px; cursor: pointer; }
main#view { min-width: 0; }
:root[data-theme="dark"] .side-link.on { background: #1d3b3f; color: #bfe6e2; }
@media (max-width: 900px) {
  .shell, body.side-mini .shell { grid-template-columns: minmax(0, 1fr); }
  .side-toggle { display: inline-block; }
  .side { position: fixed; z-index: 50; top: 0; left: 0; width: min(290px, 86vw); transform: translateX(-105%);
    transition: transform .18s; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
  body.side-open .side { transform: none; }
  body.side-mini .side-tx, body.side-mini .side-h { display: initial; }
  .side-mini-btn { display: none; }
  .top { flex-direction: row !important; align-items: center !important; }
}

/* Home columns as masonry (2026-11-30): sections of different lengths stack without gaps */
.hm-cols { display: block; column-width: 240px; column-gap: 12px; }
.hm-col { display: inline-block; width: 100%; margin: 0 0 12px; break-inside: avoid; }
@media (max-width: 560px) { .hm-cols { column-width: 160px; } }

/* sidebar groups fold (Google Ads style) */
details.side-grp > summary.side-h { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; }
details.side-grp > summary.side-h::-webkit-details-marker { display: none; }
details.side-grp > summary.side-h::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
details.side-grp:not([open]) > summary.side-h::after { transform: rotate(-90deg); }
details.side-grp > summary.side-h:hover { background: var(--chip); color: var(--ink); }
body.side-mini details.side-grp > summary.side-h { display: none; }
body.side-mini details.side-grp:not([open]) > .side-link { display: flex; }

/* Home view switch: Retro / Single screen / Sidebar */
.hm-views { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--panel); }
.hm-views button { border: 0; background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.hm-views button:hover { color: var(--ink); }
.hm-views button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.hm-views button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Favorites (2026-11-30) */
.side-favs { margin-top: 6px; }
.side-favs .side-h { color: var(--accent); }
.side-empty { margin: 2px 10px 4px; font-size: 12px; color: var(--muted); white-space: normal; }
.fav-menu { position: fixed; z-index: 100; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 4px; min-width: 200px; }
.fav-menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink);
  padding: 8px 12px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.fav-menu button:hover, .fav-menu button:focus-visible { background: var(--chip); outline: none; }
body.side-mini .side-empty { display: none; }

/* ---------------------------------------------------------------- company brand colour (2026-11-30) */
:root { --brand: #1f6f78; --brand-ink: #ffffff; }          /* RentalAF default; a company's colour overrides it */
.brand .af, .raf-brand .af { color: var(--brand); }
.side-link.on, :root[data-theme="dark"] .side-link.on { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.side-link.on:hover { background: var(--brand); filter: brightness(1.08); }
.cs-statusbar span, :root[data-theme="dark"] .cs-statusbar span { background: var(--brand); color: var(--brand-ink); }
.hm-views button.on { background: var(--brand); color: var(--brand-ink); }
.raf-tag { color: var(--brand); }
/* the AF matches the R in size, heavier (David, 2026-11-30) */
.brand .af, .raf-brand h1 .af { font-size: inherit; font-weight: 800; letter-spacing: -.01em; }
.brand { font-weight: 700; }
