/* Prenet Lighting Dashboard - same visual system as PLS-DMX (Liquid Glass), tuned for gloves on a job site.
   Floating bars (header, bottom action bar, sheets, menus) are glass. Content (cards, rows, tiles) is a quiet
   filled surface. The accent means "main action" or "selected" and nothing else.
   Status colors are the Okabe-Ito colorblind-safe set and always come with an icon, never color alone.
   Type: 12 caption · 15 text · 17 titles · 22 headings. Tap targets: 44px minimum, 52px for answers. */

:root {
  --tx: 1;
  --bg: #05070a;
  --inset: #080a0d;
  --surface-1: #0e1116;
  --surface-2: #151a21;
  --surface-3: #1d232c;
  --surface-4: #2a313b;
  --line: rgba(255, 255, 255, .06);
  --line-strong: rgba(255, 255, 255, .12);
  --card-edge: inset 0 1px 0 rgba(255, 255, 255, .045);

  --glass-tint: rgba(26, 31, 39, .62);
  --glass-thick: rgba(20, 24, 32, .86);
  --glass-fill: rgba(255, 255, 255, .07);
  --glass-fill-hover: rgba(255, 255, 255, .11);
  --glass-fill-press: rgba(255, 255, 255, .16);
  --glass-edge: rgba(255, 255, 255, .09);
  --glass-hl: inset 0 1px 0 rgba(255, 255, 255, .10);
  --glass-blur: blur(24px) saturate(135%);
  --shadow-bar: 0 1px 2px rgba(0, 0, 0, .28), 0 8px 24px rgba(0, 0, 0, .26);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, .32), 0 24px 56px rgba(0, 0, 0, .5);

  --text: #f1f3f6;
  --text-2: #c3cad3;
  --text-3: #98a1ac;
  --on-accent: #fff;

  --accent: #5b8def;
  --accent-fill: #4971bf;
  --accent-strong: #8cb0f5;
  --accent-tint: rgba(91, 141, 239, .16);

  /* states (Okabe-Ito) */
  --done: #009e73;   --done-tint: rgba(0, 158, 115, .2);   --done-text: #5fd3ad;
  --issue: #d55e00;  --issue-tint: rgba(213, 94, 0, .22);  --issue-text: #ff9f5c;
  --prog: #e69f00;   --prog-tint: rgba(230, 159, 0, .18);  --prog-text: #f3c35a;
  --todo: #6b7480;   --todo-tint: rgba(107, 116, 128, .16);
  --danger: #e5484d; --danger-text: #ff9296;

  --r-sm: 10px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-sheet: 24px; --r-pill: 999px;
  --s-1: 4px; --s-2: 6px; --s-3: 8px; --s-4: 12px; --s-5: 16px; --s-6: 20px; --s-7: 28px;

  --fs-xs: calc(12px * var(--tx));
  --fs-md: calc(15px * var(--tx));
  --fs-lg: calc(17px * var(--tx));
  --fs-xl: calc(22px * var(--tx));
  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --h-ctl: calc(44px * max(1, var(--tx)));
  --h-big: calc(52px * max(1, var(--tx)));
  --ease: 140ms cubic-bezier(.23, 1, .32, 1);
  --ease-sheet: 220ms cubic-bezier(.32, .72, 0, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef1f5;
  --inset: #ffffff;
  --surface-1: #f6f8fa;
  --surface-2: #ffffff;
  --surface-3: #f0f3f6;
  --surface-4: #e2e7ed;
  --line: rgba(15, 23, 42, .07);
  --line-strong: rgba(15, 23, 42, .14);
  --card-edge: 0 1px 2px rgba(15, 23, 42, .06);
  --glass-tint: rgba(255, 255, 255, .66);
  --glass-thick: rgba(255, 255, 255, .9);
  --glass-fill: rgba(15, 23, 42, .05);
  --glass-fill-hover: rgba(15, 23, 42, .08);
  --glass-fill-press: rgba(15, 23, 42, .12);
  --glass-edge: rgba(15, 23, 42, .1);
  --glass-hl: inset 0 1px 0 rgba(255, 255, 255, .8);
  --shadow-bar: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .08);
  --shadow-pop: 0 2px 6px rgba(15, 23, 42, .1), 0 24px 56px rgba(15, 23, 42, .18);
  --text: #0f172a;
  --text-2: #334155;
  --text-3: #5b6676;
  --accent: #2f66d0;
  --accent-fill: #2f66d0;
  --accent-strong: #2456b8;
  --accent-tint: rgba(47, 102, 208, .12);
  --done-text: #00785a;
  --issue-text: #b14d00;
  --prog-text: #8a5f00;
  --danger-text: #c4282d;
  color-scheme: light;
}
:root[data-large] { --tx: 1.2; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: radial-gradient(1200px 760px at 10% -10%, rgba(91, 141, 239, .07), transparent 62%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: var(--fs-md)/1.45 var(--font);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-strong); }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-xs); }
.spacer { flex: 1; }
h1, h2, h3 { margin: 0; }
h2 { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: var(--fs-md); font-weight: 600; color: var(--text-2); margin: var(--s-6) 0 var(--s-3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ glass bars */
.glass {
  background: var(--glass-tint);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-hl), var(--shadow-bar);
}
header.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s-3);
  margin: var(--s-3); padding: var(--s-2) var(--s-3);
  border-radius: var(--r-xl);
  padding-top: max(var(--s-2), env(safe-area-inset-top, 0px));
}
header.top .titles { min-width: 0; flex: 1; }
header.top .t1 { font-size: var(--fs-lg); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top .t2 { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { display: flex; align-items: center; gap: var(--s-3); }
.brand img { width: 30px; height: 30px; }

.bottomBar {
  position: fixed; left: var(--s-3); right: var(--s-3); bottom: calc(var(--s-3) + var(--safe-b)); z-index: 20;
  display: flex; gap: var(--s-3); padding: var(--s-3);
  border-radius: var(--r-xl);
  max-width: 944px; margin: 0 auto;
  overflow-x: auto; scrollbar-width: none;
}
.bottomBar::-webkit-scrollbar { display: none; }
/* buttons share the bar and shrink their label instead of wrapping or scrolling off */
.bottomBar .btn { flex: 1 1 auto; min-width: 0; padding: 0 var(--s-4); overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 400px) { .bottomBar .btn { font-size: calc(14px * var(--tx)); padding: 0 var(--s-3); } }

main { max-width: 960px; margin: 0 auto; padding: var(--s-3) var(--s-4) calc(110px + var(--safe-b)); }

/* ------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--h-ctl); padding: 0 var(--s-5);
  border: 1px solid var(--glass-edge); border-radius: var(--r-md);
  background: var(--glass-fill); box-shadow: var(--glass-hl);
  font-weight: 600; white-space: nowrap; cursor: pointer; text-decoration: none; color: var(--text);
  transition: background var(--ease), transform var(--ease);
}
.btn:hover { background: var(--glass-fill-hover); }
.btn:active { background: var(--glass-fill-press); transform: scale(.98); }
.btn.primary { background: var(--accent-fill); border-color: transparent; color: var(--on-accent); }
.btn.danger { color: var(--danger-text); }
.btn.big { min-height: var(--h-big); font-size: var(--fs-lg); }
.btn.icon { padding: 0; width: var(--h-ctl); flex: none; font-size: 20px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg, .ico { width: 20px; height: 20px; flex: none; }

.chip {
  display: inline-flex; align-items: center; gap: var(--s-1);
  min-height: 32px; padding: 0 var(--s-4); border-radius: var(--r-pill);
  background: var(--glass-fill); border: 1px solid var(--glass-edge);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; cursor: pointer;
}
.chip.on { background: var(--accent-tint); border-color: transparent; color: var(--accent-strong); }
.chip.static { cursor: default; }
.chips { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }

.syncBadge { min-height: 32px; }
.syncBadge.pending { background: var(--prog-tint); color: var(--prog-text); border-color: transparent; }
.syncBadge.bad { background: var(--issue-tint); color: var(--issue-text); border-color: transparent; }

input.field, select.field, textarea.field {
  width: 100%; min-height: var(--h-ctl); padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--inset); outline: none;
  font-size: max(16px, var(--fs-md)); /* 16px+ stops iOS zooming in */
}
textarea.field { min-height: 96px; resize: vertical; }
input.field:focus, select.field:focus, textarea.field:focus { border-color: var(--accent); }
label.lbl { display: block; font-size: var(--fs-xs); color: var(--text-3); margin: var(--s-4) 0 var(--s-1); font-weight: 600; }
.search { position: relative; }
.search input { padding-left: 40px; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }

/* ------------------------------------------------------------ content */
.card {
  background: var(--surface-2); border-radius: var(--r-lg); box-shadow: var(--card-edge);
  padding: var(--s-5);
}
.list { display: flex; flex-direction: column; gap: var(--s-3); }
.row {
  display: flex; align-items: center; gap: var(--s-4);
  min-height: 64px; padding: var(--s-4) var(--s-5);
  background: var(--surface-2); border-radius: var(--r-lg); box-shadow: var(--card-edge);
  color: inherit; text-decoration: none; cursor: pointer; border: 0; width: 100%; text-align: left;
}
.row:active { background: var(--surface-3); }
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 600; font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: var(--fs-xs); color: var(--text-3); }
.row .chev { color: var(--text-3); font-size: 22px; }
.pageHead { display: flex; align-items: flex-end; gap: var(--s-4); margin: var(--s-4) 0 var(--s-5); flex-wrap: wrap; }
.pageHead .sub { color: var(--text-3); font-size: var(--fs-xs); }
.toolbar { display: flex; gap: var(--s-3); align-items: center; margin-bottom: var(--s-4); }
.toolbar .search { flex: 1; }
.empty { text-align: center; padding: var(--s-7) var(--s-5); color: var(--text-3); }
.empty b { display: block; color: var(--text-2); font-size: var(--fs-lg); margin-bottom: var(--s-2); }
.banner { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); margin: 0 var(--s-3) var(--s-3); border-radius: var(--r-md); font-size: var(--fs-xs); font-weight: 600; }
.banner.warn { background: var(--prog-tint); color: var(--prog-text); }
.banner.bad { background: var(--issue-tint); color: var(--issue-text); }

