:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #d9dce1;
  --hover: #eef1f5;
  --accent: #2563eb;
  --accent-soft: #dbe6fd;
  --danger: #c62828;
  --grid: #e5e7eb;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --panel: #1d2024;
    --text: #e6e8eb;
    --muted: #9aa1ab;
    --border: #33383f;
    --hover: #272b31;
    --accent: #5b8def;
    --accent-soft: #24345a;
    --danger: #ef6b6b;
    --grid: #2c3137;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button, select, input { font: inherit; font-size: 0.9rem; color: inherit; }
button, select {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover:not(:disabled) { background: var(--hover); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; color: var(--accent); padding: 0 4px; font-size: 0.8rem; }
input[type=text], input[type=search], input[type=number] {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  min-width: 0;
}
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

/* toolbar */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 6px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 2000;
}
.toolbar .group { display: flex; align-items: center; gap: 4px; }
.toolbar button, .toolbar select, .toolbar .menu summary { padding: 4px 8px; }
.toolbar .spacer { flex: 1; }
.seg { gap: 0 !important; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; position: relative; }
.toggle { display: flex; align-items: center; gap: 4px; font-size: 0.9rem; cursor: pointer; user-select: none; }
.seg.mini button { font-size: 0.75rem; padding: 1px 8px; }
.save-state { font-size: 0.75rem; color: #16a34a; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.save-state.unsaved { color: #d97706; }
.save-state[hidden] { display: none; }
.icon-only { display: none; }

.menu { position: relative; }
.menu summary {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.9rem;
  background: var(--panel);
}
.menu summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
  z-index: 2000;
  min-width: 150px;
}
.menu-list button { border: 0; text-align: left; }
.menu-list hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; width: auto; }

/* layout */
.main { display: grid; grid-template-columns: 300px 1fr; min-height: 0; }
.work { display: grid; grid-template-rows: 1fr auto; min-width: 0; min-height: 0; }
.sidebar {
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 4px 12px 16px;
}
.sidebar section { padding: 10px 0; border-bottom: 1px solid var(--border); }
.sidebar section:last-child { border-bottom: 0; }
.sidebar h3 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.row { display: flex; gap: 6px; }
.row input { flex: 1; }
.row.small button { font-size: 0.8rem; padding: 2px 8px; }

