:root {
  color-scheme: light;
  --ink: #24342c;
  --muted: #66756b;
  --line: #e1e7df;
  --paper: #fff;
  --field: #f6f8f4;
  --green: #25483a;
  --green-hover: #1d3c30;
  --green-soft: #eaf2e9;
  --accent: #2f7456;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: #f7f8f4;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; height: 100dvh; min-height: 450px; display: grid; grid-template-rows: 74px minmax(0, 1fr); }
button, input { font: inherit; color: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border: 0; background: none; border-radius: 7px; padding: 0; }
button:disabled { opacity: .35; cursor: default; }
button:focus-visible, input:focus-visible, #plan:focus-visible { outline: 2px solid #45896b; outline-offset: 2px; }
button:not(:disabled):hover { background: var(--green-soft); }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.icon { width: 17px; height: 17px; flex: 0 0 auto; vertical-align: middle; }
.header { z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 25px; background: var(--paper); border-bottom: 1px solid var(--line); }
.identity, .header-actions { display: flex; align-items: center; gap: 13px; }
.mark, .mark img { display: block; width: 40px; height: 40px; flex-shrink: 0; }
h1 { font-size: 19px; line-height: 1.12; font-weight: 700; letter-spacing: -.6px; }
.subtitle { color: var(--muted); font-size: 12px; margin-top: 4px; }
.save-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; margin-right: 5px; }
.save-status span, .canvas-label span { width: 7px; height: 7px; border-radius: 50%; background: #629c76; }
.history, .zoom { display: flex; align-items: center; border: 1px solid var(--line); background: white; padding: 3px; border-radius: 8px; }
.history button, .zoom button, .icon-button { width: 33px; height: 33px; }
.primary { padding: 0 15px; min-height: 39px; background: var(--green); color: white; font-weight: 650; }
.primary:not(:disabled):hover { background: var(--green-hover); }
.secondary { border: 1px solid var(--line); min-height: 36px; padding: 0 12px; font-size: 12px; font-weight: 620; }
.quiet { min-height: 36px; padding: 0 12px; color: var(--muted); font-size: 12px; }
.export-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 195px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 8px 30px #172f201a; border-radius: 9px; padding: 5px; }
.menu button { min-height: 36px; width: 100%; justify-content: flex-start; padding: 0 9px; white-space: nowrap; font-size: 13px; }
.workspace { min-height: 0; display: grid; grid-template-columns: 224px minmax(0, 1fr) 255px; }
.library, .inspector { background: var(--paper); min-height: 0; overflow: auto; padding: 22px 16px 14px; }
.library { border-right: 1px solid var(--line); }
.inspector { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.side-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.side-heading h2 { font-size: 15px; letter-spacing: -.2px; }
.badge, .plan-tag { color: #476854; font-size: 9px; font-weight: 750; letter-spacing: .08em; border-radius: 4px; background: var(--green-soft); padding: 4px 6px; white-space: nowrap; }
.side-intro { font-size: 12px; line-height: 1.45; color: var(--muted); margin: 9px 0 15px; }
.catalog-group + .catalog-group { margin-top: 14px; }
.catalog-group h3, .section-label { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .10em; text-transform: uppercase; margin-bottom: 6px; }
.catalog-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.catalog-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 47px; border: 1px solid var(--line); color: #45574b; padding: 4px 2px; font-size: 11px; text-align: center; }
.catalog-item .icon { width: 18px; height: 18px; }
.catalog-item[aria-pressed=true], .tools button[aria-pressed=true] { background: var(--green-soft); color: var(--green); font-weight: 700; }
.catalog-item[aria-pressed=true] { border-color: #92b19c; }
.reference-settings { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.reference-settings .side-heading { margin-bottom: 7px; }
.switch-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 33px; font-size: 12px; cursor: pointer; }
.switch-row > span:first-child { display: flex; align-items: center; gap: 7px; }
.switch-row .icon { width: 15px; height: 15px; color: var(--muted); }
.switch-row input { position: absolute; inset-inline-end: 0; width: 29px; height: 17px; margin: 0; opacity: 0; }
.switch { position: relative; width: 29px; height: 17px; border-radius: 20px; background: #cdd8ce; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 11px; height: 11px; background: white; border-radius: 100%; transition: transform .15s; }
.switch-row input:checked + .switch { background: #477b60; }
.switch-row input:checked + .switch::after { transform: translateX(12px); }
.switch-row input:focus-visible + .switch { outline: 2px solid #45896b; outline-offset: 2px; }
.opacity-row { display: grid; gap: 4px; padding: 6px 0; font-size: 11px; color: var(--muted); }
.opacity-row input { width: 100%; accent-color: var(--accent); }
.stage { display: grid; min-width: 0; min-height: 0; grid-template-rows: 57px minmax(0, 1fr) 34px; }
.stage-bar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 16px; }
.stage-name { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.stage-name .icon, .muted-icon { color: var(--muted); }
.stage-name strong { font-size: 13px; }
.tools { display: flex; gap: 2px; align-items: center; padding: 3px; background: var(--field); border: 1px solid var(--line); border-radius: 8px; }
.tools > button, #flip-plan { padding: 0 9px; height: 29px; font-size: 12px; color: #596b60; white-space: nowrap; }
.flip-wrap { position: relative; padding-left: 2px; border-left: 1px solid var(--line); }
#flip-plan[aria-expanded=true] { background: var(--green-soft); color: var(--green); }
.tools .icon { width: 15px; height: 15px; }
.stage-options, .mobile-view, .mobile-inspector { display: none; }
.drawing { background: #f5f8f2; position: relative; overflow: hidden; min-height: 0; min-width: 0; }
#plan { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; cursor: default; }
#plan[data-mode="wall"], #plan[data-mode="place"] { cursor: crosshair; }
#plan[data-mode="pan"] { cursor: grab; }
#plan.dragging { cursor: grabbing; }
#plan[data-mode="select"] .object { cursor: move; }
#plan[data-mode="select"] .end-handle { cursor: crosshair; }
#plan:not([data-mode="select"]) .end-handle { pointer-events: none; }
.canvas-label, .hint, .zoom { box-shadow: 0 2px 7px #18261d0c; }
.canvas-label { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 7px; padding: 7px 9px; background: #ffffffec; border: 1px solid var(--line); border-radius: 6px; color: #516657; font-size: 9px; font-weight: 750; letter-spacing: .11em; pointer-events: none; }
.canvas-bottom { position: absolute; bottom: 12px; inset-inline: 13px; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; pointer-events: none; }
.hint { display: flex; align-items: center; gap: 7px; background: #ffffffef; border: 1px solid var(--line); border-radius: 7px; padding: 8px; color: var(--muted); font-size: 11px; }
.hint .icon { width: 14px; height: 14px; }
.zoom { flex: 0 0 auto; pointer-events: auto; }
.zoom button { width: 28px; height: 28px; }
.zoom output { min-width: 43px; text-align: center; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.zoom > span { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.stage-footer { display: flex; justify-content: space-between; gap: 4px; align-items: center; padding: 0 13px; background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#pointer { min-width: 93px; }
#properties { padding-top: 17px; }
.empty { border: 1px dashed #d6e0d6; border-radius: 9px; text-align: center; padding: 23px 12px; background: #f9fbf7; }
.empty-icon, .selected-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--green-soft); color: var(--green); }
.empty h3 { font-size: 13px; margin-top: 10px; }
.empty p, .property-note { font-size: 12px; color: var(--muted); line-height: 1.55; margin-top: 6px; }
.plan-info { padding-top: 19px; }
.plan-info dl { margin: 8px 0 0; font-size: 12px; display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.plan-info dt { color: var(--muted); }
.plan-info dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.selected-heading { display: flex; gap: 9px; align-items: center; margin-bottom: 16px; }
.selected-heading h3 { font-size: 14px; }
.selected-heading p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 7px 0 14px; }
.fields label { font-size: 11px; color: var(--muted); }
.fields input { display: block; margin-top: 4px; border: 1px solid var(--line); border-radius: 6px; padding: 7px; background: var(--field); color: var(--ink); width: 100%; height: 33px; font-variant-numeric: tabular-nums; }
.property-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; margin-top: 14px; }
.property-actions button { padding: 0 5px; }
.property-actions .icon { width: 14px; height: 14px; }
.danger { color: #923e3e; }
.inspector-bottom { margin-top: auto; padding-top: 18px; display: grid; gap: 3px; }
dialog { width: min(450px, calc(100vw - 30px)); padding: 20px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); box-shadow: 0 15px 80px #102c2a38; }
dialog::backdrop { background: #1b332959; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.dialog-header h2 { font-size: 18px; }
dialog p { color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.shortcut-list { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px 6px; }
.shortcut-list dd { margin: 0; text-align: right; }
kbd { display: inline-block; border: 1px solid var(--line); background: var(--field); padding: 2px 4px; border-radius: 4px; font-size: 11px; }
.toast { position: fixed; z-index: 5; bottom: 52px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 30px); border-radius: 8px; background: var(--green); color: white; padding: 10px 15px; font-size: 13px; box-shadow: 0 4px 16px #18261d25; }
@media (max-width: 1080px) {
  .workspace { grid-template-columns: 176px minmax(0, 1fr) 203px; }
  .library, .inspector { padding-inline: 12px; }
}
@media (max-width: 830px) {
  .workspace { grid-template-columns: 155px minmax(0, 1fr); position: relative; }
  .inspector { display: none; position: absolute; z-index: 3; right: 0; top: 57px; bottom: 34px; width: min(245px, 75vw); box-shadow: -8px 0 20px #243b2420; }
  .inspector.open { display: flex; }
  .stage-options, .mobile-inspector { display: inline-flex; flex: 0 0 auto; }
  .stage-bar { padding: 0 10px; }
  .header { padding-inline: 12px; }
}
@media (max-width: 560px) {
  body { grid-template-rows: 60px minmax(0, 1fr); }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 84px; }
  .stage { grid-row: 1; position: relative; }
  .mobile-view { display: inline-flex; }
  .library { grid-row: 2; border-right: 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 7px; overflow: auto; }
  .library > .side-heading, .side-intro { display: none; }
  #catalog, .catalog-items { display: flex; gap: 5px; }
  .catalog-group { padding: 0 5px; }
  .catalog-group + .catalog-group { margin-top: 0; }
  .catalog-item { width: 65px; flex: 0 0 auto; }
  .reference-settings { display: none; position: absolute; z-index: 2; top: 57px; left: 0; width: 194px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 0 0 8px 0; background: white; box-shadow: 4px 7px 18px #243b2420; }
  .reference-settings.open { display: block; }
  .inspector { bottom: 118px; }
  .save-status, .plan-tag, .canvas-label { display: none; }
  .header-actions { gap: 6px; }
  .mark, .mark img { width: 33px; height: 33px; }
  .identity { gap: 6px; }
  h1 { font-size: 15px; }
  .subtitle { font-size: 10px; }
  .primary { padding: 0 8px; }
  .history button { width: 25px; }
  .tools > button, #flip-plan { padding: 0 6px; gap: 4px; }
  #flip-plan span { display: none; }
  .stage-name .icon { display: none; }
  .stage-name strong { font-size: 11px; }
}
@media (max-width: 375px) {
  .tools > button span, .hint .icon { display: none; }
  .tools > button, #flip-plan { width: 30px; }
}