/* progress */
.bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-4); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .d { background: var(--done); }
.bar .x { background: var(--issue); }
.bar .p { background: var(--prog); }
.pct { font-variant-numeric: tabular-nums; font-weight: 700; }
.legend { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-3); margin: var(--s-2) 0 var(--s-4); }
.legend span { display: inline-flex; gap: var(--s-1); align-items: center; }

/* status mark: color + icon */
.st { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-pill); font-weight: 800; font-size: 14px; flex: none; }
.st-done { background: var(--done-tint); color: var(--done-text); }
.st-issue { background: var(--issue-tint); color: var(--issue-text); }
.st-prog { background: var(--prog-tint); color: var(--prog-text); }
.st-todo, .st-empty { background: var(--todo-tint); color: var(--text-3); }

/* room tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.tile {
  display: flex; flex-direction: column; gap: var(--s-2);
  min-height: 92px; padding: var(--s-4); border-radius: var(--r-lg);
  background: var(--surface-2); box-shadow: var(--card-edge); color: inherit; text-decoration: none; cursor: pointer;
  border-left: 5px solid var(--todo);
}
.tile.t-done { border-left-color: var(--done); }
.tile.t-issue { border-left-color: var(--issue); }
.tile.t-prog { border-left-color: var(--prog); }
.tile .num { font-weight: 700; font-size: var(--fs-lg); display: flex; align-items: center; gap: var(--s-2); }
.tile .nm { font-size: var(--fs-xs); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .bar { margin-top: auto; height: 6px; }
.pend { font-size: 11px; font-weight: 700; color: var(--prog-text); }

/* tabs */
.tabs { display: flex; gap: var(--s-1); padding: var(--s-1); border-radius: var(--r-md); background: var(--surface-1); margin-bottom: var(--s-4); }
.tabs button { flex: 1; min-height: var(--h-ctl); border: 0; background: none; border-radius: var(--r-sm); font-weight: 600; color: var(--text-3); cursor: pointer; white-space: nowrap; padding: 0 var(--s-2); font-size: var(--fs-md); }
.tabs button.on { background: var(--surface-3); color: var(--text); box-shadow: var(--card-edge); }

