:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f6fb;
  color: #172033;
  --card-radius: 18px;
  --line: #d9e2ef;
  --soft: #eef4ff;
  --primary: #1d4ed8;
  --primary-strong: #173ea8;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: linear-gradient(180deg, #f6f9ff 0%, #eff3fa 100%); }
button, input { font: inherit; }
button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 11px 15px;
  cursor: pointer;
  min-height: 44px;
}
button:hover { background: var(--primary-strong); }
button.secondary { background: #e5edf8; color: #11203d; }
button.secondary:hover { background: #d7e3f4; }
input {
  width: 100%;
  margin-top: 6px;
  border: 1px solid #c9d5e5;
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
}
label { display: block; font-size: 14px; color: #24324a; }

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px;
}
.app-shell { display: grid; gap: 16px; }
.card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--card-radius);
  padding: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(217, 226, 239, 0.8);
}
.hero-card { margin-top: 24px; }
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.hidden { display: none; }
.stack-form { display: grid; gap: 12px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: #496182;
  margin: 0 0 6px;
}
.muted { color: #5d6b82; }
.error { color: #b42318; }

.header,
.section-head,
.layout-row,
.layout-header,
.metrics,
.measurement-group,
.schedule-row,
.svg-legend,
.zone-chip-list,
.rule-card,
.measurement-badges {
  display: flex;
  gap: 12px;
}
.header,
.section-head,
.layout-header {
  justify-content: space-between;
  align-items: flex-start;
}
.compact { align-items: center; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.grid { display: grid; gap: 16px; }
.shell-grid { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
.lower-grid { grid-template-columns: minmax(0, 1.1fr) minmax(310px, 0.9fr); align-items: start; }
.side-stack { display: grid; gap: 16px; }

.layout-list { display: grid; gap: 10px; }
.layout-row {
  width: 100%;
  text-align: left;
  justify-content: space-between;
  align-items: center;
  background: #f7faff;
  color: #172033;
  border: 1px solid #d6e1f0;
  border-radius: 16px;
  padding: 14px;
}
.layout-row.selected {
  border-color: #7ca3ff;
  box-shadow: inset 0 0 0 1px #7ca3ff;
  background: #edf4ff;
}
.layout-row-main { min-width: 0; }
.layout-row strong { display: block; margin-bottom: 4px; }
.layout-row-summary { font-size: 14px; color: #4a5870; }
.layout-row-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #e8eef7;
  color: #31425d;
}
.pill.measured { background: #dcfce7; color: #166534; }
.pill.partial { background: #fef3c7; color: #92400e; }
.pill.todo, .pill.assumed { background: #fee2e2; color: #991b1b; }
.pill.main { background: #dbeafe; color: #1d4ed8; }
.pill.office { background: #ede9fe; color: #6d28d9; }
.pill.support { background: #dcfce7; color: #166534; }
.pill.neutral { background: #eef2ff; color: #4338ca; }

.layout-detail-card { overflow: hidden; }
.floorplan-shell { display: grid; gap: 16px; }
.floorplan-frame {
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7ff 100%);
  border: 1px solid #d7e3f4;
  border-radius: 18px;
  padding: 12px;
}
.floorplan-frame svg { width: 100%; height: auto; display: block; }
.layout-summary { margin: 8px 0 0; }
.metrics, .measurement-badges, .zone-chip-list { flex-wrap: wrap; }
.detail-columns { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 16px; }
.note-list, .question-list, .area-list, .measurement-list, .unknown-list, .feedback-history { display: grid; gap: 10px; }
.note-item, .area-item, .measurement-item, .unknown-item, .rule-card {
  padding: 10px 0;
  border-bottom: 1px solid #e6ecf5;
}
.note-item:last-child,
.area-item:last-child,
.measurement-item:last-child,
.unknown-item:last-child,
.rule-card:last-child { border-bottom: none; }
.helper-text { font-size: 13px; color: #66748b; }

.schedule-table {
  border: 1px solid #dfe7f3;
  border-radius: 16px;
  overflow: hidden;
  background: #fbfdff;
}
.schedule-row {
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #e6ecf5;
}
.schedule-row > div { flex: 1; min-width: 0; }
.schedule-row > div:last-child { text-align: right; }
.schedule-head {
  background: #eef4ff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #496182;
}
.schedule-table .schedule-row:last-child { border-bottom: none; }

.static-rule-list { display: grid; gap: 12px; }
.rule-card {
  gap: 10px;
  align-items: flex-start;
  padding: 14px 0;
}
.rule-card strong { display: block; margin-bottom: 4px; }
.rule-copy { flex: 1; min-width: 0; }

.svg-legend {
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: #516178;
  font-size: 13px;
}
.svg-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch,
.legend-line {
  display: inline-block;
  width: 20px;
  height: 10px;
  border-radius: 4px;
}
.legend-swatch.main { background: #dbeafe; border: 1px solid #9bbcf6; }
.legend-swatch.office { background: #ede9fe; border: 1px solid #c4b5fd; }
.legend-swatch.support { background: #dcfce7; border: 1px solid #86efac; }
.legend-swatch.partial { background: #f3f4f6; border: 1px dashed #9ca3af; }
.legend-line.window { border-bottom: 4px solid #0ea5e9; }
.legend-line.wall { border-bottom: 4px solid #334155; }
.legend-line.opening { border-bottom: 4px solid #2563eb; }
.legend-line.door { border-bottom: 4px solid #0f766e; }
.legend-line.jut { background: #cbd5e1; border: 1px solid #64748b; }

.shell-backdrop { fill: #f8fafc; }
.shell-outline { fill: #fcfdff; stroke: #1f2a44; stroke-width: 0.18; }
.zone-rect { stroke: #23324e; stroke-width: 0.1; }
.zone-rect.kind-main { fill: #dbeafe; }
.zone-rect.kind-office { fill: #ede9fe; }
.zone-rect.kind-support { fill: #dcfce7; }
.zone-rect.kind-partial { fill: #f3f4f6; stroke-dasharray: 0.55 0.35; }
.wall-existing { stroke: #334155; stroke-width: 0.24; }
.bumpout { fill: #cbd5e1; stroke: #64748b; stroke-width: 0.08; }
.feature-window { stroke: #0ea5e9; stroke-width: 0.32; }
.feature-pass-through { stroke: #2563eb; stroke-width: 0.34; }
.feature-door, .door-swing { stroke: #0f766e; stroke-width: 0.18; fill: none; }
.door-gap { stroke: #ffffff; stroke-width: 0.34; }
.door-arc { stroke: #94a3b8; stroke-width: 0.1; fill: none; stroke-dasharray: 0.35 0.25; }
.feature-label { font-size: 0.62px; fill: #475569; }
.zone-label { font-size: 0.95px; fill: #11203d; font-weight: 700; pointer-events: none; }
.zone-label-sub { font-size: 0.72px; font-weight: 500; fill: #506077; }
.annotation-dot { fill: #1d4ed8; }
.annotation-label { font-size: 0.72px; fill: #415168; }
.dimension-line, .dimension-tick { stroke: #94a3b8; stroke-width: 0.08; }
.dimension-label { font-size: 0.68px; fill: #64748b; }

@media (max-width: 1100px) {
  .shell-grid,
  .lower-grid,
  .detail-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page { padding: 10px; }
  .card { padding: 14px; border-radius: 16px; }
  .header,
  .section-head,
  .layout-header,
  .layout-row,
  .schedule-row,
  .rule-card {
    display: grid;
    gap: 10px;
  }
  .header-actions { width: 100%; }
  .header-actions button { width: 100%; }
}
