/* EDEN · LBMA Brandbook 2020: Dunkelblau #074A70, Mountain Meadow #30D28B, Green Lizard #B6ED2F,
   Viridian #02949A, Medium Sky Blue #80DED9, Air Force Blue #00338E. Weißer Grund, Avenir/Nunito Sans. */
:root {
  color-scheme: light;
  --navy: #074A70; --navy-2: #0A5C8A; --af: #00338E; --petrol: #02949A; --sky: #80DED9;
  --green: #30D28B; --lime: #B6ED2F;
  --ink: #0B2E45; --slate: #5A6F80; --muted: #8597A6;
  --paper: #FFFFFF; --canvas: #F2F6F8; --line: #DFE7EC; --line-2: #EBF0F3;
  /* Funktionsfarben nur für Risikostufen (Warnsemantik) */
  --r-ruh: #30D28B; --r-erh: #B6ED2F; --r-ang: #E8892B; --r-krit: #C8323C;
  --font: 'Avenir Next', Avenir, 'Nunito Sans', 'Helvetica Neue', Arial, sans-serif;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(7, 74, 112, .06), 0 8px 24px -16px rgba(7, 74, 112, .25);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--navy); }
button, input, select { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Kopf ---------- */
.stripe { display: grid; grid-template-columns: 3fr 1fr 1fr 1fr 1fr; height: 5px; }
.stripe i:nth-child(1) { background: var(--navy); } .stripe i:nth-child(2) { background: var(--petrol); }
.stripe i:nth-child(3) { background: var(--sky); } .stripe i:nth-child(4) { background: var(--green); }
.stripe i:nth-child(5) { background: var(--lime); }
.top { position: sticky; top: 0; z-index: 1000; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1680px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit; min-width: 0; }
/* Brandbook: horizontales Logo mindestens 180 px breit (Seitenverhältnis 3,35 -> 54 px hoch) */
.brand img { height: 54px; width: auto; min-width: 180px; display: block; }
.brand .sep { width: 1px; height: 40px; background: var(--line); }
.title { line-height: 1.15; min-width: 0; }
.title b { display: block; font-size: 19px; letter-spacing: .14em; font-weight: 800; color: var(--navy); }
.title b span { font-weight: 300; letter-spacing: .08em; }
.title small { display: block; font-size: 12px; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .spacer { flex: 1; }
.search { position: relative; width: min(360px, 34vw); }
.search input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px 0 36px; background: var(--canvas); outline: none; }
.search input:focus { border-color: var(--petrol); background: #fff; box-shadow: 0 0 0 3px rgba(2, 148, 154, .15); }
.search svg { position: absolute; left: 11px; top: 11px; }
.search ul { position: absolute; top: 44px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 360px; overflow: auto; display: none; }
.search ul.open { display: block; }
.search li { padding: 7px 10px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.search li small { color: var(--muted); white-space: nowrap; }
.search li[aria-selected="true"], .search li:hover { background: var(--canvas); }
.btn { height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.clock { font-size: 12px; color: var(--slate); text-align: right; line-height: 1.3; white-space: nowrap; }
.clock b { display: block; color: var(--ink); font-size: 14px; }

/* ---------- Layout ---------- */
.wrap { max-width: 1680px; margin: 0 auto; padding: 16px 20px 40px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.card-h h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--navy); margin: 0; font-weight: 800; }
.card-h .meta { font-size: 12px; color: var(--muted); }
.card-b { padding: 0 16px 16px; }

/* KPI-Band */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.kpi .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--canvas); flex: 0 0 auto; }
.kpi b { display: block; font-size: 22px; line-height: 1.1; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--slate); line-height: 1.25; display: block; }

.main { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(380px, 1fr); gap: 14px; align-items: start; }
.lower { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 14px; margin-top: 14px; align-items: start; }

