:root {
  color-scheme: light;
  --ink: #102f22;
  --muted: #5f7269;
  --forest: #0d4c32;
  --forest-2: #146b47;
  --mint: #dff3e8;
  --paper: #fbfcf8;
  --line: #c7d4cc;
  --gold: #d99b2b;
  --danger: #9d332d;
  --shadow: 0 18px 45px rgb(12 43 30 / 10%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: #eef3ee; color: var(--ink); min-height: 100vh; }
button, input, select { font: inherit; }
button { touch-action: manipulation; }
.site-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 26px clamp(18px, 4vw, 54px); color: white; background: radial-gradient(circle at 80% -20%, #2e7a58, transparent 40%), #071b12; }
.brand-mark { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid #7dc39c; border-radius: 17px; color: #f1c567; font-weight: 900; letter-spacing: .06em; }
.site-head h1 { margin: 2px 0 6px; font-size: clamp(1.6rem, 3vw, 2.7rem); line-height: 1.05; }
.lede { margin: 0; max-width: 780px; color: #c9ddd2; }
.eyebrow, .step { margin: 0; text-transform: uppercase; letter-spacing: .11em; font-size: .74rem; font-weight: 900; color: var(--forest-2); }
.site-head .eyebrow { color: #92c7aa; }
.silo-badge { border: 1px solid #78b995; background: #123c2b; color: #dff7e9; border-radius: 999px; padding: 9px 13px; font-size: .72rem; font-weight: 900; letter-spacing: .06em; white-space: nowrap; }
.shell { display: grid; grid-template-columns: minmax(290px, 390px) minmax(0, 1fr); gap: 22px; padding: 22px; max-width: 1680px; margin: 0 auto; }
.workflow { display: grid; align-content: start; gap: 16px; }
.panel, .viewport-card { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.panel { padding: 20px; }
.panel h2, .workspace h2 { margin: 5px 0 10px; line-height: 1.15; }
.hint, .microcopy { color: var(--muted); line-height: 1.45; }
.hint { margin: 0 0 16px; }
.microcopy { font-size: .84rem; margin: 8px 0 0; }
.field { display: grid; gap: 6px; margin: 12px 0; font-size: .82rem; font-weight: 800; color: #365246; }
.field input, .field select { width: 100%; min-height: 44px; border: 1px solid #a9bbb0; border-radius: 12px; background: white; color: var(--ink); padding: 9px 11px; }
.field-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 9px; }
#room-json { position: absolute; opacity: 0; pointer-events: none; }
.file-button { display: flex; justify-content: center; align-items: center; min-height: 52px; border-radius: 14px; background: var(--forest); color: white; font-weight: 900; cursor: pointer; }
.file-button:hover { background: var(--forest-2); }
.report { margin-top: 14px; border-left: 4px solid #91aa9c; border-radius: 8px; background: #edf2ee; padding: 12px 13px; color: #375348; font-size: .86rem; line-height: 1.48; }
.report.success { border-color: #23915d; background: #e5f5ec; }
.report.warning { border-color: var(--gold); background: #fff4d9; color: #684c18; }
.report.error { border-color: var(--danger); background: #fbe7e5; color: #722822; }
.room-queue { margin-top: 12px; }
.room-queue:empty { display: none; }
.room-queue > strong { display: block; font-size: .78rem; color: var(--forest); }
.room-queue ol { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.room-queue li { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 1px solid #cedbd2; border-radius: 10px; padding: 8px 10px; background: white; font-size: .78rem; }
.room-queue li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-queue li b { flex: none; color: var(--forest-2); font-size: .67rem; letter-spacing: .05em; }
.plan-connect-guide { border: 1px solid #8fb9a2; border-radius: 14px; padding: 12px 13px; background: #edf8f1; }
.plan-connect-guide strong { color: var(--forest); }
.plan-connect-guide p { margin: 5px 0 0; color: #476358; font-size: .84rem; line-height: 1.4; }
#attach-panel.attention { border-color: #d7a13b; box-shadow: 0 0 0 3px rgb(217 155 43 / 16%), var(--shadow); }
.actions { display: flex; gap: 9px; margin-top: 13px; }
.actions.stack { flex-direction: column; }
.button { min-height: 45px; border: 0; border-radius: 13px; padding: 10px 14px; font-weight: 900; cursor: pointer; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--forest); color: white; }
.button.secondary { color: var(--forest); background: var(--mint); border: 1px solid #79aa8d; }
.button.quiet { color: var(--forest); background: white; border: 1px solid #afc0b6; }
.button.danger { color: var(--danger); background: #fff2f1; border: 1px solid #d5aaa6; }
.workspace { min-width: 0; }
.workspace-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 7px 4px 15px; }
.workspace-head h2 { font-size: clamp(1.35rem, 2vw, 2rem); }
.stats { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.stat { border: 1px solid #b9cabe; border-radius: 999px; background: #f8fbf8; padding: 7px 10px; font-size: .78rem; font-weight: 800; }
.view-tabs { display: inline-flex; gap: 4px; border-radius: 14px 14px 0 0; background: #dfe9e2; padding: 5px; }
.tab { border: 0; border-radius: 10px; padding: 9px 13px; background: transparent; color: #496157; font-weight: 800; cursor: pointer; }
.tab.active { color: white; background: var(--forest); }
.view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.view-grid.plan #model-pane, .view-grid.model #plan-pane { display: none; }
.view-grid.plan, .view-grid.model { grid-template-columns: 1fr; }
.viewport-card { margin: 0; min-width: 0; overflow: hidden; }
.viewport-card figcaption { padding: 12px 15px; border-bottom: 1px solid var(--line); background: #f5f9f5; font-size: .8rem; font-weight: 800; color: #4d655a; }
#plan-svg, .three-viewport { display: block; width: 100%; height: clamp(420px, 54vh, 680px); background: linear-gradient(#f9fbf7, #edf4ef); }
#plan-svg .room-floor { stroke: #143c2b; stroke-width: 2; vector-effect: non-scaling-stroke; }
#plan-svg .wall-hit { fill: none; stroke: #000; stroke-opacity: .001; stroke-width: 44; pointer-events: stroke; cursor: pointer; vector-effect: non-scaling-stroke; }
#plan-svg .wall-line { fill: none; stroke: #0d4c32; stroke-width: 7; stroke-linecap: square; vector-effect: non-scaling-stroke; pointer-events: none; }
#plan-svg .wall-line.host-selected { stroke: #2563eb; stroke-width: 12; }
#plan-svg .wall-line.child-selected { stroke: #dc7a16; stroke-width: 12; }
#plan-svg .room-staged .wall-line { stroke: #bf7f13; stroke-dasharray: 10 7; }
#plan-svg .room-proposed .wall-line { stroke: #3186ad; stroke-dasharray: 7 5; }
#plan-svg .opening { stroke: #e8b745; stroke-width: 10; vector-effect: non-scaling-stroke; pointer-events: none; }
#plan-svg .wall-label { fill: #183a2c; paint-order: stroke; stroke: white; stroke-width: 4px; font-size: 12px; font-weight: 900; pointer-events: none; }
#plan-svg .room-label { fill: #0d4c32; paint-order: stroke; stroke: white; stroke-width: 5px; font-size: 16px; font-weight: 900; pointer-events: none; }
.readout, .view-tools { min-height: 43px; display: flex; gap: 10px; align-items: center; padding: 9px 13px; border-top: 1px solid var(--line); color: #4c6258; font-size: .8rem; }
.view-tools { justify-content: space-between; }
.mini-button { border: 1px solid #99ad9f; background: white; color: var(--forest); border-radius: 9px; padding: 7px 10px; font-weight: 800; }
.room-ledger { margin-top: 16px; }
.ledger-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.scale-lock { border: 1px solid #76a88a; border-radius: 999px; padding: 7px 10px; color: var(--forest); background: var(--mint); font-size: .72rem; font-weight: 900; }
.room-list { display: grid; gap: 9px; margin-top: 13px; }
.room-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 1px solid #ccd7cf; border-radius: 13px; padding: 11px 13px; background: white; }
.room-row strong { display: block; }
.room-row span { color: var(--muted); font-size: .78rem; }
/* owner ruling 3: each room's shape, asked visibly (the pressed choice is the one recorded) */
.shape-choice { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.shape-option { min-height: 36px; border: 1px solid #afc0b6; border-radius: 10px; padding: 6px 10px; background: white; color: var(--forest); font-size: .76rem; font-weight: 800; cursor: pointer; }
.shape-option[aria-pressed="true"] { background: var(--forest); color: white; border-color: var(--forest); }
.check-field { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: .82rem; font-weight: 800; color: #365246; }
.check-field input { width: 20px; height: 20px; margin: 0; }
.state { border-radius: 999px; padding: 6px 9px; font-size: .7rem !important; font-weight: 900; }
.state.confirmed { background: #dff3e8; color: #16613f; }
.state.staged { background: #fff0cb; color: #7a5410; }
.empty-state { color: var(--muted); text-align: center; padding: 15px; }
.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); translate: -50% 20px; opacity: 0; pointer-events: none; z-index: 20; max-width: min(92vw, 560px); border-radius: 14px; background: #071b12; color: white; box-shadow: 0 15px 40px #0005; padding: 12px 16px; transition: .2s ease; }
.toast.show { translate: -50% 0; opacity: 1; }
@media (max-width: 980px) {
  .site-head { grid-template-columns: auto minmax(0, 1fr); }
  .silo-badge { grid-column: 1 / -1; justify-self: start; }
  .shell { grid-template-columns: 1fr; }
  .workflow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow .panel:last-child { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .site-head { padding: 19px 16px; gap: 12px; }
  .brand-mark { width: 46px; height: 46px; border-radius: 14px; }
  .silo-badge { white-space: normal; }
  .shell { padding: 12px; display: flex; flex-direction: column; }
  .workflow { display: contents; }
  .workflow .panel:first-child { order: 1; }
  .workflow .panel:nth-child(2) { order: 2; }
  .workspace { order: 3; }
  .workflow .panel:last-child { order: 4; grid-column: auto; }
  .view-grid { grid-template-columns: 1fr; }
  #plan-svg, .three-viewport { height: 430px; }
  .field-row { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .workspace-head, .ledger-head { align-items: flex-start; flex-direction: column; }
  .stats { justify-content: flex-start; }
  .view-tabs { display: flex; width: 100%; }
  .tab { flex: 1; padding-inline: 6px; }
}
