body.admin { overflow: auto; }
html:has(body.admin) { overflow: auto; }
.small { font-size: 13px; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--text-muted); cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text-primary); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; font-size: 14px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.field-error { margin: 0; color: var(--danger); font-size: 13px; }

/* Top bar */
.topbar {
  height: 56px; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; border-bottom: 1px solid var(--hairline); background: var(--ink);
}
.topbar__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.topbar__brand img { height: 18px; }
.topbar__brand span { border-left: 1px solid var(--hairline); padding-left: 12px; color: var(--text-muted); }
.topbar__back { text-decoration: none; font-size: 20px; color: var(--text-muted); width: 32px; }
.topbar__back:hover { color: var(--text-primary); }
.topbar__title { flex: 0 1 420px; min-width: 120px; height: 36px; padding: 0 8px; background: transparent; border: 1px solid transparent; font-size: 17px; font-weight: 500; outline: none; }
.topbar__title:hover, .topbar__title:focus { border-color: var(--hairline); }
.topbar__status { font-size: 13px; }
.topbar__actions { margin-left: auto; display: flex; gap: 8px; }

/* List */
.list { max-width: 1240px; margin: 0 auto; padding: 40px 20px 80px; }
.list__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.list__head h1 { margin: 0; font-weight: 400; font-size: 32px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.card { display: block; text-decoration: none; cursor: pointer; }
.card__img { aspect-ratio: 16 / 9; background: var(--ink-panel) center / cover no-repeat; transition: opacity 0.15s; }
.card:hover .card__img { opacity: 0.85; }
.card__title { margin-top: 12px; font-weight: 500; }
.card__meta { font-size: 13px; color: var(--text-quiet); margin-top: 2px; }
.card__meta .live { color: var(--accent); }
.empty { padding: 40px 0; }

/* Editor layout */
.editor {
  height: 100vh; display: grid;
  grid-template-columns: 260px 1fr 320px;
  grid-template-rows: 56px 1fr;
  grid-template-areas: "top top top" "scenes stage side";
}
.editor > .topbar { grid-area: top; }
.scenes { grid-area: scenes; border-right: 1px solid var(--hairline); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.side { grid-area: side; border-left: 1px solid var(--hairline); overflow-y: auto; }
.stage { grid-area: stage; position: relative; background: #000; min-width: 0; }
#ed-viewer { position: absolute; inset: 0; }
.stage__empty { position: absolute; inset: 0; display: grid; place-items: center; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.block { padding: 18px 18px 22px; border-bottom: 1px solid var(--hairline); display: grid; gap: 14px; }
.block--end { border-bottom: 0; }

/* Scene list */
.scene-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.scene-item { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: center; padding: 6px; cursor: pointer; border: 1px solid transparent; }
.scene-item:hover { background: var(--ink-raised); }
.scene-item.is-active { border-color: var(--text-muted); background: var(--ink-raised); }
.scene-item.is-dragover { border-color: var(--accent); }
.scene-item img { width: 72px; height: 40px; object-fit: cover; display: block; background: var(--ink-panel); }
.scene-item__name { font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-item__sub { font-size: 12px; color: var(--text-quiet); }
.drop-hint { font-size: 12px; line-height: 1.5; }

.uploads { display: grid; gap: 8px; }
.upload { font-size: 13px; display: grid; gap: 6px; }
.upload__bar { height: 2px; background: var(--hairline); }
.upload__bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.upload.is-error { color: var(--danger); }

/* Stage overlays */
.toolbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; gap: 6px; }
.placing {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 101;
  display: flex; gap: 14px; align-items: center; padding: 8px 8px 8px 16px;
  background: var(--accent); color: var(--ink); font-weight: 500; font-size: 14px;
}
.placing .btn--ghost { color: var(--ink); border-color: rgba(0,0,0,0.3); }
.placing .btn--ghost:hover { background: rgba(0,0,0,0.08); }
.stage.is-placing #ed-viewer { cursor: crosshair; }
.stage.is-placing .psv-container { cursor: crosshair !important; }
.flash { position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); z-index: 100; background: var(--text-primary); color: var(--ink); padding: 8px 14px; font-size: 14px; }

/* Selected hotspot in editor */
.psv-marker.is-selected .hs { background: var(--accent); border-color: var(--accent); color: var(--ink); }

/* Share */
.slug { display: flex; align-items: center; border: 1px solid var(--hairline); }
.slug:focus-within { border-color: var(--text-muted); }
.slug__prefix { padding-left: 10px; font-size: 13px; white-space: nowrap; }
.slug .input { border: 0; padding-left: 2px; }
.seg { display: flex; border: 1px solid var(--hairline); }
.seg button { flex: 1; height: 34px; background: transparent; border: 0; cursor: pointer; font-size: 13px; color: var(--text-muted); }
.seg button.is-on { background: var(--text-primary); color: var(--ink); }
.sub { display: grid; gap: 14px; }
.sub[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.field > span em { font-style: normal; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.range { width: 100%; accent-color: var(--accent); margin: 4px 0 0; }
.code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.5; min-height: 120px; color: var(--text-muted); }

.drop-overlay { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(14,14,14,0.85); border: 2px dashed var(--accent); font-size: 20px; pointer-events: none; }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 220px 1fr; grid-template-areas: "top top" "scenes stage" "side side"; grid-template-rows: 56px 70vh auto; height: auto; }
  .side { border-left: 0; border-top: 1px solid var(--hairline); }
}

/* ---------- info point fields ---------- */
.info-fields { display: grid; gap: 14px; }
.photo { display: grid; gap: 8px; }
.photo img { width: 100%; max-height: 180px; object-fit: cover; display: block; }
.seg--stack { flex-direction: column; }
.seg--stack button { text-align: left; padding: 0 12px; }
.seg button { padding: 0 6px; }

/* ---------- floor plans list ---------- */
.plans { display: grid; gap: 8px; }
.plans:empty { display: none; }
.plan-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; }
.plan-row img { width: 56px; height: 40px; object-fit: contain; background: #f4f2ee; display: block; }
.plan-row__name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-row__sub { font-size: 12px; color: var(--text-quiet); }

/* ---------- modal + plan editor ---------- */
.modal { position: fixed; inset: 0; z-index: 400; background: rgba(0, 0, 0, 0.7); display: grid; place-items: center; padding: 24px; }
.modal__box { background: var(--ink-panel); border: 1px solid var(--hairline); width: min(1280px, 100%); height: min(860px, 100%); display: grid; grid-template-rows: auto 1fr auto; }
.plan-ed__head { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--hairline); }
.plan-ed__body { display: grid; grid-template-columns: 240px 1fr; min-height: 0; }
.plan-ed__foot { display: grid; grid-template-columns: 320px 1fr auto; gap: 20px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--hairline); }
.pe-rooms { list-style: none; margin: 0; padding: 10px; overflow-y: auto; border-right: 1px solid var(--hairline); display: grid; gap: 2px; align-content: start; }
.pe-rooms li { padding: 8px 10px; font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.pe-rooms li:hover { background: var(--ink-raised); }
.pe-rooms li.is-on { background: var(--ink-raised); box-shadow: inset 2px 0 0 var(--accent); }
.pe-rooms li .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--text-quiet); flex: none; align-self: center; }
.pe-rooms li.is-placed .dot { background: var(--text-primary); border-color: var(--text-primary); }
.pe-stage { display: grid; place-items: center; padding: 20px; min-height: 0; overflow: hidden; }
.pe-frame { position: relative; max-width: 100%; max-height: 100%; cursor: crosshair; }
.pe-frame img { display: block; max-width: 100%; max-height: calc(min(860px, 100vh - 48px) - 200px); background: #f4f2ee; user-select: none; }
.pe-frame .spot--selected i { background: var(--accent); width: 14px; height: 14px; }
.pe-frame .spot__label { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; padding: 2px 6px; background: rgba(14, 14, 14, 0.75); color: #fff; pointer-events: none; }

/* ---------- analytics ---------- */
#stats-view { min-height: 100vh; }
.topbar__title--static { display: flex; align-items: center; border: 0; }
#st-range { margin-left: auto; height: 34px; }
#st-range button { padding: 0 12px; }
.stats { max-width: 1100px; margin: 0 auto; padding: 32px 20px 80px; display: grid; gap: 28px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.tile { background: var(--ink); padding: 18px 20px; display: grid; gap: 6px; }
.tile__label { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-quiet); }
.tile__value { font-size: 30px; font-weight: 400; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile__sub { font-size: 12px; color: var(--text-muted); }
.st-block { display: grid; gap: 14px; }
.st-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 800px) { .st-cols { grid-template-columns: 1fr; } }
.st-chart { position: relative; height: 220px; }
.st-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.st-chart .grid { stroke: var(--hairline); stroke-width: 1; }
.st-chart .axis { fill: var(--text-quiet); font-size: 11px; font-family: var(--sans); }
.st-chart .bar { fill: var(--accent); }
.st-chart .hit { fill: transparent; cursor: default; }
.st-chart .hit:hover + .bar, .st-chart .bar.is-hover { fill: #ffa45a; }
.st-tip { position: absolute; pointer-events: none; background: var(--text-primary); color: var(--ink); font-size: 12px; padding: 6px 9px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; }
.st-list { display: grid; gap: 10px; }
.st-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
.st-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-row__n { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.st-row__bar { grid-column: 1 / -1; height: 4px; background: var(--ink-raised); }
.st-row__bar > i { display: block; height: 100%; background: var(--accent); opacity: 0.85; }
.st-empty { color: var(--text-quiet); font-size: 14px; }
.st-note { margin: 0; }
.scene-item--version { margin-left: 18px; grid-template-columns: 54px 1fr; }
.scene-item--version img { width: 54px; height: 30px; }
/* analytics layout fixes */
#st-range button { white-space: nowrap; }
.tiles { display: flex; flex-wrap: wrap; gap: 0; background: none; border: 0; border-top: 1px solid var(--hairline); border-left: 1px solid var(--hairline); }
.tile { flex: 1 1 160px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.tile__value { font-variant-numeric: normal; }
.st-block, .st-list { align-content: start; }
