/*
 * Lokalradar – Gestaltung übernommen von Storyradar (frontend/src/styles.css):
 * Kühles Papier, Schieferblau als Schrift, Petrol für Aktionen.
 * Markergelb ist dem Wichtigsten vorbehalten: Geschichten über der Schwelle.
 */
@font-face {
  font-family: "Schibsted Grotesk Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url("fonts/schibsted-grotesk-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url("fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --sr-paper: #f6f7f5;
  --sr-paper-raised: #ffffff;
  --sr-ink: #1c2733;
  --sr-ink-soft: #3a4756;
  --sr-muted: #5f6b77;
  --sr-faint: #8a949e;
  --sr-line: #dfe3e6;
  --sr-line-strong: #c3cad0;
  --sr-action: #0f5c6e;
  --sr-action-dark: #0b4654;
  --sr-action-soft: #e3eff1;
  --sr-marker: #ffd84d;
  --sr-critical: #b4473a;
  --sr-positive: #2f7d5b;
  --sr-danger-soft: #f8e9e6;

  font-family: "Schibsted Grotesk Variable", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--sr-ink);
  background: var(--sr-paper);
  font-synthesis: none;
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--sr-paper); }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--sr-action); text-underline-offset: .15em; }
a:hover { color: var(--sr-action-dark); }
:focus-visible { outline: 3px solid var(--sr-action); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; color: var(--sr-ink); }
h1 { font-size: 2.25rem; font-weight: 760; letter-spacing: -.02em; line-height: 1; }
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 1.0625rem; font-weight: 680; }
p { margin: 0 0 .6rem; }
p:last-child { margin-bottom: 0; }
.skip { position: absolute; left: 1rem; top: -5rem; background: #fff; padding: .5rem; z-index: 1000; }
.skip:focus { top: .5rem; }
.muted { color: var(--sr-muted); }
.full-text, .preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: var(--sr-critical); }

/* ---------- Kopfzeile wie Storyradar ---------- */
.app-navbar { background: var(--sr-paper-raised); border-bottom: 1px solid var(--sr-line); }
.app-topbar {
  width: min(1600px, 100%); margin: 0 auto; padding: 0 1rem; min-height: 56px;
  display: flex; align-items: stretch; gap: 1.35rem;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; white-space: nowrap; }
.brand-wordmark { color: var(--sr-ink); font-size: 1.1875rem; font-weight: 790; letter-spacing: -.025em; }
.brand-wordmark span { color: var(--sr-action); }
.brand-scope {
  padding: .1rem .45rem; border: 1px solid var(--sr-line-strong); border-radius: 3px;
  color: var(--sr-muted); font-size: .75rem; font-weight: 600;
}
.app-primary-nav { display: flex; align-items: stretch; gap: .25rem; flex: 1; }
.app-primary-link {
  position: relative; display: flex; align-items: center; padding: 0 .8rem;
  color: var(--sr-muted); font-size: .9688rem; font-weight: 650; text-decoration: none; white-space: nowrap;
}
.app-primary-link::after {
  position: absolute; right: .7rem; bottom: -1px; left: .7rem; height: 3px; background: transparent; content: "";
}
.app-primary-link:hover, .app-primary-link[aria-current] { color: var(--sr-ink); }
.app-primary-link[aria-current]::after { background: var(--sr-ink); }
.app-user { display: flex; align-items: center; gap: .9rem; margin-left: auto; color: var(--sr-muted); font-size: .875rem; }
.app-user form { margin: 0; }
.link-button {
  padding: 0; border: 0; background: none; color: var(--sr-action); font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: .15em;
}

/* ---------- Seite ---------- */
.app-container { width: min(1600px, 100%); margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: .5rem 0 1.25rem; }
.page-kicker { color: var(--sr-muted); font-size: .875rem; font-weight: 600; }
.stand { margin: .45rem 0 0; color: var(--sr-muted); font-size: .875rem; }
.stand strong { color: var(--sr-ink); }
.back { display: inline-block; margin-bottom: .75rem; font-size: .875rem; font-weight: 600; }

