/* Layout: full-height site console. 3D model fills the left, a scrolling panel sits on the right (below on phones).
   Palette: cool concrete greys, survey-stake orange for the one thing to act on, steel blue for progress. */
:root {
  --bg: #e7eaec;
  --panel: #f6f7f7;
  --raised: #ffffff;
  --ink: #15222b;
  --muted: #586873;
  --line: #c9d1d6;
  --accent: #d9500a;
  --accent-ink: #ffffff;
  --steel: #2d6187;
  --good: #2f7d50;
  --warn: #9a6209;
  --bad: #b3402a;
  --sky: #dce3e7;
  --f-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-body: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e161b;
    --panel: #141e24;
    --raised: #1b2830;
    --ink: #e5ebee;
    --muted: #93a3ac;
    --line: #2a3841;
    --accent: #ff8340;
    --accent-ink: #1a0f08;
    --steel: #6da6d0;
    --good: #5dbb86;
    --warn: #e3a64a;
    --bad: #ff8a78;
    --sky: #0e161b;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e161b;
  --panel: #141e24;
  --raised: #1b2830;
  --ink: #e5ebee;
  --muted: #93a3ac;
  --line: #2a3841;
  --accent: #ff8340;
  --accent-ink: #1a0f08;
  --steel: #6da6d0;
  --good: #5dbb86;
  --warn: #e3a64a;
  --bad: #ff8a78;
  --sky: #0e161b;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.top {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand {
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 20px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand small {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 500;
}
.proj {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.proj .n {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hbtns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  font-family: var(--f-mono);
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--warn);
  color: var(--warn);
  border-radius: 99px;
  white-space: nowrap;
}
.screen {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
#scrProject {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--sky);
}
#gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.ov {
  position: absolute;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ov button,
.tl {
  background: color-mix(in srgb, var(--raised) 90%, transparent);
  border: 1px solid var(--line);
}
.ov button {
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
}
.ov button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--panel);
  border-color: var(--ink);
}
.ov.tl-views {
  left: 12px;
  top: 12px;
}
.ov.tl-tog {
  right: 12px;
  top: 12px;
  justify-content: flex-end;
}
.tl {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
}
.tl button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--panel);
  display: grid;
  place-items: center;
  flex: none;
  padding: 0;
}
.tl button[disabled] {
  opacity: 0.4;
}
.tl input {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}
.tlLabel {
  font-family: var(--f-mono);
  font-size: 12px;
  min-width: 9.5em;
  text-align: right;
}
.hintline {
  position: absolute;
  left: 14px;
  bottom: 70px;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
  background: color-mix(in srgb, var(--raised) 70%, transparent);
  padding: 2px 8px;
  border-radius: 4px;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
  flex: none;
  overflow-x: auto;
}
.tabs button {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 11px 10px 8px;
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.tabs button[aria-selected='true'] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
#pbody {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.foot {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  display: grid;
  gap: 8px;
  background: var(--panel);
}
.foot .r1 {
  display: flex;
  gap: 8px;
  align-items: center;
}
.foot input[type='text'] {
  flex: 1;
  min-width: 0;
}
.foot input[type='number'] {
  width: 92px;
}