/* checklist (truth table) */
.q { background: var(--surface-2); border-radius: var(--r-lg); box-shadow: var(--card-edge); padding: var(--s-4); }
.q .qTop { display: flex; gap: var(--s-3); align-items: flex-start; margin-bottom: var(--s-3); }
.q .qLabel { flex: 1; font-weight: 600; font-size: var(--fs-lg); }
.q .meta { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; font-weight: 400; }
.q .qNote { margin-top: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface-3); font-size: var(--fs-md); white-space: pre-wrap; cursor: pointer; }
.tri { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s-2); }
.tv {
  min-height: var(--h-big); border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--surface-3); font-weight: 700; font-size: var(--fs-lg); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  transition: background var(--ease), transform var(--ease);
}
.tv:active { transform: scale(.97); }
.tv.yes.on { background: var(--done); border-color: var(--done); color: #fff; }
.tv.no.on { background: var(--issue); border-color: var(--issue); color: #fff; }
.tv.na.on { background: var(--surface-4); border-color: var(--text-3); color: var(--text); }

/* sheets (dialogs) */
dialog.sheet {
  border: 1px solid var(--glass-edge); padding: 0; color: var(--text);
  background: var(--glass-thick); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hl), var(--shadow-pop);
  border-radius: var(--r-sheet); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .45); }
