:root {
  --bg: #f6f5f2; --panel: #ffffff; --ink: #1c1c1c; --muted: #6b6b6b; --line: #e3e1dc;
  --accent: #a626ff; --accent-ink: #ffffff; --green: #2f7d32; --warn: #9a5b00; --warn-bg: #fff4e0;
  --ring-inner: #7cc47f; --ring-middle: #f0b400; --ring-outer: #e2572b;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: flex; font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
#panel { width: 400px; flex: none; height: 100%; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 16px 30px; }
#map { flex: 1; height: 100%; }
header h1 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
section { border-top: 1px solid var(--line); padding: 12px 0 8px; }
h2 { font-size: 15px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 13px; margin: 14px 0 6px; }
.step { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0; }
label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
label.check { flex-direction: row; align-items: center; gap: 5px; color: var(--ink); }
input, select { font: inherit; color: var(--ink); padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; align-items: center; }
button { font: inherit; border-radius: 6px; padding: 7px 12px; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.active { background: var(--accent); color: #fff; }
.areas { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.area { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.area:hover { border-color: var(--accent); }
.area.sel { border-color: var(--accent); background: #f7efff; }
.area b { font-size: 13px; } .area .meta { font-size: 11px; color: var(--muted); }
.area .score { float: right; font-weight: 600; color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat { background: var(--bg); border-radius: 8px; padding: 6px 8px; }
.stat span { display: block; font-size: 11px; color: var(--muted); } .stat b { font-size: 16px; }
.stat.wide { grid-column: span 3; font-size: 12px; }
.warnings { margin: 8px 0; padding: 0; list-style: none; }
.warnings li { background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 4px 8px; font-size: 12px; margin-bottom: 4px; }
.title-input { flex: 1; font-weight: 600; font-size: 14px; }
table.controls { width: 100%; border-collapse: collapse; font-size: 12px; }
.controls th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: 3px 4px; }
.controls td { border-bottom: 1px solid var(--line); padding: 4px; vertical-align: top; }
.controls tr { cursor: pointer; } .controls tr:hover td { background: #faf6ff; }
.controls .code { font-weight: 700; color: var(--accent); }
.controls .ring-inner { border-left: 3px solid var(--ring-inner); }
.controls .ring-middle { border-left: 3px solid var(--ring-middle); }
.controls .ring-outer { border-left: 3px solid var(--ring-outer); }
.controls .name { color: var(--muted); display: block; font-size: 11px; }
.controls .del { border: 0; padding: 0 4px; color: var(--muted); background: none; }
.tag { font-size: 9px; border: 1px solid currentColor; border-radius: 3px; padding: 0 3px; margin-left: 4px; color: var(--warn); }
.exports { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.exports button { text-align: left; font-size: 12px; }
.saved div, .history div { font-size: 12px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.saved a { color: var(--accent); cursor: pointer; }
footer { margin-top: 14px; }
#busy { position: fixed; inset: 0; background: #0005; display: flex; align-items: center; justify-content: center; gap: 12px; color: #fff; font-size: 15px; z-index: 2000; }
#busy[hidden], #toast[hidden] { display: none; }
.spinner { width: 26px; height: 26px; border: 3px solid #fff5; border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 9px 14px; border-radius: 8px; z-index: 2100; max-width: 80vw; }
/* map markers */
.ctl { background: none; border: 0; }
.ctl svg { overflow: visible; }
.ctl .lbl { position: absolute; font: 700 15px/1 Arial, sans-serif; color: var(--accent); text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; white-space: nowrap; transform: translate(-50%, -50%); }
.cand { cursor: pointer; }
.leaflet-popup-content { font-size: 13px; }
.leaflet-popup-content .pop-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.leaflet-popup-content .pop-actions button { padding: 3px 8px; font-size: 12px; }
.leaflet-popup-content a { color: var(--accent); }
@media (max-width: 760px) {
  body { flex-direction: column-reverse; }
  #panel { width: 100%; height: 55%; border-right: 0; border-top: 1px solid var(--line); }
  #map { height: 45%; flex: none; }
}
/* interface language switch */
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.lang-switch button { border: 0; border-radius: 0; padding: 4px 9px; font-size: 12px; font-weight: 600; color: var(--muted); }
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button.active { background: var(--accent); color: var(--accent-ink); }
