/* ============================================================
   House Progress Tracker — Global Styles
   ============================================================ */


/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:           #F5F0E8;
  --surface:      #FDFAF5;
  --surface-2:    #EDE8DC;
  --surface-3:    #E5DFD1;

  /* Borders */
  --border:       #D8D1C4;
  --border-dark:  #C4BAA8;

  /* Text */
  --text-primary:   #2C2825;
  --text-secondary: #5C5249;
  --text-muted:     #9A8E82;
  --text-faint:     #BDB0A4;

  /* Sage — primary accent (replaces --gold everywhere) */
  --sage:         #7D9B76;
  --sage-light:   #A8C4A0;
  --sage-dark:    #5A7554;
  --sage-muted:   #C4D4BF;
  --sage-wash:    #EBF0E9;

  /* Warm accents */
  --terracotta:       #B8735A;
  --terracotta-muted: #D4A898;
  --clay:             #9C7A5E;
  --linen:            #C8B89A;

  /* Semantic */
  --success:  #5A8A6A;
  --warning:  #9A7A3A;
  --danger:   #A05540;
  --bought:   #4A7A6A;

  /* Shape */
  --radius:    6px;
  --radius-lg: 12px;
  --radius-xl: 20px;

  /* Motion */
  --transition:      0.2s ease;
  --transition-slow: 0.35s ease;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(44, 40, 37, 0.06), 0 1px 2px rgba(44, 40, 37, 0.04);
  --shadow-md: 0 4px 12px rgba(44, 40, 37, 0.08), 0 2px 4px rgba(44, 40, 37, 0.05);
  --shadow-lg: 0 8px 24px rgba(44, 40, 37, 0.10), 0 4px 8px rgba(44, 40, 37, 0.06);

  /* Typography */
  --font-heading: 'Jost', system-ui, sans-serif;
  --font-body:    'Jost', system-ui, sans-serif;

  /* Type scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.25rem;
  --text-xl:   1.75rem;
  --text-2xl:  2.5rem;

  --leading-tight:  1.25;
  --leading-normal: 1.6;
  --tracking-wide:  0.08em;

  /* project.html layout */
  --sidebar-w:  320px;
  --header-h:   64px;
}

/* ── Base ─────────────────────────────────────────────────── */
html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: var(--leading-normal);
  font-weight: 300;
}

[x-cloak] { display: none !important; }

/* ── Shared Layout ────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Page Header (landing) ────────────────────────────────── */
.page-header {
  padding: 5rem 0 0;
  text-align: center;
}

.site-name {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: var(--leading-tight);
}

.header-divider {
  height: 1px;
  background: var(--border);
  margin: 1.75rem 0 1.25rem;
}

.site-tagline {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding-bottom: 4rem;
  font-weight: 400;
}

/* ── Main ─────────────────────────────────────────────────── */
.page-main {
  padding-bottom: 6rem;
}

/* ── State indicators ─────────────────────────────────────── */
.loading-indicator,
.error-indicator {
  padding: 6rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* ── Projects Grid ────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Project Card ─────────────────────────────────────────── */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-top-color: var(--sage);
  box-shadow: var(--shadow-md);
}

/* ── Card Thumbnail ───────────────────────────────────────── */
.card-thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
  flex-shrink: 0;
}

.card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.85);
  transition: filter var(--transition);
}

.project-card:hover .card-thumb-img {
  filter: saturate(1);
}

.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}

/* ── Card Content ─────────────────────────────────────────── */
.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.card-name {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 400;
  color: var(--text-primary);
  line-height: var(--leading-tight);
  margin-bottom: 0.375rem;
}

.card-client {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: 0.25rem;
  font-weight: 400;
}

.card-date {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 300;
}

/* ── Progress ─────────────────────────────────────────────── */
.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.progress-label-text {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-weight: 400;
}

.progress-pct-text {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--sage);
}

.progress-bar-track {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: var(--radius);
}

.progress-bar-fill {
  height: 100%;
  background: var(--sage);
  transition: width 0.5s ease;
  width: 0;
  border-radius: var(--radius);
}

.progress-fill--low {
  background: var(--danger);
}

.progress-fill--mid {
  background: var(--warning);
}

.progress-fill--high {
  background: var(--success);
}

/* ── Card Footer ──────────────────────────────────────────── */
.card-footer {
  margin-top: auto;
}

/* ── Buttons (card-level) ─────────────────────────────────── */
.btn-view {
  display: inline-block;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color var(--transition), color var(--transition);
  line-height: 1.4;
}

.btn-view:disabled {
  cursor: not-allowed;
}

.btn-view.btn-view--active {
  background: #7b4242;
  border-color: #5f3333;
  color: var(--surface);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(123, 66, 66, 0.22);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
}

.btn-view:hover:not(:disabled) {
  border-color: var(--sage);
  color: var(--sage-dark);
}

.btn-view:disabled:hover {
  border-color: #7b4242;
  background: rgba(123, 66, 66, 0.12);
  color: #7b4242;
}

.btn-view.btn-view--active:hover {
  background: #5f3333;
  border-color: #ffffff !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(123, 66, 66, 0.28);
}

/* ── Password Gate ────────────────────────────────────────── */
.pw-gate {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.pw-gate--open {
  max-height: 120px;
}

.pw-gate-inner {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

.pw-row {
  display: flex;
}

.pw-input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-right: none;
  color: var(--text-primary);
  padding: 0.625rem 0.75rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 300;
  border-radius: var(--radius) 0 0 var(--radius);
  outline: none;
  transition: border-color var(--transition);
}

.pw-input::placeholder {
  color: var(--text-muted);
}

.pw-input:focus {
  border-color: var(--sage);
}

.pw-input--error {
  border-color: var(--danger) !important;
}

.btn-unlock {
  background: var(--sage);
  color: #FDFAF5;
  border: none;
  padding: 0.625rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: background var(--transition);
  flex-shrink: 0;
}

.btn-unlock:hover {
  background: var(--sage-dark);
}

.pw-error {
  margin-top: 0.5rem;
  font-size: var(--text-xs);
  color: var(--danger);
  font-weight: 400;
}

/* ── Shake animation ──────────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-5px); }
  30%       { transform: translateX(5px); }
  45%       { transform: translateX(-4px); }
  60%       { transform: translateX(4px); }
  75%       { transform: translateX(-2px); }
  90%       { transform: translateX(2px); }
}

.shake {
  animation: shake 0.5s ease;
}

/* ── Status badges ────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
}

.badge-to-buy  { background: rgba(160, 85, 64, 0.10); color: var(--terracotta); border: 1px solid rgba(160, 85, 64, 0.25); }
.badge-bought  { background: rgba(74, 122, 106, 0.12); color: var(--bought);     border: 1px solid rgba(74, 122, 106, 0.30); }
.badge-ongoing { background: rgba(154, 122, 58, 0.10); color: var(--warning);    border: 1px solid rgba(154, 122, 58, 0.25); }
.badge-done    { background: rgba(90, 138, 106, 0.14); color: var(--success);    border: 1px solid rgba(90, 138, 106, 0.30); }

/* ── SVG floor plan overlay (project.html) ────────────────── */
#floorplan-svg .room-polygon {
  cursor: pointer;
  fill: var(--sage-wash);
  stroke: var(--sage);
  transition: fill 0.15s ease, stroke 0.15s ease, fill-opacity 0.15s ease, stroke-opacity 0.15s ease, stroke-width 0.15s ease;
}

#floorplan-svg .room-polygon-hatch {
  transition: opacity 0.15s ease;
}

