:root {
  --bg: #eef1ec;
  --panel: #ffffff;
  --ink: #1c2921;
  --muted: #6a756e;
  --line: #d8ded8;
  --green: #285f3a;
  --green-2: #3d7c51;
  --sand: #f3eee2;
  --orange: #b46d00;
  --red: #8a2b2b;
  --blue: #2a62a8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); background: var(--bg); overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #f8faf6, #dfe8df); }
.card { background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 50px rgba(32,55,38,.12); }
.login-card { width: min(460px, 100%); padding: 36px; }
.login-card h1 { margin: 5px 0 12px; font-size: 2rem; }
.eyebrow { margin: 0; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
label { display: grid; gap: 6px; color: var(--muted); font-size: .84rem; margin: 14px 0; }
input, select, textarea { width: 100%; border: 1px solid #c9d2ca; border-radius: 9px; padding: 10px 11px; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #a9cbb1; border-color: var(--green-2); }
.primary, .secondary, .ghost, .danger-outline, .icon-button { border-radius: 9px; padding: 9px 13px; border: 1px solid transparent; }
.primary { background: var(--green); color: white; }
.primary:hover { background: #1e4d2d; }
.secondary { background: #edf4ee; color: var(--green); border-color: #bbd0bf; }
.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.danger-outline { background: #fff7f7; border-color: #d6aaaa; color: var(--red); }
.icon-button { width: 34px; height: 34px; padding: 0; background: var(--green); color: white; font-size: 1.3rem; }
.full { width: 100%; }
.small { padding: 6px 9px; font-size: .8rem; }
.error { color: var(--red); min-height: 1.2em; }
.app { height: 100vh; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.topbar h1 { margin: 3px 0 0; font-size: 1.35rem; }
.top-actions, .button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { background: var(--sand); color: #665535; border-radius: 999px; padding: 6px 10px; font-size: .77rem; }
.workspace { display: grid; grid-template-columns: 260px minmax(480px,1fr) 370px; min-height: 0; height: 100%; overflow: hidden; gap: 1px; background: var(--line); }
.panel { background: var(--panel); min-height: 0; overflow: auto; }
.left-panel, .right-panel { padding: 18px; }
.left-panel section, .right-panel section { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 18px; }
section:last-child { border-bottom: 0; }
h2 { font-size: 1rem; margin: 0 0 10px; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hint, .muted { color: var(--muted); font-size: .78rem; }
.list { display: grid; gap: 8px; }
.list-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fff; }
.list-item.active { border-color: var(--green-2); box-shadow: inset 3px 0 var(--green-2); background: #f6faf6; }
.list-item button { border: 0; background: transparent; color: inherit; padding: 0; text-align: left; }
.item-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px; color: var(--muted); font-size: .72rem; }
.item-actions { margin-top: 7px; display: flex; gap: 7px; }
.compact .list-item { padding: 8px; }
.drawing-controls { background: #eef6ff; border: 1px solid #b9d0eb; border-radius: 10px; padding: 9px; margin-top: 9px; }
.map-panel { display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.map-toolbar { min-height: 58px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .72rem; color: var(--muted); }
.swatch { display: inline-block; width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; border-radius: 2px; }
.swatch.existing { background: #b2caaa; }
.swatch.protected { border: 2px solid #9c2f2f; }
.swatch.zone { background: #3c83f6; opacity: .5; }
.swatch.planned { background: #e5a235; }
.map-wrap { position: relative; min-height: 480px; background: #f7f5ef; overflow: hidden; }
#garden-map { display: block; width: 100%; height: 100%; min-height: 480px; cursor: default; }
#garden-map.drawing { cursor: crosshair; }
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.feature { vector-effect: non-scaling-stroke; transition: opacity .15s, stroke-width .15s; }
.feature:hover { opacity: .78; stroke-width: 4; }
.feature.protected { stroke: #9b3030; stroke-width: 3; }
.feature.external { opacity: .5; }
.zone-shape { fill: rgba(44,103,188,.18); stroke: #2a62a8; stroke-width: 3; vector-effect: non-scaling-stroke; }
.plan-shape { fill: rgba(235,165,46,.28); stroke: #b46d00; stroke-width: 3; vector-effect: non-scaling-stroke; }
.drawing-line { fill: rgba(42,98,168,.08); stroke: #2a62a8; stroke-width: 2; stroke-dasharray: 7 5; vector-effect: non-scaling-stroke; }
.selection-card { border-top: 1px solid var(--line); padding: 10px 16px; display: flex; gap: 12px; font-size: .82rem; }
.proposal { display: grid; gap: 9px; font-size: .83rem; }
.proposal-card { background: #f7f9f6; border: 1px solid var(--line); border-radius: 9px; padding: 10px; }
.proposal-card h3 { margin: 0 0 5px; font-size: .9rem; }
.proposal ul { padding-left: 18px; margin: 5px 0; }
.check-row { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.check-row input { width: auto; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; border-radius: 9px; border: 1px solid var(--line); }
.gallery figcaption { font-size: .7rem; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1e3025; color: white; padding: 11px 16px; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.25); z-index: 10; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 220px minmax(420px,1fr); }
  .right-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
  .right-panel section { border-bottom: 0; border-right: 1px solid var(--line); padding-right: 18px; }
}
@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .workspace { display: block; }
  .left-panel, .right-panel { overflow: visible; }
  .right-panel { display: block; }
  .map-wrap, #garden-map { min-height: 420px; }
}
.guided { border: 1px solid var(--line); border-radius: 10px; padding: 9px; margin: 10px 0 14px; background: #fbfcfa; }
.guided summary { cursor: pointer; font-weight: 700; color: var(--green); }
.guided-catalog { display: grid; gap: 8px; max-height: 330px; overflow: auto; padding-right: 4px; margin-top: 10px; }
.guided-catalog fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.guided-catalog legend { color: var(--ink); font-size: .78rem; font-weight: 700; padding: 0 4px; }
.guided-catalog .check-row { margin: 5px 0; font-size: .76rem; color: var(--ink); }
.variant-picker { display: grid; gap: 7px; margin-bottom: 9px; }
.variant-option { display: block; border: 1px solid var(--line); border-radius: 9px; padding: 9px; background: #fff; }
.variant-option.selected { border-color: var(--green-2); background: #f2f8f3; }

.zone-scope-block { margin: 12px 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfa; }
.zone-scope-list { display: grid; gap: 3px; max-height: 130px; overflow: auto; }
.planning-zone-option { margin: 3px 0; color: var(--ink); font-size: .78rem; }

/* v0.1.1-rc.6 planning usability and grounded visualisation */
.swatch.preview { background: #7a4eb2; opacity: .55; }
#garden-map.drawing .feature,
#garden-map.drawing .zone-shape,
#garden-map.drawing .plan-shape,
#garden-map.drawing .preview-shape { pointer-events: none; }
.drawing-controls { display: grid; gap: 8px; }
.drawing-controls .button-row { align-items: stretch; }
.drawing-point { fill: #fff; stroke: #1f5fbf; stroke-width: 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.drawing-point-label { fill: #153b72; font-size: 18px; font-weight: 800; paint-order: stroke; stroke: #fff; stroke-width: 4px; pointer-events: none; }
.preview-shape { fill: rgba(122,78,178,.16); stroke: #7041a8; stroke-width: 4; stroke-dasharray: 9 6; vector-effect: non-scaling-stroke; }
.zone-profile-label { margin: 8px 0 0; }
.zone-profile-select { padding: 7px 8px; font-size: .75rem; }
.zone-rule { margin: 7px 0 0; padding: 7px; border-left: 3px solid var(--blue); background: #f0f5fb; color: #3b4e61; font-size: .72rem; line-height: 1.35; }
.terrain-action { border-color: #d8b56f; background: #fffaf0; }
.terrain-approval { padding: 9px; border: 1px solid #d8b56f; border-radius: 9px; background: #fff8e8; color: #684a14; }
.warning-meta { color: #8a5a19; }
.server-check { border-color: #9fb8d4; background: #f2f7fc; }
.source-preview { width: 100%; max-height: 210px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); margin-top: 4px; }
.gallery { grid-template-columns: 1fr; }
.gallery img { max-height: 360px; object-fit: cover; }
button:disabled { cursor: not-allowed; opacity: .5; }


/* v0.1.1-rc.7 grounded 2D planning */
.small-badge { padding: 4px 7px; font-size: .68rem; }
.subheading { margin: 14px 0 8px; font-size: .84rem; }
.element-catalog { display: grid; gap: 10px; margin: 12px 0; }
.catalog-group { display: grid; gap: 6px; }
.catalog-group > strong { font-size: .75rem; color: var(--muted); }
.catalog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.catalog-item { display: grid; gap: 2px; text-align: left; border: 1px solid var(--line); border-radius: 9px; padding: 8px; background: #fff; color: var(--ink); }
.catalog-item:hover, .catalog-item.selected { border-color: var(--green-2); background: #f2f8f3; box-shadow: inset 3px 0 var(--green-2); }
.catalog-item small { color: var(--muted); font-size: .68rem; }
.placement-controls { border: 1px solid #9fb8d4; border-radius: 10px; padding: 10px; background: #f2f7fc; margin: 10px 0; }
.dimension-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
.dimension-grid label { margin: 7px 0; }
.placement-instruction { margin: 5px 0 10px; font-size: .76rem; color: #304f73; font-weight: 650; }
#garden-map.placing { cursor: copy; }
.plan-shape.locked-plan-shape { fill: rgba(235,165,46,.38); stroke-width: 4; }
.plan-shape.legacy-plan-shape { fill: rgba(180,70,50,.12); stroke: #9b3c2f; stroke-dasharray: 7 5; }
.planned-item.locked-item { border-color: #d2a454; background: #fffaf0; }
.item-warning, .site-warning { margin: 7px 0 0; color: #7a4d13; font-size: .72rem; line-height: 1.35; }
.danger-text { color: var(--red) !important; }
.unplaced-action { border-color: #d6aaaa; background: #fff8f7; }
.image-history { margin-top: 10px; border: 1px solid var(--line); border-radius: 9px; padding: 8px; }
.image-history summary { cursor: pointer; font-weight: 700; color: var(--green); }
.image-history[open] .gallery { max-height: 430px; overflow: auto; padding-right: 4px; }
.map-panel { position: relative; }
.right-panel, .left-panel { overscroll-behavior: contain; }

@media (max-width: 760px) {
  html, body { height: auto; }
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; overflow: visible; }
  .workspace { height: auto; overflow: visible; }
  .dimension-grid { grid-template-columns: 1fr; }
}
