/* ============================================================================
   Floorplan Flow — Design System
   Dark-first · steel blue · frosted glass · soft rounded · subtle mesh
   ============================================================================ */

/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
  /* Shape */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Accent — muted steel blue, desaturated and professional */
  --accent: #3fb9e8;
  --accent-2: #4cbae8;
  --accent-blue: #0e5073;
  --accent-grad: #3fb9e8; /* flat SimCapture blue, no gradient */
  --accent-soft: rgba(63, 185, 232, 0.08);
  --accent-ring: rgba(63, 185, 232, 0.20);
  --on-accent: #ffffff;
  --brand-deep: #0e5073;   /* SimCapture card-header teal-navy */
  --topbar-bg: #262626;    /* SimCapture top bar */
  --glow-accent: 0 2px 8px rgba(63, 185, 232, 0.22);
  --glow-accent-hover: 0 3px 12px rgba(63, 185, 232, 0.32);

  /* Motion */
  --t-fast: 0.15s ease;
  --t: 0.25s ease;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;

  /* ── Theme: LIGHT (base) ── */
  --bg-0: #f2f2f2;
  --text: #262626;
  --text-muted: #555555;   /* 7:1 on the light bg */
  --text-faint: #767676;

  --panel: #ffffff;
  --panel-2: #fafafa;
  --panel-strong: #ffffff;
  --panel-border: #dddddd;
  --panel-highlight: rgba(255, 255, 255, 0);
  --panel-blur: 14px;   /* article: avoid ≥20px backdrop-filter blur */

  --input-bg: #ffffff;
  --input-border: #c9c9c9;
  --border: #cfcfcf;       /* generic control/divider border (was referenced but undefined) */

  --shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.10);
  --accent-text: #0e5073;  /* steel-blue-700 — 5.3:1 on white */

  --canvas-bg: #ffffff;
  --grid-line: rgba(15, 23, 42, 0.05);

  /* Mesh: very faint steel-blue wash */
  --mesh-1: transparent;
  --mesh-2: transparent;
  --mesh-3: transparent;
  --mesh-4: transparent;

  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.10);
}

/* ── Theme: DARK (default loaded) ── */
body.dark {
  color-scheme: dark;

  /* True dark grey base — no blue tint */
  --bg-0: #1c1c1c;
  --text: #f0f0f0;
  --text-muted: #999999;
  --text-faint: #666666;

  /* Glassmorphism panels — layered grey with strong blur */
  --panel: rgba(255, 255, 255, 0.07);
  --panel-2: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(38, 38, 38, 0.95);
  --panel-border: rgba(255, 255, 255, 0.10);
  --panel-highlight: rgba(255, 255, 255, 0.08);
  --panel-blur: 20px;

  --input-bg: rgba(255, 255, 255, 0.07);
  --input-border: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.16);

  --shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.50);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.55);
  --accent-text: #5cc8f0;

  --canvas-bg: rgba(20, 20, 20, 0.70);
  --grid-line: rgba(255, 255, 255, 0.04);

  /* Mesh: very subtle warm grey glows — no blue */
  --mesh-1: rgba(80, 80, 80, 0.18);
  --mesh-2: rgba(60, 60, 60, 0.14);
  --mesh-3: rgba(90, 90, 90, 0.12);
  --mesh-4: rgba(70, 70, 70, 0.14);

  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
}

/* ── Base / reset ───────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  position: relative;
  background: var(--bg-0);
  color: var(--text);
  overflow-x: hidden;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  transition: background var(--t), color var(--t);
}

/* Animated gradient mesh backdrop */
body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38% 38% at 18% 22%, var(--mesh-1), transparent 70%),
    radial-gradient(34% 34% at 82% 18%, var(--mesh-2), transparent 70%),
    radial-gradient(42% 42% at 78% 82%, var(--mesh-3), transparent 70%),
    radial-gradient(40% 40% at 22% 80%, var(--mesh-4), transparent 70%);
  filter: blur(56px) saturate(110%);
  animation: none;
}

@keyframes meshDrift {
  0%   { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  50%  { transform: translate3d(2%, -2%, 0) scale(1.06) rotate(1.5deg); }
  100% { transform: translate3d(-2%, 1%, 0) scale(1.10) rotate(-1.5deg); }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

/* Dark mode: mesh gradients create visible banding on a near-black background. */
body.dark::before { display: none; }

::selection { background: var(--accent-ring); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Thin modern scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--panel-border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--accent-ring); background-clip: padding-box; }

/* ── App shell / header ─────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: min(1400px, 100%);
  margin: 0 auto;
  padding:
    max(16px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  transition: padding var(--t) var(--ease-out);
}


.top-right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Top navigation ─────────────────────────────────────────────────────── */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 8px;
  border-radius: var(--r-lg);
  background: var(--panel);
  backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--panel-highlight);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.top-nav::-webkit-scrollbar { display: none; }

.nav-left, .nav-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Sliding selection pill — lives inside .nav-tabs-slide, positioned absolutely */
.nav-tabs-slide {
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
}

.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: var(--r-sm);
  background: var(--accent-grad);
  box-shadow: var(--glow-accent);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.28s var(--ease-out), width 0.28s var(--ease-out);
  will-change: transform, width;
}

.nav-link {
  border: 1px solid transparent;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.92rem;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  z-index: 1;
  transition: color var(--t-fast), transform var(--t-fast);
}

.nav-link:hover { color: var(--text); }

.nav-link.disabled, .nav-link:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Helper text explaining why a disabled tab is unavailable — lives at body
   level (position: fixed) and is positioned by JS, since .top-nav's
   overflow-x:auto implicitly clips overflow-y and would hide an ::after. */
.nav-disabled-tooltip {
  position: fixed;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background: var(--panel);
  backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-sm);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(4px);
  transition: opacity var(--t-fast), transform var(--t-fast);
  z-index: 500;
}

.nav-disabled-tooltip.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-link.active {
  color: var(--on-accent);
}

/* Light mode nav — ensure links are always legible against the white panel */
body:not(.dark) .nav-link         { color: #3d5068; }
body:not(.dark) .nav-link:hover   { color: #0f172a; }
body:not(.dark) .nav-link.active  { color: #ffffff; }

.nav-link:active { transform: scale(0.97); }

/* Pinned Icons tab — no sliding pill, just accent text when active */
.nav-link-pinned.active {
  color: var(--accent-text);
  background: transparent;
  box-shadow: none;
}
body:not(.dark) .nav-link-pinned.active { color: var(--accent); }

/* Nav tab icons (SimCapture system/content icon set, fill=currentColor): inline beside the label on desktop, stacked above it in the mobile bottom bar */
.nav-tab-icon { display: block; width: 18px; height: 18px; margin-right: 8px; flex-shrink: 0; }

/* ── Pages / page header ────────────────────────────────────────────────── */
main { display: block; flex: 1; width: 100%; }
main > .page { display: none; }
main > .page.active-page { display: block; }
#floorplanPage:not(.active-page) { display: none !important; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding: 4px 2px;
  flex-wrap: wrap;
}

.page-header-title-group { display: flex; align-items: center; gap: 8px; }

.page-header h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header p { margin: 4px 0 0; color: var(--text-muted); font-size: 0.9rem; }
.page-header-helper { white-space: nowrap; }
.page-header .primary-button { width: auto; }
.page-header-actions { display: flex; gap: 10px; align-items: center; }
.page-header-actions .primary-button, .page-header-actions .secondary-button { width: auto; }

/* ── Content grid + floorplan layout (structure preserved) ──────────────── */
.content-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

body.on-floorplan-page { overflow: hidden; }

/* Floorplan layout: position fixed, JS sets top/bottom/left/right via --fl-* vars */
#floorplanPage { display: block; }

.floorplan-layout {
  display: flex;
  flex-direction: row;
  gap: 10px;
  position: fixed;
  top:    var(--fl-top,    0px);
  left:   var(--fl-left,  0px);
  right:  var(--fl-right, 0px);
  bottom: var(--fl-bottom,0px);
  overflow: hidden;
  z-index: 10;
  padding: 10px;
}

/* Icon sidebar */
.icon-panel {
  width: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
  border: 1px solid var(--panel-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}

.icon-panel-header {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
}
.icon-panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Mode toggle -- a plain two-position slider: Rooms (left) / Icons (right).
   Rooms come first, since devices can only be placed inside a room. */
.mode-toggle {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 3px;
  cursor: pointer;
  user-select: none;
  height: 32px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
  outline: none;
}
.mode-toggle:focus-visible {
  box-shadow: 0 0 0 2px var(--accent), inset 0 1px 3px rgba(0,0,0,0.15);
}
/* Sliding pill: sits under Icons (right half) by default, Rooms (left half)
   in rooms mode. */
.mode-toggle-pill {
  position: absolute;
  top: 3px;
  left: 50%;
  height: calc(100% - 6px);
  width: calc(50% - 3px);
  border-radius: 999px;
  background: #3fb9e8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: left 0.22s cubic-bezier(.4,0,.2,1);
  z-index: 0;
  pointer-events: none;
}
.mode-toggle.rooms-mode .mode-toggle-pill { left: 3px; }
/* Labels */
.mode-toggle-label {
  position: relative;
  z-index: 1;
  flex: 1;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0 4px;
  transition: color 0.18s;
  white-space: nowrap;
  line-height: 1;
  color: var(--text-muted);
}
.mode-toggle-label--icons.active-label,
.mode-toggle-label--rooms.active-label {
  color: #fff;
}

.icon-panel .icon-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  scrollbar-width: thin;
}

.icon-panel-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 8px;
  line-height: 1.4;
}

/* Icon group sections (Stamps / Organization / My Icons) */
.icon-group { display: flex; flex-direction: column; }
.icon-group-header {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 6px 10px; border: none; background: none; cursor: pointer;
  color: var(--text-muted); text-align: left;
}
.icon-group-header:hover { color: var(--text); }
.icon-group-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; flex: 1; }
.icon-group-count { font-size: 0.68rem; background: var(--panel-2); border: 1px solid var(--border); border-radius: 20px; padding: 0 6px; line-height: 1.6; }
.icon-group-chevron { flex-shrink: 0; transition: transform 0.15s; }
.icon-group-chevron.collapsed { transform: rotate(-90deg); }
.icon-group-list { display: flex; flex-direction: column; }

/* Create Room bar */
.create-room-bar {
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.create-room-bar.hidden { display: none; }
.create-room-start-btn {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: 1.5px dashed var(--accent);
  background: rgba(34,211,238,0.06);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.create-room-start-btn:hover { background: rgba(34,211,238,0.14); }
.create-room-actions {
  display: flex;
  gap: 6px;
}
.create-room-actions.hidden { display: none; }
.create-room-save-btn,
.create-room-cancel-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 0.73rem;
}
.create-room-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}
.create-room-hint.hidden { display: none; }
.create-room-hint.create-room-hint--error { color: #b45309; font-weight: 600; }

/* Short message over the floorplan (e.g. why a drop was refused). */
.canvas-notice {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 6;
  max-width: min(460px, calc(100% - 32px));
  padding: 9px 16px;
  border-radius: var(--r-md, 10px);
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.canvas-notice.canvas-notice--visible { opacity: 1; transform: translate(-50%, 0); }
/* Notices drop below the room edit bar while it's showing. */
body.room-edit-bar-open .canvas-notice { top: 82px; }

/* Floating Save/Cancel bar over the floorplan while a room is edited. */
.room-edit-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 8px 8px 8px 16px;
  border-radius: var(--r-lg, 14px);
  background: var(--panel-strong, #fff);
  border: 1px solid var(--accent, #22d3ee);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,0.18)), 0 0 0 3px rgba(63, 185, 232,0.15);
  backdrop-filter: blur(var(--panel-blur, 12px));
  animation: roomEditBarIn 0.18s ease-out;
}
@keyframes roomEditBarIn {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.room-edit-bar-text { min-width: 0; }
.room-edit-bar-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-edit-bar-status {
  font-size: 0.74rem;
  color: var(--text-muted, #64748b);
  max-width: 380px;
}
.room-edit-bar-status--error { color: #dc2626; font-weight: 600; }
.room-edit-bar-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--r-md, 10px);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--panel-border, #cbd5e1);
  background: transparent;
  color: var(--text);
}
.room-edit-bar-btn:hover { background: var(--panel-hover, rgba(100,116,139,0.12)); }
.room-edit-bar-save {
  border: none;
  background: var(--accent-grad, #22d3ee);
  color: #fff;
}
.room-edit-bar-save:hover { filter: brightness(1.08); background: var(--accent-grad, #22d3ee); }

/* Rooms panel in the icon sidebar */
.rooms-panel-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rooms-panel-list.hidden { display: none; }
.room-panel-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  min-height: 42px;
  border-radius: var(--r-sm);
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}
.room-panel-item:hover { background: var(--panel-hover, var(--panel-strong)); border-color: var(--accent); }
.room-panel-name { flex: 1; min-width: 0; font-size: 0.78rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ── Report page summary bar ───────────────────────────────────────── */
/* Used to live on the standalone Rooms page; moved here once that page was
   removed (its per-room browsing is covered by the Floorplan page's Rooms
   panel + detail drawer). */

.report-summary-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--panel);
  backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  padding: 14px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--panel-highlight);
}
.report-summary-stat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.report-summary-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}
.report-summary-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.report-summary-divider {
  width: 1px;
  height: 36px;
  background: var(--panel-border);
  flex-shrink: 0;
  margin: 0 4px;
}

.report-summary-dante {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}
.report-summary-dante.hidden { display: none; }
.report-summary-dante-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(85%) sepia(80%) saturate(600%) hue-rotate(5deg) brightness(1.05);
}
.report-summary-dante-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .report-summary-bar {
    flex-wrap: wrap;
    gap: 10px 0;
  }
  .report-summary-stat { flex: 1 1 40%; }
  .report-summary-divider { display: none; }
  .report-summary-dante {
    flex: 1 1 100%;
    flex-direction: row;
    justify-content: center;
    padding-top: 6px;
    border-top: 1px solid var(--panel-border);
  }
}

/* Room bounding box drawn on the canvas */
.room-bounds {
  position: absolute;
  border: 2px dashed rgba(63, 185, 232,0.75);
  border-radius: 10px;
  background: rgba(63, 185, 232,0.07);
  box-shadow: inset 0 0 0 1px rgba(63, 185, 232,0.15);
  pointer-events: none;
  z-index: 0;
  box-sizing: border-box;
}
/* Rooms mode: rooms can be dragged (moves the room and its devices) and
   resized from the handles -- see _startRoomGesture() in app.js. */
.room-bounds.room-bounds--interactive {
  pointer-events: auto;
  cursor: move;
}
.room-bounds--interactive:hover { border-color: rgba(63, 185, 232,1); }
.room-bounds.room-bounds--invalid {
  border-color: #dc2626 !important;
  border-style: solid;
  background: rgba(220,38,38,0.1) !important;
}
.room-handle {
  position: absolute;
  width: calc(12px * var(--inv-zoom, 1));
  height: calc(12px * var(--inv-zoom, 1));
  background: #fff;
  border: calc(2px * var(--inv-zoom, 1)) solid rgba(63, 185, 232,1);
  border-radius: calc(3px * var(--inv-zoom, 1));
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 1;
}
.room-bounds--interactive:hover .room-handle,
body.room-gesture-active .room-handle { opacity: 1; }
.room-handle--n, .room-handle--s { left: 50%; margin-left: calc(-6px * var(--inv-zoom, 1)); cursor: ns-resize; }
.room-handle--e, .room-handle--w { top: 50%; margin-top: calc(-6px * var(--inv-zoom, 1)); cursor: ew-resize; }
.room-handle--n, .room-handle--ne, .room-handle--nw { top: calc(-7px * var(--inv-zoom, 1)); }
.room-handle--s, .room-handle--se, .room-handle--sw { bottom: calc(-7px * var(--inv-zoom, 1)); }
.room-handle--e, .room-handle--ne, .room-handle--se { right: calc(-7px * var(--inv-zoom, 1)); }
.room-handle--w, .room-handle--nw, .room-handle--sw { left: calc(-7px * var(--inv-zoom, 1)); }
.room-handle--ne, .room-handle--sw { cursor: nesw-resize; }
.room-handle--nw, .room-handle--se { cursor: nwse-resize; }
/* Keep the cursor steady while a room is being dragged/resized. */
body.room-gesture-active, body.room-gesture-active * { user-select: none; }
body.room-gesture--move, body.room-gesture--move * { cursor: move !important; }
body.room-gesture--n *, body.room-gesture--s * { cursor: ns-resize !important; }
body.room-gesture--e *, body.room-gesture--w * { cursor: ew-resize !important; }
body.room-gesture--ne *, body.room-gesture--sw * { cursor: nesw-resize !important; }
body.room-gesture--nw *, body.room-gesture--se * { cursor: nwse-resize !important; }

/* Rooms are outlines (polygons): the box sits at the outline's bounding
   box and the SVG inside draws the real shape -- see _buildRoomBox(). The
   box's own border/background are only used by the draft rectangle. */
.room-bounds.room-bounds--shape {
  border: none !important;
  border-radius: 0;
  background: none !important;
  box-shadow: none !important;
  animation: none !important;
  pointer-events: none !important;
  /* No stacking context of its own, so the name tag + pencil (z-index below) can rise above
     stamps/icons standing on top of the outline (the box still paints under them by DOM order). */
  z-index: auto;
}
.room-shape-svg { position: absolute; left: 0; top: 0; overflow: visible; }
.room-shape {
  fill: rgba(63, 185, 232,0.07);
  stroke: rgba(63, 185, 232,0.75);
  stroke-width: 2;
  stroke-dasharray: 7 5;
  stroke-linejoin: round;
  pointer-events: none;
}
.room-bounds--shape.room-bounds--empty .room-shape { fill: rgba(63, 185, 232,0.035); }
.room-bounds--shape.room-bounds--editing .room-shape {
  stroke: var(--accent, #22d3ee);
  stroke-dasharray: none;
  fill: rgba(34,211,238,0.1);
}
.room-bounds--shape.room-bounds--drop-target .room-shape {
  stroke: rgba(63, 185, 232,1);
  stroke-dasharray: none;
  fill: rgba(63, 185, 232,0.18);
}
.room-bounds--shape.room-bounds--just-added .room-shape { animation: roomShapeFlash 0.9s ease-out; }
@keyframes roomShapeFlash {
  0%   { fill: rgba(63, 185, 232,0.28); stroke: rgba(63, 185, 232,1); }
  100% { fill: rgba(63, 185, 232,0.07); stroke: rgba(63, 185, 232,0.75); }
}
.room-bounds--shape.room-bounds--invalid .room-shape {
  stroke: #dc2626 !important;
  stroke-dasharray: none;
  fill: rgba(220,38,38,0.1) !important;
}
/* Rooms mode: the shape itself (not its whole bounding box) takes the drag. */
.room-bounds--shape.room-bounds--interactive .room-shape { pointer-events: visiblePainted; cursor: move; }
.room-bounds--shape.room-bounds--interactive:hover .room-shape { stroke: rgba(63, 185, 232,1); }
.room-bounds--shape .room-handle { pointer-events: auto; }
.room-bounds--shape.room-bounds--interactive:hover .room-handle { opacity: 1; }
/* Edit mode: corner handles and "+" (add corner) handles on each edge,
   constant on-screen size at any zoom. */
.room-vertex, .room-vertex-add {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
}
.room-vertex {
  width: calc(14px * var(--inv-zoom, 1));
  height: calc(14px * var(--inv-zoom, 1));
  background: #fff;
  border: calc(2.5px * var(--inv-zoom, 1)) solid var(--accent, #22d3ee);
  border-radius: calc(3px * var(--inv-zoom, 1));
  cursor: crosshair;
}
.room-vertex:hover { background: var(--accent, #22d3ee); }
.room-vertex-add {
  width: calc(12px * var(--inv-zoom, 1));
  height: calc(12px * var(--inv-zoom, 1));
  border-radius: 50%;
  background: var(--accent, #22d3ee);
  border: calc(1.5px * var(--inv-zoom, 1)) solid #fff;
  opacity: 0.75;
  cursor: crosshair;
}
.room-vertex-add::before, .room-vertex-add::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}
.room-vertex-add::before { width: 60%; height: 14%; }
.room-vertex-add::after  { width: 14%; height: 60%; }
.room-vertex-add:hover { opacity: 1; }
body.room-gesture--vertex, body.room-gesture--vertex * { cursor: grabbing !important; }

/* Rooms are drawn before devices go in -- an empty room still shows, a
   little fainter. */
.room-bounds.room-bounds--empty {
  background: rgba(63, 185, 232,0.035);
}
/* The room whose area is being redrawn, and the rectangle just drawn for a
   new room / redraw (not saved yet). */
.room-bounds.room-bounds--editing {
  border-color: rgba(63, 185, 232,0.35);
}
.room-bounds.room-bounds--draft {
  border: 2px solid var(--accent, #22d3ee);
  background: rgba(34,211,238,0.12);
  box-shadow: 0 0 0 1px rgba(34,211,238,0.25), 0 0 14px rgba(34,211,238,0.35);
}
/* A device that isn't inside any room (only possible for devices placed
   before rooms came first) -- amber, like "Not Ready". */
.canvas-item.canvas-item--no-room {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
  border-radius: 8px;
  background: rgba(254,243,199,0.55);
}
/* While dragging an icon over the canvas, whichever room's boundary the
   drop point currently falls inside lights up so it's clear the icon will
   join that room. */
.room-bounds.room-bounds--drop-target {
  border-color: rgba(63, 185, 232,1);
  border-style: solid;
  background: rgba(63, 185, 232,0.18);
  box-shadow: inset 0 0 0 1.5px rgba(63, 185, 232,0.4), 0 0 16px rgba(63, 185, 232,0.45);
}
/* Brief confirmation flash right after an icon is auto-assigned into a room
   on drop -- fades back to the normal resting style on its own. */
.room-bounds.room-bounds--just-added {
  animation: roomBoundsFlash 0.9s ease-out;
}
@keyframes roomBoundsFlash {
  0%   { border-color: rgba(63, 185, 232,1); background: rgba(63, 185, 232,0.28); box-shadow: inset 0 0 0 2px rgba(63, 185, 232,0.6), 0 0 20px rgba(63, 185, 232,0.55); }
  100% { border-color: rgba(63, 185, 232,0.75); background: rgba(63, 185, 232,0.07); box-shadow: inset 0 0 0 1px rgba(63, 185, 232,0.15); }
}
/* Room name tag above the outline. Zoomed out, it scales up (to at most 3x)
   so it stays readable on screen; zoomed in it grows with the plan. */
.room-bounds-label {
  position: absolute;
  top: 0;      /* moved onto the outline's top-left corner by _buildRoomBox() */
  left: 6px;
  transform-origin: 0 100%;
  transform: translateY(calc(-100% - 2px)) scale(clamp(1, var(--inv-zoom, 1), 2));
  display: none;   /* shown only on the Rooms tab -- see body.rooms-tab below */
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-transform: uppercase;
  color: #fff;
  background: rgb(37,99,160);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 5px;
  padding: 2px 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
  white-space: nowrap;
  pointer-events: none;
  z-index: 40;
}
/* A room's name shows only for the room you're pointing at (canvas or Rooms list), the one an icon is being
   dragged over, or the one being edited -- not on every room at once (they stack on cramped plans). */
body.rooms-tab .room-bounds--hover .room-bounds-label,
.room-bounds--drop-target .room-bounds-label { display: inline-flex; }
.room-bounds--shape.room-bounds--hover .room-shape { stroke: rgba(63, 185, 232,1); stroke-dasharray: none; fill: rgba(63, 185, 232,0.18); }
.room-bounds.room-bounds--hover:not(.room-bounds--shape) { border-color: rgba(63, 185, 232,1); border-style: solid; background: rgba(63, 185, 232,0.18); }
.room-panel-item--hover { background: var(--panel-hover, var(--panel-strong)); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(63,185,232,.28); }
.room-bounds--editing .room-bounds-label {
  display: inline-flex;
  background: #0e7490;
  border-color: var(--accent, #22d3ee);
}

/* Pencil inside a room's canvas label -- opens the room's edit mode. */
.room-bounds-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: -1px -4px -1px 0;
  border: none;
  border-radius: 4px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
}
.room-bounds-edit svg { width: 13px; height: 13px; }
.room-bounds-edit:hover { background: rgba(255,255,255,0.38); }

/* Inline room rename input */
.room-name-input {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--accent);
  border-radius: var(--r-xs);
  padding: 4px 6px;
  outline: none;
}
.room-name-input--error {
  border-color: #ef4444;
  animation: shake 0.25s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

.room-panel-edit,
.room-panel-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 4px;
  border-radius: var(--r-xs);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s, background 0.12s;
}
.room-panel-edit svg,
.room-panel-delete svg { width: 13px; height: 13px; }
.room-panel-edit:hover { color: var(--accent); background: rgba(34,211,238,0.1); }
.room-panel-delete:hover { color: #ef4444; background: rgba(239,68,68,0.12); }
/* Edit-mode row */
.room-panel-item--editing { border-color: var(--accent); background: rgba(34,211,238,0.06); flex-wrap: wrap; }
.room-edit-save-btn { color: var(--accent) !important; padding: 3px 4px !important; margin-left: auto; flex: 0 0 auto; }
.room-edit-save-btn:hover { background: rgba(34,211,238,0.15) !important; }
.room-edit-cancel-btn { color: var(--text-muted); }
/* Full-width red Delete under the name field while a room is being edited. */
.room-edit-delete-btn {
  flex: 1 0 100%;
  margin-top: 6px;
  padding: 6px 10px;
  border: 1px solid #dc2626;
  border-radius: var(--r-sm);
  background: #dc2626;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}
.room-edit-delete-btn:hover { background: #b91c1c; border-color: #b91c1c; }
.room-name-error {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: #ef4444;
  min-height: 1.2em;
  line-height: 1.3;
}

/* Room detail drawer title + inline rename */
.room-detail-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.room-detail-rename-btn svg { width: 15px; height: 15px; }
.room-detail-name-input {
  flex: 1;
  min-width: 0;
  font-size: 1.1rem;
}

/* Toolbar floats in bottom-right of canvas viewport */
.canvas-viewport .canvas-toolbar {
  position: absolute;
  bottom: 12px;
  right: 12px;
  margin: 0;
  width: auto;
  z-index: 200;
  pointer-events: auto;
}

/* In dark mode the panel is nearly transparent — force an opaque dark bg
   so the pill stays legible over white PDF backgrounds */
body.dark .canvas-viewport .canvas-toolbar {
  background: rgba(22, 22, 22, 0.90);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border-color: rgba(255, 255, 255, 0.12);
}

/* ── Cards / panels (glass) ─────────────────────────────────────────────── */
.panel { display: grid; gap: 16px; }

.card {
  background: var(--panel);
  backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  padding: 18px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--panel-highlight);
}

.card h3 {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.placeholder-card {
  min-height: 200px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 20px;
  text-align: center;
}

.hint { margin-top: 12px; color: var(--text-muted); font-size: 0.85rem; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.primary-button,
.secondary-button,
button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 11px 22px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: transform var(--t-fast), box-shadow var(--t), background var(--t),
              border-color var(--t), filter var(--t-fast), color var(--t-fast);
}

.primary-button {
  background: var(--accent-grad);
  color: var(--on-accent);
  width: 100%;
  box-shadow: var(--glow-accent);
}
.primary-button:hover { transform: translateY(-1px); box-shadow: var(--glow-accent-hover); filter: brightness(1.05); }
.primary-button:active { transform: translateY(0) scale(0.98); box-shadow: var(--glow-accent); }

.secondary-button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  box-shadow: inset 0 1px 0 var(--panel-highlight);
}
.secondary-button:hover { border-color: var(--accent-ring); color: var(--accent-text); background: var(--accent-soft); }
.secondary-button:active { transform: scale(0.98); }
/* address set button kept for JS compat but hidden */
#projectAddressSetBtn { display: none; }

button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; filter: none; }

.icon-button {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--r-sm);
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
  cursor: pointer;
  font-size: 1.1rem;
  -webkit-user-select: none;
  user-select: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.icon-button:hover { border-color: var(--accent-ring); }
.icon-button:active { transform: scale(0.95); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
label { display: block; margin-bottom: 14px; font-size: 0.88rem; color: var(--text-muted); font-weight: 500; }

input, textarea, select {
  width: 100%;
  margin-top: 7px;
  padding: 12px 14px;
  border: 1px solid var(--input-border);
  border-radius: var(--r-sm);
  font-size: 16px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
/* <option> doesn't inherit background from its <select> the way it inherits
   color -- browsers render the dropdown's own popup list with a native
   background (usually white/light grey) regardless of theme, so in dark
   mode the inherited light `color` landed on that native light background:
   white text on light grey, unreadable (reported 2026-09-24). Only
   background-color/color are reliably stylable on <option> across
   browsers; themed explicitly here so both modes stay legible.
   Uses --bg-0, not --input-bg (the closed <select> box's own background) --
   --input-bg is a translucent overlay meant to be composited over the
   page's real background underneath it, which works for the select box
   sitting in the page's own layout but not for the dropdown's native OS
   popup, which isn't part of that compositing stack and needs a solid,
   opaque color to render correctly. */
select option {
  background: var(--bg-0);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; min-height: 1.2em; }

.upload-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.upload-overlay.hidden { display: none; }
.upload-overlay-card {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 36px 48px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.upload-spinner {
  width: 44px; height: 44px;
  border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spinnerRotate 0.75s linear infinite;
}
@keyframes spinnerRotate { to { transform: rotate(360deg); } }
.upload-overlay-label { font-size: 0.9rem; color: var(--text-muted); letter-spacing: 0.02em; }

.project-address-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--input-bg, var(--panel-strong));
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  overflow: hidden;
}
.project-address-field:focus-within {
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.project-address-field input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 10px 8px;
  font-size: 0.9rem;
  color: var(--text);
  min-width: 0;
}
.project-address-field input::placeholder { color: var(--text-muted); }
.addr-icon-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0;
  padding: 0;
  transition: color var(--t-fast);
}
.addr-icon-btn svg { width: 15px; height: 15px; }
.addr-icon-btn:hover { color: var(--accent-text); background: transparent; border: none; box-shadow: none; transform: none; }
.addr-clear-btn.hidden { display: none; }

/* Location confirmation card */
.project-location-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: var(--panel-strong);
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
  box-shadow: inset 0 1px 0 var(--panel-highlight);
  margin-top: 6px;
}
.project-location-card.hidden { display: none; }
.project-location-map {
  width: 100%;
  height: 220px;
  display: block;
  position: relative;
  z-index: 0;
}
/* Leaflet attribution overlap fix inside modal */
.project-location-map .leaflet-control-attribution { font-size: 9px; }
.project-map-status {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--panel-strong);
  border-bottom: 1px solid var(--panel-border);
}
.project-map-status.hidden { display: none; }
.project-location-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--panel-border);
  min-width: 0;
}
.project-location-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}
.project-location-pin-icon {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--accent-text);
}
.project-location-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-location-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.project-location-link {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--t-fast);
}
.project-location-link:hover { color: var(--accent-text); text-decoration: underline; }
.project-location-confirm-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  height: auto;
  min-height: 0;
  background: var(--accent-grad);
  color: var(--on-accent);
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--t-fast), transform var(--t-fast);
  box-shadow: var(--glow-accent);
}
.project-location-confirm-btn:hover { opacity: 0.9; transform: scale(1.02); }
.project-location-confirm-btn:active { transform: scale(0.97); }
.project-location-confirmed-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #22c55e;
  white-space: nowrap;
}
.project-location-confirmed-badge svg { width: 14px; height: 14px; color: #22c55e; }
.project-location-confirmed-badge.hidden { display: none; }
.project-location-change-btn {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
  transition: color var(--t-fast);
  box-shadow: none;
  min-height: 0;
  height: auto;
}
.project-location-change-btn:hover { color: var(--text); background: transparent; border: none; box-shadow: none; transform: none; }
.project-location-change-btn.hidden { display: none; }


.project-modal-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid var(--panel-border);
}
.project-modal-actions .primary-button { width: auto; min-width: 140px; }

.file-drop-zone {
  display: grid;
  gap: 10px;
  border: 2px dashed var(--input-border);
  border-radius: var(--r-md);
  padding: 18px 16px;
  background: var(--panel-2);
  cursor: pointer;
  position: relative;
  color: var(--text-muted);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.file-drop-zone.disabled { opacity: 0.6; pointer-events: none; }
.file-drop-zone:hover, .file-drop-zone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.file-drop-zone input[type="file"] {
  opacity: 0;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.upload-help { color: var(--text-faint); font-size: 0.93rem; }

.file-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 20px;
  border: 2px dashed var(--input-border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  text-align: center;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.file-upload-area:hover { border-color: var(--accent-ring); }
.file-upload-area.drag-over { border-color: var(--accent); background: var(--accent-soft); }

/* ── Projects ───────────────────────────────────────────────────────────── */
.projects-table-card { display: flex; flex-direction: column; gap: 14px; }
.projects-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; }
.projects-search { margin: 0; line-height: 1.2;
  flex: 1 1 220px; min-width: 180px; box-sizing: border-box;
  padding: 8px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--input-border); background: var(--panel-2);
  color: var(--text); font-size: 0.85rem;
}

.projects-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
}
.projects-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.projects-table thead th {
  text-align: left; padding: 10px 14px; font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--panel-border);
}
.projects-table tbody tr.projects-table-row {
  border-bottom: 1px solid var(--panel-border);
  cursor: pointer; transition: background 0.1s;
}
.projects-table tbody tr.projects-table-row:last-child { border-bottom: none; }
.projects-table tbody tr.projects-table-row:hover { background: rgba(255,255,255,0.03); }
.projects-table tbody tr.projects-table-row.is-active { background: var(--accent-soft); }
.projects-table td { padding: 8px 14px; color: var(--text); vertical-align: middle; }
.projects-table-cell-num { text-align: center; }
.projects-table-preview { width: 56px; }
.projects-table-thumb {
  width: 44px; height: 44px; border-radius: var(--r-sm);
  background-size: cover; background-position: center;
  background-color: var(--panel-2); border: 1px solid var(--panel-border);
}
.projects-table-thumb.is-empty { opacity: 0.4; }
.projects-table-name { font-weight: 700; color: var(--text); }
.projects-table-actions { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.phase-current { display: none; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; background: var(--accent); color: #fff; }
.phase-current--done { background: #2fb36b; }
.phase-current--none { background: transparent; color: var(--text-muted); font-weight: 600; }
.projects-table-empty { padding: 24px 14px; text-align: center; color: var(--text-muted); }
@media (max-width: 720px) {
  /* Columns: 1 preview, 2 name, 3 phase, 4 last modified, 5 actions. On a phone the last-modified
     column goes, and the phase shows as the current phase only. */
  /* Phone: just the project name (and its actions). The phase column and ETA, and the filter row that belongs to them, are hidden. */
  .projects-table thead th:nth-child(3), .projects-table td:nth-child(3),
  .projects-table thead th:nth-child(4), .projects-table td:nth-child(4) { display: none; }
  /* The filter row stays (search + Mine live in its name cell); its phase / tag cells are hidden with their columns. */
  .projects-filter-row th:nth-child(5) { display: none; }
  .projects-table td, .projects-table thead th { padding-left: 8px; padding-right: 8px; }
  .projects-table-preview { width: 44px; }
  .projects-table-thumb { width: 36px; height: 36px; }
}

.project-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.project-columns .project-list h3 { margin: 0 0 12px; font-size: 0.95rem; color: var(--text-secondary, inherit); }
@media (max-width: 860px) { .project-columns { grid-template-columns: 1fr; } }
.project-list { display: grid; gap: 12px; }
/* #projectList's own children (.project-item rows) had zero gap between them —
   harmless with the old faint neutral hover shadow, but the blue hover glow's
   blur radius is wide enough to bleed onto the touching card below, making it
   look like two cards are highlighted at once. (.org-project-list-scroll
   already has its own gap, unaffected.) */
#projectList { display: grid; gap: 10px; }

.org-project-search-wrap { margin-bottom: 10px; }
.org-project-search {
  width: 100%; box-sizing: border-box;
  padding: 7px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text);
  font-size: 0.85rem; outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.org-project-search::placeholder { color: var(--text-muted); }
.org-project-search:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.org-project-list-scroll { max-height: 420px; overflow-y: auto; display: grid; gap: 10px; }
.admin-domain-selector { display: flex; gap: 8px; margin-bottom: 10px; }
.admin-domain-input { flex: 1; padding: 7px 10px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--panel); color: var(--text); font-size: 0.85rem; }
.admin-domain-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.admin-domain-btn { padding: 7px 14px; border-radius: var(--r-sm); background: var(--accent-grad); color: var(--on-accent); border: none; font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap; }

.project-item {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 10px 12px 16px;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
/* No transform here: shifting the box shifts its own bottom edge, which can cross
   a cursor sitting in the lower half and fire mouseleave/mouseenter in a tight
   loop (visible as the card "jittering" in place). Border/shadow only. */
.project-item:hover { border-color: var(--accent); box-shadow: var(--glow-accent); }
.project-item:active { transform: scale(0.99); }

.project-card { cursor: pointer; }
.project-card-preview {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: var(--r-sm);
  background-size: cover;
  background-position: center;
  background-color: var(--panel-3, rgba(255,255,255,0.05));
  border: 1px solid var(--panel-border);
}
.project-card-preview.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.project-card-actions { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }
.project-edit-btn,
.project-delete-btn {
  flex: none;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: filter var(--t-fast), border-color var(--t-fast);
}
.project-edit-btn { background: var(--panel-2); color: var(--text-secondary, inherit); }
.project-edit-btn:hover { filter: brightness(1.1); border-color: var(--accent-ring); }
.project-delete-btn { background: var(--danger-soft); color: var(--danger); }
.project-delete-btn:hover { filter: brightness(1.1); border-color: var(--danger); }
.project-item.is-active { border-color: var(--accent); box-shadow: var(--glow-accent); }
.project-item strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-card-filename,
.project-card-pages {
  font-size: 0.78rem;
}
.project-card-timestamps,
.project-card-editor {
  font-size: 0.7rem;
  opacity: 0.6;
}

/* Project cards collapse to their essentials on narrower displays: the preview
   thumbnail and title are the priority — every detail line (filename, pages,
   timestamps, editor, and the org-card description line) and the delete button
   are secondary and get out of the way so the card itself can shrink further. */
@media (max-width: 640px) {
  .project-card-info p { display: none; }
  .project-delete-btn { display: none; }
}

/* ── Rooms ──────────────────────────────────────────────────────────────── */
.room-controls { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.room-controls input { margin-top: 0; flex: 1; }
.room-controls .primary-button { width: auto; flex-shrink: 0; }
.rooms-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.room-item {
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.9rem;
}

/* ── Icon library / manager ─────────────────────────────────────────────── */
.icon-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; }
.icon-panel .icon-list { display: flex; flex-direction: column; gap: 4px; grid-template-columns: unset; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }

.library-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-sm);
  background: var(--panel-2);
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.icon-manager-grid .library-item { cursor: pointer; }
.icon-panel .library-item {
  flex-direction: row; gap: 8px; padding: 7px 8px;
  cursor: grab;
}
.icon-panel .library-item.dragging { opacity: 0.4; cursor: grabbing; }
.icon-panel .icon-select { width: 38px; height: 38px; flex-shrink: 0; border-radius: var(--r-xs); }
.icon-panel .icon-name { font-size: 0.76rem; text-align: left; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.library-item:hover { border-color: var(--accent-ring); }
.library-item:active { transform: scale(0.97); }
.library-item.selected { border-color: var(--accent); box-shadow: var(--glow-accent); }

.canvas-viewport.drag-over-canvas { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: var(--r-lg); }

.icon-select {
  width: 56px;
  height: 56px;
  border: 1px solid var(--input-border);
  border-radius: var(--r-xs);
  background-color: var(--panel-strong);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.icon-name { font-size: 0.8rem; color: var(--text); text-align: center; word-break: break-word; }

/* ── Icon manager full-page grid ────────────────────────────────────────── */
.icon-manager-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  align-content: start;
}

.icon-manager-grid .library-item {
  padding: 14px 10px 10px;
  position: relative;
}

.icon-manager-grid .icon-select {
  width: 72px;
  height: 72px;
}

/* Icon manager grouped sections (Personal / Organization / Stamps) */
.icon-manager-sections { display: flex; flex-direction: column; gap: 0; }
.icon-manager-group-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 4px 6px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
  user-select: none;
}
.icon-manager-group-header:not(:first-child) { margin-top: 20px; }
.icon-manager-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  align-content: start;
  margin-bottom: 4px;
}
.icon-manager-subgrid .library-item { padding: 14px 10px 10px; position: relative; cursor: pointer; }
.icon-manager-subgrid .icon-select { width: 72px; height: 72px; }

/* ── New Icon modal ─────────────────────────────────────────────────────── */
#confirmDeleteIconModal { z-index: 1001; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-backdrop.hidden { display: none; }

.confirm-modal-card { padding: 0 0 20px; }
.confirm-modal-card p { margin: 0; padding: 0 20px 4px; color: var(--text-secondary, inherit); line-height: 1.5; }
.confirm-modal-card .modal-actions { padding: 16px 20px 0; display: flex; justify-content: flex-end; gap: 10px; }
.duplicate-photo-apply-all { display: flex; align-items: center; gap: 8px; padding: 10px 20px 0; font-size: 0.82rem; color: var(--text-muted); cursor: pointer; user-select: none; }
.duplicate-photo-apply-all input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

/* ── Report share modal ───────────────────────────────────────────────── */
.report-share-modal-card { min-width: min(480px, 90vw); }
.report-share-hint { padding: 0 20px 12px; font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }
.report-share-url-row { display: flex; gap: 8px; padding: 0 20px 4px; }
.report-share-url-input {
  flex: 1; min-width: 0;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  font-size: 0.78rem; padding: 7px 10px;
  cursor: text; user-select: all;
}
.report-share-url-input:focus { outline: none; border-color: var(--accent); }
.danger-button { background: var(--danger); color: #fff; }
.danger-button:hover { filter: brightness(1.1); }

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* New Icon modal — wider two-column layout */
.new-icon-modal-card { max-width: 860px; }

/* Admin Console — project audit log modal */
.audit-log-modal-card { max-width: 560px; }
.audit-log-subtitle {
  margin: 0;
  padding: 0 20px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.audit-log-list {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.audit-log-entry {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.02);
}
.audit-log-entry-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.audit-log-entry-action { font-size: 0.85rem; color: var(--text); }
.audit-log-entry-actor { font-size: 0.72rem; color: var(--text-muted); }
.audit-log-entry-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--panel-border);
}

.modal-header h3 { margin: 0; font-size: 1rem; }

.modal-close-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-xs);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  transition: color var(--t-fast), background var(--t-fast);
}
.modal-close-btn:hover { color: var(--text); background: var(--panel-strong); }