dialog.sheet form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.sheetHead { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5) var(--s-5) var(--s-2); }
.sheetHead h2 { flex: 1; font-size: var(--fs-lg); }
.sheetBody { padding: 0 var(--s-5) var(--s-4); overflow-y: auto; }
.sheetFoot { display: flex; gap: var(--s-3); padding: var(--s-4) var(--s-5) calc(var(--s-5) + var(--safe-b)); }
.sheetFoot .btn { flex: 1; }
@media (max-width: 640px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: var(--r-sheet) var(--r-sheet) 0 0; border-bottom: 0; }
  dialog.sheet[open] { animation: sheetUp var(--ease-sheet); }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } }

.menuList { display: flex; flex-direction: column; gap: var(--s-2); }
.menuList .btn { justify-content: flex-start; }
.seg { display: flex; gap: var(--s-1); padding: var(--s-1); background: var(--surface-1); border-radius: var(--r-md); }
.seg button { flex: 1; min-height: 40px; border: 0; background: none; border-radius: var(--r-sm); font-weight: 600; cursor: pointer; color: var(--text-3); }
.seg button.on { background: var(--surface-3); color: var(--text); }

/* model search suggestions */
.suggest { margin-top: var(--s-2); border-radius: var(--r-md); background: var(--surface-1); max-height: 220px; overflow-y: auto; }
.suggest button { display: block; width: 100%; text-align: left; padding: var(--s-3) var(--s-4); min-height: 44px; border: 0; background: none; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest button b { display: block; }
.suggest button span { font-size: var(--fs-xs); color: var(--text-3); }
.warnText { color: var(--prog-text); font-size: var(--fs-xs); margin-top: var(--s-2); font-weight: 600; }
.errText { color: var(--danger-text); font-size: var(--fs-xs); margin-top: var(--s-2); font-weight: 600; }

/* notes / history */
.msg { background: var(--surface-2); border-radius: var(--r-lg); box-shadow: var(--card-edge); padding: var(--s-4); }
.msg .who { font-size: var(--fs-xs); color: var(--text-3); margin-bottom: var(--s-1); }
.msg .body { white-space: pre-wrap; }
.ev { display: flex; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
.ev .when { font-size: var(--fs-xs); color: var(--text-3); min-width: 92px; }

/* device rows */
.dev { display: flex; gap: var(--s-4); align-items: center; }
.dev .model { font-weight: 700; }
.dev .serial { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-md); color: var(--text-2); }

/* scanner */
.scanBox { position: relative; border-radius: var(--r-lg); overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanBox video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanBox .aim { position: absolute; inset: 30% 12%; border: 2px solid rgba(255, 255, 255, .8); border-radius: 12px; }

/* toasts */
#toasts { position: fixed; left: 0; right: 0; top: calc(76px + env(safe-area-inset-top, 0px)); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); pointer-events: none; padding: 0 var(--s-3); }
.toast { pointer-events: auto; padding: var(--s-3) var(--s-5); border-radius: var(--r-md); font-weight: 600; max-width: 520px; }
.toast.warn { color: var(--prog-text); }
.toast.bad { color: var(--issue-text); }

/* sign in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: var(--s-6); }
.signin .card { max-width: 420px; width: 100%; text-align: center; padding: var(--s-7) var(--s-6); }
.signin img { width: 64px; height: 64px; }
.signin h2 { margin: var(--s-4) 0 var(--s-2); }
.signin p { color: var(--text-2); margin: 0 0 var(--s-6); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--s-1) var(--s-4); font-size: var(--fs-xs); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }
.help p { margin: 0 0 var(--s-3); color: var(--text-2); }
.help h4 { margin: var(--s-4) 0 var(--s-1); font-size: var(--fs-md); }

@media (min-width: 900px) {
  .tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ------------------------------------------------------------ phase 2: stages, hazards, floor notes */
.stg { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px; font-size: 12px; font-weight: 800; flex: none; vertical-align: middle; }
.hz { color: var(--prog-text); font-weight: 800; }
.floorNotes { display: flex; flex-direction: column; gap: var(--s-2); margin: 0 0 var(--s-4); align-items: flex-start; }
.fnote { display: flex; gap: var(--s-3); align-items: center; width: 100%; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--accent-tint); }
.fnote .btn.icon { width: 36px; min-height: 36px; font-size: 14px; }
.hazard { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); border-radius: var(--r-md); background: var(--prog-tint); color: var(--prog-text); font-weight: 600; }
.hazard > :first-child { font-size: 18px; }