/* ---------- Karte ---------- */
.map-card { position: sticky; top: 90px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.seg { display: inline-flex; background: var(--canvas); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--slate); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(7, 74, 112, .15); }
#map { height: min(68vh, 720px); min-height: 420px; background: #fff; border-radius: 0 0 var(--radius) var(--radius); }
.leaflet-container { font-family: var(--font); background: #fff; }
.daybar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.daybar input[type=range] { flex: 1; accent-color: var(--navy); }
.daybar output { min-width: 128px; font-weight: 700; color: var(--navy); font-size: 14px; }
.legend { position: absolute; right: 12px; top: 12px; z-index: 500; background: rgba(255, 255, 255, .95); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); max-width: 280px; }
.legend .row { display: flex; gap: 10px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; border: 1px solid rgba(7, 74, 112, .15); }
.legend p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.map-wrap { position: relative; }
.loadbar { position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 600; background: transparent; }
.loadbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--lime)); transition: width .3s; }
.maptip { font-family: var(--font); font-size: 12px; border-radius: 8px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 6px 9px; }
.maptip b { color: var(--navy); }

/* ---------- Dossier ---------- */
.dossier { overflow: hidden; }
.d-head { padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; border-bottom: 1px solid var(--line-2); background: linear-gradient(180deg, #fff, #FAFCFD); }
.d-head h1 { margin: 0; font-size: 24px; line-height: 1.15; color: var(--navy); font-weight: 800; letter-spacing: -.01em; }
.d-head .sub { font-size: 13px; color: var(--slate); margin-top: 2px; }
.d-head .cascade-line { grid-column: 1 / -1; margin: 0; padding: 9px 12px; font-size: 13.5px; line-height: 1.45; color: var(--slate); background: #F3F6F8; border-left: 3px solid var(--line-2); border-radius: 4px; }
.d-head .cascade-line.on { color: var(--navy); background: #EAF1F6; border-left-color: var(--navy); font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: var(--canvas); color: var(--ink); }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.badge.cascade { background: var(--navy); color: #fff; }
.gauge { width: 112px; height: 112px; position: relative; }
.gauge svg { display: block; }
.gauge .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1; }
.gauge .val b { font-size: 30px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.gauge .val small { display: block; font-size: 10px; letter-spacing: .12em; color: var(--slate); text-transform: uppercase; margin-top: 3px; }

.sec { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.sec:last-child { border-bottom: 0; }
.sec h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--navy); font-weight: 800; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sec h3 small { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); font-size: 11px; }

.domains { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.dom { background: var(--canvas); border-radius: 10px; padding: 8px; min-width: 0; }
.dom span { font-size: 11px; color: var(--slate); display: block; line-height: 1.2; min-height: 26px; }
.dom b { font-size: 18px; color: var(--navy); font-variant-numeric: tabular-nums; }
.dom .bar { height: 4px; border-radius: 2px; background: #fff; margin-top: 6px; overflow: hidden; }
.dom .bar i { display: block; height: 100%; }
.drivers { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; }
.drivers li { padding: 3px 0 3px 16px; position: relative; color: var(--ink); }
.drivers li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--petrol); }

.recs { display: grid; gap: 8px; }
.rec { border-left: 3px solid var(--green); background: #F4FBF8; padding: 9px 12px; border-radius: 0 10px 10px 0; }
.rec.hinweis { border-color: var(--petrol); background: #F1F9FA; }
.rec.risiko { border-color: var(--r-ang); background: #FDF5EC; }
.rec b { display: block; font-size: 14px; color: var(--navy); }
.rec p { margin: 2px 0 0; font-size: 13px; color: var(--slate); }

/* Event-Check */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form label { font-size: 11px; color: var(--slate); font-weight: 700; letter-spacing: .04em; display: grid; gap: 4px; }
.form input, .form select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: #fff; min-width: 0; width: 100%; }
.form .full { grid-column: 1 / -1; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.verdict { margin-top: 12px; border-radius: 12px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; background: var(--canvas); }
.verdict .pill { font-weight: 800; font-size: 13px; padding: 6px 10px; border-radius: 8px; color: var(--ink); white-space: nowrap; }
.verdict b { display: block; color: var(--navy); font-size: 15px; }
.verdict small { color: var(--slate); font-size: 12px; }
.reasons { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.reasons li { display: flex; gap: 8px; padding: 4px 0; align-items: flex-start; }
.reasons li i { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: var(--muted); }
.todo { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink); }
.todo li { margin: 3px 0; }
details.more summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--navy); margin-top: 8px; }

/* Wetter */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day { text-align: center; border-radius: 10px; padding: 6px 2px; font-size: 12px; cursor: pointer; border: 1px solid transparent; }
.day:hover { border-color: var(--line); }
.day.sel { border-color: var(--navy); background: #F3F8FB; }
.day .wd { font-weight: 700; color: var(--navy); }
.day .t { font-variant-numeric: tabular-nums; }
.day .t b { color: var(--ink); }
.day .t span { color: var(--muted); }
.day .x { color: var(--slate); font-size: 11px; line-height: 1.3; }
.day .rk { height: 4px; border-radius: 2px; margin: 4px 8px 0; }
.hourly { margin-top: 10px; }
.hourly svg { width: 100%; height: auto; display: block; }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.list li:first-child { border-top: 0; }
.list a { color: var(--ink); text-decoration: none; font-weight: 600; }
.list a:hover { color: var(--navy); text-decoration: underline; }
.list .m { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--canvas); color: var(--slate); }
.tag.sicherheit, .tag.gefahr { background: #FBE9EA; color: #9A2530; }
.tag.ordnung { background: #FDF0E2; color: #8A4B10; }
.tag.krimi { background: #F1F1F4; color: #4A5568; }
.tag.verkehr { background: #EAF4FA; color: var(--navy); }
.tag.event { background: #E8F8F0; color: #146B45; }
.warn { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.warn:first-child { border-top: 0; }
.warn .lv { flex: 0 0 auto; width: 6px; border-radius: 3px; }
.warn b { color: var(--ink); display: block; }
.warn small { color: var(--slate); }
.empty { color: var(--muted); font-size: 13px; padding: 4px 0; }
.src { font-size: 11px; color: var(--muted); margin-top: 8px; }
.src a { color: var(--muted); }

.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kv div { background: var(--canvas); border-radius: 10px; padding: 8px 10px; }
.kv span { display: block; font-size: 11px; color: var(--slate); }
.kv b { font-size: 15px; color: var(--navy); }

/* Ranking */
.rank li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; cursor: pointer; }
.rank li:hover a { color: var(--navy); }
.rank .n { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.score { font-weight: 800; font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 6px; font-size: 13px; min-width: 38px; text-align: center; }

.spark { width: 100%; height: 64px; display: block; }

/* Eventplaner */
.events table { width: 100%; border-collapse: collapse; font-size: 13px; }
.events th { text-align: left; font-size: 11px; color: var(--slate); font-weight: 700; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.events td { padding: 7px 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.events td button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px 4px; }
.events td button:hover { color: var(--r-krit); }

/* Quellenstatus */
.status { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11.5px; color: var(--slate); }
.status span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--muted); vertical-align: 1px; }
.status span.ok::before { background: var(--green); }
.status span.err::before { background: var(--r-krit); }

footer { max-width: 1680px; margin: 0 auto; padding: 24px 20px 40px; display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; color: var(--slate); font-size: 12.5px; }
footer img { height: 72px; width: auto; }
footer p { margin: 0 0 6px; }

.skel { background: linear-gradient(90deg, var(--canvas), #fff, var(--canvas)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 14px; margin: 6px 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Responsiv ---------- */
@media (max-width: 1280px) { .lower { grid-template-columns: 1fr 1fr; } .lower .geo { grid-column: 1 / -1; order: -1; } }
@media (max-width: 1080px) {
  .main { grid-template-columns: 1fr; }
  .map-card { position: static; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .title small { display: none; }
}
@media (max-width: 720px) {
  .top-in { flex-wrap: wrap; padding: 8px 16px; gap: 10px; }
  .top { position: static; }
  .brand { gap: 12px; } .brand .sep { height: 34px; }
  .search { order: 5; width: 100%; }
  .title b { font-size: 15px; } .title b span { display: block; font-size: 12px; }
  .kpi { padding: 10px; gap: 8px; } .kpi .ic { display: none; } .kpi b { font-size: 19px; }
  .kpis .kpi:last-child { grid-column: 1 / -1; }
  .toolbar .seg { max-width: 100%; overflow-x: auto; }
  .legend { max-width: 190px; padding: 6px 8px; } .legend p { display: none; }
  .clock, #printBtn { display: none; }
  .wrap { padding: 12px 16px 32px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .lower { grid-template-columns: 1fr; }
  .domains { grid-template-columns: repeat(3, 1fr); }
  #map { height: 56vh; min-height: 340px; }
  .d-head { grid-template-columns: 1fr; }
  .gauge { justify-self: start; }
  .days { grid-template-columns: repeat(4, 1fr); }
  .form { grid-template-columns: 1fr; }
  footer { grid-template-columns: 1fr; padding: 20px 16px 32px; }
}

/* ---------- Druck: Lagebriefing ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11px; }
  .top { position: static; }
  .search, #printBtn, .toolbar, .daybar, .map-card, .lower .events, .leaflet-control-container { display: none !important; }
  .main { grid-template-columns: 1fr; }
  .card { box-shadow: none; break-inside: avoid; }
  .lower { grid-template-columns: 1fr 1fr; }
  .lower .geo { grid-column: auto; order: 0; }
}

/* ---------- Ansichtswechsel & Terminplaner ---------- */
.views { margin-left: 8px; }
.views button { font-size: 14px; padding: 8px 14px; }
[hidden] { display: none !important; }
.planner { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; align-items: start; }
.pl-form { position: sticky; top: 90px; }
.pl-region { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--navy); }
.pl-region .btn { height: 30px; padding: 0 10px; font-size: 12px; }
.pl-results { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.pl-results > .skel, .pl-cal, .pl-compare { grid-column: 1 / -1; }
.pl-detail { scroll-margin-top: 90px; }.pl-toplist li { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: center; cursor: pointer; }
.pl-toplist li:hover b { color: var(--petrol); }
.pl-toplist .n { font-weight: 800; color: var(--muted); }
.pl-toplist b { color: var(--navy); font-size: 14px; }
.pl-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--slate); margin-bottom: 12px; }
.pl-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.pl-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px 18px; }
.pl-mname { font-size: 12px; font-weight: 800; color: var(--navy); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.pl-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.pl-wd { font-size: 9.5px; color: var(--muted); text-align: center; }
.pl-day { position: relative; font-size: 11px; text-align: center; line-height: 24px; height: 24px; border-radius: 4px; cursor: pointer; font-variant-numeric: tabular-nums; }
.pl-day.off { background: var(--canvas); color: var(--muted); cursor: default; }
.pl-day:not(.off):hover { outline: 2px solid var(--petrol); z-index: 1; }
.pl-day.sel { outline: 2px solid var(--navy); outline-offset: 1px; z-index: 2; font-weight: 800; }
.pl-day.pub { text-decoration: underline; text-decoration-thickness: 2px; }
.pl-day .pl-mk-ge, .pl-legend .pl-mk-ge { position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--navy); }
.pl-legend .pl-mk-ge { position: static; width: 8px; height: 8px; }
.pl-day .pl-mk-hol { position: absolute; left: 3px; right: 3px; bottom: 2px; height: 2px; border-radius: 1px; background: rgba(7, 74, 112, .55); }
.pl-legend .pl-mk-hol { height: 3px; width: 12px; background: rgba(7, 74, 112, .55); vertical-align: 2px; }
.pl-legend .pl-mk-pub { background: none; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; height: 8px; }
.pl-pm { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pl-h { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); }
.pl-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.pl-compare table th { width: 170px; vertical-align: top; }
@media (max-width: 1080px) { .planner { grid-template-columns: 1fr; } .pl-form { position: static; } .pl-results { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .views { order: 4; margin-left: 0; } .pl-pm { grid-template-columns: 1fr; } .pl-months { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } }
@media print { .views, .pl-form, .pl-actions { display: none !important; } .planner { grid-template-columns: 1fr; } }
