:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --hair: rgba(0, 0, 0, .08);
  --accent: #0a7c86;
  --accent-ink: #ffffff;
  --accent-soft: rgba(10, 124, 134, .12);
  --bad: #d70015;
  --bad-soft: #fff1f0;
  --warn: #9a4a00;
  --warn-soft: #fff4e0;
  --ok: #1d7a3e;
  --ok-soft: #e9f6ee;
  --info: #0066cc;
  --info-soft: #e8f1fc;
  --radius: 18px;
  --shadow: 0 2px 14px rgba(0, 0, 0, .06);
  --glass: rgba(245, 245, 247, .78);
  --nav-w: 220px;
  --tabbar-h: 62px;
  --fill: rgba(118, 118, 128, .12);
  --chev: #c4c4c7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --panel: #1c1c1e; --ink: #f5f5f7; --muted: #a1a1a6; --line: #3a3a3c; --hair: rgba(255, 255, 255, .1);
    --accent: #40c8d4; --accent-ink: #00262a; --accent-soft: rgba(64, 200, 212, .18);
    --bad: #ff453a; --bad-soft: #3a0f0d; --warn: #ffb44d; --warn-soft: #3a2a10;
    --ok: #30d158; --ok-soft: #0f2a19; --info: #64a8ff; --info-soft: #102640;
    --shadow: none; --glass: rgba(22, 22, 23, .78); --fill: rgba(118, 118, 128, .24); --chev: #5b5b60;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --panel: #1c1c1e; --ink: #f5f5f7; --muted: #a1a1a6; --line: #3a3a3c; --hair: rgba(255, 255, 255, .1);
  --accent: #40c8d4; --accent-ink: #00262a; --accent-soft: rgba(64, 200, 212, .18);
  --bad: #ff453a; --bad-soft: #3a0f0d; --warn: #ffb44d; --warn-soft: #3a2a10;
  --ok: #30d158; --ok-soft: #0f2a19; --info: #64a8ff; --info-soft: #102640;
  --shadow: none; --glass: rgba(22, 22, 23, .78); --fill: rgba(118, 118, 128, .24); --chev: #5b5b60;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; line-height: 1.2; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 6px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------ layout */

#app { min-height: 100vh; }
#view { padding: 16px; padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }

#nav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--panel); border-top: 1px solid var(--line);
  display: flex;
}
#nav[hidden] { display: none; }
#nav .brand, #nav .company, #nav .who { display: none; }
#nav .links { display: flex; flex: 1; }
#nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11px; text-decoration: none; min-width: 0;
}
#nav a svg { width: 22px; height: 22px; }
#nav a.on { color: var(--accent); }
#nav .more-only { display: none; }

@media (min-width: 860px) {
  #nav {
    top: 0; right: auto; width: var(--nav-w); height: auto; flex-direction: column;
    border-top: 0; border-right: 1px solid var(--line); padding: 16px 10px;
  }
  #nav .brand { display: block; font-weight: 800; font-size: 17px; padding: 4px 10px 2px; color: var(--accent); }
  #nav .company { display: block; padding: 0 10px 16px; font-size: 12px; color: var(--muted); }
  #nav .links { flex-direction: column; flex: 0; gap: 2px; }
  #nav a { flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 14px; padding: 9px 10px; border-radius: 8px; color: var(--ink); }
  #nav a svg { width: 18px; height: 18px; color: var(--muted); }
  #nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  #nav a.on svg { color: var(--accent); }
  #nav .more-only { display: flex; }
  #nav .who { display: block; margin-top: auto; padding: 10px; font-size: 13px; border-top: 1px solid var(--line); }
  #view { margin-left: var(--nav-w); padding: 24px 28px 48px; max-width: none; }
  #view > * { max-width: 1040px; }
  #nav[hidden] + #view { margin-left: 0; }
  #view > .auth { margin: 8vh auto; }
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.stack > * + * { margin-top: 12px; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .grid2 { grid-template-columns: 1.4fr 1fr; align-items: start; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------- lists */

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list a.item, .list .item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; color: inherit; text-decoration: none; }
.list a.item:hover { background: var(--bg); }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .r { text-align: right; flex-shrink: 0; }
.item .r .rsep { display: block; height: 4px; }
.time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 72px; white-space: nowrap; flex-shrink: 0; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }

/* ------------------------------------------------------------ badges */

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge.requested, .badge.quoted { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.scheduled { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.in_progress { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.completed, .badge.paid, .badge.available { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.cancelled, .badge.retired { text-decoration: line-through; }
.badge.overdue, .badge.high, .badge.calibration { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.deployed, .badge.medium, .badge.unpaid { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.kind { background: transparent; }

.pci { font-weight: 800; font-variant-numeric: tabular-nums; }
.pci.bad { color: var(--bad); }
.pci.ok { color: var(--ok); }
.pci.mid { color: var(--warn); }

.banner { border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner .big { font-size: 32px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.banner .txt { flex: 1; min-width: 180px; color: var(--ink); }

.fu { display: flex; gap: 12px; padding: 12px 16px; align-items: flex-start; }
.fu .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; background: var(--muted); }
.fu .dot.high { background: var(--bad); }
.fu .dot.medium { background: var(--warn); }
.fu .dot.low { background: var(--info); }
.fu .main { flex: 1; min-width: 0; }

/* ------------------------------------------------------------- forms */

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.fields { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 600px) { .fields.two { grid-template-columns: 1fr 1fr; } .fields.three { grid-template-columns: 1fr 1fr 1fr; } .fields.four { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .fields.four { grid-template-columns: 1fr 1fr 1fr 1fr; } }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 14px; margin: 4px 0 12px; }
.check input { width: 20px; height: 20px; }
.search { max-width: 360px; }

button, .btn {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  text-decoration: none; min-height: 42px; white-space: nowrap;
}
button:hover, .btn:hover { text-decoration: none; filter: brightness(.97); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: var(--accent); padding: 4px 6px; min-height: 0; }
button.small, .btn.small { padding: 6px 10px; min-height: 34px; font-size: 13px; }
button:disabled { opacity: .55; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

details.fold { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
details.fold summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold[open] summary { margin-bottom: 12px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tabs a { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 13px; white-space: nowrap; }
.tabs a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; }

.device { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.device + .device { margin-top: 10px; }

.day-h { padding: 10px 16px; background: var(--bg); font-weight: 700; font-size: 13px; border-top: 1px solid var(--line); }
.day-h.today { color: var(--accent); }

.auth { max-width: 400px; margin: 8vh auto; }
.auth .logo { font-weight: 800; font-size: 26px; color: var(--accent); margin-bottom: 4px; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: calc(100% - 32px);
  transition: all .2s;
}
#toast.on { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--bad); color: #fff; }

.activity li { padding: 6px 0; font-size: 13px; border-top: 1px solid var(--line); }
.activity li:first-child { border-top: 0; }

/* ------------------------------------------------------- v2 additions */

.card-head.pad { padding: 16px 16px 0; }
.pad-x { margin: 0 16px 16px; }
#nav a.desk-only { display: none; }
#nav a.phone-only { display: flex; }
@media (min-width: 860px) {
  #nav a.desk-only { display: flex; }
  #nav a.phone-only { display: none; }
  #nav .links { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  #nav .links a { flex: 0 0 auto; }
}
.more-icon svg { width: 20px; height: 20px; color: var(--muted); display: block; }
.link-row { width: 100%; border: 0; border-radius: 0; background: none; text-align: left; font-weight: 400; min-height: 0; justify-content: flex-start; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: var(--bg); }
.photo-grid figcaption { font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; }
input[type="file"] { padding: 8px; }

details.card.role > summary { cursor: pointer; list-style: none; }
details.card.role > summary::-webkit-details-marker { display: none; }
details.card.role[open] > summary { margin-bottom: 12px; }
.perm-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
@media (min-width: 760px) { .perm-grid { grid-template-columns: 1fr 1fr; } }
fieldset.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 4px; margin: 0; min-width: 0; }
fieldset.perm-group legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 4px; }
.check.perm { align-items: flex-start; margin: 6px 0; }
.check.perm input { margin-top: 1px; flex-shrink: 0; }
.check input:disabled + span { opacity: .55; }
.edit-row td { background: var(--bg); }

pre.msg { white-space: pre-wrap; font: inherit; font-size: 13px; background: var(--bg); padding: 10px; border-radius: 8px; margin: 6px 0 0; overflow-wrap: anywhere; }
code { font-size: 12px; overflow-wrap: anywhere; }

/* -------------------------------------------------------- reports / charts
   Colors from the validated reference palette: one series hue, and a
   five-step ordinal ramp (checked light and dark with validate_palette). */

:root {
  --viz-1: #2a78d6;
  --viz-grid: #e1e0d9;
  --viz-axis: #c3c2b7;
  --viz-tick: #898781;
  --viz-track: #eef3fb;
  --viz-r1: #86b6ef; --viz-r2: #5598e7; --viz-r3: #2a78d6; --viz-r4: #1c5cab; --viz-r5: #0d366b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --viz-1: #3987e5; --viz-grid: #2c2c2a; --viz-axis: #383835; --viz-track: #1f2a38;
    --viz-r1: #b7d3f6; --viz-r2: #6da7ec; --viz-r3: #3987e5; --viz-r4: #256abf; --viz-r5: #184f95;
  }
}
:root[data-theme="dark"] {
  --viz-1: #3987e5; --viz-grid: #2c2c2a; --viz-axis: #383835; --viz-track: #1f2a38;
  --viz-r1: #b7d3f6; --viz-r2: #6da7ec; --viz-r3: #3987e5; --viz-r4: #256abf; --viz-r5: #184f95;
}

.section-h { margin: 28px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.filters select, .filters input { width: auto; font-size: 15px; padding: 7px 10px; }
.stat .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stats .stat .l { margin-bottom: 2px; }
.stats.inner { margin: 0; }
.stats.inner .stat { background: var(--bg); border: 0; }
.viz-row { margin-bottom: 12px; }
.viz-row > .card + .card, .grid2 > .card + .card { margin-top: 0; }
@media (max-width: 979px) { .viz-row > .card + .card { margin-top: 12px; } }
.big-num { font-size: 28px; font-weight: 700; }

svg.viz { width: 100%; height: auto; display: block; overflow: visible; }
svg.viz .grid { stroke: var(--viz-grid); stroke-width: 1; }
svg.viz .axis { stroke: var(--viz-axis); stroke-width: 1; }
svg.viz .tick { fill: var(--viz-tick); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.viz .val { fill: var(--ink); font-size: 12px; font-weight: 600; }
svg.viz .bar { fill: var(--viz-1); }
svg.viz .hit { fill: transparent; cursor: default; outline: none; }
svg.viz .hit:hover, svg.viz .hit:focus-visible { fill: var(--ink); fill-opacity: .05; }

.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 10px; align-items: center; border-radius: 6px; outline: none; padding: 2px 4px; margin: 0 -4px; }
.hbar:hover, .hbar:focus-visible { background: var(--bg); }
.hbar-l { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar-fill { height: 18px; background: var(--viz-1); border-radius: 0 4px 4px 0; flex: 0 0 auto; max-width: calc(100% - 100px); }
.hbar-fill.r1 { background: var(--viz-r1); } .hbar-fill.r2 { background: var(--viz-r2); } .hbar-fill.r3 { background: var(--viz-r3); }
.hbar-fill.r4 { background: var(--viz-r4); } .hbar-fill.r5 { background: var(--viz-r5); }
.hbar-v { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.meter { display: inline-block; vertical-align: middle; width: 100px; height: 8px; border-radius: 4px; background: var(--viz-track); margin-right: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--viz-1); border-radius: 4px; }

details.viz-table { margin-top: 10px; }
details.viz-table summary { cursor: pointer; font-size: 13px; color: var(--accent); }

#viz-tip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.12);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; display: flex; flex-direction: column; max-width: 260px;
}
#viz-tip.on { opacity: 1; }
#viz-tip strong { font-variant-numeric: tabular-nums; }
#viz-tip span { color: var(--muted); font-size: 12px; }
@media (forced-colors: active) { .hbar-fill, svg.viz .bar, .meter span { forced-color-adjust: none; background: CanvasText; fill: CanvasText; } }
.grid3 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .grid3 { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.grid3 > .card + .card { margin-top: 0; }
.grid3 .hbar { grid-template-columns: 1fr; gap: 3px; }
.grid3 .hbars { gap: 8px; }

/* ------------------------------------------------------------ timesheets */
.card.clock { margin-bottom: 12px; }
.card.clock.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.clock-time { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
button.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.time-row details.fold { margin-top: 6px; padding-top: 6px; }

.tbl.payout tr.total td { border-top: 2px solid var(--line); }

/* ------------------------------------------------------------- demo bar */
#demobar {
  position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
  padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid var(--line); font-size: 14px;
}
#demobar .demo-note { color: var(--muted); font-size: 13px; }
#demobar .demo-as { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; font-size: 13px; }
#demobar select { width: auto; padding: 5px 8px; font-size: 14px; }
/* Computers: the bar sits beside the sidebar (which already shows the logo), on one line, buttons to the right. */
@media (min-width: 860px) {
  #demobar { margin-left: var(--nav-w); }
  #demobar .demo-note { flex: 1; min-width: 0; }
  body.in-demo #demobar .demo-brand .brand-logo { display: none; }
}
@media (max-width: 600px) { #demobar .demo-note { display: none; } }
/* Public demo: one slim line, like the portal pages' demo bar. */
#demobar.slim { gap: 4px 14px; padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 6px; font-size: 14px; line-height: 1.35; }
#demobar.slim .db-pill { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; border: 1.5px solid currentColor; border-radius: 980px; padding: 0 7px; }
#demobar.slim .db-label { font-weight: 600; min-width: 0; }
#demobar.slim .db-acts { margin-left: auto; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
#demobar.slim a, #demobar.slim button { color: inherit; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px;
  background: none; border: 0; padding: 0; margin: 0; min-height: 0; width: auto; cursor: pointer; }
#demobar.slim form { display: inline; margin: 0; }

/* ------------------------------------------------------------ Apple look
   Matches the customer portal and booking page: grey canvas, borderless
   rounded cards, pill buttons, soft focus rings, frosted navigation. */

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.01em; -webkit-font-smoothing: antialiased;
}
h1 { font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 15px; font-weight: 600; }
.page-head { margin-bottom: 20px; }
.page-head .sub { font-size: 15px; }
@media (max-width: 600px) { h1 { font-size: 26px; } }

/* Cards and tiles: no borders, soft shadow, generous corners. */
.card, .stat { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .stat { box-shadow: none; }
.card { padding: 18px 20px; }
.card-head.pad { padding: 18px 20px 0; }
.pad-x { margin: 0 20px 18px; }
.stat { padding: 14px 16px; }
.stat .v { font-size: 26px; letter-spacing: -.02em; }
.stat .l { font-size: 13px; }
.stats.inner .stat { box-shadow: none; border-radius: 14px; }
.device, fieldset.perm-group { border-radius: 14px; }
.card.clock.on { box-shadow: 0 0 0 2px var(--accent); }

/* Lists: inset separators like iOS. */
.list > li { border-top: 0; position: relative; }
.list > li + li::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--hair); }
.list a.item, .list .item { padding: 13px 18px; }
.list a.item:hover { background: var(--accent-soft); text-decoration: none; }
.day-h { background: transparent; border-top: 0; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: 12px; padding: 16px 18px 6px; }
.day-h.today { color: var(--accent); }
.tbl th, .tbl td { border-bottom-color: var(--hair); }
.tbl th { letter-spacing: .02em; font-size: 11px; }

/* Buttons: pills. */
button, .btn { border-radius: 980px; font-weight: 500; font-size: 15px; padding: 10px 18px; color: var(--accent); letter-spacing: -.01em; }
button.primary, .btn.primary { color: var(--accent-ink); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.06); }
button.small, .btn.small { padding: 6px 12px; font-size: 13px; }
button.link, .link-row { border-radius: 0; }
.link-row { color: var(--ink); }
button.danger { color: var(--bad); }

/* Fields: rounded, with a soft focus ring. */
label { font-size: 13px; color: var(--muted); }
input, select, textarea { border-radius: 12px; padding: 11px 14px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
select { -webkit-appearance: none; appearance: none; padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); box-shadow: none; }
.check { color: var(--ink); }
.check input, .check input:focus { box-shadow: none; }

/* Tabs: a segmented look. */
.tabs a { border: 0; background: var(--panel); box-shadow: var(--shadow); padding: 7px 14px; font-weight: 500; }
.tabs a.on { background: var(--ink); color: var(--bg); box-shadow: none; }

/* Badges and banners. */
.badge { border: 0; font-weight: 500; padding: 3px 9px; }
.banner { border-radius: 16px; padding: 16px 18px; }
details.fold { border-top-color: var(--hair); }

/* Navigation: frosted glass tab bar on phones, sidebar on desktop. */
#nav { background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-color: var(--hair); }
#nav a { font-weight: 500; }
@media (min-width: 860px) {
  #nav .brand { color: var(--ink); font-weight: 700; letter-spacing: -.02em; font-size: 19px; }
  #nav a { border-radius: 10px; }
  #nav a.on { font-weight: 600; }
  #nav .who { border-top-color: var(--hair); }
  #view { padding: 32px 40px 56px; }
}

/* Sign-in screens. */
.auth.card { padding: 28px; }
.auth .logo { color: var(--ink); letter-spacing: -.03em; font-size: 30px; }

/* Toast and pop-ups. */
#toast { border-radius: 12px; padding: 12px 18px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
#viz-tip { border-radius: 12px; border-color: var(--hair); }
#demobar { border-bottom-color: var(--hair); }
pre.msg { border-radius: 12px; }
.photo-grid img { border-radius: 12px; border-color: var(--hair); }

/* ------------------------------------------------ demo: phone view switch */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; color: var(--ink); cursor: pointer; margin: 0 6px 0 0; }
.switch input { -webkit-appearance: none; appearance: none; width: 44px; height: 26px; padding: 0; margin: 0; border: 0; border-radius: 13px;
  background: var(--line); position: relative; cursor: pointer; flex: 0 0 auto; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { box-shadow: 0 0 0 4px var(--accent-soft); }
.phone-switch { display: none; }
@media (min-width: 860px) { .phone-switch { display: inline-flex; } }

#phoneview { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; overflow: auto; padding: 0 16px 24px; }
#phoneview .pv-bar { width: 100%; max-width: 900px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; }
.pv-device { position: relative; height: min(844px, calc(100vh - 100px)); aspect-ratio: 390 / 844; flex: 0 0 auto;
  border: 12px solid #1d1d1f; border-radius: 54px; background: #000; box-shadow: 0 0 0 2px #3a3a3c, 0 30px 60px rgba(0, 0, 0, .25); overflow: hidden; }
.pv-device iframe { width: 100%; height: 100%; border: 0; display: block; border-radius: 42px; background: var(--bg); }
.pv-notch { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 110px; height: 30px; border-radius: 20px; background: #000; z-index: 2; pointer-events: none; }
body.phone-open { overflow: hidden; }
@media (max-width: 859px) { #phoneview { display: none; } body.phone-open { overflow: auto; } }
/* The app inside the frame: room for the camera cut-out at the top. */
.in-phone-frame body { padding-top: 34px; }
.in-phone-frame, .in-phone-frame body { scrollbar-width: none; }
.in-phone-frame ::-webkit-scrollbar { display: none; }
.in-phone-frame #demobar { top: 0; padding-top: 8px; }

/* --------------------------------------------------- schedule: block calendar */
.seg { display: inline-flex; background: var(--line); border-radius: 980px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; min-height: 30px; padding: 4px 14px; font-size: 13px; color: var(--ink); border-radius: 980px; }
.seg button.on { background: var(--panel); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); font-weight: 600; }
.seg button:disabled { opacity: .35; }
.cal-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-tools .seg button[data-action="cal-zoom"] { font-size: 18px; line-height: 1; padding: 2px 14px; }

.cal { --hour: 64px; overflow: hidden; }
.cal-scroll { overflow: auto; max-height: 72vh; position: relative; }
.cal-head, .cal-body { display: grid; min-width: min-content; }
.cal-head { position: sticky; top: 0; z-index: 4; background: var(--panel); border-bottom: 1px solid var(--hair); }
.cal-head div { padding: 10px 6px; text-align: center; font-size: 13px; color: var(--muted); }
.cal-head strong { font-size: 17px; color: var(--ink); }
.cal-head .today strong { background: var(--accent); color: var(--accent-ink); border-radius: 50%; display: inline-block; width: 28px; height: 28px; line-height: 28px; }
.cal-head > div:first-child, .cal-hours { position: sticky; left: 0; z-index: 3; background: var(--panel); }
.cal-hours div { height: var(--hour); font-size: 11px; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.cal-hours div:first-child { transform: none; }
.cal-col { position: relative; border-left: 1px solid var(--hair); }
.cal-col.today { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.cal-slot { height: var(--hour); border-top: 1px solid var(--hair); }
.cal-slot:first-child { border-top: 0; }
.cal-block { position: absolute; overflow: hidden; border-radius: 8px; padding: 3px 8px; font-size: 13px; line-height: 16px; text-decoration: none;
  color: var(--ink); border-left: 3px solid var(--accent); background: var(--accent-soft); display: block; z-index: 1; }
.cal-block:hover { text-decoration: none; filter: brightness(.97); z-index: 2; }
.cal-block b, .cal-block strong { font-weight: 700; }
.cal-block b { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-block span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-block .t { font-size: 12px; }
.cal-block.tight { white-space: nowrap; text-overflow: ellipsis; padding-top: 2px; font-size: 12px; }
.cal-block.k-mitigation { border-left-color: var(--warn); background: var(--warn-soft); }
.cal-block.k-post_test { border-left-color: var(--ok); background: var(--ok-soft); }
.cal-block.k-service { border-left-color: var(--info); background: var(--info-soft); }
.cal-block.done { opacity: .6; }
.cal-block.cancelled { opacity: .45; text-decoration: line-through; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.cal-key { display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; margin: 10px 2px 0; }
.cal-key span { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: -8px; vertical-align: -2px; background: var(--accent-soft); border-left: 3px solid var(--accent); }
.cal-key .k-mitigation { background: var(--warn-soft); border-left-color: var(--warn); }
.cal-key .k-post_test { background: var(--ok-soft); border-left-color: var(--ok); }
.cal-key .k-service { background: var(--info-soft); border-left-color: var(--info); }

.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 10px; max-width: 560px; }
.cal-days a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 8px; border-radius: 12px; color: var(--ink); text-decoration: none; position: relative; }
.cal-days a:hover { text-decoration: none; background: var(--accent-soft); }
.cal-days a span { font-size: 11px; color: var(--muted); }
.cal-days a strong { font-size: 17px; width: 32px; height: 32px; line-height: 32px; text-align: center; border-radius: 50%; }
.cal-days a.today strong { color: var(--accent); }
.cal-days a.on strong { background: var(--ink); color: var(--bg); }
.cal-days a.today.on strong { background: var(--accent); color: var(--accent-ink); }
.cal-days a i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); position: absolute; bottom: 2px; }

/* ------------------------------------------------------- phones: no cut-off text */
@media (max-width: 600px) {
  .item .t, .item .s { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .item .s { margin-top: 2px; line-height: 1.35; }
  .list a.item, .list .item { align-items: flex-start; }
  .list a.item, .list .item { flex-wrap: wrap; row-gap: 6px; }
  .item .main { flex: 1 1 0; }
  .item .r { flex-basis: 100%; order: 3; text-align: left; display: flex; flex-wrap: wrap; gap: 4px; }
  .item:has(.time) .r { padding-left: 84px; }
  .item .r { align-items: center; }
  .item .r .rsep { display: inline; height: auto; }
  .item .r .rsep::before { content: "·"; color: var(--muted); }
  .item .r:empty { display: none; }
  .device .spread { flex-wrap: wrap; row-gap: 2px; }
  .device .spread > .small { white-space: normal; }
  .page-head h1 { overflow-wrap: anywhere; }
  .banner { align-items: flex-start; }
  .actions { width: 100%; }
}
textarea { field-sizing: content; min-height: 80px; max-height: 320px; }

/* Tables marked .stack become one card per row on phones, each value labeled. */
@media (max-width: 600px) {
  .scroll-x:has(> table.stack) { overflow: visible; }
  table.tbl.stack thead { display: none; }
  table.tbl.stack, table.tbl.stack tbody, table.tbl.stack tr, table.tbl.stack td { display: block; width: auto; }
  table.tbl.stack tr { padding: 12px 16px; border-top: 1px solid var(--hair); }
  table.tbl.stack tr:first-child { border-top: 0; }
  table.tbl.stack td { border: 0; padding: 4px 0 !important; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-align: right; }
  table.tbl.stack td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex: 0 0 auto; }
  table.tbl.stack td > div { min-width: 0; overflow-wrap: break-word; }
  table.tbl.stack td.stack-title { font-size: 17px; padding-bottom: 6px !important; }
  table.tbl.stack td.stack-title::before, table.tbl.stack td.stack-actions::before { content: none; }
  table.tbl.stack td.stack-actions { justify-content: flex-start; }
  table.tbl.stack td.stack-actions:empty { display: none; }
  table.tbl.stack td.stack-actions { flex-wrap: wrap; gap: 4px 10px; padding-top: 8px !important; }
  table.tbl.stack td.num { text-align: right; }
  table.tbl.stack select { width: auto; max-width: 60vw; min-width: 0 !important; }
  table.tbl.stack .meter { width: 80px; }
  table.tbl.stack tr.edit-row td::before { content: none; }
}

/* Sales: Total sold */
.sold-total .v { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.sold-total { margin-top: 4px; margin-bottom: 8px; }
#sold .card-head { flex-wrap: wrap; gap: 8px; }

/* The crew's installation work order */
.wo .wo-addr { font-size: 19px; margin: 0 0 4px; line-height: 1.3; }
.wo .wo-when { margin: 0 0 12px; }
.wo .wo-route { margin: 0 0 12px; }
.wo .wo-route strong { font-size: 17px; }
.wo .wo-h { font-size: 15px; margin: 16px 0 6px; text-transform: none; }
.wo dl.facts { margin: 0; }
.wo .wo-confirm { margin: 0; padding-left: 20px; }
.wo .wo-confirm li { margin: 4px 0; }
.wo-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.wo-photos a { display: block; text-decoration: none; color: inherit; }
.wo-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2, #f4f4f4); }
.wo-photos span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
fieldset.plan { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 0; margin: 0 0 10px; }
fieldset.plan legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
dl.facts { display: grid; gap: 8px; margin: 0; }
dl.facts > div { display: grid; grid-template-columns: minmax(96px, 32%) 1fr; gap: 10px; }
dl.facts dt { color: var(--muted); font-size: 13px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { dl.facts > div { grid-template-columns: 1fr; gap: 0; } }

/* Two-step sign-in */
.qr-box { background: #fff; border-radius: 12px; padding: 10px; width: 220px; max-width: 100%; margin: 0 auto; }
.qr-box svg { display: block; width: 100%; height: auto; }
.mono-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: .04em; word-break: break-all; background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 0 0 12px; user-select: all; }
pre.recovery { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; line-height: 1.7; background: var(--bg); border-radius: 10px; padding: 12px 14px; margin: 10px 0 0; columns: 2; user-select: all; }

/* A company logo in the sidebar (where a deployment has one) */
.brand-logo { display: block; width: auto; color: var(--ink); }
#nav .brand-mr { padding: 4px 10px 2px; }
#nav .brand-mr .brand-logo { height: 30px; }
#demobar .demo-brand { display: inline-flex; align-items: center; gap: 8px; }
#demobar .demo-brand .brand-logo { height: 22px; color: inherit; }

/* Devices: back from calibration */
form.dev-back { display: grid; gap: 4px; margin: 0; }
.dev-back-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dev-back-row input[type=date] { width: auto; min-width: 0; padding: 6px 8px; }

/* In-page confirmation (replaces browser pop-ups, which embedded views block) */
.ask-back { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .38); display: flex; align-items: center; justify-content: center; padding: 16px; animation: ask-in .14s ease-out; }
.ask { background: var(--panel); color: var(--ink); border-radius: 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, .28); padding: 22px 22px 18px; width: 100%; max-width: 420px; }
.ask p { margin: 0 0 16px; font-size: 15px; line-height: 1.45; }
.ask-field { width: 100%; margin: 0 0 16px; font: inherit; }
.ask-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.ask-row button { min-width: 96px; }
@keyframes ask-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ask-back { animation: none; } }
@media (max-width: 480px) { .ask-row button { flex: 1; } }

/* Quote for the results: what Sales still needs */
.quote-need { border-left: 4px solid var(--warn); }
ul.checklist { margin: 6px 0 12px; padding-left: 20px; }
ul.checklist li { margin: 3px 0; }

/* Needs attention: grouped look-alikes and the folded tail */
li.fu-group > details > summary { list-style: none; cursor: pointer; }
li.fu-group > details > summary::-webkit-details-marker { display: none; }
li.fu-group .fu-toggle::after { content: "Show"; }
li.fu-group > details[open] .fu-toggle::after { content: "Hide"; }
li.fu-group > details > .list { background: var(--accent-soft); }
li.more-row > details > summary { list-style: none; cursor: pointer; padding: 12px 18px; color: var(--accent); font-weight: 600; font-size: 14px; }
li.more-row > details > summary::-webkit-details-marker { display: none; }
li.more-row > details[open] > summary { display: none; }
.list .empty a { font-weight: 600; }

/* Schedule: an empty day says what's next */
.cal-empty { margin: 4px 0 12px; padding: 18px; border-radius: var(--radius); background: var(--panel); color: var(--muted); text-align: center; }
.cal-empty a { font-weight: 600; }

/* Jobs list search */
.list-filter { margin: 0 0 12px; }
.list-filter input { width: 100%; }

/* Job page: settled sections folded to one line */
details.fold-card { margin-top: 12px; }
details.fold-card + .card, .grid2 > div > details.fold-card:first-child { margin-top: 12px; }
.grid2 > div > details.fold-card:first-child { margin-top: 0; }
details.fold-card > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
details.fold-card > summary::-webkit-details-marker { display: none; }
details.fold-card > summary:hover { border-color: var(--accent); }
details.fold-card > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
details.fold-card .fc-t { font-weight: 650; font-size: 17px; }
details.fold-card .fc-n { color: var(--muted); font-size: 14px; flex: 1; min-width: 0; }
details.fold-card .fc-x { color: var(--accent); font-size: 20px; line-height: 1; }
details.fold-card[open] > summary { display: none; }

/* Price and other tables: amounts never wrap, descriptions get the room */
.tbl td.num { white-space: nowrap; width: 1%; }

/* Price lines in a narrow column: the description gets the full width, the amount sits under it */
.price-card { container-type: inline-size; }
.tbl.lines td:last-child button { padding: 2px 4px; }
@container (max-width: 380px) {
  .tbl.lines tr { display: grid; grid-template-columns: 1fr auto; }
  .tbl.lines td:first-child { grid-column: 1 / -1; border-bottom: 0; padding-bottom: 0; }
  .tbl.lines td.num { width: auto; padding-top: 4px; }
  .tbl.lines tr > td:only-child, .tbl.lines tr > td:first-child:nth-last-child(2) { border-bottom: 0; }
  .tbl.lines tr > td:first-child:nth-last-child(2) + td.num { grid-column: 1 / -1; }
}

/* Price book: prices edited in place */
.price-edit { display: inline-flex; align-items: center; gap: 4px; }
.price-in { width: 96px; text-align: right; padding: 6px 8px; font-variant-numeric: tabular-nums; }

/* Public demo: marks what a trade built on top of the Desk engine */
.trade-tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 980px; padding: 1px 8px; white-space: nowrap; vertical-align: middle; line-height: 1.6; }
h1 .trade-tag { position: relative; top: -4px; margin-left: 6px; }
.card-head .trade-tag { margin-right: auto; margin-left: 8px; }

/* ------------------------------------------------------------ iPhone
   Phones only (a computer keeps the sidebar layout above). As in an iPhone app: a frosted tab bar, a back
   button above a job or a client (and "More" above the pages under More), large titles, cards without
   outlines, filled fields, list rows with a chevron, and the long secondary cards on a job folded. */
.m-nav { display: none; }
@media (max-width: 859px) {
  #nav { background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--hair); }
  .m-nav { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; min-height: 44px; margin: -16px -16px 8px;
    padding: env(safe-area-inset-top) 16px 0 6px; background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-bottom: .5px solid var(--hair); }
  .m-back { display: inline-flex; align-items: center; gap: 1px; padding: 10px 10px 10px 2px; color: var(--accent); font-size: 17px; text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .m-back svg { width: 22px; height: 22px; flex: none; }
  .page-head h1 { font-size: 30px; letter-spacing: -.025em; line-height: 1.12; }
  .card, .stat { border-color: transparent; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]), select, textarea {
    min-height: 44px; padding: 11px 13px; border-color: transparent; border-radius: 11px; background-color: var(--fill); font-size: 17px; }
  input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus { outline: none; border-color: transparent; box-shadow: 0 0 0 3px var(--accent-soft); }
  .search { max-width: none; }
  .list > li { border-top-width: .5px; }
  .list a.item { position: relative; padding-right: 34px; -webkit-tap-highlight-color: transparent; }
  .list a.item::after { content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -5px; border: solid var(--chev);
    border-width: 2px 2px 0 0; transform: rotate(45deg); }
  .list a.item:active { background: var(--bg); }
  /* A heading that shares its row with tags and notes: the title gets the full width, the rest goes under it. */
  .card-head:has(> :nth-child(3)) { flex-wrap: wrap; justify-content: flex-start; row-gap: 6px; }
  .card-head:has(> :nth-child(3)) > h2 { flex: 1 1 100%; }
  /* Folded cards: the heading is a row you tap to open them. */
  .card.foldable > .card-head, .card.foldable > h2 { position: relative; padding-right: 30px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .card.foldable > .card-head::after, .card.foldable > h2::after { content: ""; position: absolute; right: 6px; top: 50%; width: 8px; height: 8px; margin-top: -7px;
    border: solid var(--chev); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .2s ease; }
  .card.foldable.folded > .card-head::after, .card.foldable.folded > h2::after { margin-top: -4px; transform: rotate(-45deg); }
  .card.folded > .card-head, .card.folded > h2 { margin-bottom: 0; }
  .card.folded > :not(.card-head):not(h2) { display: none !important; }
  .card.foldable > .card-head:focus-visible, .card.foldable > h2:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
}
@media (max-width: 859px) and (prefers-reduced-motion: reduce) { .card.foldable > .card-head::after, .card.foldable > h2::after { transition: none; } }
