/* Components. Colours come from theme.css only. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-md)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--ink); color: var(--on-ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: none; }
.is-danger { color: var(--danger); }
.muted { color: var(--ink-2); }

body[data-screen="editor"] .dash { display: none; }
body[data-screen="dashboard"] .editor-page { display: none; }

/* ---------- buttons ---------- */
.btn-primary, .btn-secondary, .btn-danger, .btn-quiet, .btn-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px; border-radius: var(--r-ctl);
  border: 1px solid transparent; cursor: pointer; font-weight: 550; white-space: nowrap;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--surface)); }
.btn-secondary { background: var(--surface); border-color: var(--line); }
.btn-secondary:hover, .btn-quiet:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn-secondary[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn-danger { background: var(--surface); border-color: var(--line); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-quiet { background: transparent; border-color: var(--line); padding: 0 12px; }
.btn-toggle { background: var(--surface); border-color: var(--line); padding: 0 12px; font-weight: 500; }
.btn-toggle[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn-toggle.small { min-height: var(--tap); font-size: var(--fs-sm); min-width: 96px; }
.btn-icon {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); flex: none;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}
.btn-icon:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-icon.danger:hover { color: var(--danger); border-color: var(--danger); }
.btn-icon:disabled { opacity: 0.38; cursor: default; background: var(--surface); border-color: var(--line); }
.btn-round {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); flex: none;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  transition: background-color 160ms ease-out, color 160ms ease-out, border-color 160ms ease-out;
}
a:hover > .btn-round, a.btn-round:hover, .hotel-card:hover .btn-round { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 550; min-height: var(--tap); padding: 0 4px; }
.tag { display: inline-block; font-size: var(--fs-xs); font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); vertical-align: 1px; }

/* ---------- fields ---------- */
.field { display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.field input, .field select, .field-row input, .rename-input {
  min-height: var(--tap); padding: 0 12px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: var(--fs-md); width: 100%;
}
.field input:focus, .field select:focus, .field-row input:focus, .rename-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.field input::placeholder { color: var(--ink-2); }

/* ---------- dashboard shell ---------- */
.dash { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 4px 12px 28px; }
.brand-mark { font-weight: 800; font-size: var(--fs-lg); letter-spacing: 0.06em; }
.brand-sub { color: var(--ink-2); font-size: var(--fs-sm); }
.nav-heading { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); padding: 20px 12px 6px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.nav-list a {
  display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 12px;
  border-radius: var(--r-ctl); border: 1px solid transparent; font-weight: 500;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}
.nav-list a:hover { background: var(--surface); }
.nav-list a[aria-current="page"] { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); font-weight: 650; }
.nav-list span:not(.nav-count) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offline-status { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px; font-size: var(--fs-sm); color: var(--ink-2); }
.nav-count { font-size: var(--fs-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }

.content {
  margin: 16px 16px 16px 0; padding: 36px 32px 40px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-shell);
  display: grid; gap: 24px; align-content: start; outline: none;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-2xl); font-weight: 650; line-height: 1.15; }