.results, .list { list-style: none; margin: 6px 0 0; padding: 0; }
.results li {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.35;
}
.results li:hover { background: var(--hover); }
.results .r-top { display: flex; justify-content: space-between; gap: 6px; }
.results .r-src { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.results .r-addr { font-size: 0.76rem; }
.results .r-wp { font-size: 0.72rem; padding: 0; margin-top: 2px; }
.results li.note { cursor: default; }
.results li.rename { border-left: 3px solid var(--accent, #3b82f6); }
.results .r-acts { display: flex; gap: 10px; margin-top: 2px; }
.results .r-acts .link { font-size: 0.72rem; padding: 0; }

/* route planner */
.plan-row { display: flex; align-items: flex-start; gap: 6px; position: relative; }
.plan-row .plan-dot { cursor: grab; user-select: none; touch-action: none; }
.plan-row.dragging { opacity: 0.4; }
.plan-row.drop-before::before, .plan-row.drop-after::after {
  content: ""; position: absolute; left: 0; right: 0; height: 3px; border-radius: 2px; background: var(--accent);
}
.plan-row.drop-before::before { top: -4px; }
.plan-row.drop-after::after { bottom: -4px; }
.plan-gap { height: 8px; display: flex; align-items: center; justify-content: center; position: relative; }
.plan-gap button {
  opacity: 0; font-size: 0.72rem; padding: 0 8px; line-height: 14px;
  background: var(--panel); border: 1px dashed var(--accent); border-radius: 8px; position: relative; z-index: 2;
}
.plan-gap:hover button, .plan-gap button:focus-visible { opacity: 1; }
.plan-gap:hover::before {
  content: ""; position: absolute; left: 28px; right: 70px; top: 50%; border-top: 1px dashed var(--accent);
}
#planList { margin-bottom: 6px; }
.plan-dot {
  flex: none; width: 22px; height: 22px; margin-top: 3px; border-radius: 50%;
  color: #fff; font: 700 11px/22px sans-serif; text-align: center;
}
.plan-dot.k-start, .plan-pin .k-start { background: #16a34a; }
.plan-dot.k-via, .plan-pin .k-via { background: #2563eb; }
.plan-dot.k-end, .plan-pin .k-end { background: #dc2626; }
.plan-field { flex: 1; min-width: 0; position: relative; }
.plan-field input { width: 100%; }
.plan-row.picking input { outline: 2px solid var(--accent); }
.plan-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 50; margin: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); max-height: 260px; overflow-y: auto; padding: 4px;
}
.plan-results[hidden] { display: none; }
.icon-btn { padding: 3px 7px; font-size: 0.8rem; flex: none; }
.plan-actions { display: flex; gap: 6px; margin: 2px 0 6px; }
.plan-actions button { font-size: 0.8rem; padding: 3px 8px; }
.plan-opt { margin-bottom: 6px; }
.plan-build { width: 100%; }
.plan-new { display: block; margin: 6px auto 0; font-size: 0.8rem; }
.plan-new[hidden] { display: none; }
#planLinked { margin: 0 0 6px; }
#planLinked:empty { display: none; }
.plan-pin div {
  width: 24px; height: 24px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
.plan-pin span { transform: rotate(45deg); color: #fff; font: 700 11px sans-serif; }
.results li.err-note { color: #b45309; font-size: 0.76rem; line-height: 1.45; }
.results li.note:hover { background: none; }

.list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.list li:hover { background: var(--hover); }
.list li.active { background: var(--accent-soft); }
.list .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.list .eye { border: 0; background: none; padding: 0 2px; font-size: 0.8rem; }
.list li.hidden-wp .name { color: var(--muted); text-decoration: line-through; }
.list .empty { color: var(--muted); cursor: default; }
.list .empty:hover { background: none; }

.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 8px; }
.btn-grid button { font-size: 0.8rem; padding: 4px 6px; }

.stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 0.85rem; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

#selInfo .stats { margin-bottom: 8px; }
#selInfo input[type=number] { width: 90px; text-align: right; padding: 1px 6px; }

/* map */
.map-wrap { position: relative; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; background: #ddd; isolation: isolate; }   /* 지도 버튼이 툴바 메뉴 위로 올라오지 않게 */
.map-wrap.mode-draw #map, .map-wrap.mode-waypoint #map, .map-wrap.mode-box #map { cursor: crosshair; }
.map-wrap.mode-draw .leaflet-grab, .map-wrap.mode-waypoint .leaflet-grab, .map-wrap.mode-box .leaflet-grab { cursor: crosshair; }
.map-wrap.mode-box.space-pan #map, .map-wrap.mode-box.space-pan .leaflet-grab { cursor: grab; }
.sel-box {
  position: absolute; z-index: 700; pointer-events: none;
  border: 2px dashed #2563eb; background: rgba(37, 99, 235, .12); border-radius: 2px;
}
.locate-btn { display: flex !important; align-items: center; justify-content: center; color: #333; }

/* route color legend */
.legend {
  background: rgba(255, 255, 255, .94); color: #222;
  padding: 6px 10px 5px; border-radius: 8px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .3);
  font-size: 11px; min-width: 150px;
}
.legend[hidden] { display: none; }
.lg-title { font-weight: 600; margin-bottom: 4px; }
.lg-bar { height: 8px; border-radius: 4px; }
.lg-labels { display: flex; justify-content: space-between; margin-top: 2px; color: #555; }
.lg-err { color: #b45309; }
.drop-hint {
  position: absolute; inset: 12px;
  display: none; align-items: center; justify-content: center;
  border: 3px dashed var(--accent);
  border-radius: 12px;
  background: rgba(37, 99, 235, .12);
  font-size: 1.2rem; font-weight: 600;
  z-index: 900; pointer-events: none;
}
.map-wrap.dragover .drop-hint { display: flex; }
.mode-hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(20, 20, 20, .78); color: #fff;
  padding: 5px 12px; border-radius: 16px; font-size: 0.8rem;
  z-index: 800; pointer-events: none; white-space: nowrap;
}
.mode-hint:empty { display: none; }

/* map icons */
.wp-icon { pointer-events: auto; }
.wp-pin {
  width: 16px; height: 16px;
  border-radius: 50% 50% 50% 0;
  background: #f59e0b;
  border: 2px solid #fff;
  transform: rotate(-45deg);
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.wp-label {
  position: absolute; left: 18px; top: -4px;
  background: rgba(255,255,255,.92); color: #222;
  font-size: 11px; padding: 1px 5px; border-radius: 4px;
  white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.3);
  pointer-events: none;
}
.arrow-icon, .end-icon:not(.drag) { pointer-events: none !important; }
.end-icon.drag div { pointer-events: auto; cursor: grab; }
.via-icon div {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; color: #111; border: 3px solid #111;
  font: 700 10px/12px sans-serif; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.45); box-sizing: border-box;
  cursor: grab;
}
.via-icon.ghost div { background: #ffd600; }
.join-end div {
  width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-sizing: border-box;
  cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 1px 4px rgba(0,0,0,.45);
}
.join-end .s { background: #16a34a; }
.join-end .e { background: #dc2626; }
.join-end div:hover { transform: scale(1.25); }
.join-end .chosen { background: #facc15; box-shadow: 0 0 0 4px rgba(250,204,21,.5), 0 1px 4px rgba(0,0,0,.45); transform: scale(1.2); }
.map-wrap.joining .leaflet-container, .map-wrap.joining .leaflet-interactive { cursor: crosshair; }
[data-act="join"].on { background: #2563eb; color: #fff; }
.arrow-icon div {
  width: 0; height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 9px solid #fff;
  filter: drop-shadow(0 0 1px rgba(0,0,0,.9));
}
.end-icon div {
  width: 20px; height: 20px; border-radius: 50%;
  color: #fff; font: 700 11px/16px sans-serif; text-align: center;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5);
  transform: translate(8px, -22px);
}
.end-icon .s { background: #16a34a; }
.end-icon .e { background: #111827; }

.wp-popup label { display: block; font-size: 12px; margin-top: 6px; color: #555; }
.wp-popup input { width: 200px; font-size: 13px; padding: 3px 6px; border: 1px solid #ccc; border-radius: 4px; }
.wp-popup .acts { display: flex; justify-content: space-between; margin-top: 8px; gap: 6px; }
.wp-popup .acts button { font-size: 12px; background: #fff; color: #222; border-color: #ccc; }

/* chart */
.chart-panel { background: var(--panel); border-top: 1px solid var(--border); }
.chart-head { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; padding: 4px 12px 0; font-size: 0.8rem; }
.chart-head .spacer { flex: 1; }
.chart-box { height: 150px; padding: 0 4px 2px; }
#chart { width: 100%; height: 100%; display: block; cursor: crosshair; }

.statusbar {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 3px 12px;
  font-size: 0.78rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
#status.err { color: var(--danger); }

/* context menu */
.ctx {
  position: fixed;
  z-index: 3000;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  min-width: 190px;
  display: flex; flex-direction: column;
}
.ctx[hidden] { display: none; }
.ctx button { border: 0; text-align: left; padding: 5px 10px; font-size: 0.85rem; border-radius: 5px; }
.ctx hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }
.ctx .title { font-size: 0.75rem; color: var(--muted); padding: 2px 10px 4px; }

/* dialogs */
dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 18px 20px;
  max-width: min(520px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { margin: 0 0 14px; font-size: 1.1rem; }
.form-grid { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; font-size: 0.9rem; }
.form-grid input[type=number] { width: 80px; }
.form-grid input[type=text] { width: 200px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.help { font-size: 0.88rem; line-height: 1.5; max-height: 60vh; overflow: auto; }
.dlg-msg { margin: 0 0 4px; font-size: 0.9rem; line-height: 1.5; color: var(--muted); max-width: 440px; }
.name-input { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.name-input[hidden], .dlg-msg[hidden] { display: none; }
.name-input input { flex: 1; min-width: 240px; }

/* course library */
dialog.dlg-lib { width: min(720px, calc(100vw - 32px)); max-width: none; }
dialog.dlg-lib[open] { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 48px); }
.lib-head { display: flex; align-items: center; justify-content: space-between; }
.lib-head h2 { margin: 0; }
.lib-tabs { flex-wrap: wrap; }
.lib-tabs button { font-size: 0.8rem; }
#libSearch { width: 100%; }
.lib-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 200px; }
.lib-list li { display: flex; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.lib-list li:hover { background: var(--hover); }
.lib-main { flex: 1; min-width: 0; }
.lib-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.lib-cat { font-size: 0.7rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; }
.lib-main { cursor: pointer; }
.lib-main:hover b { text-decoration: underline; }
.lib-extras { display: contents; }
.lib-meta { font-size: 0.8rem; margin-top: 2px; }
.lib-desc { font-size: 0.78rem; margin-top: 2px; line-height: 1.4; }
.lib-load { flex: none; }
.lib-acts { display: flex; flex-direction: column; gap: 4px; flex: none; }
.lib-del, .lib-extra { font-size: 0.75rem; padding: 2px 8px; }
.my-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.my-tools[hidden], .my-linkbox[hidden] { display: none; }
.my-linkbox { display: flex; flex-direction: column; gap: 6px; }
.my-linkbox textarea {
  width: 100%; font: inherit; font-size: 0.85rem; padding: 6px 8px; resize: vertical;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
}
#myMsg:empty { display: none; }
#myMsg.err { color: var(--danger); }
.amenity-icon { display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1;
  background: rgba(255,255,255,.92); border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.4); }

/* 3D flythrough */
dialog.dlg3d {
  width: min(1200px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  max-width: none;
  padding: 0;
  overflow: hidden;
}
dialog.dlg3d[open] { display: flex; flex-direction: column; }
.f3d-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; background: var(--panel); }
.f3d-wrap:fullscreen { width: 100vw; height: 100vh; }
dialog.dlg3d.full { width: 100vw; height: 100vh; max-height: none; margin: 0; border-radius: 0; border: 0; }
.f3d-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.f3d-head .spacer { flex: 1; }
.f3d-body { position: relative; flex: 1; min-height: 0; background: #0b1220; }
#map3d { position: absolute; inset: 0; }
.f3d-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(11, 18, 32, .75); font-size: 0.95rem; z-index: 5;
}
.f3d-loading[hidden] { display: none; }
.f3d-info {
  position: absolute; left: 12px; top: 12px; z-index: 4;
  background: rgba(0, 0, 0, .6); color: #fff; padding: 5px 10px; border-radius: 6px;
  font-size: 0.85rem; font-variant-numeric: tabular-nums; pointer-events: none;
}
.f3d-info:empty { display: none; }
.f3d-wp {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%); z-index: 4;
  background: rgba(245, 158, 11, .95); color: #1a1a1a; padding: 8px 18px; border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.35); text-align: center; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; max-width: 80%;
}
.f3d-wp[hidden] { display: none; }
.f3d-wp b { font-size: 1.05rem; }
.f3d-wp span { font-size: 0.78rem; }
.f3d-wp span:empty { display: none; }
.wp3d { display: flex; flex-direction: column; align-items: center; cursor: default; }
.wp3d-label {
  background: rgba(255,255,255,.95); color: #222; font: 600 12px sans-serif;
  padding: 2px 7px; border-radius: 5px; margin-bottom: 3px; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.wp3d-pin {
  width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: #f59e0b; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); margin-bottom: 4px;
}
.wp3d.active .wp3d-label { background: #f59e0b; color: #111; font-size: 14px; }
.wp3d.active .wp3d-pin { transform: rotate(-45deg) scale(1.4); }
#f3dWpSec, #f3dRes { padding: 1px 4px; font-size: 0.8rem; }
.rec-btn { color: #dc2626; font-weight: 600; }
.rec-btn.recording { background: #dc2626; border-color: #dc2626; color: #fff; }
.f3d-rec {
  position: absolute; right: 60px; top: 12px; z-index: 4; pointer-events: none;
  background: #dc2626; color: #fff; font: 700 13px sans-serif; padding: 4px 10px; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.f3d-rec[hidden] { display: none; }
.f3d-done {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 22px; display: flex; flex-direction: column; gap: 8px; align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); max-width: 90%; text-align: center;
}
.f3d-done[hidden] { display: none; }
.f3d-done .row { gap: 8px; margin-top: 4px; }
a.btn {
  display: inline-block; text-decoration: none; padding: 5px 14px; border-radius: 6px;
  border: 1px solid var(--border); font-size: 0.9rem;
}
a.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.f3d-ctrl { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; border-top: 1px solid var(--border); }
#f3dSeek { flex: 1; min-width: 160px; }
.f3d-cam { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.f3d-cam input { width: 90px; }
.help h4 { margin: 10px 0 4px; }
.help ul { margin: 0; padding-left: 20px; }

@media (max-width: 760px) {
  .icon-only { display: inline-block; }
  .main { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 88vw);
    z-index: 1500; transform: translateX(-100%); transition: transform .2s;
    box-shadow: 0 0 24px rgba(0,0,0,.25);
  }
  body.sidebar-open .sidebar { transform: none; }
  .chart-box { height: 110px; }
  .toolbar { gap: 4px 6px; }
}

/* admin */
#btnAdmin.on { background: #16a34a; color: #fff; border-color: #16a34a; }
.key-box { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 10px 0 0; }
.key-box[hidden] { display: none; }
.key-box legend { font-size: 0.8rem; color: var(--muted); padding: 0 4px; }
.lang-sel { max-width: 110px; }