/* ── Sidebar (project.html) ───────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  transition: transform 0.28s ease;
}

.sidebar.collapsed {
  transform: translateX(100%);
}

/* ── Modal overlay (project.html) ────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 40, 37, 0.50);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.25rem;
}

/* Hint the browser to keep modal/backdrop on a composited layer to avoid flicker */
.modal-backdrop,
.proj-modal {
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

/* ── Floor tab switcher (project.html) ────────────────────── */
.floor-tabs {
  display: flex;
  gap: 2px;
  background: var(--border);
  padding: 2px;
  border-radius: var(--radius);
}

.floor-tab {
  padding: 0.375rem 0.875rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 400;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.floor-tab.active {
  background: var(--surface);
  color: var(--sage);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    z-index: 50;
  }

  .site-name {
    font-size: var(--text-xl);
  }
}

/* ═══════════════════════════════════════════════════════════
   project.html — Floor Plan Viewer
   ═══════════════════════════════════════════════════════════ */

/* ── Layout shell ─────────────────────────────────────────── */
.proj-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Project header ───────────────────────────────────────── */
.proj-header {
  height: 56px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: relative;
  z-index: 10;
}

.proj-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}

.proj-back-link {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--transition);
}

.proj-back-link:hover {
  color: var(--text-primary);
}

.proj-back-link-mobile {
  display: none;
}

.proj-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.proj-header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  min-width: 140px;
  max-width: min(62vw, 560px);
  pointer-events: none;
}

.proj-edit-badge {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  background: var(--sage-muted);
  color: var(--sage-dark);
  padding: 2px 8px;
  border-radius: var(--radius);
  white-space: nowrap;
}

.proj-name {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--text-primary);
  line-height: var(--leading-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.proj-client {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.proj-header-right {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
  margin-left: auto;
}

.proj-settings-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.proj-settings-btn:hover {
  border-color: var(--sage);
  color: var(--text-primary);
}

.proj-plot-rooms-btn {
  background: var(--sage-wash);
}

.proj-completion-pct {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--sage);
  white-space: nowrap;
}

.proj-header-bar-track {
  width: 80px;
  height: 2px;
  background: var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.proj-header-bar-fill {
  height: 100%;
  background: var(--sage);
  border-radius: var(--radius);
  transition: width 0.5s ease;
  width: 0;
}

/* ── Body (sidebar + floor plan) ──────────────────────────── */
/* ── Project sub-navigation ───────────────────────────── */
.proj-subnav {
  height: 40px;
  flex-shrink: 0;
  width: 100%;
  position: relative;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.25rem;
  box-sizing: border-box;
  z-index: 9;
}

/* Main floor subnav: two-column strip (sidebar zone + content); border only under content */
.proj-subnav--main {
  padding: 0;
  border-bottom: none;
  justify-content: stretch;
  align-items: stretch;
}

.proj-subnav--main > .proj-subnav-row {
  display: flex;
  flex: 1;
  align-items: stretch;
  align-self: stretch;
  width: 100%;
  min-height: 40px;
  box-sizing: border-box;
  position: relative;
}

@media (min-width: 769px) {
  .proj-subnav--main > .proj-subnav-row {
    width: calc(100% + 280px);
    margin-left: -280px;
  }
}

.proj-subnav--main .proj-subnav-side {
  flex-shrink: 0;
  width: 280px;
  background: var(--surface);
  box-sizing: border-box;
}

.proj-subnav--main .proj-subnav-fill {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.25rem;
  transition: width 0.25s ease;
}

/* Segmented control (main floor subnav) */
.subnav-tab-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--surface-2);
  flex-shrink: 0;
  box-sizing: border-box;
}

.subnav-tab-group .proj-subnav-btn {
  position: relative;
  margin: 0;
  border: none;
  background: transparent;
  color: #6a6460;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.2;
  padding: 5px 22px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color var(--transition),
    background-color var(--transition);
}

.subnav-tab-group .proj-subnav-btn:hover:not(.is-active) {
  color: #6a6460;
  background: rgba(0, 0, 0, 0.04);
}

.subnav-tab-group .proj-subnav-btn.is-active {
  background: var(--surface);
  color: #1a1816;
  font-weight: 500;
}

/* Modal / summary inline tabs (unchanged tab-divider + underline pattern) */
.tasks-summary-subnav > .proj-subnav-btn {
  position: relative;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  padding: 0 1.25rem;
  cursor: pointer;
  transition: color var(--transition);
  white-space: nowrap;
}

.tasks-summary-subnav > .proj-subnav-btn + .proj-subnav-btn {
  border-left: 1px solid var(--border-dark);
}

.tasks-summary-subnav > .proj-subnav-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0.75rem;
  right: 0.75rem;
  height: 2px;
  background: var(--sage);
  border-radius: 1px 1px 0 0;
  transform: scaleX(0);
  transition: transform var(--transition);
}

.tasks-summary-subnav > .proj-subnav-btn:hover {
  color: var(--text-primary);
}

.tasks-summary-subnav > .proj-subnav-btn.is-active {
  color: var(--text-primary);
  font-weight: 500;
}

.tasks-summary-subnav > .proj-subnav-btn.is-active::after {
  transform: scaleX(1);
}

/* Floor plan image stack — context bar flush above container */
.floorplan-plan-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  align-self: stretch;
}

/* ── Floor context bar (between subnav and floorplan image) ── */
.proj-floor-context-bar {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  padding: 0.65rem 1.25rem;
  font-family: var(--font-body);
}

.proj-floor-context-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-width: 0;
}

.proj-floor-context-eyebrow {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.2;
}

.proj-floor-context-floor-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proj-floor-context-mobile-rooms {
  display: none;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.2;
}

.proj-floor-context-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 1.25rem;
  flex-shrink: 0;
}

.proj-floor-context-room-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.proj-floor-context-room-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
}

.proj-floor-context-room-label {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1;
}

