:root {
  color-scheme: light;
  --ink: #11231d;
  --muted: #66756f;
  --line: #dfe7e3;
  --paper: #ffffff;
  --canvas: #edf3f0;
  --green: #0d684e;
  --green-dark: #084b39;
  --lime: #c9f257;
  --shadow: 0 18px 50px rgba(19, 48, 38, .10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100%; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 24px;
  background: #10271f;
  color: white;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.topbar h1 { margin: 0; font-size: 1.15rem; line-height: 1.3; letter-spacing: -.01em; }
.topbar p { margin: 2px 0 0; color: #aebdb7; font-size: .88rem; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--lime); }
.brand-mark svg { width: 29px; fill: none; stroke: #10271f; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark circle { fill: #10271f; stroke: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.privacy-badge { padding: 8px 12px; border: 1px solid #355148; border-radius: 999px; color: #c9d5d0; font-size: .82rem; }
.language-picker select { width: 110px; padding: 6px 25px 6px 9px; border: 1px solid #355148; border-radius: 8px; background: #17342a; color: #dce6e2; font-size: .74rem; cursor: pointer; }
.language-picker select:hover, .language-picker select:focus-visible { border-color: #718b81; outline: none; }
.version-button { padding: 6px 9px; border: 1px solid #355148; border-radius: 8px; background: transparent; color: #aebdb7; font-size: .74rem; font-weight: 700; letter-spacing: .02em; }
.version-button:hover, .version-button:focus-visible { border-color: #718b81; color: white; }

.changelog-dialog { width: min(560px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 32px)); padding: 0; overflow: hidden; border: 0; border-radius: 18px; background: var(--paper); color: var(--ink); box-shadow: 0 28px 80px rgba(5, 25, 18, .32); }
.changelog-dialog::backdrop { background: rgba(7, 24, 18, .58); backdrop-filter: blur(3px); }
.changelog-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px 17px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.dialog-kicker { display: block; margin-bottom: 3px; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.changelog-header h2 { margin: 0; font-size: 1.35rem; }
.dialog-close { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: #eef3f1; color: #4f615a; font-size: 1.45rem; line-height: 1; }
.dialog-close:hover { background: #e2ebe7; color: var(--ink); }
.changelog-list { max-height: calc(100vh - 135px); padding: 4px 24px 22px; overflow-y: auto; }
.changelog-release { padding: 18px 0; border-bottom: 1px solid var(--line); }
.changelog-release:last-child { border-bottom: 0; }
.release-meta { display: flex; align-items: center; gap: 9px; }
.release-meta strong { font-size: .94rem; }
.release-meta time { color: var(--muted); font-size: .76rem; }
.release-meta span { padding: 3px 6px; border-radius: 6px; background: #e1f3eb; color: var(--green); font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.changelog-release ul { margin: 10px 0 0; padding-left: 19px; color: #44534d; font-size: .86rem; line-height: 1.55; }
.changelog-release li + li { margin-top: 4px; }

.workspace { min-height: 0; display: grid; grid-template-columns: minmax(320px, 390px) 1fr; }
.control-panel { overflow-y: auto; padding: 24px; background: var(--paper); border-right: 1px solid var(--line); }
.upload-card {
  position: relative;
  min-height: 184px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-align: center;
  border: 1.5px dashed #9fb8ad;
  border-radius: 18px;
  background: #f6faf8;
  transition: .2s ease;
}
.upload-card:hover, .upload-card.dragover { border-color: var(--green); background: #eff8f4; transform: translateY(-1px); }
.upload-card input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.upload-card strong { font-size: 1rem; }
.upload-card span { color: var(--muted); font-size: .9rem; }
.upload-card small { margin-top: 8px; color: #85938d; font-size: .76rem; }
.upload-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: #d9ece4; color: var(--green); font-size: 1.6rem; font-weight: 700; }
.demo-button { width: 100%; margin: 10px 0 4px; padding: 10px; border: 0; background: transparent; color: var(--green); font-weight: 700; }

.route-summary, .settings { padding-top: 20px; margin-top: 18px; border-top: 1px solid var(--line); }
.section-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-title-row h2, .category-heading { margin: 0; font-size: .95rem; }
.section-title-row output { padding: 5px 9px; border-radius: 8px; background: #eaf4ef; color: var(--green); font-size: .85rem; font-weight: 700; }
.text-button { border: 0; padding: 4px 0; background: transparent; color: #9a4949; font-size: .82rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 13px; }
.stats-grid div { padding: 11px 9px; background: #f4f7f5; border-radius: 11px; }
.stats-grid span { display: block; color: var(--muted); font-size: .72rem; }
.stats-grid strong { display: block; margin-top: 3px; font-size: .92rem; }
input[type="range"] { width: 100%; margin: 17px 0 3px; accent-color: var(--green); }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .74rem; }
.garmin-limit { margin-top: 20px; padding: 14px; border: 1px solid #d9e6e0; border-radius: 12px; background: #f7faf8; }
.garmin-limit p { margin: 7px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.category-heading { margin-top: 22px; }
.category-list { display: grid; gap: 4px; margin-top: 9px; }
.category-list label { display: grid; grid-template-columns: 20px 31px 1fr; align-items: center; min-height: 39px; cursor: pointer; font-size: .9rem; }
.category-list input { width: 16px; height: 16px; accent-color: var(--green); }
.category-dot { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; font-size: .8rem; background: #eef3f1; }
.category-dot.toilet { font-size: .58rem; font-weight: 800; }
.primary-button { width: 100%; min-height: 48px; margin-top: 20px; display: flex; align-items: center; justify-content: space-between; padding: 0 17px; border: 0; border-radius: 12px; background: var(--green); color: white; font-weight: 750; box-shadow: 0 8px 18px rgba(13,104,78,.2); }
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.status-message { min-height: 18px; margin: 9px 2px 0; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.status-message.error { color: #a13d3d; }
.poi-selection, .export-card { padding-top: 20px; margin-top: 18px; border-top: 1px solid var(--line); }
.selection-actions { display: flex; gap: 5px; }
.selection-actions button { border: 0; padding: 5px 7px; background: #eef4f1; color: var(--green); border-radius: 7px; font-size: .74rem; font-weight: 700; }
.poi-list { max-height: 330px; overflow-y: auto; display: grid; gap: 6px; margin-top: 11px; padding-right: 3px; }
.poi-item { display: grid; grid-template-columns: 20px 30px 1fr auto; align-items: center; gap: 7px; min-width: 0; padding: 8px; border: 1px solid #e4eae7; border-radius: 10px; background: #fbfcfb; cursor: pointer; }
.poi-item:hover { border-color: #acc4b9; }
.poi-item.ineligible { cursor: default; opacity: .6; background: #f5f6f5; }
.poi-item input { width: 16px; height: 16px; accent-color: var(--green); }
.poi-item .poi-symbol { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: #eaf2ee; font-size: .72rem; }
.poi-copy { min-width: 0; }
.poi-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.poi-copy span, .poi-km { color: var(--muted); font-size: .7rem; }
.poi-km { white-space: nowrap; }
.export-card h2 { margin: 0 0 8px; font-size: .95rem; }
.export-card > p { margin: 0 0 12px; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.export-button { width: 100%; display: flex; align-items: center; justify-content: space-between; margin-top: 7px; padding: 10px 12px; border: 1px solid #bed0c8; border-radius: 11px; background: white; color: var(--green-dark); text-align: left; font-size: .82rem; font-weight: 750; }
.export-button.recommended { background: #eaf6f0; border-color: #8eb6a5; }
.export-button small { display: block; margin-bottom: 2px; color: var(--muted); font-size: .65rem; font-weight: 550; }
.export-hint { display: block; margin-top: 9px; color: #7b8983; font-size: .68rem; line-height: 1.4; }

.map-panel { position: relative; min-width: 0; min-height: 520px; background: #dce7e2; }
#map { position: absolute; inset: 0; z-index: 1; }
.map-empty { position: absolute; inset: 0; z-index: 2; display: grid; align-content: center; justify-items: center; padding: 30px; text-align: center; pointer-events: none; background: radial-gradient(circle at center, rgba(255,255,255,.7), rgba(227,237,232,.92)); }
.map-empty h2 { margin: 12px 0 5px; font-size: 1.25rem; }
.map-empty p { margin: 0; color: var(--muted); }
.empty-route { width: 180px; color: var(--green); }
.empty-route svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 5 7; }
.empty-route circle { fill: var(--lime); stroke: var(--green); stroke-width: 3; }
.results-drawer { position: absolute; z-index: 500; left: 20px; right: 20px; bottom: 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.7); border-radius: 14px; background: rgba(16,39,31,.92); color: white; backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.results-drawer strong { display: block; }
.results-drawer span { color: #c2d0ca; font-size: .78rem; }
.results-drawer button { border: 1px solid #5f746c; border-radius: 9px; padding: 8px 11px; background: transparent; color: white; }
.poi-marker { width: 32px !important; height: 32px !important; display: grid !important; place-items: center; border-radius: 10px 10px 10px 2px; background: #10271f; color: white; font-size: 15px; box-shadow: 0 4px 12px rgba(16,39,31,.3); transform: rotate(-45deg); border: 2px solid white; }
.poi-marker span { transform: rotate(45deg); }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.popup-name { margin: 0 0 4px; font-size: .95rem; }
.popup-meta { color: #63716b; font-size: .78rem; }

@media (max-width: 780px) {
  .topbar { min-height: 68px; padding: 11px 14px; }
  .topbar p, .privacy-badge { display: none; }
  .workspace { display: flex; flex-direction: column; }
  .control-panel { overflow: visible; padding: 16px; border-right: 0; }
  .upload-card { min-height: 145px; }
  .map-panel { min-height: 58vh; border-top: 1px solid var(--line); }
  .results-drawer { left: 10px; right: 10px; bottom: 10px; }
  .changelog-header { padding: 18px; }
  .changelog-list { padding: 4px 18px 18px; }
}
@media (max-width: 420px) {
  .brand-mark { display: none; }
  .topbar { gap: 8px; }
  .topbar h1 { font-size: 1rem; }
  .language-picker select { width: 88px; }
}