input[type='text'],
input[type='number'],
input[type='tel'],
input[type='password'],
input[type='date'],
input[type='email'],
input[type='search'],
select,
textarea {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 9px;
  min-width: 0;
  width: 100%;
}
.foot input,
.foot select {
  width: auto;
}
input[type='checkbox'] {
  width: auto;
  accent-color: var(--accent);
}
label.f {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
label.chk {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.btn {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 12px;
  font-weight: 600;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.sm {
  padding: 4px 9px;
  font-size: 12px;
}
.btn.danger {
  color: var(--bad);
  border-color: var(--bad);
}
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn[aria-pressed='true'] {
  background: var(--ink);
  color: var(--panel);
  border-color: var(--ink);
}

h1 {
  margin: 0;
  font-family: var(--f-display);
  font-size: 30px;
  letter-spacing: 0.04em;
}
h3 {
  margin: 0;
  font-family: var(--f-display);
  font-size: 18px;
  letter-spacing: 0.05em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}
.card {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
}
.sum {
  display: flex;
  gap: 14px;
  align-items: center;
}
.big {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 56px;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}
.big small {
  font-size: 26px;
  margin-left: 2px;
  color: var(--muted);
}
.sumR {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
}
.lbl {
  font-weight: 600;
}
.hint {
  font-size: 12px;
  color: var(--muted);
}
.bar {
  height: 7px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--steel);
  border-radius: 4px;
}
.bar > i.done {
  background: var(--good);
}
.mono {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}
.grow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 38px auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.grow .t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grow .p {
  text-align: right;
  font-family: var(--f-mono);
  font-size: 12px;
}
.chip {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  border: 1px solid var(--line);
  white-space: nowrap;
  color: var(--muted);
}
.chip.done {
  color: var(--good);
  border-color: var(--good);
}
.chip.prog {
  color: var(--warn);
  border-color: var(--warn);
}
.chip.late {
  color: var(--bad);
  border-color: var(--bad);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--muted);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.25);
}
.eh {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.eh b {
  font-size: 16px;
}
.eid {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--muted);
}
.st {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.st.done {
  color: var(--good);
  border-color: var(--good);
}
.st.prog {
  color: var(--warn);
  border-color: var(--warn);
}
.stg {
  display: grid;
  gap: 4px;
}
.stgTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}
.stgTop output {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.stg input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}
.rowbtns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.rowbtns .sp {
  flex: 1;
}
details.grp {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
}
details.grp > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px 38px;
  gap: 10px;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
}
details.grp > summary::-webkit-details-marker {
  display: none;
}
details.grp > summary .t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rows {
  display: grid;
  border-top: 1px solid var(--line);
  max-height: 280px;
  overflow-y: auto;
}
.row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 54px 36px;
  gap: 8px;
  align-items: center;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 7px 12px;
  font-size: 12px;
}
.row:last-child {
  border-bottom: 0;
}
.row.sel {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.row .rid {
  font-family: var(--f-mono);
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .rn {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.row .rp {
  text-align: right;
  font-family: var(--f-mono);
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.banner {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  border: 1px solid var(--warn);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.entry {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
  text-align: left;
  width: 100%;
}
.entry.cur {
  border-color: var(--accent);
}
.entry .h {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.entry .h b {
  font-family: var(--f-display);
  font-size: 18px;
  letter-spacing: 0.03em;
}
.entry ul {
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
}
.entry .note {
  font-size: 13px;
}
.photos {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.photos img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--line);
}
.list {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.sheet {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.sheet:last-child {
  border-bottom: 0;
}
.sheet .d {
  font-size: 12px;
  color: var(--muted);
}
.empty {
  color: var(--muted);
  padding: 8px 2px;
}
.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  font-size: 13px;
}
.kv b {
  font-family: var(--f-mono);
  text-align: right;
}
.ms {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.ms:last-child {
  border-bottom: 0;
}
.ms .top2 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.sub {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: color-mix(in srgb, var(--line) 20%, transparent);
}
.inl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px;
}

.plan {
  width: 100%;
  height: auto;
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  touch-action: manipulation;
}
.plan text {
  font-family: var(--f-mono);
  font-size: 1.6px;
  fill: var(--muted);
}
.plan .bay {
  cursor: pointer;
}
.plan .edge,
.plan .node {
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 20, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 20;
}
.dlg {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  width: min(400px, 100%);
  display: grid;
  gap: 14px;
}
.dlg h2 {
  margin: 0;
  font-family: var(--f-display);
  font-size: 26px;
  letter-spacing: 0.04em;
}
.loginwrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.err {
  color: var(--bad);
  font-size: 13px;
  min-height: 1em;
}
.plist {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px;
  display: grid;
  gap: 16px;
}
.phead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.pcard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 8px 16px;
  text-align: left;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  width: 100%;
}
.pcard b {
  font-family: var(--f-display);
  font-size: 22px;
  letter-spacing: 0.03em;
}
.pcard .r {
  text-align: right;
}
.pcard .big {
  font-size: 36px;
}
.pcard:hover {
  border-color: var(--accent);
}
.pcards {
  display: grid;
  gap: 12px;
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }
  html,
  body {
    height: auto;
    min-height: 100%;
  }
  #app {
    height: 100vh;
    height: 100dvh;
  }
  #scrProject {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(300px, 46%) minmax(0, 1fr);
  }
  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .hintline {
    display: none;
  }
  .tlLabel {
    min-width: 7.5em;
    font-size: 11px;
  }
  .brand small {
    display: none;
  }
  .proj {
    order: 3;
    flex-basis: 100%;
  }
  .hbtns {
    margin-left: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--panel);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 40;
  max-width: min(92vw, 520px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
.toast.bad {
  background: var(--bad);
  color: #fff;
}

/* stage hero (client overview) */
.hero {
  gap: 14px;
}
.heroTop {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}
.heroTop .r {
  text-align: right;
}
.heroTop .big {
  font-size: 64px;
}
.heroTop .lbl {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.now {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
}
.now .lbl {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stagelist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.srow {
  display: grid;
  grid-template-columns: 14px 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 2px;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.srow:last-child {
  border-bottom: 0;
}
.srow .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: transparent;
}
.srow.done .dot {
  background: var(--good);
  border-color: var(--good);
}
.srow.cur .dot {
  border-color: var(--accent);
  background: var(--accent);
}
.srow .sn {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--muted);
}
.srow .mk {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--muted);
}
.srow.done .mk {
  color: var(--good);
}
.srow.cur .mk {
  color: var(--accent);
  font-weight: 600;
}
.srow.up .nm {
  color: var(--muted);
}
/* weights table */
.wtable {
  display: grid;
  gap: 4px;
}
.wh,
.wr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 74px 56px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.wh {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.wr .t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wr input {
  padding: 4px 6px;
  width: 100%;
}
.wh span:nth-child(n + 2),
.wr span.mono {
  text-align: right;
}

/* ---- phones without 3D ---- */
#scrProject.no3d {
  grid-template-rows: auto minmax(0, 1fr);
}
.stage.no3d {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--panel);
}
.stage.no3d #gl,
.stage.no3d .ov,
.stage.no3d .hintline {
  display: none;
}
.stage.no3d .tl {
  position: static;
}
.no3d-msg {
  font-size: 13px;
  color: var(--muted);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
@media (min-width: 861px) {
  #scrProject.no3d {
    grid-template-rows: none;
  }
}

/* ---- photos ---- */
.photos img {
  cursor: zoom-in;
}
.photos .ph {
  width: 72px;
  height: 72px;
  border-radius: 4px;
  background: var(--line);
  display: inline-block;
}
.dlg.photo {
  width: min(1100px, 100%);
  max-height: calc(100dvh - 32px);
  grid-template-rows: minmax(0, 1fr) auto;
}
.pv {
  min-height: 0;
  display: grid;
  place-items: center;
}
.pv img {
  max-width: 100%;
  max-height: calc(100dvh - 140px);
  object-fit: contain;
  border-radius: 6px;
  background: var(--line);
}

/* ---- install and update ---- */
.upbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--ink);
  color: var(--panel);
  padding: 10px 12px 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3);
  width: max-content;
  max-width: calc(100vw - 32px);
}
.upbar .btn {
  flex: none;
}
.ver {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.inst {
  display: grid;
  gap: 6px;
}

/* ---- header menu on phones ---- */
a.btn {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#btnMenu {
  display: none;
}
@media (max-width: 600px) {
  .top {
    flex-wrap: nowrap;
    position: relative;
    padding: 8px 12px;
    gap: 10px;
  }
  .proj {
    order: 0;
    flex: 1;
    flex-basis: auto;
    min-width: 0;
  }
  .proj .pill {
    display: none;
  }
  #btnMenu {
    display: inline-flex;
    flex: none;
    margin-left: auto;
  }
  .hbtns {
    display: none;
    position: absolute;
    right: 12px;
    top: calc(100% + 4px);
    z-index: 30;
    flex-direction: column;
    align-items: stretch;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    min-width: 210px;
    margin: 0;
  }
  .top.menu-open .hbtns {
    display: flex;
  }
  .hbtns .btn {
    justify-content: flex-start;
    padding: 10px 12px;
    font-size: 14px;
  }
}
/* ---- 3D overlay buttons: second row on narrow screens so they never overlap ---- */
.stage.stackov .ov.tl-tog {
  left: 12px;
  right: auto;
  top: 48px;
  justify-content: flex-start;
}
@media (max-width: 560px) {
  .ov button {
    padding: 5px 8px;
    font-size: 11.5px;
  }
}
@media (max-width: 340px) {
  .ov.tl-views button {
    padding: 5px 6px;
  }
}
/* ---- phones held sideways: model and panel side by side ---- */
@media (max-width: 960px) and (orientation: landscape) and (max-height: 520px) {
  #app {
    height: 100vh;
    height: 100dvh;
  }
  body {
    overflow: hidden;
  }
  .top {
    padding: 4px 12px;
  }
  .proj {
    order: 0;
    flex: 1;
    flex-basis: auto;
    min-width: 0;
  }
  #scrProject {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 46%);
    grid-template-rows: minmax(0, 1fr);
  }
  .panel {
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  #pbody {
    padding: 12px;
    gap: 12px;
  }
}
/* ---- short phones: give the panel more room ---- */
@media (max-width: 860px) and (max-height: 700px) and (orientation: portrait) {
  #scrProject {
    grid-template-rows: minmax(220px, 40%) minmax(0, 1fr);
  }
}
/* ---- big screens ---- */
@media (min-width: 1500px) {
  #scrProject {
    grid-template-columns: minmax(0, 1fr) 480px;
  }
}