/* New icon form layout */
.new-icon-form { display: flex; flex-direction: column; }

.new-icon-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  align-items: start;
  gap: 28px;
  padding: 24px 28px;
  overflow-y: auto;
  max-height: calc(90vh - 130px); /* header + footer; prevents buttons going off-screen */
}

.new-icon-left-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

@media (max-width: 560px) {
  .new-icon-body { grid-template-columns: 1fr; }
}

/* Drop zone / image placeholder */
.new-icon-dropzone {
  position: relative;
  width: 240px;
  height: 240px;
  border: 2px dashed var(--input-border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
}
.new-icon-dropzone:hover,
.new-icon-dropzone.drag-over { border-color: var(--accent); background: var(--accent-soft); }

@media (max-width: 560px) {
  .new-icon-dropzone { width: 100%; height: 160px; }
}

.new-icon-drop-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.new-icon-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}
.new-icon-preview.hidden { display: none; }

/* Fields column */
.new-icon-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.new-icon-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; color: var(--text-muted); }
.new-icon-fields input,
.new-icon-fields textarea,
.new-icon-fields select { margin-top: 0; }
.new-icon-fields textarea { resize: vertical; min-height: 72px; }

.new-icon-fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.new-icon-fields-row .label-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* 2×2 controls grid */
.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.controls-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.controls-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
}
.controls-dante-logo {
  display: block;
  height: 1em;
  font-size: 0.8rem;
  width: auto;
  margin: 0 auto;
  object-fit: contain;
  filter: none;
}
body.dark .controls-dante-logo { filter: invert(1); }
.dante-active .controls-dante-logo {
  filter: invert(82%) sepia(60%) saturate(800%) hue-rotate(0deg) brightness(1.05);
}
/* Keep the yellow tint in dark mode — outspecificity body.dark's invert(1). */
body.dark .dante-active .controls-dante-logo {
  filter: invert(82%) sepia(60%) saturate(800%) hue-rotate(0deg) brightness(1.05);
}

.dante-yesno {
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}
.dante-yesno input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.dante-yesno-track {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 34px;
  border-radius: var(--r-pill);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  overflow: hidden;
  transition: border-color var(--t-fast);
}
.dante-yesno input:checked ~ .dante-yesno-track {
  border-color: var(--accent);
}
.dante-yesno-no,
.dante-yesno-yes {
  position: absolute;
  width: 50%;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 34px;
  z-index: 1;
  transition: color var(--t-fast);
  pointer-events: none;
}
.dante-yesno-no { left: 0; color: var(--text); }
.dante-yesno-yes { right: 0; color: var(--text-muted); }
.dante-yesno input:checked ~ .dante-yesno-track .dante-yesno-no { color: var(--text-muted); }
.dante-yesno input:checked ~ .dante-yesno-track .dante-yesno-yes { color: #fff; }
.dante-yesno-thumb {
  position: absolute;
  left: 2px;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  top: 2px;
  border-radius: var(--r-pill);
  background: var(--panel-border);
  transition: transform var(--t-fast), background var(--t-fast);
  z-index: 0;
}
.dante-yesno input:checked ~ .dante-yesno-track .dante-yesno-thumb {
  transform: translateX(calc(100% + 4px));
  background: var(--accent);
}


/* Segmented pill (PoE / Data Drops) */
.seg-pill {
  position: relative;
  display: flex;
  width: 100%;
  height: 34px;
  border-radius: var(--r-pill);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  overflow: hidden;
}
.seg-pill-thumb {
  position: absolute;
  top: 2px;
  left: 0;
  height: calc(100% - 4px);
  border-radius: var(--r-pill);
  background: var(--accent);
  transition: transform 0.2s var(--ease-out), width 0.2s var(--ease-out);
  pointer-events: none;
  z-index: 0;
}
.seg-pill-opt {
  flex: 1;
  position: relative;
  z-index: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
}
.seg-pill-opt.active { color: #0f172a; }
.seg-pill-opt:not(.active):hover { color: var(--text); }

/* PoE colour states */
#iconPoeToggle.poe-active .seg-pill-thumb { background: #16a34a; }
#iconPoeToggle.poe-active .seg-pill-opt.active { color: #0f172a; }
#iconPoeToggle.poe-plus-active .seg-pill-thumb { background: #eab308; }
#iconPoeToggle.poe-plus-active .seg-pill-opt.active { color: #0f172a; }


/* Segmented toggle */

/* Suppress all native browser validation UI */
.new-icon-form input:invalid,
.new-icon-form textarea:invalid,
.new-icon-form select:invalid { box-shadow: none; outline: none; }

/* Only show invalid highlight after user attempts submit */
.new-icon-form.submitted input:invalid,
.new-icon-form.submitted textarea:invalid,
.new-icon-form.submitted select:invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}
.new-icon-dropzone.drop-invalid {
  border-color: var(--danger) !important;
  background: rgba(220, 38, 38, 0.06);
}

/* Footer */
.new-icon-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--panel-border);
}
.new-icon-footer .primary-button,
.new-icon-footer .secondary-button { width: auto; }

/* ── URL Import ──────────────────────────────────────────────────────── */
.icon-url-import-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.icon-url-import-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  background: var(--panel-2);
  border: 1px solid var(--input-border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.icon-url-import-trigger:hover {
  color: var(--accent);
  border-color: var(--accent-ring);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.icon-url-input-row {
  display: flex;
  gap: 6px;
}
.icon-url-input-row input {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
}
.icon-url-input-row .primary-button {
  width: auto;
  padding: 0 14px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.icon-url-status {
  font-size: 0.76rem;
  color: var(--text-muted);
  min-height: 16px;
}
.icon-url-status.error { color: var(--danger, #f87171); }

/* ── Scrape review panel ─────────────────────────────────────────────── */
/* ── Inline field suggestions (injected by scraper) ─────────────────── */

/* Image picker — injected below the URL import wrap, in the left column */
.icon-suggest-images {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--accent) 6%, var(--panel-2));
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-sm);
}
.icon-suggest-images-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.icon-suggest-thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.icon-scrape-thumb {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: var(--r-sm);
  border: 2px solid var(--input-border);
  background: var(--panel);
  cursor: pointer;
  padding: 3px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.icon-scrape-thumb:hover { border-color: var(--accent-ring); transform: scale(1.06); }
.icon-scrape-thumb.selected {
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
}
.icon-suggest-image-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.icon-suggest-use-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--accent-grad);
  color: var(--on-accent, #000);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: opacity var(--t-fast);
}
.icon-suggest-use-btn:hover { opacity: 0.88; }
.icon-suggest-use-btn:disabled { opacity: 0.5; cursor: default; }
.icon-suggest-progress-track {
  height: 4px;
  border-radius: 999px;
  background: var(--panel);
  overflow: hidden;
}
.icon-suggest-progress-bar {
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: var(--accent-grad);
  animation: suggestProgress 1.2s ease-in-out infinite;
}
@keyframes suggestProgress {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

/* Per-field suggestion row — injected after each input/textarea */
.icon-suggest-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 4px;
  padding: 7px 10px;
  background: color-mix(in srgb, var(--accent) 6%, var(--panel-2));
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-sm);
  animation: suggestFadeIn 0.18s ease;
}
@keyframes suggestFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.icon-suggest-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.icon-suggest-val {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-primary);
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}
/* In a half-width column (Model), the suggested value gets its own line
   under the badge and buttons instead of wrapping word by word. */
.new-icon-fields-row .icon-suggest-val { order: 3; flex-basis: 100%; }
.new-icon-fields-row .icon-suggest-badge { flex: 1; }
.icon-suggest-accept {
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-grad);
  color: var(--on-accent, #000);
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--t-fast);
}
.icon-suggest-accept:hover { opacity: 0.85; }
.icon-suggest-dismiss {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 50%;
  transition: color var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
}
.icon-suggest-dismiss:hover { color: var(--text-primary); background: var(--panel-2); }

/* Power/data suggestion block — injected below sliders-dante-row */
.icon-suggest-power {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--accent) 6%, var(--panel-2));
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-sm);
  animation: suggestFadeIn 0.18s ease;
}
.icon-suggest-power-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.icon-suggest-power-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.icon-suggest-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--input-border);
  background: var(--panel);
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: default;
}
.icon-suggest-chip-accept {
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-grad);
  color: var(--on-accent, #000);
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: opacity var(--t-fast);
}
.icon-suggest-chip-accept:hover { opacity: 0.85; }
.icon-suggest-chip.applied {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

@media (max-width: 560px) {
  .new-icon-left-col { width: 100%; }
}

.icon-trash-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 0;
  min-height: 0;
  margin-right: auto;
  padding: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.icon-trash-btn:hover { color: var(--danger); border-color: var(--danger); }
.icon-trash-btn.hidden { display: none; }

.upload-hint { font-size: 0.75rem; color: var(--text-muted); margin: 0; }

/* ── Canvas ─────────────────────────────────────────────────────────────── */
.canvas-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; height: 100%; }

.canvas-header { display: flex; justify-content: flex-end; gap: 12px; align-items: center; flex-wrap: wrap; }
.canvas-header--status-only { justify-content: flex-start; }
.canvas-header h3 { margin: 0; font-size: 1rem; }

/* Viewport is the strict bounding box — clips the canvas at all four edges */
.canvas-viewport {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--canvas-bg);
  cursor: grab;
  /* fill all available space in the flex row */
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}
.canvas-viewport:active { cursor: grabbing; }

/* Canvas is absolutely positioned so transforms never affect viewport size */
.canvas {
  position: absolute;
  top: 0;
  left: 0;
  /* fills the viewport until a PDF sets explicit pixel dimensions via JS */
  width: 100%;
  height: 100%;
  transform-origin: top left;
  will-change: transform;
  touch-action: none;
  border-radius: var(--r-lg);
  border: 1px solid var(--panel-border);
  background-color: var(--canvas-bg);
  background-image:
    radial-gradient(70% 60% at 12% 8%, var(--accent-soft), transparent 55%),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    linear-gradient(180deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, 40px 40px, 40px 40px;
}

.pdf-background {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  pointer-events: none;
  z-index: 0;
}

.canvas-item {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: var(--r-sm);
  background: transparent;
  /* Every interactive state below (selected/hover/locked/etc.) sets only
     this one custom property rather than border-color directly, so there's
     a single place -- the .canvas-item--mount-desktop rule further down --
     that can unconditionally force it back to transparent for the hexagon
     shape (which shows color via its SVG stroke instead, see
     .canvas-item-hex-border). Before this, each state had to remember to
     separately suppress its own border-color for that one shape, and it
     was easy to miss one (icons-locked:hover did, reported 2026-09-17 as
     a plain square outline appearing on hover instead of the hex). */
  --item-ring-color: transparent;
  border: 2px solid var(--item-ring-color);
  display: grid;
  place-items: center;
  overflow: visible;
  cursor: move;
  /* 'none' (not 'manipulation') so the browser never treats a finger-move
     on an icon as its own pan/scroll gesture -- the press-and-hold-to-drag
     JS (see createCanvasElement()) needs to fully own the touch instead.
     -webkit-touch-callout/user-select suppress iOS's long-press "save
     image"/text-selection callout, which would otherwise fire partway
     through the same hold that's meant to arm dragging. */
  touch-action: none;
  -webkit-touch-callout: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  transform-origin: center center;
  user-select: none;
}
/* Border shape is an at-a-glance mount-position indicator (2026-09-17) --
   set by createCanvasElement() from the item's _effectiveMountPosition(),
   independent of the selected/hover states below (which only ever change
   border *color*, not shape, so it stays put through interaction). */
.canvas-item--mount-ceiling { border-radius: 50%; }
.canvas-item--mount-wall { border-radius: 0; }
/* Hexagon (Desktop) isn't achievable with border-radius, and a real `border`
   plus clip-path would just crop a rectangle unevenly at the diagonals
   instead of tracing a hexagon outline -- an SVG polygon stroke (appended by
   createCanvasElement(), fill: none) draws a true hollow hexagon instead,
   the same way a plain CSS border is already a hollow ring for the other
   two shapes. */
/* Always transparent regardless of what any state above sets
   --item-ring-color to -- this shape shows its color via the SVG stroke's
   `stroke: var(--item-ring-color)` (see .canvas-item-hex-border below)
   instead of a real border, so the box's own border must never show. */
.canvas-item--mount-desktop { border-radius: 0; border-color: transparent; }
.canvas-item-hex-border {
  grid-row: 1;
  grid-column: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.canvas-item-hex-border polygon { stroke: var(--item-ring-color, transparent); transition: stroke var(--t-fast); }
/* Visual "lift" cue while a press-and-hold has armed dragging on touch,
   similar to a phone home screen's icon-rearrange mode. Can't use `transform`
   here (scale) -- _applyItemTransform() sets that element's transform
   directly as an inline style on every move/render, which would silently
   override anything set here. */
.canvas-item--drag-armed {
  box-shadow: 0 6px 20px rgba(0,0,0,0.35), var(--glow-accent);
  filter: brightness(1.08);
  z-index: 3;
}
.canvas-item.selected {
  --item-ring-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.6), var(--glow-accent), 0 2px 12px rgba(0,0,0,0.35);
  z-index: 2;
}
/* Hover on a room detail drawer table row highlights its canvas icon.
   Needs to win over .canvas-item.selected -- every icon in the open room
   already carries that class (see the drawer's multi-select focus), and
   its two-class selector otherwise beats a single .canvas-item--row-hover
   class on specificity regardless of source order. */
.canvas-item.canvas-item--row-hover {
  --item-ring-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251,191,36,0.7), 0 2px 12px rgba(0,0,0,0.35);
  z-index: 3;
}
/* .selected/.canvas-item--row-hover above also draw a box-shadow -- always
   rectangular, since box-shadow can't be clipped to the hex polygon --
   around the item's actual (square) box, showing as a stray square line
   boxing in the hexagon outline (reported 2026-09-17). The hex's own SVG
   stroke already reflects selection via --item-ring-color (no glow added
   here to match it -- the circle/square shapes read as crisp lines too,
   a drop-shadow glow on the thin stroke read as noticeably more "feathered"
   than their box-shadow does around a solid border, reported 2026-09-17). */
.canvas-item--mount-desktop.selected,
.canvas-item--mount-desktop.canvas-item--row-hover {
  box-shadow: none;
}
/* One fixed size for every mount shape -- deliberately NOT a per-shape
   percentage anymore. That earlier approach picked the largest size that
   still stayed inside each shape's own geometry (circle: 100/sqrt(2) =~
   70.7% of the box; hexagon, tightest of the three because of its slanted
   edges near the corners: ~63%; square: unconstrained, its border is the box
   edge), which meant the icon artwork itself visibly shrank and grew as you
   switched a placed item's elevation between wall/ceiling/desktop (reported
   2026-09-17) -- jarring since nothing about the icon actually changed, only
   its mount point. Using the hexagon's tighter threshold as the one shared
   size instead keeps the artwork pixel-identical across every elevation; the
   tradeoff is the square and circle borders now sit with more visible
   breathing room around it than they would at their own individual max, but
   that's a fixed, consistent margin rather than a size that jumps around.
   Still a few points under the hexagon's ~63% ceiling for safety margin. */
.canvas-item img { grid-row: 1; grid-column: 1; width: 60%; height: 60%; object-fit: contain; pointer-events: none; display: block;
  /* Muted grey backing plate with a soft, feathered edge so white/light devices stay visible on
     white floorplans without a heavy block. The blurred spread widens the plate without shrinking
     the image or moving its drawn edge. The plate's shape follows the mount position (below). */
  background: rgba(130, 138, 150, 0.45); border-radius: 8px; box-shadow: 0 0 12px 4px rgba(130, 138, 150, 0.45); }
/* Plate shape matches the mount-position shape: circle = Ceiling, square = Wall, rounded
   hexagon-ish = Desktop (a true hexagon clip would cut the feather off). */
.canvas-item--mount-ceiling img { border-radius: 50%; box-shadow: 0 0 12px 6px rgba(130, 138, 150, 0.45); }
.canvas-item--mount-wall img { border-radius: 3px; }
.canvas-item--mount-desktop img { border-radius: 28%; }
.canvas-item.icons-locked { cursor: pointer; }
/* Stamp view: just the picture -- no mount-position border, grey plate, name label or selection
   outline (the selection bar shows what is selected). The row-hover highlight from the room
   details table glows around the stamp's own shape instead of a box. */
.canvas-item--stamp-view { border-radius: var(--r-sm); border-color: transparent; }
.canvas-item--stamp-view img { background: none; box-shadow: none; border-radius: 0; }
.canvas-item--stamp-view.selected,
.canvas-item--stamp-view.canvas-item--row-hover { box-shadow: none; }
.canvas-item--stamp-view.canvas-item--row-hover img {
  filter: drop-shadow(0 0 2px #fbbf24) drop-shadow(0 0 5px #fbbf24) drop-shadow(0 0 9px rgba(251, 191, 36, 0.8));
}
/* Selected stamp: a glow hugging the picture's own shape (no box), so a multi-selection reads clearly. */
.canvas-item--stamp-view.selected img {
  filter: drop-shadow(0 0 1.5px var(--accent)) drop-shadow(0 0 3px var(--accent)) drop-shadow(0 0 7px var(--accent));
}
.canvas-item--stamp-view.selected.canvas-item--row-hover img {
  filter: drop-shadow(0 0 2px #fbbf24) drop-shadow(0 0 5px #fbbf24) drop-shadow(0 0 9px rgba(251, 191, 36, 0.8));
}
.canvas-item.icons-locked:hover { --item-ring-color: var(--accent); }
/* Already assigned to a room — muted and not selectable */
.canvas-item.room-assigned { opacity: 0.4; cursor: not-allowed; }
.canvas-item.room-assigned:hover { --item-ring-color: transparent; box-shadow: none; }
.canvas-item.room-assigned.selected { opacity: 1; cursor: not-allowed; z-index: 2; }
/* Model label under a placed device. Anchored at the element's centre and
   counter-rotated by --item-rot (set in _applyItemTransform) so it stays
   upright and straight below the icon however the device is rotated. */
.canvas-item-model {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 0 0;
  transform: rotate(calc(-1 * var(--item-rot, 0deg))) translate(-50%, 22px);
  max-width: 140px;
  padding: 1px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-pill);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 1;
}
.canvas-item-label {
  display: none; /* labels hidden on canvas */
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  font-size: 0.65rem;
  text-align: center;
  color: var(--text);
  background: var(--panel-strong);
  border-radius: var(--r-pill);
  padding: 1px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Canvas selection HUD ───────────────────────────────────────────────── */
.canvas-selection-hud {
  position: absolute;
  pointer-events: none;
  z-index: 60;
}

/* Shared button base for rotate + delete */
.canvas-rotate-handle,
.canvas-delete-btn {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  pointer-events: all;
  padding: 0;
  /* High-contrast dark pill that reads on white PDF backgrounds */
  background: rgba(18, 18, 24, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.55), 0 0 0 1.5px rgba(255,255,255,0.12);
  transition: transform var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}

.canvas-rotate-handle {
  top: -44px;
  left: 50%;
  transform: translateX(-50%);
  cursor: grab;
  border: 1.5px solid rgba(100, 180, 255, 0.75);
  color: #82c8ff;
}
.canvas-rotate-handle:hover {
  background: rgba(63, 185, 232, 0.92);
  color: #fff;
  border-color: #82c8ff;
  box-shadow: 0 3px 12px rgba(63, 185, 232,0.55), 0 0 0 1.5px rgba(255,255,255,0.18);
  transform: translateX(-50%) scale(1.12);
}
.canvas-rotate-handle:active { cursor: grabbing; }

.canvas-delete-btn {
  top: -44px;
  right: -18px;
  cursor: pointer;
  border: 1.5px solid rgba(255, 90, 90, 0.65);
  color: #ff8080;
}
.canvas-delete-btn:hover {
  background: rgba(200, 30, 30, 0.92);
  color: #fff;
  border-color: #ff6060;
  box-shadow: 0 3px 12px rgba(200,30,30,0.5), 0 0 0 1.5px rgba(255,255,255,0.18);
  transform: scale(1.12);
}

.canvas-position-options {
  position: absolute;
  top: 50%;
  left: 100%;
  margin-left: 14px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: all;
}
.canvas-position-btn {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1.5px solid rgba(130, 200, 255, 0.5);
  background: rgba(18, 18, 24, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #cfe9ff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.55), 0 0 0 1.5px rgba(255,255,255,0.12);
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.canvas-position-btn:hover {
  border-color: #82c8ff;
  transform: scale(1.06);
}
.canvas-position-btn.active {
  background: rgba(63, 185, 232, 0.92);
  color: #fff;
  border-color: #82c8ff;
  box-shadow: 0 3px 12px rgba(63, 185, 232,0.55), 0 0 0 1.5px rgba(255,255,255,0.18);
}

/* Connector stem from top of item to rotation handle */
.canvas-selection-hud::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -12px;
  width: 2px;
  height: 12px;
  background: rgba(100, 180, 255, 0.55);
  transform: translateX(-50%);
}

/* Room Detail snippet HUD -- same rotate/delete/position controls as the
   main canvas, scaled down and appended to .room-detail-snapshot-stage
   instead of the canvasViewport. No connector stem (would point the wrong
   way once flipped) and each control flips to the opposite edge when the
   default placement would spill outside the snippet. */
.room-detail-selection-hud::before { display: none; }
.room-detail-selection-hud .canvas-rotate-handle,
.room-detail-selection-hud .canvas-delete-btn { width: 24px; height: 24px; }
.room-detail-selection-hud .canvas-rotate-handle { top: -30px; }
.room-detail-selection-hud .canvas-delete-btn { top: -30px; right: -12px; }
.room-detail-selection-hud.hud-flip-down .canvas-rotate-handle { top: auto; bottom: -30px; }
.room-detail-selection-hud.hud-flip-down .canvas-delete-btn { top: auto; bottom: -30px; }
.room-detail-selection-hud .canvas-position-options { margin-left: 10px; }
.room-detail-selection-hud.hud-flip-left .canvas-position-options {
  left: auto; right: 100%; margin-left: 0; margin-right: 10px;
}
.room-detail-selection-hud .canvas-position-btn { font-size: 0.6rem; padding: 3px 7px; }

/* Snap alignment guides */
.snap-guide {
  position: absolute;
  pointer-events: none;
  z-index: 8;
}
.snap-guide--v {
  width: 1.5px;
  background: rgba(61, 150, 255, 0.85);
  box-shadow: 0 0 4px rgba(61, 150, 255, 0.5);
}
.snap-guide--h {
  height: 1.5px;
  background: rgba(61, 150, 255, 0.85);
  box-shadow: 0 0 4px rgba(61, 150, 255, 0.5);
}

/* Marquee rubber-band selection rectangle */
.canvas-marquee {
  position: absolute;
  border: 2px dashed rgba(63, 185, 232, 0.9);
  background: rgba(63, 185, 232, 0.08);
  border-radius: 2px;
  pointer-events: none;
  z-index: 9;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

/* ── Canvas toolbar ─────────────────────────────────────────────────────── */
.canvas-toolbar {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--panel-highlight);
  color: var(--text);
  font-size: 0.83rem;
  z-index: 2;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--panel-border);
  margin: 0 4px;
  flex-shrink: 0;
}

.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-control { display: flex; align-items: center; gap: 5px; }
.toolbar-control input[type="range"] { width: 90px; margin-top: 0; }

.canvas-toolbar button { min-height: 28px; padding: 4px 8px; font-size: 0.8rem; }
/* +/- icon-scale stepper, flanking the slider for quick 10%-nudge adjustments
   without dragging — same buttons also serve as the mobile toolbar's whole
   icon-scale control, since the slider is hidden there (see mobile media
   query below). */
.icon-scale-step-btn { min-width: 28px; padding: 4px 5px; }
/* Only relevant to the mobile collapsed/expandable toolbar -- see the
   mobile media query below. Desktop always shows every control. */
.toolbar-expand-toggle { display: none; }
.mobile-rooms-list { display: none; }
/* Mobile-only gallery-style page nav (edge arrows + badge) -- desktop keeps
   the ← → arrows in the toolbar pill. Shown by the mobile media query. */
.canvas-page-arrow,
.canvas-page-badge { display: none; }
.button--narrow { min-width: 28px; padding: 4px 6px; }
.button--icon { min-width: 28px; padding: 4px 6px; font-size: 0.9rem; }
.button--zoom { min-width: 28px; min-height: 28px; padding: 4px 5px; font-size: 0.95rem; }

.toolbar-group--pages { gap: 6px; }
.toolbar-group--zoom { align-items: center; gap: 4px; }
.toolbar-group--icon-scale { gap: 6px; align-items: center; }
.toolbar-group--icon-scale input[type="range"] {
  width: 140px; margin: 0;
  height: 4px; cursor: pointer;
  accent-color: var(--accent);
}
.zoom-label {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  white-space: nowrap;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.toolbar-group--zoom label { margin: 0; display: inline-flex; align-items: center; font-weight: 500; white-space: nowrap; }
.toolbar-group--pages span,
.toolbar-group--zoom span,
.toolbar-group--icon-scale span {
  min-width: 36px;
  text-align: center;
  font-weight: 600;
  color: var(--text);
}

.canvas-status {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  white-space: nowrap;
}

/* ── PDF upload zone ─────────────────────────────────────────────────────── */
.pdf-zone {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── PDF preview ────────────────────────────────────────────────────────── */
.pdf-preview {
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  padding: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.pdf-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}
.pdf-preview-header span { color: var(--text-muted); font-size: 0.9rem; }
.pdf-reupload-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 0;
  height: auto;
  transition: color var(--t-fast), border-color var(--t-fast);
  box-shadow: none;
}
.pdf-reupload-btn svg { width: 12px; height: 12px; }
.pdf-reupload-btn:hover { color: var(--accent-text); border-color: var(--accent-ring); background: transparent; box-shadow: none; transform: none; }
.pdf-preview-body { display: grid; gap: 10px; }

.pdf-page-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.pdf-page-thumb {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 4px;
  padding: 5px 5px 4px;
  border: 1px solid var(--panel-border);
  background: var(--panel-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: center;
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.pdf-page-thumb:hover { border-color: var(--accent-ring); }
.pdf-page-thumb.active {
  background: var(--accent-grad);
  color: var(--on-accent);
  border-color: transparent;
  box-shadow: var(--glow-accent);
}
.pdf-page-thumb.active .pdf-page-thumb-label { color: var(--on-accent); }

.pdf-page-thumb-canvas {
  width: 100%;
  flex: 1;
  object-fit: contain;
  border-radius: var(--r-xs);
  background: var(--panel-strong);
  display: block;
}
.pdf-page-thumb-label { font-size: 0.65rem; font-weight: 600; color: var(--text); line-height: 1.2; padding: 0 2px 1px; }

.pdf-page-more { color: var(--text-muted); font-size: 0.85rem; padding: 8px; text-align: center; }


/* ── Theme toggle ───────────────────────────────────────────────────────── */
#themeToggleContainer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-pill);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
  box-shadow: inset 0 1px 0 var(--panel-highlight);
  cursor: pointer;
  font-size: 1.1rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
#themeToggleContainer:hover { border-color: var(--accent-ring); box-shadow: var(--glow-accent); }
#themeToggleContainer:active { transform: scale(0.95); }
.toggle-icon { line-height: 1; }

/* ── User profile / dropdown ────────────────────────────────────────────── */
.user-profile {
  display: flex;
  align-items: center;
}
/* The avatar sits inside a slightly larger wrap so the save ring (below) has
   room to circle it without overlapping the photo itself. */
.user-avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-avatar img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: block; }
.user-avatar svg { display: block; }

/* Cloud-save status, shown on the avatar itself instead of a separate
   standalone icon (2026-09-17) -- see _showSaveRing()/_flashSaveIndicator()
   in app.js. Idle: both layers invisible, plain avatar. Saving: the ring
   fades in and spins (an indeterminate arc, since there's no real byte-level
   progress to report). Saved: the ring closes into a solid circle and the
   save icon crossfades over the photo, both held briefly, then fade back to
   idle -- .user-avatar-wrap--saved's removal handles the fade-out via the
   same opacity transitions used to fade it in. */
.save-ring {
  position: absolute;
  inset: 0;
  width: 36px;
  height: 36px;
  opacity: 0;
  transition: opacity var(--t-fast);
  pointer-events: none;
}
.save-ring-track {
  fill: none;
  stroke: color-mix(in srgb, var(--success, #22c55e) 25%, transparent);
  stroke-width: 2.5;
}
.save-ring-progress {
  fill: none;
  stroke: var(--success, #22c55e);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 28 72;
  transform-origin: 18px 18px;
  transition: stroke-dasharray 0.3s ease;
}
.user-avatar-wrap--saving .save-ring,
.user-avatar-wrap--saved .save-ring {
  opacity: 1;
}
.user-avatar-wrap--saving .save-ring-progress {
  animation: saveRingSpin 0.9s linear infinite;
}
.user-avatar-wrap--saved .save-ring-progress {
  stroke-dasharray: 100.5 0;
  animation: none;
}
@keyframes saveRingSpin {
  to { transform: rotate(360deg); }
}
.save-icon-overlay {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.6);
  color: #fff;
  opacity: 0;
  transition: opacity var(--t-fast);
  pointer-events: none;
}
.user-avatar-wrap--saved .save-icon-overlay { opacity: 1; }

/* Live viewers of the open project — overlapping circle stack, immediately
   left of the Icons tab. Empty/hidden when nobody else (or nobody) is viewing. */
.presence-avatars { display: flex; align-items: center; }
.presence-avatars.hidden { display: none; }
.presence-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--panel, #fff);
  margin-left: -8px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.presence-avatars .presence-avatar:first-child { margin-left: 0; }
.presence-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.presence-avatar svg { display: block; }

#userName { font-size: 0.9rem; font-weight: 600; color: var(--text); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-item-icon { width: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-muted); }

.profile-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--t-fast);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
}
.profile-dropdown-trigger:hover { background: var(--accent-soft); }

.profile-dropdown-menu {
  position: fixed;
  width: 220px;
  background: var(--panel-strong);
  backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 99999;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.profile-dropdown-menu.show { display: flex; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-xs);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background var(--t-fast);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  width: 100%;
  cursor: pointer;
}
.dropdown-item:hover { background: var(--accent-soft); }
.dropdown-divider { height: 1px; background: var(--panel-border); margin: 4px 0; }
.dropdown-item--logout { color: var(--danger); border: 1px solid var(--danger-soft); margin-top: 4px; }
.dropdown-item--logout:hover { background: var(--danger-soft); }

/* ── Auth screen ────────────────────────────────────────────────────────── */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  background: var(--bg-0);
  overflow-y: auto;
}
.auth-screen.hidden { display: none; }

/* Same flat bar + blue strip as the app's top bar, with the same wordmark. */
.auth-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 20px;
  background: var(--topbar-bg);
  border-bottom: 3px solid var(--accent);
}
.auth-wordmark { color: #ffffff; font-weight: 700; font-size: 1.08rem; letter-spacing: 0.2px; white-space: nowrap; }
.auth-wordmark span { color: var(--accent); }

.auth-main { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }

.auth-container {
  position: relative;
  width: min(400px, 100%);
  padding: 30px 30px 24px;
  border: 1px solid var(--panel-border);
  border-top: 3px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--panel-strong);
  box-shadow: var(--shadow-sm);
}

.auth-brandrow { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-logo { height: 40px; width: auto; display: block; }
.auth-logo--dark { display: none; }
body.dark .auth-logo--light { display: none; }
body.dark .auth-logo--dark { display: block; }
body.dark .auth-logo-sim.auth-logo--dark { display: inline-block; }
.auth-footer { display: flex; justify-content: center; align-items: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--panel-border); }
.auth-logo-sim { height: 20px; width: auto; }
.auth-logo-sim.auth-logo--dark { display: none; }

.auth-container h1 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--text);
}

.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--accent-grad);
  color: var(--on-accent);
  box-shadow: var(--glow-accent);
  transition: transform var(--t-fast), box-shadow var(--t), filter var(--t-fast);
}
.auth-button:hover { transform: translateY(-1px); box-shadow: var(--glow-accent-hover); filter: brightness(1.05); }
.auth-button:active { transform: translateY(0) scale(0.98); }
.auth-icon { flex-shrink: 0; background: #fff; border-radius: 6px; padding: 2px; }

.auth-sso-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.auth-sso-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-sm);
  background: #fff;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t), filter var(--t-fast);
}
.auth-sso-icon-button:not(:disabled):hover { transform: translateY(-1px); box-shadow: var(--glow-accent-hover); }
.auth-sso-icon-button:not(:disabled):active { transform: translateY(0) scale(0.98); }
.auth-sso-icon-button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.45;
}
.auth-sso-icon-button svg { flex-shrink: 0; }

/* Full-width labeled variant -- used for Microsoft, the one SSO provider
   actually wired up (Azure/Entra ID), so it reads as a real sign-in action
   rather than an icon-only placeholder next to Google's "coming soon" square. */
