/* ===== Design-Tokens ===== */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-deep: #0f295e;
  --accent-ab: #ea6a1e;
  --accent-bs: #f0a91b;
  --bg: #f5f7fc;
  --card: #ffffff;
  --border: #e5e9f2;
  --border-strong: #d4dbea;
  --text: #182135;
  --muted: #6a7385;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 6px 20px rgba(16, 24, 40, .08);
  --shadow-lg: 0 18px 40px rgba(16, 24, 40, .14);
  --ring: 0 0 0 4px rgba(37, 99, 235, .18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
}

/* ===== HERO: Rechner + Karte ===== */
.hero {
  display: flex; height: calc(92vh - 68px); min-height: 540px;
  padding: 20px; gap: 18px;
  background: linear-gradient(160deg, #0f295e 0%, #1d4ed8 100%);
}

#panel {
  width: 400px; min-width: 340px; height: 100%; overflow-y: auto;
  padding: 28px 26px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 1000;
}
#panel::-webkit-scrollbar { width: 8px; }
#panel::-webkit-scrollbar-thumb { background: #d7deeb; border-radius: 8px; }

.brand {
  display: inline-flex; align-items: center; gap: 11px; text-decoration: none;
  margin-bottom: 16px;
}
.brand-mark { width: 40px; height: 40px; display: block; flex-shrink: 0; }
.brand-name {
  font-size: 1.42rem; font-weight: 800; letter-spacing: -.03em; color: var(--brand-deep);
}
.brand-24 { color: var(--brand); }

header h1 {
  font-size: clamp(1.25rem, 1rem + 1vw, 1.5rem); font-weight: 800;
  color: var(--brand-deep); letter-spacing: -.02em; line-height: 1.2;
}
header .sub { color: var(--muted); font-size: .84rem; margin: 8px 0 22px; }

/* ===== Formularfelder ===== */
.field { margin-bottom: 16px; position: relative; }
.field label {
  display: block; font-size: .76rem; font-weight: 600; color: #46506a;
  margin-bottom: 6px; letter-spacing: .01em;
}
.field input, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: .95rem; font-family: inherit;
  color: var(--text); background: #fbfcfe; transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: #9aa3b5; }
.field input:focus, .field select:focus {
  outline: none; border-color: var(--brand); box-shadow: var(--ring); background: #fff;
}
.field select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236a7385' d='M6 8 0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}

.autocomplete .suggestions {
  position: absolute; top: 100%; left: 0; right: 0; background: #fff; z-index: 1100;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); margin-top: 6px;
  overflow: hidden; box-shadow: var(--shadow-lg); display: none;
}
.autocomplete .suggestions.open { display: block; }
.autocomplete .suggestions div {
  padding: 11px 14px; font-size: .85rem; cursor: pointer; transition: background .12s;
  border-bottom: 1px solid #f0f3f9;
}
.autocomplete .suggestions div:last-child { border-bottom: none; }
.autocomplete .suggestions div:hover { background: #eef4ff; }

.advanced { margin-bottom: 18px; }
.advanced summary {
  font-size: .82rem; color: var(--brand); cursor: pointer; font-weight: 600;
  padding: 4px 0; list-style: none; user-select: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "⚙ "; }
.advanced .field { margin-top: 10px; }
.note { font-size: .72rem; color: var(--muted); line-height: 1.5; margin-top: 8px; }

/* ===== Button ===== */
#go {
  width: 100%; padding: 14px; border: none; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-size: 1rem; font-weight: 700; font-family: inherit; cursor: pointer;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .28); transition: transform .12s, box-shadow .12s, filter .12s;
}
#go:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37, 99, 235, .34); }
#go:active { transform: translateY(0); }
#go:disabled { filter: grayscale(.4) opacity(.7); cursor: wait; transform: none; }

#status { font-size: .82rem; color: #c0392b; margin-top: 12px; min-height: 1.2em; }
#status.working { color: var(--muted); }

/* ===== Ergebnis ===== */
#result { margin-top: 22px; animation: fadeUp .35s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.toll-box {
  background: linear-gradient(140deg, var(--brand-deep), var(--brand));
  color: #fff; border-radius: var(--radius); padding: 22px; text-align: center;
  margin-bottom: 16px; box-shadow: 0 10px 28px rgba(15, 41, 94, .28); position: relative; overflow: hidden;
}
.toll-box::after {
  content: ""; position: absolute; top: -40%; right: -20%; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%);
}
.toll-label { font-size: .76rem; opacity: .85; text-transform: uppercase; letter-spacing: .06em; }
.toll-amount { font-size: 2.4rem; font-weight: 800; margin: 6px 0 2px; letter-spacing: -.02em; }
.toll-rate { font-size: .76rem; opacity: .85; }

.stats { display: flex; gap: 10px; margin-bottom: 16px; }
.stat {
  flex: 1; background: #f2f6fc; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 6px; text-align: center;
}
.stat span { display: block; font-weight: 800; font-size: 1rem; color: var(--brand-deep); }
.stat small { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }

