:root {
  --bg: #070b08;
  --panel: rgba(13, 20, 15, 0.96);
  --panel-soft: rgba(255,255,255,.035);
  --line: rgba(255,255,255,.08);
  --text: #f1f5f1;
  --muted: #89968d;
  --accent: #a7e279;
  --accent-2: #78c79b;
  --exterior: #94dc70;
  --interior: #f4b963;
  --danger: #f08079;
  --shadow: 0 22px 65px rgba(0,0,0,.36);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 70% -15%, rgba(128, 189, 99, .12), transparent 35%),
    radial-gradient(circle at -10% 110%, rgba(52, 119, 87, .10), transparent 38%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}
button, select, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid rgba(167,226,121,.75); outline-offset: 2px; }

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 310px;
  gap: 12px;
  padding: 12px;
}

.sidebar, .details-panel {
  min-width: 0;
  background: linear-gradient(180deg, rgba(17, 26, 19, .98), rgba(9, 14, 11, .98));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.sidebar { display: flex; flex-direction: column; overflow: hidden; }
.workspace { min-width: 0; display: grid; grid-template-rows: auto minmax(0,1fr); gap: 12px; }

.brand { display: flex; gap: 12px; align-items: center; padding: 19px 18px 15px; border-bottom: 1px solid var(--line); }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  overflow: hidden;
  flex: 0 0 44px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 18px; letter-spacing: -.025em; }
h2 { font-size: 16px; letter-spacing: -.02em; }
h3 { font-size: 15px; }
.eyebrow { color: var(--muted); font-size: 9px; letter-spacing: .15em; text-transform: uppercase; font-weight: 850; }