.auth-sso-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid #8c8c8c;
  border-radius: 4px;
  background: #fff;
  color: #1f2937;
  font-weight: 600;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t), filter var(--t-fast);
}
.auth-sso-button:not(:disabled):hover { transform: translateY(-1px); box-shadow: var(--glow-accent-hover); }
.auth-sso-button:not(:disabled):active { transform: translateY(0) scale(0.98); }
.auth-sso-button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.45;
}
.auth-sso-button svg { flex-shrink: 0; }
.auth-sso-button.is-busy { cursor: progress; opacity: 0.8; }
.auth-sso-error { margin: 0 0 14px; padding: 10px 12px; border-left: 3px solid var(--danger, #dc2626); background: var(--danger-soft, rgba(220,38,38,.1)); color: var(--danger, #dc2626); font-size: 0.85rem; border-radius: 4px; }

/* Hidden by default -- only the Azure/Entra ID backend's SSO is actually
   gated to the Laerdal tenant, so this only shows there (see .backend-azure
   override below), not alongside the mock backend's disabled placeholder
   Microsoft button. */
.auth-org-badge {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
}
.auth-org-badge svg { flex-shrink: 0; }

.auth-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 11px 13px;
  border: 1px solid #fcd34d;
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  background: #fef3c7;
  color: #78350f;
  font-size: 0.78rem;
  line-height: 1.4;
}
body.dark .auth-disclaimer { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); border-left-color: #f59e0b; color: #fcd34d; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--panel-border); }

/* Azure backend is Entra ID (Microsoft) only — no email/password or Google
   sign-in, so hide the parts of this shared auth markup that don't apply.
   The backend-azure class is set synchronously in <head> (see index.html),
   before this markup is parsed, specifically to avoid a flash of the email
   field on load — hiding it only via azure-compat.js's runtime JS wasn't
   early enough to prevent that. */
.backend-azure .auth-email-gate,
.backend-azure .divider,
.backend-azure #googleSignInBtn {
  display: none;
}
.backend-azure .auth-org-badge {
  display: flex;
}

.auth-helper-text { margin: 16px 0 0; color: var(--text-faint); font-size: 0.8rem; text-align: center; }

.auth-panel { display: flex; flex-direction: column; }
.auth-panel.hidden { display: none; }

.auth-panel form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-email-gate { position: relative; margin-bottom: 18px; }

.auth-panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.auth-panel input, .auth-email-gate input {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  outline: none;
  font-family: inherit;
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.auth-panel input:focus, .auth-email-gate input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.auth-email-gate input { padding-right: 38px; }

.auth-panel .primary-button { width: 100%; margin-top: 4px; }

.auth-field-error {
  font-size: 0.82rem;
  color: var(--danger);
  min-height: 16px;
  margin: -6px 0 0;
}

/* ── Email verification panel ───────────────────────────────────────────── */
.auth-verify-intro {
  font-size: 0.9rem;
  color: var(--text-secondary, inherit);
  margin: 0 0 14px;
  line-height: 1.45;
}
#verifyCodeInput {
  letter-spacing: 10px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
}
.auth-verify-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
}
.link-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  color: var(--accent);
}
.link-button:hover { text-decoration: underline; }
.link-button:disabled { opacity: 0.5; cursor: default; text-decoration: none; }

/* ── Domain indicator — small icon anchored to the email field's right edge ── */
.signup-domain-indicator {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.signup-domain-indicator:empty { display: none; }

.signup-domain-indicator svg { flex-shrink: 0; }

.signup-domain-indicator--personal { color: #d97706; }
body.dark .signup-domain-indicator--personal { color: #fbbf24; }

.signup-domain-indicator--checking { color: var(--text-faint); }

.signup-domain-indicator--org-found { color: #16a34a; }
body.dark .signup-domain-indicator--org-found { color: #4ade80; }

.signup-domain-indicator--org-new { color: var(--accent); }

@keyframes spin { to { transform: rotate(360deg); } }
.signup-domain-indicator .spin { animation: spin 0.8s linear infinite; }

/* ── Account link prompt (sign-up panel) ────────────────────────────────── */
.auth-link-prompt {
  display: flex;
  gap: 12px;
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.25);
  border-radius: var(--r-md);
  padding: 14px;
  margin-top: 12px;
  animation: fadeIn 0.2s var(--ease-out);
}

.auth-link-prompt.hidden { display: none; }

.auth-link-prompt-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(234, 179, 8, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ca8a04;
}
body.dark .auth-link-prompt-icon { color: #fbbf24; }

.auth-link-prompt-body { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }

.auth-link-prompt-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.auth-link-prompt-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.auth-link-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.auth-button--link { min-height: 44px; font-size: 0.875rem; }

/* ── Registration modal — org status badges ─────────────────────────────── */
.reg-org-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
}

.reg-org-status svg { flex-shrink: 0; margin-top: 1px; }

.reg-org-status--joining {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.22);
  color: var(--text);
}
body.dark .reg-org-status--joining { color: #86efac; }

.reg-org-status--creating {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--text-muted);
}

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 7, 13, 0.6);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  z-index: 999;
}
.modal.hidden { display: none !important; }

.modal-content {
  position: relative;
  width: min(960px, 100%);
  padding: 30px 26px 26px;
  max-height: 97vh;
  overflow-y: auto;
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-xl);
  background: var(--panel-strong);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  box-shadow: var(--shadow), inset 0 1px 0 var(--panel-highlight);
}
.modal-content h3 { margin: 0 0 6px; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.modal-content > p { color: var(--text-muted); margin: 0 0 18px; font-size: 0.9rem; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  border-radius: var(--r-pill);
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.modal-close:hover { border-color: var(--accent-ring); background: var(--accent-soft); color: var(--accent-text); }
.modal-close:active { transform: scale(0.95); }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-actions .primary-button, .modal-actions .secondary-button { width: auto; }

/* ── Utility ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive (small screens) ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .app-shell {
    padding:
      max(10px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }
  .page-header { gap: 8px; margin-bottom: 12px; }
  .page-header h2 { font-size: 1.35rem; }
  .card { padding: 14px; }
  .icon-list { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .page-header .primary-button,
  .primary-button,
  .secondary-button { width: 100%; }
  .modal-actions .primary-button, .modal-actions .secondary-button,
  .room-controls .primary-button, .logout-btn { width: auto; }
}

/* ── Debug Console ──────────────────────────────────────────────────── */
.dropdown-item--debug { color: var(--accent); }

.debug-section { margin-bottom: 20px; }
.debug-section-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.debug-count { font-size: 0.8rem; font-weight: 400; color: var(--text-muted); }

.debug-list { display: flex; flex-direction: column; gap: 8px; }

.debug-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--panel); border: 1px solid var(--panel-border);
}
.debug-row-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.debug-row-name--mono { font-family: monospace; font-size: 0.82rem; }
.debug-row-meta { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Icon group dropdowns in admin console */
.debug-icon-group {
  border: 1px solid var(--panel-border);
  border-radius: var(--r-sm);
  background: var(--panel-2);
  overflow: hidden;
  margin-bottom: 8px;
}
.debug-icon-group-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: 0.82rem; font-weight: 600;
  transition: background 0.15s;
}
.debug-icon-group-summary::-webkit-details-marker { display: none; }
.debug-icon-group-summary::before {
  content: '▶';
  font-size: 0.65rem;
  margin-right: 8px;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.debug-icon-group[open] > .debug-icon-group-summary::before { transform: rotate(90deg); }
.debug-icon-group-summary:hover { background: var(--panel-hover, rgba(255,255,255,0.04)); }
.debug-icon-group-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: 0.88rem; letter-spacing: 0.01em; }
.debug-icon-group-count {
  flex-shrink: 0; margin-left: 8px;
  font-size: 0.72rem; font-weight: 500;
  color: var(--text-muted);
  background: var(--panel-3, rgba(255,255,255,0.06));
  border-radius: 999px;
  padding: 1px 8px;
}
.debug-icon-group .debug-icon-grid {
  padding: 12px;
  margin-top: 0;
  border-top: 1px solid var(--panel-border);
}

/* Icon grid in admin console */
.debug-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.debug-icon-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 8px 8px;
  border: 1px solid var(--panel-border); border-radius: var(--r-sm);
  background: var(--panel-2); cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: center; position: relative;
}
.debug-icon-card:hover { border-color: var(--accent-ring); box-shadow: var(--glow-accent); }

.debug-icon-card-img { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }
.debug-icon-card-img img { width: 100%; height: 100%; object-fit: contain; }
.debug-icon-placeholder { font-size: 1.5rem; color: var(--text-muted); }

.debug-icon-card-name {
  font-size: 0.72rem; font-weight: 600; width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.debug-icon-card-owner {
  font-size: 0.65rem; color: var(--text-muted); width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.debug-icon-card-actions { display: flex; gap: 4px; margin-top: 2px; }

.debug-copy-btn {
  padding: 3px 8px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--accent); color: var(--accent);
  font-size: 0.9rem; font-weight: 700; line-height: 1; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.debug-copy-btn:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); }
.debug-copy-btn:disabled { opacity: 0.6; cursor: default; }

.debug-delete-btn {
  padding: 3px 8px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--danger); color: var(--danger);
  font-size: 0.8rem; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.debug-delete-btn:hover { background: var(--danger); color: #fff; }

.debug-edit-btn {
  padding: 3px 8px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--accent); color: var(--accent);
  font-size: 0.8rem; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.debug-edit-btn:hover { background: var(--accent); color: var(--on-accent); }

.debug-audit-btn {
  padding: 3px 8px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--panel-border); color: var(--text-muted);
  font-size: 0.8rem; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.debug-audit-btn:hover { background: var(--panel-border); color: var(--text); }

.debug-row-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* Icon manager debug delete overlay */
.library-item { position: relative; }
.icon-debug-delete-btn {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--danger); color: #fff; border: none;
  font-size: 0.6rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
  z-index: 2;
}
.library-item:hover .icon-debug-delete-btn { opacity: 1; }

/* Room photo debug delete (single photo in room detail) */
.room-photo-debug-delete {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--danger); color: #fff; border: none;
  font-size: 0.65rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s; z-index: 3;
}
.room-photo-cell:hover .room-photo-debug-delete { opacity: 1; }

/* ── Debug ID badges — always in DOM for admin, revealed on hover in debug mode ── */
.debug-id-block {
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.55);
  border-radius: var(--r-sm);
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.68rem;
  color: #a3e635;
  display: flex;
  flex-direction: column;
  gap: 2px;
  word-break: break-all;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.15s ease, max-height 0.2s ease;
  pointer-events: none;
}
body.admin-mode .project-card:hover .debug-id-block,
body.admin-mode .debug-row:hover .debug-id-block,
body.admin-mode .debug-icon-card:hover .debug-id-block,
body.admin-mode .debug-storage-img-card:hover .debug-id-block {
  opacity: 1;
  max-height: 400px;
  pointer-events: auto;
}
/* Project cards: take the debug overlay fully out of flex flow so its own
   margin (not clipped by its own overflow:hidden) can never inflate card
   height — it floats below the card on hover instead of living inline. */
.project-card .debug-id-block {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 6px;
  z-index: 20;
}
.debug-id-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.debug-id-label { color: #94a3b8; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.debug-id-value { color: #a3e635; flex: 1; }
.debug-id-count { color: #60a5fa; font-size: 0.62rem; flex-shrink: 0; }

/* Canvas icon ID badge */
.debug-canvas-id {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.78);
  color: #a3e635;
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.58rem;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.15s ease;
}
body.admin-mode .canvas-item:hover .debug-canvas-id { opacity: 1; }

/* Photo ID badge */
.debug-photo-id {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.72);
  color: #a3e635;
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.58rem;
  padding: 2px 4px;
  word-break: break-all;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s ease;
}
body.admin-mode .room-photo-cell:hover .debug-photo-id { opacity: 1; }

/* Report page debug photo delete */
.report-photo-debug-wrap { position: relative; display: inline-block; }
.report-photo-debug-del {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--danger); color: #fff; border: none;
  font-size: 0.6rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s; z-index: 3;
}
.report-photo-debug-wrap:hover .report-photo-debug-del { opacity: 1; }

/* Org project card — clickable */
.org-project-card { transition: background 0.15s, box-shadow 0.15s; }
.org-project-card:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.org-project-card.active-org-project {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  box-shadow: 0 0 0 1.5px var(--accent);
}
.org-project-card.loading { opacity: 0.6; }

.org-project-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.org-project-name-row strong { flex: 1; min-width: 0; }

.org-project-error {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, #ef4444 15%, var(--panel));
  border: 1px solid color-mix(in srgb, #ef4444 40%, transparent);
  color: #fca5a5;
  font-size: 0.82rem;
}

/* Icon lock toggle button */
.icon-lock-btn {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  border: 1px solid var(--border); font-size: 0.65rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s; z-index: 3;
  padding: 0;
}
.library-item:hover .icon-lock-btn { opacity: 1; }
.library-item .icon-lock-btn[title*="Unlock"] { opacity: 0.8; }

/* Locked icon: muted appearance */
.library-item--locked .icon-select { opacity: 0.45; filter: grayscale(0.6); }
.library-item--locked .icon-name { color: var(--text-muted); }

/* Favorite star — bottom-right corner (lock/debug-delete occupy the top
   corners), always visible once favorited so the pinned state reads at a
   glance without hovering. */
.icon-favorite-btn {
  position: absolute; bottom: 3px; right: 3px;
  width: 16px; height: 16px;
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s, color 0.15s; z-index: 3;
  padding: 0; color: var(--text-muted);
}
.icon-favorite-btn svg { width: 11px; height: 11px; }
.library-item:hover .icon-favorite-btn,
.icon-favorite-btn.is-favorite { opacity: 1; }
.icon-favorite-btn.is-favorite { color: #f5c518; }

.package-count-badge {
  position: absolute; top: 2px; left: 2px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 0.6rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.library-item--package .icon-select { border: 2px solid var(--accent); }

/* ── New Package modal ───────────────────────────────────────────────── */
.new-package-modal-card { max-width: 640px; }
.new-package-form { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px; }
.new-package-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--text-muted); }
.new-package-form input[type="text"], .new-package-form textarea {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  font: inherit; font-size: 0.9rem; padding: 8px 10px; resize: vertical;
}
.new-package-form input[type="text"]:focus, .new-package-form textarea:focus { outline: none; border-color: var(--accent); }
.new-package-icons-label { font-size: 0.82rem; color: var(--text-muted); }

.new-package-dnd-columns {
  display: flex; height: 300px;
  border: 1px solid var(--panel-border); border-radius: var(--r-sm); overflow: hidden;
}
.new-package-col { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel-2); }
.new-package-col-divider { width: 1px; background: var(--panel-border); flex-shrink: 0; }
.new-package-col-label {
  font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em;
  padding: 8px 12px; border-bottom: 1px solid var(--panel-border); flex-shrink: 0;
}
.new-package-list { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.new-package-list.drag-over { background: var(--panel); box-shadow: inset 0 0 0 2px var(--accent); }
.new-package-icons-empty { color: var(--text-muted); font-size: 0.8rem; padding: 12px; text-align: center; }

.package-dnd-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: var(--r-xs); cursor: grab; font-size: 0.85rem;
}
.package-dnd-row:hover { background: var(--panel); }
.package-dnd-row.dragging { opacity: 0.4; cursor: grabbing; }
.package-dnd-row .icon-select { width: 32px; height: 32px; flex-shrink: 0; }
.package-dnd-row .icon-name { font-size: 0.82rem; text-align: left; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.package-qty-stepper {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0; cursor: default;
}
.package-qty-btn {
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--panel);
  color: var(--text); font-size: 0.85rem; line-height: 1; cursor: pointer; padding: 0;
}
.package-qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.package-qty-value { min-width: 16px; text-align: center; font-size: 0.82rem; color: var(--text); }

.debug-empty { color: var(--text-muted); font-size: 0.875rem; padding: 8px 0; }
.debug-empty--error { color: var(--danger); }

.debug-status {
  padding: 8px 12px; border-radius: var(--r-sm); font-size: 0.85rem;
  margin-top: 8px; min-height: 1.2em;
}
.debug-status--ok { background: color-mix(in srgb, var(--success, #22c55e) 15%, transparent); color: var(--success, #22c55e); }
.debug-status--error { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

/* ── Floorplan preload modal ─────────────────────────────────────── */
.floorplan-loading-card {
  max-width: 320px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none; /* non-interactive — dismisses automatically */
}
.floorplan-loading-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
}
.floorplan-loading-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}
.floorplan-loading-track {
  margin-top: 2px;
}

/* ── Export Progress Modal ───────────────────────────────────────────── */
.export-progress-backdrop {
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
}
.export-progress-card {
  max-width: 380px;
  width: 92%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 28px 24px;
  pointer-events: none;
}
.export-progress-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.export-progress-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}
.export-progress-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.export-progress-label {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
  margin: 0;
  min-height: 1.25em;
}
.export-progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--panel);
  overflow: hidden;
}
.export-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-grad);
  transition: width 0.35s cubic-bezier(0.4,0,0.2,1);
}
.export-progress-step {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

/* ── Admin mode (krimsin@gmail.com) — red accent, locked dark ─────── */
body.admin-mode {
  --accent: #ef4444;
  --accent-2: #dc2626;
  --accent-grad: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  --glow-accent: 0 0 18px rgba(239,68,68,0.35);
  --on-accent: #fff;
}

/* ── Room Detail Page ────────────────────────────────────────────────── */

/* Slide-in drawer mode -- opened from the Floorplan page's Rooms panel
   (openRoomDetailDrawer()) so a room's details can be checked alongside the
   main canvas, which is panned/zoomed onto the room instead of being
   covered by a dimming backdrop (see _focusCanvasOnRoom() in app.js) --
   the canvas stays fully visible and interactive underneath the drawer.
   Reuses the exact same #roomDetailPage markup/render path as the full-page
   view (reached via the Rooms grid); this modifier class just repositions
   it. Specificity (id + class) beats the base `main > .page { display:
   none }` rule, so the drawer shows even while roomDetailPage isn't the
   "active-page". */
#roomDetailPage.room-detail-drawer {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(600px, 100vw);
  max-width: 100vw;
  margin: 0;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-0);
  border-left: 1px solid var(--panel-border);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  /* Promotes the drawer to its own GPU compositing layer for the slide
     transition instead of leaving the browser to decide mid-transition --
     without it, mobile Chrome/Safari have been seen partially repainting
     the drawer's own content (table/photos) frame-to-frame during the
     transform animation, visible as a brief flicker that settles once the
     transition ends and the browser falls back to normal paint (reported
     2026-09-24, mobile-only, "settles after opening"). Same family of
     transform-transition compositing issue as the backdrop-filter seam bug
     fixed below (see .room-detail-drawer .room-detail-stats-row etc). */
  will-change: transform;
  backface-visibility: hidden;
}
#roomDetailPage.room-detail-drawer.room-detail-drawer--open {
  transform: translateX(0);
}
#roomDetailPage.room-detail-drawer .room-detail-body {
  flex-direction: column;
  /* .room-detail-body's base rule (see above) sets align-items: flex-start
     for the non-drawer, row-direction layout, where that's the cross axis
     (vertical) and just top-aligns the snapshot next to the info panel.
     In the drawer's column direction, flex-start becomes the cross axis's
     *horizontal* alignment instead, which means .room-detail-info (and
     everything inside it: stats row, device table) shrinks to fit its own
     content's natural width rather than filling the drawer, since nothing
     else in the chain sets an explicit width. That made the whole card
     visibly narrower/differently laid out for rooms with fewer or
     shorter-named devices (reported 2026-09-24, desktop). Force it to
     stretch full width regardless of content. */
  align-items: stretch;
  /* The base rule's flex-wrap: wrap (needed for the non-drawer, row-
     direction layout to drop the info panel below the snapshot on narrow
     screens) has a much more disruptive effect once flex-direction is
     column: wrapping a column-direction flex container creates new
     *columns* side by side, not new rows, and a device table with long
     enough names to need more than the single line's available height
     pushed .room-detail-info onto its own wrapped column sized by content
     instead of stretched to the drawer's width -- the actual mechanism
     behind the "card gets bigger/smaller depending on the room" report,
     confirmed by toggling this in devtools (706px content-fit vs the
     correct 559px stretched-to-container once nowrap is forced). Only one
     item (.room-detail-info) is ever visible in drawer mode anyway (the
     snapshot is display:none, see below), so there's nothing to wrap. */
  flex-wrap: nowrap;
}
/* The focused main canvas plays the "preview" role instead (see
   _focusCanvasOnRoom() in app.js) -- freeing this width for the icon
   table/notes/photos, which is the whole point of the drawer. */
#roomDetailPage.room-detail-drawer .room-detail-snapshot-wrap {
  display: none;
}
.room-detail-drawer-close {
  display: none;
  flex-shrink: 0;
}
#roomDetailPage.room-detail-drawer .room-detail-drawer-close { display: flex; }

.room-detail-body {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* Snapshot */
.room-detail-snapshot-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.room-detail-snapshot-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}
#roomDetailSnapshot {
  border-radius: var(--r-md);
  border: 2px solid var(--accent);
  box-shadow: var(--glow-accent), var(--shadow-sm);
  display: block;
  max-width: 100%;
  background: rgba(30,30,50,0.4);
  cursor: pointer;
}
.room-detail-snapshot-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Info panel */
.room-detail-info {
  flex: 1 1 320px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* Stats row */
.room-detail-stats-row {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  padding: 16px 24px;
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
}
.room-detail-stat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

@media (max-width: 480px) {
  /* One compact row: all four totals side by side, no wrapping. */
  .room-detail-stats-row {
    flex-wrap: nowrap;
    gap: 0;
    padding: 8px 6px;
  }
  .room-detail-stat { flex: 1 1 0; gap: 2px; }
  .room-detail-stat-value { font-size: 1.15rem; }
  .room-detail-stat-label { font-size: 0.55rem; letter-spacing: 0.03em; white-space: nowrap; }
  .room-detail-stat-divider { display: block; height: 24px; }
}
/* "Network Devices" is longer than its neighbours and ran into them on a phone: let the labels wrap onto two lines
   (centred, values kept level at the top) instead of forcing one line. */
@media (max-width: 480px) {
  #roomDetailPage .room-detail-stats-row { align-items: flex-start; }
  #roomDetailPage .room-detail-stat { justify-content: flex-start; }
  #roomDetailPage .room-detail-stat-label { white-space: normal; text-align: center; line-height: 1.2; letter-spacing: 0.04em; }
  #roomDetailPage .room-detail-stat-divider { align-self: center; }
}
.room-detail-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}
.room-detail-stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.room-detail-stat-divider {
  width: 1px;
  height: 40px;
  background: var(--panel-border);
  flex-shrink: 0;
}

/* The drawer slides in via a transform transition on #roomDetailPage (see
   .room-detail-drawer--open); Chromium/WebKit have a known compositing bug
   where backdrop-filter on a descendant of a transitioning-transform
   ancestor leaves a stale filter seam (a diagonal gradient streak) baked
   into the paint after the transition ends. The drawer's own background is
   already fully opaque (--bg-0, see .room-detail-drawer below), so blurring
   it here added nothing visually anyway -- drop the filter in drawer mode
   and use an equally-opaque solid background instead of chasing the seam. */
.room-detail-drawer .room-detail-stats-row,
.room-detail-drawer .room-detail-icon-table-wrap,
.room-detail-drawer .room-notes-textarea {
  background: var(--panel-strong);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Icon table */
.room-detail-icon-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
}
.room-detail-icon-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  /* table-layout:auto (the default) derives every column's width from its
     widest cell content across the WHOLE table, so both the column widths
     and the overall table width shift with whatever devices happen to be
     in a given room -- forcing white-space:nowrap on the headers (tried
     first, 2026-09-24) stopped them wrapping onto a second line, but a
     room with enough columns/content to need more than the drawer's width
     now triggered .room-detail-icon-table-wrap's horizontal scroll, while
     a room with less content instead got stretched (via width:100% below)
     into wider-spaced columns with no scrollbar -- i.e. still visibly
     different layouts room to room, just a different symptom (reported
     2026-09-24 again, screenshots comparing "Control 2" vs "Exam 3").
     table-layout:fixed with explicit widths on every column except Name
     (see below) makes every column's width a constant, independent of
     content entirely -- Name is the only column that varies, and it's
     truncated with an ellipsis (see .room-detail-icon-name) instead of
     growing the table, so the table's overall width is now always exactly
     100% of the wrap, room after room. */
  table-layout: fixed;
}
/* Every column except Name has a fixed width; Name takes whatever is left
   (and truncates with an ellipsis, see .room-detail-icon-name). The table's
   min-width guarantees Name that leftover is never squeezed to nothing --
   Chromium's fixed layout collapses an unsized column to 0 when the table is
   narrower than the sized columns' total (seen on mobile, 2026-09-24).
   Previously all six columns had explicit widths summing to 555px against a
   ~557px drawer, so anything that took 3px from the drawer -- a classic
   (Windows) vertical scrollbar once the room's table/photos made the drawer
   scroll, a larger default font -- pushed the table into horizontal scroll
   (reported 2026-10-02). The fixed columns now total 314px (Dante moved under the name); Name gets the
   rest of the drawer (~150px+ on desktop, vs a hard 105px before). */
.room-detail-icon-table { min-width: 370px; }
.room-detail-icon-table th:nth-child(1), .room-detail-icon-table td:nth-child(1) { width: 52px; }
.room-detail-icon-table th:nth-child(3), .room-detail-icon-table td:nth-child(3) { width: 118px; }
.room-detail-icon-table th:nth-child(4), .room-detail-icon-table td:nth-child(4) { width: 80px; }
.room-detail-icon-table th:nth-child(5), .room-detail-icon-table td:nth-child(5) { width: 84px; }
.room-detail-icon-table th:not(:nth-child(2)), .room-detail-icon-table td:not(:nth-child(2)) {
  padding-left: 6px !important; padding-right: 6px !important;
}
.room-detail-icon-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--panel-border);
  white-space: nowrap;
}
.room-detail-icon-table thead th:not(:first-child):not(:nth-child(2)) {
  text-align: center;
}
.room-detail-icon-table tbody tr {
  border-bottom: 1px solid var(--panel-border);
  transition: background 0.1s;
}
.room-detail-icon-table tbody tr:last-child { border-bottom: none; }
.room-detail-icon-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.room-detail-icon-table tbody tr.room-detail-row--hover { background: rgba(251,191,36,0.12); }
.room-detail-icon-table td {
  padding: 10px 14px;
  color: var(--text);
  vertical-align: middle;
}
.room-detail-icon-thumb {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  border-radius: var(--r-xs);
}
.room-detail-icon-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0; /* table-layout:fixed cells: forces this to respect the
                   column's fixed width as a hard cap instead of growing
                   to fit the text, so an overlong device name truncates
                   with an ellipsis instead of widening the table. */
}
.room-detail-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-detail-cell-dante {
  text-align: center;
}
/* Dante shows as a small logo under the device name (no Dante column). */
.room-detail-dante-inline {
  display: block;
  height: 10px;
  width: auto;
  margin-top: 3px;
  filter: brightness(0) saturate(100%) invert(85%) sepia(80%) saturate(600%) hue-rotate(5deg) brightness(1.05);
}
/* PoE / PoE+ / AC / Dante pill tags under a device name. */
.rd-pill { display: inline-flex; align-items: center; gap: 3px; height: 16px; padding: 0 7px; border-radius: 999px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.04em; line-height: 1; border: 1px solid transparent; white-space: nowrap; }
.rd-pill svg { width: 11px; height: 11px; display: block; color: currentColor; --ac-wave: #fff; }
.rd-pill--poe { background: rgba(63,185,232,.16); border-color: rgba(63,185,232,.5); color: #0e5073; }
.rd-pill--poeplus { background: rgba(99,102,241,.16); border-color: rgba(99,102,241,.5); color: #4338ca; }
.rd-pill--ac { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.55); color: #92400e; }
.rd-pill--dante { background: rgba(250,204,21,.18); border-color: rgba(202,138,4,.5); padding: 0 6px; }
.rd-pill--dante .room-detail-dante-inline { height: 8px; margin: 0; }
body.dark .rd-pill--poe { color: #7dd3fc; }
body.dark .rd-pill--poeplus { color: #a5b4fc; }
body.dark .rd-pill--ac { color: #fcd34d; }
body.dark .rd-pill--ac svg { --ac-wave: #1e1e1e; }
/* Dante logo / AC power badge row under a device name. */
.room-detail-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.room-detail-badges .room-detail-dante-inline { margin-top: 0; }
.room-detail-ac {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.room-detail-ac svg { width: 13px; height: 13px; display: block; color: #1f2937; }
/* Dark mode: a yellow plug (like the Dante logo) with a dark wave. */
body.dark .room-detail-ac svg { color: #facc15; --ac-wave: #1e1e1e; }
.room-detail-dante-logo {
  height: 14px;
  width: auto;
  vertical-align: middle;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(85%) sepia(80%) saturate(600%) hue-rotate(5deg) brightness(1.05);
}

/* Light mode: yellow on white was hard to read, so show the logo as supplied
   (black); dark mode keeps the yellow recolour above. */
body:not(.dark) .report-summary-dante-logo,
body:not(.dark) .room-detail-dante-logo,
body:not(.dark) .room-detail-dante-inline,
body:not(.dark) .rrr-dante-logo {
  filter: none;
}
.room-detail-cell-num {
  text-align: center;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.room-detail-cell-pos {
  text-align: center;
  padding: 6px 8px;
}
.room-detail-pos-select {
  appearance: none;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 0.8rem;
  padding: 4px 22px 4px 8px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2388889a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  transition: border-color 0.15s;
  min-width: 80px;
}
.room-detail-pos-select:focus {
  outline: none;
  border-color: var(--accent);
}
.room-detail-pos-select:hover {
  border-color: var(--accent);
}
.room-detail-empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 24px !important;
  font-size: 0.85rem;
}

/* ── Room Detail — Photo Gallery ─────────────────────────────────────── */
#roomDetailPhotos {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-photos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.room-photos-header-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.room-photos-hint {
  margin: -4px 0 0;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.room-photos-ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  flex-shrink: 0;
  padding: 0;
}
.room-photos-ctrl-btn svg {
  width: 15px;
  height: 15px;
}
.room-photos-ctrl-btn:hover {
  color: var(--text);
  border-color: var(--panel-border);
  background: rgba(255,255,255,0.06);
}
.room-photos-ctrl-btn.all-selected {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(34,211,238,0.1);
}
.room-photos-delete-btn:not(:disabled):hover {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239,68,68,0.1);
}
.room-photos-ctrl-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.room-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.room-photo-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.12s, box-shadow 0.12s;
  background: rgba(0,0,0,0.2);
}
.room-photo-cell:hover {
  border-color: var(--panel-border);
}
.room-photo-cell.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.room-photo-caption {
  width: 100%; box-sizing: border-box; resize: none; border: 0; border-top: 1px solid var(--panel-border);
  background: var(--panel-solid, rgba(0,0,0,0.12)); color: inherit; font: inherit; font-size: 12px; line-height: 1.35;
  padding: 6px 8px; outline: none; cursor: text;
}
.room-photo-caption--error { box-shadow: inset 0 0 0 1px #dc2626; }
.room-photo-caption:focus { box-shadow: inset 0 0 0 1px var(--accent); }
.room-photo-img {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

/* Checkmark overlay */
.room-photo-check {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  border: 1.5px solid rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s, border-color 0.12s;
}
.room-photo-check svg {
  width: 11px;
  height: 11px;
  stroke: #fff;
}
.room-photo-cell .room-photo-check {
  opacity: 0.55;
}
.room-photo-cell.selected .room-photo-check {
  opacity: 1;
  background: var(--accent);
  border-color: var(--accent);
}

/* Upload-in-progress overlay -- shown while a just-added photo's compressed
   dataUrl preview is rendering but the real Storage upload hasn't resolved
   yet, so there's visible progress instead of the grid looking finished
   before the photo has actually persisted. */
.room-photo-cell--uploading .room-photo-img {
  filter: brightness(0.55);
}
.room-photo-upload-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
}
.room-photo-upload-spinner {
  width: 26px; height: 26px;
  border: 3px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinnerRotate 0.75s linear infinite;
}

/* ── Drop zone cell ──────────────────────────────────────────────────────── */
.room-photo-dropzone {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-muted);
  background: var(--panel);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
  font-size: 0.8rem;
  font-weight: 500;
}
.room-photo-dropzone svg {
  width: 32px;
  height: 32px;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.room-photo-dropzone-sub {
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.6;
}
.room-photo-dropzone:hover,
.room-photo-dropzone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  color: var(--accent);
}
.room-photo-dropzone:hover svg,
.room-photo-dropzone.drag-over svg {
  opacity: 1;
}
.room-photo-dropzone.drag-over {
  border-style: solid;
}

/* ── "Add photo" source sheet (mobile: camera vs. gallery) ──────────────── */
.room-photo-source-sheet {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: flex-end;
}
.room-photo-source-sheet.hidden { display: none; }
.room-photo-source-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.room-photo-source-sheet-panel {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.35);
}
.room-photo-source-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  background: var(--bg-0);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}
.room-photo-source-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.room-photo-source-btn--cancel {
  justify-content: center;
  margin-top: 4px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Photo Lightbox ───────────────────────────────────────────────────────── */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightboxIn 0.18s ease;
}
@keyframes lightboxIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 56px 60px;
}
#lightboxImg {
  max-width: 100%;
  max-height: calc(100vh - 112px);
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 8px 48px rgba(0,0,0,0.7);
  user-select: none;
}
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
.lightbox-close svg { width: 18px; height: 18px; }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 1;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.22); }
.lightbox-nav:disabled { opacity: 0.25; cursor: default; }
.lightbox-nav svg { width: 22px; height: 22px; }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.05em;
  pointer-events: none;
}

/* ── Admin Storage Groups ─────────────────────────────────────────────────── */
.debug-storage-group { margin-bottom: 20px; }
.debug-storage-group-heading {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.debug-storage-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.debug-storage-img-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.debug-storage-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
  background: var(--surface);
  transition: opacity 0.15s;
}
.debug-storage-thumb:hover { opacity: 0.85; }
.debug-storage-img-info {
  padding: 5px 7px 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.debug-storage-img-name {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.debug-storage-img-size {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.7;
}
.debug-storage-img-card .debug-delete-btn {
  margin: 4px 7px 7px;
  align-self: flex-start;
}

/* ── Room Notes ───────────────────────────────────────────────────────────── */
#roomDetailNotes { margin-bottom: 20px; }
.room-notes-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.room-notes-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 10px 12px;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
  backdrop-filter: blur(var(--panel-blur));
}
.room-notes-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
.room-notes-textarea::placeholder { color: var(--text-muted); opacity: 0.6; }

/* ── Report Page ─────────────────────────────────────────────────────────── */
#reportPage { padding-bottom: 48px; }

.report-section {
  margin-bottom: 16px;
}
.report-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
/* ── Survey page ─────────────────────────────────────────────────────────── */
#surveyPage { padding-bottom: 48px; }
.survey-progress {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.survey-progress--complete { color: #22c55e; }
/* Survey Questions title-row bar: answered / total, filled green. */
.survey-progress-bar {
  flex: 1 1 auto;
  min-width: 48px;
  max-width: 320px;
  height: 8px;
  margin: 0 4px 0 auto;
  border-radius: var(--r-pill);
  background: var(--panel-border);
  overflow: hidden;
}
.survey-progress-bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #22c55e;
  transition: width 0.3s ease;
}
.survey-empty { margin: 0; font-size: 0.88rem; color: var(--text-muted); }
.survey-checklist { display: flex; flex-direction: column; gap: 14px; }
.survey-group {
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.survey-group-header,
.survey-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text);
}
.survey-group-header {
  background: var(--panel-2);
  border-bottom: 1px solid var(--panel-border);
  font-weight: 700;
  font-size: 0.88rem;
}
.survey-group-name { flex: 1; min-width: 0; }
.survey-group-count { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.survey-row { font-size: 0.85rem; border-bottom: 1px solid var(--panel-border); }
.survey-row:last-child { border-bottom: none; }
.survey-row:hover { background: rgba(255, 255, 255, 0.03); }
.survey-row--checked .survey-row-name { color: var(--text-muted); text-decoration: line-through; }
.survey-row-thumb { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; border-radius: var(--r-xs); }
.survey-row-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.survey-row-meta { font-size: 0.75rem; color: var(--text-muted); }
.survey-row-drops { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); min-width: 52px; text-align: right; }
/* The global form rule gives inputs width:100% + padding + appearance:none,
   which would turn these into full-width invisible boxes. */
#surveyPage input[type="checkbox"],
#surveyPage input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  appearance: auto;
  -webkit-appearance: auto;
  accent-color: var(--accent);
  cursor: pointer;
}
.survey-questions { display: flex; flex-direction: column; gap: 10px; }
.survey-section {
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.survey-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 0;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.survey-section-title { flex: 1; min-width: 0; }
.survey-section-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.survey-section-chevron { flex-shrink: 0; color: var(--text-muted); transition: transform 0.15s; }
.survey-section--open .survey-section-chevron { transform: rotate(180deg); }
.survey-section-body { border-top: 1px solid var(--panel-border); }
.survey-section-subtitle { margin: 0; padding: 10px 16px 0; font-size: 0.8rem; color: var(--text-muted); }
.survey-q {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--panel-border);
}
.survey-q:last-child { border-bottom: none; }
.survey-q--followup { padding-left: 32px; background: rgba(127, 127, 127, 0.04); }
.survey-q-main { display: flex; align-items: center; gap: 16px; }
.survey-q-text { flex: 1; min-width: 0; font-size: 0.88rem; font-weight: 500; color: var(--text); }
.survey-q--answered .survey-q-text { color: var(--text-muted); }
.survey-q-answer { flex-shrink: 0; max-width: 60%; }
.survey-q-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-left: 10px;
  border-left: 2px solid var(--accent);
}
.survey-auto-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: 1px;
  white-space: nowrap;
}
.survey-q-hint--warn { border-left-color: #fbbf24; color: var(--text); }
.survey-use-suggested {
  margin-left: 6px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.survey-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.survey-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 7px 14px;
  min-height: 36px;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-pill);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.survey-chip:hover { border-color: var(--accent); }
.survey-chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent, #fff);
  font-weight: 600;
}
/* Chips are the whole tap target; the native radio/checkbox stays in the
   DOM for keyboard/screen-reader use but isn't drawn. */
