/* ClAn Report-Seiten — schlank, mobile-first, iframe-tauglich */
:root {
  --fg: #1c2733;
  --fg-muted: #61707f;
  --bg: #FAFAF7;
  --panel: #f7f8fa;
  --border: #dde2e8;
  --accent: #c0392b;
  --accent-soft: #f7dcd6;
  --warm: #c0392b;
  --cool: #2980b9;
  --ok: #27ae60;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  font-size: 15px;
  line-height: 1.55;
}
a { color: #2c5d8b; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header (nur standalone, nicht iframe) */
body.embed .hdr { display: none; }
.hdr {
  background: #1c2733;
  color: #fff;
  padding: 10px 18px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hdr strong { font-size: 15px; letter-spacing: 0.4px; margin-right: 8px; }
.hdr a { color: #fff; }
.hdr .proj { font-size: 11px; color: #aab7c6; text-transform: uppercase; letter-spacing: 0.5px; }

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 22px 18px 36px;
}

/* Stations-Kopf */
.station-head h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; line-height: 1.2; }
.station-head .meta { margin: 0; color: var(--fg-muted); font-size: 13px; }
.station-head .desc { margin: 8px 0 0; color: var(--fg); font-size: 14px; }
.tag {
  display: inline-block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--fg-muted);
  margin-right: 4px;
}

h2 {
  font-size: 20px;
  margin: 32px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
h2 .period {
  font-size: 12px;
  color: var(--fg-muted);
  font-weight: 400;
  letter-spacing: 0.3px;
}
section .hint {
  margin: 0 0 16px;
  color: var(--fg-muted);
  font-size: 13px;
}

/* Section-Head mit Datums-Stempel */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 32px 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.section-head h2 { margin: 0; font-size: 20px; }
.section-head .stand { color: var(--fg-muted); font-size: 12px; }

.wind-arrow { font-size: 12px; color: var(--fg-muted); margin-left: 2px; display: inline-block; }

/* "Jetzt" — Tile-Grid mit gleichberechtigten Werten */
.now-grid {
  background: linear-gradient(135deg, #f7f8fa 0%, #ebf2f8 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 14px 16px;
  margin-bottom: 18px;
}
.now-tiles {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
@media (max-width: 900px) { .now-tiles { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 540px) { .now-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 380px) { .now-tiles { grid-template-columns: repeat(2, 1fr); } }

.ntile {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 8px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
}
.ntile-icon { font-size: 18px; line-height: 1; margin-bottom: 4px; }
.ntile-icon-big { font-size: 26px; }
.ntile-val {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--fg);
  letter-spacing: -0.3px;
}
.ntile-val-text { font-size: 15px; letter-spacing: 0; }
.ntile-unit { font-size: 11px; font-weight: 500; color: var(--fg-muted); margin-left: 1px; }
.ntile-lbl {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 3px;
  line-height: 1.3;
}
.now-grid-foot {
  text-align: right;
  font-size: 10px;
  color: var(--fg-muted);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.week-foot {
  text-align: right;
  font-size: 10px;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* 7-Tage-Diagramm */
.week-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px 10px;
  margin-bottom: 18px;
}
.week-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.week-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.week-chart {
  width: 100%;
  height: auto;
  max-height: 220px;
  display: block;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 4px;
}
.legend .lg-item { display: flex; align-items: center; gap: 5px; }
.legend .lg-square { display: inline-block; width: 12px; height: 8px; border-radius: 2px; }
.legend .lg-square.warm { background: #e67e22; }
.legend .lg-square.cool { background: #9bc4e2; }
.legend .lg-bar { display: inline-block; width: 4px; height: 10px; }
.legend .lg-bar.precip { background: #2980b9; opacity: 0.65; }
.legend .lg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #fff; border: 1.2px solid #444; }

/* Perioden-Grid (Monat + Jahr) */
.period-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 700px) { .period-grid { grid-template-columns: 1fr; } }
.period-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
}
.period-card h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.period-card h3 .muted { font-weight: 400; }
.period-headline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.period-headline .big { font-size: 26px; font-weight: 700; }
.period-headline .delta { font-size: 12px; padding: 3px 8px; border-radius: 3px; background: #ececec; }
.period-headline .delta.warm { background: var(--accent-soft); color: var(--warm); }
.period-headline .delta.cool { background: #d6e9f5; color: var(--cool); }
.period-headline .delta.wet { background: #cfe6f2; color: #1a5a82; }
.period-headline .delta.dry { background: #f3e1c8; color: #8a5a16; }
.period-headline .delta.neutral { background: #ececec; color: var(--fg-muted); }

.compare-bar { margin: 8px 0; font-size: 12px; }
.cmp-row { display: grid; grid-template-columns: 70px 1fr 90px; align-items: center; gap: 8px; margin: 3px 0; }
.cmp-lbl { color: var(--fg-muted); }
.cmp-track { height: 8px; background: #fff; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.cmp-fill { height: 100%; }
.cmp-fill.normal { background: #b0b8c2; }
.cmp-fill.warm { background: var(--warm); }
.cmp-fill.cool { background: var(--cool); }
.cmp-val { text-align: right; font-variant-numeric: tabular-nums; }

.period-sub { font-size: 13px; margin-top: 6px; }
.period-sub .delta { font-size: 11px; padding: 1px 6px; border-radius: 3px; margin-left: 6px; }
.period-sub .delta.wet { background: #cfe6f2; color: #1a5a82; }
.period-sub .delta.dry { background: #f3e1c8; color: #8a5a16; }
.period-sub .delta.neutral { background: #ececec; color: var(--fg-muted); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; text-align: center; }
.kpi-val { font-size: 22px; font-weight: 700; line-height: 1.1; }
.kpi-lbl { font-size: 11px; color: var(--fg-muted); margin-top: 2px; }
.kpi-ref { font-size: 10px; color: var(--fg-muted); margin-top: 2px; }
@media (max-width: 500px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.pending { font-size: 13px; color: var(--fg-muted); padding: 12px; background: #fff; border-radius: 4px; }

/* Alte Card-Klassen — werden vom alten Code teils noch genutzt, lass ich vorerst stehen */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}
.card-wide { grid-column: span 2; }
@media (max-width: 600px) {
  .card-wide { grid-column: span 1; }
}
.card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  margin-bottom: 6px;
}
.card-value {
  font-size: 24px;
  font-weight: 700;
  margin: 2px 0;
}
.card-value .delta {
  font-size: 13px;
  font-weight: 500;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 3px;
  background: #ececec;
  color: var(--fg);
}
.card-value .delta.warm { background: var(--accent-soft); color: var(--warm); }
.card-value .delta.cool { background: #d6e9f5; color: var(--cool); }
.card-detail {
  font-size: 13px;
  color: var(--fg);
  margin-top: 3px;
}
.card-detail.muted { color: var(--fg-muted); }
.card-source {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 6px;
}

.spark { display: block; margin: 6px 0; }

/* Embed-Helper — Snippets fuer Einbettung in andere Sites */
.embed-section {
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 22px;
  margin: 30px 0;
}
.embed-section h2 {
  margin: 0 0 8px;
  font-size: 18px;
  border: none;
  padding: 0;
}
.embed-section details {
  margin: 12px 0;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.embed-section details:first-of-type { border-top: none; padding-top: 4px; }
.embed-section summary {
  cursor: pointer;
  padding: 6px 0;
  font-size: 14px;
  color: var(--fg);
}
.embed-section summary:hover { color: var(--accent); }
.embed-section summary strong { font-weight: 600; }
.embed-section p { margin: 6px 0; font-size: 13px; }
.embed-section pre {
  background: #1c2733;
  color: #e8edf3;
  padding: 12px 14px;
  border-radius: 4px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  margin: 6px 0 10px;
}
.embed-section pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.embed-section code {
  background: #e8edf3;
  color: #1c2733;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

/* Klima-Tabs (Radio-Input + :checked-Selector, JS-frei) */
.climate-tabs { margin: 18px 0 24px; }
.climate-tabs .cv-radio { position: absolute; opacity: 0; pointer-events: none; }
.climate-tabs .tab-labels {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.climate-tabs .tab-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  color: var(--fg-muted);
  transition: color 120ms, border-color 120ms;
}
.climate-tabs .tab-label strong { font-size: 14px; font-weight: 600; }
.climate-tabs .tab-label .muted { font-size: 11px; }
.climate-tabs .tab-label:hover { color: var(--fg); }
/* Aktiver Tab basierend auf :checked */
#cv-wmo:checked ~ .tab-labels .tab-wmo,
#cv-full:checked ~ .tab-labels .tab-full {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.climate-tabs .tab-pane { display: none; }
#cv-wmo:checked ~ .pane-wmo,
#cv-full:checked ~ .pane-full { display: block; }
.variant-independent { margin-top: 18px; }

/* Headline-Box — Kernaussage oben in Klima-Analyse */
.headline-box {
  background: linear-gradient(135deg, #fff5ed 0%, #f7e6dc 100%);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  padding: 14px 18px;
  margin: 14px 0 22px;
  font-size: 15px;
  line-height: 1.6;
}
.headline-box p { margin: 0; color: var(--fg); }
.headline-box strong { font-weight: 600; }

/* Steckbrief Cards */
.steckbrief {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin: 16px 0 24px;
}
.sb-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}
.sb-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.sb-value { font-size: 18px; font-weight: 600; color: var(--fg); }
.sb-value strong { color: var(--accent); }
.sb-trend {
  font-size: 12px;
  margin-top: 4px;
  color: var(--fg-muted);
}
.sb-trend.warm { color: var(--warm); font-weight: 500; }
.sb-trend.cool { color: var(--cool); font-weight: 500; }
.sig {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 4px;
  vertical-align: 1px;
}

/* Plot-Blöcke */
.plot-block {
  margin: 30px 0;
}
.plot-block h3 {
  font-size: 16px;
  margin: 0 0 6px;
}
.plot-block p {
  margin: 0 0 12px;
  color: var(--fg);
  font-size: 14px;
}
.plot-block img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: block;
}

/* Chart.js-Container — Dark Cards (GitHub-Dark-Palette) */
.chart-wrap {
  position: relative;
  background: #0e1117;
  border-radius: 8px;
  padding: 12px 14px 14px;
  /* Default-Höhe (Chart.js braucht eine — sonst kollabiert canvas auf 0) */
  height: 420px;
}
.chart-attribution {
  display: block;
  color: #6e7681;
  font-size: 11px;
  margin: 4px 2px 0;
  text-align: right;
}

/* Stripes-Only Embed (?section=stripes) — schlanker Container, kein Site-Padding */
#stripes-only { margin: 0; }
#stripes-only .stripes-only-head { margin: 0 0 10px; }
#stripes-only h2 {
  font-size: 18px;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
}
#stripes-only .hint { margin: 0 0 8px; font-size: 13px; }
.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.chart-wrap-stripes      { height: 280px; }
.chart-wrap-trend        { height: 380px; }
.chart-wrap-wl           { height: 460px; }
.chart-wrap-normal       { height: 320px; }
.chart-wrap-week-temp    { height: 240px; }
.chart-wrap-week-precip  { height: 180px; }
/* Seasonal-Grid: 2x2 auf Desktop, gestapelt auf Mobile */
.chart-grid-seasonal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.chart-grid-seasonal .chart-wrap {
  height: 260px;
  padding: 10px 12px 12px;
}
@media (max-width: 640px) {
  .chart-grid-seasonal { grid-template-columns: 1fr; }
  .chart-wrap-stripes { height: 240px; }
  .chart-wrap-trend, .chart-wrap-wl { height: 320px; }
}

.error {
  background: #fff4f2;
  border: 1px solid #f4cabd;
  color: #8a4030;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
}

.footer {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 12px;
}
.footer p { margin: 4px 0; }
.muted { color: var(--fg-muted); }
.small { font-size: 11px; }

/* Reports-Index */
body.reports-index main h1 { font-size: 24px; margin: 0 0 18px; }
body.reports-index main h1 .count { font-size: 13px; color: var(--fg-muted); font-weight: 400; }
body.reports-index .empty {
  background: var(--panel);
  padding: 18px;
  border-radius: 4px;
  color: var(--fg-muted);
}
.project { margin-bottom: 26px; }
.project h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.station-list { list-style: none; margin: 0; padding: 0; }
.station-list li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.station-list a {
  color: var(--fg);
  display: block;
}
.station-list a strong { font-size: 15px; display: inline-block; margin-right: 8px; }
.station-list .coords { font-size: 12px; color: var(--fg-muted); }
.station-list .desc { display: block; font-size: 13px; color: var(--fg); margin-top: 2px; }
.station-list .tags { display: block; margin-top: 4px; }
.station-list .status {
  font-size: 11px;
  display: flex;
  gap: 8px;
}
.status .ok { color: var(--ok); }
.status .missing { color: #c87f5e; }

/* Embed-Modus: keine Header, kein extra Padding aussen, smooth iframe */
body.embed { background: transparent; }
body.embed main { padding-top: 12px; }

/* Compact-Now-Modus: nur das Tile-Grid, minimal vertikales Padding */
body.embed main:has(.compact-now) { padding: 0; }
.compact-now { padding: 0; margin: 0; }
.compact-now .now-grid { margin: 0; border-radius: 6px; }
