/* ============================================================
   Warm architectural-editorial theme for the virtual tour
   ============================================================ */
:root {
  --bg:        #f1e9db;   /* warm bone paper */
  --bg-tint:   #efe4d2;
  --surface:   #fffdf8;   /* warm white card */
  --ink:       #322b22;   /* warm charcoal-brown */
  --ink-soft:  #5c5346;
  --muted:     #93876f;   /* taupe */
  --line:      #e3d8c4;
  --clay:      #c2673e;   /* terracotta accent */
  --clay-dk:   #a8512c;
  --sage:      #7c8a64;   /* secondary accent */
  --gold:      #d39a44;
  --viewer-bg: #393732;   /* warm dark stone for imagery wells */
  --shadow:    0 18px 44px -18px rgba(74,52,30,.45);
  --shadow-sm: 0 6px 18px -8px rgba(74,52,30,.35);
  --radius:    16px;
  --header-h:  68px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Hanken Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(210,154,68,.14), transparent 60%),
    radial-gradient(900px 500px at -5% 110%, rgba(124,138,100,.13), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--clay-dk); text-decoration: none; }

/* ---- header ---- */
.tbar {
  height: var(--header-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, rgba(255,253,248,.9), rgba(255,253,248,.6));
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 40;
}
.tbar .brand { display: flex; align-items: baseline; gap: 12px; }
.tbar .mark { font-family: "Fraunces", serif; font-weight: 600; font-size: 15px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--clay); }
.tbar h1 { font-family: "Fraunces", serif; font-weight: 500; font-size: clamp(20px, 2vw, 30px);
  margin: 0; letter-spacing: -.01em; }
.tbar .right { display: flex; gap: 10px; align-items: center; }
.tbar .btn { white-space: nowrap; }   /* never wrap to a second line (would overflow the header) */

/* condense the header on phones so it stays within --header-h and can't cover the stage tabs */
@media (max-width: 760px) {
  .tbar { padding: 0 14px; }
  .tbar .mark { display: none; }              /* drop "Spaces Studio" wordmark on phones */
  .tbar .right { gap: 6px; }
  .tbar .btn { padding: 8px 11px; font-size: 12.5px; }
}

/* header tour switcher: the title is a button that drops down other tours */
.tour-switch { position: relative; }
.tour-switch h1 { margin: 0; }
.tour-switch-toggle { font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
  padding: 2px 4px; margin: -2px -4px; border-radius: 8px; display: inline-flex; align-items: baseline; gap: 7px;
  font-family: "Fraunces", serif; font-weight: 500; font-size: clamp(20px, 2vw, 30px); letter-spacing: -.01em; }
.tour-switch-toggle:hover { background: rgba(28,25,22,.05); }
.tour-switch-toggle .caret { font-size: 0.5em; color: var(--clay); transform: translateY(-2px);
  transition: transform .15s; }
.tour-switch-toggle[aria-expanded="true"] .caret { transform: translateY(-2px) rotate(180deg); }
.tour-switch-menu { position: absolute; left: 0; top: calc(100% + 8px); z-index: 50; min-width: 240px;
  max-height: 60vh; overflow: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.tour-switch-menu[hidden] { display: none; }
.tour-switch-item { display: block; padding: 9px 12px; border-radius: 8px; text-decoration: none;
  font: 500 14px "Hanken Grotesk"; color: var(--ink); white-space: nowrap; }
.tour-switch-item:hover { background: rgba(28,25,22,.06); }
.tour-switch-item.current { color: var(--clay); font-weight: 600; }
.tour-switch-item.current::after { content: " ●"; font-size: 9px; vertical-align: middle; }

/* ---- buttons ---- */
.btn {
  font: 500 14px/1 "Hanken Grotesk", sans-serif; cursor: pointer;
  padding: 11px 16px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); transition: .15s ease;
  display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); border-color: var(--clay); color: var(--clay-dk); }