#surveyPage .survey-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.survey-chip:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-ring); }
#surveyPage .survey-input {
  width: auto;
  margin: 0;
  padding: 8px 12px;
  font-size: 0.88rem;
}
#surveyPage .survey-input--text { width: 260px; max-width: 100%; }
#surveyPage .survey-input--num { width: 64px; text-align: center; -moz-appearance: textfield; }
#surveyPage .survey-input--num::-webkit-inner-spin-button,
#surveyPage .survey-input--num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.survey-stepper { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.survey-step-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.survey-step-btn:hover { border-color: var(--accent); }
.survey-unit { font-size: 0.78rem; color: var(--text-muted); }
.survey-equipment { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.survey-note-toggle {
  align-self: flex-end;
  padding: 2px 0;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
}
.survey-note-toggle:hover { color: var(--accent); }
#surveyPage .survey-note { margin: 0; padding: 8px 12px; font-size: 0.85rem; resize: vertical; }

/* Devices on the floorplan that aren't assigned to any room. */
.report-unassigned-notice { border-left: 3px solid var(--danger); }
.report-unassigned-notice .report-section-label { color: var(--danger); }
.report-unassigned-help { margin: 0 0 12px; font-size: 0.82rem; color: var(--text-muted); }
.report-unassigned-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.report-unassigned-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.88rem;
  color: var(--text);
}
.report-unassigned-item:last-child { border-bottom: none; }
.report-unassigned-thumb { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; border-radius: var(--r-xs); }
.report-unassigned-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-unassigned-page { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.report-unassigned-show { flex-shrink: 0; width: auto; padding: 6px 12px; font-size: 0.78rem; white-space: nowrap; }

/* Data drops not yet confirmed on the Survey checklist. */
.report-drops-notice { border-left: 3px solid #fbbf24; }
.report-drops-notice .report-section-header { margin-bottom: 4px; }
.report-drops-notice .report-section-label { color: #f59e0b; }
.report-drops-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.report-drops-room { font-size: 0.8rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.report-drops-count { font-size: 0.78rem; font-weight: 600; color: #f59e0b; white-space: nowrap; }
.report-survey-list { gap: 0; }
.report-survey-section { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border, rgba(127,127,127,0.18)); font-size: 0.85rem; }
.report-survey-section:last-child { border-bottom: none; }
.report-survey-section-name { color: var(--text); font-weight: 600; min-width: 0; }
/* Pulses when Save as PDF / Share is blocked by unanswered survey questions. */
.report-notice-flash { animation: report-notice-flash 0.9s ease-out 2; }
@keyframes report-notice-flash {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  100% { box-shadow: 0 0 0 12px rgba(245, 158, 11, 0); }
}
/* Sits under the Data Drops label without shifting that stat's number out
   of line with its neighbours; the bar grows a little to make room. */
.report-summary-stat:has(.report-summary-status) { position: relative; }
.report-summary-status {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 2px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}
.report-summary-bar:has(.report-summary-status:not(.hidden)) { padding-bottom: 26px; }
/* Phones: the stats wrap into a 2x2 grid with the Dante block on its own
   bordered row below, which the floating line above ran into. Put it back
   in the flow there instead, with stats top-aligned so the numbers in each
   row still line up. */
@media (max-width: 480px) {
  .report-summary-bar { align-items: flex-start; }
  .report-summary-status { position: static; transform: none; }
  .report-summary-bar:has(.report-summary-status:not(.hidden)) { padding-bottom: 14px; }
}
.report-summary-status--ok { color: #22c55e; }
.report-summary-status--warn { color: #f59e0b; }

/* Procurement notes implied by device mount position (e.g. a wall-mount
   bracket for a wall-mounted PTZ camera) -- see ACCESSORY_RULES in app.js. */
.report-accessories-notice {
  border-left: 3px solid #fbbf24;
}
.report-accessories-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text);
}
.report-accessories-list > li {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.report-accessories-item { line-height: 1.45; }
.report-accessories-locations {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.report-accessories-locations li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.85rem;
}
.report-accessories-locations li:last-child { border-bottom: none; }
.report-accessories-room { font-weight: 700; white-space: nowrap; }
.report-accessories-devices { flex: 1; min-width: 0; color: var(--text-muted); overflow-wrap: anywhere; }
/* Report page header buttons (Share / Floorplan / Save as PDF). */
.report-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
@media (max-width: 520px) {
  .report-header-actions { width: 100%; justify-content: stretch; }
  .report-header-actions > button { flex: 1 1 0; min-width: 0; width: auto; padding-left: 8px; padding-right: 8px; font-size: 0.85rem; white-space: nowrap; }
  .report-header-actions > button svg { margin-right: 4px !important; }
}
/* Mobile: icon-only buttons (labels stay available via aria-label/title). */
@media (max-width: 768px) {
  .report-header-actions { width: 100%; justify-content: flex-end; gap: 6px; }
  .page-header .report-header-actions > button { flex: 0 0 auto; width: 38px !important; min-width: 0; height: 38px; min-height: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
  .report-header-actions > button svg { margin: 0 !important; width: 18px !important; height: 18px !important; vertical-align: 0 !important; }
  .report-header-actions > button .report-btn-label { display: none; }
}
.rrr-dante {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--panel-border);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.rrr-dante-logo {
  height: 12px;
  width: auto;
  filter: brightness(0) saturate(100%) invert(85%) sepia(80%) saturate(600%) hue-rotate(5deg) brightness(1.05);
}
.rrr-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.rrr-status--ready { color: #16a34a; background: rgba(34, 197, 94, 0.14); }
body.dark .rrr-status--ready { color: #4ade80; }
.rrr-status--not-ready { color: #b45309; background: rgba(251, 191, 36, 0.18); }
body.dark .rrr-status--not-ready { color: #fbbf24; }
.rrr-status-detail { font-weight: 600; opacity: 0.85; font-size: 0.75rem; line-height: 1.3; white-space: nowrap; margin-left: 8px; }
.report-accessories-qty { font-weight: 700; color: #fbbf24; white-space: nowrap; }
.report-accessories-list strong { color: #fbbf24; }
.report-accessories-list a { color: var(--accent); font-weight: 600; }
.report-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.report-map-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.report-comments-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 10px 12px;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
  backdrop-filter: blur(var(--panel-blur));
}
.report-comments-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
.report-comments-textarea::placeholder { color: var(--text-muted); opacity: 0.6; }

/* Top section: site address + point of contact (left) / location map (right) */
.report-top-section {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.report-top-col.report-top-details {
  flex: 0 1 340px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.report-top-col.report-top-map {
  flex: 1 1 380px;
  min-width: 260px;
}
.report-field-group { display: flex; flex-direction: column; }
.report-open-maps-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-text);
  text-decoration: none;
  align-self: flex-start;
  transition: opacity var(--t-fast);
}
.report-open-maps-link svg { width: 14px; height: 14px; }
.report-open-maps-link:hover { opacity: 0.8; text-decoration: underline; }
.report-open-maps-link.hidden { display: none; }
.report-address-input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 8px 12px;
  transition: border-color 0.15s;
}
.report-address-input:focus {
  outline: none;
  border-color: var(--accent);
}
.report-poc-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.report-poc-fields input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 8px 12px;
  transition: border-color 0.15s;
}
.report-poc-fields input:focus {
  outline: none;
  border-color: var(--accent);
}
.report-poc-fields input:last-child { grid-column: 1 / -1; }
.report-required {
  margin-left: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--danger);
}
/* Set once the user tries to save/share with a field missing or invalid. */
.report-poc-fields input.report-poc-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 1.5px var(--danger) !important;
}
.report-poc-hint { margin: 6px 0 0; font-size: 0.8rem; font-weight: 600; color: var(--danger); }
.report-location-map {
  width: 100%;
  height: 220px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--panel-border);
}
.report-location-map .leaflet-control-attribution { font-size: 9px; }
.report-coords {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
@media (max-width: 720px) {
  .report-top-section { flex-direction: column; }
  /* In a column layout flex-basis is a HEIGHT -- the details column's 320px
     basis left a big empty gap above the map. */
  .report-top-col.report-top-details { flex: 0 0 auto; min-width: 0; width: 100%; }
  .report-top-col.report-top-map { flex: 0 0 auto; min-width: 0; width: 100%; }
}

/* Additional photos grid */
.report-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.report-photos-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
  grid-column: 1/-1;
}
.report-photo-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--panel-border);
}
.report-photo-media {
  position: relative;
  aspect-ratio: 4/3;
}
.report-photo-caption {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: none;
  border-top: 1px solid var(--panel-border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
  resize: none;
  box-shadow: none;
}
.report-photo-caption:focus { outline: none; background: var(--accent-soft); }
.report-photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  display: block;
  transition: opacity 0.15s;
}
.report-photo-thumb:hover { opacity: 0.88; }
.report-photo-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.report-photo-del svg { width: 13px; height: 13px; }
.report-photo-card:hover .report-photo-del { opacity: 1; }
/* No hover on touch screens -- keep the remove button visible there. */
@media (hover: none) { .report-photo-del { opacity: 1; } }

/* Compact room array */
.report-room-array-card { padding: 16px; }
.report-room-array { display: flex; flex-direction: column; }
.report-room-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  min-height: 44px;
}
.report-room-row.alt { background: color-mix(in srgb, var(--accent) 4%, transparent); }
/* The 220px basis is what makes the photo strip wrap onto its own line
   below on narrow screens -- with a basis of 0 this column shrank to
   nothing beside the (non-shrinking) thumbnails, and the name and stat
   pills overflowed underneath them. */
.report-room-row-main {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.report-room-row-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 80px;
  max-width: 200px;
}
.report-room-row-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.rrr-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
}
.rrr-pill-label {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
}
.report-room-row-notes {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  flex: 1;
}
.report-room-row-photos {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
  max-width: 100%;
  overflow-x: auto;
}
.report-room-row-thumb,
.report-room-row-more { flex-shrink: 0; }
.report-room-row-thumb {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: opacity 0.15s;
}
.report-room-row-thumb:hover { opacity: 0.8; }
.report-room-row-more {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}
.report-no-rooms {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 12px 0;
}

/* ── Mobile companion — bottom tab bar (≤768px) ──────────────────────────── */
@media (max-width: 768px) {
  /* Reposition nav to fixed bottom tab bar */
  .top-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0; top: auto;
    z-index: 100;
    margin: 0;
    border-radius: 0;
    border-top: 1px solid var(--panel-border);
    border-bottom: none;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
    flex-direction: row;
    overflow: visible;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
  }

  .nav-left {
    flex: 1;
    display: flex;
    align-items: stretch;
    position: static;
    gap: 0;
  }

  .nav-link-pinned {
    flex: 0 0 auto;
    min-width: 56px;
  }

  .nav-tabs-slide {
    flex: 1;
    display: flex;
    justify-content: space-around;
    position: static;
    gap: 0;
  }

  .nav-right {
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-left: 1px solid var(--panel-border);
  }

  /* Icons tab is desktop-only (navbar link); no mobile equivalent as of 2026-09-04
     (the profile-dropdown duplicate was removed) — see CLAUDE.md. */
  .nav-link-icons-desktop { display: none; }

  /* Tab button: icon above label, full-height column */
  .nav-link {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    padding: 8px 4px 6px;
    min-height: 56px;
    border-radius: 0;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
  }


  /* Show icons on mobile */
  .nav-tab-icon {
    display: block;
    width: 22px;
    height: 22px;
    margin-right: 0;
    flex-shrink: 0;
  }



  /* Hide animated pill — position math breaks in bottom flex layout */
  .nav-indicator {
    display: none !important;
  }

  /* Active tab: accent color, no pill background */
  .nav-link.active {
    color: var(--accent-text);
    background: transparent;
    box-shadow: none;
  }
  body:not(.dark) .nav-link.active { color: var(--accent); }

  /* Compact profile trigger — avatar only */
  #userProfile #userName,
  #userProfile svg[viewBox="0 0 14 14"] { display: none; }

  /* Push main content above the tab bar */
  main {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  /* Hide the app header — saves vertical space on phones */
  header { display: none; }

  /* Account for missing header padding at top */
  .app-shell {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  /* Survey: question text on its own line, answer controls right-aligned
     beneath it so they stay under the thumb. */
  .survey-q-main { flex-direction: column; align-items: stretch; gap: 10px; }
  .survey-q-answer { max-width: none; }
  #surveyPage .survey-input--text,
  #surveyPage .survey-input--date { width: 100%; }
  .survey-q--followup { padding-left: 24px; }

  /* Hide new project button — project creation is a desktop workflow */
  #importFloorplan {
    display: none;
  }

  /* ── Floorplan page: simplified mobile layout ── */
  /* View-only (2026-10-02): pinch-zoom, pan, page arrows/swipe and opening
     rooms only -- placed icons can't be selected/moved/rotated/deleted here
     (see _floorplanViewOnly() in app.js), and the only tool button is the
     Rooms list toggle. */

  /* Hide the left icon/rooms panel entirely */
  #floorplanPage .icon-panel {
    display: none;
  }

  /* Canvas viewport fills the full width */
  #floorplanPage .canvas-viewport {
    flex: 1;
    width: 100%;
  }

  /* Vertical stack — keeps every control within a thumb's reach of one
     corner instead of spread across a wide horizontal pill. Hide the
     desktop icon-scale slider/label (a 140px drag-slider doesn't fit a
     narrow column) in favor of the +/- stepper buttons added for mobile. */
  .zoom-label { display: none; }
  #iconScaleSlider { display: none; }

  /* Stack into a vertical pill anchored bottom-right */
  .canvas-toolbar {
    display: inline-flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 8px 6px;
    gap: 8px;
    border-radius: 22px;
    bottom: 8px;
    right: 8px;
    max-height: calc(100vh - 140px);
  }
  .canvas-toolbar .toolbar-divider {
    width: 20px;
    height: 1px;
    margin: 0;
  }
  .toolbar-group--pages {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
  }
  /* No point showing page nav for a single-page project -- see
     updateProjectPageControls() in app.js, which toggles this. */
  .toolbar-group--pages.toolbar-group--single-page {
    display: none !important;
  }
  /* Collapsed by default -- the pill only shows pagination + the expand
     toggle (⋯) to stay out of the way of the canvas underneath; tapping
     the toggle reveals icon scale + zoom. Reported 2026-09-24: the fully
     expanded vertical pill was too tall/prominent on small screens. */
  /* Zoom is pinch-only and icon scale isn't adjustable on mobile. */
  .toolbar-group--zoom,
  .toolbar-group--icon-scale,
  .canvas-toolbar .toolbar-divider {
    display: none !important;
  }
  #prevPdfPage,
  #nextPdfPage,
  .toolbar-group--zoom button,
  .toolbar-group--icon-scale button,
  .toolbar-expand-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    font-size: 1.1rem;
  }
  /* The pill already provides the background -- a filled secondary-button
     inside it read as a second, nested background. */
  .toolbar-expand-toggle {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  /* Text label in front of the icon: the button grows to fit it. */
  .toolbar-expand-toggle {
    width: auto !important;
    min-width: 36px;
    gap: 6px;
    padding: 0 10px !important;
  }
  .toolbar-expand-label { font-size: 0.8rem; font-weight: 600; line-height: 1; }
  .toolbar-expand-toggle[aria-expanded="true"] {
    background: var(--accent-soft) !important;
    border-color: var(--accent-ring);
    color: var(--accent-text);
  }
  /* Page nav moved out of the pill into gallery-style edge arrows + a
     bottom-centre badge (plus swipe, see app.js) -- reported 2026-10-01
     that vertical up/down page arrows felt odd. The pill is now just the
     wrench toggle until expanded. */
  .canvas-toolbar .toolbar-group--pages { display: none !important; }
  .canvas-viewport--multi-page .canvas-page-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 48px;
    padding: 0;
    /* Bare chevron, no chip -- a panel-coloured circle washed the arrow out
       in dark mode (reported 2026-10-01). Black in both themes since it sits
       over the (light) floorplan; the faint white halo keeps it legible over
       darker drawing areas. */
    border: none;
    background: none;
    box-shadow: none;
    color: #000;
    opacity: 0.45;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.7));
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .canvas-viewport--multi-page .canvas-page-arrow svg {
    width: 28px;
    height: 28px;
  }
  .canvas-viewport--multi-page .canvas-page-arrow:active {
    opacity: 0.8;
    transform: translateY(-50%) scale(0.9);
  }
  .canvas-page-arrow--prev { left: 8px; }
  .canvas-page-arrow--next { right: 8px; }
  /* The Rooms list sits over the right edge -- hide the next arrow while
     it's open (swipe still works). */
  .canvas-viewport--rooms-open .canvas-page-arrow--next {
    display: none;
  }

  /* Floating Rooms list, anchored above the Rooms button. */
  #floorplanPage .mobile-rooms-list {
    position: absolute;
    right: 8px;
    bottom: 60px;
    z-index: 5;
    width: min(300px, calc(100% - 16px));
    max-height: min(60vh, calc(100% - 80px));
    display: flex;
    flex-direction: column;
    border-radius: var(--r-lg);
    border: 1px solid var(--panel-border);
    background: var(--panel-strong);
    box-shadow: var(--shadow-md);
    overflow: hidden;
  }
  #floorplanPage .mobile-rooms-list.hidden { display: none; }
  .mobile-rooms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px 8px 14px;
    border-bottom: 1px solid var(--panel-border);
  }
  .mobile-rooms-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .mobile-rooms-close {
    width: 30px; height: 30px;
    border: none; background: none;
    color: var(--text-muted);
    font-size: 1.3rem; line-height: 1;
    cursor: pointer;
  }
  .mobile-rooms-items {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-rooms-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--panel-border);
  }
  .mobile-rooms-row:last-child { border-bottom: none; }
  .mobile-rooms-focus {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 6px 11px 14px;
    border: none;
    background: none;
    color: var(--text);
    text-align: left;
    font: inherit;
    cursor: pointer;
  }
  .mobile-rooms-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-rooms-meta { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
  .mobile-rooms-status {
    flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    font-size: 0.7rem; font-weight: 800;
  }
  .mobile-rooms-status--ready { background: #dcfce7; color: #15803d; }
  .mobile-rooms-status--warn  { background: #fef3c7; color: #92400e; }
  .mobile-rooms-open {
    flex: none;
    width: 44px;
    display: flex; align-items: center; justify-content: center;
    border: none;
    border-left: 1px solid var(--panel-border);
    background: none;
    color: var(--text-muted);
    cursor: pointer;
  }
  .mobile-rooms-focus:active, .mobile-rooms-open:active { background: var(--accent-soft); }
  .mobile-rooms-empty { padding: 14px; font-size: 0.85rem; color: var(--text-muted); }
  .canvas-viewport--multi-page .canvas-page-badge {
    display: block;
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    z-index: 2;
    padding: 4px 12px;
    border-radius: var(--r-pill);
    border: 1px solid var(--panel-border);
    background: var(--panel);
    backdrop-filter: blur(var(--panel-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(140%);
    box-shadow: var(--shadow-md);
    color: var(--text);
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
  }
  /* Same as the pill -- out of the way while the room drawer covers the canvas. */
  body:has(#roomDetailPage.room-detail-drawer--open) .canvas-page-arrow,
  body:has(#roomDetailPage.room-detail-drawer--open) .canvas-page-badge {
    display: none !important;
  }
  #pdfPageIndicator,
  #iconScaleValue {
    display: block !important;
    font-size: 0.72rem;
    white-space: nowrap !important;
    text-align: center !important;
    padding: 0 2px;
  }


  /* ── Room detail page ── */

  /* Prevent snapshot from blowing out page width. .page-header deliberately
     is NOT in this list even though an earlier version included it --
     giving a multi-line flex-wrap container (title group + close button)
     any non-'visible' overflow (regardless of which axis) turns it into a
     scroll container, and Chromium's automatic block-size calc for a
     wrapped flex container inside a scroll container doesn't reliably
     include every wrapped line, clipping/hiding whatever wrapped onto the
     header's second line -- the close button, or the room name itself for
     a longer title. Reported 2026-09-19 as the room title getting cut off
     by the device table below it, and occasionally the drawer looking
     like it hadn't rendered at all. .page-header's content (an h2 that
     wraps normally, no canvas/image) never actually needed horizontal
     clipping in the first place -- only the snapshot inside
     .room-detail-body did. */
  #roomDetailPage,
  #roomDetailPage .room-detail-body {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Stack snapshot above info, full width */
  .room-detail-body {
    flex-direction: column;
    gap: 16px;
  }

  /* Snapshot: full width, capped height — never taller than ~35% of viewport */
  .room-detail-snapshot-wrap {
    width: 100%;
    max-width: 100%;
  }
  #roomDetailSnapshot {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 36vh;
    object-fit: contain;
  }

  /* Info panel: full width */
  .room-detail-info {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  /* Device table: only scrollable element */
  .room-detail-icon-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  /* Fits the phone-width drawer without sideways scrolling: PoE and Dante
     columns are dropped (PoE is in the stats row above; Dante shows as a
     small logo after the device name instead), and the remaining fixed
     columns are tightened so Name keeps a usable width. */
  .room-detail-icon-table { min-width: 0; }
  .room-detail-icon-table th:nth-child(5), .room-detail-icon-table td:nth-child(5) { width: 76px; }
  .room-detail-icon-table th:nth-child(1), .room-detail-icon-table td:nth-child(1) { width: 44px; }
  .room-detail-icon-table th:nth-child(3), .room-detail-icon-table td:nth-child(3) { width: 112px; }
  .room-detail-icon-table th:nth-child(4), .room-detail-icon-table td:nth-child(4) { width: 58px; }
  .room-detail-icon-table td:nth-child(2) { padding-left: 4px; padding-right: 4px; }
  .room-detail-icon-table thead th { white-space: normal; line-height: 1.25; }
  .room-detail-icon-thumb { width: 28px; height: 28px; }
  .room-detail-pos-select { min-width: 0; width: 100%; }
  /* Mobile drawer: only notes and photos are editable (see
     _floorplanViewOnly() in app.js) -- no rename. */
  /* No browser-level pinch/double-tap zoom on the floorplan or the drawer:
     the canvas has its own pinch-zoom, and a zoomed page left the
     full-screen drawer oversized and cut off (reported 2026-10-02). Lists
     inside still scroll vertically. */
  #floorplanPage .canvas-viewport,
  #floorplanPage .canvas-viewport * { touch-action: none; }
  #floorplanPage .mobile-rooms-items,
  #floorplanPage .mobile-rooms-items * { touch-action: pan-y; }
  #roomDetailPage.room-detail-drawer,
  #roomDetailPage.room-detail-drawer * { touch-action: pan-y; }
  #roomDetailPage.room-detail-drawer .room-detail-icon-table-wrap,
  #roomDetailPage.room-detail-drawer .room-detail-icon-table-wrap * { touch-action: pan-x pan-y; }
  /* A long room name truncates instead of wrapping the close button onto
     its own line. */
  #roomDetailPage.room-detail-drawer .page-header { flex-wrap: nowrap; gap: 12px; }
  #roomDetailPage.room-detail-drawer .page-header > div { min-width: 0; flex: 1; }
  #roomDetailPage.room-detail-drawer .room-detail-title-row { min-width: 0; }
  /* The drawer covers the whole screen here, so stop painting the floorplan
     underneath it -- a pinch-zoomed canvas is a very large scaled layer, and
     mobile browsers (iOS Safari especially) could misdraw the drawer sliding
     in over it (reported 2026-10-02: pinch, then open a room on another
     page from the Rooms list). */
  body:has(#roomDetailPage.room-detail-drawer--open) #floorplanPage .canvas-viewport { visibility: hidden; }
  #roomDetailName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .room-detail-pos-text { font-size: 0.82rem; color: var(--text); }

  /* Drawer mode: use the full screen rather than the desktop 600px cap --
     there's much less room to spare next to it on a phone/small tablet.
     Anchoring all four edges (not just right/top/bottom, as the desktop
     rule does) and re-asserting a solid, non-transparent background here
     guards against a translucent-looking drawer if anything about the
     mobile viewport (dynamic browser chrome, an ancestor's stacking
     context) ever put the base rule's sizing/background off -- reported
     2026-09-09. isolation: isolate guarantees its own stacking context so
     nothing behind it can blend through regardless.
     Deliberately no explicit height here -- top+bottom both pinned to 0
     already gives an auto-computed box that exactly fills the real visual
     viewport and tracks the address bar showing/hiding. An explicit
     `height: 100dvh` was tried and reverted (2026-09-24): with top/bottom
     both set to 0 AND an explicit height, height wins and bottom's used
     value silently stops being 0, so a mismatch between 100dvh and the
     actual visible viewport during a browser-chrome transition left a gap
     at the bottom the canvas toolbar (position: fixed, bottom:8px) showed
     through -- reported as the toolbar not auto-hiding behind the room
     detail drawer.
     width/max-width DO need resetting here, unlike height -- the base
     (desktop) rule's `width: min(600px, 100vw)` isn't cleared just because
     this block doesn't repeat it, so on any screen between 600px and
     768px wide that 600px cap was still winning over left+right:0's
     implied full width, leaving the floorplan canvas visible in the
     leftover gap next to the drawer (reported 2026-09-24). `width: auto`
     lets left+right:0 drive the box's width the same way top+bottom:0
     already drives its height above. */
  #roomDetailPage.room-detail-drawer {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    background: var(--bg-0);
    isolation: isolate;
    /* Skip the slide-in animation entirely on mobile instead of chasing
       further compositing artifacts in it (see will-change/backface-
       visibility above, added the same day) -- reported still visibly
       flickering during the transition even with GPU layer promotion
       forced. The drawer just appears/disappears instantly here; desktop
       keeps the slide (there's room for it not to feel like a jump-cut
       there, and no report of it flickering on desktop). */
    transition: none;
  }

  /* Belt-and-suspenders on top of the sizing fix above: explicitly hide the
     floating canvas toolbar whenever the drawer is open, rather than
     relying solely on it being covered by an equal-z-index sibling that's
     later in the DOM. */
  body:has(#roomDetailPage.room-detail-drawer--open) .canvas-toolbar {
    display: none !important;
  }
}

/* ── Pull-to-refresh indicator ────────────────────────────────────────────── */
.pull-refresh-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  opacity: 0;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  transition: opacity 0.15s ease;
  pointer-events: none;
  will-change: height, opacity;
}
.pull-refresh-indicator.visible {
  opacity: 1;
}
.pull-refresh-indicator.refreshing .pull-refresh-label {
  content: 'Refreshing…';
}
.pull-refresh-spinner {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--accent);
}
.pull-refresh-indicator.refreshing .pull-refresh-spinner {
  animation: ptr-spin 0.75s linear infinite;
}
@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

.view-only-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  margin-right: 8px;
  white-space: nowrap;
}
.view-only-badge.hidden { display: none; }

/* ── Settings page ───────────────────────────────────────────────────────── */
.settings-card {
  max-width: 540px;
  margin-bottom: 16px;
}

.settings-card-title {
  margin: 0 0 16px;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.settings-card-desc {
  margin: 0 0 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--panel-border);
}
.settings-row:last-of-type { border-bottom: none; }

.settings-row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.settings-value {
  font-size: 0.925rem;
  color: var(--text);
}

.settings-password-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.settings-reset-status {
  font-size: 0.82rem;
}
.settings-reset-status--ok  { color: #4ade80; }
.settings-reset-status--err { color: var(--danger); }

.settings-sso-notice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0 4px;
}
.settings-sso-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.settings-sso-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}
.settings-sso-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ── Print styles ─────────────────────────────────────────────────────────── */
@media print {
  .top-nav { display: none; }
}

/* ── Registration / Onboarding modal ─────────────────────────────────────── */
.registration-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 40px 20px;
  overflow-y: auto;
  animation: fadeIn 0.25s var(--ease-out);
}

.registration-card {
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  margin: auto;
  padding: 36px 36px 32px;
  animation: slideUp 0.3s var(--ease-out);
}

@media (max-width: 520px) {
  .registration-backdrop {
    padding: 16px;
  }

  .registration-card {
    max-height: calc(100vh - 32px);
    padding: 28px 22px 24px;
  }
}

@keyframes slideUp {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.registration-card .reg-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.registration-card .reg-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.registration-card .reg-logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.registration-card h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.registration-card .reg-subtitle {
  margin: 0 0 28px;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.registration-card .reg-sso-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  margin-bottom: 22px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.registration-card .reg-sso-banner img,
.registration-card .reg-sso-banner svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.registration-card .reg-sso-banner strong {
  color: var(--text);
}

.registration-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.registration-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.registration-card label input,
.registration-card label select {
  font-size: 0.95rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  font-family: inherit;
}

.registration-card label input:focus,
.registration-card label select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.registration-card label input[readonly] {
  opacity: 0.6;
  cursor: default;
}

.reg-org-section {
  border-top: 1px solid var(--panel-border);
  padding-top: 20px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reg-org-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin: 0;
}

.reg-org-domain-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 0.875rem;
  color: var(--text);
}

.reg-org-domain-display .reg-domain-pill {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-text);
}

.reg-personal-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  background: var(--panel-2);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  margin: 0;
}

.reg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.reg-error {
  font-size: 0.82rem;
  color: var(--danger);
  min-height: 18px;
  text-align: center;
}

/* ── Autosave confirmation ────────────────────────────────────────── */
.autosave-confirm {
  font-size: 11px;
  color: var(--accent-text);
  opacity: 0;
  transition: opacity 0.25s ease;
  margin: 0;
  line-height: 1;
  white-space: nowrap;
}
.autosave-confirm--visible { opacity: 1; }

/* Live-collab cue: briefly flash an item a remote collaborator just changed. */
@keyframes recentlyChangedFlash {
  0%   { background: color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: inset 0 0 0 2px var(--accent); }
  100% { background: transparent; box-shadow: inset 0 0 0 0 transparent; }
}
.recently-changed { animation: recentlyChangedFlash 1.6s ease-out 1; border-radius: var(--r-sm, 6px); }
@media (prefers-reduced-motion: reduce) { .recently-changed { animation: none; } }
/* Upper-case what's typed, not the "e.g. PTZ" placeholder. */
#iconIdPrefix:not(:placeholder-shown) { text-transform: uppercase; }
/* Phones: the icon editor's paired fields stack instead of squeezing. */
@media (max-width: 520px) {
  .new-icon-fields-row { grid-template-columns: 1fr; }
}

/* First sign-in role picker */
.role-picker-options { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.role-picker-btn { flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; width: 100%; }
.role-picker-btn span { font-weight: 400; font-size: 0.8rem; color: var(--text-muted); }
.nav-link.hidden { display: none !important; }

/* Icon editor: Device / Stamp graphic type */
.icon-type-toggle { display: inline-flex; align-self: flex-start; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--panel-strong); border: 1px solid var(--panel-border); }
.icon-type-opt { border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 0.8rem; font-weight: 700; padding: 5px 16px; border-radius: var(--r-pill); cursor: pointer; }
.icon-type-opt.active { background: var(--accent-grad); color: var(--on-accent); }
.icon-type-hint { margin: 6px 0 8px; font-size: 0.75rem; color: var(--text-muted); }


/* Admin notification counter (pending role requests) */
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e11d48; color: #fff; font-size: 0.68rem; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--panel-strong); pointer-events: none; z-index: 3; }
.notif-badge.hidden { display: none; }
.notif-badge--inline { position: static; display: inline-block; margin-left: 8px; box-shadow: none; vertical-align: middle; }
.user-avatar-wrap { position: relative; }

