:root {
  --ink: #f7f5ef;
  --paper: #101214;
  --surface: #191d20;
  --raised: #24292d;
  --line: #566066;
  --forest: #bb353e;
  --muted: #cbd2d4;
  --accent: #ff898b;
  --shadow: 0 12px 32px #0008;
  color-scheme: dark;
}
body { background: var(--paper); color: var(--ink); font: 14px/1.5 system-ui, sans-serif; }
button, input { font: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #ffe178; outline-offset: 3px; }
button { min-height: 40px; }
.console-brand { display: inline-flex; align-items: center; gap: .65rem; width: max-content; color: var(--accent); text-decoration: none; font-weight: 800; font-style: italic; font-size: 1.1rem; }
.console-brand-icon { display: block; width: 64px; height: 36px; background: var(--accent); -webkit-mask: url('/logo-mark.svg') center / contain no-repeat; mask: url('/logo-mark.svg') center / contain no-repeat; }
.intro { background: radial-gradient(circle at 20% 25%, #5a232b, #1c1b20 48%, #101214); color: var(--ink); padding: clamp(40px, 9vw, 110px); }
.intro p, form>p, header small, .detail small, .space-heading small { color: var(--accent); font-size: 11px; }
.intro h1 { font: 700 clamp(42px, 5.2vw, 72px)/1.15 system-ui, sans-serif; letter-spacing: -.04em; }
.intro h1 i { color: var(--accent); font-style: normal; }
.intro>small { color: #e3e7e5; font-size: 15px; max-width: 520px; }
.home-link { color: var(--ink); margin-top: 2rem; text-underline-offset: .2em; }
form { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
form h2, main>header h2, .space-heading h3, .detail h3 { font-family: system-ui, sans-serif; letter-spacing: -.02em; }
form label { font-size: 14px; }
form em { color: var(--muted); font-size: 12px; }
input { width: 100%; background: var(--raised); border-color: var(--line); color: var(--ink); font-size: 14px; }
input::placeholder { color: #aeb9bc; }
form>button, .actions>button:first-child, .space-heading>button { background: var(--forest); color: white; }
form>button:hover, .actions>button:first-child:hover, .space-heading>button:hover { background: #d9434e; }
.app { background: var(--paper); }
aside { background: var(--surface); border-color: var(--line); }
aside nav button { color: var(--muted); font-size: 13px; }
aside nav button:hover { background: var(--raised); color: var(--ink); }
aside nav button.active { background: var(--forest); color: white; }
aside nav button i { background: #79232b; color: white; }
aside footer { border-color: var(--line); color: var(--muted); }
aside footer small { color: var(--muted); }
main>header { background: var(--surface); border-color: var(--line); }
main>header h2 { font-size: 25px; }
.user>span { background: var(--forest); color: white; }
.user b { font-size: 13px; }
.user b small { color: var(--muted); }
.user button { border-color: var(--line); color: var(--muted); font-size: 13px; }
.toolbar { gap: 1rem; flex-wrap: wrap; }
.toolbar small { color: var(--muted); }
#filters { flex-wrap: wrap; }
#filters button, .location-tabs button, .location-chips button { background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 12px; }
#filters button.active, .location-tabs button.active, .location-chips button.active { background: var(--forest); border-color: var(--forest); color: white; }
.location-bar { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin: 0 0 20px; }
.location-bar>span { font: 11px 'DM Mono', monospace; color: var(--accent); }
.location-tabs, .location-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.location-tabs button, .location-chips button { padding: 7px 10px; }
.card.location-hidden { display: none; }
.card, .detail, .place { background: var(--surface); border-color: var(--line); color: var(--ink); }
.card:hover, .chosen { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card em, .card p, .card footer, .detail p, .space-heading p, .place p, .place small, .manage article, .meta { color: var(--muted); }
.card strong, .place b { font-size: 13px; }
.card em, .card p, .card footer, .place p, .place small { font-size: 12px; }
.card footer, .meta { border-color: var(--line); }
.badge { font-size: 10px; font-weight: 700; }
.badge.urgent { background: #7b212a; color: white; }
.badge.normal { background: #1a5269; color: #e7f7ff; }
.badge.watch { background: #644b20; color: #fff2bf; }
.detail h3 { font-size: 23px; }
.detail p, .ai p { font-size: 13px; }
.detail-title { flex-wrap: wrap; align-items: flex-start; }
.live { background: #312027; color: var(--accent) !important; }
.ai { background: var(--raised); border-color: var(--accent); }
.ai>b, .ai small { color: var(--accent); }
.ai p { color: var(--ink); }
.ai small, .meta, .meta b, .manage article, .manage button { font-size: 11px; }
.actions { flex-wrap: wrap; }
.actions>button+button, .line { background: var(--surface); border-color: var(--line); color: var(--ink); }
.meta b { color: var(--ink); }
.space-heading { gap: 1rem; }
.space-heading h3 { font-size: 27px; }
.place>span { background: linear-gradient(135deg, #58242b, #92343b); color: white; }
.model { background: var(--raised); }
.model>header, .model>footer { color: var(--ink); font-size: 11px; }
.floor { background: #4a4b4b; border-color: #929598; }
.wall, .shelf { background: #777e80; border-color: #a9afb0; }
.shelf.c, .shelf.d { background: #a06b6b; }
.pin, .pin.p3 { background: var(--forest); }
.manage article { border-color: var(--line); }
.manage strong, .manage .ok { color: var(--ink); font-family: system-ui, sans-serif; }
.manage small { color: var(--muted); font-size: 11px; }
.manage button { color: var(--accent); }
#toast { z-index: 30; background: var(--forest); color: white; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: #000b; }
.modal-card { width: min(760px, 100%); max-height: min(90vh, 800px); overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); padding: clamp(20px, 3vw, 34px); }
.modal-card.editor { width: min(1000px, 100%); }
.modal-card>header { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
.modal-card>header h2 { margin: .3rem 0; font-size: 24px; }
.modal-card>header p { color: var(--muted); margin: 0; }
.modal-card>header>button { border: 1px solid var(--line); background: var(--raised); color: var(--ink); width: 42px; height: 42px; font-size: 26px; }
.config-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; border-bottom: 1px solid var(--line); padding: 1rem 0; }
.config-row strong { font-size: 16px; }
.config-row p { color: var(--muted); margin: .3rem 0; }
.config-row small { color: var(--accent); }
.config-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.config-actions button, .editor-controls button { border: 1px solid var(--line); background: var(--raised); color: var(--ink); padding: .5rem .75rem; }
.config-actions button:first-child, .editor-controls .publish { background: var(--forest); border-color: var(--forest); color: white; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(220px, .7fr); gap: 1rem; margin-top: 1.2rem; }
.editor-canvas { min-height: 320px; position: relative; overflow: hidden; background: #30363a; border: 1px solid var(--line); }
.editor-canvas::before { content: ''; position: absolute; inset: 12% 16%; border: 8px solid #9ba0a1; transform: skewY(-8deg); }
.map-wall { position: absolute; z-index: 1; background: #a8adae; }
.map-wall.one { width: 38%; height: 12px; left: 25%; top: 38%; }
.map-wall.two { width: 12px; height: 35%; left: 64%; top: 38%; }
.map-route { position: absolute; left: 30%; top: 55%; width: 40%; height: 22%; border-bottom: 4px dashed var(--accent); border-left: 4px dashed var(--accent); border-radius: 0 0 0 50%; }
.map-pin { position: absolute; z-index: 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--forest); color: white; }
.map-pin.danger { left: 30%; top: 30%; }.map-pin.info { right: 23%; top: 42%; }.map-pin.route { left: 42%; bottom: 22%; }
.editor-canvas>small { position: absolute; left: 12px; bottom: 12px; color: var(--ink); }
.editor-controls { display: grid; align-content: start; gap: .5rem; }
.editor-controls h3 { margin: .9rem 0 .2rem; }
.preview:before, .stage:before { display: none; }
.preview { display: grid; place-items: center; isolation: isolate; }
.preview::after { content: ''; position: absolute; inset: 12px; border: 1px solid #fff5; background: repeating-linear-gradient(45deg, #ffffff0a 0 10px, #00000012 10px 20px); z-index: -1; }
.preview-mask { color: white; font-size: 24px; font-weight: 700; letter-spacing: .2em; }
.preview small { color: #fff; }
.card[data-status="in_call"] { opacity: .88; }
.card[data-status="resolved"] { opacity: .66; }
.queue-state { display: inline-flex; align-items: center; gap: .25rem; font-weight: 700; }
.queue-state.waiting, .queue-state.pending { color: #ffb9bd; }
.queue-state.in_call { color: #9edbd0; }
.queue-state.resolved { color: var(--muted); }
.detail.empty-detail { display: grid; place-items: center; min-height: 360px; text-align: center; }
.empty-detail h3 { color: var(--ink); }
.empty-detail p { max-width: 32rem; }
.stage { display: block; width: 100%; height: auto; min-height: 250px; aspect-ratio: 16 / 9; background: #202b31; border: 1px solid var(--line); }
.stage.privacy { display: grid; place-items: center; text-align: center; padding: 2rem; background: radial-gradient(circle at 50% 40%, #394a50, #1b2429 70%); }
.privacy-panel { max-width: 27rem; color: var(--ink); }
.privacy-panel .lock { display: block; font-size: 2.3rem; color: var(--accent); }
.privacy-panel strong { display: block; margin-top: .7rem; font-size: 18px; }
.privacy-panel p { color: #e3e8e9; font-size: 13px; }
.stage.call { position: relative; overflow: hidden; background: #000; }
.stage.call img { width: 100%; height: 100%; display: block; object-fit: cover; }
.feed-label { position: absolute; left: 12px; top: 12px; background: #101214e8; color: white; padding: 6px 10px; font: 700 11px system-ui, sans-serif; }
.feed-meta { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; background: #101214dd; color: white; padding: 8px 10px; font-size: 12px; }
.consent-note { margin: 14px 0; padding: 13px; background: #2a3035; border-left: 3px solid #f3ba65; color: var(--ink); }
.consent-note strong { display: block; margin-bottom: .3rem; }
.consent-note p { color: var(--muted); margin: 0; }
.actions button { min-width: 150px; }
.model { height: auto; min-height: 0; display: flex; flex-direction: column; }
.model>header { position: static; padding: 12px 14px; }
.model>footer { position: static; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 11px; height: 11px; border-radius: 2px; background: var(--swatch); }
.spatial-viewport { width: 100%; height: 360px; position: relative; overflow: hidden; background: #1b242a; }
.spatial-viewport canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.spatial-viewport canvas:active { cursor: grabbing; }
.spatial-viewport canvas:focus-visible { outline: 3px solid #ffe178; outline-offset: -4px; }
.spatial-view-controls { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; max-width: calc(100% - 20px); }
.spatial-view-controls button { border: 1px solid #a3b6bf; background: #17242be8; color: #fff; padding: 6px 9px; min-height: 32px; font: 600 12px system-ui, sans-serif; cursor: pointer; }
.spatial-view-controls button:hover, .spatial-view-controls button:focus-visible { background: #315c6c; outline: 2px solid #ffe178; }
.spatial-view-controls button[aria-pressed="true"] { background: #315c6c; border-color: #d5e7ef; }
.editor-canvas { min-height: 360px; }
.editor-canvas::before { display: none; }
.editor-controls button[data-tool].active { background: #70303a; border-color: var(--accent); color: white; }
#editor-status { margin: .6rem 0; padding: 10px; border-left: 3px solid var(--accent); background: var(--raised); color: var(--ink); font-size: 12px; }
#undo-editor:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 850px) {
  .login { grid-template-columns: 1fr; }
  .intro { min-height: 360px; }
  .app { display: block; }
  aside { display: flex; padding: 14px 20px; gap: 1rem; }
  aside nav { display: flex; flex-wrap: wrap; margin: 0; }
  aside footer { display: none; }
  .assist-grid, .spaces-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .intro { padding: 36px 24px; }
  form { padding: 25px; }
  .page { padding: 20px; }
  .cards, .manage, .editor-grid { grid-template-columns: 1fr; }
  .config-row { align-items: start; flex-direction: column; }
  main>header { height: auto; gap: .6rem; padding: 16px 20px; }
}