.proj-body {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.proj-sidebar {
  position: relative;
  width: 280px;
  min-width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

/* ── Sidebar edge toggle tab (desktop only) ──────────────── */
/*
 * Lives as an adjacent sibling of .proj-sidebar inside .proj-body.
 * Hidden on mobile — the hamburger drawer handles mobile.
 * On desktop the tab is always rendered; CSS moves it via the
 * .sidebar--collapsed sibling selector so no JS positioning is needed.
 */
.sidebar-toggle-tab {
  display: none; /* shown only in min-width: 769px block below */
}

@media (min-width: 769px) {
  .sidebar-toggle-tab {
    display: flex;
    align-items: center;
    justify-content: center;

    /* Overlap the sidebar's right border */
    position: absolute;
    left: 280px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 12;

    width: 18px;
    height: 26px;
    padding: 0;
    margin: 0;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 var(--radius) var(--radius) 0;
    border-left: none;

    color: var(--text-muted);
    cursor: pointer;

    /* Chevron drawn as ::after so we can rotate without markup */
    transition: left 0.25s ease, color var(--transition), box-shadow var(--transition);
  }

  /* Chevron character */
  .sidebar-toggle-tab::after {
    content: '‹';
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1;
    display: block;
    transition: transform 0.25s ease;
  }

  .sidebar-toggle-tab--collapsed::after {
    transform: rotate(180deg);
  }

  .sidebar-toggle-tab:hover {
    color: var(--text-secondary);
    box-shadow: 2px 0 6px rgba(0,0,0,0.07);
  }

  /* When sidebar collapses, tab slides to the left edge */
  .sidebar-toggle-tab--collapsed {
    left: 6px;
    border-radius: 0 var(--radius) var(--radius) 0;
  }
}

@media (min-width: 769px) {
  .proj-sidebar {
    transition:
      width 0.25s ease,
      min-width 0.25s ease;
  }

  .proj-sidebar.sidebar--collapsed {
    width: 0;
    min-width: 0;
    padding: 0;
    border-right: none;
    overflow: hidden;
  }

  /* Subnav left chunk + row offset track collapsed sidebar (same as binding width to 0) */
  .proj-sidebar.sidebar--collapsed ~ .proj-floorplan-area .proj-subnav--main > .proj-subnav-row {
    width: 100%;
    margin-left: 0;
  }

  .proj-sidebar.sidebar--collapsed ~ .proj-floorplan-area .floorplan-container {
    max-width: calc(100vw - 4rem);
  }

  .proj-sidebar.sidebar--collapsed ~ .proj-floorplan-area .floorplan-workspace {
    max-width: calc(100vw - 4rem);
  }
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.25rem 0.5rem;
}

.sidebar-section-label {
  font-family: var(--font-body);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0;
  min-width: 0;
}

.sidebar-add-floor-btn {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.sidebar-add-floor-btn:hover {
  border-color: var(--sage);
  color: var(--sage);
  background: rgba(125, 155, 118, 0.06);
}

/* ── Floor rows ───────────────────────────────────────────── */
.floor-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}

.floor-row:hover {
  background: var(--surface-2);
}

.floor-active {
  border-left-color: var(--sage);
}

.floor-row::after {
  content: '';
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 0;
  height: 1px;
  background: var(--sage);
  opacity: 0;
  transform: scaleX(0.85);
  transition: opacity var(--transition), transform var(--transition);
}

.floor-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.floor-chevron {
  font-size: 0.5rem;
  color: var(--text-muted);
  display: inline-block;
  flex-shrink: 0;
  transition: transform var(--transition);
  line-height: 1;
}

.floor-chevron.rotated {
  transform: rotate(90deg);
}

.floor-row-left {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.floor-label-text {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  flex-shrink: 1;
  min-width: 0;
}

.floor-room-count {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 300;
  white-space: nowrap;
}

.floor-add-room-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.floor-add-room-btn:hover {
  border-color: var(--sage);
  color: var(--text-primary);
  background: rgba(125, 155, 118, 0.06);
}

.floor-settings-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.floor-settings-btn:hover {
  border-color: var(--sage);
  color: var(--text-primary);
  background: rgba(125, 155, 118, 0.06);
}

/* ── Add room modal (project.html) ─────────────────────────── */
.add-room-modal {
  max-height: 78vh;
}

.add-room-modal .proj-modal-floor-label {
  margin-bottom: 0.4rem;
}

.add-room-modal-body {
  padding: 1.5rem 1.75rem 0.5rem;
}

.add-room-form {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.add-room-modal-body .settings-status-error {
  font-size: 1.625rem;
}

.projects-create-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.add-room-modal-body .settings-status-error.projects-create-error-text {
  font-size: 0.75rem;
  line-height: 1.2;
  margin: 0;
  flex: 1;
}

.projects-create-footer-row .settings-actions {
  margin-left: auto;
  flex-shrink: 0;
}

.add-room-modal-body .settings-input.projects-input-conflict,
.add-room-modal-body .settings-input.projects-input-conflict:focus {
  border-color: #7b4242;
  box-shadow: 0 0 0 1px rgba(123, 66, 66, 0.2);
}

/* ── Room rows ────────────────────────────────────────────── */
.room-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem 0.5rem 2.25rem;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

/* Match horizontal span of .floor-row::after (3px border + 1.25rem, right 1.25rem) */
.room-row:not(:last-child)::after {
  content: '';
  position: absolute;
  left: calc(3px + 1.25rem);
  right: 1.25rem;
  bottom: 0;
  height: 1px;
  background: color-mix(in srgb, var(--text-muted) 14%, transparent);
  pointer-events: none;
}

.room-row:hover,
.room-highlighted {
  background: var(--surface-2);
}

.room-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.50;
  transition: opacity var(--transition);
}

.room-row:hover .room-dot,
.room-highlighted .room-dot,
.room-active .room-dot {
  opacity: 1;
}

.room-row-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  transition: color var(--transition);
}

.room-row:hover .room-row-label,
.room-highlighted .room-row-label,
.room-active .room-row-label {
  color: var(--text-primary);
}

/* ── Floor plan area ──────────────────────────────────────── */
.proj-floorplan-area {
  position: relative;
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}

.floorplan-container {
  aspect-ratio: 4 / 3;
  width: min(100%, calc((100vh - 56px - 40px - 4rem) * 4 / 3));
  max-width: calc(100vw - 280px - 4rem);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: var(--radius);
  position: relative;
}

.floorplan-container svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Modal transition keyframes & classes ─────────────────── */
@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes modal-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes modal-slide-down {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(20px); }
}

.fade-in    { animation: modal-fade-in    0.18s ease     both; }
.fade-out   { animation: modal-fade-out   0.18s ease     both; }
.slide-up   { animation: modal-slide-up   0.22s ease-out both; }
.slide-down { animation: modal-slide-down 0.22s ease-out both; }

/* Alpine x-transition helpers (more stable than keyframes for fixed overlays) */
.backdrop-trans { transition: opacity 0.18s ease; }
.backdrop-enter-start { opacity: 0; }
.backdrop-enter-end { opacity: 1; }

.modal-trans { transition: opacity 0.22s ease-out, transform 0.22s ease-out; }
.modal-enter-start { opacity: 0; transform: translateY(20px); }
.modal-enter-end { opacity: 1; transform: translateY(0); }

.settings-modal-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings-form {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem 2.5rem;
}

.settings-label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 500;
}

.projects-required-asterisk {
  display: inline-flex;
  align-items: center;
  margin-left: 0.2rem;
  line-height: 1;
  vertical-align: middle;
}

.settings-input,
.settings-textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 0.65rem 0.875rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  text-transform: none;
  letter-spacing: normal;
  transition: border-color var(--transition), background var(--transition);
}

.settings-input:focus,
.settings-textarea:focus {
  outline: none;
  border-color: var(--sage);
  background: var(--surface);
}

.settings-textarea {
  min-height: 96px;
  resize: vertical;
}

.settings-password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.settings-ghost-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  border-radius: var(--radius);
  padding: 0.5rem 0.875rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  white-space: nowrap;
}

.settings-ghost-btn:hover {
  border-color: var(--sage);
  color: var(--text-primary);
}