/* Phase sign-off + role request modals */
.signoff-pad-wrap { position: relative; margin: 14px 0 10px; border: 1px dashed var(--panel-border); border-radius: var(--r-sm); background: #fff; }
.signoff-pad-wrap canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }
.signoff-pad-hint { position: absolute; left: 12px; bottom: 8px; font-size: 0.75rem; color: #94a3b8; pointer-events: none; }
.signoff-pad-wrap.has-ink .signoff-pad-hint { display: none; }
.project-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 12px; }
.project-links label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.project-links input { font-weight: 400; }
@media (max-width: 600px) { .project-links { grid-template-columns: 1fr; } }
.signoff-notes { margin-bottom: 12px; }
.signoff-notes label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.signoff-notes textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 120px; max-height: 40vh; padding: 8px 10px; font: inherit; font-size: 13px; line-height: 1.4; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-solid, var(--panel)); color: inherit; }
.signoff-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.signoff-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.project-phase-extra { display: flex; flex-direction: column; gap: 8px; margin: -4px 0 10px; }
.project-phase-extra.hidden { display: none; }
.project-phase-note { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.project-signoff-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.project-signoff-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 0.8rem; }
.project-signoff-list img { height: 28px; background: #fff; border: 1px solid var(--panel-border); border-radius: 4px; }

/* ── User Management (admin) ─────────────────────────────────────────── */
.um-header { align-items: flex-start; flex-wrap: nowrap; }
.um-header h2 { margin: 0; font-size: 1.25rem; }
.um-header p { margin: 2px 0 0; font-size: 0.85rem; color: var(--text-muted); }
.um-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm); border: 1px solid var(--panel-border); background: var(--panel-strong); color: var(--text-muted); cursor: pointer; }
.um-icon-btn:hover { color: var(--accent-text); border-color: var(--accent-ring); }
.um-card { max-width: 880px; padding: 14px 16px 6px; border-radius: var(--r-lg); background: var(--panel-strong); border: 1px solid var(--panel-border); box-shadow: var(--shadow); }
.um-toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.um-search { position: relative; }
.um-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.um-search input { margin: 0; width: 100%; height: 36px; padding: 0 12px 0 34px; font-size: 0.88rem; border-radius: var(--r-pill); }
.um-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.um-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--panel-border); background: transparent; color: var(--text-muted); font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.um-chip:hover { color: var(--text); }
.um-chip.active { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--accent-text); }
.um-chip-n { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--panel-border); font-size: 0.7rem; line-height: 18px; text-align: center; }
.um-chip.active .um-chip-n { background: var(--accent-ring); }
.um-chip--alert .um-chip-n { background: #e11d48; color: #fff; }
.um-bulkbar { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 10px; border-radius: var(--r-md, 12px); background: var(--accent-soft); border: 1px solid var(--accent-ring); backdrop-filter: blur(10px); }
.um-bulkbar.hidden { display: none; }
.um-bulk-count { font-size: 0.82rem; font-weight: 700; margin-right: 4px; }
.um-select { width: auto; margin: 0; height: 32px; padding: 0 28px 0 11px; font-size: 0.82rem; border-radius: var(--r-pill); }
.um-btn { height: 32px; min-height: 0; padding: 0 13px; border-radius: 999px; border: 1px solid var(--panel-border); background: var(--panel-strong); color: var(--text); font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; width: auto; }
.um-btn:hover { border-color: var(--accent-ring); }
.um-btn--primary { background: var(--accent-grad); color: var(--on-accent); border-color: transparent; }
.um-btn--ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.um-status { min-height: 1.1em; margin: 0 0 6px; font-size: 0.78rem; color: var(--text-muted); }
.um-status.is-error { color: #e11d48; }

.um-table { width: 100%; border-collapse: collapse; }
.um-table thead th { padding: 6px 8px; text-align: left; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); border-bottom: 1px solid var(--panel-border); }
.um-table td { padding: 9px 8px; vertical-align: middle; border-bottom: 1px solid var(--panel-border); }
.um-table tbody tr:last-child td { border-bottom: 0; }
.um-table tbody tr:hover { background: var(--accent-soft); }
.um-table th:first-child, .um-table td:first-child { width: 34px; padding-left: 4px; padding-right: 0; }
.um-table input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; -webkit-appearance: auto; appearance: auto; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.um-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.um-avatar { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 0.72rem; font-weight: 800; }
.um-user-text { min-width: 0; line-height: 1.25; }
.um-user-name { font-size: 0.88rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-user-email { font-size: 0.75rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-role-fixed { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--panel-border); font-size: 0.75rem; font-weight: 700; }
.um-table td select { width: auto; min-width: 150px; margin: 0; height: 30px; padding: 0 26px 0 10px; font-size: 0.8rem; border-radius: var(--r-pill); }
.um-req { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.um-req-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: rgba(225, 29, 72, 0.12); color: #e11d48; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.um-req-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 1px solid var(--panel-border); background: var(--panel-strong); color: var(--text-muted); cursor: pointer; }
.um-req-btn--ok:hover { color: #16a34a; border-color: #16a34a; }
.um-req-btn--no:hover { color: #e11d48; border-color: #e11d48; }
.um-req-reason { flex-basis: 100%; font-size: 0.72rem; color: var(--text-muted); overflow-wrap: anywhere; }
.um-empty { padding: 28px 8px !important; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
@media (max-width: 720px) {
  .um-card { padding: 12px 12px 4px; }
  .um-table thead { display: none; }
  .um-table tr { display: grid; grid-template-columns: 30px 1fr; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--panel-border); }
  .um-table td { border: 0; padding: 3px 4px; }
  .um-table td:first-child { grid-row: 1; }
  .um-table td:nth-child(3), .um-table td:nth-child(4) { grid-column: 2; }
  .um-table td select { width: 100%; }
}

/* Support-phase lock */
.project-lock-banner { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 400; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--panel-strong); border: 1px solid var(--panel-border); box-shadow: var(--shadow); font-size: 0.78rem; font-weight: 700; color: var(--text-muted); pointer-events: none; }
.project-lock-banner.hidden { display: none; }
@media (max-width: 768px) { .project-lock-banner { bottom: 84px; } }
body.project-locked .room-photos-header, body.project-locked .room-photos-hint { display: none; }
[inert] { opacity: 0.72; }

/* Subcomponent mode of the icon editor: only image, title, Service Part# and parent device. */
.new-icon-form--sub .icon-device-only { display: none !important; }
/* Subcomponents tagged on a device: placed with it, removable on the plan. */


/* Right-angle connector from a placed subcomponent to its parent device. */
.canvas-group-frame { position: absolute; box-sizing: border-box; pointer-events: none; border: 2px dashed var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.canvas-group-frame.selected { border-style: solid; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.canvas-group-label { position: absolute; left: 6px; bottom: calc(100% + 2px); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; line-height: 1.5; color: #0f172a; background: var(--accent); }
.canvas-connectors { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.canvas-connector-line { fill: none; stroke: #334155; stroke-width: calc(2px * var(--inv-zoom, 1)); stroke-linejoin: miter; stroke-linecap: square; }
.canvas-connector-dot { fill: #334155; }
body.dark .canvas-connector-line { stroke: #cbd5e1; }
body.dark .canvas-connector-dot { fill: #cbd5e1; }

/* Bolder, higher-contrast connector: a shade lighter than the icon border (--accent, #3fb9e8) over a white halo, dots at both ends. */
body { --connector-color: color-mix(in srgb, var(--accent) 72%, #ffffff); }
.canvas-connector-halo { fill: none; stroke: #fff; stroke-opacity: 0.92; stroke-width: calc(8px * var(--inv-zoom, 1)); stroke-linejoin: round; stroke-linecap: round; }
.canvas-connector-line { stroke: var(--connector-color, #739fca) !important; stroke-width: calc(4px * var(--inv-zoom, 1)) !important; stroke-linejoin: round !important; stroke-linecap: round !important; }
.canvas-connector-dot, body.dark .canvas-connector-dot { fill: var(--connector-color, #739fca); stroke: #fff; stroke-width: calc(1.5px * var(--inv-zoom, 1)); r: calc(5px * var(--inv-zoom, 1)); }
body.dark .canvas-connector-line { stroke: var(--connector-color, #739fca) !important; }

/* Subcomponent rows in the room details flyout: directly under their device, indented. */
.room-detail-row--sub .room-detail-icon-name { padding-left: calc(22px + 14px * (var(--sub-depth, 1) - 1)); position: relative; }
.room-detail-row--sub .room-detail-icon-name::before { content: '↳'; position: absolute; left: calc(6px + 14px * (var(--sub-depth, 1) - 1)); top: 50%; transform: translateY(-50%); color: var(--text-faint); font-weight: 700; }
.room-detail-row--sub .room-detail-icon-thumb { transform: scale(0.82); transform-origin: left center; }

/* Subcomponent drag: devices a sub can be attached to */
.canvas-item--sub-target {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: 10px;
}
.canvas-item--sub-target-hot {
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* Report header: feature not ready yet */
.report-btn-disabled-wrap { display: inline-flex; cursor: not-allowed; }
.report-btn-disabled-wrap > button:disabled { opacity: 0.55; filter: grayscale(1); pointer-events: none; }
.report-btn-note { display: block; font-size: 9px; font-weight: 600; letter-spacing: 0.02em; opacity: 0.85; line-height: 1.1; }
.report-btn-disabled-wrap .report-btn-label { display: inline-block; line-height: 1.15; vertical-align: middle; }
@media (max-width: 768px) { .report-btn-note { display: none; } }


/* ── Canvas controls cleanup (2026-10-14) ───────────────────────────────── */
@media (min-width: 769px) {
/* Bottom toolbar: quiet ghost buttons in one slim pill. */
.canvas-viewport .canvas-toolbar { padding: 4px 6px; gap: 2px; }
.canvas-viewport .canvas-toolbar .toolbar-divider { margin: 0 3px; height: 18px; }
.canvas-viewport .canvas-toolbar .toolbar-group { gap: 2px; flex-wrap: nowrap; }
.canvas-viewport .canvas-toolbar .tb-btn {
  min-width: 30px; min-height: 30px; padding: 4px 7px; border: 0; background: transparent; box-shadow: none;
  border-radius: 10px; color: var(--text-muted); font-size: 0.8rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.canvas-viewport .canvas-toolbar .tb-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.canvas-viewport .canvas-toolbar .tb-btn:hover { background: var(--accent-soft); color: var(--accent-text); }
.canvas-viewport .canvas-toolbar .tb-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent-text); }
.canvas-viewport .canvas-toolbar .toolbar-group--pages span { min-width: 34px; font-size: 0.78rem; color: var(--text-muted); }
.canvas-viewport .canvas-toolbar .toolbar-group--icon-scale { position: relative; }
.canvas-viewport .canvas-toolbar .toolbar-group--icon-scale #iconScaleValue { min-width: 0; font-size: 0.78rem; color: inherit; }
.toolbar-group--pages.toolbar-group--single-page,
.toolbar-group--pages.toolbar-group--single-page + .toolbar-divider { display: none; }
.icon-scale-popover {
  display: none; position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  align-items: center; gap: 4px; padding: 6px 8px; border-radius: 14px; white-space: nowrap;
  border: 1px solid var(--panel-border); background: var(--panel);
  backdrop-filter: blur(var(--panel-blur)) saturate(140%); -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(140%);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--panel-highlight);
}
.icon-scale-popover.is-open { display: flex; }
body.dark .icon-scale-popover { background: rgba(22, 22, 22, 0.94); border-color: rgba(255, 255, 255, 0.12); }
.icon-scale-popover input[type="range"] { width: 130px; margin: 0 4px; height: 4px; padding: 0; border: 0; background: transparent; box-shadow: none; cursor: pointer; accent-color: var(--accent); }
}

/* Selection HUD: a slim rotate handle on a stem above, one compact bar below. */
.canvas-viewport .canvas-selection-hud .canvas-rotate-handle {
  width: calc(26px * var(--hs, 1)); height: calc(26px * var(--hs, 1)); top: calc(-38px * var(--hs, 1)); border: 0; color: #2c5d8f;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.canvas-viewport .canvas-selection-hud .canvas-rotate-handle:hover { background: #3fb9e8; color: #fff; transform: translateX(-50%) scale(1.08); box-shadow: 0 2px 8px rgba(63, 185, 232, 0.5); }
.canvas-viewport .canvas-selection-hud .canvas-rotate-handle svg { width: calc(12px * var(--hs, 1)); height: calc(12px * var(--hs, 1)); }
.canvas-viewport .canvas-selection-hud::before { top: calc(-12px * var(--hs, 1)); height: calc(12px * var(--hs, 1)); background: rgba(63, 185, 232, 0.55); }
.canvas-hud-bar {
  position: absolute; top: calc(100% + 24px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; white-space: nowrap; pointer-events: all;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.canvas-hud-seg {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 0; border-radius: 999px;
  background: transparent; color: #475569; font-size: 0.7rem; font-weight: 600; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.canvas-hud-seg:hover { background: rgba(63, 185, 232, 0.12); color: #2c5d8f; }
.canvas-hud-seg.active { background: #3fb9e8; color: #fff; }
.canvas-hud-divider { width: 1px; height: 16px; margin: 0 3px; background: rgba(15, 23, 42, 0.14); flex-shrink: 0; }
.canvas-hud-del {
  display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: #dc2626; cursor: pointer; transition: background var(--t-fast);
}
.canvas-hud-del:hover { background: #fee2e2; }

/* Icon editor: remove the current Device/Stamp picture. */
.icon-remove-image-btn { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin: 6px 0 0; padding: 4px 10px; border: 0; border-radius: 999px; background: transparent; color: #dc2626; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.icon-remove-image-btn:hover { background: #fee2e2; }
.icon-remove-image-btn.hidden { display: none; }

/* Stamp view: rotate handle + stem sit right on the picture's top edge (--hud-inset set in JS). */
.canvas-viewport .canvas-selection-hud--stamp .canvas-rotate-handle { top: calc(-38px * var(--hs, 1) + var(--hud-inset, 0px)); }
.canvas-viewport .canvas-selection-hud--stamp::before { top: calc(-12px * var(--hs, 1) + var(--hud-inset, 0px)); }

/* Package stamp picker (New/Edit Package modal) reuses the icon editor's drop zone */
.package-stamp-dropzone { width: 100%; height: 150px; }


/* ── Stamp generator ──────────────────────────────────────────────────── */
#stampGenModal { z-index: 1100; }
.stampgen-card { width: min(780px, 96vw); max-width: 780px; max-height: 92vh; overflow-y: auto; padding-bottom: 20px; }
.stampgen-create-toggle { margin: 0 20px 10px; }
.stampgen-form { display: flex; gap: 20px; padding: 4px 20px 8px; }
.stampgen-form.hidden { display: none; }
.stampgen-preview-col { flex: 0 0 190px; align-self: flex-start; display: flex; align-items: flex-start; justify-content: center; padding: 14px; border: 1px dashed var(--border); border-radius: var(--r-md, 12px); background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.stampgen-preview { width: 150px; height: auto; }
.stampgen-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.stampgen-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.stampgen-fields input.invalid { border-color: #dc2626; }
.stampgen-field-label { margin-top: 6px; font-size: 0.85rem; }
.stampgen-symbols { max-height: 260px; overflow-y: auto; padding-right: 4px; }
.stampgen-group-label { margin: 8px 0 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.stampgen-symbol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.stampgen-count { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.stampgen-symbol { position: relative; }
.stampgen-symbol[data-order]::after { content: attr(data-order); position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #2563eb; color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.stampgen-symbol { display: flex; align-items: center; justify-content: center; height: 42px; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: inherit; cursor: pointer; }
.stampgen-symbol:hover { border-color: var(--accent); }
.stampgen-symbol.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.stampgen-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.stampgen-pool-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px 8px; font-weight: 600; font-size: 0.9rem; }
.stampgen-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; padding: 0 20px; }
.stampgen-empty { grid-column: 1 / -1; margin: 0; color: var(--text-muted); font-size: 0.85rem; }
.stampgen-tile { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 8px; display: flex; justify-content: center; background: #fff; }
.stampgen-tile.editing { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.stampgen-tile-img { border: 0; background: transparent; padding: 0; cursor: pointer; }
.stampgen-tile-img img { width: 84px; height: auto; display: block; }
.stampgen-tile-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(15, 23, 42, 0.08); color: #475569; font-size: 11px; cursor: pointer; opacity: 0; }
.stampgen-tile:hover .stampgen-tile-del, .stampgen-tile-del:focus-visible { opacity: 1; }
.stampgen-tile-del:hover { background: #fee2e2; color: #dc2626; }
.stampgen-pick-btn { display: inline-flex; align-self: flex-start; margin: 6px 0 0; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--accent); font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.stampgen-pick-btn:hover { border-color: var(--accent); }
.stampgen-pick-btn.hidden { display: none; }
@media (max-width: 640px) { .stampgen-form { flex-direction: column; } .stampgen-preview-col { flex-basis: auto; } }

.stampgen-types { display: flex; gap: 6px; flex-wrap: wrap; }
.stampgen-type { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.stampgen-type.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.stampgen-type-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* Stamps modal: generator + library side by side */
.stampgen-card { width: min(1200px, 96vw); max-width: 1200px; height: min(90vh, 900px); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.stampgen-body { flex: 1; min-height: 0; display: flex; gap: 18px; padding: 0 20px 20px; }
.stampgen-pane { min-width: 0; overflow-y: auto; }
.stampgen-pane--create { flex: 0 0 620px; }
.stampgen-pane--library { flex: 1; }
.stampgen-pane-title { margin: 4px 0 10px; font-size: 0.95rem; }
.stampgen-card .stampgen-form { flex-direction: row; padding: 0; gap: 16px; }
.stampgen-card .stampgen-preview-col { flex: 0 0 170px; align-self: flex-start; padding: 10px; }
.stampgen-card .stampgen-preview { width: 140px; }
.stampgen-card .stampgen-pool { padding: 0; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.stampgen-card .stampgen-pool-head { padding: 4px 0 10px; justify-content: space-between; }
.stampgen-pool-actions { display: inline-flex; gap: 8px; }
.stampgen-card .stampgen-symbols { max-height: 420px; }
.stampgen-card.stampgen--pick .stampgen-pane--create { display: none; }
.stampgen-card.stampgen--pick.stampgen--create-open .stampgen-pane--create { display: block; }
.stampgen-tile { flex-direction: column; align-items: center; gap: 4px; }
.stampgen-tile-img img { width: 96px; height: 96px; object-fit: contain; }
.stampgen-tile-name { max-width: 100%; font-size: 0.74rem; color: var(--text-muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stampgen-tile-badge { position: absolute; top: 4px; left: 4px; padding: 1px 6px; border-radius: 6px; background: rgba(15,23,42,.08); color: #475569; font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.stampgen-pane--library.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; }
@media (max-width: 900px) { .stampgen-card .stampgen-form { flex-direction: column; } .stampgen-body { flex-direction: column; overflow-y: auto; } .stampgen-pane { overflow: visible; } .stampgen-pane--create { flex: none; } }

/* Stamp builder in the icon editor */
.icon-stamp-panel { display: flex; gap: 18px; margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--border); }
.icon-stamp-panel.hidden { display: none; }
.icon-stamp-preview-col { flex: 0 0 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.icon-stamp-preview-col .stampgen-preview { width: 130px; padding: 8px; border: 1px dashed var(--border); border-radius: 12px; background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.icon-stamp-controls { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.icon-stamp-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.icon-stamp-label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; flex: 1 1 200px; }
.icon-stamp-panel .stampgen-symbols { max-height: 190px; }
.icon-stamp-derived { margin: 4px 0 0; font-size: 0.76rem; color: var(--text-muted); }
@media (max-width: 700px) { .icon-stamp-panel { flex-direction: column; } .icon-stamp-preview-col { flex: none; } }
.stampgen-card { width: min(900px, 96vw); height: auto; max-height: 90vh; }
.stampgen-card .stampgen-pool { padding-bottom: 4px; }

.icon-stamp-row .stampgen-pick-btn { margin: 0 0 2px; }

/* Stamp mode: the stamp tools replace the device details (the Name field stays) */
.icon-details-slot { position: relative; }
.new-icon-form.icon-stamp-mode .icon-details-wrap { visibility: hidden; }
.new-icon-fields .icon-stamp-panel { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; position: absolute; inset: 0; overflow-y: auto; }
.new-icon-fields .icon-stamp-panel.hidden { display: none; }

/* ── Stamp canvas editor (icon editor, Stamp mode) ───────────────────── */
.new-icon-body { transition: grid-template-columns .45s cubic-bezier(.2,.8,.2,1); }
.new-icon-form.icon-stamp-mode .new-icon-body { grid-template-columns: 400px 1fr; }
.new-icon-form.icon-stamp-canvas-on #iconDropZone,
.new-icon-form.icon-stamp-canvas-on #iconRemoveImageBtn,
.new-icon-form.icon-stamp-canvas-on #iconUrlImportWrap { display: none !important; }
.new-icon-form.icon-stamp-mode .new-icon-fields > label:first-child { display: none; }
.icon-stamp-canvas-wrap { display: flex; flex-direction: column; gap: 8px; width: 100%; min-width: 0; }
.icon-stamp-canvas-wrap.hidden { display: none; }
.icon-stamp-canvas-box { position: relative; width: 100%; aspect-ratio: 1; }
.icon-stamp-canvas { width: 100%; height: 100%; border-radius: 18px; touch-action: none; outline: none; user-select: none;
  background: repeating-conic-gradient(#eef2f7 0 25%, #ffffff 0 50%) 0 0 / 18px 18px; box-shadow: inset 0 0 0 1px var(--border); }
.icon-stamp-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.icon-stamp-canvas .sc-item { cursor: grab; }
.icon-stamp-canvas .sc-item:active { cursor: grabbing; }
.icon-stamp-canvas .sc-name { cursor: text; }
.icon-stamp-canvas .sc-handle { cursor: nwse-resize; }
.icon-stamp-name-input { position: absolute; left: 12%; width: 76%; box-sizing: border-box; text-align: center; font-weight: 700; padding: 0 6px;
  border: 2px solid var(--accent); border-radius: 8px; background: #fff; color: #111; z-index: 2; }
.icon-stamp-name-input.hidden { display: none; }
.icon-stamp-canvas-hint { margin: 0; font-size: 0.72rem; color: var(--text-muted); text-align: center; }
.icon-stamp-canvas-wrap.sc-enter .icon-stamp-canvas { animation: scPop .55s cubic-bezier(.2,.9,.25,1.05) both; }
.icon-stamp-canvas-wrap.sc-enter .sc-border { stroke-dasharray: 1; stroke-dashoffset: 1; fill-opacity: 0; animation: scDraw .85s .1s cubic-bezier(.4,.1,.2,1) forwards, scFill .45s .7s ease forwards; }
.icon-stamp-canvas-wrap.sc-enter .sc-item, .icon-stamp-canvas-wrap.sc-enter .sc-name { opacity: 0; animation: scFade .4s .8s ease forwards; }
@keyframes scPop { from { opacity: 0; transform: scale(.82); clip-path: inset(30% round 40px); } to { opacity: 1; transform: scale(1); clip-path: inset(0 round 18px); } }
@keyframes scDraw { to { stroke-dashoffset: 0; } }
@keyframes scFill { to { fill-opacity: 1; } }
@keyframes scFade { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .new-icon-body { transition: none; } .icon-stamp-canvas-wrap.sc-enter * { animation: none !important; } }

.new-icon-fields .icon-stamp-panel { overflow: hidden; gap: 10px; }
.icon-stamp-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.icon-stamp-field select { width: 100%; }
.icon-stamp-sel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.icon-stamp-sel.hidden { display: none; }
.icon-stamp-size { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; flex: 1 1 160px; }
.icon-stamp-size input { flex: 1; min-width: 80px; }
.stamp-tool-btn { border: 1px solid var(--border); background: var(--panel, #fff); color: inherit; border-radius: 999px; padding: 4px 11px; font-size: 0.76rem; font-weight: 600; cursor: pointer; }
.stamp-tool-btn:hover { border-color: var(--accent); }
.stamp-tool-btn--danger { color: #dc2626; }
.stamp-tool-btn--danger:hover { border-color: #dc2626; background: #fee2e2; }
.icon-stamp-add-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.icon-stamp-add-head input { width: 140px; padding: 5px 10px; font-size: 0.8rem; border-radius: 999px; }
.stamp-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.stamp-chip { border: 1px solid var(--border); background: transparent; color: inherit; border-radius: 999px; padding: 3px 11px; font-size: 0.74rem; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.stamp-chip:hover { border-color: var(--accent); }
.stamp-chip.active { background: var(--accent-grad); color: var(--on-accent); border-color: transparent; }
.icon-stamp-symbols { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.stamp-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 6px; }
.stamp-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 4px 7px; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: inherit; font-size: 0.66rem; line-height: 1.15; text-align: center; cursor: pointer; transition: transform .12s, border-color .12s, box-shadow .12s; }
.stamp-tile:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, .12); }
.stamp-tile:active { transform: scale(.97); }
.icon-stamp-size { flex-direction: row !important; align-items: center; }
.icon-stamp-size input[type="range"] { padding: 0; height: 22px; border: 0; background: transparent; box-shadow: none; accent-color: var(--accent); }

/* ── Floorplan layers: pill, panel, overlays ─────────────────────────── */
@media (max-width: 768px) { .toolbar-group--layers, .toolbar-group--3d, .toolbar-group--grid, .layer-panel { display: none !important; } }

.layer-panel { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 30; width: min(560px, calc(100% - 32px)); padding: 10px 14px 12px; border-radius: 16px;
  background: var(--panel, #fff); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(15, 23, 42, .16); backdrop-filter: blur(8px); font-size: 0.8rem; }
.layer-panel.hidden { display: none; }
.lp-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lp-title { font-weight: 700; }
.lp-hint { margin: 6px 0 0; color: var(--text-muted); font-size: 0.74rem; line-height: 1.4; }
.lp-hint.hidden { display: none; }
.lp-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.lp-seg button { border: 0; background: transparent; color: inherit; font: inherit; font-size: 0.76rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.lp-seg button[data-kind="network"].active { background: #2563eb; color: #fff; }
.lp-seg button[data-kind="analogue"].active { background: #ea580c; color: #fff; }
.lp-btn { border: 1px solid var(--border); background: transparent; color: inherit; font: inherit; font-size: 0.76rem; font-weight: 700; padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.lp-btn:hover:not(:disabled) { border-color: var(--accent); }
.lp-btn--danger { color: #dc2626; }
.lp-btn--suggest { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.lp-btn.hidden, #lpCovTools.hidden { display: none; }
.lp-block { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.lp-block--off label { display: none; }
.lp-block label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; flex-direction: row !important; }
.lp-block input[type="range"] { width: 110px; padding: 0; height: 18px; border: 0; background: transparent; box-shadow: none; accent-color: var(--accent); }
.lp-block output { min-width: 34px; font-variant-numeric: tabular-nums; color: var(--text-muted); }

.canvas-layer-under, .canvas-layer-over { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.canvas-layer-over { z-index: 5; }
.ly-wire-halo { fill: none; stroke: #fff; stroke-opacity: .9; stroke-width: calc(8px * var(--inv-zoom, 1)); stroke-linecap: round; }
.ly-wire { fill: none; stroke-width: calc(4px * var(--inv-zoom, 1)); stroke-linecap: round; }
.ly-wire.selected { stroke-width: calc(6px * var(--inv-zoom, 1)); filter: drop-shadow(0 0 4px rgba(37, 99, 235, .6)); }
.ly-wire--temp { opacity: .8; }
.ly-wire-hit { fill: none; stroke: transparent; stroke-width: calc(16px * var(--inv-zoom, 1)); pointer-events: stroke; cursor: pointer; }
.ly-wire-dot { stroke: #fff; stroke-width: calc(1.5px * var(--inv-zoom, 1)); }
.ly-wire-x { pointer-events: all; cursor: pointer; }
.ly-fov { fill-opacity: .2; stroke-opacity: .85; stroke-width: calc(2px * var(--inv-zoom, 1)); stroke-linejoin: round; }
.ly-sound { fill-opacity: .16; stroke-opacity: .85; stroke-width: calc(2px * var(--inv-zoom, 1)); stroke-dasharray: 8 6; }
.ly-sound-ring { fill: none; stroke-opacity: .5; stroke-width: calc(1.5px * var(--inv-zoom, 1)); }
.ly-aim { fill: none; stroke-width: calc(1.5px * var(--inv-zoom, 1)); stroke-dasharray: 5 4; opacity: .8; }
.ly-handle { stroke-width: calc(2.5px * var(--inv-zoom, 1)); pointer-events: all; cursor: grab; }
.ly-handle:hover { fill: #eff6ff; }
/* Layers other than Plan: devices are targets, not things to drag around */
.canvas.layer-connections .canvas-item, .canvas.layer-coverage .canvas-item { cursor: crosshair; }
.canvas.layer-coverage .canvas-item { cursor: pointer; }
.canvas.layer-connections .canvas-selection-hud, .canvas.layer-coverage .canvas-selection-hud--hide { display: none; }
.canvas.ly-wiring .canvas-item:hover { outline: 2px solid #2563eb; outline-offset: 2px; border-radius: 10px; }

/* Layer panel: docked top-right so it doesn't cover the plan, stacked controls */
.layer-panel { left: auto; right: 14px; top: 14px; transform: none; width: 300px; }
.lp-block { display: grid; grid-template-columns: 1fr; gap: 6px; }
.lp-block > .lp-btn { justify-self: start; }
.lp-block label { display: grid !important; grid-template-columns: 62px 1fr 42px; align-items: center; gap: 8px; }
.lp-block input[type="range"], .icon-stamp-size input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; padding: 0; margin: 0; border: 0; background: transparent; box-shadow: none; }
.lp-block input[type="range"]::-webkit-slider-runnable-track, .icon-stamp-size input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--border, #cbd5e1); }
.lp-block input[type="range"]::-moz-range-track, .icon-stamp-size input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--border, #cbd5e1); }
.lp-block input[type="range"]::-webkit-slider-thumb, .icon-stamp-size input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5.5px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .35); }
.lp-block input[type="range"]::-moz-range-thumb, .icon-stamp-size input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .35); }

.lp-seg button[data-kind="power"].active { background: #d97706; color: #fff; }
.lp-sub { font-weight: 700; font-size: 0.76rem; }
.lp-check { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; font-size: 0.76rem; }
.lp-check input { width: 15px; height: 15px; accent-color: var(--accent); }
#lpNetBlock { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
#lpNetBlock.hidden { display: none; }
.ly-tag-text { font-size: 9px; font-weight: 700; fill: #fff; font-family: 'Segoe UI', system-ui, sans-serif; pointer-events: none; }
.ly-tags { pointer-events: none; }
.canvas-layer-under .ly-wire[stroke-dasharray="1 10"], .canvas-layer-over .ly-wire[stroke-dasharray="1 10"] { stroke-linecap: round; stroke-width: calc(5px * var(--inv-zoom, 1)); }
.lp-check input[type="checkbox"] { -webkit-appearance: checkbox; appearance: auto; width: 16px; height: 16px; padding: 0; margin: 0; background: initial; border: initial; box-shadow: none; flex: none; }
.lp-check { grid-template-columns: none !important; }

/* Stamp editor: selected-item tools readable in dark mode; name tools */
.icon-stamp-sel-title { font-weight: 700; font-size: 0.76rem; flex: 0 0 100%; }
.icon-stamp-sel .name-only { display: none; }
.icon-stamp-sel.is-name .name-only { display: inline-block; }
.icon-stamp-sel.is-name #iconStampDup, .icon-stamp-sel.is-name #iconStampDel { display: none; }
.icon-stamp-canvas .sc-name-hit { cursor: grab; }
body.dark .icon-stamp-sel { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .22); }
body.dark .icon-stamp-sel .icon-stamp-size, body.dark .icon-stamp-sel .icon-stamp-sel-title, body.dark .icon-stamp-sel .stamp-tool-btn { color: #e2e8f0; }
body.dark .icon-stamp-sel .stamp-tool-btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .28); }
body.dark .icon-stamp-sel .stamp-tool-btn--danger { color: #fca5a5; }
body.dark .lp-block input[type="range"]::-webkit-slider-runnable-track, body.dark .icon-stamp-size input[type="range"]::-webkit-slider-runnable-track { background: rgba(203, 213, 225, .55); }
body.dark .lp-block input[type="range"]::-moz-range-track, body.dark .icon-stamp-size input[type="range"]::-moz-range-track { background: rgba(203, 213, 225, .55); }
body.dark .lp-block input[type="range"]::-webkit-slider-thumb, body.dark .icon-stamp-size input[type="range"]::-webkit-slider-thumb { border-color: #0f172a; box-shadow: 0 0 0 1px rgba(255, 255, 255, .6); }

/* Layers button + mini menu in the bottom-right control pill */
.toolbar-group--layers { position: relative; align-items: center; }
#layerToggle.layer-on { color: var(--accent); }
.layer-toggle-label { font-size: 0.74rem; font-weight: 700; margin-left: 4px; }
.layer-toggle-label:empty { display: none; }
.layer-menu { display: none; position: absolute; bottom: calc(100% + 14px); right: 0; min-width: 236px; flex-direction: column; gap: 2px; padding: 6px; border-radius: 14px;
  border: 1px solid var(--panel-border); background: var(--panel); backdrop-filter: blur(var(--panel-blur)) saturate(140%); -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(140%); box-shadow: var(--shadow-md), inset 0 1px 0 var(--panel-highlight); z-index: 40; }
.layer-menu.is-open { display: flex; }
.layer-menu-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.layer-menu-opt:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.layer-menu-opt.active { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.layer-menu-title { font-size: 0.84rem; font-weight: 700; }
.layer-menu-title::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; border: 2px solid currentColor; opacity: .55; vertical-align: 0; }
.layer-menu-opt.active .layer-menu-title::before { background: var(--accent); border-color: var(--accent); opacity: 1; }
.layer-menu-opt--view { margin-top: 4px; border-top: 1px solid var(--panel-border); border-radius: 0 0 10px 10px; padding-top: 10px; }
.layer-menu-opt--view .layer-menu-title::before { border-radius: 3px; }
.layer-menu-opt--view:disabled { opacity: .5; cursor: not-allowed; }
.layer-menu-desc { font-size: 0.72rem; color: var(--text-muted); padding-left: 16px; }
.layer-panel { top: 14px; }

/* Dark mode: layers menu + panel (helper text must stay readable) */
body.dark .layer-menu, body.dark .layer-panel { background: rgba(22, 22, 22, 0.94); border-color: rgba(255, 255, 255, 0.14); color: #e2e8f0; }
body.dark .layer-menu-desc, body.dark .lp-hint, body.dark .lp-block output { color: #cbd5e1; }
body.dark .lp-title, body.dark .lp-sub, body.dark .lp-block label, body.dark .lp-check { color: #f1f5f9; }
body.dark .lp-btn { color: #e2e8f0; border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.06); }
body.dark .lp-btn--danger { color: #fca5a5; }
body.dark .layer-menu-opt:hover { background: rgba(255, 255, 255, 0.08); }
body.dark .layer-menu-opt.active { background: rgba(255, 255, 255, 0.14); }
.lp-block.lp-block--off label { display: none !important; }

/* Connection trails (subcomponent -> parent, package tethers) and hand-drawn analogue links: a thin solid orange line, always visible. */
.canvas .canvas-connector-line, body.dark .canvas .canvas-connector-line { stroke: #ea580c !important; stroke-width: calc(1.2px * var(--inv-zoom, 1)) !important; stroke-opacity: 0.7; stroke-dasharray: none !important; stroke-linecap: round !important; }
.canvas .canvas-connector-halo { stroke-dasharray: none; stroke-width: calc(2.4px * var(--inv-zoom, 1)); stroke-opacity: 0.3; }
.canvas .canvas-connector-dot, body.dark .canvas .canvas-connector-dot { fill: #ea580c; fill-opacity: 0.8; r: calc(2px * var(--inv-zoom, 1)); stroke-width: calc(0.6px * var(--inv-zoom, 1)); }
.canvas-layer-under .ly-wire[stroke-dasharray="1 10"], .canvas-layer-over .ly-wire[stroke-dasharray="1 10"] { stroke-dasharray: none; stroke-linecap: round; stroke-width: calc(1.2px * var(--inv-zoom, 1)); stroke-opacity: 0.7; }
.canvas-layer-under .ly-wire-halo { stroke-width: calc(2.4px * var(--inv-zoom, 1)); stroke-opacity: 0.3; }
.canvas-layer-under .ly-wire-dot { r: calc(2px * var(--inv-zoom, 1)); stroke-width: calc(0.6px * var(--inv-zoom, 1)); fill-opacity: 0.8; }

/* Stamp editor: device-type drop-down with colour dots, canvas controls */
.icon-stamp-field > span { font-size: 0.85rem; }
.stamp-dd { position: relative; }
.stamp-dd-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 1px solid var(--input-border, var(--border)); border-radius: var(--r-sm, 10px); background: var(--input-bg, var(--panel-2)); color: inherit; font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; }
.stamp-dd-btn:hover { border-color: var(--accent); }
.stamp-dd-label { flex: 1; }
.stamp-dd-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1.5px rgba(15, 23, 42, .35); }
.stamp-dd-list { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; margin: 0; padding: 4px; list-style: none; border-radius: 12px; border: 1px solid var(--panel-border, var(--border)); background: var(--panel, #fff); box-shadow: var(--shadow-md, 0 8px 24px rgba(15, 23, 42, .18)); }
.stamp-dd-list.is-open { display: block; }
.stamp-dd-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 0.9rem; cursor: pointer; }
.stamp-dd-opt:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.stamp-dd-opt.active { background: color-mix(in srgb, var(--accent) 20%, transparent); font-weight: 700; }
body.dark .stamp-dd-list { background: rgba(22, 22, 22, 0.97); border-color: rgba(255, 255, 255, 0.14); }
body.dark .stamp-dd-dot { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .4); }
.icon-stamp-canvas { overflow: visible; }
.icon-stamp-canvas .sc-rot, .icon-stamp-canvas .sc-del { cursor: pointer; }
.icon-stamp-canvas .sc-rot { cursor: grab; }
.icon-stamp-canvas .sc-del:hover circle { fill: #fee2e2; }
.icon-stamp-canvas .sc-rot:hover circle { fill: #eff6ff; }

/* Stamp editor snap guides */
.icon-stamp-canvas .sc-guide { stroke: #ec4899; stroke-width: 0.6; stroke-dasharray: 2 1.5; pointer-events: none; }

/* Stamp panel: device type + default mounting elevation side by side */
.icon-stamp-row { display: flex; gap: 10px; align-items: flex-start; }
.icon-stamp-row > .icon-stamp-field { flex: 1 1 0; min-width: 0; }
.icon-stamp-row .icon-stamp-field select { width: 100%; }
.stamp-elev-sel { padding: 9px 12px; border: 1px solid var(--input-border, var(--border)); border-radius: var(--r-sm, 10px); background: var(--input-bg, var(--panel-2)); color: inherit; font: inherit; font-size: 0.9rem; height: auto; box-sizing: border-box; }

/* Same modal height in Device and Stamp view: toggling must never resize the window. */
@media (min-width: 701px) { .new-icon-body { min-height: 580px; } }

/* ── Icon editor, Stamp view: alignment + the symbol library area ─────── */
:root { --stamp-field-bg: #f2f2f2; }
body.dark { --stamp-field-bg: var(--input-bg); }
/* Device type / elevation line up with the Name field: same label type, same 44px controls, top-aligned. */
.icon-stamp-row { align-items: flex-start; gap: 12px; flex-wrap: nowrap; }
.icon-stamp-field { gap: 6px; font-size: 0.875rem; color: var(--text-muted); }
.icon-stamp-field > span { font-size: 0.875rem; }
.icon-stamp-row .stamp-dd-btn, .icon-stamp-row .stamp-elev-sel { box-sizing: border-box; height: 44px; padding: 0 14px; border-radius: 12px; font-size: 0.95rem; background: var(--stamp-field-bg); }
.icon-stamp-row .stamp-elev-sel { margin: 0; }
.icon-stamp-add-head input { background: var(--stamp-field-bg); }
/* Add a symbol: one clearly bounded card that takes all the remaining height; the tiles scroll inside it. */
.icon-stamp-lib { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 10px 4px; border: 1px solid var(--input-border, var(--border)); border-radius: 14px; background: color-mix(in srgb, var(--text, #0f172a) 3%, transparent); }
.icon-stamp-lib .icon-stamp-add-head .stampgen-field-label { margin-top: 0; }
.icon-stamp-lib .icon-stamp-symbols { flex: 1 1 0; min-height: 0; max-height: none; overflow-y: auto; padding-right: 4px; }
.icon-stamp-panel .icon-stamp-derived { margin: 0; flex: none; }
.new-icon-form.icon-stamp-mode .new-icon-body { align-items: stretch; }
.new-icon-form.icon-stamp-mode .new-icon-fields { align-self: stretch; }
.new-icon-form.icon-stamp-mode .icon-details-slot { flex: 1 1 auto; min-height: 0; }

/* Subcomponents keep the mounting elevation drop-down (it sets their stamp border); packages don't. */
.new-icon-form.icon-pkg-stamp #iconTypeToggle,
.new-icon-form.icon-pkg-stamp #iconStampUseImage,
.new-icon-form.icon-pkg-stamp #iconStampDerived { display: none !important; }
/* Subcomponents: the Stamp toggle already means "design a stamp", so no separate link for it. */
.new-icon-form--sub #iconStampDesignBtn { display: none !important; }

/* Package stamp editor shows the default mounting position (it sets the border shape). */
.new-icon-form.icon-pkg-stamp .icon-stamp-elev { display: flex !important; }
.package-mount-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; color: var(--text-muted); margin: 8px 0 0; }

/* Settings: language picker */
/* Language flags: Settings grid (flags/*.svg, round 49x49 artwork) */
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-width: 520px; }
.lang-opt { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; font-size: 0.88rem; cursor: pointer; text-align: left; }
.lang-opt:hover { border-color: var(--accent); }
.lang-opt.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); font-weight: 600; }
.lang-opt img { flex-shrink: 0; border-radius: 50%; }

/* ── About page ──────────────────────────────────────────────────────────── */
.about-list {
  margin: 0 0 16px;
  padding-left: 20px;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.about-list strong { color: var(--text); }

/* ── Network diagram: switch port editor ─────────────────────────────────── */
.nd-ports { margin-top: 10px; font-size: 13px; }
.nd-ports > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.nd-ports-hint { margin: 4px 0 8px; color: var(--text-muted); font-size: 12px; }
#netPortsBody { max-height: clamp(300px, 58vh, 700px); overflow: auto; border: 1px solid var(--border, #d0d7de); border-radius: 8px; }
.nd-ports.hidden, .nd-viewer.hidden { display: none; }
.nd-pe-table { width: 100%; border-collapse: collapse; }
.nd-pe-table th, .nd-pe-table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--panel-border); }
.nd-pe-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.nd-pe-table select { width: auto; display: inline-block; padding: 3px 6px; font-size: 12px; }
.nd-pe-nic { font-size: 11px; color: var(--text-muted); }
.nd-pe-auto { font-size: 11px; background: none; border: 1px solid var(--panel-border); border-radius: 6px; padding: 2px 8px; cursor: pointer; color: inherit; }

/* ── 3D view ─────────────────────────────────────────────────────────────── */
.v3-content { max-width: min(1200px, 96vw); width: 96vw; }
.v3-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; margin: 4px 0 10px; font-size: 13px; }
.v3-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.v3-field > span { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; color: var(--text); }
.v3-field select, .v3-field input[type="number"] { width: auto; padding: 4px 8px; font-size: 13px; }
.v3-field input[type="number"] { width: 72px; }
.v3-scale-info { color: var(--text-muted); }
.v3-btn { flex: 0 0 auto; width: auto; white-space: nowrap; padding: 6px 12px; }
.v3-checks { display: flex; gap: 14px; margin-left: auto; font-size: 13px; }
.v3-checks label { display: inline-flex; align-items: center; gap: 5px; }
.v3-stage { position: relative; height: min(62vh, 640px); border: 1px solid var(--panel-border); border-radius: 10px; overflow: hidden; background: #eef2f7; }
.v3-stage canvas { display: block; touch-action: none; }
.v3-tip { position: absolute; z-index: 2; pointer-events: none; padding: 4px 8px; border-radius: 6px; background: rgba(15, 23, 42, 0.9); color: #fff; font-size: 12px; white-space: nowrap; }
.v3-tip.hidden { display: none; }
.v3-status { margin: 6px 0 0; min-height: 1em; font-size: 12px; color: #92400e; }
.v3-hint { font-size: 12px; color: var(--text-muted); }
.v3-cal-banner { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3000; max-width: 90vw; padding: 10px 16px; border-radius: 10px; background: #e11d48; color: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.v3-cal-svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 50; }
body.dark .v3-stage { border-color: var(--panel-border); }
@media (max-width: 768px) { .layer-menu-opt--3d { display: none; } }
.v3-checks input[type="checkbox"] { -webkit-appearance: checkbox; appearance: auto; accent-color: var(--accent); width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; background: initial; border: initial; box-shadow: none; flex: none; }
.v3-checks label { white-space: nowrap; }
.v3-ovl { position: absolute; transform: translate(-50%, -50%); pointer-events: none; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(15, 23, 42, 0.55)); display: none; }
/* Light mode: the layers menu and panel were see-through over the floorplan, which made the text hard to read. */
body:not(.dark) .layer-menu, body:not(.dark) .layer-panel { background: rgba(255, 255, 255, 0.98); color: #0f172a; border-color: rgba(15, 23, 42, 0.16); box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22); }
body:not(.dark) .layer-menu-desc { color: #475569; }

/* ── Room scan card + aligner ────────────────────────────────────────────── */
.rd-scan { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--panel-border); border-radius: 12px; }
.rd-scan-head { display: flex; align-items: center; gap: 8px; }
.rd-scan-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.rd-scan-state { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.rd-scan-state.ok { background: #dcfce7; color: #166534; }
.rd-scan-state.warn { background: #fef3c7; color: #92400e; }
.rd-scan-desc { margin: 6px 0 8px; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.rd-scan-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.rd-scan-actions button { width: auto; flex: 0 0 auto; padding: 5px 12px; font-size: 12.5px; }
.sa-content { max-width: min(1160px, 96vw); width: 96vw; }
.sa-hint { margin: 4px 0 10px; font-size: 13px; font-weight: 600; color: var(--text); min-height: 1.3em; }
.sa-panes { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.sa-pane-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 4px; }
.sa-stage { position: relative; width: 520px; height: 420px; border: 1px solid var(--panel-border); border-radius: 10px; overflow: hidden; background: #eef2f7; cursor: crosshair; }
.sa-stage canvas { display: block; width: 520px; height: 420px; }
.sa-dot { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); pointer-events: none; }
.sa-up { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.sa-up select { width: auto; padding: 3px 6px; font-size: 12px; }

/* Room photos: the "add photo" placeholder is a slim full-width bar instead of a photo-sized square. */
.room-photo-dropzone { grid-column: 1 / -1; aspect-ratio: auto; flex-direction: row; min-height: 0; height: 56px; gap: 10px; padding: 0 14px; }
.room-photo-dropzone svg { width: 22px; height: 22px; }
.room-photo-dropzone-sub { margin-left: 2px; }

/* Page rotation: toolbar group (desktop) and the small rotate button on New/Edit Project page thumbnails. */
@media (max-width: 768px) { .toolbar-group--rotate { display: none !important; } }
.pdf-page-thumb { position: relative; }
.pdf-page-thumb-rotate {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(15, 23, 42, 0.78); color: #fff; cursor: pointer; z-index: 2;
  opacity: 0; transition: opacity 0.12s;
}
.pdf-page-thumb:hover .pdf-page-thumb-rotate, .pdf-page-thumb-rotate:focus-visible { opacity: 1; }
.pdf-page-thumb-rotate svg { width: 14px; height: 14px; }
@media (hover: none) { .pdf-page-thumb-rotate { opacity: 1; } }
.pdf-page-thumb-canvas { transition: transform 0.15s; }

/* Only admin accounts can delete projects. */
.project-delete-btn.hidden { display: none; }

/* ── SimCapture-style top bar (desktop) ─────────────────────────────────────
   Flat near-black bar edge to edge with a blue strip under it, matching the
   SimCapture web GUI; the active tab is a lighter block. Same bar in light and
   dark mode. Mobile keeps its bottom tab bar. Tokens: --topbar-bg, --accent. */
.nav-brand { display: none; }
@media (min-width: 769px) {
  .app-shell { padding-top: 0; }
  .top-nav {
    width: 100vw;
    margin: 0 0 20px calc(50% - 50vw);
    padding: 0 20px;
    min-height: 54px;
    border-radius: 0;
    background: var(--topbar-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
    border-bottom: 3px solid var(--accent);
    box-shadow: none;
  }
  .nav-left { gap: 22px; }
  .nav-brand {
    display: block;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.08rem;
    letter-spacing: 0.2px;
    white-space: nowrap;
  }
  .nav-brand span { color: var(--accent); }
  .nav-tabs-slide { gap: 2px; align-self: stretch; }
  .nav-indicator {
    border-radius: 0;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: none;
  }
  body .top-nav .nav-link {
    color: #d2d2d2;
    border-radius: 0;
    min-height: 54px;
    padding: 0 16px;
    font-size: 0.9rem;
  }
  body .top-nav .nav-link:hover { color: #ffffff; background: rgba(255, 255, 255, 0.07); }
  body .top-nav .nav-link.active { color: #ffffff; background: transparent; }
  .top-nav .profile-dropdown-trigger { color: #ffffff; }
  .top-nav .profile-dropdown-trigger:hover { background: rgba(255, 255, 255, 0.10); }
  .top-nav #userName { color: #ffffff; }
  .top-nav .view-only-badge { color: #ffffff; }
}

/* Point of Contact block in the New/Edit Project modal (reuses .report-poc-fields). */
.project-poc { margin-top: 14px; }
.project-poc .report-poc-fields { margin-top: 6px; font-weight: 400; }
.project-poc-opt { font-weight: 400; font-size: 0.75rem; color: var(--text-faint); margin-left: 4px; }

/* Selection bar, side columns: Coverage on the left, mounting elevation stacked on the right
   (delete stays in .canvas-hud-bar underneath). */
.canvas-hud-col {
  position: absolute; top: 50%; display: flex; flex-direction: column; gap: 2px; padding: 3px;
  border-radius: 16px; white-space: nowrap; pointer-events: all;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.canvas-hud-col--right { transform: translateY(-50%); }
.canvas-hud-col--left { transform: translate(-100%, -50%) scale(calc(var(--hs, 1) * var(--inv-zoom, 1))); transform-origin: right center; }
.canvas-hud-col .canvas-hud-seg { justify-content: flex-start; }
.lp-block label.lp-check { grid-template-columns: auto 1fr !important; justify-content: start; }

/* Network diagram viewer (fits the modal; zoom/pan instead of scrollbars) */
.nd-viewer { position: relative; }
.nd-viewport { height: clamp(300px, 58vh, 700px); overflow: hidden; border: 1px solid var(--border, #d0d7de); border-radius: 8px; background: #fff; cursor: grab; user-select: none; -webkit-user-select: none; }
.nd-viewport.is-panning { cursor: grabbing; }
.nd-zoom { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.nd-zoom button { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border: 1px solid var(--border, #d0d7de); border-radius: 8px; background: rgba(255, 255, 255, 0.95); color: #0f172a; font-size: 18px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18); }
.nd-zoom button:hover { background: #e8f6fd; border-color: var(--accent); }
.nd-viewer-hint { margin: 4px 0 0; font-size: 0.72rem; color: var(--text-muted); text-align: right; }

/* ── 3D view toolbar (2026-10-20): toggle chips, ceiling field, ft/m switch, slim scale chip ───────── */
.v3-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 2px 0 10px; }
.v3-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.v3-group--end { gap: 8px; }
.v3-toolbar svg, .v3-foot svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.v3-chip { position: relative; display: inline-flex; cursor: pointer; }
.v3-chip.hidden { display: none; }
.v3-chip input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.v3-chip-face { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text-muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.v3-chip:hover .v3-chip-face { border-color: var(--accent); color: var(--text); }
.v3-chip input:checked + .v3-chip-face { background: var(--accent); border-color: var(--accent); color: #fff; }
.v3-chip input:focus-visible + .v3-chip-face { outline: 2px solid var(--accent); outline-offset: 2px; }
.v3-ceil { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text-muted); font-size: 12.5px; }
.v3-ceil select, .v3-ceil input { height: 24px; min-height: 0; width: auto; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-weight: 600; box-shadow: none; }
.v3-ceil select { max-width: 150px; cursor: pointer; }
.v3-ceil input { width: 52px; text-align: right; background: var(--panel-2); }
.v3-ceil input:focus, .v3-ceil select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.v3-unit { font-weight: 600; color: var(--text-muted); }
.v3-seg { display: inline-flex; height: 30px; padding: 2px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); }
.v3-seg button { min-width: 34px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.v3-seg button.active { background: var(--accent); color: #fff; }
.v3-seg button:disabled { opacity: 0.5; cursor: not-allowed; }
.v3-scale { display: inline-flex; align-items: center; gap: 4px; }
.v3-scale-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--panel-2); color: var(--text-muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.v3-scale-chip.is-unset { background: #fef3c7; color: #92400e; }
body.dark .v3-scale-chip.is-unset { background: rgba(251, 191, 36, 0.16); color: #fbbf24; }
.v3-ghost, .v3-solid { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; width: auto; flex: 0 0 auto; }
.v3-ghost { border: 1px solid var(--border); background: transparent; color: var(--text); }
.v3-ghost:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.v3-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.v3-solid { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.v3-solid:hover { filter: brightness(1.06); }
.v3-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.v3-foot-btns { display: flex; gap: 6px; }
.v3-hint { font-size: 11.5px; color: var(--text-faint); letter-spacing: 0.01em; }

/* 3D view: scale distance dialog */
#v3ScaleModal { z-index: 3100; }
.v3-scale-card { max-width: 380px; width: 92vw; padding: 20px 22px 18px; }
.v3-scale-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.v3-scale-help { margin: 0 0 14px; font-size: 0.82rem; color: var(--text-muted); }
.v3-dist { display: flex; gap: 12px; }
.v3-dist label { flex: 1; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px; border: 1px solid var(--input-border); border-radius: 12px; background: var(--input-bg); }
.v3-dist label:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.v3-dist input { flex: 1; min-width: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; box-shadow: none; outline: none; font-size: 1.1rem; font-weight: 600; text-align: right; color: var(--text); }
.v3-dist span { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.v3-dist-err { margin: 8px 0 0; font-size: 0.8rem; font-weight: 600; color: var(--danger); }
.v3-dist-err.hidden { display: none; }
.v3-scale-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Layers menu (2026-10-20): one compact row per option (descriptions are hover tooltips), the Device
   switch on top, the 3D viewer set apart at the bottom. */
.layer-menu { min-width: 168px; }
.layer-menu-opt { flex-direction: row; align-items: center; padding: 8px 12px; }
.layer-menu-opt--view { margin: 0 0 4px; padding: 8px 12px 10px; border-top: 0; border-bottom: 1px solid var(--panel-border); border-radius: 10px 10px 0 0; }
.layer-menu-opt--3d { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--panel-border); border-radius: 0 0 10px 10px; }
.layer-menu-opt--3d .layer-menu-title::before { display: none; }
.layer-menu-opt--3d .layer-menu-title::after { content: '\2197'; margin-left: 6px; opacity: .55; }
body.dark .layer-menu-opt--view, body.dark .layer-menu-opt--3d { border-color: rgba(255, 255, 255, 0.14); }

/* Package stamp: devices list on the selection bar's left side (drag one out onto the plan). */
.canvas-hud-pkg-item { display: flex; align-items: center; gap: 6px; max-width: 150px; padding: 3px 8px 3px 4px; border-radius: 12px; color: #0f172a; font-size: 11px; font-weight: 600; cursor: grab; user-select: none; -webkit-user-select: none; }
.canvas-hud-pkg-item:hover { background: #e8f6fd; }
.canvas-hud-pkg-item img { width: 24px; height: 24px; object-fit: contain; flex: none; border-radius: 4px; background: #e5e7eb; pointer-events: none; }
.canvas-hud-pkg-item span { overflow: hidden; text-overflow: ellipsis; }
.canvas-hud-pkg-empty { padding: 4px 10px; font-size: 11px; color: #64748b; }
.canvas-hud-pkg-ghost { position: fixed; z-index: 9999; width: 44px; height: 44px; object-fit: contain; transform: translate(-50%, -50%); pointer-events: none; opacity: 0.85; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35)); }

/* Package modal laid out like the icon editor: stamp picture left, details + icon picker right. */
.new-package-modal-card { max-width: 860px; }
.new-icon-form.new-package-form { padding: 0; gap: 0; }
.new-package-body .package-stamp-dropzone { width: 240px; height: 240px; }
.new-package-body .new-package-icons-label { line-height: 1.35; }
.new-package-body .new-icon-left-col .new-package-icons-label { font-size: 0.78rem; }
.new-package-body .new-package-dnd-columns { height: 260px; min-height: 200px; }
.new-package-body .new-icon-fields .package-mount-field { margin: 0; }
.new-package-form .modal-actions { padding: 14px 28px 20px; }
@media (max-width: 560px) { .new-package-body .package-stamp-dropzone { width: 100%; height: 160px; } }

.project-signoff-list .signoff-notes-view { flex: 0 0 100%; }
.project-signoff-list .signoff-notes-view summary { cursor: pointer; font-weight: 600; }

/* ── New/Edit Project modal: site-details card laid out like the Report page ── */
.project-site-card { margin: 14px 0 6px; padding: 16px; box-shadow: none; }
.project-site-card .project-address-field { background: var(--panel); border-color: var(--border); }
.project-site-card .report-top-col.report-top-map { display: flex; flex-direction: column; }
.project-site-card .project-location-card { margin-top: 0; }
.project-site-card .project-poc-opt { text-transform: none; letter-spacing: 0; }
.project-map-empty {
  display: none; align-items: center; justify-content: center; text-align: center;
  min-height: 220px; padding: 16px; border: 1px dashed var(--border); border-radius: var(--r-md);
  font-size: 0.8rem; color: var(--text-muted);
}
#projectMapEmbed.hidden + .project-map-empty { display: flex; }
/* Phase + its buttons sit at the bottom, above Create / Save. */
.project-phase-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--panel-border); }
.project-phase-block select { max-width: 280px; }
.project-phase-block .project-phase-extra { margin: 8px 0 0; }
.project-phase-block > label { display: flex; flex-direction: column; gap: 6px; }

/* Right-click menu on a placed icon (delete / elevation / coverage / connections) */
.item-ctx-menu {
  position: fixed; z-index: 10000; min-width: 168px; padding: 4px;
  background: #fff; color: #1f2937; border: 1px solid #d1d5db; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22); font-size: 0.82rem;
}
.item-ctx-head { padding: 4px 8px 2px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #6b7280; }
.item-ctx-sep { height: 1px; margin: 4px 2px; background: #e5e7eb; }
.item-ctx-opt {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  background: none; border: none; border-radius: 5px; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.item-ctx-opt:hover { background: rgba(63, 185, 232,0.14); }
.item-ctx-opt.active { background: #3fb9e8; color: #fff; }
.item-ctx-opt.danger { color: #dc2626; }
.item-ctx-opt.danger:hover { background: rgba(220,38,38,0.12); }
body.dark .item-ctx-menu { background: #1f2937; color: #e5e7eb; border-color: #374151; }
body.dark .item-ctx-head { color: #9ca3af; }
body.dark .item-ctx-sep { background: #374151; }
body.dark .item-ctx-opt.danger { color: #f87171; }


/* Reorderable icon groups (press and hold a header, then drag) */
.icon-group-header { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#iconLibrary.reordering { cursor: grabbing; }
#iconLibrary.reordering .icon-group-list { display: none; }
#iconLibrary.reordering .icon-group-header { cursor: grabbing; }
.icon-group--dragging { opacity: 0.92; position: relative; z-index: 5; box-shadow: 0 6px 18px rgba(0,0,0,0.35); border-radius: 10px; outline: 2px solid var(--accent, #3fb9e8); }

/* Report page: ready-for-install tick + required note under each room row */
.rrr-install { margin-top: 8px; flex: 1 1 100%; display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 8px 14px; }
.rrr-install-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 600; cursor: pointer; width: fit-content; flex: 0 0 auto; padding-top: 0; white-space: nowrap; margin-left: 4px; }
.rrr-install-check input.rrr-install-cb { -webkit-appearance: checkbox; appearance: auto; width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 0; border-radius: 3px; background: none; accent-color: #16a34a; cursor: pointer; flex: 0 0 auto; }
.rrr-install-check--off { opacity: 0.6; cursor: not-allowed; }
.rrr-install-check--off input.rrr-install-cb { cursor: not-allowed; }
.rrr-install-note { flex: 1 1 100%; min-width: 0; box-sizing: border-box; font: inherit; font-size: 0.82rem; padding: 6px 8px; border: 1px solid var(--border, #cfcfcf); border-radius: 6px; background: var(--panel-solid, #fff); color: inherit; resize: vertical; }
.rrr-install-note--missing { border-color: #d98a1b; box-shadow: 0 0 0 1px rgba(217,138,27,.35); }
body.dark .rrr-install-note { background: rgba(255,255,255,.05); }

/* Room rows: summary (name, stats, ready tick + note) on top, the photo strip underneath, rows separated by a rule */
.report-room-row { align-items: stretch; padding: 12px 10px; border-top: 1px solid var(--border, #dddddd); }
.report-room-row:first-child { border-top: none; }
.report-room-row-main { flex: 1 1 100%; }
.report-room-row-photos { flex: 1 1 100%; margin-top: 2px; padding-bottom: 2px; }
.report-room-row-thumb { width: 72px; height: 54px; }
.report-room-row-more { width: 54px; height: 54px; }

.rrr-install-note { margin-top: 2px; }

/* Room disposition pill (a select styled as a status pill) */
.rrr-disp-wrap { display: inline-flex; align-items: center; gap: 6px; }
.rrr-disp { -webkit-appearance: none; appearance: none; font: inherit; font-size: 0.75rem; font-weight: 700; border: 1px solid transparent; border-radius: 20px; padding: 3px 26px 3px 12px; cursor: pointer; min-width: 150px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.rrr-disp:disabled { cursor: not-allowed; opacity: 0.85; }
.rrr-disp--unset { color: #6b7a8d; background-color: transparent; border: 1px dashed #9aa5b4; }
.rrr-disp--ready { color: #16a34a; background-color: rgba(34, 197, 94, 0.14); }
.rrr-disp--followup { color: #b45309; background-color: rgba(245, 158, 11, 0.16); }
body.dark .rrr-disp--followup { color: #fbbf24; }
.rrr-disp--not-ready { color: #dc2626; background-color: rgba(239, 68, 68, 0.14); }
body.dark .rrr-disp--ready { color: #4ade80; }
body.dark .rrr-disp--not-ready { color: #f87171; }
body.dark .rrr-disp--unset { color: #aab4c3; border-color: #667085; }
.rrr-disp option { color: #222; background: #fff; }
body.dark .rrr-disp option { color: #eee; background: #2a2a2a; }

/* Match the disposition pill's height to the stat pills beside it */
.rrr-disp { box-sizing: border-box; height: 22px; padding: 0 26px 0 10px; line-height: 20px; min-width: 140px; }
.rrr-disp-wrap { display: flex; align-self: center; line-height: 0; }
.rrr-disp { height: 19px; line-height: 17px; padding-top: 0; padding-bottom: 0; margin: 0; vertical-align: middle; }

/* Room notes + edit pencil in the Report page room rows */
.report-room-row-notes-wrap { display: inline-flex; align-items: center; gap: 4px; min-width: 0; flex: 1 1 200px; }
.report-room-row-notes-wrap--editing { flex: 1 1 100%; }
.rrr-notes-edit { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: none; border-radius: 6px; background: transparent; color: var(--text-muted, #888); cursor: pointer; }
.rrr-notes-edit:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.rrr-notes-textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 0.82rem; padding: 6px 8px; border: 1px solid var(--accent); border-radius: 6px; background: var(--panel-solid, #fff); color: inherit; resize: vertical; }
body.dark .rrr-notes-textarea { background: rgba(255,255,255,.05); }

/* ── Phase tracker (Projects table): diagonal-cut steps, done = green, current = animated blue, to come = grey ── */
.phase-track { display: flex; gap: 3px; width: 100%; max-width: 360px; --cut: 7px; }
.phase-step { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.phase-step-bar { display: block; height: 10px; background: #b5b9bd;
  clip-path: polygon(var(--cut) 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%); }
.phase-step-bar.is-first { clip-path: polygon(0 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%); border-radius: 5px 0 0 5px; }
.phase-step-bar.is-last { clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, 0 100%); border-radius: 0 5px 5px 0; }
body.dark .phase-step--todo .phase-step-bar { background: #4a4d50; }
.phase-step--done .phase-step-bar { background: #2fb36b; }
.phase-step--current .phase-step-bar { background: #3fb9e8; }
.phase-step-label .l-abbr { display: none; }
.phase-step-label { font-size: 0.68rem; line-height: 1.1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted, #777); }
.phase-step--done .phase-step-label { color: #23915a; }
.phase-step--current .phase-step-label { color: var(--text, #222); font-weight: 600; }
body.dark .phase-step--done .phase-step-label { color: #5fd49b; }
body.dark .phase-step--current .phase-step-label { color: #fff; }
@media (max-width: 720px) {
  .phase-track { max-width: 200px; }
  .phase-step-label .l-full { display: none; }
  .phase-step-label .l-abbr { display: inline; }
}

.phase-review-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; white-space: nowrap; background: #fff4d6; color: #8a5a00; border: 1px solid #f0c75e; }
body.dark .phase-review-tag { background: rgba(240,199,94,.16); color: #f3cf74; border-color: rgba(240,199,94,.4); }
@media (max-width: 720px) { .phase-review-tag { margin-left: 6px; } }

/* ── Scope + Support pages ── */
.scope-placeholder { padding: 28px; }
.scope-placeholder-title { font-weight: 600; margin-bottom: 6px; }
.scope-placeholder p { margin: 0; color: var(--text-muted, #777); }
.sup-card, .sup-room { padding: 16px 18px; margin-bottom: 14px; }
.sup-heading { margin: 0 0 10px; font-size: 1rem; }
.sup-heading--rooms { margin: 20px 0 10px; }
.sup-empty { margin: 4px 0; color: var(--text-muted, #777); font-size: 0.85rem; }
.sup-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.sup-table th { text-align: left; font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #777); padding: 4px 8px; }
.sup-table td { padding: 5px 8px; border-top: 1px solid var(--border, #ddd); vertical-align: middle; }
.sup-table tfoot td { font-weight: 600; }
.sup-table td:first-child, .sup-table th:first-child { width: 44px; }
.sup-num { text-align: right !important; white-space: nowrap; }
.sup-sub td { color: var(--text-muted, #666); }
.sup-room-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.sup-room-name { font-weight: 600; font-size: 1rem; }
.sup-status--ready { background: #2fb36b; color: #fff; }
.sup-status--not_ready { background: #d9534f; color: #fff; }
.sup-status--unset { background: #9aa0a6; color: #fff; }
.sup-sublabel { margin: 12px 0 4px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #777); }
.sup-notes { margin-top: 10px; font-size: 0.85rem; white-space: pre-wrap; }
.sup-notes .sup-sublabel { margin-top: 0; }
.sup-notes--warn { color: #a35a00; }
body.dark .sup-notes--warn { color: #f0b35c; }
.sup-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.sup-photo { margin: 0; }
.sup-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; cursor: zoom-in; display: block; }
.sup-photo figcaption { margin-top: 3px; font-size: 0.75rem; color: var(--text-muted, #777); }

/* SimCapture icon set: filled paths in currentColor -- never inherit an ancestor's stroke styling */
svg path[fill="currentColor"] { stroke: none; }

/* "Loading project…" bar shown while a project's data and pages are fetched */
.project-loading-bar { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 4000; padding: 8px 18px; border-radius: 999px; background: #262626; color: #fff; font-size: 0.85rem; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.project-loading-bar.hidden { display: none; }
@media (max-width: 768px) { .project-loading-bar { top: 12px; } }

/* iOS Safari zooms the whole page in when a field under 16px gets focus and never zooms back out.
   On touch devices every text field is therefore at least 16px, so focusing one doesn't zoom. */
@media (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Survey page room cards: photos + comments under each room's data drops */
.survey-row--empty { cursor: default; color: var(--text-muted); font-style: italic; }
.sv-photos { padding: 10px 14px 14px; border-top: 1px solid var(--panel-border); }
.sv-photos-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.sv-photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sv-photo { position: relative; display: flex; flex-direction: column; gap: 6px; }
.sv-photo-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); cursor: pointer; background: var(--panel-2); }
.sv-photo--uploading .sv-photo-img { opacity: 0.5; }
.sv-photo-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: none; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 0.8rem; cursor: pointer; line-height: 1; }
.sv-photo-caption { width: 100%; resize: vertical; min-height: 44px; }
.sv-photos-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
@media (max-width: 480px) { .sv-photos-grid { grid-template-columns: repeat(2, 1fr); } .sv-photos-add-btn { flex: 1 1 140px; } }

.sv-notes { padding: 10px 14px 0; border-top: 1px solid var(--panel-border); }
.sv-room-notes { width: 100%; resize: vertical; min-height: 64px; margin-top: 6px; }
.sv-notes + .sv-photos { border-top: none; padding-top: 12px; }

/* Scope of Work import (project modal + Scope tab) */
.scope-import-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -2px 0 12px; }
.scope-import-status { font-size: 0.8rem; color: var(--text-muted, #777); flex: 1 1 220px; line-height: 1.35; }
.scope-import-status--bad { color: #dc2626; }
.scope-toolbar { margin: 0 0 14px; }
.scope-card { padding: 16px 18px; margin-bottom: 12px; }
.scope-card-title { font-weight: 700; margin-bottom: 10px; }
.scope-row { display: flex; gap: 14px; padding: 5px 0; border-top: 1px solid var(--border, #ddd); font-size: 0.9rem; }
.scope-card-title + .scope-row { border-top: 0; }
.scope-label { flex: 0 0 210px; color: var(--text-muted, #777); }
.scope-value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.scope-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 4px 0 8px; }
.scope-table th, .scope-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border, #ddd); }
.scope-table th { color: var(--text-muted, #777); font-weight: 600; }
.scope-notes { font-size: 0.9rem; line-height: 1.5; overflow-wrap: anywhere; }
.scope-imported { font-size: 0.78rem; color: var(--text-muted, #777); margin: 6px 2px; }
@media (max-width: 600px) { .scope-row { flex-direction: column; gap: 2px; } .scope-label { flex: none; } .scope-table { display: block; overflow-x: auto; } }

/* Other people on the floorplan: their pointer, and a pulse on what they just changed */
.remote-cursor-layer { position: absolute; inset: 0; pointer-events: none; z-index: 55; }
.remote-cursor { position: absolute; left: 0; top: 0; transition: transform 1.4s linear; will-change: transform; }
.remote-cursor-inner { transform-origin: 0 0; transform: scale(var(--inv-zoom, 1)); display: flex; align-items: flex-start; gap: 2px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.remote-cursor-name { margin-top: 14px; padding: 1px 6px; border-radius: 4px; background: var(--rc, #2563eb); color: #fff; font-size: 11px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.canvas-item.remote-edit { animation: remote-edit-pulse 1.1s ease-out 3; }
.room-bounds.remote-edit { animation: remote-edit-room 1.1s ease-out 3; }
@keyframes remote-edit-pulse { 0% { filter: drop-shadow(0 0 0 rgba(63,185,232,0)); } 40% { filter: drop-shadow(0 0 10px rgba(63,185,232,1)) drop-shadow(0 0 4px rgba(63,185,232,1)); } 100% { filter: drop-shadow(0 0 0 rgba(63,185,232,0)); } }
@keyframes remote-edit-room { 0% { box-shadow: 0 0 0 0 rgba(63,185,232,.0); } 40% { box-shadow: 0 0 0 4px rgba(63,185,232,.75); } 100% { box-shadow: 0 0 0 0 rgba(63,185,232,0); } }
.remote-edit-ghost { position: absolute; border: 2px dashed rgba(220, 38, 38, .85); border-radius: 50%; background: rgba(220, 38, 38, .12); animation: remote-ghost-fade 2s ease-out forwards; }
@keyframes remote-ghost-fade { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }
.remote-edit-toast { position: absolute; left: 50%; bottom: 74px; transform: translate(-50%, 8px); max-width: 80%; padding: 7px 14px; border-radius: 999px; background: #262626; color: #fff; font-size: 0.82rem; font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 70; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.remote-edit-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .remote-cursor { transition: none; } .canvas-item.remote-edit, .room-bounds.remote-edit { animation: none; outline: 3px solid rgba(63,185,232,.9); } }

/* ── Report page: PDF module toggles (Survey / Floorplan / Network) ── */
.report-modules {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 4px 8px 4px 12px; border: 1px solid var(--border, var(--panel-border, #ccc)); border-radius: var(--r-md, 8px);
  background: var(--panel, transparent);
}
.report-modules-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.report-mod {
  display: inline-flex; align-items: center; gap: 0; white-space: nowrap; cursor: pointer;
  padding: 6px 12px; border-radius: var(--r-sm, 6px); border: 1px solid var(--border, #ccc);
  background: transparent; color: inherit; font: inherit; font-size: 0.82rem; font-weight: 600;
}
.report-mod:hover { border-color: var(--accent-ring); color: var(--accent-text); background: var(--accent-soft); }
.report-mod.is-on, .report-mod[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.report-mod.is-on:hover, .report-mod[aria-pressed="true"]:hover { background: var(--accent); color: #fff; filter: brightness(0.95); }
.report-mod svg { fill: currentColor; width: 16px; height: 16px; margin-right: 5px; flex: none; }
.report-mod-group { display: inline-flex; align-items: center; gap: 4px; }
.report-mod-link { background: none; border: 0; padding: 0 2px; cursor: pointer; font: inherit; font-size: 0.72rem; color: var(--accent-text); text-decoration: underline; white-space: nowrap; }
.report-mod-link:hover { filter: brightness(1.15); }
@media (max-width: 520px) { .report-modules { width: 100%; justify-content: flex-start; } }

/* Survey submit footer */
.survey-submit-bar { margin: 16px 0 32px; }
.survey-submit { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel); }
.survey-submit-text { font-size: 0.9rem; color: var(--text-muted, inherit); flex: 1 1 260px; }
.survey-submit--done { border-color: #16a34a; background: rgba(22, 163, 74, 0.08); }
.survey-submit--done .survey-submit-text { color: inherit; }
#surveyPage.survey-submitted .survey-q-answer, #surveyPage.survey-submitted .survey-row { opacity: 0.85; }

/* Descriptive hover tooltip (data-tip) */
#ffTip { position: fixed; z-index: 100000; max-width: 260px; padding: 8px 11px; border-radius: 6px; background: #262626; color: #f2f2f2; font-size: 12px; line-height: 1.4; box-shadow: 0 6px 18px rgba(0,0,0,.35); pointer-events: none; }
#ffTip[hidden] { display: none; }
#ffTip .ff-tip-head { font-weight: 600; font-size: 12.5px; color: #fff; }
#ffTip .ff-tip-body { margin-top: 2px; color: #d6d6d6; }
#ffTip .ff-tip-now { margin-top: 5px; padding-top: 5px; border-top: 1px solid rgba(255,255,255,.18); color: #7fd3f2; font-weight: 600; }

/* Survey room card: tags + disposition under the room header */
.sv-room-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--panel-border); }
.sv-room-status .rrr-install-note { flex: 1 1 100%; }

/* Icons page: drag a device/subcomponent onto the other group to move it */
.icon-manager-drop--over { outline: 2px dashed var(--accent); outline-offset: 2px; background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: var(--r-sm, 8px); }
.icon-manager-subgrid .library-item[draggable="true"] { cursor: grab; }
.icon-manager-subgrid .library-item.dragging { opacity: 0.4; }

/* Survey drop rows: AC Power / Dante tags beside the device name */
.survey-row-tag { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.survey-row-tag svg { width: 12px; height: 12px; }
.survey-row-tag--ac { color: #b45309; background: rgba(251, 191, 36, 0.18); }
body.dark .survey-row-tag--ac { color: #fbbf24; }
.survey-row .survey-row-tag--dante { flex-shrink: 0; }

.sv-room-notes--missing { border-color: #d98a1b; box-shadow: 0 0 0 1px rgba(217,138,27,.35); }

/* Icons page: last tile of each section is a dashed "add new" placeholder */
.library-item--add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 108px; cursor: pointer; border: 2px dashed var(--border); background: transparent; color: var(--text-muted); }
.library-item--add:hover, .library-item--add:focus-visible { border-color: var(--accent); color: var(--accent-text, var(--accent)); outline: none; }
.library-item--add .icon-add-plus { width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 300; line-height: 1; }
.library-item--add .icon-name { color: inherit; }

/* Marker mode of the icon editor: just picture, name and description. */
.new-icon-form--marker #iconTypeToggle,
.new-icon-form--marker .icon-details-wrap .new-icon-fields-row,
.new-icon-form--marker .icon-details-wrap .controls-grid { display: none !important; }

/* Marker editor */
.mk-card { width: min(980px, 96vw); max-width: 980px; max-height: 94vh; display: flex; flex-direction: column; }
.mk-body { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 22px; padding: 18px 22px; overflow-y: auto; min-height: 0; }
.mk-left { display: flex; flex-direction: column; gap: 10px; }
.mk-canvas-wrap { aspect-ratio: 1; width: 100%; border: 1px solid var(--border); border-radius: var(--r-md, 12px);
  background-color: #fff; background-image: linear-gradient(45deg, #eef1f5 25%, transparent 25%, transparent 75%, #eef1f5 75%), linear-gradient(45deg, #eef1f5 25%, transparent 25%, transparent 75%, #eef1f5 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px; overflow: hidden; }
.mk-canvas { width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.mk-canvas .mk-item { cursor: move; }
.mk-canvas .mk-handle { cursor: nwse-resize; } .mk-canvas .mk-rot, .mk-canvas .mk-del { cursor: pointer; }
.mk-hint { margin: 0; font-size: 0.72rem; color: var(--text-muted); }
.mk-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mk-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.mk-field input[type="text"], .mk-field textarea { font-weight: 400; }
.mk-label { font-size: 0.72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.mk-shapes { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-shape { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0; }
.mk-shape:hover { border-color: var(--accent); color: var(--text); }
.mk-shape.active { border-color: var(--accent); color: var(--accent-text, var(--accent)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.mk-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mk-color { display: inline-flex; align-items: center; gap: 8px; }
.mk-color input[type="color"] { -webkit-appearance: none; appearance: none; width: 40px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; flex: none; }
.mk-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; } .mk-color input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
.mk-color input[type="text"] { width: 96px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: lowercase; }
.mk-color input:disabled { opacity: .4; cursor: not-allowed; }
.mk-hex-bad { border-color: #dc2626 !important; }
.mk-check, .mk-bold { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 0.8rem; }
.mk-check input, .mk-bold input { width: auto; }
.mk-size { display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.mk-size input[type="range"] { width: 120px; }
.mk-add-row { flex-direction: row; align-items: center; gap: 10px; }
.mk-add-row .mk-label { flex: 1; }
.mk-count { font-size: 0.74rem; color: var(--text-muted); font-weight: 600; }
.mk-symbols-panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.mk-symbols { max-height: 220px; overflow-y: auto; padding-right: 4px; }
.mk-sel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2, transparent); }
.mk-sel.hidden { display: none; }
.mk-sel-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.mk-sel-text { flex: 1 1 100%; }
.mk-color--sm input[type="text"] { width: 84px; }
.mk-footer { display: flex; align-items: center; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--border); }
.mk-footer-gap { flex: 1; }
.mk-delete { color: #dc2626; border-color: color-mix(in srgb, #dc2626 40%, var(--border)); }
@media (max-width: 760px) { .mk-body { grid-template-columns: 1fr; } .mk-colors { grid-template-columns: 1fr; } }

/* Marker editor: undo the global input styling for ranges / checkboxes and give the small hex field room */
.mk-card input[type="range"] { -webkit-appearance: auto; appearance: auto; width: 120px; height: auto; padding: 0; margin: 0; border: 0; background: none; box-shadow: none; accent-color: var(--accent); }
.mk-card input[type="checkbox"] { -webkit-appearance: checkbox; appearance: auto; width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 0; border-radius: 3px; background: none; accent-color: var(--accent); cursor: pointer; }
.mk-color--sm input[type="text"] { width: 100px; }
.mk-color input[type="text"] { padding: 6px 8px; }

/* Icons page: View menu + spreadsheet-like Table view */
.icon-view-wrap { position: relative; }
.icon-view-btn { display: inline-flex; align-items: center; gap: 6px; }
.icon-view-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 150px; display: flex; flex-direction: column; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-strong); box-shadow: 0 12px 32px rgba(0,0,0,.28); color: var(--text); }
.icon-view-menu.hidden { display: none; }
.icon-view-menu button { text-align: left; padding: 8px 12px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; font-size: 0.86rem; cursor: pointer; }
.icon-view-menu button:hover { background: color-mix(in srgb, var(--text) 9%, transparent); }
.icon-view-menu button.active { font-weight: 700; color: var(--accent-text, var(--accent)); }
.icon-view-menu button.active::after { content: ' ✓'; }
.icon-table-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.icon-table-bar input[type="search"] { flex: 0 1 320px; min-width: 180px; }
.icon-table-count { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.icon-table-add { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 6px; }
.icon-table-add .secondary-button { width: auto; padding: 6px 12px; font-size: 0.8rem; }
.icon-table-wrap { overflow: auto; max-height: calc(100vh - 250px); border: 1px solid var(--border); border-radius: 10px; background: var(--panel-strong); color: var(--text); }
.icon-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.82rem; }
.icon-table th, .icon-table td { padding: 6px 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; white-space: nowrap; }
.icon-table th:last-child, .icon-table td:last-child { border-right: 0; }
.icon-table thead th { position: sticky; top: 0; z-index: 2; background: color-mix(in srgb, var(--text) 9%, var(--panel-strong)); font-size: 0.7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); cursor: pointer; user-select: none; }
.icon-table thead th:hover { color: var(--text); }
.icon-table thead th.sorted { color: var(--accent-text, var(--accent)); }
.icon-table thead th.it-thumb { cursor: default; }
.icon-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--text) 4%, transparent); }
.icon-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.icon-table .it-thumb { width: 40px; padding: 3px 6px; text-align: center; }
.icon-table .it-thumb img { width: 28px; height: 28px; object-fit: contain; display: block; margin: 0 auto; }
.icon-table .it-name { font-weight: 700; }
.icon-table .it-num { text-align: right; font-variant-numeric: tabular-nums; }
.icon-table .it-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
.icon-table .it-wide { white-space: normal; min-width: 180px; max-width: 360px; }
.icon-table .it-empty { text-align: center; color: var(--text-muted); padding: 24px; }
.it-type { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text, var(--accent)); }
.it-type--subcomponents { background: rgba(139, 92, 246, .16); color: #7c3aed; }
.it-type--packages { background: rgba(245, 158, 11, .18); color: #b45309; }
.it-type--markers { background: rgba(225, 29, 72, .14); color: #be123c; }
.it-type--personal { background: rgba(100, 116, 139, .18); color: #475569; }
body.dark .it-type--subcomponents { color: #c4b5fd; } body.dark .it-type--packages { color: #fbbf24; } body.dark .it-type--markers { color: #fda4af; } body.dark .it-type--personal { color: #cbd5e1; }

/* Dark mode: the View button and the table */
body.dark .icon-view-btn { color: var(--text); border-color: var(--border); background: color-mix(in srgb, var(--text) 8%, transparent); }
body.dark .icon-view-btn:hover { border-color: var(--accent); }
body.dark .icon-view-menu { border-color: var(--border); }
body.dark .icon-view-menu button.active { color: var(--accent-text); }
body.dark .icon-table-wrap, body.dark .icon-table th, body.dark .icon-table td { border-color: var(--border); }
body.dark .icon-table thead th.sorted { color: var(--accent-text); }
body.dark .icon-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 20%, transparent); }
body.dark .icon-table .it-thumb img { background: rgba(255,255,255,.10); border-radius: 4px; }
body.dark .icon-table-add .secondary-button { color: var(--text); border-color: var(--border); background: color-mix(in srgb, var(--text) 8%, transparent); }

/* Icon table: inline cell editing */
.icon-table-hint { margin: 0 0 8px; font-size: 0.74rem; color: var(--text-muted); }
.icon-table-status { font-size: 0.76rem; font-weight: 700; color: var(--text-muted); min-width: 70px; }
.icon-table-status--ok { color: #16a34a; } .icon-table-status--err { color: #dc2626; }
body.dark .icon-table-status--ok { color: #4ade80; } body.dark .icon-table-status--err { color: #f87171; }
.icon-table td.it-editable { cursor: cell; }
.icon-table td.it-ro { cursor: default; }
.icon-table td.it-editable:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.icon-table td.it-thumb { cursor: pointer; }
.icon-table td.it-edit-cell { padding: 0; box-shadow: inset 0 0 0 2px var(--accent); background: var(--panel-strong); }
.icon-table .it-edit { display: block; width: 100%; min-width: 110px; height: auto; margin: 0; padding: 6px 10px; border: 0; border-radius: 0; background: transparent; color: var(--text); font: inherit; font-size: 0.82rem; box-shadow: none; outline: none; }
.icon-table select.it-edit { -webkit-appearance: menulist; appearance: menulist; background: var(--panel-strong); }


/* ── Notifications bell + panel ─────────────────────────────────────── */
#notifPanel { position: fixed; z-index: 9000; width: min(380px, calc(100vw - 16px)); max-height: min(70vh, 520px); display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel-strong, #fff); color: var(--text); box-shadow: 0 12px 32px rgba(0,0,0,.28); overflow: hidden; }
#notifPanel[hidden] { display: none; }
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 700; }
.notif-panel-head button { border: 0; background: none; color: var(--accent-text, var(--accent)); font-size: 0.8rem; cursor: pointer; }
.notif-head-actions { display: inline-flex; gap: 14px; }
.notif-panel-head button:disabled { opacity: .4; cursor: default; }
.notif-list { overflow-y: auto; }
.notif-empty { padding: 28px 14px; text-align: center; color: var(--text-muted, #777); font-size: 0.9rem; }
.notif-item { display: flex; gap: 10px; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.notif-item:hover { background: rgba(127,127,127,.1); }
.notif-item--unread { background: rgba(63,185,232,.1); }
.notif-dot { flex: 0 0 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: transparent; }
.notif-item--unread .notif-dot { background: var(--accent); }
.notif-item-title { font-weight: 600; font-size: 0.88rem; }
.notif-item-body { margin-top: 2px; font-size: 0.8rem; color: var(--text-muted, #777); line-height: 1.35; }
.notif-item-time { margin-top: 3px; font-size: 0.72rem; color: var(--text-muted, #888); }

/* Assignees in the Edit Project modal */
.project-assignees { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.project-assignees-title { font-weight: 700; margin-bottom: 4px; }
.assignee-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
.assignee-phase { flex: 0 0 96px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted, #666); }
.assignee-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border-radius: 999px; background: rgba(63,185,232,.16); font-size: 0.8rem; }
.assignee-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 0 4px; opacity: .7; }
.assignee-chip button:hover { opacity: 1; }
.assignee-add { max-width: 190px; font-size: 0.8rem; padding: 3px 6px; }
.assignee-none { font-size: 0.8rem; color: var(--text-muted, #888); }
.projects-assigned-filter { display: inline-flex; align-items: center; align-self: center; gap: 6px; margin: 0 0 0 12px; line-height: 1; font-size: 0.85rem; white-space: nowrap; cursor: pointer; }
.projects-assigned-filter.hidden { display: none; }
.settings-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }

/* Grid snapping toggle + overlay */
#gridSnapBtn.grid-on { color: var(--accent); }
.canvas.grid-snap-on::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(63,185,232,.16) 1px, transparent 1px),
    linear-gradient(180deg, rgba(63,185,232,.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63,185,232,.3) 1px, transparent 1px),
    linear-gradient(180deg, rgba(63,185,232,.3) 1px, transparent 1px);
  background-size: var(--grid, 20px) var(--grid, 20px), var(--grid, 20px) var(--grid, 20px), calc(var(--grid, 20px) * 5) calc(var(--grid, 20px) * 5), calc(var(--grid, 20px) * 5) calc(var(--grid, 20px) * 5);
}
.projects-assigned-filter input[type="checkbox"], .settings-check input[type="checkbox"] { vertical-align: middle; -webkit-appearance: checkbox; appearance: auto; width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 0; border-radius: 3px; background: none; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto; }

/* Sign-in progress: replaces the sign-in controls while SSO completes (boot.js setAuthProgress) */
.auth-container.is-signing-in .auth-org-badge,
.auth-container.is-signing-in .auth-disclaimer,
.auth-container.is-signing-in .auth-email-gate,
.auth-container.is-signing-in .auth-panel,
.auth-container.is-signing-in .divider,
.auth-container.is-signing-in .auth-sso-row { display: none; }
.auth-progress { display: flex; align-items: center; gap: 14px; margin: 6px 0 4px; padding: 16px; border: 1px solid var(--panel-border); border-left: 3px solid var(--accent); border-radius: 4px; background: var(--panel); }
.auth-progress.hidden { display: none; }
.auth-progress-spinner { flex: 0 0 auto; width: 22px; height: 22px; border: 3px solid var(--panel-border); border-top-color: var(--accent); border-radius: 50%; animation: authSpin 0.8s linear infinite; }
.auth-progress-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 0.85rem; color: var(--text); }
.auth-progress-text strong { font-size: 0.95rem; }
.auth-progress-text span { color: var(--text-muted, #777); overflow-wrap: anywhere; }
@keyframes authSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .auth-progress-spinner { animation-duration: 2.4s; } }

/* Room details card: data drop "Confirmed" column + disposition below the device table */
.room-detail-icon-table th.room-detail-col-confirm { width: 84px; white-space: nowrap; text-align: center; }
.room-detail-icon-table td.room-detail-cell-confirm { text-align: center; vertical-align: middle; }
.room-detail-confirm-head { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; font: inherit; }
.room-detail-cell-confirm .room-detail-confirm { display: inline-block; vertical-align: middle; }
.room-detail-confirm, .room-detail-confirm-all { -webkit-appearance: checkbox; appearance: auto; width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 0; border-radius: 3px; background: none; accent-color: #16a34a; cursor: pointer; flex: 0 0 auto; }
.room-detail-confirm:disabled, .room-detail-confirm-all:disabled { cursor: not-allowed; opacity: 0.6; }
.room-dispo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.room-dispo-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted, #777); }
.room-dispo-hint { margin: 2px 0 8px; font-size: 0.8rem; color: #dc2626; }
.room-notes-textarea--missing { border-color: #dc2626; box-shadow: 0 0 0 1px #dc2626; }
.rrr-disp--static { display: inline-flex; align-items: center; cursor: default; }
.rrr-pill--ok { border-color: #16a34a; color: #16a34a; }

/* Photo import progress */
.photo-import-progress { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); z-index: 9000; width: min(360px, calc(100vw - 32px)); padding: 12px 14px; border: 1px solid var(--panel-border); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--panel-strong); color: var(--text); box-shadow: var(--shadow-sm, 0 4px 14px rgba(0,0,0,.2)); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.photo-import-progress--on { opacity: 1; transform: translate(-50%, 0); }
.photo-import-text { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; }
.photo-import-track { height: 6px; border-radius: 3px; background: var(--panel-border); overflow: hidden; }
.photo-import-fill { height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }

/* In-app camera (Take photo) */
.cam-overlay { position: fixed; inset: 0; z-index: 10000; background: #000; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.cam-video { flex: 1 1 auto; min-height: 0; width: 100%; object-fit: contain; background: #000; }
.cam-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px; background: linear-gradient(#000a, transparent); color: #fff; font-size: 0.9rem; }
.cam-room { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-strip { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 150px); display: flex; gap: 6px; padding: 0 12px; overflow-x: auto; }
.cam-thumb { height: 52px; width: 52px; object-fit: cover; border: 2px solid #fff; border-radius: 4px; flex: 0 0 auto; }
.cam-bar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 18px 20px calc(env(safe-area-inset-bottom, 0px) + 40px); background: #000; }
.cam-btn { min-width: 84px; padding: 12px 14px; border: 0; border-radius: 22px; background: #ffffff22; color: #fff; font: inherit; font-weight: 600; }
.cam-btn:disabled { opacity: 0.4; }
.cam-done:not(:disabled) { background: var(--accent); color: #fff; }
.cam-shutter { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: #ffffffcc; box-shadow: inset 0 0 0 4px #000; }
.cam-shutter:active { background: #fff; }
.cam-shutter:disabled { opacity: 0.35; }
.cam-alt { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); border: 0; background: none; color: #ffffffaa; font-size: 0.78rem; text-decoration: underline; }
.cam-flash .cam-video { opacity: 0.4; }
.cam-lenses { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 212px); display: flex; justify-content: center; gap: 8px; }
.cam-lenses.hidden { display: none; }
.cam-lens { min-width: 44px; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid #ffffff55; background: #000a; color: #fff; font-size: 0.85rem; font-weight: 600; }
.cam-lens.active { background: #ffd60a; color: #000; border-color: #ffd60a; }
@media (max-height: 500px) { .cam-lenses { bottom: calc(env(safe-area-inset-bottom, 0px) + 150px); } }

/* Survey page: additional comments */
.survey-additional-comments { width: 100%; box-sizing: border-box; min-height: 110px; padding: 10px 12px; border: 1px solid var(--panel-border); border-radius: var(--r-xs, 4px); background: var(--panel); color: var(--text); font: inherit; resize: vertical; }
.survey-additional-comments:disabled { opacity: 0.7; cursor: not-allowed; }

/* ── Phones in landscape (2026-11-04) ───────────────────────────────────────
   index.html now asks for viewport-fit=cover, so the page uses the phone's full width in landscape instead of
   being letterboxed by the notch / Dynamic Island safe areas (the letterbox made an iPhone 16 Pro's 874px screen a ~750px
   layout, under the 768px phone breakpoint, so landscape kept the small phone layout). The safe-area insets are
   padded back in where content would otherwise sit under the island or the home bar. */
@media (min-width: 769px) {
  .top-nav {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}
.floorplan-layout {
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
/* A phone on its side is only ~400px tall: slimmer top bar and tighter margins so the plan gets the height. */
@media (min-width: 769px) and (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .top-nav { min-height: 40px; margin-bottom: 8px; }
  body .top-nav .nav-link { min-height: 40px; padding: 0 12px; font-size: 0.85rem; }
  .nav-left { gap: 14px; }
  .nav-brand { font-size: 0.95rem; }
  .floorplan-layout { gap: 8px; padding-top: 6px; }
  .icon-panel { width: 170px; }
}

/* ── Assignments page (admins) ─────────────────────────────────────────────
   Projects as rows, phases as columns; the project's current phase is highlighted and is the "pool" column. */
.asg-card { max-width: 1240px; padding: 14px 16px 8px; border-radius: var(--r-lg); background: var(--panel-strong); color: var(--text); border: 1px solid var(--panel-border); box-shadow: var(--shadow); }
.asg-scroll { overflow-x: auto; }
.asg-table { width: 100%; min-width: 940px; border-collapse: collapse; }
.asg-table thead th { padding: 6px 10px; text-align: left; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); border-bottom: 1px solid var(--panel-border); }
.asg-table td { padding: 10px; vertical-align: top; border-bottom: 1px solid var(--panel-border); }
.asg-table tbody tr:last-child td { border-bottom: 0; }
.asg-table th:first-child, .asg-table td:first-child { width: 230px; }
.asg-table td.asg-current { background: var(--accent-soft); }
.asg-project { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--text); text-align: left; cursor: pointer; }
.asg-project:hover { color: var(--accent-text); text-decoration: underline; }
.asg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; }
.asg-pool { padding: 2px 8px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 0.7rem; font-weight: 700; }
body.dark .asg-pool { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.asg-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 30px; }
.asg-need { font-size: 0.76rem; font-weight: 700; color: #b45309; }
body.dark .asg-need { color: #fbbf24; }
.asg-done { font-size: 0.78rem; font-weight: 600; color: var(--text-faint); }
.asg-empty { padding: 22px 10px; text-align: center; color: var(--text-muted); }
.assignee-chip--static { padding-right: 9px; opacity: 0.75; }
/* Salesforce lists this person but they have no Floorplan Flow account yet. */
.assignee-chip--noacct { opacity: 1; border-style: dashed; color: #b45309; }
.assignee-chip--noacct small { font-size: 0.68rem; opacity: 0.85; }
body.dark .assignee-chip--noacct { color: #fbbf24; }
.asg-table .assignee-add { width: auto; margin: 0; max-width: 170px; height: 28px; }

/* Support handoff page */
.sup-kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; padding: 6px 0; border-top: 1px solid var(--border, #ddd); font-size: 0.9rem; }
.sup-kv:first-of-type { border-top: 0; }
.sup-k { color: var(--text-muted, #777); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.sup-v a { color: var(--accent-text, var(--accent)); }
.sup-notes-body { white-space: pre-wrap; font-size: 0.92rem; line-height: 1.5; max-height: 420px; overflow: auto; }
.sup-byline { margin-top: 8px; font-size: 0.78rem; color: var(--text-muted, #777); }
.sup-history { margin: 0; padding-left: 18px; font-size: 0.88rem; line-height: 1.7; }
@media (max-width: 560px) { .sup-kv { grid-template-columns: 1fr; gap: 2px; } }

/* Pre-assigned roles card (User Management) */
.um-pre { margin-top: 14px; padding-bottom: 14px; }
.um-pre[hidden] { display: none; }
.um-pre-title { margin: 0 0 4px; font-size: 0.95rem; }
.um-pre-help { margin: 0 0 8px; font-size: 0.8rem; color: var(--text-muted); }
.um-pre-text { width: 100%; box-sizing: border-box; font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; margin-bottom: 8px; }
.um-pre-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.um-pre-actions .um-status { margin: 0; }

/* Link a Salesforce project (project modal) and the milestones strip */
.sf-find-row { margin: 8px 0 12px; }
.sf-find-row.hidden, .sf-find-panel.hidden { display: none; }
.sf-find-panel { margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-md, 10px); background: var(--panel-strong); }
.sf-find-search { display: flex; gap: 8px; }
.sf-find-search input { flex: 1; margin: 0; }
.sf-find-results { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 220px; overflow: auto; }
.sf-find-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.sf-find-item:hover { border-color: var(--accent); }
.sf-find-item span { font-size: 0.78rem; color: var(--text-muted); }
.sf-strip { margin: 0 0 14px; padding: 12px 14px; }
.sf-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-size: 0.86rem; }
.sf-ms-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.sf-ms { display: flex; flex-direction: column; gap: 1px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.78rem; opacity: .75; }
.sf-ms--key { opacity: 1; border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.sf-ms--done .sf-ms-name { color: #16a34a; }
.sf-ms-phase { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.sf-ms-name { font-weight: 700; }
.sf-ms-dates { color: var(--text-muted); }
.sf-strip-foot { margin-top: 8px; font-size: 0.74rem; color: var(--text-muted); }

.sf-wo { margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.82rem; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sf-wo-line--done strong { color: #16a34a; }
.sf-wo-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sf-wo-chip { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); font-size: 0.74rem; color: var(--text-muted); }
.sf-wo-chip--done { color: #16a34a; border-color: #16a34a; }

/* Settings › Notifications: push row */
.settings-push { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.settings-push-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-push-text .settings-card-desc { margin: 0; }
.settings-push .um-btn { flex: 0 0 auto; }

/* Projects page: ETA of the current phase from Salesforce milestone dates */
.projects-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.eta { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.eta--ok { color: var(--text); background: rgba(128,128,128,.14); border-color: rgba(128,128,128,.3); }
.eta--soon { color: #8a4a00; background: #fff0d9; border-color: #f2c98a; }
.eta--late { color: #b91c1c; background: #fde8e8; border-color: #f3b0b0; }
.eta--done { color: #15803d; background: #e3f6ea; border-color: #9fd9b5; }
body.dark .eta--soon { color: #f5c37a; background: rgba(245,195,122,.15); border-color: rgba(245,195,122,.4); }
body.dark .eta--late { color: #fca5a5; background: rgba(252,165,165,.14); border-color: rgba(252,165,165,.4); }
body.dark .eta--done { color: #86e0a8; background: rgba(134,224,168,.14); border-color: rgba(134,224,168,.4); }
.eta--none { color: var(--text-muted); font-weight: 500; }
body.dark .eta--soon { color: #fbbf24; }
body.dark .eta--late { color: #f87171; }
body.dark .eta--done { color: #4ade80; }

/* Projects table: column filters and pager */
.projects-filter-row th { padding: 6px 14px 10px; border-bottom: 1px solid var(--panel-border); text-transform: none; letter-spacing: 0; font-weight: 500; }
.projects-col-filter { width: 100%; min-width: 0; box-sizing: border-box; margin: 0; padding: 5px 8px; border-radius: var(--r-sm); border: 1px solid var(--input-border); background: var(--panel-2); color: var(--text); font-size: 0.78rem; }
.projects-clear-filters { background: none; border: none; padding: 4px 6px; color: var(--accent-text); font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.projects-clear-filters:hover { text-decoration: underline; }
.projects-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-muted); }
.projects-pager-nav { display: flex; align-items: center; gap: 10px; }
.projects-pager-btn { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: var(--r-sm); padding: 5px 12px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.projects-pager-btn:disabled { opacity: 0.4; cursor: default; }
.projects-pager-page { min-width: 84px; text-align: center; }
@media (max-width: 720px) { .projects-filter-row th { padding: 6px 8px 8px; } }

/* Sortable Projects headings */
.projects-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.projects-sortable:hover { color: var(--text); }
.projects-sortable[aria-sort="ascending"]::after { content: " \25B2"; font-size: 0.55rem; }
.projects-sortable[aria-sort="descending"]::after { content: " \25BC"; font-size: 0.55rem; }

/* Salesforce strip: ordered hardware vs placed */
.sf-hw { margin: 12px 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 0.85rem; }
.sf-hw-head { margin-bottom: 8px; }
.sf-hw-note, .sf-hw-other { color: var(--text-muted); font-size: 0.8rem; margin-top: 6px; }
.sf-hw-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.sf-hw-table th { text-align: left; font-size: 0.65rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding: 4px 8px; border-bottom: 1px solid var(--border); }
.sf-hw-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.sf-hw-row--done td:last-child { color: #16a34a; font-weight: 600; }
.sf-hw-row--over td { color: #dc2626; }
.sf-hw-flag { font-size: 0.72rem; font-weight: 600; }
body.dark .sf-hw-row--over td { color: #f87171; }
body.dark .sf-hw-row--done td:last-child { color: #4ade80; }

/* Salesforce catalog vs library */
.sf-catalog-card { width: min(1100px, 96vw); max-height: 90vh; display: flex; flex-direction: column; gap: 10px; }
.sf-catalog-intro { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.sf-catalog-summary { margin: 0; font-weight: 600; font-size: 0.9rem; }
.sf-catalog-scroll { overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); min-height: 140px; }
.sf-catalog-table td, .sf-catalog-table th { vertical-align: top; }
.sf-cat-missing td:nth-child(4) { color: #dc2626; }
body.dark .sf-cat-missing td:nth-child(4) { color: #f87171; }
.sf-cat-muted { color: var(--text-muted); }
.sf-cat-detail { color: var(--text-muted); font-size: 0.78rem; max-width: 420px; }
.sf-catalog-foot { display: flex; justify-content: flex-end; }

/* ── Floorplan: swap the Rooms / Icons panel to the other side; controls pill centred ─────────────── */
.panel-swap-bar {
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 100%; height: 22px; margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--panel-border);
  border-radius: 0; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text-muted);
  cursor: pointer; box-shadow: none; min-height: 0;
}
.panel-swap-bar:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); }
.panel-swap-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.floorplan-layout.panel-right { flex-direction: row-reverse; }
@media (max-width: 768px) { .panel-swap-bar { display: none; } }
/* The controls pill sits in the middle of the canvas area (phones keep their own bottom-right column). */
@media (min-width: 769px) {
  .canvas-viewport .canvas-toolbar { right: auto; left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); }
}

/* The room details drawer comes out of the edge opposite the Rooms / Icons panel (desktop). */
@media (min-width: 769px) {
  body:has(.floorplan-layout.panel-right) #roomDetailPage.room-detail-drawer {
    right: auto; left: 0; border-left: 0; border-right: 1px solid var(--panel-border);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45); transform: translateX(-100%);
  }
  body:has(.floorplan-layout.panel-right) #roomDetailPage.room-detail-drawer.room-detail-drawer--open { transform: translateX(0); }
}

/* The floating controls pill steps aside while the room details card is open. */
.canvas-viewport .canvas-toolbar { transition: opacity 0.2s ease; }
body:has(#roomDetailPage.room-detail-drawer--open) .canvas-viewport .canvas-toolbar { opacity: 0; pointer-events: none; }

/* RJ45 data-drop pill (room details): green confirmed, red not confirmed, amber pending the site survey. */
.rd-pill--rj45 { margin: 0; } /* the editable one is a <label>, which the app styles with a bottom margin */
.rd-pill--rj45 b { font-weight: 800; }
.rd-pill--rj45-ok { background: rgba(34,197,94,.16); border-color: rgba(22,163,74,.55); color: #166534; }
.rd-pill--rj45-no { background: rgba(239,68,68,.14); border-color: rgba(220,38,38,.55); color: #b91c1c; }
.rd-pill--rj45-pending { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.6); color: #92400e; }
body.dark .rd-pill--rj45-ok { color: #86efac; }
body.dark .rd-pill--rj45-no { color: #fca5a5; }
body.dark .rd-pill--rj45-pending { color: #fcd34d; }
/* Site Survey assignee: the pill sits in its own column at the table's right edge, big enough to tap. */
.rd-pill--rj45-edit { height: 24px; padding: 0 10px 0 9px; gap: 6px; font-size: 0.68rem; cursor: pointer; }
.rd-pill--rj45-edit svg { width: 13px; height: 13px; }
.rd-pill--rj45-edit .room-detail-confirm { -webkit-appearance: checkbox; appearance: auto; width: 16px; height: 16px; min-width: 16px; min-height: 0; margin: 0; padding: 0; border: initial; background: none; box-shadow: none; border-radius: 3px; flex: 0 0 auto; }
.room-detail-icon-table th.rd-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.room-detail-icon-table th.rd-sortable:hover, .room-detail-icon-table th.rd-sortable:focus-visible { color: var(--accent-text, var(--accent)); outline: none; }
.room-detail-icon-table th.rd-sortable[aria-sort="ascending"], .room-detail-icon-table th.rd-sortable[aria-sort="descending"] { color: var(--accent-text, var(--accent)); }
.rd-sort-ind { font-size: 0.7em; }
.rd-pill--rj45-ok .room-detail-confirm { accent-color: #16a34a; }
.rd-pill--rj45-no .room-detail-confirm { accent-color: #dc2626; }
.room-detail-icon-table th.room-detail-col-confirm { width: 112px; text-align: right; white-space: nowrap; padding-right: 10px; }
.room-detail-icon-table td.room-detail-cell-drop { width: 112px; text-align: right; vertical-align: middle; padding-right: 10px; }
.room-detail-col-confirm .room-detail-confirm-head { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; font: inherit; cursor: pointer; }
.room-detail-col-confirm .room-detail-confirm-all { -webkit-appearance: checkbox; appearance: auto; width: 16px; height: 16px; min-width: 16px; min-height: 0; margin: 0; padding: 0; border: initial; background: none; box-shadow: none; border-radius: 3px; accent-color: #16a34a; }
/* "Reduce motion" (Settings): no CSS transitions or animations (loading spinners keep turning). */
body.reduce-motion *:not([class*="spinner"]):not(.spin), body.reduce-motion *::before, body.reduce-motion *::after {
  animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important;
}

/* Install phase: the survey's notes shown read-only under the install notes box (room details card). */
.room-notes-prior { margin-top: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--text-muted) 10%, transparent); color: var(--text-muted); font-size: 0.78rem; line-height: 1.4; white-space: pre-wrap; }

/* Changes since the survey (Install phase): flagged on the canvas, in the room card, and in the Install report. */
.rd-pill--moved { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.6); color: #92400e; }
.rd-pill--added { background: rgba(34,197,94,.16); border-color: rgba(22,163,74,.55); color: #166534; }
body.dark .rd-pill--moved { color: #fcd34d; }
body.dark .rd-pill--added { color: #86efac; }
.room-detail-layout-note { margin: 0 0 8px; font-size: 0.78rem; color: var(--text-muted); }
.canvas-item.canvas-item--moved-survey { outline: 2px dashed #f59e0b; outline-offset: 2px; border-radius: 10px; }
.canvas-item.canvas-item--added-survey { outline: 2px dashed #16a34a; outline-offset: 2px; border-radius: 10px; }

/* Salesforce Network Details import review */
.ndi-card { max-width: 860px; width: calc(100vw - 32px); }
.ndi-body { padding: 0 20px; max-height: 62vh; overflow: auto; }
.ndi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.ndi-chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.ndi-chip--ok { background: #dcfce7; color: #166534; }
.ndi-chip--warn { background: #fef3c7; color: #92400e; }
body.dark .ndi-chip--ok { background: rgba(34,197,94,.18); color: #86efac; }
body.dark .ndi-chip--warn { background: rgba(245,158,11,.18); color: #fcd34d; }
.ndi-scroll { overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.ndi-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ndi-table th, .ndi-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text); }
.ndi-table th { position: sticky; top: 0; background: var(--panel-strong, var(--panel)); }
.ndi-sub { font-size: 11px; opacity: .7; }
.ndi-lbl { display: inline-block; min-width: 130px; opacity: .7; }
.ndi-chg s { opacity: .55; }
.ndi-list { margin: 10px 0; font-size: 12.5px; color: var(--text); }
.ndi-list summary { cursor: pointer; font-weight: 600; }
.ndi-list ul { margin: 6px 0 0 20px; }

.ndi-h { margin: 14px 0 4px; font-size: 14px; color: var(--text); }
.ndi-body select { padding: 1px 4px; }

/* Import IP Summary wizard */
.ipw-card { max-width: 900px; width: calc(100vw - 32px); }
.ipw-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 4px 20px 12px; flex-wrap: wrap; }
.ipw-step { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); opacity: .55; }
.ipw-step.is-on, .ipw-step.is-done { opacity: 1; }
.ipw-step:not(:last-child)::after { content: ''; width: 18px; height: 1px; background: var(--border); margin-left: 4px; }
.ipw-n { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: color-mix(in srgb, var(--text) 12%, transparent); font-size: 11px; font-weight: 700; }
.ipw-step.is-on .ipw-n { background: var(--accent); color: #fff; }
.ipw-step.is-done .ipw-n { background: #16a34a; color: #fff; }
.ipw-body { padding: 0 20px; max-height: 58vh; overflow: auto; color: var(--text); }
.ipw-lead { margin: 6px 0 10px; font-size: 13.5px; }
.ipw-muted { font-size: 11.5px; opacity: .7; }
.ipw-warn { color: #b45309; font-size: 12.5px; }
body.dark .ipw-warn { color: #fcd34d; }
.ipw-err { margin: 10px 0; padding: 9px 12px; border-radius: 8px; background: #fee2e2; color: #991b1b; font-size: 13px; }
body.dark .ipw-err { background: rgba(239,68,68,.18); color: #fca5a5; }
.ipw-drop { border: 2px dashed var(--border); border-radius: 12px; padding: 34px 16px; text-align: center; cursor: pointer; }
.ipw-drop:hover, .ipw-drop.is-over, .ipw-drop:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); outline: none; }
.ipw-drop.is-busy { cursor: progress; opacity: .8; }
.ipw-drop-t { font-weight: 600; margin-bottom: 4px; }
.ipw-tablewrap { max-height: 40vh; }
.ipw-row--empty { opacity: .6; }
.ipw-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.ipw-pill--ok { background: #dcfce7; color: #166534; }
.ipw-pill--bad { background: #fef3c7; color: #92400e; }
.ipw-pill--empty { background: color-mix(in srgb, var(--text) 10%, transparent); }
body.dark .ipw-pill--ok { background: rgba(34,197,94,.18); color: #86efac; }
body.dark .ipw-pill--bad { background: rgba(245,158,11,.18); color: #fcd34d; }
.ipw-val { display: inline-block; margin: 0 10px 2px 0; font-size: 12px; }
.ipw-val i { font-style: normal; opacity: .6; margin-right: 3px; }
.ipw-check { display: flex; align-items: center; gap: 6px; margin: 8px 0; font-size: 13px; }
.ipw-check input { width: 16px; height: 16px; margin: 0; appearance: auto; accent-color: var(--accent); }
.ipw-sum { margin: 6px 0 10px 18px; line-height: 1.6; font-size: 13.5px; }
.ipw-ok { padding: 14px 16px; border-radius: 10px; background: #dcfce7; color: #166534; }
.ipw-ok-t { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.ipw-ok ul { margin: 4px 0 0 18px; }
body.dark .ipw-ok { background: rgba(34,197,94,.16); color: #86efac; }

/* Network chip: opens the viewer; the tick tab beside it includes the diagram in the PDF */
.report-mod-group { gap: 0; }
.report-mod-group > .report-mod:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.report-mod--tick { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-width: 0; padding: 6px 8px; }
.report-mod--tick svg { margin-right: 0; }
.report-mod--tick:not(.is-on) svg { opacity: .35; }

/* Import wizard: editable rows */
.ipw-card { max-width: min(1240px, 96vw); }
.ipw-edit { min-width: 1080px; }
.ipw-edit td { padding: 4px 6px; }
.ipw-in { width: 100%; min-width: 74px; padding: 3px 6px; font-size: 12px; border: 1px solid var(--border); border-radius: 5px; background: var(--panel-strong, var(--panel)); color: var(--text); box-sizing: border-box; }
.ipw-in--mac { min-width: 118px; font-family: ui-monospace, Menlo, monospace; }
.ipw-in--sp { min-width: 56px; }
.ipw-in--loc { margin-top: 3px; font-size: 11px; }
select.ipw-in { min-width: 150px; }
.ipw-sf { font-size: 11px; margin-top: 2px; }
.ipw-sf--ok { color: #15803d; } .ipw-sf--warn { color: #b45309; } .ipw-sf--muted { opacity: .6; }
body.dark .ipw-sf--ok { color: #86efac; } body.dark .ipw-sf--warn { color: #fcd34d; }
.ipw-pill--sug { background: #fef3c7; color: #92400e; }
.ipw-pill--dup { background: #fee2e2; color: #991b1b; }
.ipw-pill--none { background: color-mix(in srgb, var(--text) 10%, transparent); }
body.dark .ipw-pill--sug { background: rgba(245,158,11,.18); color: #fcd34d; }
body.dark .ipw-pill--dup { background: rgba(239,68,68,.18); color: #fca5a5; }

/* Punch list (Survey page): issues from the submitted survey that the project manager resolves before Install */
.punch-card { margin-bottom: 14px; }
.punch-badge { margin-left: auto; font-size: 0.72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #fee2e2; color: #b91c1c; }
.punch-badge.is-clear { background: #dcfce7; color: #15803d; }
body.dark .punch-badge { background: rgba(248,113,113,.18); color: #fca5a5; }
body.dark .punch-badge.is-clear { background: rgba(74,222,128,.16); color: #86efac; }
.punch-intro { margin: 2px 0 10px; font-size: 0.85rem; color: var(--text-muted, #666); }
.punch-missing { margin: 0 0 10px; padding: 8px 10px; border-radius: var(--r-sm, 6px); background: #fef3c7; color: #92400e; font-size: 0.85rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
body.dark .punch-missing { background: rgba(251,191,36,.14); color: #fcd34d; }
.punch-list { list-style: none; margin: 0 0 12px; padding: 0; border: 1px solid var(--border); border-radius: var(--r-sm, 6px); }
.punch-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: start; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.punch-item:last-child { border-bottom: 0; }
.punch-check { display: flex; gap: 9px; align-items: flex-start; margin: 0; cursor: pointer; }
.punch-check input { appearance: auto; width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.punch-text { font-size: 0.9rem; line-height: 1.35; overflow-wrap: anywhere; }
.punch-item.is-resolved .punch-text { text-decoration: line-through; color: var(--text-muted, #777); }
.punch-meta { grid-column: 1 / -1; padding-left: 25px; font-size: 0.74rem; color: var(--text-muted, #777); }
.punch-res { color: #15803d; }
body.dark .punch-res { color: #86efac; }
.punch-note { grid-column: 1; margin: 2px 0 0 25px; height: 30px; font-size: 0.82rem; }
.punch-remove { grid-column: 2; grid-row: 1; background: none; border: 0; color: #b91c1c; font-size: 0.78rem; cursor: pointer; padding: 0; }
.punch-add { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.punch-add input { flex: 1 1 240px; height: 34px; margin: 0; }
.punch-add select { flex: 0 1 170px; height: auto; min-height: 34px; padding: 4px 8px; margin: 0; }
.punch-actions { margin-top: 4px; }
.punch-status { margin: 8px 0 0; font-size: 0.82rem; color: var(--text-muted, #666); }
.punch-status.is-error { color: #b91c1c; }

.punch-visit { margin: 4px 0 12px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: var(--r-sm, 6px); }
.punch-visit-title { font-weight: 700; font-size: 0.85rem; margin-bottom: 2px; }
.punch-visit-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.punch-visit-table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #777); padding: 4px 8px; }
.punch-visit-table td { padding: 5px 8px; border-top: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.punch-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Support page: Install report menu */
.support-report-wrap { position: relative; }
.support-report-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 180px; display: flex; flex-direction: column; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-strong, #fff); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.support-report-menu.hidden { display: none; }
.support-report-menu button { text-align: left; padding: 8px 12px; border: 0; background: none; color: var(--text); font: inherit; font-size: .88rem; border-radius: 6px; cursor: pointer; }
.support-report-menu button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* Report page: final install report status */
.report-install-status { margin: 0 0 12px; padding: 9px 14px; border-radius: 8px; font-size: .85rem; background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.report-install-status.is-done { background: #dcfce7; color: #166534; border-color: #86efac; }
body.dark .report-install-status { background: rgba(245,158,11,.16); color: #fcd34d; border-color: rgba(252,211,77,.35); }
body.dark .report-install-status.is-done { background: rgba(34,197,94,.16); color: #86efac; border-color: rgba(134,239,172,.35); }

/* Rooms first: with no rooms the Icons side of the panel toggle is locked */
.mode-toggle.icons-need-rooms .mode-toggle-label--icons { opacity: .4; cursor: not-allowed; }
.mode-toggle.icons-need-rooms { cursor: not-allowed; }

/* Replacing the PDF in the Edit Project modal */
.pdf-replace-options { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.pdf-keep { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .88rem; font-weight: 600; }
.pdf-keep input { width: 16px; height: 16px; margin: 0; appearance: auto; accent-color: var(--accent); }
.pdf-replace-note { margin: 6px 0 0; font-size: .8rem; opacity: .85; }

/* Install sign-off + reopen */
.so-check { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-weight: 600; font-size: .9rem; }
.so-check input { width: 16px; height: 16px; margin: 0; appearance: auto; accent-color: var(--accent); }
.so-error { min-height: 1.2em; margin: 6px 0 0; color: #b91c1c; font-size: .85rem; }
body.dark .so-error { color: #fca5a5; }
.project-lock-reopen { margin-left: 12px; padding: 3px 10px; border: 1px solid currentColor; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.project-lock-reopen:hover { background: rgba(255,255,255,.18); }

#reportIpImportBtn:disabled { opacity: .55; cursor: not-allowed; }
.report-btn-dev { font-size: .72em; font-weight: 500; opacity: .85; }
@media (max-width: 768px) { .report-btn-dev { display: none; } }

/* The viewport covers the notch / Dynamic Island / status bar (viewport-fit=cover), so a full-screen panel must keep its first
   line clear of them: the room details drawer's header (title and close button) was hidden behind the iPhone status bar. */
#roomDetailPage.room-detail-drawer {
  padding-top: max(20px, calc(env(safe-area-inset-top, 0px) + 8px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px));
}

/* On phones the amber review banner is a fixed bar at the top; the full-screen room card must start below it so its
   close button is never covered (the banner height is measured into --lockbar-h whenever it is showing). */
@media (max-width: 768px) {
  body.lock-banner-shown #roomDetailPage.room-detail-drawer {
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--lockbar-h, 0px) + 10px);
  }
}

/* Phone held sideways: bigger tap targets in the profile menu, no sticky hover highlight from a scroll touch. */
@media (hover: none) and (pointer: coarse) {
  .dropdown-item { min-height: 44px; }
  .dropdown-item:hover { background: transparent; }
  .dropdown-item:active { background: var(--accent-soft); }
}

.install-overview { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel, transparent); }
.install-overview-title { font-weight: 700; font-size: .9rem; margin-bottom: 8px; }
.install-overview-grid { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 12px; align-items: end; }
.install-overview-grid label { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: .8rem; }
.install-overview-saved { font-size: .75rem; color: var(--text-muted, #777); }
@media (max-width: 640px) { .install-overview-grid { grid-template-columns: 1fr; } }

/* Project modal: icon buttons + short-name toggle */
.scope-import-row .secondary-button { display: inline-flex; align-items: center; gap: 7px; }
.scope-toolbar .secondary-button { display: inline-flex; align-items: center; gap: 7px; }
.short-name-toggle { display: flex; align-items: center; gap: 8px; margin: -4px 0 10px; font-size: 0.85rem; cursor: pointer; }
.short-name-toggle input[type="checkbox"] { appearance: auto; -webkit-appearance: checkbox; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.short-name-toggle span { color: var(--text-muted, #777); }

/* ── PDF contents picker (Report page): one button, a panel of checkboxes with a Preview per item ── */
.report-pdf-menu { position: relative; display: inline-block; }
.report-pdf-menu > .secondary-button { display: inline-flex; align-items: center; white-space: nowrap; }
.report-contents-count { margin-left: 8px; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center; }
.report-contents-count.is-zero { background: #b5b9bd; }
.rcp-caret { width: 14px; height: 14px; margin-left: 6px; }
.report-contents-panel { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: 400px; max-width: calc(100vw - 32px); background: #fff; color: #222; border: 1px solid #ddd; border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 12px 12px 10px; }
.report-contents-panel.hidden { display: none; }
body.dark .report-contents-panel { background: #262626; color: #eee; border-color: #444; }
.rcp-title { font-size: 0.7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #777); margin: 0 2px 8px; }
.rcp-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; }
.rcp-row:hover { background: rgba(63,185,232,.09); }
.rcp-row.hidden { display: none; }
.rcp-check { display: flex; align-items: flex-start; gap: 10px; flex: 1 1 auto; min-width: 0; margin: 0; cursor: pointer; }
.rcp-check input[type="checkbox"] { appearance: auto; -webkit-appearance: checkbox; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); flex: none; padding: 0; }
.rcp-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rcp-name { font-size: 0.9rem; }
.rcp-desc { font-size: 0.74rem; color: var(--text-muted, #777); line-height: 1.3; }
.rcp-preview { flex: none; background: none; border: 1px solid var(--accent); color: var(--accent-text, #0e5073); border-radius: 999px; padding: 3px 11px; font-size: 0.74rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
body.dark .rcp-preview { color: #7fd6f2; }
.rcp-preview:hover { background: var(--accent); color: #fff; }
.rcp-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding-top: 10px; border-top: 1px solid rgba(128,128,128,.25); }
.rcp-foot .secondary-button { padding: 6px 12px; font-size: 0.82rem; }
@media (max-width: 768px) { .report-pdf-menu { flex: 1 1 100%; } .report-pdf-menu > .secondary-button { width: 100%; justify-content: center; } .report-contents-panel { width: 100%; } }
@media (max-width: 520px) { .report-contents-panel { position: fixed; left: 16px; right: 16px; width: auto; top: auto; bottom: 90px; max-height: 70vh; overflow: auto; } }
/* The contents picker and the Download PDF button read as one joined control: the left half says what goes in, the right half builds it. */
.report-pdf-group { display: inline-flex; align-items: stretch; }
.report-pdf-group .report-pdf-menu > .secondary-button { height: 100%; border-top-right-radius: 0; border-bottom-right-radius: 0; font-weight: 600; max-width: 340px; }
.report-pdf-group .report-pdf-menu > .secondary-button .report-btn-label { overflow: hidden; text-overflow: ellipsis; }
.report-pdf-group > #reportPrintBtn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
@media (max-width: 768px) {
  .report-pdf-group { flex: 1 1 100%; display: flex; }
  .report-pdf-group .report-pdf-menu { flex: 1 1 auto; min-width: 0; }
  .report-pdf-group > #reportPrintBtn { flex: 0 0 auto; }
  .page-header .report-header-actions .report-pdf-group > #reportPrintBtn .report-btn-label { display: none; }
  .page-header .report-header-actions .report-pdf-group > #reportPrintBtn { width: 44px !important; padding: 0; justify-content: center; }
  .report-header-actions .report-pdf-group > #reportPrintBtn svg { margin: 0 !important; }
}
/* the report's scope page */

.report-pre-survey #reportDropsNotice, .report-pre-survey #reportSurveyNotice { display: none !important; }

/* Network diagram modal: Diagram / Switch ports tabs, so the port table is never tucked away below the picture */
.nd-tabs { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; border-bottom: 1px solid var(--border, #d0d7de); }
.nd-tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 14px; margin-bottom: -1px; font-size: 0.9rem; font-weight: 600; color: var(--text-muted, #666); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.nd-tab:hover { color: var(--text, #222); }
.nd-tab.is-active { color: var(--text, #222); border-bottom-color: var(--accent); }
.nd-tab-count { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center; }
.nd-tab-count.is-auto { background: #d97706; }
.nd-tabs-hint { margin-left: auto; font-size: 0.74rem; color: #b45309; padding-right: 4px; }
.nd-tabs-hint:empty { display: none; }

/* Network diagram: drag a port onto another port */
.nd-port-drag { cursor: grab; }
.nd-port-dragging, .nd-port-dragging * { cursor: grabbing !important; }
#netDiagramBody .nd-drop-ok > rect:first-child { stroke: #16a34a; stroke-width: 3; }
#netDiagramBody .nd-drop-bad > rect:first-child { stroke: #dc2626; stroke-width: 3; }
#netDiagramBody .nd-port-drag:hover > rect:first-child { stroke: #111; stroke-width: 2.2; }
#ndPortGhost { position: fixed; z-index: 9999; pointer-events: none; padding: 4px 10px; border-radius: 999px; background: #262626; color: #fff; font-size: 12px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.3); white-space: nowrap; }

/* Network tab (page): the diagram fills the window, notes above */
/* The page fills the window below the top bar: the header, switch field and notes take what they need and the diagram gets ALL the rest. */
@media (min-width: 769px) {
  main > #networkPage.active-page { display: flex; flex-direction: column; height: calc(100vh - var(--nd-top, 58px) - 14px); box-sizing: border-box; overflow: hidden; }
  #networkPage > * { flex: 0 0 auto; }
  #networkPage > #networkBody { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #networkPage > #networkBody.hidden { display: none; }
  #networkPage #networkBody > .nd-viewer { flex: 1 1 auto; min-height: 280px; display: flex; flex-direction: column; }
  #networkPage .nd-viewer > .nd-viewport { flex: 1 1 auto; height: auto; min-height: 0; }
  #networkPage #netPortsPanel:not(.hidden) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #networkPage #netPortsBody { flex: 1 1 auto; max-height: none; min-height: 0; }
}
@media (max-width: 768px) {
  #networkPage .nd-viewport { height: clamp(320px, 60vh, 700px); }
  #networkPage #netPortsBody { max-height: 60vh; }
}
.nd-page-notes { margin: 0 0 10px 18px; padding: 0; font-size: 12px; color: #92400e; }
.nd-page-notes:empty { display: none; }
body.dark .nd-page-notes { color: #f3c98b; }
#networkPage .nd-tabs { margin-top: 4px; }

.nd-switch-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; margin: 0 0 10px; }
.nd-switch-card label { margin: 0; font-weight: 600; font-size: 0.88rem; white-space: nowrap; }
.nd-switch-sub { font-weight: 400; color: var(--text-muted, #777); }
.nd-switch-card input { flex: 1 1 260px; min-width: 200px; max-width: 420px; margin: 0; }
.nd-switch-hint { flex: 1 1 100%; font-size: 0.74rem; color: var(--text-muted, #777); }
.nd-switch-hint:empty { display: none; }

/* Network page: the zoom pill follows the floorplan canvas' control pill (ghost buttons in one slim pill, bottom centre) */
.nd-viewer .canvas-toolbar { position: absolute; bottom: 12px; left: 50%; right: auto; transform: translateX(-50%); z-index: 5; padding: 4px 6px; gap: 2px; width: auto; margin: 0; }
.nd-viewer .canvas-toolbar .toolbar-group { gap: 2px; flex-wrap: nowrap; }
.nd-viewer .canvas-toolbar .tb-btn { min-width: 30px; min-height: 30px; padding: 4px 7px; border: 0; background: transparent; box-shadow: none; border-radius: 10px; color: var(--text-muted); font-size: 0.8rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.nd-viewer .canvas-toolbar .tb-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.nd-viewer .canvas-toolbar .tb-btn:hover { background: var(--accent-soft); color: var(--accent-text); }
body.dark .nd-viewer .canvas-toolbar { background: rgba(22, 22, 22, 0.90); backdrop-filter: blur(20px) saturate(120%); -webkit-backdrop-filter: blur(20px) saturate(120%); border-color: rgba(255, 255, 255, 0.12); }
.nd-viewport { background: #fff; }
/* Download menu */
.nd-dl { position: relative; display: inline-block; }
.nd-dl > .primary-button { display: inline-flex; align-items: center; }
.nd-dl-menu { position: absolute; z-index: 60; right: 0; top: calc(100% + 6px); min-width: 190px; background: #fff; color: #222; border: 1px solid #ddd; border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.nd-dl-menu.hidden { display: none; }
body.dark .nd-dl-menu { background: #262626; color: #eee; border-color: #444; }
.nd-dl-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer; color: inherit; font: inherit; }
.nd-dl-menu button:hover { background: rgba(63,185,232,.12); }
.nd-dl-menu button small { font-size: 0.74rem; color: var(--text-muted, #777); }

/* Switch field: one slim control on the tab row instead of a card */
.nd-switch { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 4px auto; font-size: 0.8rem; font-weight: 600; color: var(--text-muted, #666); white-space: nowrap; }
.nd-switch input { margin: 0; width: clamp(200px, 26vw, 340px); height: 32px; min-height: 0; padding: 4px 10px; font-size: 0.82rem; font-weight: 400; border-radius: 8px; }

/* Projects: search + 'Mine' live in the name cell of the filter row */
.projects-name-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.projects-name-filter .projects-search { flex: 1 1 110px; min-width: 110px; width: auto; padding: 5px 8px; font-size: 0.78rem; }
.projects-name-filter .projects-assigned-filter { margin: 0; font-size: 0.74rem; flex: 0 0 auto; color: var(--text-muted); }
.projects-name-filter .projects-assigned-filter input[type="checkbox"] { width: 13px; height: 13px; min-width: 13px; }

/* Project modal: name row with the short-name slider on the right */
.project-name-row { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.project-name-row > label { margin: 0; }
.project-name-field { flex: 1 1 0; min-width: 0; transition: flex-grow .25s ease, opacity .2s ease; }
.project-name-field input { width: 100%; box-sizing: border-box; }
.project-short-field { flex: 0 0 0; max-width: 0; opacity: 0; overflow: hidden; pointer-events: none; margin-left: -12px; transition: flex .25s ease, max-width .25s ease, opacity .2s ease, margin .25s ease; }
.project-name-row.short-on .project-short-field { flex: 1 1 0; max-width: 100%; opacity: 1; pointer-events: auto; margin-left: 0; }
.short-switch { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; height: 40px; cursor: pointer; font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; user-select: none; }
input#projectShortNameOn.switch { -webkit-appearance: none; appearance: none; position: relative; width: 36px; height: 20px; min-width: 36px; padding: 0; margin: 0; border: 0; border-radius: 999px; background: var(--input-border, #bbb); cursor: pointer; transition: background .2s ease; flex: 0 0 auto; }
input#projectShortNameOn.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .2s ease; }
input#projectShortNameOn.switch:checked { background: var(--accent); }
input#projectShortNameOn.switch:checked::after { transform: translateX(16px); }
input#projectShortNameOn.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 520px) { .short-switch-text { display: none; } }

/* Find in Salesforce: the search slides out to the right of the button */
.sf-slide { display: inline-flex; max-width: 0; opacity: 0; overflow: hidden; transition: max-width .25s ease, opacity .2s ease; }
.sf-slide.open { max-width: 460px; opacity: 1; }
.sf-slide .sf-find-search { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.sf-slide .sf-find-search input { width: 240px; margin: 0; }
.project-links { margin-top: 4px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .project-links { grid-template-columns: 1fr; } }
.project-handoff { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }

/* Projects table: fixed column widths so the layout (search, filters, columns) never shifts with the rows shown */
.projects-table { table-layout: fixed; }
.projects-table thead th:nth-child(1) { width: 72px; }
.projects-table thead th:nth-child(2) { width: auto; }
.projects-table thead th:nth-child(3) { width: 340px; }
.projects-table thead th:nth-child(4) { width: 220px; }
.projects-table thead th:nth-child(5) { width: 100px; }
.projects-table td.projects-table-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1000px) { .projects-table thead th:nth-child(1) { width: 56px; } .projects-table thead th:nth-child(3) { width: 250px; } .projects-table thead th:nth-child(4) { width: 130px; } .projects-table thead th:nth-child(5) { width: 84px; } }
@media (max-width: 720px) {
  .projects-table thead th:nth-child(1) { width: 52px; }
  .projects-table thead th:nth-child(5) { width: 84px; }
}

/* ── Project modal, second pass ─────────────────────────────────────────── */
.project-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-right: 44px; }
.project-modal-head-text { flex: 1 1 auto; min-width: 0; }
.project-phase-top { flex: 0 0 auto; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; }
.project-phase-top select { margin: 0; min-width: 150px; }
.project-phase-top.hidden { display: none; }

/* Name row: the short-name field is revealed in place — its space is always reserved, so nothing below moves. */
.project-name-row { align-items: flex-end; min-height: 76px; }
.project-name-field { align-self: flex-end; }
.project-short-field { max-width: none; flex: 0 0 0; margin-left: -12px; visibility: hidden; }
.project-name-row.short-on .project-short-field { flex: 1 1 0; margin-left: 0; visibility: visible; }

/* Import row: fixed, single line (the search slides out in place; status text has its own reserved line) */
.scope-import-row { flex-wrap: nowrap; margin-bottom: 4px; min-height: 44px; }
.scope-import-row .secondary-button { flex: 0 0 auto; white-space: nowrap; }
.sf-slide .sf-find-search input { width: 230px; }
.import-status-line { display: flex; flex-direction: column; justify-content: center; margin: 0 0 8px; }
.import-status-line .scope-import-status { margin: 0; flex: 0 0 auto; }
.import-status-line .scope-import-status:empty { display: none; }
@media (max-width: 640px) { .scope-import-row { flex-wrap: wrap; } .sf-slide.open { max-width: 100%; } }
.sf-find-row { margin: 0 0 8px; }
.sf-find-row:has(.sf-find-panel.hidden) { margin: 0; }

.sf-go { width: 38px; height: 38px; min-width: 38px; padding: 0; border-radius: 50%; border: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; cursor: pointer; transition: background .2s ease; flex: 0 0 auto; }
.sf-go svg { display: block; }
.sf-go.searching svg { animation: sfSearchMove 1.2s linear infinite; }
.sf-go.found { background: #2fb36b; box-shadow: 0 0 0 3px rgba(47,179,107,.25); }
@keyframes sfSearchMove {
  0% { transform: translate(0, -4px); } 25% { transform: translate(4px, 0); }
  50% { transform: translate(0, 4px); } 75% { transform: translate(-4px, 0); } 100% { transform: translate(0, -4px); }
}
@media (prefers-reduced-motion: reduce) { .sf-go.searching svg { animation: none; opacity: .6; } }

.url-field .url-title { display: block; margin-bottom: 4px; }
.url-title-link { color: var(--accent-text, var(--accent)); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.url-title-link.hidden, .url-title-text.hidden { display: none; }

/* Edit mode saves by itself: the button only appears when a new floorplan PDF has been chosen */
.project-autosave-status { margin-right: auto; font-size: 0.8rem; color: var(--text-muted); }
.project-modal--editing #saveProject { display: none; }
.project-modal--editing.project-modal--pdf #saveProject { display: inline-flex; }
.project-modal--editing .project-modal-actions { min-height: 40px; }
.project-name-row { height: 78px; min-height: 0; }
.project-name-row > label { white-space: nowrap; overflow: visible; }
.project-short-field { overflow: hidden; width: 0; }
.project-name-row.short-on .project-short-field { width: auto; overflow: visible; }
.project-name-field input { min-width: 0; }
.project-name-row > .project-name-field { display: flex; flex-direction: column; gap: 6px; }
.project-name-row > .short-switch { align-self: flex-end; }
.project-modal-head p { margin-bottom: 14px; }

/* iOS Safari re-inflates text after a portrait -> landscape rotation unless told not to, which pushed layouts wider than the screen */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Pending-review banner: amber like the "Under PM review" tag; on phones a slim full-width bar at the top instead of a big floating pill */
.project-lock-banner--review { background: #fff4d6; color: #8a5a00; border-color: #f0c75e; }
body.dark .project-lock-banner--review { background: #3a2f12; color: #f3cf74; border-color: rgba(240,199,94,.45); }
.project-lock-banner .project-lock-reopen { pointer-events: auto; }
@media (max-width: 768px) {
  .project-lock-banner { top: env(safe-area-inset-top, 0px); bottom: auto; left: 0; right: 0; transform: none; width: auto; border-radius: 0 0 12px 12px; border-top: 0; justify-content: center; flex-wrap: wrap; gap: 4px 8px; padding: 6px 12px; font-size: 0.74rem; line-height: 1.25; text-align: center; }
  .project-lock-banner .project-lock-reopen { margin-left: 0; padding: 2px 10px; font-size: 0.72rem; }
}
@media (max-width: 768px) { .project-lock-banner > svg { display: none; } }

/* Pending-review notices: no stacking. The top banner pushes phone content down; on the Report page the status card carries the notice instead. */
@media (max-width: 768px) { body.has-lock-banner main { padding-top: var(--lockbar-h, 0px); } }
.report-install-status.is-review { background: #fff4d6; color: #8a5a00; border-color: #f0c75e; }
body.dark .report-install-status.is-review { background: #3a2f12; color: #f3cf74; border-color: rgba(240,199,94,.45); }
.report-install-status .project-lock-reopen { margin-left: 4px; }

/* Network tab on phones: no port-count badge, the switch field gets its own full-width row, and one finger scrolls the page
   (the diagram only pans/pinches/drags ports while 'Explore' is on). */
.nd-touch-toggle { display: none; }
/* Touch screens: no control pill at all (one finger scrolls, two fingers pinch/pan). */
@media (pointer: coarse) { .nd-viewer .canvas-toolbar { display: none !important; } }
.nd-viewer .canvas-toolbar .nd-touch-toggle.is-on { background: var(--accent); color: #fff; }
@media (max-width: 768px) {
  #ndPortsCount { display: none; }
  /* The floorplan's phone rules collapse .canvas-toolbar to a vertical dot and hide its zoom group; the diagram's pill is a
     normal horizontal one: Explore + zoom out / fit / in. */
  .nd-viewer .canvas-toolbar { flex-direction: row !important; align-items: center !important; left: 50% !important; right: auto !important; bottom: 12px !important; padding: 4px 6px !important; gap: 4px !important; border-radius: 999px !important; max-height: none !important; }
  .nd-viewer .canvas-toolbar .toolbar-group--zoom { display: flex !important; flex-direction: row !important; }
  .nd-viewer .canvas-toolbar .toolbar-group--zoom button { width: 36px !important; height: 36px !important; }
  .nd-viewer .canvas-toolbar .nd-touch-toggle { width: auto !important; height: 36px !important; padding: 0 12px !important; display: inline-flex !important; }
  #networkPage .nd-tabs { flex-wrap: wrap; row-gap: 8px; }
  #networkPage .nd-switch { flex: 1 1 100%; margin: 0 0 8px; }
  #networkPage .nd-switch span { flex: 0 0 auto; }
  #networkPage .nd-switch input { flex: 1 1 auto; width: auto; min-width: 0; }
}

.projects-loading { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 0.9rem; }
.projects-loading.hidden { display: none; }
.projects-loading-spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: projSpin .8s linear infinite; }
@keyframes projSpin { to { transform: rotate(360deg); } }

/* ── Network tab on phones: a full-screen canvas like the floorplan; switch + ports live in a sheet ─────────────────────── */
.nd-ports-open, .nd-sheet-head, .nd-sheet-switch, .nd-sheet-notes { display: none; }
@media (max-width: 768px) {
  main > #networkPage.active-page { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 6px); bottom: var(--nav-h, 70px); padding: 0 12px; display: flex; flex-direction: column; overflow: hidden; z-index: 5; box-sizing: border-box; }
  body.has-lock-banner main > #networkPage.active-page { top: calc(env(safe-area-inset-top, 0px) + var(--lockbar-h, 0px) + 6px); }
  #networkPage > * { flex: 0 0 auto; }
  #networkPage .page-header { margin: 0 0 8px; align-items: center; flex-wrap: nowrap; justify-content: space-between; }
  #networkPage .report-header-actions { width: auto; flex: 0 0 auto; }
  #networkPage .page-header h2 { font-size: 1.3rem; margin: 0; }
  #networkSubtitle, #netIpImportBtn, .nd-tabs, #networkPage .nd-viewer-hint { display: none !important; }
  #networkPage > #networkBody { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #networkPage > #networkBody.hidden { display: none; }
  #networkPage .nd-viewer { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #networkPage .nd-viewer > .nd-viewport { flex: 1 1 auto; height: auto; min-height: 0; touch-action: none; overscroll-behavior: contain; }
  .nd-ports-open { display: inline-flex; align-items: center; position: absolute; right: 8px; left: auto; bottom: 8px; z-index: 6; padding: 0 16px; height: 40px; border-radius: 999px; border: 1px solid var(--panel-border); background: var(--panel-strong, #262626); color: var(--text); font-weight: 600; font-size: 0.85rem; box-shadow: var(--shadow); }
  /* The sheet: full-screen, slides up (the ports table, customer switch and notes). It sits on <body> (see _ndPlace()). */
  #netPortsPanel { display: none; position: fixed; inset: 0; z-index: 450; flex-direction: column; background: var(--bg-0, #1c1c1c); transform: translateY(100%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px calc(env(safe-area-inset-bottom, 0px) + 10px); box-sizing: border-box; overflow: hidden; }
  body.lock-banner-shown #netPortsPanel { padding-top: calc(env(safe-area-inset-top, 0px) + var(--lockbar-h, 0px) + 10px); }
  body:has(#networkPage.active-page) #netPortsPanel { display: flex; }
  #netPortsPanel.nd-sheet-open { transform: translateY(0); visibility: visible; transition: transform .25s ease; }
  .nd-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 10px; font-size: 1.15rem; }
  .nd-sheet-close { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--panel-border); background: transparent; color: var(--text); }
  .nd-sheet-switch { display: block; margin-bottom: 8px; }
  .nd-sheet-notes { display: block; }
  #netPortsPanel .nd-switch { display: flex; margin: 0 0 8px; width: 100%; }
  #netPortsPanel .nd-switch input { flex: 1 1 auto; width: auto; min-width: 0; font-size: 16px; }
  #netPortsPanel #netPortsBody { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; -webkit-overflow-scrolling: touch; }
}

/* Projects on phones: search + Mine dock above the bottom tab bar; no 'create a project' blurb (projects aren't created on a phone). */
.projects-search-dock { display: none; }
@media (max-width: 768px) {
  #projectsPage .page-header > div > p { display: none; }
  .projects-filter-row { display: none; }
  .projects-search-dock { position: fixed; left: 0; right: 0; bottom: 70px; z-index: 90; padding: 8px 12px; background: var(--panel-strong, #262626); border-top: 1px solid var(--panel-border); }
  body:has(#projectsPage.active-page) .projects-search-dock { display: block; }
  .projects-search-dock .projects-name-filter { flex-wrap: nowrap; gap: 12px; }
  .projects-search-dock .projects-search { flex: 1 1 auto; min-width: 0; padding: 10px 14px; font-size: 16px; }
  .projects-search-dock .projects-assigned-filter { font-size: 0.85rem; }
  .projects-search-dock .projects-assigned-filter input[type="checkbox"] { width: 18px; height: 18px; min-width: 18px; }
  #projectsPage { padding-bottom: 72px; }
  .projects-search-dock.is-typing { bottom: auto !important; top: 0; padding-top: calc(env(safe-area-inset-top, 0px) + 8px); border-top: 0; border-bottom: 1px solid var(--panel-border); }
  body.projects-typing #projectsPage { padding-top: calc(env(safe-area-inset-top, 0px) + 64px); }
}

/* ── About › Feedback, Settings › Floorplan guide ─────────────────────────── */
.about-feedback-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.um-btn--ghost { background: transparent; }
.about-feedback-status { min-height: 1.3em; margin: 8px 0 0; font-size: 0.82rem; }
#settingsTourCard .settings-row-actions { margin-top: 10px; }

/* ── First-time floorplan guide (tour.js) ─────────────────────────────────── */
#ffTour[hidden] { display: none; }
.ff-tour-block { position: fixed; inset: 0; z-index: 99990; background: transparent; cursor: default; }
.ff-tour-block.ff-tour-dim { background: rgba(10, 14, 20, 0.62); }
.ff-tour-spot { position: fixed; z-index: 99991; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(10, 14, 20, 0.62), 0 0 0 2px var(--accent), 0 0 18px 2px rgba(63, 185, 232, 0.55);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease; }
.ff-tour-card { position: fixed; z-index: 99992; box-sizing: border-box; width: min(340px, calc(100vw - 24px)); padding: 16px 18px 14px;
  background: var(--panel-strong); color: var(--text); border: 1px solid var(--panel-border); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38); outline: none; }
.ff-tour-card--center { width: min(400px, calc(100vw - 24px)); }
.ff-tour-step { font-size: 0.7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text, var(--accent)); margin-bottom: 4px; }
.ff-tour-x { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--text); font-size: 1.3rem; line-height: 1; cursor: pointer; opacity: .6; }
.ff-tour-x:hover { opacity: 1; background: rgba(128, 128, 128, 0.18); }
.ff-tour-title { margin: 0 0 6px; font-size: 1.02rem; line-height: 1.25; padding-right: 26px; }
.ff-tour-body { margin: 0 0 12px; font-size: 0.88rem; line-height: 1.5; color: var(--text); opacity: .9; }
.ff-tour-dots { display: flex; gap: 5px; margin-bottom: 12px; }
.ff-tour-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(128, 128, 128, 0.35); }
.ff-tour-dot.is-past { background: rgba(63, 185, 232, 0.55); }
.ff-tour-dot.is-on { background: var(--accent); transform: scale(1.25); }
.ff-tour-actions { display: flex; align-items: center; gap: 8px; }
.ff-tour-spacer { flex: 1 1 auto; }
.ff-tour-btn { height: 32px; min-height: 0; width: auto; padding: 0 14px; border-radius: 999px; border: 1px solid var(--panel-border);
  background: var(--panel-strong); color: var(--text); font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; }
.ff-tour-btn:hover { border-color: var(--accent); }
.ff-tour-btn--ghost { border-color: transparent; background: transparent; opacity: .75; padding: 0 6px; }
.ff-tour-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ff-tour-btn[hidden], .ff-tour-x[hidden] { display: none; }
.ff-tour-btn:focus-visible, .ff-tour-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 768px) { .ff-tour-card { padding: 14px 15px 12px; } }

/* Project modal: the three link fields stack vertically (Salesforce Project, SimCapture URL, jAUS URL) */
.project-links { grid-template-columns: 1fr; gap: 10px; }

/* Settings + About: cards flow into as many columns as fit (one column on phones), header spans the top */
#settingsPage.active-page, #aboutPage.active-page { column-width: 420px; column-gap: 16px; max-width: 1320px; }
#settingsPage > .page-header, #aboutPage > .page-header { column-span: all; }
#settingsPage .settings-card, #aboutPage .settings-card { max-width: none; width: 100%; box-sizing: border-box; break-inside: avoid; }

/* BOM revisions: Legacy icons */
.icon-bom-row { align-items: end; }
.icon-bom-row .icon-bom-legacy { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 14px; }
.icon-bom-row .icon-bom-legacy input[type="checkbox"] { appearance: auto; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.new-icon-form--marker .icon-bom-row { display: none; }
.icon-legacy-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 12px; font-size: 0.85rem; color: var(--text-muted); width: 100%; }
.icon-legacy-bar label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text); font-weight: 600; cursor: pointer; }
.icon-legacy-bar input[type="checkbox"] { appearance: auto; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.icon-table td.it-legacy { color: #b45309; font-weight: 600; }
body.dark .icon-table td.it-legacy { color: #fbbf24; }
.rd-pill--legacy { background: rgba(180, 83, 9, 0.12); color: #b45309; border: 1px solid rgba(180, 83, 9, 0.35); }
body.dark .rd-pill--legacy { background: rgba(251, 191, 36, 0.14); color: #fbbf24; border-color: rgba(251, 191, 36, 0.4); }

/* ── "View as" (view-as.js): an admin sees the app as another person, read-only ── */
.view-as-bar { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 9000; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 7px 8px 7px 12px; border-radius: 999px; background: #6d28d9; color: #fff; font-size: 0.82rem; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }
.view-as-bar-eye { display: inline-flex; }
.view-as-bar-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-as-bar button { border: 0; border-radius: 999px; padding: 4px 11px; font: inherit; font-weight: 600; cursor: pointer; background: rgba(255, 255, 255, 0.2); color: #fff; }
.view-as-bar button:hover { background: rgba(255, 255, 255, 0.34); }
.view-as-bar .view-as-bar-exit { background: #fff; color: #6d28d9; }
body.view-as-active::after { content: ''; position: fixed; inset: 0; z-index: 8999; pointer-events: none; box-shadow: inset 0 0 0 3px #6d28d9; }
.view-as-avatar { outline: 2px solid #6d28d9; outline-offset: 2px; border-radius: 50%; }
@media (max-width: 768px) { .view-as-bar { top: calc(env(safe-area-inset-top, 0px) + 8px); } }
.view-as-modal { position: fixed; inset: 0; z-index: 9500; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); padding: 16px; }
.view-as-modal.hidden { display: none; }
.view-as-card { width: min(480px, 100%); max-height: min(640px, 90vh); display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 12px; background: var(--panel-strong, #fff); color: var(--text, #262626); border: 1px solid var(--border, #ddd); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); }
.view-as-card h3 { margin: 0; font-size: 1.1rem; }
.view-as-sub { margin: 0; font-size: 0.82rem; opacity: 0.75; }
.view-as-search { width: 100%; box-sizing: border-box; margin: 0; }
.view-as-list { flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; border: 1px solid var(--border, #ddd); border-radius: 8px; }
.view-as-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'n r' 'e r'; gap: 0 12px; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--border, #ddd); background: transparent; color: inherit; cursor: pointer; font: inherit; }
.view-as-row:last-child { border-bottom: 0; }
.view-as-row:hover, .view-as-row:focus-visible { background: rgba(109, 40, 217, 0.1); outline: none; }
.view-as-name { grid-area: n; font-weight: 600; }
.view-as-email { grid-area: e; font-size: 0.78rem; opacity: 0.7; overflow: hidden; text-overflow: ellipsis; }
.view-as-role { grid-area: r; align-self: center; font-size: 0.74rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: rgba(109, 40, 217, 0.14); color: #6d28d9; white-space: nowrap; }
body.dark .view-as-role { color: #c4b5fd; background: rgba(167, 139, 250, 0.18); }
.view-as-empty { padding: 18px; text-align: center; opacity: 0.7; font-size: 0.88rem; }
.view-as-actions { display: flex; justify-content: flex-end; }
.view-as-actions button { border: 1px solid var(--border, #ddd); background: transparent; color: inherit; border-radius: 8px; padding: 7px 14px; cursor: pointer; font: inherit; }
#reportSurveyFinalBtn svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; }
/* Punch List tab: items grouped by room, with the data drops listed under each room. */
.punch-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.punch-group { list-style: none; border: 1px solid var(--border, #ddd); border-radius: 10px; overflow: hidden; }
.punch-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 12px; font-weight: 700; background: rgba(128, 128, 128, 0.1); }
.punch-group-count { font-weight: 500; font-size: 0.78rem; opacity: 0.75; }
/* The room's own row: name, the Ready-for-install tick (the room's disposition), counts, and the note that explains why it is not ready. */
.punch-group-head.punch-item--room { display: grid; grid-template-columns: 1fr auto auto; align-items: center; column-gap: 12px; row-gap: 4px; }
.punch-room-name { font-weight: 700; }
.punch-room-pill { margin: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.punch-room-pill input.punch-cb { -webkit-appearance: checkbox; appearance: auto; width: 16px; height: 16px; min-width: 16px; margin: 0; padding: 0; border: initial; background: none; box-shadow: none; }
.punch-room-pill.rd-pill--rj45-ok input { accent-color: #16a34a; }
.punch-room-pill.rd-pill--rj45-no input { accent-color: #dc2626; }
.punch-room-note { grid-column: 1 / -1; font-size: 0.85rem; font-weight: 400; opacity: 0.85; }
.punch-group-head.punch-item--room > .punch-note { grid-column: 1 / -1; width: 100%; box-sizing: border-box; margin: 0; }
.punch-group-head.punch-item--room.is-resolved .punch-room-name { text-decoration: none; }
/* Room block laid out like the room details card: device table, then disposition and notes. */
.punch-table { width: 100%; border-collapse: collapse; }
.punch-table th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: .04em; opacity: .7; padding: 6px 12px; }
.punch-table td { padding: 6px 12px; vertical-align: middle; border-top: 1px solid var(--border, #ddd); }
.punch-table th.punch-td-pill, .punch-table td.punch-td-pill { width: 130px; text-align: right; white-space: nowrap; }
.punch-table th:first-child, .punch-table td:first-child:not(.punch-td-name) { width: 44px; }
.punch-table img.room-detail-icon-thumb { width: 32px; height: 32px; object-fit: contain; display: block; }
.punch-name-text { font-weight: 600; }
.punch-table .punch-meta { padding: 0; font-size: 0.74rem; opacity: .75; }
.punch-table .room-detail-badges { display: flex; gap: 4px; margin-top: 3px; }
.punch-row.is-resolved .punch-name-text { opacity: .85; }
.punch-table tr.punch-row { display: table-row; }
.punch-table .punch-td-name { min-width: 0; }
.rd-pill--rj45-edit input.punch-cb { -webkit-appearance: checkbox; appearance: auto; width: 16px; height: 16px; min-width: 16px; margin: 0; padding: 0; border: initial; background: none; box-shadow: none; }
.rd-pill--rj45-ok input.punch-cb { accent-color: #16a34a; }
.rd-pill--rj45-no input.punch-cb { accent-color: #dc2626; }
.punch-room-foot { padding: 10px 12px 12px; border-top: 1px solid var(--border, #ddd); display: flex; flex-direction: column; gap: 6px; }
.punch-room-foot .room-notes-textarea { width: 100%; box-sizing: border-box; }
.punch-cfe-hint { margin: 0; padding: 6px 12px 0; font-size: 0.82rem; opacity: .8; }
.punch-sublist { list-style: none; margin: 0; padding: 0; }
.punch-sublist > .punch-item { padding: 8px 12px; border-top: 1px solid var(--border, #ddd); }
.punch-sublist > .punch-item:first-child { border-top: 0; }
.punch-missing { flex-wrap: wrap; }
.punch-na { opacity: .4; }
/* Room picker for a manually added item: a custom menu (the native list opened outside the window at the bottom of the page). */
.punch-roompick { position: relative; flex: 0 0 auto; }
.punch-roompick-btn { display: inline-flex; align-items: center; gap: 8px; height: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--border, #ccc); border-radius: 10px; background: var(--panel-strong, #fff); color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.punch-roompick-menu { position: absolute; z-index: 40; right: 0; top: calc(100% + 4px); min-width: 100%; width: max-content; max-width: min(320px, 80vw); max-height: 240px; overflow-y: auto; padding: 4px; border: 1px solid var(--border, #ccc); border-radius: 10px; background: var(--panel-strong, #fff); box-shadow: 0 10px 28px rgba(0, 0, 0, .28); display: flex; flex-direction: column; }
.punch-roompick-menu.hidden { display: none; }
.punch-roompick-menu.is-up { top: auto; bottom: calc(100% + 4px); }
.punch-roompick-opt { text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.punch-roompick-opt:hover, .punch-roompick-opt:focus-visible { background: rgba(63, 185, 232, .18); outline: none; }
.punch-missing-list { flex: 1 1 100%; margin: 4px 0 0; padding-left: 18px; font-size: 0.85rem; }