.breaks { font-size: .77rem; color: #55607a; margin: -4px 0 14px; text-align: center; line-height: 1.5; }

.breakdown { width: 100%; border-collapse: collapse; font-size: .86rem; }
.breakdown td { padding: 9px 4px; border-bottom: 1px solid #eef1f7; }
.breakdown tr:last-child td { border-bottom: none; }
.breakdown td:last-child { text-align: right; font-weight: 700; color: var(--brand-deep); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 9px; vertical-align: middle; }
.dot.ab { background: var(--accent-ab); }
.dot.bs { background: var(--accent-bs); }
.dot.free { background: var(--brand); }

/* ===== Karte ===== */
#map {
  flex: 1; height: 100%; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.leaflet-container { border-radius: var(--radius); }

/* ===== CONTENT ===== */
.content {
  max-width: 800px; margin: 0 auto; padding: clamp(40px, 6vw, 72px) 24px 72px;
  font-size: 1.02rem;
}
.content h2 {
  font-size: clamp(1.25rem, 1rem + 1.3vw, 1.55rem); font-weight: 800; color: var(--brand-deep);
  margin: 40px 0 14px; line-height: 1.3; letter-spacing: -.01em;
}
.content h2:first-child { margin-top: 0; }
.content p { margin-bottom: 15px; color: #38415a; }
.content p.small { font-size: .86rem; color: var(--muted); }
.content strong { color: var(--text); font-weight: 700; }

/* Tabelle */
.table-wrap {
  overflow-x: auto; margin: 22px 0; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--card);
}
table.rates { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 540px; }
table.rates th, table.rates td { padding: 12px 14px; text-align: right; }
table.rates th:first-child, table.rates td:first-child { text-align: left; }
table.rates thead th {
  background: #f2f6fc; color: var(--brand-deep); font-weight: 700; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border-strong);
}
table.rates tbody td { border-bottom: 1px solid #eef1f7; }
table.rates tbody tr:last-child td { border-bottom: none; }
table.rates tbody tr:hover { background: #f8fafd; }
table.rates td b { color: var(--brand); font-weight: 800; }

/* FAQ */
.faq { margin-top: 48px; }
.faq details {
  border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px;
  padding: 0 18px; background: var(--card); box-shadow: var(--shadow-sm); transition: box-shadow .15s;
}
.faq details[open] { box-shadow: var(--shadow); }
.faq summary {
  font-weight: 600; cursor: pointer; padding: 16px 0; font-size: .98rem; color: var(--text);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; color: var(--brand); font-weight: 700; font-size: 1.3rem; line-height: 1;
  transition: transform .2s; flex-shrink: 0;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 16px; margin: 0; color: #4a536b; font-size: .93rem; }

.site-footer {
  margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--border);
  font-size: .8rem; color: var(--muted); text-align: center; line-height: 1.6;
}

/* ===== Interne Verlinkung (Startseite) ===== */
.related { max-width: 800px; margin: 40px auto 0; padding: 0 24px; }
.related > h2 {
  font-size: clamp(1.25rem, 1rem + 1.3vw, 1.55rem); font-weight: 800; color: var(--brand-deep);
  margin-bottom: 16px; letter-spacing: -.01em;
}
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.related-grid a {
  display: block; text-decoration: none; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.related-grid a:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c7d5f0; }
.related-grid strong { display: block; color: var(--brand-deep); font-size: 1rem; margin-bottom: 6px; }
.related-grid span { color: var(--muted); font-size: .84rem; line-height: 1.5; }

/* ===== Unterseiten ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 15px max(24px, calc((100% - 960px) / 2));
  background: linear-gradient(135deg, #0f295e 0%, #1d4ed8 100%);
}
.topbar .brand { margin-bottom: 0; }
.topbar .brand-name { font-size: 1.2rem; color: #fff; }
.topbar .brand-24 { color: #9dc0ff; }
.topbar .brand-mark { width: 34px; height: 34px; }
.topbar .brand-mark rect { fill: #fff; }
.topbar .brand-mark path { stroke: #1d4ed8; }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a {
  text-decoration: none; color: #cdddff; font-size: .88rem; font-weight: 600;
  padding: 8px 12px; border-radius: 8px; transition: background .12s, color .12s;
}
.topnav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.topnav a[aria-current="page"] { background: rgba(255,255,255,.20); color: #fff; }

.subpage { padding-top: clamp(28px, 4vw, 44px); }
.subpage .crumbs { font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
.subpage .crumbs a { color: var(--brand); text-decoration: none; }
.subpage h1 {
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.2rem); font-weight: 800; color: var(--brand-deep);
  letter-spacing: -.02em; line-height: 1.2; margin-bottom: 16px;
}
.subpage .lead { font-size: 1.08rem; color: #2c3550; }
.content a { color: var(--brand-dark); }
.content .lead a, .content p a { text-decoration: underline; text-underline-offset: 2px; }
.examples { margin: 6px 0 18px 0; padding-left: 22px; }
.examples li { margin-bottom: 8px; color: #38415a; }
.cta-box {
  background: #eef4ff; border: 1px solid #cfe0fb; border-radius: var(--radius);
  padding: 16px 18px; font-size: 1rem; font-weight: 600; margin: 26px 0 18px;
}
.cta-box a { color: var(--brand-dark); }
.site-footer a { color: var(--brand); text-decoration: none; }

/* ===== Responsive ===== */
@media (max-width: 680px) {
  .related-grid { grid-template-columns: 1fr; }
  .topbar { justify-content: center; }
}
@media (max-width: 760px) {
  .hero { flex-direction: column; height: auto; min-height: 0; padding: 12px; gap: 12px; }
  #panel { width: 100%; min-width: 0; height: auto; padding: 22px 20px; }
  #map { width: 100%; height: 58vh; min-height: 320px; }
  .content { padding: 36px 18px 52px; }
  .toll-amount { font-size: 2.1rem; }
}
@media (max-width: 380px) {
  .stats { flex-wrap: wrap; }
  .stat { min-width: calc(50% - 5px); }
}