.sidebar-scroll { overflow: auto; padding: 12px; }
.sidebar-scroll::-webkit-scrollbar { width: 7px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 20px; }
.panel { padding: 14px; background: var(--panel-soft); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.label { display: block; color: #abb6ae; font-size: 11px; font-weight: 760; margin-bottom: 6px; }
.top-gap { margin-top: 12px; }
.control {
  width: 100%; color: var(--text); background: #09100c; border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px; padding: 10px 11px; outline: none; transition: .16s ease;
}
.control:focus { border-color: rgba(167,226,121,.55); box-shadow: 0 0 0 3px rgba(167,226,121,.07); }
select.control { cursor: pointer; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-heading h2 { margin-top: 3px; font-size: 14px; }
.section-subtitle { color: #66736b; font-size: 9px; margin-top: 4px; }

.toggle-row {
  position: relative; min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  color: #c6cec8; font-size: 12px; cursor: pointer; border-top: 1px solid rgba(255,255,255,.045);
}
.toggle-row:first-of-type { border-top: 0; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 36px; height: 20px; border-radius: 999px; background: #273029; position: relative; transition: .16s ease; flex: none; }
.switch::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #7d8880; transition: .16s ease; }
.toggle-row input:checked + .switch { background: rgba(148,220,112,.25); }
.toggle-row input:checked + .switch::after { transform: translateX(16px); background: var(--accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.exterior-dot { background: var(--exterior); box-shadow: 0 0 0 3px rgba(148,220,112,.09); }
.interior-dot { background: var(--interior); box-shadow: 0 0 0 3px rgba(244,185,99,.09); }

.counter-list { display: grid; gap: 7px; }
.counter-row {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center;
  min-height: 55px; padding: 8px 9px 8px 11px; border: 1px solid var(--line); border-radius: 13px;
  background: linear-gradient(180deg, rgba(255,255,255,.028), rgba(255,255,255,.012));
}
.counter-row.featured { border-color: rgba(167,226,121,.13); background: linear-gradient(155deg, rgba(167,226,121,.09), rgba(255,255,255,.012)); }
.counter-name { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.counter-name span { color: #aab6ae; font-size: 11px; font-weight: 720; }
.counter-name strong { font-size: 22px; letter-spacing: -.04em; }
.stepper { display: inline-grid; grid-template-columns: 30px 30px; gap: 4px; }
.stepper button {
  width: 30px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,.035);
  color: #dce5df; cursor: pointer; font-size: 17px; line-height: 1; transition: .14s ease;
}
.stepper button:hover { background: rgba(167,226,121,.1); border-color: rgba(167,226,121,.22); transform: translateY(-1px); }

.button-stack { display: grid; gap: 8px; margin-top: 10px; }
.button {
  border: 1px solid transparent; border-radius: 12px; min-height: 38px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none;
  color: var(--text); cursor: pointer; background: #151d17; transition: .15s ease; font-weight: 720; font-size: 11px;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: #10180f; background: var(--accent); }
.button.secondary { background: rgba(167,226,121,.08); border-color: rgba(167,226,121,.16); color: #cef0bc; }
.button.ghost { background: rgba(255,255,255,.032); border-color: var(--line); }
.button.danger { background: rgba(240,128,121,.07); border-color: rgba(240,128,121,.16); color: #ffc2bd; }
.button.disabled { opacity: .35; pointer-events: none; }
.icon-button { width: 30px; height: 30px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--muted); cursor: pointer; }
.small-button { min-height: 34px; }
.muted { color: var(--muted); }
.small { font-size: 10px; line-height: 1.5; }
.status-badge { display: inline-flex; align-items: center; min-height: 21px; padding: 0 7px; border-radius: 999px; border: 1px solid rgba(167,226,121,.14); background: rgba(167,226,121,.07); color: #c6e9b5; font-size: 8px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.status-badge.custom { border-color: rgba(120,199,155,.18); background: rgba(120,199,155,.08); color: #a9dfc3; }
.sidebar-footer { color: #626f67; font-size: 9px; line-height: 1.5; padding: 12px 18px 15px; border-top: 1px solid var(--line); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 18px; border: 1px solid var(--line); border-radius: 20px;
  background: rgba(12,18,14,.78); backdrop-filter: blur(18px);
}
.topbar h2 { margin-top: 4px; font-size: 22px; }
.subline { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; margin-top: 4px; }
.topbar-actions { display: flex; gap: 8px; }

.map-card {
  min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden;
  border: 1px solid var(--line); border-radius: 22px; background: rgba(10,16,12,.82); box-shadow: var(--shadow);
}
.map-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border-radius: 12px; background: rgba(255,255,255,.028); border: 1px solid rgba(255,255,255,.05); }
.segment { border: 0; border-radius: 9px; background: transparent; color: #7e8c83; padding: 7px 9px; font-size: 10px; font-weight: 820; cursor: pointer; }
.segment.active { color: var(--text); background: #1b2920; box-shadow: inset 0 0 0 1px rgba(255,255,255,.045); }
.toolbar-hint { color: #65736a; font-size: 9px; margin-left: auto; }

.map-viewport {
  position: relative; overflow: hidden; min-height: 0; cursor: crosshair;
  background: radial-gradient(circle at 50% 35%, #121a14, #060a07 82%);
}
.map-viewport.dragging { cursor: grabbing; }
.map-transform { position: absolute; inset: 0; display: grid; place-items: center; transform-origin: center center; }
.map-surface {
  position: relative; width: min(91%, 1120px); height: auto; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: 16px; background: #111711; box-shadow: 0 28px 90px rgba(0,0,0,.38), inset 0 0 0 1px rgba(255,255,255,.07);
}
.map-placeholder, .map-image, .marker-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-placeholder {
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    radial-gradient(circle at 40% 35%, rgba(167,226,121,.08), transparent 36%),
    #111811;
  background-size: 42px 42px, 42px 42px, auto, auto;
}
.map-placeholder-copy { position: absolute; left: 50%; top: 50%; width: min(430px, 74%); transform: translate(-50%,-50%); text-align: center; }
.map-placeholder-copy h3 { font-size: clamp(19px, 3vw, 32px); letter-spacing: -.04em; }
.map-placeholder-copy p { margin-top: 8px; color: #8d9b91; font-size: 11px; line-height: 1.6; }
.map-badge-label { display: inline-grid; place-items: center; min-width: 48px; height: 23px; padding: 0 9px; border-radius: 999px; background: rgba(167,226,121,.09); color: #c6eab4; border: 1px solid rgba(167,226,121,.14); font-size: 8px; font-weight: 900; letter-spacing: .16em; margin-bottom: 11px; }
.map-image { object-fit: contain; display: none; user-select: none; pointer-events: none; }
.map-image.visible { display: block; }
.marker-layer { z-index: 5; }
.zone-marker {
  --marker: var(--exterior); position: absolute; transform: translate(-50%,-50%); width: 22px; height: 22px;
  border-radius: 50%; border: 3px solid rgba(8,12,9,.92); background: var(--marker); cursor: pointer;
  box-shadow: 0 5px 18px rgba(0,0,0,.4), 0 0 0 3px color-mix(in srgb, var(--marker) 25%, transparent);
}
.zone-marker.interior { --marker: var(--interior); }
.zone-marker.active { width: 28px; height: 28px; box-shadow: 0 5px 18px rgba(0,0,0,.45), 0 0 0 5px color-mix(in srgb, var(--marker) 24%, transparent); }
.zone-marker::after { content: attr(data-type); position: absolute; left: 50%; top: 27px; transform: translateX(-50%); text-transform: uppercase; letter-spacing: .09em; font-size: 7px; font-weight: 900; color: #fff; background: rgba(5,8,6,.8); padding: 3px 5px; border-radius: 5px; opacity: 0; pointer-events: none; transition: .14s ease; white-space: nowrap; }
.zone-marker:hover::after, .zone-marker.active::after { opacity: 1; }
.zoom-readout { position: absolute; right: 12px; bottom: 12px; z-index: 10; padding: 6px 9px; border-radius: 10px; font-size: 9px; color: #b7c1ba; background: rgba(5,8,6,.8); border: 1px solid var(--line); }

.details-panel { padding: 16px; overflow: auto; }
.details-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.details-header h2 { margin-top: 4px; }
.empty-state { min-height: 68vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; color: var(--muted); }
.empty-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: rgba(167,226,121,.07); color: var(--accent); border: 1px solid rgba(167,226,121,.12); font-size: 22px; margin-bottom: 14px; }
.empty-state h3 { color: #d8e0da; font-size: 14px; }
.empty-state p { font-size: 10px; line-height: 1.6; margin-top: 7px; max-width: 220px; }
.zone-form { margin-top: 20px; }
.hidden { display: none !important; }
.textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.pill { border: 1px solid var(--line); background: rgba(255,255,255,.03); color: #cad2cc; padding: 9px 10px; border-radius: 10px; text-transform: capitalize; font-size: 10px; }
.form-actions { margin-top: 20px; }
.form-actions .button { width: 100%; }

.dialog { width: min(500px, calc(100% - 28px)); border: 0; padding: 0; color: var(--text); background: transparent; }
.dialog::backdrop { background: rgba(0,0,0,.62); backdrop-filter: blur(7px); }
.dialog-card { padding: 18px; border-radius: 20px; background: #101711; border: 1px solid var(--line); box-shadow: var(--shadow); }
.dialog-card p { margin: 14px 0; font-size: 10px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 270px minmax(0,1fr); }
  .details-panel { display: none; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; grid-template-columns: 1fr; }
  .workspace { min-height: 760px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-direction: column; }
  .toolbar-hint { width: 100%; margin-left: 0; }
}