/* site map */
.mapGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.mapCard { color: inherit; text-decoration: none; display: block; }
.mapCard:active { background: var(--surface-3); }
.mapCard .sub { font-size: var(--fs-xs); color: var(--text-3); }

/* floor plan */
main.planMain { max-width: none; display: flex; flex-direction: column; height: calc(100dvh - 76px); padding: 0 var(--s-3) calc(92px + var(--safe-b)); }
.planTop { margin-bottom: var(--s-2); min-height: 32px; }
.planBox { position: relative; flex: 1; min-height: 260px; overflow: hidden; border-radius: var(--r-lg); background: #1b1f26; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.planInner { position: absolute; left: 0; top: 0; transform-origin: 0 0; --inv: 1; }
.planInner img { display: block; width: 100%; height: 100%; pointer-events: none; background: #fff; }
.mk {
  position: absolute; transform: translate(-50%, -50%) scale(var(--inv)); transform-origin: center;
  min-width: 30px; min-height: 26px; padding: 2px 7px; border-radius: 7px; border: 2px solid rgba(0, 0, 0, .55);
  background: var(--c, #59616c); color: var(--ink, #fff); font: 700 13px/1.3 var(--font); white-space: nowrap; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.mk-issue { border-color: var(--issue); box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(0, 0, 0, .4); }
.mk-pend { border-style: dashed; }
.mk-move { cursor: move; }
.mk-ghost { position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, -120%); background: var(--accent-fill); color: #fff; }
.planZoom { position: absolute; right: var(--s-3); top: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); }
.planZoom .btn { background: var(--glass-thick); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); font-size: 22px; }
.planMsg { position: absolute; inset: auto var(--s-4) var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--glass-thick); font-weight: 600; }
.tray { display: flex; gap: var(--s-2); overflow-x: auto; flex: 1; min-width: 0; align-items: center; scrollbar-width: none; touch-action: pan-x; }
.tray::-webkit-scrollbar { display: none; }
.tray .chip { min-height: var(--h-ctl); font-size: var(--fs-md); flex: none; }
.bottomBar .tray + .btn { flex: none; }

/* replay */
.replayBox { border-radius: var(--r-lg); overflow: hidden; background: #0b0e13; }
.replayBox canvas { display: block; width: 100%; height: auto; }
.replayCtl { display: flex; gap: var(--s-3); align-items: center; margin: var(--s-3) 0; }
.replayCtl input[type=range] { flex: 1; accent-color: var(--accent); height: 32px; }

/* ------------------------------------------------------------ phase 3: photos, reading, voice */
dialog.sheet.wide { width: min(960px, calc(100vw - 24px)); }
@media (max-width: 640px) { dialog.sheet.wide { width: 100vw; } }
.editWrap { display: flex; justify-content: center; background: #000; border-radius: var(--r-md); overflow: hidden; }
.editView { display: block; max-width: 100%; max-height: 52vh; width: auto; height: auto; touch-action: none; cursor: crosshair; }
.chip.sw { padding: 0 8px; }
.chip.sw span { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .35); display: block; }
.chip.sw.on { box-shadow: inset 0 0 0 2px var(--accent); }
.photoGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s-2); }
.ph { position: relative; padding: 0; border: 0; border-radius: var(--r-md); overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-3); cursor: pointer; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.phTag { position: absolute; left: 6px; top: 6px; padding: 2px 8px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700; background: rgba(0, 0, 0, .65); color: #fff; }
.phTag.warn { background: var(--issue); }
.phCap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; font-size: 12px; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phFull { display: block; max-width: 100%; max-height: 62vh; margin: 0 auto; border-radius: var(--r-md); }
.rv { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3); border-radius: var(--r-md); background: var(--surface-2); }
.rv input[type=checkbox] { width: 24px; height: 24px; margin-top: 10px; flex: none; }
.field.mono { font-family: ui-monospace, Consolas, monospace; }
.warnChip { background: var(--issue-tint); color: var(--issue-text); border-color: transparent; }
.fab {
  position: fixed; right: var(--s-5); bottom: calc(92px + var(--safe-b)); z-index: 21;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent-fill); color: #fff; box-shadow: var(--shadow-pop);
  display: grid; place-items: center;
}
.fab .ico { width: 28px; height: 28px; }
.fab:active { transform: scale(.95); }
#vmic.rec { color: var(--danger-text); }
.toolbar .btn.icon { flex: none; }
/* five room tabs fit a phone: labels shrink, never wrap */
@media (max-width: 420px) { .tabs button { font-size: calc(13px * var(--tx)); padding: 0 2px; } }