/* ---------- Bedienelemente ---------- */
.sr-button, button.primary, .actions button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 2.25rem; padding: .4rem .9rem; border: 1px solid var(--sr-line-strong); border-radius: 4px;
  background: var(--sr-paper-raised); color: var(--sr-ink); font-weight: 600; font-size: .9375rem;
  line-height: 1.2; text-decoration: none; cursor: pointer;
}
.sr-button:hover, .actions button:hover:not(:disabled) { border-color: var(--sr-ink); }
.sr-button.is-primary, button.primary { background: var(--sr-action); border-color: var(--sr-action); color: #fff; }
.sr-button.is-primary:hover, button.primary:hover { background: var(--sr-action-dark); border-color: var(--sr-action-dark); }
button:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.actions button { min-height: 1.9rem; padding: .2rem .65rem; font-size: .8125rem; }
select, input[type="text"], input[type="password"], input:not([type]), textarea {
  width: 100%; min-height: 2.25rem; padding: .35rem .65rem; border: 1px solid var(--sr-line-strong);
  border-radius: 4px; background: var(--sr-paper-raised); color: var(--sr-ink);
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--sr-action); outline-offset: 0; border-color: var(--sr-action); }
label { display: grid; gap: .25rem; color: var(--sr-ink-soft); font-size: .8125rem; font-weight: 600; }
.checkbox { display: inline-flex; align-items: center; gap: .45rem; font-size: .875rem; font-weight: 500; color: var(--sr-ink); }
.checkbox input { width: 1rem; height: 1rem; accent-color: var(--sr-action); }

/* ---------- Filterleiste: eine Zeile, dicke Linie darunter ---------- */
.filters { margin: 0; padding: 0 0 .9rem; border-bottom: 2px solid var(--sr-ink); }
.filter-toggle { position: absolute; opacity: 0; pointer-events: none; }
.filter-toggle-label { display: none; cursor: pointer; font-weight: 650; padding: .35rem 0; color: var(--sr-ink); font-size: .9375rem; }
.filter-toggle:focus-visible + .filter-toggle-label { outline: 3px solid var(--sr-action); outline-offset: 2px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; }
.filter-row label { flex: 0 1 11rem; }
.filter-row .checkbox { flex: 0 0 auto; padding-bottom: .5rem; }
.filter-row button { flex: 0 0 auto; }

