/* Civic Lobby — resident front end */

  :root {
    --ground: #e6e4de;
    --ground-deep: #d9d6cd;
    --surface: #f7f5f0;
    --surface-2: #edeae2;
    --line: #c9c4b7;
    --ink: #1b2430;
    --ink-2: #4b5563;
    --ink-3: #7a8290;
    --civic: #1f3b5c;
    --civic-ink: #ffffff;
    --brass: #a97c1f;
    --brass-soft: #e9d9a8;
    --floor: #ece7db;
    --floor-line: #dcd5c4;
    --wall: #b9ad94;
    --wall-top: #9d917a;
    --room-text: #1b2430;
    --door: #6b4a2b;
    --desk: #8a6a3d;
    --plant: #4f7d5a;
    --good: #2f7d4f;
    --warn: #b3541e;
    --wall-hi: #efe9dc; --wall-lo: #cfc5ae; --baseboard: #8b7b60; --door-frame: #5a4030; --door-a: #8d5d35; --door-b: #6b4426;
    --marble-a: #f0ebe1; --marble-b: #e3ddd0; --marble-vein: rgba(120,110,95,.16); --desk-hi: #a8875a; --plant-hi: #6f9e74; --runner: #2c4a70; --runner-edge: #b8912f;
    --shadow: 0 18px 40px -18px rgba(20, 30, 45, .45);
    --radius: 14px;
    --font-display: "Bricolage Grotesque", "Avenir Next", "Helvetica Neue", sans-serif;
    --font-body: "Atkinson Hyperlegible", "Verdana", "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", "SF Mono", Menlo, monospace;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --ground: #121a25; --ground-deep: #0d141d; --surface: #1b2634; --surface-2: #222f3f; --line: #344357;
      --ink: #eef0f3; --ink-2: #b6bfcb; --ink-3: #7f8a99; --civic: #8fb3e0; --civic-ink: #0f1824;
      --brass: #d8b052; --brass-soft: #4a3c1b; --floor: #2a3547; --floor-line: #33405a; --wall: #4a5369; --wall-top: #5c6780;
      --room-text: #eef0f3; --door: #c59858; --desk: #b48a50; --plant: #6fa57c; --good: #5dbb82; --warn: #e58a4a;
      --wall-hi: #5d6a80; --wall-lo: #3a4357; --baseboard: #262d3b; --door-frame: #3a2a20; --door-a: #a06c3f; --door-b: #7a5030;
      --marble-a: #36425c; --marble-b: #2d3850; --marble-vein: rgba(255,255,255,.05); --desk-hi: #c79a5e; --plant-hi: #8dc497; --runner: #4a6a94; --runner-edge: #d8b052;
      --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
    }
  }
  :root[data-theme="dark"] {
    --ground: #121a25; --ground-deep: #0d141d; --surface: #1b2634; --surface-2: #222f3f; --line: #344357;
    --ink: #eef0f3; --ink-2: #b6bfcb; --ink-3: #7f8a99; --civic: #8fb3e0; --civic-ink: #0f1824;
    --brass: #d8b052; --brass-soft: #4a3c1b; --floor: #2a3547; --floor-line: #33405a; --wall: #4a5369; --wall-top: #5c6780;
    --room-text: #eef0f3; --door: #c59858; --desk: #b48a50; --plant: #6fa57c; --good: #5dbb82; --warn: #e58a4a;
    --wall-hi: #5d6a80; --wall-lo: #3a4357; --baseboard: #262d3b; --door-frame: #3a2a20; --door-a: #a06c3f; --door-b: #7a5030;
    --marble-a: #36425c; --marble-b: #2d3850; --marble-vein: rgba(255,255,255,.05); --desk-hi: #c79a5e; --plant-hi: #8dc497; --runner: #4a6a94; --runner-edge: #d8b052;
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
  }

  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html, body { margin: 0; min-height: 100%; }
  body {
    background: var(--ground);
    background-image:
      radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--brass) 10%, transparent), transparent 60%),
      repeating-linear-gradient(0deg, transparent 0 39px, color-mix(in srgb, var(--line) 35%, transparent) 39px 40px),
      repeating-linear-gradient(90deg, transparent 0 39px, color-mix(in srgb, var(--line) 35%, transparent) 39px 40px);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
  a { color: var(--civic); }
  :focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

  /* ---------- shell ---------- */
  .shell { max-width: 1240px; margin: 0 auto; padding: 20px 20px 48px; }
  header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 0 18px; }
  .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
  .seal { width: 46px; height: 46px; border-radius: 50%; flex: none; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18); overflow: hidden; }
  .seal img { width: 100%; height: 100%; display: block; border-radius: 50%; }
  .brand-text { line-height: 1.15; }
  .brand-text b { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -.01em; display: block; }
  .brand-text span { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .12em; font-family: var(--font-mono); }
  .top-actions { display: flex; align-items: center; gap: 10px; }
  .chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
  .chip .mini { width: 26px; height: 26px; }
  .ghost { background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; color: var(--ink-2); position: relative; }
  .ghost:hover { border-color: var(--ink-3); color: var(--ink); }
  .ghost .badge { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brass); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; font-family: var(--font-mono); }

  .screen { display: none; }
  .screen.active { display: block; }

  /* ---------- entry ---------- */
  .entry { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 440px); gap: 36px; align-items: center; min-height: 70vh; }
  .hero-photo { position: relative; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 16 / 9; background: var(--surface-2); }
  .hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .hero-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(15, 22, 32, .75)); }
  .hero-photo figcaption { position: absolute; left: 16px; right: 16px; bottom: 12px; z-index: 1; color: #fff; display: flex; justify-content: space-between; gap: 10px; align-items: end; font-size: 13px; }
  .hero-photo figcaption b { font-family: var(--font-display); font-weight: 600; font-size: 15px; display: block; }
  .hero-photo figcaption span { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
  .facade h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(34px, 5vw, 58px); line-height: .98; letter-spacing: -.025em; margin: 22px 0 10px; text-wrap: balance; }
  .facade h1 em { font-style: normal; color: var(--brass); }
  .facade p.lede { color: var(--ink-2); max-width: 52ch; margin: 0; font-size: 17px; }
  .facade .addr { margin-top: 18px; font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; }
  .proto-note { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }

  .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; position: relative; overflow: hidden; }
  .card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--civic), var(--brass)); }
  .steps { display: flex; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
  .steps li { display: flex; align-items: center; gap: 6px; }
  .steps li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
  .steps li.done::before { background: var(--good); }
  .steps li.now::before { background: var(--brass); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brass) 25%, transparent); }
  .steps li.now { color: var(--ink); }
  .steps li + li { margin-left: 6px; }
  .card h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; margin: 0 0 4px; letter-spacing: -.015em; }
  .card p.sub { margin: 0 0 18px; color: var(--ink-2); font-size: 15px; }
  .field { display: grid; gap: 6px; margin-bottom: 14px; }
  .field label { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
  .field input, .field select, .field textarea { width: 100%; padding: 12px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
  .field textarea { min-height: 96px; resize: vertical; }
  .field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
  .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--civic); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--civic) 20%, transparent); }
  .field .err { color: var(--warn); font-size: 13px; display: none; }
  .field.invalid .err { display: block; }
  .field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--warn); }
  .field .help { font-size: 12.5px; color: var(--ink-3); }
  .primary { width: 100%; padding: 13px 16px; border: 0; border-radius: 10px; background: var(--civic); color: var(--civic-ink); font-weight: 700; font-size: 15.5px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: transform .12s ease, filter .12s ease; }
  .primary:hover { filter: brightness(1.08); }
  .primary:active { transform: translateY(1px); }
  .primary:disabled { opacity: .55; cursor: not-allowed; }
  .card .foot { margin-top: 14px; font-size: 13px; color: var(--ink-3); text-align: center; }
  .linkbtn { background: none; border: 0; color: var(--civic); text-decoration: underline; padding: 0; font-size: inherit; }

  .code-row { display: flex; gap: 8px; justify-content: space-between; margin: 6px 0 4px; }
  .code-row input { width: 100%; aspect-ratio: 1 / 1.15; text-align: center; font-family: var(--font-mono); font-size: 26px; font-weight: 600; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); padding: 0; }
  .code-row input:focus { border-color: var(--civic); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--civic) 20%, transparent); }
  .code-row.shake { animation: shake .4s ease; }
  @keyframes shake { 20%,60% { transform: translateX(-6px);} 40%,80% { transform: translateX(6px);} }

  .inbox { margin: 16px 0 4px; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; background: color-mix(in srgb, var(--brass) 8%, var(--surface-2)); }
  .inbox .tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--brass); display: flex; align-items: center; gap: 8px; }
  .inbox .tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); animation: pulse 1.6s infinite; }
  @keyframes pulse { 50% { opacity: .3; } }
  .inbox .mail { margin-top: 8px; font-size: 14px; color: var(--ink-2); }
  .inbox .mail b { color: var(--ink); }
  .inbox .code { font-family: var(--font-mono); font-size: 22px; font-weight: 600; letter-spacing: .3em; color: var(--ink); margin-top: 4px; }
  .inbox .note { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

  .avatars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 16px; }
  .av-opt { border: 2px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 10px 6px 8px; display: grid; justify-items: center; gap: 4px; transition: transform .15s ease, border-color .15s ease; }
  .av-opt svg { width: 56px; height: 76px; }
  .av-opt span { font-size: 12.5px; color: var(--ink-2); }
  .av-opt:hover { transform: translateY(-2px); border-color: var(--ink-3); }
  .av-opt[aria-pressed="true"] { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 12%, var(--surface-2)); }
  .av-opt[aria-pressed="true"] span { color: var(--ink); font-weight: 700; }

  /* ---------- lobby ---------- */
  .lobby { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
  .lobby > * { min-width: 0; }
  .directory { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; top: 16px; }
  .directory h3 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
  .directory p { margin: 0 0 10px; color: var(--ink-3); font-size: 13px; }
  .dir-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
  .dir-list button { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 9px; border: 1px solid transparent; background: transparent; font-size: 14px; }
  .dir-list button:hover { background: var(--surface-2); }
  .dir-list button[aria-current="true"] { background: color-mix(in srgb, var(--brass) 14%, var(--surface-2)); border-color: color-mix(in srgb, var(--brass) 50%, transparent); font-weight: 700; }
  .dir-list .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(0,0,0,.15); }
  .dir-list small { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
  .directory .hours { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }

  .stage { position: relative; overflow: clip; overflow-clip-margin: 40px; }
  .map-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); overflow: hidden; }
  .map-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 2px 4px 10px; }
  .map-head .where { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
  .map-head .hint { color: var(--ink-3); font-size: 13px; }
  .map-head .hint b { color: var(--ink-2); font-weight: 700; }

  /* ---- 3D lobby ---- */
  .scene-wrap { position: relative; width: 100%; height: 470px; min-width: 0; overflow: hidden; border-radius: 10px;
    background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--brass) 18%, var(--ground-deep)), var(--ground-deep) 65%); }
  .scene { position: absolute; left: 0; top: 0; width: 880px; height: 470px; transform-origin: 0 0; perspective: 1500px; perspective-origin: 50% 10%; }
  .floor { position: absolute; left: 0; bottom: 16px; width: 880px; height: 600px; transform-origin: 50% 100%; transform: rotateX(56deg); transform-style: preserve-3d;
    background:
      radial-gradient(ellipse 30% 14% at 18% 32%, var(--marble-vein), transparent 65%),
      radial-gradient(ellipse 38% 10% at 68% 58%, var(--marble-vein), transparent 65%),
      radial-gradient(ellipse 26% 12% at 42% 84%, var(--marble-vein), transparent 65%),
      radial-gradient(ellipse 22% 9% at 85% 20%, var(--marble-vein), transparent 65%),
      repeating-conic-gradient(from 0deg, var(--marble-a) 0 25%, var(--marble-b) 0 50%) 0 0 / 160px 160px;
    box-shadow: 0 0 0 2px var(--wall-lo); }
  .floor > * { position: absolute; }
  .grain { inset: 0; pointer-events: none; opacity: .13;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.45 0 0 0 0 0.4 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E"); }
  .gridlines { inset: 0; pointer-events: none; background-image: linear-gradient(90deg, rgba(0,0,0,.05) 1px, transparent 1px), linear-gradient(rgba(0,0,0,.05) 1px, transparent 1px); background-size: 80px 80px; }
  .vignette { inset: 0; pointer-events: none; background: radial-gradient(ellipse 68% 62% at 50% 48%, transparent 45%, rgba(0,0,0,.26)); }
  .tint { cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), inset 0 0 0 12px rgba(255,255,255,.06); transition: filter .15s ease;
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 6px, transparent 6px 12px); }
  .tint:hover, .tint.active { filter: brightness(1.08); }
  .tint.active { box-shadow: inset 0 0 0 3px var(--brass), inset 0 0 0 12px rgba(255,255,255,.06); }
  .medallion { width: 180px; height: 180px; border-radius: 50%; transform: translate(-50%,-50%); pointer-events: none;
    background: radial-gradient(circle, var(--brass-soft) 0 14%, transparent 15%), repeating-radial-gradient(circle, transparent 0 16px, color-mix(in srgb, var(--brass) 45%, transparent) 16px 18px, transparent 18px 42px);
    box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--brass) 65%, transparent), inset 0 0 0 6px color-mix(in srgb, var(--brass) 25%, transparent); }
  .runner { background: linear-gradient(90deg, var(--runner-edge) 0 8px, var(--runner) 8px calc(100% - 8px), var(--runner-edge) calc(100% - 8px)); box-shadow: 0 0 10px rgba(0,0,0,.15); pointer-events: none; }
  .mat { background: repeating-linear-gradient(90deg, var(--runner) 0 3px, var(--runner-edge) 3px 4px); box-shadow: inset 0 0 0 3px var(--runner-edge); pointer-events: none; }
  .wshadow { pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.3), transparent); }
  .wshadow.l { background: linear-gradient(270deg, rgba(0,0,0,.22), transparent); }
  .wshadow.r { background: linear-gradient(90deg, rgba(0,0,0,.22), transparent); }

  .wall { height: 64px; transform-origin: 0 100%; transform-style: preserve-3d;
    background: linear-gradient(180deg, var(--wall-hi) 0%, var(--wall) 55%, var(--wall-lo) 100%);
    box-shadow: inset 0 -7px 0 var(--baseboard), inset 0 1px 0 rgba(255,255,255,.3); }
  .wall::before { content: ""; position: absolute; left: 0; right: 0; top: 22px; height: 3px; background: rgba(0,0,0,.09); border-bottom: 1px solid rgba(255,255,255,.18); }
  .wall.fy { transform: rotateX(-90deg); }
  .wall.fxp { transform: rotateZ(-90deg) rotateX(-90deg); }
  .wall.fxn { transform: rotateZ(90deg) rotateX(-90deg); }
  .wall.fxp::after, .wall.fxn::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.09); pointer-events: none; }
  .wall.fxn::after { background: rgba(0,0,0,.14); }
  .wall.ledge { height: 10px; background: var(--wall-lo); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
  .wall.ledge::before { display: none; }
  .wall.glass { background: linear-gradient(180deg, rgba(190,215,235,.40), rgba(190,215,235,.12)); box-shadow: inset 0 0 0 4px var(--door-frame); }
  .wall.glass::before { top: 4px; bottom: 4px; left: calc(50% - 2px); width: 4px; height: auto; background: var(--door-frame); border: 0; }
  .wall.glass::after { content: ""; position: absolute; left: 46%; top: 28px; width: 3px; height: 16px; background: var(--brass); box-shadow: 10px 0 0 var(--brass); }
  .wall.desk { height: 30px; background: linear-gradient(180deg, var(--desk-hi), var(--desk)); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); }
  .wall.desk::before { display: none; }
  .desk-top { transform: translateZ(30px); background: linear-gradient(90deg, var(--desk-hi), var(--desk) 40%, var(--desk-hi) 70%, var(--desk)); box-shadow: inset 0 0 0 3px rgba(0,0,0,.12), 0 2px 0 rgba(0,0,0,.25); pointer-events: none;
    background-image: repeating-linear-gradient(90deg, rgba(0,0,0,.06) 0 2px, transparent 2px 9px), linear-gradient(90deg, var(--desk-hi), var(--desk) 40%, var(--desk-hi) 70%, var(--desk)); }

  .door { position: absolute; bottom: 0; width: 34px; height: 52px; transform-style: preserve-3d; }
  .door .jamb { position: absolute; inset: -3px -3px 0; background: var(--door-frame); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
  .door .glow { position: absolute; inset: 0; background: linear-gradient(180deg, #fff6dc, #ffd98a); opacity: 0; transition: opacity .45s ease; }
  .door.open .glow { opacity: .95; }
  .door .leaf { position: absolute; inset: 0; background: linear-gradient(90deg, var(--door-a), var(--door-b)); transform-origin: left center; transition: transform .6s cubic-bezier(.2,.7,.2,1);
    box-shadow: inset 0 0 0 2px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.12); backface-visibility: visible; }
  .door .leaf::before, .door .leaf::after { content: ""; position: absolute; left: 6px; right: 6px; border: 2px solid rgba(0,0,0,.2); border-radius: 2px; box-shadow: inset 1px 1px 0 rgba(255,255,255,.08); }
  .door .leaf::before { top: 6px; height: 14px; } .door .leaf::after { top: 26px; height: 18px; }
  .door .knob { position: absolute; right: 5px; top: 27px; width: 4px; height: 4px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
  .door.open .leaf { transform: rotateY(-80deg); }
  .win { position: absolute; top: 8px; width: 26px; height: 40px; border-radius: 13px 13px 2px 2px; background: linear-gradient(180deg, #dcebf7, #b9d3ea 60%, #f3e9c9); box-shadow: inset 0 0 0 3px var(--door-frame), 0 0 18px rgba(255,240,200,.55); }
  .win::before { content: ""; position: absolute; left: calc(50% - 1.5px); top: 3px; bottom: 3px; width: 3px; background: var(--door-frame); }
  .win::after { content: ""; position: absolute; left: 3px; right: 3px; top: 18px; height: 3px; background: var(--door-frame); }
  .winlight { pointer-events: none; background: linear-gradient(180deg, rgba(255,245,215,.55), transparent); }
  .plate { position: absolute; bottom: 30px; left: 100%; margin-left: 9px; white-space: nowrap; background: linear-gradient(180deg, #efd99a, #b9932f); color: #2b220c; font: 600 8px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; padding: 4px 6px; border-radius: 2px; box-shadow: 0 1px 0 rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.35); }
  @media (prefers-reduced-motion: reduce) { .door .leaf, .door .glow { transition: none; } }

  .bill { transform-origin: 50% 100%; transform: translate(-50%, -100%) rotateX(-56deg); pointer-events: none; }
  .sprite svg { display: block; }
  .hang { transform-origin: 50% 100%; transform: translate(-50%, -100%) translateZ(92px) rotateX(-56deg); pointer-events: none; text-align: center;
    background: rgba(18, 26, 38, .86); color: #fff; font: 600 12.5px/1.15 var(--font-display); padding: 6px 10px 5px; border-radius: 7px; white-space: nowrap; box-shadow: 0 8px 18px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.12); }
  .hang small { display: block; font: 500 8.5px/1 var(--font-mono); letter-spacing: .12em; opacity: .7; margin-top: 4px; text-transform: uppercase; }
  .ashadow { width: 36px; height: 13px; border-radius: 50%; transform: translate(-50%, -50%); background: radial-gradient(rgba(0,0,0,.4), transparent 70%); pointer-events: none; }
  .avatar { width: 48px; height: 72px; will-change: transform; }
  .avatar svg { width: 48px; height: 72px; display: block; }
  .ntag { transform: translate(-50%, -100%) translateZ(86px) rotateX(-56deg); background: var(--ink); color: var(--ground); font: 700 11.5px/1 var(--font-body); padding: 5px 9px; border-radius: 999px; white-space: nowrap; pointer-events: none; box-shadow: 0 4px 10px rgba(0,0,0,.25); }
  .path-svg { inset: 0; pointer-events: none; }

  /* panel */
  .panel { position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(420px, calc(100% - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; transition: transform .38s cubic-bezier(.2,.7,.2,1), opacity .25s ease; }
  .panel.show { transform: none; opacity: 1; pointer-events: auto; }
  @media (prefers-reduced-motion: reduce) { .panel { transition: none; } }
  .panel-head { padding: 16px 18px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .panel-head .band { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }
  .panel-head .eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
  .panel-head h3 { margin: 2px 36px 6px 0; font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -.015em; line-height: 1.15; }
  .panel-head p { margin: 0; color: var(--ink-2); font-size: 14px; }
  .panel-head .close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; }
  .contact { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
  .contact span { display: inline-flex; align-items: center; gap: 6px; }
  .contact svg { width: 14px; height: 14px; opacity: .7; }
  .contact a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--ink-3); }
  .panel-body { overflow: auto; padding: 8px; flex: 1; }
  .panel-body .q { padding: 8px 10px 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px 4px 8px; }
  .act { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--civic) 35%, var(--line)); background: color-mix(in srgb, var(--civic) 7%, var(--surface-2)); text-align: left; }
  .act:hover { background: color-mix(in srgb, var(--civic) 14%, var(--surface-2)); }
  .act .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--civic); color: var(--civic-ink); flex: none; }
  .act .ic svg { width: 16px; height: 16px; }
  .act b { font-size: 13.5px; display: block; line-height: 1.15; }
  .act small { font-size: 11.5px; color: var(--ink-3); }
  .svc { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: inherit; text-decoration: none; }
  .svc:hover { background: var(--surface-2); border-color: var(--line); }
  .svc .ic { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--surface-2); }
  .svc:hover .ic { background: var(--surface); }
  .svc .ic svg { width: 17px; height: 17px; }
  .svc .t { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
  .svc .d { color: var(--ink-2); font-size: 13px; margin-top: 2px; display: block; }
  .svc .go { margin-left: auto; align-self: center; color: var(--ink-3); flex: none; }
  .svc .go svg { width: 14px; height: 14px; }
  .svc.urgent .ic { background: color-mix(in srgb, var(--warn) 18%, var(--surface-2)); color: var(--warn); }
  .svc.pay .ic { background: color-mix(in srgb, var(--good) 16%, var(--surface-2)); color: var(--good); }
  .panel-foot { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-3); }
  .panel-foot a { color: var(--ink-2); }

  /* forms inside panel */
  .pform { padding: 6px 8px 10px; }
  .pform .back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--ink-2); padding: 4px 0 10px; font-size: 13.5px; }
  .pform .back svg { width: 14px; height: 14px; }
  .pform h4 { margin: 0 0 2px; font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -.01em; }
  .pform p.sub { margin: 0 0 14px; color: var(--ink-2); font-size: 13.5px; }
  .chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .chip-opt { border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 7px 10px; font-size: 13px; line-height: 1.2; display: grid; text-align: center; min-width: 58px; }
  .chip-opt small { font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); letter-spacing: .04em; }
  .chip-opt:hover:not(:disabled) { border-color: var(--ink-3); }
  .chip-opt[aria-pressed="true"] { background: var(--civic); color: var(--civic-ink); border-color: var(--civic); }
  .chip-opt[aria-pressed="true"] small { color: var(--civic-ink); opacity: .75; }
  .chip-opt:disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
  .you { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-bottom: 14px; font-size: 13.5px; }
  .you .mini { width: 24px; height: 36px; flex: none; }
  .you span { color: var(--ink-2); }
  .you b { color: var(--ink); }

  .confirm { text-align: center; padding: 26px 18px 18px; }
  .confirm .ok { width: 58px; height: 58px; border-radius: 50%; background: color-mix(in srgb, var(--good) 18%, var(--surface-2)); color: var(--good); display: grid; place-items: center; margin: 0 auto 12px; }
  .confirm .ok svg { width: 28px; height: 28px; }
  .confirm h4 { font-family: var(--font-display); font-weight: 700; font-size: 21px; margin: 0 0 4px; letter-spacing: -.015em; }
  .confirm p { margin: 0; color: var(--ink-2); font-size: 14px; }
  .confirm .ref { font-family: var(--font-mono); font-size: 22px; font-weight: 600; letter-spacing: .12em; margin: 14px 0 4px; color: var(--ink); }
  .confirm .reflabel { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
  .confirm .details { text-align: left; margin: 18px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); display: grid; gap: 6px; font-size: 13.5px; }
  .confirm .details div { display: flex; justify-content: space-between; gap: 12px; }
  .confirm .details span:first-child { color: var(--ink-3); }
  .confirm .next { margin-top: 14px; font-size: 13px; color: var(--ink-2); text-align: left; padding: 0 4px; }
  .confirm .btns { display: grid; gap: 8px; margin-top: 16px; }
  .secondary { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 14px; }
  .secondary:hover { border-color: var(--ink-3); }

  .mine-list { display: grid; gap: 8px; padding: 4px; }
  .mine { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; display: grid; gap: 4px; background: var(--surface-2); }
  .mine .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .mine .ref { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); letter-spacing: .06em; }
  .mine b { font-size: 14px; }
  .mine .meta { font-size: 12.5px; color: var(--ink-2); }
  .pill { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid; }
  .pill.received { color: var(--civic); border-color: color-mix(in srgb, var(--civic) 50%, transparent); background: color-mix(in srgb, var(--civic) 10%, transparent); }
  .pill.scheduled { color: var(--good); border-color: color-mix(in srgb, var(--good) 50%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
  .pill.cancelled { color: var(--ink-3); border-color: var(--line); }
  .mine .tools { display: flex; gap: 12px; margin-top: 2px; }
  .mine .tools button { background: none; border: 0; padding: 0; color: var(--civic); font-size: 12.5px; text-decoration: underline; }
  .empty { text-align: center; padding: 34px 18px; color: var(--ink-3); font-size: 14px; }
  .empty svg { width: 36px; height: 36px; margin-bottom: 8px; opacity: .6; }

  .toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s ease; box-shadow: var(--shadow); z-index: 20; }
  .toast.show { opacity: 1; transform: translateX(-50%); }

  @media (max-width: 900px) {
    .entry { grid-template-columns: 1fr; min-height: 0; gap: 20px; }
    .lobby { grid-template-columns: minmax(0, 1fr); }
    .directory { position: static; }
    .dir-list { grid-template-columns: repeat(2, 1fr); }
    .dir-list small { display: none; }
    .panel { position: fixed; inset: auto 0 0 0; width: 100%; max-height: 80vh; border-radius: 16px 16px 0 0; transform: translateY(110%); z-index: 15; }
  }
  @media (max-width: 520px) {
    .shell { padding: 12px 12px 32px; }
    .dir-list { grid-template-columns: 1fr; }
    .avatars { gap: 6px; }
    .av-opt svg { width: 44px; height: 60px; }
    .top-actions .ghost.txt { display: none; }
    .actions { grid-template-columns: 1fr; }
  }

  /* ---------- additions for the live app ---------- */
  .skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--ground); padding: 8px 12px; border-radius: 8px; z-index: 50; }
  .skip:focus { left: 8px; }
  .ghost.lang { font-family: var(--font-mono); font-weight: 600; letter-spacing: .08em; }
  .greet { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
  .greet-av { width: 44px; height: 66px; flex: none; }
  .greet-av svg { width: 44px; height: 66px; }
  .greet-body { flex: 1; min-width: 0; }
  .greet-body b { font-family: var(--font-display); font-weight: 600; font-size: 17px; display: block; margin-bottom: 4px; }
  .greet-body ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
  .greet-body li { font-size: 14px; color: var(--ink-2); display: flex; gap: 8px; align-items: flex-start; }
  .greet-body li a { color: var(--civic); }
  .kind { flex: none; font: 600 10px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; padding: 4px 7px; border-radius: 999px; border: 1px solid; margin-top: 2px; }
  .kind.info { color: var(--civic); border-color: color-mix(in srgb, var(--civic) 45%, transparent); }
  .kind.due { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
  .kind.alert { color: #fff; background: var(--warn); border-color: var(--warn); }
  .notice { margin: 4px 8px 8px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--brass) 10%, var(--surface-2)); font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; }
  .notice a { color: var(--civic); }

  /* list mode */
  .listview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
  .listview h3 { margin: 0 0 10px; font-family: var(--font-display); font-weight: 600; font-size: 18px; }
  .lv-dept { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface-2); }
  .lv-dept > button { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: none; border: 0; font-size: 15.5px; font-weight: 700; }
  .lv-dept > button .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
  .lv-dept > button small { margin-left: auto; font-weight: 400; color: var(--ink-3); font-size: 13px; }
  body.listmode .map-wrap { display: none; }
  body.listmode .directory p[data-t="directorySub"] { display: none; }

  /* kiosk */
  body.kiosk { font-size: 18px; }
  body.kiosk .shell { max-width: 1400px; }
  body.kiosk .top-actions .txt { display: none; }
  body.kiosk .svc .t { font-size: 16.5px; }
  body.kiosk .act b { font-size: 15px; }
  body.kiosk .panel { width: min(520px, calc(100% - 24px)); }
  .kiosk-bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--ink); color: var(--ground); font-size: 13px; text-align: center; padding: 6px; z-index: 30; }

  /* receptionist */
  .fab { position: fixed; left: 18px; bottom: 18px; z-index: 25; display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px 12px 14px; border-radius: 999px; border: 0; background: var(--civic); color: var(--civic-ink); font-weight: 700; font-size: 15px; box-shadow: 0 12px 30px -8px rgba(0,0,0,.45); }
  .fab:hover { filter: brightness(1.08); }
  .fab-ic { font-size: 18px; }
  .chat { position: fixed; left: 18px; bottom: 18px; width: min(400px, calc(100vw - 36px)); height: min(560px, calc(100vh - 40px)); z-index: 26; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
  .chat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--civic) 8%, var(--surface)); }
  .chat-head b { font-family: var(--font-display); font-weight: 600; font-size: 16px; display: block; }
  .chat-head small { color: var(--ink-3); font-size: 12.5px; }
  .chat-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
  .msg { max-width: 86%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; }
  .msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
  .msg.me { align-self: flex-end; background: var(--civic); color: var(--civic-ink); border-bottom-right-radius: 4px; }
  .msg.typing { color: var(--ink-3); font-style: italic; }
  .msg .go { display: inline-block; margin-top: 6px; font-weight: 700; color: var(--civic); text-decoration: underline; background: none; border: 0; padding: 0; font-size: 13.5px; }
  .chat-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 8px; }
  .chat-chips button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 6px 10px; font-size: 12.5px; }
  .chat-chips button:hover { border-color: var(--ink-3); }
  .chat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
  .chat-form input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
  .chat-form .primary { width: auto; padding: 10px 14px; }

  /* request detail / conversation */
  .thread { display: grid; gap: 8px; padding: 6px 8px 10px; }
  .tmsg { padding: 9px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; white-space: pre-wrap; }
  .tmsg.staff { background: color-mix(in srgb, var(--civic) 10%, var(--surface-2)); border-left: 3px solid var(--civic); }
  .tmsg .who { font-size: 11.5px; color: var(--ink-3); margin-bottom: 3px; font-family: var(--font-mono); letter-spacing: .04em; }
  .video-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 9px 12px; border-radius: 10px; background: var(--good); color: #fff; font-weight: 700; text-decoration: none; font-size: 14px; }
  .spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .hero-photo img[src=""] { display: none; }
  @media (max-width: 900px) { .chat { left: 10px; bottom: 10px; width: calc(100vw - 20px); } .fab span:last-child { display: none; } .fab { padding: 12px 14px; } }