/* ------------------------------------------------------------ phase 4: punch items, parking, handoffs */
.headBtns { display: flex; gap: var(--s-2); flex-wrap: nowrap; }
.headBtns .btn.on { background: var(--accent-tint); color: var(--accent-strong); }
.sev { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; background: var(--todo-tint); color: var(--text-2); }
.sev.sev-blocking { background: var(--issue-tint); color: var(--issue-text); }
.sev.sev-functional { background: var(--prog-tint); color: var(--prog-text); }
.pi { background: var(--surface-2); border-radius: var(--r-lg); box-shadow: var(--card-edge); padding: var(--s-4); display: flex; flex-direction: column; gap: 6px; }
.pi.closed { opacity: .8; }
.piTop { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.piTitle { font-weight: 650; font-size: var(--fs-lg); }
.piTitle a { color: inherit; }
.piDetail { color: var(--text-2); white-space: pre-wrap; }
.piFix { padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--done-tint); color: var(--done-text); font-weight: 600; }
.piHint { padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--accent-tint); font-size: var(--fs-xs); }
.piActs { display: flex; gap: var(--s-2); margin-top: 4px; }
.piActs .btn { flex: 1; }
.hints { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; padding: var(--s-3); border-radius: var(--r-md); background: var(--accent-tint); }
.hint { display: flex; flex-direction: column; text-align: left; gap: 2px; padding: var(--s-2) var(--s-3); min-height: 44px; border: 0; border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; }
.sevSeg label { flex: 1; position: relative; }
.sevSeg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.sevSeg span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: var(--r-sm); font-weight: 600; color: var(--text-3); }
.sevSeg input:checked + span { background: var(--surface-3); color: var(--text); }
.sevSeg .sev-blocking input:checked + span { background: var(--issue-tint); color: var(--issue-text); }
.sevSeg .sev-functional input:checked + span { background: var(--prog-tint); color: var(--prog-text); }
.lockBar, .parkBar { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); border-radius: var(--r-md); background: var(--surface-3); }
.parkBar { background: var(--accent-tint); }
.parkBar.due { background: var(--prog-tint); color: var(--prog-text); }
.lockBar .btn, .parkBar .btn { flex: none; }
.q.qLocked { opacity: .55; }
.tileMarks { display: flex; gap: 4px; flex-wrap: wrap; }
.tileMarks:empty { display: none; }
.pb { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-pill); background: var(--surface-4); }
.pb.sev-blocking { background: var(--issue-tint); color: var(--issue-text); }
.pb.due { background: var(--prog-tint); color: var(--prog-text); }
.sumCard { display: block; color: inherit; text-decoration: none; margin: var(--s-2) 0 var(--s-4); }
.sumRow { display: flex; gap: var(--s-4); flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.dueTag { color: var(--prog-text); font-weight: 700; }
.clusterCard { margin-bottom: var(--s-3); }
.cl { padding: 6px 0; border-top: 1px solid var(--line); }
.photoPick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.photoPick label { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; cursor: pointer; }
.photoPick img { width: 100%; height: 100%; object-fit: cover; }
.photoPick input { position: absolute; left: 6px; top: 6px; width: 20px; height: 20px; }

/* ------------------------------------------------------------ phase 5: stock, RMAs, hostnames, test settings */
.mono { font-family: ui-monospace, Consolas, monospace; }
.okText { color: var(--done-text); font-size: var(--fs-xs); margin-top: var(--s-2); font-weight: 600; }
.testBar { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); border-radius: var(--r-md); background: var(--prog-tint); color: var(--prog-text); }
.testBar .btn { flex: none; }
.testItem { padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--prog-tint); color: var(--prog-text); margin-bottom: 6px; font-weight: 600; }
.stockTable { border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); box-shadow: var(--card-edge); font-size: var(--fs-xs); }
.stockTable > div { display: grid; grid-template-columns: 2.2fr 1fr 1.2fr 1fr 1fr; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: center; }
.stockTable .st-h { color: var(--text-3); font-weight: 700; }
.stockTable .st-r span:not(:first-child) { font-variant-numeric: tabular-nums; }
.stockTable .st-r.short { background: var(--prog-tint); }
.chip.rma-open { background: var(--prog-tint); color: var(--prog-text); border-color: transparent; }
.chip.rma-sent { background: var(--accent-tint); color: var(--accent-strong); border-color: transparent; }

