:root{font:16px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#202c33;background:#fafbf9;--border:#d6dcda;--accent:#006d62;--soft:#e2f1ed}*{box-sizing:border-box}body{margin:0}header{height:56px;background:#172c32;color:#e1e9e7;display:flex;align-items:center;gap:19px;padding:0 24px;font-size:.94rem}.brand{display:flex;align-items:center;gap:10px;font-size:1.15rem;font-weight:680;color:white}.mark{font-size:1.7rem;color:#84d6ba;line-height:1}.divider{height:21px;border-left:1px solid #556568}main{display:grid;grid-template-columns:290px minmax(0,1fr);height:calc(100dvh - 56px)}aside{background:white;border-right:1px solid var(--border);overflow:auto}.section{padding:23px 20px;border-bottom:1px solid var(--border)}.spaces{border-bottom:0}h1,h2,p{margin:0}h1{font-size:1.48rem;letter-spacing:-.04em;margin-bottom:22px}h2{font-size:1.07rem;letter-spacing:-.02em}.heading,.stats,.pair,.toolbar,footer,.drawing-title,.toggle{display:flex;align-items:center}.heading{justify-content:space-between;margin-bottom:14px}#count{font-size:.82rem;background:#eef2f0;padding:1px 8px;border-radius:5px}label{font-size:.875rem;font-weight:560;display:block}button,select,input{font:inherit;font-size:.9rem;color:inherit}button,select,input:not([type=checkbox]){border:1px solid #c8d2ce;border-radius:6px;background:white;padding:8px 11px}button{cursor:pointer;font-weight:550;line-height:1.25}button:hover:enabled{background:#f0f5f2;border-color:#92aaa0}button:disabled{opacity:.45;cursor:default}.wide,select,#name{width:100%}select,#name{margin:6px 0 8px}button.primary{color:white;background:var(--accent);border-color:var(--accent)}button.primary:hover:enabled{background:#005a50}p{color:#586963;font-size:.89rem}.pair{gap:7px;margin-top:8px}.pair button{flex:1}.stats{justify-content:space-between;font-size:.85rem;color:#364f48}.spaces p{margin:12px 0}#list{display:grid;gap:6px;margin-top:13px}.space-row{display:flex;justify-content:space-between;gap:10px;align-items:center;text-align:left}.space-row span{overflow-wrap:anywhere}.space-row small{white-space:nowrap;font-weight:400}.space-row.active{background:var(--soft);border-color:#6aa89a}#workspace{display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-width:0}.toolbar{min-height:60px;background:white;padding:10px 18px;gap:16px;border-bottom:1px solid var(--border)}.drawing-title{gap:9px;flex:1;min-width:0}.drawing-title strong{font-size:.96rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.file-icon{color:var(--accent);font-size:1.35rem}.toggle{gap:5px;white-space:nowrap}input[type=checkbox]{accent-color:var(--accent);width:17px;height:17px}#stage{position:relative;overflow:hidden;background:#f5f7f4}#map{display:block;width:100%;height:100%;touch-action:none;cursor:grab}#map.tracing{cursor:crosshair}#map.dragging{cursor:grabbing}.zoom{position:absolute;bottom:16px;right:16px;display:flex;gap:3px}.zoom button{width:39px;height:36px;font-size:1.1rem}footer{min-height:37px;border-top:1px solid var(--border);padding:7px 16px;gap:10px;justify-content:space-between;background:#fff;font-size:.8rem;color:#53625f}#xy{font-variant-numeric:tabular-nums;white-space:nowrap}.error{color:#a63122;font-weight:600}#guide{pointer-events:none}#guide path{stroke:#58666a;stroke-width:1;vector-effect:non-scaling-stroke;stroke-linejoin:round}#guide .annotation{stroke:#99a3a3;stroke-width:.75}#guide text{fill:#546264;font-family:Arial,sans-serif}#saved polygon,#trace polygon,#trace polyline{vector-effect:non-scaling-stroke;stroke-linejoin:round}#saved polygon{fill:#13877329;stroke:#188773;stroke-width:1.6;cursor:pointer}#saved polygon.active{fill:#178e7455;stroke:#005f54;stroke-width:2.5}#trace{pointer-events:none}#trace polygon,#trace polyline{stroke:#037d69;stroke-width:2.4}#trace circle{vector-effect:non-scaling-stroke;stroke-width:2}button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #41a994;outline-offset:2px}[hidden]{display:none!important}@media(max-width:760px){main{grid-template-columns:225px minmax(0,1fr)}.section{padding:15px}.toolbar{flex-wrap:wrap;gap:7px}.drawing-title{flex-basis:100%}#xy{display:none}}@media(max-width:560px){main{display:flex;flex-direction:column-reverse;height:auto}#workspace{height:58dvh}.toolbar{min-height:42px}.drawing-title{flex-basis:auto}.toolbar strong{font-size:.8rem}header{height:45px}aside{border-right:0;border-top:1px solid var(--border);overflow:visible}h1{margin-bottom:8px}.section{padding:12px 16px}.spaces{padding-bottom:32px}}

#wall-length {
  position:absolute;
  transform:translate(-50%,-50%);
  padding:3px 8px;
  border-radius:4px;
  background:#173d37;
  color:white;
  font-size:.875rem;
  font-weight:600;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
  pointer-events:none;
}
#trace .alignment-guide {
  stroke:#167d87;
  stroke-width:1.4;
  stroke-dasharray:5 4;
  vector-effect:non-scaling-stroke;
}

