/* Boother Designer — app shell styles.
   Shares the visual language of the portfolio page (../style.css). */

:root {
  --ink: #1c2430;
  --ink-soft: #2a3442;
  --muted: #5b6675;
  --paper: #f5f6f8;
  --card: #ffffff;
  --brand: #e8901a;
  --brand-dark: #c67612;
  --brand-tint: #fdf3e3;
  --accent: #2e9bd6;
  --line: #e2e6ec;
  --danger: #c0392b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(28, 36, 48, 0.06), 0 4px 14px rgba(28, 36, 48, 0.05);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------------------------------------------------------------- header */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 11px 22px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.brand-block { display: flex; align-items: center; gap: 14px; min-width: 0; }
.wordmark { text-decoration: none; }
.logo { color: var(--brand); font-weight: 800; font-size: 20px; letter-spacing: 0.06em; }
.header-divider { width: 1px; height: 22px; background: #3a4656; }
.app-title { margin: 0; font-size: 15px; font-weight: 600; color: #dfe6ee; white-space: nowrap; }

.header-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.city-field { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #b8c2cf; }
.city-field select {
  font: inherit;
  font-size: 13px;
  color: #eef2f7;
  background: var(--ink-soft);
  border: 1px solid #3a4656;
  border-radius: 8px;
  padding: 5px 8px;
  cursor: pointer;
}
.city-field select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* segmented control */
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  overflow: hidden;
  flex: none;
}
.seg button {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.seg button:hover:not(:disabled):not(.active) { color: var(--ink); }
.seg button.active { background: var(--brand); color: #171d26; font-weight: 700; }
.seg button:disabled { opacity: 0.45; cursor: default; }
.app-header .seg { border-color: #3a4656; background: var(--ink-soft); }
.app-header .seg button { color: #b8c2cf; }
.app-header .seg button.active { background: var(--brand); color: #171d26; }

/* buttons */
.btn {
  font: inherit;
  font-size: 13.5px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: inline-block;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover:not(:disabled) { border-color: #c6cdd7; background: #fafbfc; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #171d26; font-weight: 700; }
.btn-brand:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.danger { color: var(--danger); border-color: #ecc8c3; }
.btn.danger:hover:not(:disabled) { background: #fdf4f3; border-color: var(--danger); }
.btn.wide { display: block; width: 100%; }

/* ---------------------------------------------------------------- layout */

.app {
  flex: 1;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 22px 10px;
}

/* --------------------------------------------------------------- sidebar */

.sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.mode-tabs button {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 4px 10px;
  cursor: pointer;
}
.mode-tabs button:hover:not(.active) { color: var(--ink); }
.mode-tabs button.active { color: var(--ink); border-bottom-color: var(--brand); }

.panel { padding: 18px 16px 22px; display: flex; flex-direction: column; gap: 20px; }

.panel-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.panel-note kbd {
  font-family: inherit;
  font-size: 11px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
}

.field { display: block; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field > label,
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 7px;
}

.field input[type="text"],
.field input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
}
.field input:focus-visible,
.el-props input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-color: var(--brand);
}

/* steppers */
.stepper {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.stepper input {
  flex: 1;
  min-width: 0;
  text-align: center;
  border: none !important;
  border-radius: 0 !important;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 2px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper button {
  font: inherit;
  font-size: 16px;
  width: 34px;
  border: none;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  flex: none;
}
.stepper button:hover { background: var(--brand-tint); color: var(--brand-dark); }
.stepper.small button { width: 28px; font-size: 14px; }
.stepper.small input { padding: 4px 2px; font-size: 13px; }

/* archetype cards */
.arch-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.arch-card {
  font: inherit;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.12s, background 0.12s;
}
.arch-card:hover:not(:disabled) { border-color: #c6cdd7; }
.arch-card.selected {
  border-color: var(--brand);
  background: var(--brand-tint);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.arch-card:disabled { opacity: 0.42; cursor: default; }
.arch-card .name { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.arch-card .desc { font-size: 11px; color: var(--muted); line-height: 1.35; }
.arch-card .min { font-size: 10.5px; color: var(--muted); opacity: 0.85; }

/* palette pickers */
.palette-row { display: flex; gap: 10px; }
.swatch { flex: 1; text-align: center; cursor: pointer; }
.swatch input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
}
.swatch span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 4px; }

/* features */
.feature-list { display: flex; flex-direction: column; gap: 9px; }
.check { font-size: 13.5px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--brand); width: 15px; height: 15px; }
.count-row { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; gap: 10px; }
.count-row .stepper { width: 108px; }

/* budget */
.budget-field { border-top: 1px solid var(--line); padding-top: 16px; }
.budget-row { display: flex; gap: 8px; }
.budget-row input { flex: 1; min-width: 0; }
.budget-row .btn { flex: none; }
.fit-result {
  margin-top: 10px;
  background: var(--paper);
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12.5px;
}
.fit-result p { margin: 0 0 4px; }
.fit-result .fit-head { font-weight: 600; }
.fit-result ul { margin: 4px 0 0 16px; padding: 0; }
.fit-result li { margin: 2px 0; }

/* status lines */
.status { margin: 0; font-size: 12.5px; color: var(--muted); }
.status.err { color: var(--danger); }

/* live reasoning ticker, shown while a design is being generated */
.ai-ticker {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.02);
  padding: 10px 12px;
  max-height: 190px;
  overflow-y: auto;
}
.ticker-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.ticker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent, #e8760a);
  animation: ticker-pulse 1.4s ease-in-out infinite;
}
@keyframes ticker-pulse {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-dot { animation: none; opacity: 1; }
}
.ticker-lines {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
.ticker-lines li {
  padding: 3px 0;
  border-top: 1px solid var(--line);
}
.ticker-lines li:first-child { border-top: 0; }
.ticker-lines li:last-child { color: var(--ink, inherit); }

/* photo panel */
.drop-zone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 26px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.12s, background 0.12s;
}
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragging {
  border-color: var(--brand);
  background: var(--brand-tint);
  outline: none;
}
.dz-icon { font-size: 26px; }
.photo-preview { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.swatch-row { display: flex; gap: 6px; }
.swatch-row .sw { flex: 1; height: 30px; border-radius: 6px; border: 1px solid rgba(28, 36, 48, 0.15); }
.mapped-palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.mapped-palette .chip { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink); }
.mapped-palette .dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(28, 36, 48, 0.18); flex: none; }
.mapped-palette code { font-size: 11px; color: var(--muted); }
.cta-box {
  background: var(--paper);
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 12.5px;
}
.cta-box p { margin: 0 0 9px; }

/* plan panel */
/* ---- Booth Editor sections ---- */
.ed-sec { border-bottom: 1px solid var(--line); }
.ed-sec:last-of-type { border-bottom: 0; }
.ed-sec > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 2px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.ed-sec > summary::-webkit-details-marker { display: none; }
/* Disclosure caret, rotated when the section is open. */
.ed-sec > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}
.ed-sec[open] > summary::before { transform: rotate(90deg); }
.ed-sec > summary:hover { color: var(--ink); }
.ed-sec[open] > summary { color: var(--ink); }
.ed-body { padding: 0 2px 14px; }

/* element add palette, grouped */
.el-group {
  margin: 10px 0 5px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.el-group:first-child { margin-top: 0; }
.el-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.el-row button {
  font: inherit;
  font-size: 12.5px;
  padding: 7px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.el-row button:hover { border-color: var(--brand); background: var(--brand-tint); }

/* palette generator */
.harmony-row { display: flex; gap: 8px; align-items: flex-end; }
.harmony-row .swatch { flex: none; width: 58px; }
.harmony-row select { flex: 1; min-width: 0; }
.harmony-row .btn { flex: none; }
.wheel-swatches { display: flex; gap: 5px; margin-top: 9px; }
.wheel-sw {
  flex: 1;
  height: 26px;
  border-radius: 5px;
  border: 1px solid rgba(28, 36, 48, 0.12);
}
.contrast-note { color: var(--danger); }

/* saved booths */
.saved-list { margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.saved-item { display: flex; gap: 5px; align-items: stretch; }
.saved-open {
  flex: 1;
  min-width: 0;
  text-align: left;
  font: inherit;
  font-size: 12.5px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.saved-open:hover { border-color: var(--brand); background: var(--brand-tint); }
.saved-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-when { flex: none; font-size: 11px; color: var(--muted); }
.saved-item.current .saved-open { border-color: var(--brand); background: var(--brand-tint); }
.saved-del {
  flex: none;
  width: 30px;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}
.saved-del:hover { border-color: var(--danger); color: var(--danger); }

.el-palette { display: grid; gap: 6px; }
.el-palette button {
  font: inherit;
  font-size: 12.5px;
  padding: 7px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.el-palette button:hover { border-color: var(--brand); background: var(--brand-tint); }

.el-props {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  margin-bottom: 8px;
  background: #fafbfc;
}
.el-props .empty { margin: 0; font-size: 12.5px; color: var(--muted); }
.el-props .sel-head { margin: 0 0 9px; font-size: 12.5px; color: var(--muted); }
.el-props .sel-head strong { color: var(--ink); }
.prop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* Label and colour run the full width — they are prose and a menu, not dimensions. */
.wide-prop { display: block; margin-bottom: 8px; }
.wide-prop select, .wide-prop input[type="text"] {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 13px;
  margin-top: 3px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}
.prop {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.prop input[type="number"], .prop input[type="text"] {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  margin-top: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.prop.check-line {
  display: flex;
  align-items: center;
  gap: 7px;
  text-transform: none;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  grid-column: 1 / -1;
}
.prop.check-line input { accent-color: var(--brand); }
.plan-actions { display: flex; flex-direction: column; gap: 8px; }
.two-btn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ------------------------------------------------------------- main column */

.main-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.viewport-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.viewport-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.viewport-hint { margin-left: auto; font-size: 11.5px; color: var(--muted); }

.viewport {
  position: relative;
  height: clamp(380px, 56vh, 720px);
  background: linear-gradient(#eceff3, #dfe4ea);
}
.view3d { position: absolute; inset: 0; }
.view3d canvas { display: block; width: 100%; height: 100%; }
.viewport-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 14px;
  background: linear-gradient(#eceff3, #dfe4ea);
}
.plan-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  cursor: default;
}

/* stats strip */
.stats-strip {
  display: flex;
  flex-wrap: wrap;
  padding: 14px 8px;
}
.stat { flex: 1 1 auto; min-width: 128px; padding: 2px 18px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: none; }
.stat .k {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.stat .v { display: block; font-size: 16.5px; font-weight: 700; margin-top: 1px; white-space: nowrap; }

/* pricing + package cards */
.pricing-card, .package-card { padding: 18px 22px 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 17px; }
.card-sub { margin: 6px 0 4px; font-size: 12.5px; color: var(--muted); }
.pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-dark);
  background: var(--brand-tint);
  border: 1px solid #f3ddb7;
  border-radius: 999px;
  padding: 2px 11px;
  white-space: nowrap;
}
.pill.neutral { color: var(--muted); background: var(--paper); border-color: var(--line); }

.pricing-body .empty, .package-body .empty { color: var(--muted); font-size: 13px; }

.pricing-body details, .package-body details { border-bottom: 1px solid var(--line); }
.pricing-body summary, .package-body summary {
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 2px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}
.pricing-body summary::-webkit-details-marker,
.package-body summary::-webkit-details-marker { display: none; }
.pricing-body summary::before, .package-body summary::before {
  content: "▸";
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.15s;
  flex: none;
}
.pricing-body details[open] > summary::before,
.package-body details[open] > summary::before { transform: rotate(90deg); }
.pricing-body summary .amt { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.package-body summary .count { margin-left: auto; font-size: 11.5px; color: var(--muted); }

.price-lines { width: 100%; border-collapse: collapse; margin: 2px 0 12px; }
.price-lines td {
  font-size: 12.5px;
  padding: 5px 8px;
  border-top: 1px dashed var(--line);
  vertical-align: top;
}
.price-lines td:first-child { padding-left: 21px; }
.price-lines .qty, .price-lines .unit { color: var(--muted); white-space: nowrap; text-align: right; }
.price-lines .line-total { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.price-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 2px 2px;
  font-size: 14px;
  font-weight: 600;
}
.price-total .total-num { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.range { margin: 2px 0 10px; text-align: right; font-size: 12.5px; color: var(--muted); }

.assumptions { font-size: 12.5px; color: var(--muted); }
.assumptions summary { font-size: 12.5px !important; }
.assumptions ul { margin: 2px 0 12px 24px; padding: 0; }
.assumptions li { margin: 3px 0; }

.disclaimer {
  margin: 12px 0 0;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}

/* build package */
.package-body { margin-top: 6px; }
.bom-table { width: 100%; border-collapse: collapse; margin: 2px 0 12px; font-size: 12.5px; }
.bom-table th, .bom-table td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
.bom-table th { background: var(--paper); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.doc-preview { padding: 2px 4px 14px 21px; font-size: 13px; }
.doc-preview p { margin: 6px 0; }
.doc-preview ul { margin: 6px 0; padding-left: 18px; }

/* full install / dismantle sequence */
.guide-detail {
  padding: 0 4px 16px 21px;
  font-size: 13px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.guide-detail h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.guide-detail h4 .count { margin-left: auto; text-transform: none; letter-spacing: 0; }
.guide-meta {
  margin: 12px 0 4px;
  padding: 9px 11px;
  background: var(--paper);
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  line-height: 1.5;
}
.guide-note { margin: 0 0 6px; color: var(--muted); }
.step-notes { margin: 6px 0; padding-left: 18px; }
.step-notes li { margin: 5px 0; line-height: 1.5; }
.step-list { margin: 6px 0; padding-left: 22px; }
.step-list li { margin: 8px 0; line-height: 1.55; }
/* The title carries the step; the body is reference the crew reads on site. */
.step-title { font-weight: 600; }
.step-title::after { content: " —"; font-weight: 400; color: var(--muted); }

/* footer */
.app-footer {
  padding: 16px 22px 26px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.app-footer a { color: var(--muted); }

.noscript-note { text-align: center; padding: 30px 20px; color: var(--muted); }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1020px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; order: 2; }
  .main-col { order: 1; }
  .viewport { height: clamp(320px, 48vh, 560px); }
}

/*
 * Below the sidebar breakpoint the two columns stack, which put every editing
 * control roughly 1700 px down the page — behind the viewport, the stats, the
 * estimate and the whole build package. For a tool whose entire job is
 * editing, the controls have to come immediately after the thing they edit.
 *
 * `display: contents` promotes the main column's children to grid items of
 * .app, so the editor can be ordered between the viewport and the results
 * instead of after all of them. The viewport then sticks to the top, so the
 * booth stays in view while the controls scroll underneath it.
 */
@media (max-width: 900px) {
  .main-col { display: contents; }
  .app { gap: 14px; }

  /*
   * `display: contents` promotes these to grid items, which lose the
   * min-width: 0 the main column carried. Without it a grid item's automatic
   * minimum is its content, so one wide child — the parts table — stretches
   * the whole column and the page scrolls sideways.
   */
  .viewport-card, .sidebar, .stats-strip, .viz-card, .pricing-card, .package-card {
    min-width: 0;
  }

  /*
   * Two sticky elements cannot both own the top of a phone screen. The header
   * was covering the upper 153 px of the pinned booth — and by a changing
   * amount as its own sticky range ran out, which just looks broken. The booth
   * is what has to stay visible while editing, so the header scrolls away.
   */
  .app-header { position: static; }

  .viewport-card {
    order: 1;
    position: sticky;
    top: 0;
    z-index: 20;
    /* Square off the top edge: it meets the header when stuck. */
    border-radius: 0 0 var(--radius) var(--radius);
    margin: -14px -12px 0;
  }
  .viewport { height: 38vh; min-height: 240px; }

  .sidebar { order: 2; }
  .stats-strip { order: 3; }
  .viz-card { order: 4; }
  .pricing-card { order: 5; }
  .package-card { order: 6; }
}

/*
 * Landscape phones invert the problem: plenty of width, almost no height. The
 * stacked layout above spends the whole 375 px on header + toolbar + viewport
 * and leaves nothing for the controls, so short-and-wide goes back to two
 * columns — the sidebar scrolls inside itself beside a viewport that stays put.
 * Keyed on height rather than orientation alone, so a short desktop window
 * gets the same treatment.
 */
@media (max-width: 900px) and (max-height: 560px) and (orientation: landscape) {
  .main-col { display: flex; }
  .app {
    grid-template-columns: minmax(280px, 34%) minmax(0, 1fr);
    padding: 10px 12px 8px;
    gap: 12px;
  }
  /* At 240 px of sidebar the stepper buttons left 20 px for the number they
     step. Narrower buttons plus a wider column give the value room to show. */
  .panel { padding: 14px 13px 18px; }
  .stepper button { width: 28px; }
  .sidebar {
    position: sticky;
    top: 8px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    order: 0;
  }
  .viewport-card {
    position: static;
    margin: 0;
    border-radius: var(--radius);
    order: 0;
  }
  .viewport { height: clamp(190px, 58vh, 340px); }
  /* The mode tabs are the only way back to the AI panel; keep them reachable. */
  .mode-tabs { position: sticky; top: 0; }
  .viewport-hint { display: none; }
}

@media (max-width: 640px) {
  .app { padding: 14px 12px 6px; }
  .app-header { padding: 10px 14px; }
  .app-title { display: none; }
  .header-divider { display: none; }
  .city-field span { display: none; }
  .viewport-hint { display: none; }
  .stat { min-width: 104px; padding: 2px 12px; }
  .pricing-card, .package-card { padding: 15px 15px 17px; }

  /* Touch targets: 31 px tall buttons are a miss on a phone. */
  .el-row button { padding: 11px 8px; }
  .ed-sec > summary { padding: 15px 2px; }
  .btn { padding: 10px 16px; }
  .seg button { padding: 8px 14px; }
  .saved-open { padding: 11px 10px; }
  .pal-option { padding: 12px 11px; }
  /* Colour inputs are the fiddliest thing to hit; give them room. */
  .swatch input[type="color"] { height: 40px; }
}

/* ---- design-for-me (AI) panel ---- */
#panel-ai textarea,
#panel-ai input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line, #d9dee6);
  border-radius: 8px;
  background: var(--card, #fff);
  color: inherit;
  resize: vertical;
}
#panel-ai textarea { line-height: 1.45; }
#ai-revise-btn {
  margin-top: 8px;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--line, #d9dee6);
  background: var(--card, #fff);
  color: inherit;
}
#ai-revise-btn:hover:not(:disabled) { border-color: var(--brand, #e8901a); }
#ai-revise-btn:disabled, #ai-generate-btn:disabled { opacity: 0.55; cursor: default; }
.ai-notes {
  margin-top: 14px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--paper, #f5f6f8);
  border-left: 3px solid var(--brand, #e8901a);
  border-radius: 6px;
}

/* palette directions offered for a described feel */
.pal-options { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
.pal-option {
  font: inherit;
  text-align: left;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  display: block;
}
.pal-option:hover { border-color: var(--brand); }
.pal-option.chosen { border-color: var(--brand); background: var(--brand-tint); }
.pal-chips { display: flex; gap: 3px; margin-bottom: 6px; }
.pal-chip {
  flex: 1;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(28, 36, 48, 0.12);
}
.pal-label { display: block; font-size: 12.5px; font-weight: 600; }
.pal-why { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

/* concept visualization */
.viz-btn { font-size: 12.5px; padding: 5px 12px; margin-left: auto; }
.viewport-toolbar .viz-btn + .viewport-hint { margin-left: 12px; }
.viz-card { margin-bottom: 16px; }
.viz-actions { display: flex; gap: 8px; margin-left: auto; }
.viz-actions .btn { font-size: 12.5px; padding: 5px 12px; }
.viz-body { padding: 0 16px; }
.viz-body img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.viz-body .empty { padding: 28px 0; text-align: center; color: var(--muted); }
.viz-disclaimer {
  margin: 12px 16px 16px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  border-left: 3px solid var(--brand);
  padding-left: 10px;
}

/* Wide tables scroll inside their card rather than widening the page. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .bom-table { min-width: 420px; }

/* visualization: direction before rendering */
.viz-setup { padding: 4px 16px 12px; }
.viz-setup .budget-row { margin-bottom: 8px; }
.viz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.viz-chip {
  font: inherit;
  font-size: 12px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}
.viz-chip:hover { border-color: var(--brand); color: var(--ink); background: var(--brand-tint); }
.viz-setup .hint { margin: 0; }