.settings-modal-footer {
  flex-shrink: 0;
  padding: 1.25rem 2.5rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.settings-status {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.8125rem;
}

.settings-status-error {
  color: var(--danger);
}

.settings-status-success {
  color: var(--success);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.625rem;
}

.settings-actions .btn-view {
  padding: 0.5rem 1.25rem;
}

.settings-actions .btn-view:not(:disabled) {
  background: var(--sage);
  border-color: var(--sage-dark);
  color: var(--surface);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(90, 117, 84, 0.18);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
}

.settings-actions .btn-view:not(:disabled):hover {
  background: var(--sage-dark);
  border-color: var(--sage-dark);
  color: var(--surface);
  box-shadow: 0 2px 6px rgba(90, 117, 84, 0.22);
}

.settings-actions .btn-view:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.floor-settings-delete-btn {
  margin-right: auto;
  border-color: rgba(160, 85, 64, 0.34);
  color: var(--danger);
  background: rgba(160, 85, 64, 0.08);
}

.floor-settings-delete-btn:hover:not(:disabled) {
  border-color: rgba(160, 85, 64, 0.5);
  color: var(--danger);
  background: rgba(160, 85, 64, 0.14);
}

.floor-settings-modal .proj-modal-header {
  padding-top: 1.5rem;
  padding-bottom: 0.75rem;
}

.floor-settings-modal .proj-modal-floor-label {
  margin-top: 0.15rem;
  margin-bottom: 0;
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: 0.04em;
}

.floor-settings-form .settings-label:last-child {
  padding-bottom: 0.75rem;
}

.floor-delete-confirm-wrap {
  margin-right: auto;
  border: 1px solid rgba(160, 85, 64, 0.28);
  background: rgba(160, 85, 64, 0.08);
  border-radius: var(--radius);
  padding: 0.625rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.floor-delete-confirm-text {
  margin: 0;
  color: var(--danger);
  font-size: 0.78rem;
  line-height: 1.4;
}

.floor-delete-confirm-actions {
  display: flex;
  gap: 0.5rem;
}

.settings-actions .floor-delete-danger-btn:not(:disabled) {
  background: var(--danger);
  border-color: #8a4534;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(160, 85, 64, 0.24);
}

.settings-actions .floor-delete-danger-btn:not(:disabled):hover {
  background: #8a4534;
  border-color: #73392b;
  color: #fff;
  box-shadow: 0 2px 6px rgba(138, 69, 52, 0.28);
}

.floor-delete-modal .proj-modal-body {
  align-items: center;
  justify-content: center;
}

.proj-modal.add-room-modal.floor-delete-modal {
  width: min(218px, calc(100% - 2rem));
  max-width: 218px;
  max-height: 85.8vh;
}

.floor-delete-copy {
  width: 100%;
  text-align: center;
}

.floor-delete-title {
  margin: 0;
  color: var(--danger);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.3;
}

.floor-delete-title strong {
  font-weight: 600;
}

.floor-delete-subtitle {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.floor-delete-actions {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
}

.floor-delete-actions .floor-delete-danger-btn,
.floor-delete-actions .floor-delete-cancel-btn {
  width: min(92px, 100%);
  min-height: 2.57rem;
  justify-content: center;
}

@media (max-width: 640px) {
  .settings-modal {
    width: calc(100% - 2rem);
    max-height: 92vh;
  }

  .settings-form {
    padding: 1.5rem 1.25rem;
    gap: 1.25rem;
  }

  .settings-modal-footer {
    padding: 1rem 1.25rem 1.25rem;
  }

  .settings-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }

  .settings-actions .btn-view,
  .settings-actions .settings-ghost-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
  }

  .settings-password-row {
    grid-template-columns: 1fr auto;
  }
}

/* ── Room modal card ──────────────────────────────────────── */
.proj-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  /* border-left color is injected via Alpine :style */
  border-left-width: 3px;
  max-width: 960px;
  width: calc(100% - 2.5rem);
  max-height: 90vh;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Narrower card for add-room / add-floor (both use proj-modal + add-room-modal) */
.proj-modal.add-room-modal {
  width: min(520px, calc(100% - 2rem));
  max-width: 520px;
}

/* ── Modal header ─────────────────────────────────────────── */
.proj-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 2rem 0.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.proj-modal-header-info {
  flex: 1;
  min-width: 0;
}

.proj-modal-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.proj-modal-floor-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.125rem;
  margin-bottom: 0;
}

.proj-modal-close {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.125rem 0.25rem;
  transition: color var(--transition);
}

.proj-modal-close:hover {
  color: var(--text-primary);
}

.proj-modal-header-actions {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 3.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.proj-modal-header-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.proj-modal-header-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.proj-modal-header-btn:hover {
  border-color: var(--sage);
  color: var(--text-primary);
  background: var(--surface);
}

.proj-modal-header-btn--danger {
  border-color: rgba(160, 85, 64, 0.28);
  color: var(--danger);
  background: rgba(160, 85, 64, 0.08);
}

.proj-modal-header-btn--danger:hover {
  border-color: rgba(160, 85, 64, 0.42);
  color: var(--danger);
  background: rgba(160, 85, 64, 0.14);
}

.proj-modal-header-btn--save {
  background: var(--sage);
  border-color: var(--sage-dark);
  color: #fff;
  font-weight: 500;
}

.proj-modal-header-btn--save:hover {
  background: var(--sage-dark);
  border-color: var(--sage-dark);
  color: #fff;
}

.proj-modal-header-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.proj-modal-title-input {
  width: min(100%, 480px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: var(--leading-tight);
  padding: 0.1rem 0.25rem;
}

.proj-modal-title-input:focus {
  outline: none;
  border-color: var(--sage);
  background: var(--surface);
}

.proj-modal-title-edit-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.proj-modal-title-edit-toggle-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  min-width: 72px;
  min-height: 2.1rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition), opacity var(--transition);
  flex-shrink: 0;
}

.proj-modal-title-edit-toggle-btn:hover:not(:disabled) {
  border-color: var(--sage);
  color: var(--text-primary);
  background: var(--surface);
}

.proj-modal-title-edit-toggle-btn--save {
  background: var(--sage);
  border-color: var(--sage-dark);
  color: #fff;
  font-weight: 500;
}

.proj-modal-title-edit-toggle-btn--save:hover:not(:disabled) {
  background: var(--sage-dark);
  border-color: var(--sage-dark);
  color: #fff;
}

.proj-modal-title-edit-toggle-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.proj-modal-header-confirm-btn,
.proj-modal-header-cancel-btn {
  min-width: 72px;
  min-height: 2.1rem;
}

.proj-modal-header-confirm-btn {
  background: var(--danger);
  border-color: #8a4534;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(160, 85, 64, 0.24);
}

.proj-modal-header-confirm-btn:hover:not(:disabled) {
  background: #8a4534;
  border-color: #73392b;
  color: #fff;
  box-shadow: 0 2px 6px rgba(138, 69, 52, 0.28);
}

/* ── Modal body ───────────────────────────────────────────── */
.proj-modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Collapsed section rows ───────────────────────────────── */
.modal-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--transition);
}

.modal-section-row:last-child {
  border-bottom: none;
}

.modal-section-row:hover {
  background: var(--surface-2);
}

.modal-section-row:hover .modal-section-row-chevron {
  color: var(--text-muted);
}

.modal-section-row-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.modal-section-row-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
}

