:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1f2420;
  --muted: #6b716c;
  --line: #e1e0da;
  --accent: #2f6b3f;
  --accent-ink: #ffffff;
  --warn: #a4431c;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { display: flex; }

#map { flex: 1; height: 100%; }
#panel {
  width: 360px; height: 100%; overflow-y: auto; background: var(--panel);
  border-left: 1px solid var(--line); padding: 18px 18px 12px; display: flex; flex-direction: column; gap: 18px;
}
@media (max-width: 760px) {
  body { flex-direction: column; }
  #map { height: 50vh; flex: none; }
  #panel { width: 100%; height: auto; border-left: none; border-top: 1px solid var(--line); }
}

h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0; }
.muted { color: var(--muted); }
p { margin: 6px 0 0; }
section { display: flex; flex-direction: column; gap: 8px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
fieldset { border: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
fieldset label { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 13px; }

input, select {
  font: inherit; color: var(--ink); padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; width: 100%;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }

button {
  font: inherit; border-radius: 6px; padding: 8px 12px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:disabled { opacity: 0.45; cursor: default; }
button.ghost { background: transparent; }
button.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.wide { width: 100%; }

.row { display: flex; gap: 8px; align-items: flex-end; }
.grow { flex: 1; }
.narrow { width: 110px; }
.grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.estimate { padding: 10px; border-radius: var(--radius); background: var(--bg); line-height: 1.45; }
.estimate.bad { color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, #fff); }
.estimate b { color: var(--ink); }

.large {
  flex-direction: row; align-items: flex-start; gap: 8px; padding: 10px; border-radius: var(--radius);
  background: color-mix(in srgb, #c98a1c 12%, #fff); color: var(--ink); font-size: 12px; line-height: 1.45;
}
.large[hidden] { display: none; }
.large input { margin-top: 2px; }
.estimate.warn { background: color-mix(in srgb, #c98a1c 12%, #fff); }

.progress { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
#bar { height: 100%; width: 0; background: var(--accent); transition: width 0.4s; }

.models { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.models li { padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.models li:hover { border-color: var(--accent); }
.models .title { font-weight: 600; }
.models .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.models .del {
  float: right; padding: 0 6px; border: none; background: transparent; font-size: 15px; line-height: 1.3;
  opacity: 0.55; cursor: pointer;
}
.models .del:hover { opacity: 1; }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--bg); color: var(--muted); margin-left: 6px; }
.badge.done { background: color-mix(in srgb, var(--accent) 14%, #fff); color: var(--accent); }
.badge.failed { background: color-mix(in srgb, var(--warn) 12%, #fff); color: var(--warn); }

a { color: var(--accent); }
footer { margin-top: auto; font-size: 11px; line-height: 1.5; }

.corner { width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.leaflet-container.drawing { cursor: crosshair; }
