* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #2d4559; color: #f5f5f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'SF Pro Display', system-ui, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.page-shell { max-width: 1480px; margin: 0 auto; padding: 16px; }
.card { background: #3a5266; border: 1px solid rgba(184, 212, 200, 0.15); border-radius: 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.header-card { padding: 18px; display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
h1, h2, h3 { margin: 0; color: #f5f5f5; }
h1 { font-size: 28px; font-weight: 600; }
h2 { font-size: 20px; font-weight: 600; }
.muted { color: #b8d4c8; margin: 6px 0 0; line-height: 1.4; }
.controls-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #b8d4c8; font-weight: 500; }
.field input, .field select { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid #5b9faa; background: #2d4559; color: #f5f5f5; }
.field input:focus, .field select:focus { outline: none; border-color: #e9a199; box-shadow: 0 0 0 3px rgba(233, 161, 153, 0.15); }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.primary, .secondary { padding: 11px 14px; border-radius: 10px; border: 1px solid transparent; font-weight: 500; transition: all 0.15s ease; }
.primary { background: #c8767d; color: white; }
.primary:hover { background: #e9a199; }
.secondary { background: #3a5266; color: #f5f5f5; border-color: #5b9faa; }
.secondary:hover { background: #4a5f75; border-color: #b8d4c8; }
.status-line { background: rgba(91, 159, 170, 0.15); border: 1px solid rgba(91, 159, 170, 0.4); border-radius: 12px; padding: 10px 12px; color: #b8d4c8; font-size: 13px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.stage-card { padding: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head.compact { margin-bottom: 12px; }
.canvas-wrap { display: flex; justify-content: center; align-items: center; min-height: 420px; background: linear-gradient(180deg, #2d4559 0%, #3a5266 100%); border-radius: 16px; padding: 18px; overflow: auto; }
.canvas-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.stage-shell { background: #2d4559; border: 1px solid #5b9faa; border-radius: 16px; padding: 14px; }
.room-stage { position: relative; background: #f5f5f5; border: 3px solid #5b9faa; overflow: hidden; border-radius: 8px; touch-action: none; }
.room-grid { position: absolute; inset: 0; background-image: linear-gradient(to right, rgba(91, 159, 170, 0.12) 1px, transparent 1px), linear-gradient(to bottom, rgba(91, 159, 170, 0.12) 1px, transparent 1px); }
.room-label { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(45, 69, 89, 0.9); color: #b8d4c8; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.item { position: absolute; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0; overflow: visible; background: transparent; border: none; border-radius: 0; box-shadow: none; user-select: none; cursor: pointer; transition: all 0.2s ease; touch-action: none; }
.item:hover { border: none; box-shadow: none; }
.item.sectional-piece { background: transparent; }
.item.selected { border: none; box-shadow: none; z-index: 3; }
.item-inner { position: absolute; left: 50%; top: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: visible; transform-origin: center center; transition: transform 120ms ease; }
.item-avatar { width: 100%; height: 100%; object-fit: contain; object-position: center center; display: block; transform: scale(1.08); transform-origin: center center; }
.item-topdown { width: 100%; height: 100%; display: block; transform: scale(1.16); transform-origin: center center; }
.item-topdown .shadow { fill: var(--topdown-shadow, rgba(45, 69, 89, 0.12)); }
.item-topdown .surface { fill: var(--topdown-surface, #e9dccb); stroke: var(--topdown-line, #69564b); stroke-width: 2; }
.item-topdown .detail { fill: var(--topdown-detail, #dbc9b1); stroke: var(--topdown-line, #69564b); stroke-width: 1.3; }
.item-topdown .detail-soft { fill: var(--topdown-detail-soft, #efe5d8); }
.item-topdown .detail-strong { fill: var(--topdown-detail-strong, #cfb79a); }
.item-topdown .accent { fill: var(--topdown-accent, #b78b6d); stroke: var(--topdown-line, #69564b); stroke-width: 1.3; }
.item-topdown .line { stroke: var(--topdown-line, #7a6659); stroke-width: 1.2; stroke-linecap: round; fill: none; }
.item-topdown-rug .rug-surface { fill: var(--topdown-rug-surface, #d9e5eb); stroke-dasharray: 4 3; }
.item-topdown-rug .rug-line { stroke: rgba(91, 159, 170, 0.55); }
.item-topdown-table-round .table-surface,
.item-topdown-table-rect .table-surface { fill: var(--topdown-accent, #d3b08a); }
.item-topdown-cabinet .cabinet-surface { fill: var(--topdown-accent, #d2b28d); }
.item-copy { display: none; }
.item .dims { display: none; }
.sidebar-stack { display: flex; flex-direction: column; gap: 16px; }
.sidebar-stack .card { padding: 16px; }
.catalog-results, .layout-list, .preset-list { display: flex; flex-direction: column; gap: 10px; }
.result-card, .saved-card, .info-card { background: #2d4559; border: 1px solid #5b9faa; border-radius: 12px; padding: 12px; }
.result-card h3, .saved-card h3, .info-card h3 { font-size: 15px; margin-bottom: 4px; font-weight: 600; }
.result-card p, .saved-card p, .info-card p { margin: 0 0 10px; color: #b8d4c8; font-size: 13px; line-height: 1.4; }
.preset-card { background: #2d4559; border: 1px solid #5b9faa; border-radius: 12px; padding: 12px; }
.preset-card h3 { font-size: 15px; margin: 0 0 4px; font-weight: 600; }
.preset-card p { margin: 0 0 10px; color: #b8d4c8; font-size: 13px; line-height: 1.4; }
.inline-field { margin-bottom: 12px; }
.group-note { margin: 10px 0; }
.group-chip { display: inline-flex; align-items: center; gap: 6px; }
.sectional-empty { padding: 2px 0; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.badge { border: 1px solid #5b9faa; border-radius: 999px; padding: 4px 8px; font-size: 12px; color: #b8d4c8; background: rgba(91, 159, 170, 0.1); }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.helper { color: #b8d4c8; font-size: 12px; line-height: 1.45; }
.selected-empty { color: #b8d4c8; font-size: 14px; line-height: 1.5; }
.notice { background: rgba(91, 159, 170, 0.15); border: 1px solid rgba(91, 159, 170, 0.35); border-radius: 12px; padding: 12px; color: #b8d4c8; font-size: 13px; }
.warning-section { margin-bottom: 14px; }
.warning-section h3 { font-size: 14px; margin-bottom: 8px; font-weight: 600; }
.error-section h3 { color: #e9a199; }
.warning-section.warning-section h3 { color: #f5c4b8; }
.warning-item { background: #2d4559; border: 1px solid #5b9faa; border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; font-size: 13px; line-height: 1.4; }
.warning-item.error { border-color: #c8767d; background: rgba(200, 118, 125, 0.12); color: #e9a199; }
.warning-item.warning { border-color: #f5c4b8; background: rgba(245, 196, 184, 0.12); color: #f5c4b8; }
@media (max-width: 1100px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .controls-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .page-shell { padding: 12px; }
  .header-card, .stage-card, .sidebar-stack .card { padding: 14px; }
  .controls-grid { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
  .canvas-wrap { min-height: 300px; padding: 12px; }
  h1 { font-size: 24px; }
}