.modal-section-row-right {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.modal-section-row-badge {
  background: var(--sage-muted);
  color: var(--text-secondary);
  border: none;
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.modal-section-row-chevron {
  font-size: 14px;
  line-height: 1;
  color: var(--text-faint);
  transition: color var(--transition);
}

/* ── Expanded section wrapper ─────────────────────────────── */
.modal-expanded-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 2rem 2.5rem;
}

/* Tighter top when Images is expanded (carousel + header stack vertically) */
.modal-expanded-wrapper.modal-expanded-wrapper--images {
  padding-top: 0.75rem;
}

/* ── Back button ──────────────────────────────────────────── */
.modal-back-btn {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: 0;
  margin-bottom: 0.55rem;
  transition: color var(--transition);
  flex-shrink: 0;
}

.modal-back-btn:hover {
  color: var(--text-primary);
}

/* ── Expanded section content ─────────────────────────────── */
.modal-expanded-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ── Expanded section header ──────────────────────────────── */
.modal-expanded-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-left: 1rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.modal-expanded-header-left {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.modal-add-task-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.modal-add-task-btn:hover {
  border-color: var(--sage);
  color: var(--text-primary);
  background: rgba(125, 155, 118, 0.06);
}

.modal-add-image-btn {
  width: auto;
  min-height: 28px;
  padding: 0.3rem 0.7rem;
  border-color: var(--sage-dark);
  background: var(--sage);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.modal-add-image-btn:hover {
  border-color: var(--sage-dark);
  background: var(--sage-dark);
  color: #fff;
}

.modal-expanded-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 400;
  color: #1f1b18;
}

.modal-expanded-count {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Expanded list (scrollable) ───────────────────────────── */
.modal-expanded-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.room-images-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.room-carousel-wrap {
  position: relative;
}

.room-carousel {
  width: 100%;
  max-width: 100%;
  min-height: 200px;
  max-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #1a1917;
}

.room-carousel img {
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Fullscreen-expand button wrapping the carousel image */
.carousel-img-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  position: relative;
  line-height: 0;
}

.carousel-img-expand-btn:focus {
  outline: none;
}

.carousel-img-expand-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Expand icon — hidden by default, fades in on hover */
.carousel-img-expand-icon {
  position: absolute;
  bottom: 0.45rem;
  right: 0.5rem;
  font-size: 1rem;
  line-height: 1;
  color: #fff;
  background: rgba(20, 19, 17, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 0.2rem 0.3rem;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.carousel-img-expand-btn:hover .carousel-img-expand-icon,
.carousel-img-expand-btn:focus-visible .carousel-img-expand-icon {
  opacity: 1;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(20, 19, 17, 0.62);
  color: #fff;
  cursor: pointer;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.carousel-arrow:hover {
  background: var(--linen);
  color: #2a2622;
}

.carousel-arrow-left {
  left: 0.5rem;
}

.carousel-arrow-right {
  right: 0.5rem;
}

.carousel-image-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.4rem;
}

.carousel-image-action-btn {
  border: 1px solid rgba(245, 240, 232, 0.55);
  background: rgba(20, 19, 17, 0.62);
  color: #fff;
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.carousel-image-action-btn:hover {
  background: var(--linen);
  border-color: var(--linen);
  color: #2a2622;
}

.carousel-image-action-delete:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.carousel-dots {
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.carousel-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: none;
  background: var(--border-dark);
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
}

.carousel-dot.is-active {
  background: var(--linen);
  transform: scale(1.08);
}

.carousel-position {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.carousel-meta {
  margin-top: 0.2rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.carousel-meta-view-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.carousel-meta-view-desc {
  margin: 0.45rem 0 0;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.5;
}

.add-image-form textarea {
  resize: vertical;
}

.add-image-form input,
.add-image-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.5rem 0.6rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.add-image-form input:focus,
.add-image-form textarea:focus {
  border-color: var(--sage);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(125, 155, 118, 0.16);
}

.carousel-delete-link {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.carousel-delete-link:hover {
  color: var(--danger);
}

.add-image-form {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.add-image-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.add-image-form-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.empty-images {
  min-height: 220px;
  border: 1px dashed var(--border-dark);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

.empty-images-icon {
  font-size: 1.6rem;
  opacity: 0.8;
}

/* ── Section list items (shared between views) ────────────── */
.modal-section-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.625rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-primary);
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.modal-section-item:last-child {
  border-bottom: none;
}

.modal-section-empty {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 300;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

.modal-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-item-name--muted {
  color: var(--text-muted);
}

/* ── Task items — merged section ─────────────────────────── */

/* Override baseline alignment from modal-section-item */
.task-item {
  align-items: center;
  gap: 0.625rem;
  animation: task-item-enter 0.22s ease both;
}

.task-item--new {
  animation: none;
}

.material-item--new {
  align-items: center;
}

.material-form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: normal;
  padding-top: 0;
  padding-bottom: 0.175rem;
}

.material-new-fields {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 2fr 1.25fr 1fr 1fr;
  align-items: center;
  gap: 0.625rem;
}

.material-new-input--name {
  width: 100%;
  min-width: 0;
}

.material-new-input--supplier,
.material-new-input--qty,
.material-new-input--metric {
  width: 100%;
  min-width: 0;
}

.material-cancel-btn {
  background: transparent !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

.task-new-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  padding: 0.45rem 0.55rem;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.task-new-input:focus {
  border-color: var(--sage);
  background: rgba(125, 155, 118, 0.06);
}

.task-save-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition), color var(--transition), background var(--transition), opacity var(--transition);
}

/* When active, match the task checkbox green */
.task-save-btn:not(:disabled) {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}

.task-save-btn:not(:disabled):hover {
  background: var(--sage-dark);
  border-color: var(--sage-dark);
  color: #fff;
}

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

.task-item--done .modal-item-name {
  text-decoration: line-through;
}

.task-desc-btn {
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  text-align: left;
  cursor: text;
}

.task-desc-text {
  display: inline;
}

.task-edit-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  padding: 0.45rem 0.55rem;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.task-edit-input:focus {
  border-color: var(--sage);
  background: rgba(125, 155, 118, 0.06);
}

.task-cb.task-save-btn {
  width: auto;
  height: auto;
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
}

.task-trash-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color var(--transition), background var(--transition), opacity var(--transition);
}

.task-trash-btn:hover:not(:disabled) {
  color: var(--danger);
  background: rgba(160, 85, 64, 0.08);
}

.task-trash-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.task-trash-btn svg {
  width: 14px;
  height: 14px;
}

.task-completed-at {
  flex-shrink: 0;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--text-muted);
}

@keyframes task-item-enter {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Circular checkbox toggle */
.task-cb {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border-dark);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color var(--transition), background var(--transition);
}

.task-cb:hover {
  border-color: var(--sage);
}

.task-cb--done {
  background: var(--sage);
  border-color: var(--sage);
}

.task-cb--done:hover {
  background: var(--sage-dark);
  border-color: var(--sage-dark);
}

.task-cb svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.task-cb .task-edit-hint-icon {
  width: 12px;
  height: 12px;
}

.task-cb--text-hover {
  border-color: transparent;
  background: transparent;
}

.task-cb--text-hover:hover {
  border-color: transparent;
  background: transparent;
}

/* Divider between ongoing and completed groups */
.tasks-divider {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0 0.125rem;
  border-bottom: none;
}

.tasks-divider-label {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
  flex-shrink: 0;
}

.tasks-divider-rule {
  flex: 1;
  height: 1px;
  background: var(--border);
  display: block;
}

.modal-item-qty {
  font-family: var(--font-body);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 300;
  white-space: nowrap;
  flex-shrink: 0;
}

.modal-material-item {
  align-items: center;
  gap: 1.25rem;
}

.modal-materials-column-head {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  width: 100%;
  gap: 1.25rem;
  padding: 0.5rem 0 0.65rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  list-style: none;
}

.modal-material-head-name {
  flex: 1 1 0;
  min-width: 0;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-material-head-supplier {
  flex: 0 0 clamp(88px, 18%, 168px);
  min-width: 0;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-material-head-progress {
  flex: 0 0 clamp(108px, 18%, 168px);
  min-width: 0;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-material-head-actions {
  flex-shrink: 0;
  width: 8rem;
}

.modal-material-display {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  width: 100%;
  gap: 1.25rem;
}

.modal-material-edit-row {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  width: 100%;
  gap: 0.5rem;
}

.material-edit-inline {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.material-edit-error {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--danger);
  margin: 0;
  font-weight: 400;
}

.modal-material-name-wrap {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

.modal-material-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-material-supplier-wrap {
  flex: 0 0 clamp(88px, 18%, 168px);
  min-width: 0;
}

.modal-material-supplier-value {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 300;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-material-progress-wrap {
  flex: 0 0 clamp(108px, 18%, 168px);
  min-width: 0;
}

.modal-material-progress {
  width: 100%;
}

.modal-material-progress-track {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.modal-material-progress-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.modal-material-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.modal-material-qty-unset {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.modal-material-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: auto;
}

.modal-material-edit-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: color var(--transition), background var(--transition), opacity var(--transition);
}

.modal-material-edit-btn:hover {
  color: var(--sage-dark);
  background: rgba(125, 155, 118, 0.08);
}

.modal-material-edit-btn svg {
  width: 14px;
  height: 14px;
}

.modal-material-controls .task-trash-btn {
  margin-left: 0;
}

.modal-qty-input {
  width: 72px;
  height: 26px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.45rem;
  text-align: center;
  color: var(--text-primary);
  appearance: textfield;
  -moz-appearance: textfield;
  -webkit-appearance: none;
}

.modal-qty-input::-webkit-outer-spin-button,
.modal-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (max-width: 600px) {
  .modal-material-item {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .modal-material-display {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .modal-material-edit-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .modal-material-name-wrap {
    width: 100%;
    min-width: 0;
  }

  .modal-material-supplier-wrap {
    order: 2;
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .modal-material-progress-wrap {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .modal-materials-column-head {
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }

  .modal-material-head-supplier {
    flex: 1 1 auto;
    min-width: 5rem;
  }

  .modal-material-head-progress {
    flex: 1 1 auto;
    min-width: 5rem;
  }

  .modal-material-head-actions {
    width: 100%;
    min-height: 0;
  }

  .material-new-fields {
    grid-template-columns: 1fr;
  }
}

/* ── Responsive: narrow screens ───────────────────────────── */
@media (max-width: 600px) {
  .proj-modal {
    width: calc(100% - 2rem);
  }

  .proj-modal-header {
    padding: 0.75rem 1.25rem 0.625rem;
  }

  .proj-modal-header-actions {
    position: static;
    transform: none;
    margin-left: auto;
    margin-right: 2rem;
    margin-top: 0.1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .proj-modal-header-btn {
    font-size: 0.62rem;
    padding: 0.24rem 0.42rem;
  }

  .proj-modal-close {
    transform: none;
  }

  .proj-modal-title-edit-row {
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }

  .modal-section-row {
    padding: 1.125rem 1.5rem;
  }

  .modal-expanded-wrapper {
    padding: 1.5rem 1.5rem;
  }

  .modal-expanded-wrapper.modal-expanded-wrapper--images {
    padding-top: 0.625rem;
  }
}

/* ============================================================
   Edit Mode — Polygon Calibration Tool
   Styled to match the main site theme.
   ============================================================ */

/* Calibration toolbar below floor plan */
.floorplan-workspace {
  flex: 1;
  min-height: 0;
  align-self: center;
  width: min(100%, calc((100vh - 56px - 40px - 4rem) * 4 / 3));
  max-width: calc(100vw - 280px - 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
  padding: 2rem;
  box-sizing: border-box;
}

.proj-modal.viewer-summary-modal {
  width: min(560px, calc(100% - 2rem));
  max-width: 560px;
}

.proj-modal.viewer-summary-modal.viewer-summary-modal--wide {
  width: min(880px, calc(100% - 2rem));
  max-width: 880px;
}

.viewer-summary-modal .proj-modal-header.viewer-summary-modal-header {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding-top: 0.9375rem;
  padding-bottom: 0.75rem;
}

.viewer-summary-header-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.viewer-summary-header-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  /* One visual row: heading + controls share the same cross-axis center */
  min-height: 2.125rem;
}

.viewer-summary-header-title {
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  /* Match control height so flex centering lines up with the buttons */
  min-height: 2.125rem;
  line-height: 1.1;
}

.viewer-summary-header-aside {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
  align-self: center;
}

.viewer-summary-modal .proj-modal-close {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  padding: 0;
  border-radius: var(--radius);
  line-height: 0;
  flex-shrink: 0;
  font-size: 1.375rem;
}

.viewer-summary-modal .proj-modal-close:hover {
  background: rgba(44, 40, 37, 0.06);
}

.viewer-summary-header-sub {
  padding-bottom: 0.2rem;
}

.viewer-summary-header-sub .proj-modal-floor-label {
  margin-top: 0;
  margin-bottom: 0;
}

.viewer-summary-add-keypoint-btn {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(165deg, var(--success) 0%, #3d6b4f 100%);
  border: 1px solid rgba(44, 40, 37, 0.14);
  border-radius: var(--radius);
  padding: 0 0.75rem;
  height: 2.125rem;
  min-height: 2.125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition), transform 0.12s ease;
}

.viewer-summary-add-keypoint-btn:hover {
  background: linear-gradient(165deg, #6a9e7a 0%, var(--success) 100%);
  border-color: rgba(44, 40, 37, 0.2);
}

.viewer-summary-add-keypoint-btn:active {
  transform: translateY(1px);
}

.keypoint-add-inline {
  margin-bottom: 1rem;
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.keypoint-add-inline-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}

.keypoint-add-inline .settings-label {
  margin-bottom: 0.65rem;
}

.keypoint-add-inline-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.keypoint-add-inline-actions .keypoint-add-save-btn {
  padding: 0.5rem 1.25rem;
  font-weight: 500;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    opacity var(--transition),
    box-shadow var(--transition);
}

/* Incomplete form (or idle): muted, disabled */
.keypoint-add-inline-actions .keypoint-add-save-btn:disabled:not(.keypoint-add-save-btn--ready) {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-muted);
  opacity: 0.65;
  cursor: not-allowed;
}

.keypoint-add-inline-actions .keypoint-add-save-btn:disabled:not(.keypoint-add-save-btn--ready):hover {
  border-color: var(--border);
  color: var(--text-muted);
  background: var(--surface-2);
}

/* All fields filled, ready to save */
.keypoint-add-inline-actions .keypoint-add-save-btn.keypoint-add-save-btn--ready:not(:disabled) {
  background: linear-gradient(165deg, #6a9e7a 0%, var(--success) 100%);
  border-color: rgba(44, 40, 37, 0.22);
  color: var(--surface);
  box-shadow: 0 1px 2px rgba(90, 117, 84, 0.2);
  cursor: pointer;
}

.keypoint-add-inline-actions .keypoint-add-save-btn.keypoint-add-save-btn--ready:not(:disabled):hover {
  background: linear-gradient(165deg, #5c9070 0%, #4a7d5c 100%);
  border-color: rgba(44, 40, 37, 0.28);
  color: var(--surface);
  box-shadow: 0 2px 6px rgba(90, 117, 84, 0.24);
}

/* Saving: keep green tone but clearly disabled */
.keypoint-add-inline-actions .keypoint-add-save-btn.keypoint-add-save-btn--ready.keypoint-add-save-btn--saving:disabled {
  opacity: 0.85;
  cursor: wait;
}

.keypoint-add-inline-actions .keypoint-add-save-btn.keypoint-add-save-btn--ready.keypoint-add-save-btn--saving:disabled:hover {
  border-color: rgba(44, 40, 37, 0.22);
  background: linear-gradient(165deg, #6a9e7a 0%, var(--success) 100%);
  color: var(--surface);
}

.viewer-summary-modal-body {
  overflow-y: auto;
  padding: 0 2.5rem 1.5rem;
  max-height: min(62vh, 520px);
}

.viewer-summary-panel {
  padding-top: 0.25rem;
}

/* Tasks summary (viewer modal): document-style, floor → room → rows */
.viewer-summary-panel--tasks-doc {
  padding-top: 0;
}

.tasks-summary-subnav {
  margin: 0 -2.5rem 0;
  padding: 0 2.5rem;
  justify-content: flex-start;
  z-index: 1;
}

.tasks-summary-tab-panel {
  padding-top: 1.25rem;
}

.tasks-summary-doc {
  font-family: var(--font-body);
  color: var(--text-primary);
}

.tasks-summary-columns {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: stretch;
}

@media (min-width: 720px) {
  .tasks-summary-columns {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.75rem;
  }

  .tasks-summary-section {
    flex: 1 1 0;
    min-width: 0;
  }

  .tasks-summary-section--completed {
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
  }
}

.tasks-summary-section-title {
  margin: 0 0 0.85rem;
  padding: 0 0 0.45rem;
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.tasks-summary-section--completed .tasks-summary-section-title {
  color: var(--text-muted);
}

.tasks-summary-empty {
  margin-top: 0;
}

.tasks-summary-section-body {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.tasks-summary-floor-label {
  margin: 0 0 0.65rem;
  padding: 0 0 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(44, 40, 37, 0.08);
}

.tasks-summary-floor-label--interactive {
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.tasks-summary-floor-label--interactive:hover {
  color: var(--text-primary);
  background-color: rgba(44, 40, 37, 0.04);
}

.tasks-summary-floor-label--interactive:focus {
  outline: none;
}

.tasks-summary-floor-label--interactive:focus-visible {
  outline: 2px solid rgba(44, 40, 37, 0.35);
  outline-offset: 2px;
}

.tasks-summary-room {
  margin-bottom: 1rem;
}

.tasks-summary-room:last-child {
  margin-bottom: 0;
}

.tasks-summary-room-head {
  margin-bottom: 0.35rem;
  padding: 0.15rem 0 0.15rem 0.65rem;
  border-left: 3px solid rgba(148, 163, 184, 0.45);
}

.tasks-summary-room-name {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

.tasks-summary-task-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.15rem;
}

.tasks-summary-task {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid rgba(44, 40, 37, 0.06);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: var(--leading-normal);
}

.tasks-summary-task:last-child {
  border-bottom: none;
}

.tasks-summary-task-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.tasks-summary-task-desc {
  word-break: break-word;
}

.tasks-summary-task-glyph {
  flex-shrink: 0;
  box-sizing: border-box;
}

.tasks-summary-task-glyph--ongoing {
  width: 0.65rem;
  height: 0.65rem;
  margin-top: 0.32em;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  opacity: 0.85;
}

/* Muted checkbox + tick for completed rows */
.tasks-summary-task-glyph--done {
  position: relative;
  width: 0.72rem;
  height: 0.72rem;
  margin-top: 0.28em;
}

.tasks-summary-task-glyph--done::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(44, 40, 37, 0.2);
  border-radius: 2px;
  box-sizing: border-box;
  opacity: 0.55;
}

.tasks-summary-task-glyph--done::after {
  content: '';
  position: absolute;
  left: 0.14rem;
  top: 0.1rem;
  width: 0.2rem;
  height: 0.36rem;
  border: solid var(--text-muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  opacity: 0.6;
  box-sizing: border-box;
}

.tasks-summary-task--completed .tasks-summary-task-desc {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(44, 40, 37, 0.28);
}

.tasks-summary-task-date {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.85;
}

.tasks-summary-material-meter {
  width: 100%;
  height: 3px;
  margin-top: 0.3rem;
  border-radius: 2px;
  background: rgba(44, 40, 37, 0.08);
  overflow: hidden;
  box-sizing: border-box;
}

.tasks-summary-material-meter-fill {
  height: 100%;
  min-width: 0;
  max-width: 100%;
  border-radius: 2px;
  transition: width 0.2s ease;
}

.tasks-summary-task--completed .tasks-summary-material-meter {
  opacity: 0.45;
}

.tasks-summary-task--interactive {
  cursor: pointer;
}

.tasks-summary-task--interactive:focus {
  outline: none;
}

.tasks-summary-task--interactive:focus-visible {
  outline: 2px solid rgba(44, 40, 37, 0.35);
  outline-offset: 2px;
}

.viewer-summary-tabs {
  width: 100%;
  margin-bottom: 0.85rem;
  box-sizing: border-box;
}

.viewer-summary-tabs .floor-tab {
  flex: 1 1 0;
  text-align: center;
}

.keypoint-summary-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-body);
}

.keypoint-summary-row:last-child .keypoint-summary-cell {
  border-bottom: none;
}

.keypoint-summary-cell {
  vertical-align: top;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.keypoint-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.keypoint-summary-title {
  font-size: 1rem;
  font-weight: 500;
  line-height: var(--leading-tight);
  color: var(--text-primary);
  min-width: 0;
  flex: 1 1 auto;
}

.keypoint-summary-date {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-muted);
  opacity: 0.92;
}

.keypoint-summary-body {
  margin-top: 0.4rem;
  font-size: 0.875rem;
  font-weight: 300;
  line-height: var(--leading-normal);
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.keypoint-summary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.keypoint-summary-action-btn {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    opacity var(--transition);
}

.keypoint-summary-action-btn:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text-primary);
  background: var(--surface-2);
}

.keypoint-summary-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.keypoint-summary-action-btn--danger:hover:not(:disabled) {
  border-color: rgba(180, 72, 72, 0.45);
  color: #b44848;
  background: rgba(180, 72, 72, 0.06);
}

.keypoint-edit-inline {
  margin-top: 0.35rem;
}

.viewer-summary-prose {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 300;
  line-height: var(--leading-normal);
  color: var(--text-primary);
  white-space: pre-wrap;
}

.viewer-summary-empty {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 300;
  padding: 0.5rem 0 0.25rem;
}

.viewer-summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.viewer-summary-row {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.28rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: var(--font-body);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.viewer-summary-row:hover {
  background: var(--surface);
  border-color: var(--border-dark);
  box-shadow: var(--shadow-sm);
}

.viewer-summary-row-path {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.viewer-summary-row-main {
  font-size: 1rem;
  font-weight: 400;
  line-height: var(--leading-tight);
}

.viewer-summary-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

.viewer-summary-row-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.viewer-summary-qty {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.viewer-summary-supplier {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .viewer-summary-modal-body {
    padding: 0 1.25rem 1.25rem;
  }

  .tasks-summary-subnav {
    margin: 0 -1.25rem 0;
    padding: 0 1.25rem;
  }
}

.dev-toolbar {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-primary);
}

.dev-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.dev-toolbar-field {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dev-label {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.dev-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.32rem 0.45rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.74rem;
  width: auto;
  min-width: 96px;
  max-width: 170px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.dev-select:focus {
  border-color: var(--sage);
  background: var(--surface);
}

.dev-toolbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
}

.dev-toolbar-points {
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dev-toolbar-hint {
  color: var(--text-faint);
  font-size: 0.71rem;
  white-space: nowrap;
}

.dev-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex-shrink: 0;
}

.dev-btn {
  width: auto;
  padding: 0.34rem 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 400;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition);
  text-align: center;
}

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

.dev-btn-copy {
  background: var(--sage-wash);
  color: var(--sage-dark);
  border-color: var(--sage-muted);
}

.dev-btn-copy:hover:not(:disabled) {
  background: rgba(125, 155, 118, 0.14);
  border-color: var(--sage-light);
  color: var(--sage-dark);
}

.dev-btn-success {
  background: var(--success) !important;
  color: #fff !important;
  border-color: var(--success) !important;
}

.dev-btn-secondary {
  background: var(--surface-2);
  color: var(--text-secondary);
  border-color: var(--border);
}

.dev-btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text-primary);
  border-color: var(--border-dark);
}

.dev-btn-danger {
  background: rgba(160, 85, 64, 0.08);
  color: var(--danger);
  border-color: rgba(160, 85, 64, 0.25);
}

.dev-btn-danger:hover:not(:disabled) {
  background: rgba(160, 85, 64, 0.14);
  border-color: rgba(160, 85, 64, 0.35);
}

.dev-btn-undo {
  background: rgba(154, 122, 58, 0.08);
  color: var(--warning);
  border-color: rgba(154, 122, 58, 0.22);
}

.dev-btn-undo:hover:not(:disabled) {
  background: rgba(154, 122, 58, 0.13);
  border-color: rgba(154, 122, 58, 0.32);
}

.dev-btn-save {
  background: rgba(154, 122, 58, 0.12);
  color: var(--warning);
  border-color: rgba(154, 122, 58, 0.32);
  font-weight: 500;
}

.dev-btn-save:hover:not(:disabled) {
  background: rgba(154, 122, 58, 0.2);
  border-color: rgba(154, 122, 58, 0.44);
  color: var(--warning);
}

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

/* Save status message */
.dev-save-status {
  padding: 0.3rem 0.125rem 0;
}

.dev-save-status-msg {
  display: inline-flex;
  align-items: center;
  font-size: 0.66rem;
  text-align: center;
  padding: 0.22rem 0.4rem;
  border-radius: var(--radius);
  white-space: nowrap;
}

.dev-save-status-ok {
  background: rgba(90, 138, 106, 0.12);
  color: var(--success);
  border: 1px solid rgba(90, 138, 106, 0.28);
}

.dev-save-status-err {
  background: rgba(160, 85, 64, 0.10);
  color: var(--danger);
  border: 1px solid rgba(160, 85, 64, 0.28);
}

@media (max-width: 1100px) {
  .dev-toolbar {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .dev-toolbar-center {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }
}

/* Cursor tooltip that follows the mouse over the floor plan */
.dev-tooltip {
  position: fixed;
  background: var(--surface);
  color: var(--text-primary);
  font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 11px;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius);
  pointer-events: none;
  z-index: 9999;
  border: 1px solid var(--border);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  .sidebar-toggle-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 50%;
    left: 280px;
    transform: translateY(-50%);
    z-index: 40;
    width: 18px;
    height: 26px;
    padding: 0;
    margin: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-muted);
    cursor: pointer;
    transition: left 0.2s ease, color var(--transition), box-shadow var(--transition);
  }

  .sidebar-toggle-tab::after {
    content: '‹';
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1;
    display: block;
    transition: transform 0.2s ease;
  }

  .sidebar-toggle-tab--collapsed::after {
    transform: rotate(180deg);
  }

  .sidebar-toggle-tab:hover {
    color: var(--text-secondary);
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.07);
  }

  .sidebar-toggle-tab--collapsed {
    left: 0;
  }

  .proj-header {
    padding: 0 0.85rem;
    gap: 0.5rem;
  }

  .proj-menu-btn {
    display: inline-flex;
  }

  .proj-back-link-desktop {
    display: none;
  }

  .proj-back-link-mobile {
    display: inline-block;
  }

  .proj-header-left {
    gap: 0.35rem;
    min-width: 0;
  }

  .proj-edit-badge {
    padding: 2px 6px;
    font-size: 0.62rem;
  }

  .proj-header-right {
    min-width: 70px;
    justify-content: flex-end;
  }

  .proj-header-center {
    max-width: min(50vw, 300px);
  }

  .proj-settings-btn {
    padding: 0.24rem 0.45rem;
    font-size: 0.66rem;
  }

  .proj-header-keypoints-btn {
    display: inline-flex;
  }

  .proj-header-bar-track {
    display: none;
  }

  .proj-subnav:not(.proj-subnav--main) {
    padding: 0 1.25rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    justify-content: center;
  }

  .proj-subnav:not(.proj-subnav--main)::-webkit-scrollbar {
    display: none;
  }

  .proj-subnav--main > .proj-subnav-row {
    margin-left: 0;
    width: 100%;
  }

  .proj-subnav--main .proj-subnav-side {
    display: none;
  }

  .proj-subnav--main .proj-subnav-fill {
    flex: 1;
    min-width: 0;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .proj-subnav--main .proj-subnav-fill::-webkit-scrollbar {
    display: none;
  }

  .proj-subnav--main .subnav-tab-group {
    position: static;
    left: auto;
    transform: none;
  }

  .subnav-tab-group .proj-subnav-btn {
    padding: 5px 11px;
  }

  .proj-floor-context-bar {
    padding: 0.55rem 1rem;
    gap: 0.75rem;
  }

  .proj-floor-context-eyebrow {
    display: none;
  }

  .proj-floor-context-left {
    gap: 0.25rem;
  }

  .proj-floor-context-floor-name {
    font-size: 13px;
  }

  .proj-floor-context-mobile-rooms {
    display: block;
  }

  .proj-floor-context-right {
    display: none;
  }

  .mobile-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(44, 40, 37, 0.45);
    z-index: 25;
  }

  .proj-layout.mobile-sidebar-open .mobile-sidebar-backdrop {
    display: block;
  }

  .proj-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 30;
    transform: translateX(-280px);
    transition: transform 0.2s ease;
  }

  .proj-sidebar.is-open {
    transform: translateX(0);
  }

  .proj-floorplan-area {
    width: 100%;
    padding: 0;
  }

  .floorplan-container {
    max-width: calc(100vw - 2rem);
  }

  .floorplan-workspace {
    width: 100%;
    max-width: calc(100vw - 2rem);
    padding: 1rem;
  }

  .pw-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .pw-input {
    width: 100%;
    border-right: 1px solid var(--border);
    border-radius: var(--radius);
  }
}

/* ============================================================
   Project Images Panel
   ============================================================ */

/* ── Panel wrapper (inside viewer-summary-modal-body) ──────── */
.images-summary-panel {
  /* inherits scroll and padding from .viewer-summary-modal-body */
  font-family: var(--font-body);
  color: var(--text-primary);
}

.images-summary-empty {
  padding-top: 0.25rem;
}

/* ── Accordion floor section ───────────────────────────────── */
.images-summary-body {
  width: 100%;
}

.images-summary-floor {
  width: 100%;
}

/* Floor label — full-row tap target for accordion toggle */
.images-summary-floor-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius);
  padding-right: 0.25rem;
  transition: color var(--transition), background-color var(--transition);
}

.images-summary-floor-label:hover {
  color: var(--text-primary);
  background-color: rgba(44, 40, 37, 0.04);
}

.images-summary-floor-label:focus {
  outline: none;
}

.images-summary-floor-label:focus-visible {
  outline: 2px solid rgba(44, 40, 37, 0.35);
  outline-offset: 2px;
}

/* Chevron — CSS-only, rotates to signal open/closed state */
.images-summary-chevron {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.55;
  transform: rotate(45deg);
  transition: transform var(--transition);
  margin-left: 0.5rem;
  box-sizing: border-box;
}

.images-summary-chevron--collapsed {
  transform: rotate(-45deg);
}

/* Floor body */
.images-summary-floor-body {
  padding-bottom: 0.25rem;
}

/* ── Image grid ────────────────────────────────────────────── */
.images-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

/* ── Image tile ────────────────────────────────────────────── */
.images-summary-tile {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface-2);
  padding: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.images-summary-tile:hover {
  border-color: var(--border-dark);
  box-shadow: var(--shadow-sm);
}

.images-summary-tile:focus {
  outline: none;
}

.images-summary-tile:focus-visible {
  outline: 2px solid rgba(44, 40, 37, 0.35);
  outline-offset: 2px;
}

.images-summary-tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.images-summary-tile:hover .images-summary-tile-img {
  transform: scale(1.04);
}

/* ── Lightbox overlay ──────────────────────────────────────── */
.images-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 15, 0.90);
  z-index: 110; /* one step above modal-backdrop (100) */
  display: flex;
  align-items: center;
  justify-content: center;
}

.images-lightbox-img {
  max-width: calc(100vw - 9rem);
  max-height: calc(100vh - 5rem);
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: block;
}

/* Close button */
.images-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  font-size: 1.5rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}

.images-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
}

/* Nav arrows */
.images-lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  min-width: 44px;
  min-height: 44px;
  font-size: 1.2rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}

.images-lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
}

.images-lightbox-arrow--prev {
  left: 1.25rem;
}

.images-lightbox-arrow--next {
  right: 1.25rem;
}

/* Lightbox caption (title + description) */
.images-lightbox-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 1.25rem 1.75rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
}

.images-lightbox-caption-title {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.images-lightbox-caption-desc {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.45;
}

.images-lightbox-caption-desc:first-child {
  margin-top: 0;
}

/* ── Responsive breakpoints ────────────────────────────────── */
@media (max-width: 767px) {
  .images-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .images-lightbox-img {
    max-width: calc(100vw - 6rem);
  }

  .images-lightbox-arrow--prev {
    left: 0.5rem;
  }

  .images-lightbox-arrow--next {
    right: 0.5rem;
  }
}

@media (max-width: 479px) {
  .images-summary-grid {
    grid-template-columns: 1fr;
  }

  .images-lightbox-img {
    max-width: calc(100vw - 1rem);
    max-height: calc(100vh - 7rem);
  }

  .images-lightbox-arrow {
    top: auto;
    bottom: 1.25rem;
    transform: none;
  }

  .images-lightbox-arrow--prev {
    left: calc(50% - 3.5rem);
  }

  .images-lightbox-arrow--next {
    right: calc(50% - 3.5rem);
  }

  /* Keep caption above bottom-centered nav arrows */
  .images-lightbox-caption--clear-mobile-arrows {
    bottom: 5.75rem;
  }
}