/* ---------- Themenliste (sb-*) wie Storyradar ---------- */
.sb-list { display: grid; gap: .5rem; margin: .75rem 0 0; padding: 0; list-style: none; }
.sb-item { border: 1px solid var(--sr-line); border-radius: 4px; background: var(--sr-paper-raised); }
.sb-item.is-signal { box-shadow: inset 4px 0 0 var(--sr-action); }
.sb-row {
  display: grid; grid-template-columns: 4.25rem minmax(0, 1fr) auto auto; gap: 0 1.1rem;
  align-items: start; padding: .875rem 1rem;
}
.sb-score {
  justify-self: start; min-width: 3.1rem; padding: .05rem .35rem .1rem; font-size: 1.65rem; font-weight: 720;
  line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.sb-score.is-marked { background: linear-gradient(176deg, transparent 8%, var(--sr-marker) 8%, var(--sr-marker) 88%, transparent 88%); }
.sb-score.is-mid { color: var(--sr-ink); }
.sb-score.is-low, .sb-score.is-open { color: var(--sr-faint); }
.sb-body { display: grid; gap: .3rem; min-width: 0; }
.sb-headline {
  color: var(--sr-ink); font-size: 1.125rem; font-weight: 640; line-height: 1.35; text-decoration: none; text-wrap: pretty;
}
.sb-headline:hover { color: var(--sr-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.sb-meta { display: flex; flex-wrap: wrap; gap: .15rem .6rem; font-size: .875rem; color: var(--sr-muted); }
.sb-place { color: var(--sr-ink); font-weight: 600; }
.sb-flag { color: var(--sr-action); font-weight: 650; }
.sb-flag.is-quiet { color: var(--sr-muted); font-weight: 500; }
.sb-summary { margin: .1rem 0 0; max-width: 78ch; color: var(--sr-ink-soft); font-size: .9375rem; line-height: 1.45; }
.sb-time { padding-top: .35rem; font-size: .875rem; color: var(--sr-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sb-thumb { width: 6rem; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 3px; background: var(--sr-line); }
.sb-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sb-also { padding: 0 1rem .75rem 6.35rem; }
.sb-also-list { margin: 0; padding: .5rem 0 0; list-style: none; border-top: 1px solid var(--sr-line); }
.sb-also-list li { padding: .125rem 0; max-width: 90ch; color: var(--sr-ink-soft); font-size: .9375rem; line-height: 1.4; }
.sb-also-list strong { margin-right: .4rem; color: var(--sr-ink); font-weight: 650; }
.kind-tag {
  display: inline-block; margin-right: .35rem; padding: 0 .3rem; border: 1px solid var(--sr-line); border-radius: 3px;
  color: var(--sr-muted); font-size: .6875rem; font-weight: 600; vertical-align: .1em;
}
.kind-tag.is-community { border-color: var(--sr-action-soft); background: var(--sr-action-soft); color: var(--sr-action-dark); }
.sb-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  padding: .55rem 1rem .65rem 6.35rem; border-top: 1px solid var(--sr-line); color: var(--sr-muted); font-size: .8125rem;
}
.empty-state { padding: 2.5rem 1rem; color: var(--sr-muted); text-align: center; border: 1px dashed var(--sr-line-strong); border-radius: 4px; }

/* ---------- Detail ---------- */
.sb-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 22rem); gap: 1.5rem; align-items: start; }
.detail-head { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 2px solid var(--sr-ink); }
.detail-head h1 { font-size: 2rem; line-height: 1.12; margin: .35rem 0 .6rem; }
.detail-summary { font-size: 1.0625rem; color: var(--sr-ink-soft); max-width: 72ch; }
.panel { background: var(--sr-paper-raised); border: 1px solid var(--sr-line); border-radius: 4px; padding: 1rem 1.1rem; }
.aside { display: grid; gap: .75rem; position: sticky; top: 1rem; }
.aside h2 { font-size: .8125rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sr-muted); margin-bottom: .35rem; }
.aside ul { margin: 0; padding-left: 1.1rem; }
.aside li { margin-bottom: .25rem; }
.big-score { font-size: 2.6rem; font-weight: 760; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; display: inline-block; padding: 0 .3rem; }
.big-score.is-marked { background: linear-gradient(176deg, transparent 8%, var(--sr-marker) 8%, var(--sr-marker) 88%, transparent 88%); }
.big-score.is-low { color: var(--sr-faint); }
.source-item { margin-bottom: .6rem; }
.source-item h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem; margin-bottom: .2rem; }
.source-item .meta { color: var(--sr-muted); font-size: .875rem; margin-bottom: .5rem; }
.source-item img { display: block; max-width: 100%; max-height: 360px; margin: .6rem 0; border-radius: 3px; }
.comments { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .9375rem; color: var(--sr-ink-soft); }
.comments li { margin-bottom: .35rem; }
.inline-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .875rem; font-weight: 600; }