#trace .corner-handle {
  pointer-events:all;
  cursor:move;
}
#trace .corner-handle:hover {
  stroke:#c66718;
}

#pallet-panel{border-top:1px solid var(--border)}
#pallet-context{margin:3px 0 12px}
#position-list{list-style:none;margin:12px 0 0;padding:0}
#position-list li{display:flex;gap:9px;align-items:baseline;border-top:1px solid var(--border);padding:6px 0;font-size:.87rem;overflow-wrap:anywhere}
#position-list strong{color:#805421}
#positions,#pallet-preview{pointer-events:none}
.pallet rect{vector-effect:non-scaling-stroke;stroke:#805421;stroke-width:1.35;fill:#f4ddae}
.pallet text{fill:#503718;text-anchor:middle;dominant-baseline:central;font-weight:650}
#pallet-preview rect{fill:#fce7bba8;stroke:#805421;stroke-dasharray:6 3;stroke-width:2}

#space-settings{margin-top:15px}
.prefix-row{display:flex;gap:6px;margin-top:4px}
.prefix-row input{min-width:0;flex:1}
#draft-prefix,#shelf-form input{width:100%;margin:4px 0 10px}
#pallet-spec{font-size:.85rem;color:#40544d;margin-bottom:8px}
#shelf-list{list-style:none;padding:0;margin:12px 0 0}
#shelf-list li{font-variant-numeric:tabular-nums;border-top:1px solid var(--border);padding:4px 0;overflow-wrap:anywhere}

#trace polyline.corner-alignment {
  stroke:#c66718;
  stroke-width:3;
  stroke-dasharray:6 3;
}

#map:not(.tracing) #positions .pallet{pointer-events:all;cursor:grab}
#positions .pallet.selected rect{stroke:#006d62;stroke-width:2.5;fill:#f7d99e}
#positions .pallet.moving{opacity:.2}
#position-list button{width:100%;display:flex;align-items:baseline;gap:8px;text-align:left}
#position-list button[aria-pressed=true]{border-color:#408b7a;background:var(--soft)}

#margin-form{margin:10px 0 13px}
.pallet-margin{fill:none;stroke:#956a31;stroke-width:1;stroke-dasharray:4 3;vector-effect:non-scaling-stroke;pointer-events:none}
.pallet.selected .pallet-margin,#pallet-preview .pallet-margin{stroke:#006d62;stroke-width:1.5}

#details-error:empty{display:none}
#details-error{margin:5px 0}

#unit-panel summary,#table-panel summary{cursor:pointer;color:var(--accent);font-weight:600}
.unit-form{display:grid;gap:8px;margin:10px 0}
.unit-form input,.unit-form select{display:block;width:100%;box-sizing:border-box;margin:3px 0 0}
#unit-hint{margin:10px 0}
#unit-spec{font-size:.85rem}
#placed-units,#unit-preview{pointer-events:none}
.rack-shape rect{fill:#d8e6f0;stroke:#3e6279;stroke-width:1.6;vector-effect:non-scaling-stroke}
.rack-shape text{text-anchor:middle;dominant-baseline:central;fill:#233e52;font-weight:650}
#unit-preview rect{fill:#d8e6f099;stroke-dasharray:5 3}

#layout-workflow{background:#f1f6f4;border:1px solid #c1d6ce;border-radius:6px;padding:10px;margin-top:10px}
#layout-help{margin:0 0 8px}
.fill-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:8px}
.fill-grid input{width:100%;margin-top:4px}
#layout-overlay{pointer-events:none}
#layout-overlay>.area{fill:#0678630f;stroke:#007465;stroke-width:1.6;stroke-dasharray:6 3;vector-effect:non-scaling-stroke}
#layout-overlay .pallet rect{fill:#a2dacc99;stroke:#006d62}
#delete-selected{color:#932e1e}

#prefix-form{margin-top:10px}
#table-types{margin:12px 0 0;overflow-wrap:anywhere}
#table-types:empty{display:none}
#table-types dt{font-size:.9rem;font-weight:600;border-top:1px solid var(--border);padding-top:6px}
#table-types dd{margin:0 0 6px;color:#586963;font-size:.85rem}

.unit-form textarea,#position-comment{display:block;box-sizing:border-box;width:100%;margin-top:3px;padding:8px 11px;resize:vertical;font:inherit;border:1px solid #c8d2ce;border-radius:6px}
#table-hint:not(:empty){margin:10px 0}
#placed-table-list{padding-left:18px;font-size:.9rem;overflow-wrap:anywhere}
#placed-table-list:empty{display:none}
#placed-tables{pointer-events:none}
.table-shape rect{fill:#f3e4c9;stroke:#8c6837;stroke-width:1.6;vector-effect:non-scaling-stroke}
.table-shape text{text-anchor:middle;dominant-baseline:central;fill:#634922;font-weight:650}
#unit-preview .table-shape rect{fill:#f3e4c999}

#map:not(.tracing) [data-fixture]{pointer-events:all;cursor:grab}
#map [data-fixture].selected rect{stroke:#006d62;stroke-width:3}
#map [data-fixture].moving{opacity:.25}
#placed-table-list,#unit-list{display:grid;gap:5px;padding:0;list-style:none}
.fixture-choice{width:100%;text-align:left}
.fixture-choice[aria-pressed=true]{background:var(--soft);border-color:#408b7a}
#fixture-panel{border-left:3px solid var(--accent)}
#fixture-error:empty{display:none}
#fixture-editor input:read-only{background:#f1f4f2;color:#596963}

.view-nav{display:flex;align-items:center;gap:16px;height:100%}
.view-nav a{display:flex;align-items:center;height:100%;box-sizing:border-box;border-bottom:3px solid transparent;padding:3px 0 0;color:#c5d4d1;text-decoration:none;white-space:nowrap}
.view-nav a:hover,.view-nav a[aria-current]{color:white;border-bottom-color:#84d6ba}
@media(max-width:560px){header{padding:0 12px;gap:10px}.view-nav{gap:12px;font-size:.82rem}}

#object-panel summary{cursor:pointer;color:var(--accent);font-weight:600}
#placed-objects{pointer-events:none}
.object-shape rect{fill:#e3daee;stroke:#785a91;stroke-width:1.6;vector-effect:non-scaling-stroke}
.object-shape text{text-anchor:middle;dominant-baseline:central;fill:#503665;font-weight:650}
#unit-preview .object-shape rect{fill:#e3daee99}
#placed-object-list{display:grid;gap:5px;padding:0;list-style:none;margin:10px 0 0}
#placed-object-list:empty,#object-hint:empty{display:none}

@media(max-width:520px){header:has(.view-nav){flex-wrap:wrap;height:auto;padding-block:6px;gap:6px 12px}header:has(.view-nav) .divider{display:none}.view-nav{height:32px;flex-wrap:nowrap}}

.adding-space aside{display:none}
.adding-space main{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(280px,1fr)}
.adding-space #workspace{height:auto;min-height:0}
#create-space-bar{padding:10px 16px;background:white;border-bottom:1px solid var(--border)}
#drawing-tools,#create-space-bar #draft{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px}
#drawing-tools h1{margin:0;font-size:1.1rem}
#drawing-tools a{color:var(--accent);font-size:1.3rem;text-decoration:none}
#drawing-tools select{width:auto;max-width:100%;margin:0}
#drawing-tools #import,#create-space-bar .wide{width:auto}
#create-space-bar #draft{margin-top:10px}
#create-space-bar #name,#create-space-bar #draft-prefix{width:clamp(95px,12vw,180px);margin:0}
#create-space-bar .stats{gap:8px}
#create-space-bar #hint{flex-basis:100%;margin:0}
#create-space-bar .pair{margin:0}
@media(max-width:560px){.adding-space main{height:auto}.adding-space #workspace{height:max(52dvh,320px)}}

.editing-layout main{grid-template-columns:minmax(0,1fr) minmax(260px,320px);grid-template-rows:auto minmax(0,1fr)}
.editing-layout #layout-heading{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid var(--border);padding:14px 20px;background:white}
#layout-heading h1{margin:0}
.editing-layout #layout-heading{position:sticky;top:0;z-index:5}
.layout-actions{display:flex;gap:8px;align-items:center}
#layout-save{display:grid;place-items:center;min-width:42px;min-height:40px}
.editing-layout #fixture-editor button.primary,.editing-layout #position-details button{display:none}
#position-details label{display:block;margin-top:9px}
#position-details input{width:100%}
.editing-layout aside{grid-column:2;grid-row:2;border:0;border-left:1px solid var(--border)}
.editing-layout #workspace{grid-column:1;grid-row:2}
.editing-layout aside>.section:has(#plans),.editing-layout .section.spaces,.editing-layout #margin-form{display:none}
.editing-layout #layout-selector{padding-bottom:14px}
.editing-layout #layout-selector select{margin-bottom:0}
.editing-layout #saved polygon.active{fill:white;stroke:#32665b;cursor:grab}
.editing-layout #fixture-panel{border-left:0}
.editing-layout #delete-fixture{color:#96382b}
@media(max-width:680px){
  .editing-layout main{display:flex;flex-direction:column;height:auto}
  .editing-layout #layout-heading{order:0}
  .editing-layout #workspace{order:1;height:max(48dvh,320px)}
  .editing-layout aside{order:2;border-left:0;overflow:visible}
}