.btn.primary { background: var(--clay); border-color: var(--clay); color: #fff7ef; }
.btn.primary:hover { background: var(--clay-dk); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn form, form.button_to { display: inline; }

/* ---- the stage: imagery | floorplan, side by side, big ---- */
.stage {
  display: grid; grid-template-columns: minmax(0, var(--stage-split, 1.1fr)) minmax(0, 1fr);
  gap: 22px; padding: 22px; height: calc(100vh - var(--header-h));
  animation: rise .6s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
/* set by the inline head script once this tour has been rendered in this tab —
   the stage is unchanged by a Space switch, so re-entering it is just jank */
:root.no-rise .stage { animation: none; }

.viewer-card, .plan-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  position: relative; min-height: 0;
}
.viewer-card { background: var(--viewer-bg); }
.viewer-card .label-chip {
  position: absolute; left: 16px; top: 14px; z-index: 6;
  font: 500 13px/1 "Hanken Grotesk"; letter-spacing: .02em;
  color: #fff7ef; background: rgba(28,25,22,.6); backdrop-filter: blur(6px);
  padding: 8px 13px; border-radius: 999px; border: 1px solid rgba(255,247,239,.18);
}
#splat-frame, #pano-canvas { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: none; }
/* touch-action:none lets the sphere take finger drags (orbit/pinch) instead of
   the browser scrolling/zooming the page — which on mobile also collapsed the URL
   bar and caused the viewport to jump/resize. */
#pano-canvas { cursor: grab; touch-action: none; overscroll-behavior: none; }
#pano-canvas:active { cursor: grabbing; }
#pano-empty { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; color: #d9cdb8; text-align: center; padding: 30px; }
#pano-empty .big { font-family: "Fraunces", serif; font-size: 22px; color: #f3e7d2; }

/* ---- floorplan / blueprint card ---- */
.plan-card { display: flex; flex-direction: column; }
.plan-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px 14px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
/* the plan's own controls (Edit, ⋯, Lengths, Expand) — right side of the header,
   so nothing floats over the drawing itself */
.plan-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.plan-actions form { margin: 0; }
.plan-head .ttl { font: 600 12px/1 "Hanken Grotesk"; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted); }

/* layout switcher (proposed floor plans) */
.layout-switch { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.layout-pill { display: inline-flex; align-items: center; font: 600 12px/1 "Hanken Grotesk";
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); white-space: nowrap; }
.layout-pill:hover { border-color: var(--clay); color: var(--clay-dk); }
.layout-pill.on { background: var(--clay); border-color: var(--clay); color: #fff7ef; }
.layout-pill-view { font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
  padding: 7px 4px 7px 11px; border-radius: 999px 0 0 999px; }
/* no star (guests): the view button is the whole pill, so restore full padding */
.layout-pill:not(:has(.layout-default-star)) .layout-pill-view { padding-right: 11px; border-radius: 999px; }
/* the "make this everyone's default" star — dim until it's the default or hovered */
.layout-default-star { background: none; border: 0; cursor: pointer; font-size: 12px; line-height: 1;
  padding: 7px 10px 7px 4px; color: currentColor; opacity: .4; }
.layout-default-star:hover { opacity: 1; }
.layout-pill.is-default .layout-default-star { opacity: 1; color: var(--clay); }
.layout-pill.on.is-default .layout-default-star { color: #fff7ef; }
.layout-add { display: inline-flex; }
.layout-add-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 50%; border: 1px dashed var(--line); color: var(--muted); cursor: pointer; font-size: 15px;
  background: none; padding: 0; font-family: inherit; }
.layout-add-btn:hover { border-color: var(--clay); color: var(--clay-dk); }

/* layouts manager (the Layouts dialog) */
.layout-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.layout-list li { display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  background: var(--bg-tint); border-radius: 10px; }
.layout-list li.active { outline: 1.5px solid var(--clay); }
.layout-rename { flex: 1; min-width: 0; }
.layout-rename input { width: 100%; font: 500 13.5px "Hanken Grotesk"; padding: 7px 9px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.layout-list .tag { font: 600 10px/1 "Hanken Grotesk"; letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px; }
.plan-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 18px; background:
    linear-gradient(#393732, #393732) padding-box,
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(255,255,255,.04) 23px 24px); }
.fp-wrap { position: relative; display: inline-block; max-width: 100%; max-height: 100%;
  background: #fffdf8; padding: 10px; border-radius: 10px; box-shadow: var(--shadow-sm); }
.fp-wrap img { display: block; max-width: 100%; max-height: calc(100vh - var(--header-h) - 160px);
  width: auto; height: auto; }
.fp-legend { padding: 11px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-soft); }
.fp-legend b.s { color: var(--clay); } .fp-legend b.p { color: var(--sage); }

/* ---- pins ---- */
.fp-dot { position: absolute; width: 22px; height: 22px; border-radius: 50%;
  transform: translate(-50%, -50%); cursor: pointer; border: 2.5px solid #fffdf8;
  box-shadow: 0 2px 6px rgba(40,28,16,.4); transition: transform .15s ease; }
.fp-dot::after { content: ""; position: absolute; inset: -7px; border-radius: 50%;
  border: 2px solid currentColor; opacity: .0; }
.fp-dot.splat { background: var(--clay); color: var(--clay); }
.fp-dot.panorama { background: var(--sage); color: var(--sage); }
.fp-dot.pending, .fp-dot.stitching { background: var(--gold); color: var(--gold); }
.fp-dot:hover { transform: translate(-50%, -50%) scale(1.28); }
.fp-dot.active::after { opacity: .55; animation: ping 1.6s ease-out infinite; }
@keyframes ping { 0% { transform: scale(.7); opacity: .6; } 100% { transform: scale(1.5); opacity: 0; } }

/* fallback sketched rectangle */
#fp.sketch { width: 100%; height: 100%; }
#fp .room { fill: #fffdf8; stroke: var(--clay); stroke-width: .08; }
#fp .dot { stroke: #fffdf8; stroke-width: .06; cursor: pointer; }
#fp .dot.ready { fill: var(--clay); } #fp .dot.stitching, #fp .dot.pending { fill: var(--gold); }

.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: 8px; align-items: start; }
@media (max-width: 760px)  { .panel-grid { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow-sm); }
.card h2 { font-family: "Fraunces", serif; font-weight: 500; font-size: 18px; margin: 0 0 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.stations { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.stations li { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 11px; padding: 10px 12px;
  background: var(--bg-tint); border-radius: 10px; }
.stations li .tag { font: 600 11px/1 "Hanken Grotesk"; letter-spacing: .05em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 999px; }
.station-name { font-weight: 600; }
.tag.splat { background: rgba(194,103,62,.16); color: var(--clay-dk); }
.tag.panorama { background: rgba(124,138,100,.18); color: #5e6b48; }
.tag.processing, .tag.pending, .tag.stitching { background: rgba(211,154,68,.18); color: #976b1d; }
.tag.failed { background: rgba(180,60,40,.14); color: #9a3320; }
/* actions cluster to the right and wrap together inside the card */
.station-controls { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.station-space { display: inline-flex; }

/* Add-a-Station modal (native <dialog>) */
dialog.modal { border: none; padding: 0; width: min(520px, 92vw); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(40, 28, 16, .45); backdrop-filter: blur(2px); }
.modal-body { padding: 20px 22px 22px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-family: "Fraunces", serif; font-weight: 500; font-size: 18px; }
.modal-close { background: transparent; border: none; color: var(--muted); font-size: 18px; line-height: 1;
  cursor: pointer; padding: 5px 7px; border-radius: 8px; }
.modal-close:hover { color: var(--ink); background: var(--bg-tint); }

/* header Share dialog (collaborator links + public tour page) and the plan's Layouts dialog */
dialog.share-dialog { width: min(660px, 94vw); }
dialog.layouts-dialog { width: min(560px, 94vw); }
.share-dialog .board-tab .tag { font: 600 9.5px/1 "Hanken Grotesk"; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 6px; border-radius: 999px; margin-left: 4px; vertical-align: 1px; }
.share-dialog section > .hint:first-child { margin-top: 0; }

/* scale calibration dialog + dimension labels */
.calib-dialog { width: min(360px, 92vw); }
.calib-row { display: flex; gap: 8px; margin: 10px 0 14px; }
.calib-row input[type=number] { flex: 1; min-width: 0; font: 400 14px "Hanken Grotesk";
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.calib-row select { font: 400 14px "Hanken Grotesk"; padding: 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.calib-actions { display: flex; gap: 8px; }
.dim-toggle.on { background: var(--clay); border-color: var(--clay); color: #fff7ef; }

.dim-layer { position: absolute; inset: 0; pointer-events: none; z-index: 7; }
.dim-tape { position: absolute; inset: 0; width: 100%; height: 100%; }
.dim-tape line { stroke: var(--clay-dk); stroke-width: 1.5; stroke-dasharray: 3 2;
  vector-effect: non-scaling-stroke; opacity: .85; }
.dim-label { position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font: 600 11px/1 "Hanken Grotesk", sans-serif; color: var(--ink);
  background: rgba(255, 253, 248, .9); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 6px; box-shadow: var(--shadow-sm); }
.dim-label.is-area { color: var(--clay-dk); }
.dim-label.is-tape { color: var(--clay-dk); font-weight: 700; }
.dim-total { position: absolute; right: 10px; bottom: 10px; z-index: 8; pointer-events: none;
  font: 700 12px/1 "Hanken Grotesk"; color: var(--ink); background: rgba(255, 253, 248, .94);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; box-shadow: var(--shadow); }

.station-space select { font: 500 12.5px "Hanken Grotesk"; padding: 6px 9px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; max-width: 160px; }
.form { display: grid; gap: 13px; }
.form label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.form input[type=text], .form select, .form input[type=file] {
  font: 400 14px "Hanken Grotesk"; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); }
.hint { color: var(--muted); font-size: 12.5px; }
.hint-inline { color: var(--muted); font-weight: 400; font-size: 12px; }
/* live panorama-stitch progress bar across the very top of the app */
#stitch_bar:empty { display: none; }
.stitch-bar { position: relative; display: flex; align-items: center; min-height: 30px;
  padding: 5px 18px; overflow: hidden; font: 600 12.5px "Hanken Grotesk"; color: #7a5a16;
  background: color-mix(in srgb, var(--gold) 20%, var(--surface)); border-bottom: 1px solid var(--gold); }
.stitch-bar-fill { position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--gold) 55%, transparent), transparent);
  animation: stitch-slide 1.4s ease-in-out infinite; }
@keyframes stitch-slide { from { left: -40%; } to { left: 100%; } }
.stitch-bar-label { position: relative; z-index: 1; }
.stitch-elapsed { font-variant-numeric: tabular-nums; }
.stitch-bar-error { justify-content: space-between; gap: 12px; color: var(--clay-dk);
  background: color-mix(in srgb, var(--clay) 15%, var(--surface)); border-bottom-color: var(--clay); }
.stitch-bar-error .stitch-actions { display: inline-flex; gap: 6px; flex: 0 0 auto; }

/* toast notifications (controller flash) — float top-right, auto-dismiss */
.flash-stack { position: fixed; top: calc(var(--header-h) + 14px); right: 22px; z-index: 60;
  display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 44px)); pointer-events: none; }
.flash { pointer-events: auto; cursor: pointer; padding: 12px 16px; border-radius: 12px; font-size: 14px;
  background: rgba(124,138,100,.16); border: 1px solid var(--sage); color: #4f5a3b;
  box-shadow: var(--shadow); animation: toast-in .28s cubic-bezier(.2,.7,.2,1) both; }
.flash-alert { background: rgba(194,103,62,.16); border-color: var(--clay); color: var(--clay-dk); }
.flash.flash-out { animation: toast-out .4s ease forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-10px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(-10px); } }

/* ---- responsive: tabbed Imagery / Floor plan on phones ---- */
/* segmented toggle — hidden on desktop, shown inside the mobile media query */
.stage-tabs { display: none; }
.stage-tab { flex: 1; padding: 11px 14px; font: 600 13px/1 "Hanken Grotesk"; letter-spacing: .01em;
  color: var(--ink-soft); background: transparent; border: none; cursor: pointer; }
.stage-tab.on { color: #fff7ef; background: var(--clay); }

@media (max-width: 1100px) {
  /* full-height tabbed layout: row 1 = toggle, row 2 = the active panel */
  .stage { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 0; padding: 0;
    height: calc(100dvh - var(--header-h)); }
  .stage-tabs { display: flex; grid-row: 1; border-bottom: 1px solid var(--line); background: var(--surface);
    position: sticky; top: var(--header-h); z-index: 42; }   /* always sits just below the header, never covered */
  .viewer-card, .plan-card { grid-row: 2; grid-column: 1; border-radius: 0; height: auto; }
  /* show one panel at a time (default chosen by stage_tabs_controller) */
  /* default to the plan with no class at all, so the pre-JS paint already
     shows the right panel (stage_tabs only ever has to add .m-view) */
  .stage:not(.m-view) .viewer-card { display: none; }
  .stage.m-view  .plan-card  { display: none; }
  /* undo the old fixed floating card behaviour */
  .plan-card { position: static; right: auto; bottom: auto; width: auto; box-shadow: none; }
  .theatre-toggle, .stage-resize { display: none; }     /* theatre + drag-resize are desktop-only */
  .fp-wrap img { max-height: none; }                    /* let the plan fill the panel */

  /* touch targets: bigger pins + tappable toolbar buttons */
  .fp-dot { width: 30px; height: 30px; }
  .btn.sm { padding: 10px 13px; font-size: 13px; }
  .fp-toolbar { gap: 8px; }
}

/* ---- index / new pages (cohesive warm) ---- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 30px 26px 60px; }
.tours-grid { list-style: none; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tour-tile { display: block; padding: 22px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: .15s; }
.tour-tile:hover { transform: translateY(-2px); border-color: var(--clay); }
.tour-tile .nm { font-family: "Fraunces", serif; font-size: 20px; color: var(--ink); display: block; }
.tour-tile .mt { color: var(--muted); font-size: 13px; margin-top: 4px; }
.lead { color: var(--ink-soft); font-size: 15px; }
h1.page { font-family: "Fraunces", serif; font-weight: 500; }

/* =========================================================================
   Spaces — collaboration tool (Phase 1)
   ========================================================================= */
:root { --stage-h: 62vh; }

.tour-layout { display: flex; flex-direction: column; }

/* Stage shrinks so the collaboration panel sits below the viewport + plan.
   Height is user-adjustable via the drag handle (theatre_controller) and the
   chosen px value rides in --stage-h; no max-height cap so it fills what the
   user sets. */
.stage { height: var(--stage-h); position: relative; }
.fp-wrap img { max-height: calc(var(--stage-h) - 150px); }
.plan-body { position: relative; }

/* identity chip in the header */
.who-chip { display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; background: var(--clay); color: #fff7ef;
  font: 600 14px "Hanken Grotesk"; box-shadow: var(--shadow-sm); }

/* draw-space toolbar floating on the plan */
/* Space tools float as a row of buttons over the top-left of the plan */
.fp-toolbar { position: absolute; left: 24px; top: 24px; z-index: 8; display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding: 5px; border-radius: 13px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
/* "Add Space" flyout — base button opens a small menu of draw modes */
.fp-flyout { position: relative; }
.fp-flyout > .btn .caret { font-size: 9px; margin-left: 5px; color: var(--clay); display: inline-block; vertical-align: middle; }
.fp-flyout > .btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.fp-flyout-menu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 9; min-width: 168px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 5px;
  box-shadow: 0 12px 30px rgba(28,25,22,.16); display: flex; flex-direction: column; gap: 2px; }
.fp-flyout-menu[hidden] { display: none; }
.fp-flyout-menu.align-right { left: auto; right: 0; white-space: nowrap; }
.fp-flyout-menu form { margin: 0; }
.fp-flyout-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0;
  background: none; border-radius: 8px; font: inherit; font-size: 12.5px; color: inherit; text-align: left; cursor: pointer; }
.fp-flyout-item:hover { background: rgba(28,25,22,.06); }
.fp-flyout-item .ic { width: 16px; text-align: center; color: var(--clay); }
.fp-flyout-item.danger:hover { color: #9a3320; background: rgba(180,60,40,.08); }
.fp-tb-sep { width: 1px; align-self: stretch; margin: 3px 2px; background: var(--line); }
/* markup (Planes) tools live in a one-row footer below the plan. No overflow
   clipping: the Plane picker's menu opens upward over the plan. */
.fp-footer { border-top: 1px solid var(--line); padding: 9px 14px; background: var(--surface); flex: 0 0 auto;
  position: relative; }
/* the markup hint floats just above the bar, over the plan, not on the legend */
.fp-footer .planes-hint { bottom: calc(100% + 10px); }
.btn.sm { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }

/* outline overlay — shares the exact [0,1] box the pins use (the #fp wrapper) */
.space-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.fp-wrap.editing, .plan-body.editing { cursor: crosshair; }
.space-poly { fill: color-mix(in srgb, var(--space-color, var(--clay)) 16%, transparent);
  stroke: var(--space-color, var(--clay)); stroke-width: 1; vector-effect: non-scaling-stroke;
  stroke-linejoin: round; transition: fill .15s ease, stroke-width .15s ease; }
.space-poly.active { fill: color-mix(in srgb, var(--space-color, var(--clay)) 30%, transparent);
  stroke-width: 4; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--space-color, var(--clay)) 65%, transparent)); }
.space-poly.draft { fill: color-mix(in srgb, var(--clay) 18%, transparent);
  stroke: var(--clay-dk); stroke-width: 2; stroke-dasharray: 3 2; }
/* while editing an outline the body of the shape drags the whole thing */
.space-poly.draft.movable { cursor: move; }
.space-poly.draft.moving { fill: color-mix(in srgb, var(--clay) 30%, transparent); }
.space-rubber { stroke: var(--clay-dk); stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }

/* outline handles live in an HTML layer so they stay round + fixed-size regardless
   of the floorplan's aspect ratio (SVG circles would distort in the stretched overlay) */
.fp-handle-layer { position: absolute; inset: 0; pointer-events: none; z-index: 7; }
.fp-handle { position: absolute; width: 11px; height: 11px; transform: translate(-50%, -50%);
  border-radius: 50%; background: #fffdf8; border: 1.5px solid var(--clay-dk); box-shadow: var(--shadow-sm); }
.fp-handle.grab { cursor: grab; pointer-events: auto; transition: background .1s ease; }
.fp-handle.grab:hover { background: var(--clay); }
.fp-handle.add { width: 9px; height: 9px; opacity: .5; border-style: dashed;
  background: color-mix(in srgb, var(--clay) 30%, #fffdf8); cursor: copy; pointer-events: auto; }
.fp-handle.add:hover { opacity: 1; }
.fp-edit-controls:not([hidden]) { display: inline-flex; gap: 6px; }

/* hover a Space outline → an "open" button at its centre loads that Space */
.fp-opener-layer { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.fp-open { position: absolute; width: 34px; height: 34px; transform: translate(-50%, -50%) scale(.8);
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--surface); color: var(--clay-dk);
  border: 2px solid color-mix(in srgb, var(--space-color, var(--clay)) 55%, var(--surface));
  box-shadow: var(--shadow-sm); opacity: 0; pointer-events: none;
  transition: opacity .12s ease, transform .12s ease, background .12s ease; }
.fp-open.on { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
/* hide the openers while drawing / editing an outline */
.fp-wrap.editing .fp-opener-layer { display: none; }
.fp-open:hover { background: var(--space-color, var(--clay)); color: #fffdf8; border-color: var(--space-color, var(--clay)); }
.fp-open svg { display: block; }

/* ---- markup "Planes" ---- */
.planes-overlay-wrap, .planes-draft { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.planes-overlay, .planes-draft svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pl-shape { fill: none; stroke: var(--plane-color, var(--clay)); stroke-width: 1.8;
  vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
/* Excalidraw-style: stroke in the Plane colour, a light translucent fill of the same */
.pl-shape.filled { fill: color-mix(in srgb, var(--plane-color, var(--clay)) 18%, transparent); }
.pl-shape.selected { stroke-dasharray: 4 2; }
.planes-text-layer { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.plane-text-group { position: absolute; inset: 0; }
.pl-text { position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font: 600 12px/1.1 "Hanken Grotesk"; color: var(--plane-color, var(--clay-dk));
  background: rgba(255,253,248,.86); padding: 2px 7px; border-radius: 7px;
  border: 1px solid var(--plane-color, var(--clay)); box-shadow: var(--shadow-sm); }
.pl-text.selected { outline: 2px dashed var(--plane-color, var(--clay)); outline-offset: 2px; }
.planes-handles { z-index: 15; }   /* reuses .fp-handle-layer rules; above the draw overlay */
/* hidden planes (client-side visibility toggle, per-viewer) */
.plane-group.hidden, .plane-text-group.hidden { display: none; }
.fp-wrap.markup-editing { cursor: crosshair; }
/* while a markup tool is active, the overlay captures pointer events above pins;
   the draft sits on top (visual only). */
.fp-wrap.markup-editing .planes-overlay-wrap { pointer-events: auto; z-index: 12; }
.fp-wrap.markup-editing .planes-draft { z-index: 13; }
/* Select mode: only the shapes + text labels are clickable (empty areas still pan) */
.fp-wrap.markup-selecting .pl-shape { pointer-events: auto; cursor: pointer; }
.fp-wrap.markup-selecting .pl-text { pointer-events: auto; cursor: move;
  touch-action: none; -webkit-user-select: none; user-select: none; }

/* the markup tool palette under the plan: tools on the left, then the Plane
   you're drawing on and the scale pushed to the right */
.planes-bar { margin: 0; }
.planes-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.planes-tools .plane-picker { margin-left: auto; }
.planes-tools .calibrate.on { border-color: color-mix(in srgb, var(--sage) 60%, var(--line)); }
.planes-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.pl-tool.on, .pl-fill.on { background: var(--active-plane-color, var(--clay));
  border-color: var(--active-plane-color, var(--clay)); color: #fff7ef; }
/* the Plane picker: a swatch + name button whose menu lists every Plane */
.plane-current { display: inline-flex; align-items: center; gap: 7px; max-width: 220px; }
.plane-current .plane-swatch { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 3px;
  background: var(--plane-color, var(--muted)); }
.plane-current-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plane-current .caret { font-size: 9px; color: var(--clay); }
.plane-current[aria-expanded="true"] .caret { transform: rotate(180deg); }
.plane-menu { top: auto; bottom: calc(100% + 6px); left: auto; right: 0; width: 300px; }
.plane-menu-ttl { font: 600 10.5px/1 "Hanken Grotesk"; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); padding: 7px 10px 5px; }
.planes-list { display: flex; flex-direction: column; gap: 2px; padding-bottom: 4px; margin-bottom: 3px;
  border-bottom: 1px solid var(--line); }
.planes-list:empty { display: none; }
.plane-row { display: flex; align-items: center; gap: 7px; padding: 5px 6px 5px 8px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; }
.plane-row:hover { background: rgba(28,25,22,.04); }
.plane-row.active { border-color: var(--plane-color, var(--clay));
  background: color-mix(in srgb, var(--plane-color, var(--clay)) 9%, var(--surface)); }
.plane-row .plane-color { width: 22px; height: 22px; padding: 0; border: none; background: none; border-radius: 6px; cursor: pointer; }
.plane-row .plane-name { flex: 1; min-width: 0; font: 500 12.5px "Hanken Grotesk"; padding: 4px 6px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
.plane-row .plane-vis { accent-color: var(--plane-color, var(--clay)); }
.planes-hint:not(:empty) { font-size: 12px; color: var(--muted); }

/* theatre mode (desktop): hide the imagery viewer entirely, floor plan fills the
   full width — like Gmail's pop-out. Mobile is tabbed, so this never applies there. */
@media (min-width: 1101px) {
  :root.theatre .stage { grid-template-columns: minmax(0, 1fr); }
  :root.theatre .stage .viewer-card { display: none; }
}
.btn.sm.icon { padding: 7px 9px; line-height: 1; font-size: 14px; }

/* Edit-mode gating: the Space authoring tools (Add Space, Edit outline, the ⋯
   menu with layouts / Rotate / Pop out) stay hidden until the member flips the
   plan's "✎ Edit" toggle — keeps the default view uncluttered. They're always
   shown in the dedicated pop-out editing window (.tour-layout.popout).
   Inside Edit, the Planes markup bar is .draw-only: a second toggle, "Markup",
   shows it (see edit_mode_controller). */
:root:not(.editing) .tour-layout:not(.popout) .edit-only { display: none; }
:root:not(.drawing) .draw-only { display: none; }
.edit-toggle .when-on, :root.editing .edit-toggle .when-off { display: none; }
:root.editing .edit-toggle .when-on { display: inline; }
:root.editing .edit-toggle { background: var(--clay); color: #fff7ef; border-color: var(--clay); }
:root.drawing .draw-toggle { background: var(--ink); color: #fff7ef; border-color: var(--ink); }
/* the mirror of .edit-only — viewing controls that make no sense while authoring.
   The portrait/landscape toggle turns the plan with CSS, which would put every
   pointer coordinate the outline/markup editors read at 90° to where it was aimed. */
:root.editing .tour-layout .view-only, .tour-layout.popout .view-only { display: none; }
.orient-toggle[aria-pressed="true"] { background: var(--clay); color: #fff7ef; border-color: var(--clay); }

/* drag handle across the bottom of the stage to set its height (persisted) */
.stage-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: row-resize; z-index: 8; touch-action: none; }
.stage-resize::before { content: ""; width: 56px; height: 4px; border-radius: 999px;
  background: var(--line); transition: background .15s, width .15s; }
.stage-resize:hover::before { background: var(--clay); width: 76px; }
.stage.resizing { user-select: none; }
.stage.resizing .stage-resize::before { background: var(--clay); width: 76px; }
@media (max-width: 1100px) { .stage-resize { display: none; } }

/* vertical divider between viewer + floor plan to set the width split (desktop) */
.stage-vresize { position: absolute; top: 0; bottom: 16px; width: 18px; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center;
  cursor: col-resize; z-index: 8; touch-action: none; }
.stage-vresize::before { content: ""; width: 4px; height: 56px; border-radius: 999px;
  background: var(--line); transition: background .15s, height .15s; }
.stage-vresize:hover::before { background: var(--clay); height: 76px; }
.stage.resizing-x { user-select: none; }
.stage.resizing-x .stage-vresize::before { background: var(--clay); height: 76px; }
:root.theatre .stage .stage-vresize { display: none; }   /* theatre is its own width preset */
@media (max-width: 1100px) { .stage-vresize { display: none; } }

/* direct-upload progress for the panorama photo set */
.upload-progress { display: flex; align-items: center; gap: 10px; margin: 4px 0 2px; }
/* Stays hidden until the upload actually starts — `display: flex` would otherwise
   override the `hidden` attribute and show "Uploading…" while files are still being picked. */
.upload-progress[hidden] { display: none; }
.upload-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.upload-bar-fill { height: 100%; width: 0; border-radius: 999px; background: var(--clay);
  transition: width .2s ease; }
.upload-label { font: 500 12.5px/1 "Hanken Grotesk"; color: var(--ink-soft); white-space: nowrap; }

/* fade pins that are not in the active space */
.fp-wrap.has-active .fp-dot { opacity: .3; filter: grayscale(.4); }
.fp-wrap.has-active .fp-dot.in-space { opacity: 1; filter: none; }

.fp-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 8;
  font: 500 12px "Hanken Grotesk"; color: var(--ink-soft); background: var(--surface);
  padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow-sm); max-width: 82%; text-align: center; }
.fp-hint:empty { display: none; }

/* ---- collaboration panel below the stage ---- */
.space-panel { padding: 0 22px 32px; animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
/* one white sheet — header, brief + discussion, and board together — that the
   active tab merges into (the tabs row draws the top line; this rounds the rest) */
.space-panel-inner { background: var(--surface); border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-sm); padding: 22px 24px 26px; }
.space-empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 28px; text-align: center; box-shadow: var(--shadow-sm); }
.space-empty h2 { font-family: "Fraunces", serif; font-weight: 500; margin: 0 0 8px; }
.space-empty p { color: var(--ink-soft); max-width: 640px; margin: 0 auto; font-size: 14px; line-height: 1.5; }

.sp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sp-head h2 { font-family: "Fraunces", serif; font-weight: 500; font-size: 24px; margin: 0; }
.sp-swatch { width: 16px; height: 16px; border-radius: 4px; background: var(--space-color, var(--clay)); }
.sp-count { color: var(--muted); font-size: 13px; }
.sp-head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.btn.danger:hover { border-color: #b14227; color: #9a3320; }

.sp-grid { display: grid; grid-template-columns: minmax(0, 540px) minmax(0, 1fr); gap: 22px; align-items: stretch; }
/* let grid items shrink to their track instead of expanding to content (e.g. the
   Lexxy editor's intrinsic toolbar width), which would overflow into the board.
   The brief uses .form (display:grid) too, whose auto column blows out to the
   editor's max-content width — pin it to a shrinkable single column. */
.sp-grid > * { min-width: 0; }
/* the brief/discussion is no longer its own card inside the white sheet — drop the
   chrome and separate it from the board with a divider instead */
.sp-brief.card { background: transparent; border: none; box-shadow: none; padding: 0;
  border-right: 1px solid var(--line); padding-right: 24px; }
.sp-brief .form { grid-template-columns: minmax(0, 1fr); }
.sp-brief .form > * { min-width: 0; }
.sp-brief .sp-brief-row { display: flex; gap: 8px; margin-bottom: 10px; }
.sp-name-input { flex: 1; min-width: 0; font: 500 16px "Fraunces", serif; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); }
.sp-brief input[type=color] { flex: 0 0 auto; width: 40px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
/* inline rename: ✓/✕ appear only while the name is modified */
.sp-name-edit { flex: 1; min-width: 0; display: flex; gap: 6px; align-items: center; }
.sp-name-save, .sp-name-cancel { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.sp-name-save { background: var(--clay); color: #fff7ef; border: 1px solid var(--clay-dk); }
.sp-name-save:hover { background: var(--clay-dk); }
.sp-name-save:disabled { opacity: .6; cursor: default; }
.sp-name-cancel { background: #fff; color: var(--muted); border: 1px solid var(--line); }
.sp-name-cancel:hover { background: rgba(0,0,0,.05); color: var(--ink); }
.sp-name-save[hidden], .sp-name-cancel[hidden] { display: none; }
.sp-brief lexxy-editor { display: block; width: 100%; box-sizing: border-box; margin-bottom: 10px; }
.sp-comments { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.sp-comments h4, .sp-board-head h3 { margin: 0 0 10px; }
.sp-comments h4 { font: 600 12px/1 "Hanken Grotesk"; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sp-board-head h3 { font-family: "Fraunces", serif; font-weight: 500; font-size: 18px; }

.insp-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px;
  background: var(--bg-tint); padding: 12px; border-radius: 12px; }
.insp-add input[type=text], .insp-add input[type=url] { flex: 1 1 140px; min-width: 0;
  font: 400 13px "Hanken Grotesk"; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: #fff; }
.insp-add input[type=file] { flex: 0 1 auto; min-width: 0; max-width: 100%; font-size: 12.5px; }

/* the add-item form stays tucked behind the ＋ Add item button until clicked */
.insp-add-wrap { margin-bottom: 16px; }
.insp-add-panel[hidden] { display: none; }
.insp-add-panel { margin-top: 10px; }
.insp-add-panel .insp-add { margin-bottom: 0; }

.insp-grid { list-style: none; padding: 0; margin: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.insp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; position: relative; }
.insp-card[draggable="true"] { cursor: grab; }
.insp-card.cr-drag { opacity: .4; cursor: grabbing; }
.insp-media { aspect-ratio: 4 / 3; background: var(--bg-tint); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.insp-media img { width: 100%; height: 100%; object-fit: cover; }
.insp-media video.insp-video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.insp-video-link { position: relative; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.insp-video-badge { position: absolute; inset: 0; margin: auto; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; font-size: 16px;
  backdrop-filter: blur(2px); transition: background .15s; }
.insp-video-link:hover .insp-video-badge { background: rgba(0,0,0,.62); }
/* video inside the PhotoSwipe lightbox */
.pswp__video-container { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.pswp__video-container video { max-width: 100%; max-height: 100%; width: auto; height: auto; }
/* the card's caption, carried under the expanded media */
.pswp__caption { position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; gap: 3px; justify-items: center; text-align: center; pointer-events: none;
  padding: 34px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0)); }
.pswp__caption[hidden] { display: none; }
.pswp__caption strong { font: 600 15px "Hanken Grotesk"; color: #fff; }
.pswp__caption span { max-width: 70ch; font-size: 13px; color: rgba(255,255,255,.8); }
.insp-file { font-size: 13px; color: var(--clay-dk); padding: 14px; text-align: center; word-break: break-word; }
.insp-file.insp-text { font-size: 26px; color: var(--muted); }
/* PDF card: the rasterized first page, with the filename over its foot. The sheet
   is `contain` on white — a drawing cropped to fill is unreadable. */
.insp-doc { position: relative; display: block; width: 100%; height: 100%; background: #fff; }
.insp-doc img { width: 100%; height: 100%; object-fit: contain; display: block; }
.insp-doc-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 8px;
  font-size: 11px; line-height: 1.3; color: #fff; background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px); word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.insp-meta { padding: 10px 11px; display: grid; gap: 4px; font-size: 13px; }
.insp-meta p { margin: 0; color: var(--ink-soft); }
/* editable caption: reads as the card's heading until you click it */
.insp-caption-text { display: block; width: 100%; padding: 1px 3px; margin: -1px -3px; text-align: left;
  font: 600 13px "Hanken Grotesk"; color: var(--ink); background: transparent; border: none;
  border-radius: 5px; cursor: text; word-break: break-word; }
.insp-caption-text:hover { background: var(--bg-tint); box-shadow: inset 0 0 0 1px var(--line); }
.insp-caption-text.empty { font-weight: 500; color: var(--muted); font-style: italic; transition: opacity .15s; }
/* "Add a caption…" is quiet until you go near the card — but only where there's a
   pointer to hover with; on touch it has to stay visible to be reachable. */
@media (hover: hover) {
  .insp-caption-text.empty { opacity: 0; }
  .insp-card:hover .insp-caption-text.empty, .insp-caption-text.empty:focus { opacity: 1; }
}
.insp-caption-form { display: flex; gap: 3px; align-items: center; }
/* author `display` beats the UA's [hidden] rule, so restate it for both halves */
.insp-caption-text[hidden], .insp-caption-form[hidden] { display: none; }
.insp-caption-form input { flex: 1; min-width: 0; padding: 3px 6px; font: 600 13px "Hanken Grotesk";
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.insp-caption-form.saving { opacity: .5; pointer-events: none; }
.insp-link { font-size: 12px; }
.insp-by { color: var(--muted); font-size: 11.5px; }
.insp-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; opacity: 0; transition: .15s; }
.insp-card:hover .insp-actions { opacity: 1; }
.insp-card.flash { animation: insp-flash 1.4s ease-out; }
@keyframes insp-flash { 0% { box-shadow: 0 0 0 3px var(--clay); } 100% { box-shadow: var(--shadow-sm); } }

/* the "Starred direction" row: promoted cards above the main inspiration grid */
.insp-starred[hidden] { display: none; }
.insp-starred { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px dashed var(--line); }
.insp-starred-head { margin: 0 0 10px; font: 600 12.5px "Hanken Grotesk"; letter-spacing: .02em;
  text-transform: uppercase; color: var(--clay-dk); display: flex; align-items: center; gap: 6px; }
.insp-starred .insp-card { border-color: var(--clay); box-shadow: 0 0 0 1px var(--clay), var(--shadow-sm); }
/* Empty star (the "add to starred" control): clay-dark instead of the faint
   ink-soft so it's legible on hover, and previews gold on hover. */
.linkbtn.insp-star { color: var(--clay-dk); }
.linkbtn.insp-star:hover { color: #b8860b; background: rgba(184,134,11,.14); }
/* Starred (active) star = the "unstar" toggle. Ring + hover highlight so it
   reads as a clickable button, not just a status badge. The extra .linkbtn in
   the selector beats the generic .linkbtn.on (green) rule below it. */
.linkbtn.insp-star.on { color: #b8860b; background: rgba(184,134,11,.18);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(184,134,11,.55); }
.linkbtn.insp-star.on:hover { color: #8a6608; background: rgba(184,134,11,.3);
  box-shadow: var(--shadow-sm), inset 0 0 0 1.5px #b8860b; }

/* right-column board tabs: one per InspirationItem board. They wrap on a narrow
   column rather than squeezing — the labels are words, not icons. */
.board-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.board-tab { padding: 8px 14px; font: 600 13px "Hanken Grotesk"; color: var(--muted);
  background: transparent; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px; cursor: pointer; border-radius: 8px 8px 0 0; }
.board-tab:hover { color: var(--ink-soft); }
.board-tab.on { color: var(--clay-dk); border-bottom-color: var(--clay); }
.board-section[hidden] { display: none; }

/* paste / drag-and-drop upload */
.sp-board, .board-section { position: relative; }
.insp-dropzone { position: absolute; inset: 0; z-index: 5; display: none; pointer-events: none;
  align-items: center; justify-content: center; border-radius: 14px;
  border: 2px dashed var(--clay); background: color-mix(in srgb, var(--clay) 12%, transparent); }
.board-section.dragging .insp-dropzone { display: flex; }
.insp-dropzone span { font: 600 14px "Hanken Grotesk"; color: var(--clay-dk);
  background: var(--surface); padding: 8px 16px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.insp-upload-status:not(:empty) { display: inline-block; margin-left: 6px; color: var(--clay-dk); font-weight: 600; }

/* top-level board links (e.g. a Pinterest board) — pills, not cards */
/* board heading (left half) and board-links (right half) share one row */
.sp-board-top { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-start; margin-bottom: 16px; }
.sp-board-top .sp-board-head { flex: 1 1 0; min-width: 0; }
.sp-board-top .insp-links { flex: 1 1 0; min-width: 0; justify-content: flex-end; margin-bottom: 0; }

.insp-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.insp-links-list { display: contents; }
.board-link { display: inline-flex; align-items: center; gap: 2px;
  background: color-mix(in srgb, var(--clay) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--clay) 32%, var(--line));
  border-radius: 999px; padding: 3px 5px 3px 11px; }
.board-link > a { display: inline-flex; align-items: baseline; gap: 6px; text-decoration: none;
  color: var(--clay-dk); font: 600 12.5px "Hanken Grotesk"; }
.board-link > a:hover .board-link-label { text-decoration: underline; }
.board-link-ico { font-size: 12px; align-self: center; }
.board-link-host { font-weight: 400; font-size: 11px; color: var(--muted); }
.board-link-x { background: transparent; box-shadow: none; min-width: 20px; height: 20px; }
.insp-link-add { display: inline-flex; gap: 6px; align-items: center; flex: 1 1 240px; min-width: 0; }
.insp-link-add input { min-width: 0; font: 400 12.5px "Hanken Grotesk"; padding: 6px 11px;
  border-radius: 999px; border: 1px dashed var(--line); background: #fff; }
.insp-link-add input[type=url] { flex: 1 1 150px; }
.insp-link-add input[type=text] { flex: 0 1 120px; }

.linkbtn { border: none; background: rgba(255,253,248,.92); border-radius: 7px; min-width: 24px; height: 24px;
  cursor: pointer; color: var(--ink-soft); box-shadow: var(--shadow-sm); font: 500 13px/1 "Hanken Grotesk"; padding: 0 6px; }
.linkbtn:hover { color: var(--clay-dk); }
.linkbtn.on { color: #4f5a3b; background: rgba(124,138,100,.25); }

/* comment threads */
.thread { display: grid; gap: 7px; }
.cmt { display: flex; align-items: baseline; gap: 8px; font-size: 13px; padding: 6px 9px; background: var(--bg-tint); border-radius: 9px; margin-bottom: 6px;}
.cmt-who { font-weight: 600; color: var(--ink); white-space: nowrap; }
.cmt-body { flex: 1; color: var(--ink-soft); }
.cmt-approved { background: rgba(124,138,100,.16); }
.cmt-actions { display: flex; gap: 2px; }
.cmt-form { display: flex; gap: 6px; margin-top: 4px; }
.cmt-form input { flex: 1; font: 400 13px "Hanken Grotesk"; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: #fff; }
.btn.ghost.sm { box-shadow: none; }

.pin-space { font: 600 11px/1 "Hanken Grotesk"; padding: 4px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--space-color, var(--muted)) 15%, var(--surface)); color: var(--ink-soft); }

/* join / share page */
.join-wrap { display: flex; justify-content: center; padding: 60px 22px; }
.join-card { max-width: 440px; width: 100%; }
.join-card h2 { font-family: "Fraunces", serif; font-weight: 500; font-size: 24px; margin: 0 0 8px; }
.join-card em { color: var(--clay-dk); font-style: normal; }

@media (max-width: 1100px) {
  .stage { height: calc(100dvh - var(--header-h)); }
  .sp-grid { grid-template-columns: 1fr; }
  .sp-brief.card { border-right: none; padding-right: 0;
    border-bottom: 1px solid var(--line); padding-bottom: 20px; }
}

/* ---- viewport annotations (Phase 2) ---- */
#anno-layer { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.anno-marker { position: absolute; transform: translate(-50%, -50%); pointer-events: auto;
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; border: 2px solid #fffdf8;
  background: var(--clay); color: #fff7ef; font: 600 12px/22px "Hanken Grotesk"; cursor: pointer;
  box-shadow: 0 2px 8px rgba(40,28,16,.5); }
.anno-marker.flash { animation: insp-flash 1s ease-out 3; }
/* hover popup: an annotation's label, note and linked-item thumbnail */
.anno-pop { position: absolute; z-index: 9; transform: translate(-50%, -100%);
  width: max-content; max-width: 240px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; box-shadow: var(--shadow); display: grid; gap: 8px; }
.anno-pop.below { transform: translate(-50%, 0); }
.anno-pop[hidden] { display: none; }
.anno-pop-thumb { display: block; width: 100%; max-height: 150px; object-fit: cover;
  border-radius: 8px; background: rgba(40,28,16,.06); }
.anno-pop-thumb[hidden] { display: none; }
.anno-pop-label { font: 600 13.5px "Hanken Grotesk"; color: var(--ink); }
.anno-pop-body { font: 400 12.5px/1.45 "Hanken Grotesk"; color: var(--clay-dk);
  white-space: pre-wrap; }
.anno-pop-body[hidden] { display: none; }
.anno-pop.sticky { pointer-events: auto; }   /* clickable Edit/Delete when pinned open */
.anno-pop-actions { display: flex; gap: 6px; }
.anno-pop-actions[hidden] { display: none; }
.anno-add { position: absolute; right: 16px; top: 14px; z-index: 7;
  font: 600 12.5px "Hanken Grotesk"; padding: 8px 13px; border-radius: 999px; cursor: pointer;
  color: #fff7ef; background: var(--clay); border: 1px solid var(--clay-dk); box-shadow: var(--shadow-sm); }
.anno-add[hidden] { display: none; }
.anno-add:hover { background: var(--clay-dk); }
.anno-composer { position: absolute; right: 16px; top: 54px; z-index: 8; width: 264px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  box-shadow: var(--shadow); display: grid; gap: 8px; }
.anno-composer[hidden] { display: none; }
.anno-composer input, .anno-composer textarea, .anno-composer select {
  font: 400 13px "Hanken Grotesk"; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); width: 100%; box-sizing: border-box; }
.anno-composer-row { display: flex; gap: 6px; }

/* ---- "walk through" portal discs ---- */
#portal-layer { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.portal-disc { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  perspective: 340px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); }
.portal-disc .ring { width: 82px; height: 82px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255,247,239,.9), rgba(255,247,239,.28) 58%, transparent 72%);
  border: 5px solid rgba(255,247,239,.95);
  box-shadow: inset 0 0 22px rgba(255,247,239,.6), 0 0 14px rgba(255,247,239,.65), 0 0 26px rgba(255,247,239,.35);
  transform: rotateX(70deg); transform-origin: center;
  animation: portal-pulse 2s ease-in-out infinite; }
@keyframes portal-pulse { 0%, 100% { transform: rotateX(70deg) scale(1); opacity: .82; } 50% { transform: rotateX(70deg) scale(1.12); opacity: 1; } }
.portal-disc .label { order: -1; font: 600 12px "Hanken Grotesk"; color: #fff7ef; white-space: nowrap;
  background: rgba(28,25,22,.72); backdrop-filter: blur(6px); padding: 5px 10px; border-radius: 999px;
  border: 1px solid rgba(255,247,239,.18); opacity: 0; transition: opacity .15s; }
.portal-disc:hover .label { opacity: 1; }
.portal-disc:hover .ring { border-color: #fff;
  box-shadow: inset 0 0 30px rgba(255,247,239,.9), 0 0 20px rgba(255,247,239,.85), 0 0 40px rgba(255,247,239,.5); }
.portal-disc .portal-del { position: absolute; top: -8px; right: -8px; display: none;
  width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--clay-dk); color: #fff7ef; font: 700 11px/1 system-ui; }
.portal-disc.is-member:hover .portal-del { display: block; }
/* Cross-tour discs jump to another floor's tour — tint them so they read as a
   bigger move than an in-room walk-through. */
.portal-disc.is-cross .ring { border-color: #d9ecff;
  box-shadow: inset 0 0 22px rgba(210,234,255,.6), 0 0 14px rgba(150,200,255,.7), 0 0 26px rgba(120,180,255,.4); }
.portal-disc.is-cross .label { background: rgba(20,40,66,.78); }
/* Locked: a guest without access to the destination tour — dim and non-inviting. */
.portal-disc.is-locked { cursor: not-allowed; filter: grayscale(.6) drop-shadow(0 2px 6px rgba(0,0,0,.45)); opacity: .72; }
.portal-disc.is-locked .ring { animation: none; }

#pano-fade { position: absolute; inset: 0; z-index: 8; pointer-events: none; opacity: 0;
  background: var(--viewer-bg); }

.portal-add { position: absolute; left: 16px; top: 52px; z-index: 7;
  font: 600 12.5px "Hanken Grotesk"; padding: 8px 13px; border-radius: 999px; cursor: pointer;
  color: #fff7ef; background: var(--clay); border: 1px solid var(--clay-dk); box-shadow: var(--shadow-sm); }
.portal-add[hidden] { display: none; }
.portal-add:hover { background: var(--clay-dk); }
.portal-composer { position: absolute; left: 16px; top: 92px; z-index: 8; width: 240px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  box-shadow: var(--shadow); display: grid; gap: 8px; }
.portal-composer[hidden] { display: none; }
.portal-composer-ttl { font: 600 11px "Hanken Grotesk"; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.portal-composer select { font: 400 13px "Hanken Grotesk"; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); width: 100%; box-sizing: border-box; }
.portal-composer-row { display: flex; gap: 6px; }

/* ---- wider, vertically-scrollable blueprint ---- */
/* plan-body holds the (fixed) draw toolbar + hint; the floorplan itself scrolls
   inside .fp-scroll so a tall plan can be panned up/down without moving the tools. */
.plan-body { position: relative; overflow: hidden; padding: 0; }
.fp-scroll { align-self: stretch; flex: 1 1 100%; width: 100%; min-height: 0;
  overflow: auto; padding: 18px; display: flex; align-items: safe center; justify-content: safe center;
  scrollbar-width: thin; cursor: grab; touch-action: none; }
.fp-scroll.grabbing { cursor: grabbing; }
.fp-scroll.grabbing * { cursor: grabbing !important; }
/* keep pin/draw cursors meaningful (override grab) when not actively dragging */
.fp-scroll:not(.grabbing) .fp-dot { cursor: pointer; }
.fp-scroll:not(.grabbing) .fp-wrap.editing { cursor: crosshair; }
/* fill the (now wider) column width; let height grow naturally and scroll when tall.
   flex:none stops the flex container from shrinking it back, so the Ctrl+wheel zoom
   (which sets an inline width > 100%) actually overflows and becomes pannable. */
/* display:flex, not block — .fp-wrap is inline-block, and a block rotor would
   give it a line box with a few px of baseline descender under the plan. */
.fp-rotor { width: 100%; flex: none; position: relative; display: flex; }
.fp-wrap { width: 100%; max-height: none; flex: none; }
.fp-wrap img { width: 100%; height: auto; max-height: none; }

/* ---- portrait / landscape view toggle (fp_rotate_controller) ----
   Turning the wrapper turns the plan image, outlines, markup and pins as one.
   The rotated box keeps its old footprint in layout, so the wrap comes out of
   flow and .fp-rotor holds the space instead (its height is set in JS). The
   translate re-seats the rotated box at the rotor's top-left corner. */
.fp-rotor.on .fp-wrap { position: absolute; top: 0; left: 0;
  transform-origin: 0 0; transform: rotate(90deg) translateY(-100%); }

/* ---- share links (member) ---- */
.share-new { display: flex; gap: 8px; margin: 10px 0 14px; }
.visits-head { margin: 18px 0 4px; font: 600 13px "Hanken Grotesk"; color: var(--ink); }
.visits { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.visits li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface); font-size: 13px; }
.visits li.bot { opacity: .55; }
.visit-who { font-weight: 600; }
.visit-meta { color: var(--muted); font-size: 12px; }
.visit-what { color: var(--ink-soft); }
.visit-errors { color: #b3261e; font-size: 12px; }
.share-new input { flex: 1; min-width: 0; font: 400 13px "Hanken Grotesk"; padding: 8px 10px;
  border-radius: 9px; border: 1px solid var(--line); background: #fff; }
.shares { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.shares li { display: flex; align-items: center; gap: 8px; background: var(--bg-tint);
  padding: 8px 10px; border-radius: 10px; }
.share-label { font-weight: 600; font-size: 13px; white-space: nowrap; }
.share-url { flex: 1; min-width: 0; font: 400 12px ui-monospace, monospace; padding: 6px 9px;
  border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); }
/* saved design brief shown as a stylish quote (with a pencil to revise) */
.sp-brief-quote { position: relative; margin: 0 0 12px; padding: 12px 38px 12px 18px;
  border-left: 3px solid var(--clay); background: var(--bg-tint); border-radius: 0 10px 10px 0;
  font-size: 16px; color: var(--ink-soft); line-height: 1.55; }
.sp-brief-quote > :first-child { margin-top: 0; }
.sp-brief-quote > :last-child { margin-bottom: 0; }
.sp-brief-edit { position: absolute; top: 7px; right: 7px; border: none; background: transparent;
  cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1; padding: 5px; border-radius: 7px; }
.sp-brief-edit:hover { color: var(--clay-dk); background: rgba(0,0,0,.05); }

/* ---- space tabs (prominent switcher under the stage) ---- */
.space-tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-end;
  padding: 16px 22px 0; margin-bottom: -1px; border-bottom: 1px solid var(--line); }
.space-tab { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px;
  font: 600 14px/1 "Hanken Grotesk"; color: var(--ink-soft); cursor: pointer;
  border: 1px solid transparent; border-bottom: none; border-radius: 11px 11px 0 0;
  background: transparent; transition: background .15s ease, color .15s ease; }
.space-tab:hover { color: var(--ink);
  background: color-mix(in srgb, var(--space-color, var(--clay)) 9%, transparent); }
.space-tab-dot { width: 11px; height: 11px; border-radius: 50%;
  background: var(--space-color, var(--muted)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--space-color, var(--muted)) 25%, transparent); }
.space-tab.on { color: var(--ink); background: var(--surface);
  border-color: var(--line); border-bottom: 1px solid var(--surface);
  box-shadow: 0 -6px 16px -10px rgba(74,52,30,.4); }
.space-tab.on::after { content: ""; position: absolute; }
/* The station-management tab sits apart, pulled to the right edge of the bar. */
.space-tab.stations-tab { margin-left: auto; }
@media (max-width: 700px) { .space-tabs { padding: 12px 14px 0; } .space-tab { padding: 9px 13px; font-size: 13px; } }

/* clarify the inspiration add-form: a header label so "add item" isn't read as "add a board" */
.insp-add-label { flex: 1 0 100%; font: 600 11px/1 "Hanken Grotesk"; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }

/* keep the satellite emoji upright/sized within the serif heading */
.card h2 .emoji { font-style: normal; font-size: .85em; vertical-align: 1px; }

/* inspiration images open a PhotoSwipe gallery */
.insp-media a.pswp-item { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.insp-media a.pswp-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- popped-out floor-plan window (tours#popout) ---- */
/* The plan card owns the whole window: no header, no padding, fills the viewport. */
.popout-body { margin: 0; height: 100dvh; overflow: hidden; }
.popout-body .tour-layout.popout { height: 100dvh; }
/* single column: this window holds only the plan card, and the two-column stage
   grid would otherwise leave it in a 1.1fr slot with an empty column beside it.
   (It used to borrow the .theatre class for this; that hook now lives on :root,
   which the pop-out window doesn't inherit from the opener.) */
.popout-body .stage { --stage-h: 100dvh; height: 100dvh; padding: 0; gap: 0; animation: none;
  grid-template-columns: minmax(0, 1fr); }
.popout-body .plan-card { border: 0; border-radius: 0; box-shadow: none; height: 100dvh; }
