:root {
  --bg: #f6f4ef; --panel: #fffdf9; --ink: #23272e; --muted: #6d7078; --line: #e3ded3;
  --accent: #c2553d; --accent-ink: #fff; --dark: #20242b;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: grid; grid-template-columns: 360px 1fr;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
button, input, select { font: inherit; color: inherit; }

/* ---- Seitenleiste ---- */
#side { overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); }
#side header { padding: 18px 20px 14px; background: var(--dark); color: #fff; }
#side h1 { margin: 0; font-size: 22px; letter-spacing: .02em; }
#side h1 span { color: #f0a48f; }
#side header p { margin: 2px 0 0; color: #aab0bb; font-size: 13px; }
section { padding: 16px 20px; border-bottom: 1px solid var(--line); }
h2 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
h2 b {
  display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px;
  border-radius: 50%; background: var(--ink); color: #fff; font-size: 11px;
}
.hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; min-height: 1em; }
.hint.error { color: #b3261e; }
footer { padding: 14px 20px 24px; color: var(--muted); font-size: 12px; }
footer a { color: inherit; }

button {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; cursor: pointer;
}
button:hover:not(:disabled) { border-color: #b9b3a6; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.07); border-color: var(--accent); }
button.primary.active { background: var(--ink); border-color: var(--ink); }
button.wide { width: 100%; padding: 10px; }
button.link { margin-top: 10px; padding: 0; border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: 13px; }
:focus-visible { outline: 2px solid #2f6fd0; outline-offset: 2px; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.row > * { flex: 1; }
.col { display: grid; gap: 8px; }
.dl { text-align: left; font-weight: 700; }
.dl small { margin-left: 8px; font-weight: 400; color: var(--muted); }

#search { display: flex; gap: 8px; }
#q, input[type=number], select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
#q { flex: 1; min-width: 0; }
#results { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
#results li { padding: 7px 10px; cursor: pointer; font-size: 13px; border-top: 1px solid var(--line); }
#results li:first-child { border-top: 0; }
#results li:hover { background: var(--bg); }

.field { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.field input { width: 76px; text-align: right; }
.field select { max-width: 190px; }
.slider { display: block; margin-bottom: 10px; }
.slider output { float: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.slider input { display: block; width: 100%; margin: 4px 0 0; accent-color: var(--accent); }

#classes { width: 100%; margin-top: 16px; border-collapse: collapse; }
#classes th { padding: 0 0 6px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#classes td { padding: 3px 0; vertical-align: middle; }
#classes td:first-child { width: 26px; }
#classes td:nth-child(2) { width: 44px; }
#classes td:last-child, #classes th:last-child { width: 64px; text-align: right; }
#classes input[type=color] { width: 34px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; cursor: pointer; }
#classes input[type=number] { width: 60px; padding: 4px 6px; text-align: right; }
#classes tr.off td:nth-child(n+2) { opacity: .45; }
#classes small { color: var(--muted); }

/* ---- Hauptbereich ---- */
main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#tabs { display: flex; gap: 4px; padding: 8px 12px 0; background: var(--dark); }
#tabs button { border: 0; border-radius: 6px 6px 0 0; background: transparent; color: #aab0bb; padding: 8px 16px; }
#tabs button.active { background: var(--bg); color: var(--ink); font-weight: 600; }
.pane { flex: 1; min-height: 0; }
#map.drawing, #map.drawing .leaflet-interactive { cursor: crosshair !important; }
#view { position: relative; background: var(--dark); }
#view canvas { display: block; width: 100%; height: 100%; }
#viewEmpty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #8c93a0; }
[hidden] { display: none !important; }

@media (max-width: 800px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 80vh; height: auto; }
  #side { border-right: 0; }
}