/* ---- first-open details, authenticator code ---- */
.dlg.wide {
  width: min(460px, 100%);
}
.welbrand {
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 18px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.welbrand small {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 500;
}
.req {
  color: var(--accent);
}
.opt {
  font-weight: 400;
  color: var(--muted);
}
label.chk.consent {
  align-items: flex-start;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
}
label.chk.consent input {
  margin-top: 3px;
  flex: none;
}
.btn.linkish {
  background: none;
  border: 0;
  color: var(--steel);
  text-decoration: underline;
  justify-self: center;
  font-weight: 500;
}
.lgextra {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.lgextra:empty {
  display: none;
}
input.code {
  font-family: var(--f-mono);
  font-size: 26px;
  letter-spacing: 0.35em;
  text-align: center;
  padding: 10px;
}
.steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  font-size: 13.5px;
}
.qr {
  display: block;
  width: 180px;
  height: 180px;
  margin: 10px 0;
  background: #fff;
  border-radius: 6px;
  padding: 6px;
  border: 1px solid var(--line);
}
.qr.demo {
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 12px;
  color: #333;
  padding: 12px;
}
code.key {
  font-family: var(--f-mono);
  font-size: 13px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  word-break: break-all;
  user-select: all;
}

/* ---- admin dashboard ---- */
.admin {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: grid;
  gap: 14px;
}
.admtabs {
  padding: 0;
  border-bottom: 1px solid var(--line);
}
#admBody {
  display: grid;
  gap: 14px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 2px;
}
.stat .big {
  font-size: 44px;
}
.stat .lbl {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.big.sm {
  font-size: 30px;
}
.big.sm small {
  font-size: 16px;
}
.plist2 {
  display: grid;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.prow {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.9fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.prow:last-child {
  border-bottom: 0;
}
.prow b {
  font-size: 15px;
}
.prow .note {
  font-size: 12px;
  margin-top: 4px;
  padding: 4px 8px;
  border-left: 3px solid var(--steel);
  background: var(--panel);
}
.prow .mono a,
.prow a[href^='tel'] {
  color: inherit;
}
.prow .rowbtns {
  justify-content: flex-end;
}
.seg {
  display: inline-flex;
  gap: 0;
}
.seg .btn {
  border-radius: 0;
}
.seg .btn:first-child {
  border-radius: 5px 0 0 5px;
}
.seg .btn:last-child {
  border-radius: 0 5px 5px 0;
  border-left: 0;
}
.alog {
  display: grid;
  font-size: 12.5px;
  max-height: 520px;
  overflow-y: auto;
}
.arow {
  display: grid;
  grid-template-columns: 118px minmax(0, 0.9fr) minmax(0, 1.6fr);
  gap: 10px;
  padding: 6px 2px;
  border-bottom: 1px dashed var(--line);
}
.arow:last-child {
  border-bottom: 0;
}
.arow .t {
  color: var(--muted);
  font-size: 11.5px;
}
.arow .w {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layers {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 13px;
}
.sub.eh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
@media (max-width: 760px) {
  .prow {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .prow > div:nth-child(3) {
    grid-column: 1/-1;
  }
  .prow .rowbtns {
    grid-column: 1/-1;
    justify-content: flex-start;
  }
  .arow {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .stat .big {
    font-size: 36px;
  }
}
