/* Light, paper-like palette shared by all viewer styles (same tokens as the Objektplan tools). */
:root {
  --ground: #E7E6E2;
  --paper: #F1F0EC;
  --paper-raised: #FBFAF8;
  --line: #D6D5D0;
  --line-soft: #DEDDD8;
  --control-line: #CFCEC8;
  --ink: #18191A;
  --ink-soft: #45464A;
  --muted: #6B6C68;
  --accent: #4F7A16;
  --accent-soft: #E6EDDB;
  --warn: #B4650A;
  --info: #2F6F8F;
  --radius: 4px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Geist', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--ground);
  color: var(--ink);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button, input, select { font-family: inherit; }

#canvas { width: 100%; height: 100%; display: block; touch-action: none; }

/* Shell like the Objektplan tools: dark numbered sidebar, light breadcrumb header. */
:root { --side-w: 228px; --header-h: 57px; }
.overlay { position: absolute; inset: 0 auto auto 0; pointer-events: none; z-index: 10; }
.app-side { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); display: flex; flex-direction: column; background: #17191B; color: #E7E6E2; pointer-events: auto; z-index: 11; }
.app-brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px 24px; color: #E7E6E2; text-decoration: none; }
.app-brand > span:last-child { display: flex; flex-direction: column; }
.app-brand b { font-size: 15px; font-weight: 600; }
.app-brand small { font-size: 11px; color: #8C8E8A; }
.app-mark { width: 34px; height: 34px; flex: none; border-radius: 4px; background: #F1F0EC; color: #17191B; display: grid; place-items: center; font-weight: 700; font-size: 12px; letter-spacing: -.04em; }
.app-side-label { padding: 14px 20px 8px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #8C8E8A; }
.app-side-label[hidden], .app-nav[hidden] { display: none; }
.app-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.app-nav button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 38px; padding: 9px 10px; border: 0; border-radius: 4px; background: transparent; color: #B9BBB6; font-size: 13.5px; text-align: left; cursor: pointer; }
.app-nav button:hover:not(:disabled) { background: #25282B; color: #F1F0EC; }
.app-nav button[aria-pressed="true"], .app-nav button[aria-current="true"] { background: #2A2D30; color: #FFFFFF; }
.app-nav button:disabled { opacity: .45; cursor: wait; }
.app-nav i { width: 16px; font: normal 10px 'Geist Mono', ui-monospace, monospace; color: #8C8E8A; }
.app-side-foot { margin-top: auto; padding: 14px 20px 18px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid #2A2D30; }
.app-side-foot .property-link { color: #B9BBB6; font-size: 12.5px; text-decoration: none; }
.app-side-foot .property-link:hover { color: #FFFFFF; }
.app-nav button:focus-visible, .app-side a:focus-visible { outline: 2px solid #9DBF5E; outline-offset: 2px; }

header {
  position: fixed;
  left: var(--side-w);
  right: 0;
  top: 0;
  min-height: var(--header-h);
  padding: 10px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  pointer-events: auto;
}
.header-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
header h1.app-crumb { font-size: 14px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.app-crumb-sep { color: #B3B3AE; }
.app-scan { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; min-width: 0; }
.app-scan:hover { background: var(--line-soft); }
.app-scan span:last-child { color: var(--muted); font-size: 11px; }
#selectedScan { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.mode-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; }
#crouchBadge { color: var(--warn); font-size: 11px; padding: 3px 8px; border: 1px solid currentColor; border-radius: 999px; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#scanPanel { width: min(1120px, calc(100vw - 32px)); max-height: 82dvh; margin: auto; padding: 24px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow); overflow: hidden; }
#scanPanel[open] { display: flex; flex-direction: column; gap: 24px; }
#scanPanel::backdrop { background: rgba(24, 25, 26, .25); }
.picker-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.picker-heading h2 { font-size: 20px; font-weight: 500; letter-spacing: -.01em; }
.picker-heading p, .picker-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
#closeScanPanel { border: 1px solid var(--control-line); border-radius: 999px; background: transparent; color: var(--ink); width: 36px; height: 36px; cursor: pointer; flex-shrink: 0; }
#closeScanPanel:hover { background: var(--line-soft); }
.picker-hint { display: none; }

.quality-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--control-line);
  border-radius: 999px;
  align-self: center;
}

.qual-btn {
  padding: 6px 12px;
  background: transparent;
  color: var(--ink-soft);
  border: none;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
}

.qual-btn:hover { background: var(--line-soft); color: var(--ink); }

.qual-btn.active {
  background: var(--ink);
  color: var(--paper);
}

.qual-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.walk-controls button { min-height: 34px; padding: 6px 14px; border: 1px solid var(--control-line); border-radius: 999px; background: transparent; color: var(--ink); font-size: 12.5px; cursor: pointer; }
.walk-controls button:hover { background: var(--line-soft); }
.walk-controls button:disabled { opacity: .5; cursor: wait; }
.walk-controls .qual-btn { min-height: 28px; border: 0; padding: 5px 12px; }
.walk-controls .qual-btn.active { background: var(--ink); color: var(--paper); }
#walkStatus { font-size: 12px; color: var(--muted); }
.walking .vertical-pad { display: none; }
.walk-crosshair { display: none; position: fixed; top: 50%; left: 50%; width: 5px; height: 5px; border-radius: 50%; background: white; box-shadow: 0 0 2px black; pointer-events: none; }
.walking .walk-crosshair { display: block; }
#stairFade { position: fixed; inset: 0; background: var(--ground); opacity: 0; transition: opacity .12s; pointer-events: none; z-index: 8; }
.stair-transition #stairFade { opacity: .95; }

.scan-grid {
  display: grid;
  grid-template-columns: 96px repeat(7, minmax(88px, 1fr));
  width: 100%;
  overflow: auto;
  padding: 3px 3px 12px;
  scrollbar-width: thin;
  gap: 0.4rem;
  align-items: center;
  pointer-events: auto;
}

.unassigned-scans {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
}

.scan-note {
  grid-column: var(--scan-note-start, 3) / -1;
  min-width: 0;
  padding: 0 0.4rem;
  font-size: 0.7rem;
  line-height: 1.3;
  color: var(--muted);
}

.scan-grid .col-header,
.scan-grid .row-header {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 0.4rem;
}

.scan-grid .col-header {
  text-align: center;
  padding-bottom: 0.2rem;
}

.scan-grid .row-header {
  text-align: right;
  white-space: nowrap;
}

.scan-btn {
  padding: 0.45rem 1rem;
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background .15s;
  pointer-events: auto;
  min-width: 0;
}

.scan-btn:hover:not(:disabled) {
  background: var(--line-soft);
}

.scan-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.scan-btn:disabled {
  opacity: 0.3;
  border-color: transparent;
  background: transparent;
  cursor: default;
}
.app-nav button[hidden] { display: none; }
