:root {
  --bg: #0d1117;
  --panel: rgba(18, 24, 34, 0.94);
  --panel2: #161b22;
  --text: #e6edf3;
  --muted: #9da7b3;
  --line: #30363d;
  --accent: #58a6ff;
  --danger: #ff6b6b;
  --ok: #49d17d;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: system-ui, -apple-system, Segoe UI, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
.topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; background: rgba(13,17,23,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1000; backdrop-filter: blur(10px); }
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.1; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.header-logo-link { display: inline-flex; align-items: center; min-width: 0; }
.header-logo { display: block; max-width: min(420px, 55vw); max-height: 48px; width: auto; height: auto; object-fit: contain; }
.admin-link, .btn, button, input[type="submit"] { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); color: var(--text); text-decoration: none; cursor: pointer; font-weight: 650; }
.admin-link:hover, .btn:hover, button:hover, input[type="submit"]:hover { border-color: var(--accent); }
.btn.primary, button.primary, input.primary { background: #1f6feb; border-color: #388bfd; }
.btn.danger, button.danger { background: #4b1113; border-color: #8d2429; color: #ffd6d6; }
.btn.ghost, button.ghost { background: transparent; }
.map-shell { height: calc(100vh - 74px); display: grid; grid-template-columns: 310px 1fr; min-height: 520px; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; overflow: auto; z-index: 500; }
.public-sidebar { display: flex; flex-direction: column; }
.sidebar-footer { margin-top: auto; padding-top: 24px; }
.sidebar-footer a { display: inline-flex; align-items: center; opacity: .88; transition: opacity .15s ease, transform .15s ease; }
.sidebar-footer a:hover { opacity: 1; transform: translateY(-1px); }
.sidebar-footer img { display: block; max-width: 190px; max-height: 70px; width: auto; height: auto; object-fit: contain; }
.sidebar h2 { margin: 0 0 12px; font-size: 18px; }
.sidebar label { display: block; margin: 10px 0; color: var(--text); }
.sidebar input, .sidebar select, .sidebar textarea, .sidebar .field input, .sidebar .field select, .sidebar .field textarea { width: 100%; }
.sidebar input[type="checkbox"] { width: auto; margin-right: 7px; }
.map { min-height: 100%; width: 100%; }
.small-note { color: var(--muted); line-height: 1.45; font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.leaflet-container { background: #0b1220; color: #111; }
.leaflet-popup-content { min-width: 210px; }
.popup-title { font-weight: 800; margin-bottom: 4px; }
.popup-meta { color: #444; margin: 2px 0; }
.badge { display: inline-flex; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 800; background: #e9eef7; color: #111; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.card { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: 0 20px 70px rgba(0,0,0,.35); }
.card h1 { margin-top: 0; font-size: 24px; }
.field { margin: 12px 0; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 700; }
input, select, textarea { background: #0b1220; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; }
textarea { min-height: 80px; resize: vertical; }
.error { border: 1px solid #8d2429; background: rgba(141, 36, 41, .18); color: #ffd6d6; padding: 10px; border-radius: 10px; }
.success { border: 1px solid #238636; background: rgba(35, 134, 54, .18); color: #d1ffd9; padding: 10px; border-radius: 10px; }
.admin-shell { height: calc(100vh - 74px); display: grid; grid-template-columns: 360px 1fr; min-height: 620px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.line-list { display: grid; gap: 8px; margin-top: 12px; }
.line-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: rgba(255,255,255,.035); cursor: pointer; }
.line-item.active { border-color: var(--accent); background: rgba(88,166,255,.12); }
.line-item strong { display:block; }
.line-item span { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; gap: 10px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.notice { padding: 10px; border-radius: 10px; background: rgba(88,166,255,.12); border: 1px solid rgba(88,166,255,.35); color: #d6eaff; font-size: 13px; }
.kv-dot { display:inline-block; width: 10px; height: 10px; border-radius: 99px; margin-right: 6px; }
.kv-400 { background: #ff3333; }
.kv-220 { background: #2fbf5b; }
.kv-132 { background: #2f64ff; }
.kv-110 { background: #ff9f1c; }
@media (max-width: 900px) {
  .map-shell, .admin-shell { grid-template-columns: 1fr; height: auto; }
  .sidebar { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .map { height: 72vh; }
  .topbar { position: relative; }
}