/* ------------------------------------------------------------ phase 6: status, witness */
.tiles4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); margin-bottom: var(--s-2); }
@media (min-width: 700px) { .tiles4 { grid-template-columns: repeat(4, 1fr); } }
.tile4 { background: var(--surface-2); border-radius: var(--r-lg); box-shadow: var(--card-edge); padding: var(--s-4); }
.tile4 .big { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.chartCard { position: relative; }
.burn { position: relative; }
.burnSvg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.burnSvg .gridl { stroke: var(--line); stroke-width: 1; }
.burnSvg .axl { fill: var(--text-3); font: 11px var(--font); }
.burnSvg .actl { fill: none; stroke: var(--done); stroke-width: 2; stroke-linejoin: round; }
.burnSvg .actd { fill: var(--done); stroke: var(--surface-2); stroke-width: 2; }
.burnSvg .fcl { fill: none; stroke: var(--text-3); stroke-width: 2; stroke-dasharray: 6 5; }
.burnSvg .todayl { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.burnSvg .xhair { stroke: var(--text-3); stroke-width: 1; }
.ctip { position: absolute; top: 4px; width: 150px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--glass-thick); box-shadow: var(--shadow-pop); font-size: var(--fs-xs); pointer-events: none; }
.frow { display: grid; grid-template-columns: 1.1fr 2fr 48px 92px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.frow:last-child, .crow:last-child { border-bottom: 0; }
.fdate { text-align: right; }
.crow { display: grid; grid-template-columns: 1.3fr 2fr 40px 60px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.bar i.n { background: var(--text-3); }
.cday { text-align: right; }
.mailPrev { width: 100%; height: 55vh; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: #fff; margin-top: 8px; }
.kvs { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-md); }
.sigpad { width: 100%; aspect-ratio: 3 / 1; background: #fff; border-radius: var(--r-md); border: 1px solid var(--line-strong); touch-action: none; cursor: crosshair; }
.chip.acc-yes { background: var(--done-tint); color: var(--done-text); border-color: transparent; }
.chip.acc-no { background: var(--issue-tint); color: var(--issue-text); border-color: transparent; }

.cl:first-child { border-top: 0; }

/* ------------------------------------------------------------ phase 7: types, notes, service, glossary */
.typeBox { padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); border-radius: var(--r-md); background: var(--surface-2); box-shadow: var(--card-edge); }
.msg.crit, .fnote.crit { box-shadow: inset 4px 0 0 var(--issue); }
.fnote.crit { background: var(--issue-tint); }
.msg.mine { box-shadow: inset 4px 0 0 var(--accent); }
.seen { margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mentionCard .cl:first-of-type { border-top: 0; }
.term { all: unset; cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.term:focus-visible { outline: 2px solid var(--accent); }
.pinForm { margin-top: 4px; text-align: left; }

/* ------------------------------------------------------------ phase 8: change orders, engraving */
.co-chip { background: var(--accent-tint); color: var(--accent-strong); border-color: transparent; }
.chip.co-pending { background: var(--prog-tint); color: var(--prog-text); border-color: transparent; }
.chip.co-approved { background: var(--accent-tint); color: var(--accent-strong); border-color: transparent; }
.chip.co-done { background: var(--done-tint); color: var(--done-text); border-color: transparent; }
.mk.mk-co { outline: 3px solid var(--accent); outline-offset: 2px; }
.sumCard.nolink { cursor: default; }
.coList { max-height: 40vh; overflow-y: auto; border-radius: var(--r-md); background: var(--surface-1); padding: 6px 10px; }
.coZone { display: flex; gap: 8px; align-items: center; padding: 8px 0 4px; }
.coRow { display: flex; gap: 8px; align-items: center; min-height: 40px; padding: 0 4px; cursor: pointer; }
.coRow input { width: 20px; height: 20px; }
.engRow { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.engRow:first-of-type { border-top: 0; }