/* ---------- Tabellen ---------- */
.table-panel { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
th, td { padding: .7rem .75rem; border-bottom: 1px solid var(--sr-line); text-align: left; vertical-align: top; }
thead th { color: var(--sr-muted); font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; border-bottom: 2px solid var(--sr-ink); }
tbody th { font-weight: 600; }
.status-ok { color: var(--sr-positive); font-weight: 600; }
.status-error { color: var(--sr-critical); font-weight: 600; }
.metric { font-variant-numeric: tabular-nums; }

/* ---------- Login wie Storyradar ---------- */
.auth-column { width: min(25rem, 100%); margin: 3rem auto; }
.auth-lede { color: var(--sr-ink-soft); margin-bottom: 1.5rem; }
.auth-panel { display: grid; gap: 1rem; padding: 1.5rem; }
.auth-panel h1 { font-size: 1.5rem; }
.auth-panel label { font-size: 1rem; font-weight: 400; color: var(--sr-ink); }
.auth-panel button { min-height: 2.75rem; width: 100%; }
.auth-footnote { margin-top: 1rem; color: var(--sr-muted); font-size: .8125rem; }

/* ---------- Karte ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1rem; align-items: start; margin-top: .75rem; }
#map { height: min(72vh, 760px); min-height: 420px; border: 1px solid var(--sr-line-strong); border-radius: 4px; background: #e9ece8; }
.map-list { display: grid; gap: .4rem; max-height: min(72vh, 760px); overflow: auto; margin: 0; padding: 0; list-style: none; }
.map-list li { padding: .55rem .7rem; border: 1px solid var(--sr-line); border-radius: 4px; background: var(--sr-paper-raised); }
.map-list button { all: unset; cursor: pointer; display: grid; gap: .15rem; }
.map-list button:focus-visible { outline: 3px solid var(--sr-action); outline-offset: 2px; }
.map-list .t { font-weight: 640; line-height: 1.3; }
.map-list .m { color: var(--sr-muted); font-size: .8125rem; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-top: .6rem; color: var(--sr-muted); font-size: .8125rem; }
.legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-right: .3rem; vertical-align: -.1em; border: 2px solid var(--sr-ink); }
.legend .approx { border-style: dashed; background: transparent; }
.leaflet-popup-content { font-family: "Schibsted Grotesk Variable", ui-sans-serif, system-ui, sans-serif; margin: .7rem .9rem; }
.pop-score { font-weight: 760; font-size: 1.1rem; padding: 0 .2rem; }
.pop-score.is-marked { background: var(--sr-marker); }
.pop-title { display: block; margin: .2rem 0; color: var(--sr-ink); font-weight: 650; font-size: .95rem; line-height: 1.3; }
.pop-meta { color: var(--sr-muted); font-size: .8rem; }

/* ---------- Einstellungen ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem); gap: 1.25rem; align-items: start; }
.settings-grid textarea { min-height: 26rem; font-size: .9375rem; line-height: 1.5; resize: vertical; }
.fixed-rules { white-space: pre-wrap; color: var(--sr-muted); font-size: .8125rem; line-height: 1.45; }
.notice { padding: .7rem .9rem; border-left: 4px solid var(--sr-action); background: var(--sr-action-soft); border-radius: 0 4px 4px 0; margin-bottom: 1rem; }
.notice.is-error { border-color: var(--sr-critical); background: var(--sr-danger-soft); }
.result dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .8rem; margin: 0; font-size: .9375rem; }
.result dt { color: var(--sr-muted); font-weight: 600; }
.result dd { margin: 0; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin: 1rem 0; color: var(--sr-muted); font-size: .875rem; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .app-topbar { flex-wrap: wrap; gap: 0 .5rem; padding-top: .5rem; }
  .app-primary-nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .app-primary-link { min-height: 44px; padding: 0 .6rem; }
  .app-user .date { display: none; }
  h1 { font-size: 1.75rem; }
  .filter-toggle-label { display: block; }
  .filter-toggle:not(:checked) ~ .filter-row { display: none; }
  .filter-row label { flex: 1 1 45%; }
  .sb-row { grid-template-columns: 3.4rem minmax(0, 1fr); gap: .2rem .8rem; padding: .75rem; }
  .sb-score { font-size: 1.35rem; min-width: 2.6rem; }
  .sb-time { grid-column: 2; padding-top: 0; }
  .sb-thumb { display: none; }
  .sb-also { padding: 0 .75rem .6rem; }
  .sb-foot { padding: .5rem .75rem; }
  .sb-detail, .settings-grid, .map-layout { grid-template-columns: 1fr; }
  .aside { position: static; }
  #map { height: 60vh; }
}