.page-head p { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 8px; }
.card-head h2 { font-size: var(--fs-lg); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.stat { display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-card); min-width: 0; }
.stat-label { font-size: var(--fs-sm); color: var(--ink-2); }
.stat-value { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.01em; }
.stat-sub { font-size: var(--fs-sm); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Plans: the room drawn from the same data the editor uses. */
.plan { display: block; width: 100%; height: 100%; }
.plan .room { fill: var(--surface); stroke: var(--ink); stroke-width: 1.6px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.plan .aw { stroke: var(--ink-2); stroke-width: 1px; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.plan .aw-closed { stroke: var(--ink-2); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.plan .fx { fill: var(--line-strong); }
.plan .door { stroke: var(--surface); stroke-width: 3px; vector-effect: non-scaling-stroke; }
.plan .it { fill: var(--ink); fill-opacity: 0.78; }

.hotel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.hotel-card { display: grid; grid-template-rows: auto auto; overflow: hidden; transition: border-color 160ms ease-out, box-shadow 160ms ease-out; }
.hotel-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.hotel-plan { aspect-ratio: 16 / 7; padding: 18px 22px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.hotel-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 20px; }
.hotel-meta h3 { font-size: var(--fs-md); font-weight: 650; }
.hotel-meta p { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; }

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 500; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 16px; width: 1%; }
.table td.num, .table th.num { text-align: right; }
.table tbody tr { transition: background-color 120ms ease-out; }
.table tbody tr:hover { background: var(--surface-2); }
.row-link { display: flex; align-items: center; gap: 12px; font-weight: 550; font-size: var(--fs-md); }
.row-plan { width: 64px; height: 36px; flex: none; border: 1px solid var(--line); border-radius: 8px; padding: 3px; background: var(--surface-2); }
.empty { padding: 20px; color: var(--ink-2); }

.new-form { display: flex; align-items: flex-end; gap: 12px; padding: 16px; flex-wrap: wrap; }
.new-form .grow { flex: 1 1 260px; }
.new-form .field { flex: 0 1 200px; }
.new-form .field.grow { flex: 1 1 260px; }
.new-form .field.room-field { flex: 1 1 280px; }

.layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.layout-card { display: grid; overflow: hidden; }
.layout-plan { display: block; aspect-ratio: 16 / 9; padding: 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.layout-meta { padding: 14px 16px 4px; display: grid; gap: 2px; }
.layout-meta h3 { font-size: var(--fs-md); font-weight: 650; }
.layout-meta p { font-size: var(--fs-sm); color: var(--ink-2); }
.layout-actions { display: flex; gap: 8px; padding: 10px 16px 16px; }
.layout-actions .btn-round { margin-left: auto; }

.room-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); }
.room-card { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 16px; padding: 12px 16px 12px 12px; }
.room-plan { height: 72px; padding: 6px; border-radius: 10px; background: var(--surface-2); }
.room-meta h3 { font-size: var(--fs-md); font-weight: 650; }
.room-meta p { font-size: var(--fs-sm); color: var(--ink-2); }

/* ---------- editor ---------- */
.editor-page, .editor-page > div { height: 100%; }
.editor {
  display: grid; height: 100dvh;
  grid-template-columns: 248px minmax(0, 1fr) 304px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top top top" "lib view panel" "status status status";
}
.ed-top { grid-area: top; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ed-title { flex: 1; min-width: 0; display: grid; }
.ed-name { border: 1px solid transparent; background: transparent; font-size: var(--fs-lg); font-weight: 650; padding: 2px 8px; margin-left: -8px; border-radius: 8px; min-width: 0; text-overflow: ellipsis; }
.ed-name:hover { border-color: var(--line); }
.ed-name:focus { outline: none; border-color: var(--ink); }
.ed-crumb { font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-tools { display: flex; align-items: center; gap: 8px; }
.ed-save { font-size: var(--fs-sm); color: var(--ink-2); min-width: 80px; text-align: right; }
.seg { display: inline-flex; padding: 0; min-height: var(--tap); border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.seg button { min-width: 56px; min-height: var(--tap); border: 0; border-radius: 11px; background: transparent; font-weight: 600; cursor: pointer; transition: background-color 160ms ease-out, color 160ms ease-out; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }

.ed-lib { grid-area: lib; overflow-y: auto; padding: 16px 12px 24px; background: var(--surface); border-right: 1px solid var(--line); }
.lib-head { padding: 0 6px 12px; }
.lib-head h2 { font-size: var(--fs-lg); font-weight: 650; }
.lib-search { width: 100%; min-height: var(--tap); margin-top: 10px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); font-size: var(--fs-md); }
.lib-search:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.lib-search::placeholder { color: var(--ink-2); }
.lib-head p { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; }
.lib-group { display: grid; gap: 4px; padding-top: 14px; }
.lib-group h3 { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); padding: 0 6px 4px; }
.lib-item {
  display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  text-align: left; min-height: 52px; padding: 6px 8px; border-radius: var(--r-ctl);
  border: 1px solid transparent; background: transparent; cursor: pointer;
  transition: background-color 140ms ease-out, border-color 140ms ease-out;
}
.lib-item:hover { background: var(--surface-2); border-color: var(--line); }
.lib-item:active { transform: scale(0.99); }
.lib-glyph { grid-row: span 2; }
.lib-glyph rect { fill: var(--ink); }
.lib-name { font-weight: 550; line-height: 1.25; }
.lib-dims { font-size: var(--fs-xs); color: var(--ink-2); font-variant-numeric: tabular-nums; }

.ed-view { grid-area: view; position: relative; overflow: hidden; background: var(--view-bg); touch-action: none; }
.view-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.view-canvas:active { cursor: grabbing; }
.view-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.view-overlay > * { position: absolute; left: 0; top: 0; }
.ov-section { font-size: var(--fs-sm); font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.ov-label {
  font-size: var(--fs-xs); font-weight: 600; padding: 2px 7px; border-radius: 6px; white-space: nowrap; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; background: rgb(255 255 255 / 0.92); color: #141414; border: 1px solid #dededa;
  font-variant-numeric: tabular-nums;
}
.ov-label.is-selected { background: #141414; color: #fff; border-color: #141414; z-index: 2; }
.ov-handle { width: var(--tap); height: var(--tap); padding: 0; border: 0; background: transparent; pointer-events: auto; cursor: nwse-resize; touch-action: none; z-index: 3; }
.ov-handle::after { content: ""; position: absolute; inset: 50%; width: 14px; height: 14px; margin: -7px; background: #fff; border: 2px solid #141414; border-radius: 3px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.2); }
.ov-handle.is-edge::after { border-radius: 50%; width: 12px; height: 12px; margin: -6px; }

.ed-panel { grid-area: panel; overflow-y: auto; padding: 16px 16px 24px; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { font-size: var(--fs-lg); font-weight: 650; }
.ed-panel h3 { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.field-row { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; align-items: flex-end; min-width: 0; }
.field-row legend { font-size: var(--fs-sm); color: var(--ink-2); padding: 0 0 6px; }
.field-row label { display: grid; gap: 4px; flex: 1; min-width: 0; font-size: var(--fs-xs); color: var(--ink-2); }
.field-row input { padding: 0 8px; font-variant-numeric: tabular-nums; }
.field-row.rotate label { flex: 1; }
.panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.panel-actions .btn-danger { grid-column: span 2; }
.note { font-size: var(--fs-sm); padding: 8px 12px; border-radius: var(--r-ctl); }
.note.is-danger { background: var(--danger-soft); color: var(--danger-ink); font-weight: 550; }
.hint { font-size: var(--fs-sm); color: var(--ink-2); }
.facts { margin: 0; display: flex; justify-content: space-between; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 600; }
.aw-list, .totals { list-style: none; margin: 0; padding: 0; display: grid; }
.aw-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.aw-list li:last-child { border-bottom: 0; }
.totals li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.totals li:last-child { border-bottom: 0; }
.totals .num { font-weight: 650; }

/* layout checks */
.checks { list-style: none; margin: 0; padding: 0; display: grid; }
.checks li { display: grid; grid-template-columns: 18px 1fr; gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.checks li:last-child { border-bottom: 0; }
.checks .mark { grid-row: span 2; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; font-weight: 700; font-size: 12px; line-height: 1; color: var(--ink); }
.checks .is-warn .mark { background: var(--danger); color: #fff; }
.checks .is-info .mark { border: 1.5px solid var(--ink-2); color: var(--ink-2); }
.checks strong { font-weight: 600; color: var(--ink); }
.checks .is-warn strong { color: var(--danger); }
.checks span:last-child { color: var(--ink-2); }

.ed-status { grid-area: status; display: flex; justify-content: space-between; gap: 16px; padding: 10px 16px; font-size: var(--fs-sm); background: var(--surface); border-top: 1px solid var(--line); color: var(--ink-2); }
.ed-status strong { color: var(--ink); font-weight: 650; }
.ed-sel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-disclaimer { white-space: nowrap; color: var(--ink-2); }

/* view controls, present mode, measure, selection box */
.view-bar { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 8px; z-index: 4; }
.vb-group { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); box-shadow: var(--shadow); overflow: hidden; }
.vb-btn { min-width: var(--tap); min-height: var(--tap); display: inline-grid; place-items: center; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; font-weight: 550; font-size: var(--fs-sm); transition: background-color 140ms ease-out; }
.vb-btn:last-child { border-right: 0; }
.vb-btn.text { padding: 0 12px; }
.vb-btn:hover { background: var(--surface-2); }
.editor[data-mode="2d"] .vb-cams { display: none; }
.present-bar { display: none; position: absolute; top: 16px; right: 16px; gap: 8px; z-index: 4; }
.present-bar .seg { background: var(--surface); box-shadow: var(--shadow); }
.editor.is-presenting { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "view"; }
.editor.is-presenting .ed-top, .editor.is-presenting .ed-lib, .editor.is-presenting .ed-panel, .editor.is-presenting .ed-status { display: none; }
.editor.is-presenting .present-bar { display: flex; }
.editor.is-presenting .view-canvas { cursor: grab; }
.editor.is-measuring .view-canvas { cursor: crosshair; }
.ov-marquee { position: absolute; border: 1.5px dashed #141414; background: rgb(20 20 20 / 0.06); pointer-events: none; }
.ov-measure { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.ov-measure .m-line { stroke: #141414; stroke-width: 2; }
.ov-measure .m-dot { fill: #141414; }
.ov-measure .m-tag { fill: #141414; }
.ov-measure .m-text { fill: #fff; font: 600 13px var(--font); text-anchor: middle; font-variant-numeric: tabular-nums; }
.grid-fill { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 0 12px; }
.grid-fill[open] { padding-bottom: 12px; display: grid; gap: 10px; }
.grid-fill summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.btn-secondary.wide { width: 100%; }
.align-grid { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, var(--tap)); gap: 8px; }
.align-grid legend { font-size: var(--fs-sm); color: var(--ink-2); padding: 0 0 6px; }
.btn-icon.square { border-radius: var(--r-ctl); }
.facts.big dd { font-size: var(--fs-lg); }

/* venue setup */
.tabs { align-self: start; justify-self: start; }
.tabs button { padding: 0 16px; }
.setup { padding: 20px; }
.setup-pick { display: grid; place-content: center; justify-items: center; gap: 8px; min-height: min(60vh, 520px); padding: 48px 16px; text-align: center; border: 1.5px dashed var(--line-strong); border-radius: var(--r-card); background: var(--surface-2); }
.setup.is-pick { padding: 0; border: 0; background: none; }
.setup-pick .btn-primary { margin-top: 8px; }
.steps { display: flex; gap: 8px; list-style: none; margin: 0 0 16px; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 550; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-strong); font-size: var(--fs-sm); }
.steps li + li::after { order: -1; content: ""; width: 24px; height: 1px; background: var(--line-strong); }
.steps li[aria-current="step"] { color: var(--ink); }
.steps li[aria-current="step"]::before { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.setup-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.setup-canvas { height: min(68vh, 640px); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; }
.setup-canvas canvas { display: block; cursor: crosshair; }
.setup-side { display: grid; gap: 12px; align-content: start; }
.setup-side .row { display: flex; gap: 8px; flex-wrap: wrap; }
.setup-save { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.setup-save .field-row input { padding: 0 8px; }
.setup-blank { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.setup-blank .field { flex: 0 1 180px; }
.setup-blank .field.grow { flex: 1 1 260px; }
@media (max-width: 960px) { .setup-body { grid-template-columns: 1fr; } }

/* comments */
.ov-pin { width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid #fff; background: #141414; color: #fff; font: 700 12px var(--font); font-variant-numeric: tabular-nums; pointer-events: auto; cursor: pointer; box-shadow: 0 1px 4px rgb(0 0 0 / 0.25); z-index: 4; }
.ov-pin::before { content: ""; position: absolute; inset: -8px; } /* 44px hit area */
.ov-pin.is-floor { background: #fff; color: #141414; border-color: #141414; }
.ov-leader { position: absolute; left: 0; top: 0; height: 1.5px; background: #141414; transform-origin: 0 50%; pointer-events: none; }
.comments { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.comment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.comment-list li { display: flex; align-items: flex-start; gap: 10px; }
.comment-list p { flex: 1; min-width: 0; padding-top: 2px; overflow-wrap: anywhere; }
.pin-n { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.pin-n.is-floor { background: var(--surface); color: var(--ink); border: 1.5px solid var(--ink); }
.link-row { flex: 1; min-width: 0; display: grid; text-align: left; border: 0; background: none; padding: 2px 0; min-height: var(--tap); cursor: pointer; }
.link-row:disabled { cursor: default; }
.link-row strong { font-weight: 600; }
.link-row span { color: var(--ink-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.link-row:not(:disabled):hover strong { text-decoration: underline; text-underline-offset: 3px; }

/* versions */
.version-form { display: flex; gap: 8px; min-width: 0; }
.version-form .btn-secondary { flex: none; padding: 0 12px; }
.version-form input { flex: 1; min-width: 0; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); }
.version-form input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.version-form input::placeholder { color: var(--ink-2); }
.versions { list-style: none; margin: 0; padding: 0; display: grid; }
.versions li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.versions li:last-child { border-bottom: 0; }
.versions li > div { flex: 1; min-width: 0; display: grid; }
.versions strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.versions .num { font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* export menu (native popover) */
.menu { position: fixed; inset: auto; margin: 0; width: 300px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); color: var(--ink); box-shadow: 0 8px 32px rgb(20 20 20 / 0.12); }
.menu button { display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: var(--tap); padding: 10px 12px; border: 0; border-radius: var(--r-ctl); background: transparent; text-align: left; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu button .ic { margin-top: 2px; }
.menu strong { display: block; font-weight: 600; }
.menu small { display: block; font-size: var(--fs-sm); color: var(--ink-2); }

/* print sheet: only exists while printing */
.print-sheet { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block; color: #141414; font: 400 10pt/1.4 var(--font); }
  .ps-page { break-after: page; display: grid; gap: 4mm; }
  .ps-page:last-child { break-after: auto; }
  .ps-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; border-bottom: 0.4mm solid #141414; padding-bottom: 3mm; }
  .ps-brand { font-weight: 800; letter-spacing: 0.06em; font-size: 9pt; }
  .ps-head h1 { font-size: 18pt; font-weight: 650; margin-top: 1mm; }
  .ps-head p { color: #5c5c58; }
  .ps-facts { display: flex; gap: 8mm; margin: 0; }
  .ps-facts dt { color: #5c5c58; font-size: 8pt; }
  .ps-facts dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
  .ps-plan { width: 100%; max-height: 150mm; object-fit: contain; border: 0.3mm solid #e3e3e0; }
  .ps-split { display: grid; grid-template-columns: 1.25fr 1fr; gap: 8mm; align-items: start; }
  .ps-3d { width: 100%; border: 0.3mm solid #e3e3e0; }
  .ps-split h2 { font-size: 12pt; font-weight: 650; margin-bottom: 2mm; }
  .ps-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
  .ps-table th { text-align: left; font-weight: 500; color: #5c5c58; border-bottom: 0.3mm solid #141414; padding: 1.5mm 2mm; }
  .ps-table td { border-bottom: 0.2mm solid #e3e3e0; padding: 1.5mm 2mm; font-variant-numeric: tabular-nums; }
  .ps-table tr { break-inside: avoid; }
  .ps-table .n { text-align: right; }
  .ps-table tfoot td { font-weight: 650; border-bottom: 0; border-top: 0.3mm solid #141414; }
  .ps-foot { font-size: 8pt; color: #5c5c58; }
  .ps-sub { margin-top: 5mm; }
  .ps-notes { margin: 0; padding-left: 6mm; font-size: 9pt; }
  .ps-notes li { padding: 0.8mm 0; break-inside: avoid; }
}

/* ---------- messages ---------- */
.banner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); padding: 8px 8px 8px 16px; border-radius: 12px; background: var(--danger); color: #fff; font-weight: 550; box-shadow: var(--shadow); }
.banner button { min-height: var(--tap); padding: 0 12px; border-radius: 8px; border: 1px solid rgb(255 255 255 / 0.5); background: transparent; color: #fff; cursor: pointer; }
.toast { position: fixed; bottom: 64px; left: 50%; transform: translateX(-50%); z-index: 40; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--on-ink); font-weight: 550; box-shadow: var(--shadow); animation: toast-in 200ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  .editor { grid-template-columns: 216px minmax(0, 1fr) 272px; }
  .ed-status { flex-wrap: wrap; row-gap: 2px; }
  .ed-tools .btn-toggle span, .ed-tools .btn-primary span { display: none; }
  .ed-tools .btn-toggle, .ed-tools .btn-primary { padding: 0 12px; }
  .ed-tools { gap: 6px; }
}
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .dash { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 4px; padding: 12px 16px; overflow-x: auto; }
  .brand { padding: 0 12px 0 0; }
  .nav-heading, .offline-status { display: none; }
  .nav-list { display: flex; gap: 4px; }
  .nav-list a { white-space: nowrap; }
  .content { margin: 0 8px 8px; padding: 24px 16px 32px; border-radius: 20px; }
  .hotel-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: var(--fs-xl); }
}
@media (max-width: 760px) {
  .editor {
    height: auto; min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 58dvh auto auto auto;
    grid-template-areas: "top" "view" "lib" "panel" "status";
  }
  .ed-top { flex-wrap: wrap; }
  .ed-title { flex-basis: calc(100% - 60px); }
  .ed-tools { width: 100%; justify-content: space-between; }
  .ed-lib { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; }
  .lib-head { display: none; }
  .lib-group { display: flex; gap: 6px; padding: 0; }
  .lib-group h3 { display: none; }
  .lib-item { flex: none; width: 168px; border-color: var(--line); }
  .ed-panel { border-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
