/* Himmelsplaner · Gestaltung „Nachtwarte“. Keine Webfonts, keine Inline-Styles (CSP: default-src 'self'). */
:root {
  color-scheme: dark;
  --page: #0a0f18;
  --bar: #0c1320;
  --panel: #0f1622;
  --field: #0c1320;
  --raised: #111a29;
  --sunken: #0b1220;
  --twilight: #1b2740;
  --hover: #142034;
  --border: #1e2a3f;
  --line: #2a3851;
  --line-strong: #3a4a66;
  --text: #e8f0fa;
  --soft: #d6e0ec;
  --muted: #a3b3c9;
  --dim: #97a9c1;
  --accent: #7fe0c8;
  --accent-strong: #c4f7ea;
  --accent-soft: #12302f;
  --accent-line: #2f6b60;
  --selected: #10282a;
  --moon: #e9b872;
  --warn: #e9b872;
  --crit: #ff8a7a;
  --error: #ffc0ac;
  --red-border: #5a2620;
  --red-bg: #1a1012;
  --red-text: #ff8a7a;
  --radius: 16px;
  --radius-s: 8px;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Space Grotesk", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23a3b3c9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  font-family: var(--sans);
  color: var(--text);
  background: var(--page);
}

/* Rotlicht: nur Rottöne auf Schwarz, Kontrast ≥ 4,5:1 für Text. */
:root[data-theme="red"] {
  --page: #000; --bar: #050101; --panel: #0e0302; --field: #070101; --raised: #140403; --sunken: #050101;
  --twilight: #1f0604; --hover: #1c0605; --border: #3a0f0b; --line: #4a120c; --line-strong: #6a1a12;
  --text: #ff7a66; --soft: #ff7a66; --muted: #d9483a; --dim: #d9483a;
  --accent: #ff7a66; --accent-strong: #ff9a8a; --accent-soft: #2a0905; --accent-line: #7a2016; --selected: #240805;
  --moon: #d9483a; --warn: #ff7a66; --crit: #ff7a66; --error: #ff9a8a;
  --red-border: #ff7a66; --red-bg: #2a0905; --red-text: #ff7a66;
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23d9483a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); line-height: 1.45; }
button, select, input { font: inherit; }
button, select, a, summary { touch-action: manipulation; }
button { cursor: pointer; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: var(--display); letter-spacing: -.02em; font-weight: 600; }
h1 { font-size: 1.75rem; line-height: 1.15; margin: 0; }
h2 { font-size: 1.25rem; line-height: 1.2; margin: 0; }
.small-heading { font-size: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 20; padding: 8px 12px; border-radius: var(--radius-s); background: var(--accent); color: var(--page); }
.skip-link:focus { top: 12px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: min(1440px, 100%); margin-inline: auto; padding-inline: 32px; }

/* Kopfzeile */
.masthead { border-bottom: 1px solid var(--border); background: var(--bar); position: sticky; top: 0; z-index: 10; }
.masthead-content { min-height: 64px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-mark { width: 32px; height: 32px; fill: none; stroke: var(--accent); stroke-width: 1.5; }
.brand-mark .ring { opacity: .45; }
.brand-mark .core { fill: var(--accent); stroke: none; }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 1.12rem; letter-spacing: -.01em; }
.badge { font: 500 .75rem var(--mono); color: var(--dim); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: var(--radius-s); color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 500; }
.tabs a .icon { width: 16px; height: 16px; }
.tabs a:hover { color: var(--text); background: var(--hover); }
.tabs a[aria-current="page"] { color: var(--text); background: var(--hover); font-weight: 600; }
.tabs a[aria-current="page"] .icon { color: var(--accent); }
.masthead-tools { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip-button, .red-button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--raised); color: var(--text); font-size: .88rem; }
.chip-button .icon { width: 16px; height: 16px; color: var(--accent); }
.chip-button:hover { border-color: var(--accent-line); }
.chip-button .mono { color: var(--dim); font-size: .78rem; }
.red-button { border-color: var(--red-border); background: var(--red-bg); color: var(--red-text); font-weight: 600; }
.red-button .icon { width: 16px; height: 16px; }
.red-button[aria-pressed="true"] { border-width: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

main { padding-top: 28px; padding-bottom: 32px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.view-intro { color: var(--muted); margin: 8px 0 0; font-size: .92rem; }
.quiet-button { background: var(--raised); border-radius: var(--radius-s); border: 1px solid var(--line); color: var(--text); min-height: 38px; font-size: .88rem; padding: 6px 12px; }
.quiet-button:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.link-button { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; min-height: 24px; }
.link-button:hover { color: var(--accent-strong); }

/* Formularfelder */
label { min-width: 0; display: grid; gap: 6px; color: var(--muted); font-size: .84rem; line-height: 1.3; font-weight: 500; }
input, select {
  display: block; width: 100%; min-width: 0; min-height: 42px; color: var(--text); background: var(--field);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; font-size: .92rem; font-weight: 400;
}
input::placeholder { color: var(--dim); }
input:hover, select:hover { border-color: var(--line-strong); }
select { appearance: none; padding-right: 28px; background-image: var(--arrow); background-position: right 8px center; background-repeat: no-repeat; background-size: 16px; }
input[type="file"] { padding: 7px 8px; font-size: .84rem; }
.plan-fields, .custom-fields { display: grid; gap: 12px; }
.plan-fields { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-top: 14px; }
.custom-fields { margin-top: 14px; grid-template-columns: 1fr 1fr 1.4fr; }
.custom-fields p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .86rem; }
.form-error { color: var(--error); margin: 10px 0 0; font-size: .88rem; }

/* Nachtband */
.night { padding: 22px 24px 20px; }
.night-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 18px; }
.night-conditions { margin: 0; color: var(--muted); font-size: .88rem; }
.night-settings { margin: 0 0 20px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--sunken); }
.night-body { display: flex; flex-wrap: wrap; gap: 24px; }
.night-stats { flex: 1 1 400px; min-width: 0; }
.night-summary { margin: 0; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; align-content: start; }
.night-summary > div { min-width: 0; }
.night-summary dt { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.night-summary dd { margin: 0; }
.kpi { font: 600 1.15rem/1.25 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi.moon { color: var(--moon); }
.kpi.accent { color: var(--accent); }
.kpi-note { margin-top: 2px !important; font-size: .8rem; color: var(--dim); }
.night-chart { flex: 999 1 480px; min-width: 0; }
.night-timeline .axis { height: 18px; margin-bottom: 6px; }
.night-plot { display: block; width: 100%; height: 84px; border-radius: 10px; }
.moon-hint { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; font-size: .88rem; color: var(--soft); }
.moon-hint .icon { color: var(--moon); margin-top: 1px; }
.moon-hint strong { color: var(--moon); font-weight: 600; }

/* Zeitachse (Kopf und Nachtband) */
.axis { position: relative; display: block; height: 16px; }
.axis span { position: absolute; top: 0; transform: translateX(-50%); font: 400 .7rem var(--mono); color: var(--dim); white-space: nowrap; }
.axis span.edge-start { transform: none; }
.axis span.edge-end { transform: translateX(-100%); }
.plot-twilight { fill: var(--twilight); }
.plot-dark { fill: var(--sunken); }
.plot-hour { stroke: var(--border); stroke-width: 1; }
.plot-midnight { stroke: var(--line); stroke-width: 1; }
.plot-moon { fill: none; stroke: var(--moon); stroke-width: 2; stroke-dasharray: 6 5; }
.plot-text { fill: var(--muted); font: 400 12px var(--sans); }
.plot-text.moon { fill: var(--moon); }

/* Katalog */
.catalog-section { margin-top: 24px; }
.catalog-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.filters { flex: 0 0 248px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.filter-more { display: flex; flex-direction: column; gap: 16px; }
.filters-toggle { display: none; }
fieldset.chip-field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.chip-field legend { font-size: .84rem; color: var(--muted); font-weight: 500; margin-bottom: 8px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--soft); font-size: .82rem; }
.chips button:hover { border-color: var(--accent-line); }
.chips button[aria-pressed="true"], .segmented button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.segmented button { min-height: 38px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--soft); font-size: .82rem; padding: 0 4px; }
.segmented button:first-child { border-left: 0; }
.segmented button[aria-pressed="true"] { border-color: var(--line); }

.results-panel { flex: 1 1 560px; overflow: hidden; }
.results-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.results-head > div { margin-right: auto; }
#result-count { color: var(--muted); margin: 2px 0 0; font-size: .84rem; min-height: 1.2em; }
.sort-label { font-size: .82rem; }
#sort { width: auto; min-height: 38px; padding-block: 4px; font-size: .84rem; background-color: var(--raised); }
.result-scroll { overflow: auto; max-height: 760px; scrollbar-color: var(--line-strong) var(--panel); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; text-align: left; }
.results-table { table-layout: fixed; }
.results-table thead { position: sticky; top: 0; z-index: 1; background: var(--bar); }
.results-table th { font-size: .76rem; font-weight: 500; color: var(--dim); padding: 8px 6px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.col-target { width: 212px; }
.col-window { width: 108px; text-align: right; }
.results-table th:first-child, .results-table td:first-child { padding-left: 16px; }
.results-table th:last-child, .results-table td:last-child { padding-right: 16px; }
.results-table td { padding: 11px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.results-table tbody tr { cursor: pointer; }
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table tbody tr:hover { background: var(--hover); }
.results-table tbody tr.selected { background: var(--selected); }
.results-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 var(--accent); }
.target-button { display: block; text-align: left; border: 0; background: transparent; padding: 2px 0; color: var(--text); width: 100%; line-height: 1.3; min-height: 40px; }
.target-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.target-name strong { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected .target-name strong { color: var(--accent); }
.target-meta { display: block; margin-top: 3px; font: 400 .74rem var(--mono); color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { flex: none; font: 600 .66rem/1.5 var(--sans); letter-spacing: .03em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.tag.duo { color: var(--accent-strong); border-color: var(--accent-line); }
.track { display: block; width: 100%; height: 28px; }
.track-bg { fill: var(--sunken); }
.track-twilight { fill: var(--twilight); opacity: .6; }
.bar { fill: var(--accent); }
.bar.warn { fill: var(--warn); opacity: .8; }
.bar.crit { fill: var(--crit); opacity: .7; }
.peak { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.window-cell { text-align: right; }
.window-value { display: block; font: 600 .84rem var(--mono); color: var(--text); white-space: nowrap; }
.moon-value { display: block; white-space: nowrap; margin-top: 2px; font: 400 .74rem var(--mono); color: var(--dim); }
.moon-value.warn { color: var(--warn); }
.moon-value.crit { color: var(--crit); }
.empty { padding: 24px 16px; color: var(--muted); }
.empty p { margin: 0 0 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bar); font-size: .76rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 18px; height: 6px; border-radius: 3px; background: var(--accent); }
.legend .key-warn::before { background: var(--warn); }
.legend .key-crit::before { background: var(--crit); }
.legend .key-peak::before { width: 3px; height: 12px; background: var(--text); }

/* Detail */
.detail-panel { flex: 1 1 380px; max-width: 480px; padding: 20px 22px 24px; }
.detail-meta { color: var(--accent); font: 400 .78rem/1.5 var(--mono); margin-bottom: 6px; }
.detail-title { font-family: var(--display); font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.1; letter-spacing: -.02em; margin: 0; font-weight: 600; }
.detail-title:focus { outline: none; }
.detail-type { color: var(--muted); margin: 6px 0 14px; font-size: .88rem; }
.detail-reason { font-size: .92rem; line-height: 1.6; margin-bottom: 18px; color: var(--soft); }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 0 0 12px; }
.details-grid > div { background: var(--bar); padding: 10px 12px; min-width: 0; }
dt { color: var(--muted); font-size: .76rem; line-height: 1.3; margin-bottom: 3px; }
dd { margin: 0; font-size: .86rem; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.detail-secondary { color: var(--muted); font-weight: 400; font-size: .78rem; }
.detail-block { margin-top: 20px; }
.detail-block h3 { font-size: .95rem; margin: 0 0 6px; }
.detail-block p { color: var(--muted); font-size: .86rem; line-height: 1.5; margin: 0 0 6px; }
.detail-block p strong { color: var(--text); font-weight: 600; }
.detail-block .windows { color: var(--accent); font: 600 1.02rem var(--mono); }
.chart { display: block; width: 100%; height: auto; background: var(--sunken); border: 1px solid var(--border); border-radius: 10px; margin-top: 10px; }
.chart-window { fill: var(--accent); opacity: .1; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-min { stroke: var(--line-strong); stroke-dasharray: 4 4; }
.chart-target { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.chart-moon { fill: none; stroke: var(--moon); stroke-width: 1.6; stroke-dasharray: 5 4; }
.chart-peak { fill: var(--text); }
.chart-label { fill: var(--dim); font: 400 10px var(--mono); }
.chart-key { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 8px; color: var(--muted); font-size: .74rem; }
.chart-key span { display: inline-flex; align-items: center; gap: 6px; }
.chart-key span::before { content: ""; width: 14px; border-top: 2px solid var(--accent); }
.chart-key span:nth-child(2)::before { border-top: 2px dashed var(--moon); }
.chart-key span:nth-child(3)::before { border-top: 2px dashed var(--line-strong); }
.chart-key span:nth-child(4)::before { width: 12px; height: 9px; border: 1px solid var(--accent-line); background: var(--accent-soft); }
.mobile-link { display: none; color: var(--accent); margin-top: 14px; font-size: .9rem; }

/* Belichtung im Detail */
.exposure-card { margin-top: 22px; border: 1px solid var(--accent-line); border-radius: 12px; background: var(--accent-soft); padding: 16px; }
.exposure-card .section-heading h3 { margin: 0; font-size: .95rem; }
.exposure-card .context { font-size: .76rem; color: var(--muted); }
.exposure-headline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 10px 0 0; }
.exposure-headline .seconds { font: 600 2.4rem/1 var(--mono); color: var(--accent); }
.exposure-headline .summary { font-size: .88rem; color: var(--soft); }
.exposure-kpis { margin: 14px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.exposure-kpis dd { font: 500 .82rem var(--mono); }
.exposure-kpis dd.moon { color: var(--moon); }
.exposure-more { margin-top: 14px; border-top: 1px solid var(--accent-line); padding-top: 12px; }
.exposure-more summary { cursor: pointer; color: var(--accent); font-size: .88rem; font-weight: 500; min-height: 28px; }
.exposure-more p { color: var(--muted); font-size: .84rem; line-height: 1.5; }
.exposure-more .details-grid { margin-top: 12px; }
.exposure-more h4 { font-size: .86rem; margin: 16px 0 6px; color: var(--text); }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--sunken); }
.data-table th, .data-table td { padding: 6px 8px; white-space: nowrap; font-size: .76rem; border-bottom: 1px solid var(--border); color: var(--muted); }
.data-table thead th { color: var(--soft); font-weight: 600; background: var(--bar); }
.data-table tbody th { font-weight: 600; color: var(--text); text-align: left; }
.data-table tbody tr:last-child th, .data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tr.chosen th, .data-table tr.chosen td { background: var(--selected); color: var(--accent); }
.data-table tr.limit th { color: var(--warn); }
.data-table tr.muted-row th, .data-table tr.muted-row td { color: var(--dim); }
.table-note { font-size: .74rem !important; color: var(--dim) !important; margin-top: 5px !important; }
.warn { color: var(--warn); }
.exposure-notes { margin: 0; padding-left: 18px; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.exposure-notes li { margin-bottom: 5px; }
.exposure-notes strong { color: var(--text); }

/* Weitere Ansichten */
.exposure-settings, .sky-measure, .source-copy { padding: 22px 24px 24px; }
.exposure-fields { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.device-profile { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.device-profile summary { cursor: pointer; color: var(--soft); font-size: .9rem; font-weight: 500; min-height: 28px; }
.profile-note { color: var(--dim); font-size: .82rem; line-height: 1.55; margin: 14px 0 0; max-width: 110ch; }
.sky-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.sky-status { font-size: .86rem; color: var(--muted); margin: 8px 0; min-height: 1.2em; }
.sky-status.warn { color: var(--warn); }
#sky-result .details-grid { margin-top: 8px; }
#sky-result .details-grid .wide { grid-column: 1 / -1; }
#sky-result h4 { font-size: .9rem; margin: 14px 0 6px; }
#sky-result .sqm { font-size: 1.15rem; color: var(--accent); }
.source-copy { max-width: 900px; color: var(--soft); font-size: .9rem; line-height: 1.6; }
.source-copy h1 { margin-bottom: 16px; }
.source-copy p { margin-bottom: 10px; }
.source-copy ul { padding-left: 18px; color: var(--muted); }
.source-copy li { margin-bottom: 4px; }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); font-size: .82rem; color: var(--dim); }

/* Responsiv */
@media (max-width: 1180px) {
  .detail-panel { max-width: none; flex-basis: 100%; }
}
@media (max-width: 780px) {
  .wrap { padding-inline: 16px; }
  main { padding-top: 16px; padding-bottom: 96px; }
  .masthead-content { min-height: 56px; gap: 8px; }
  .masthead-tools .chip-button { display: none; }
  .red-button span { display: none; }
  .red-button { min-width: 44px; min-height: 44px; justify-content: center; padding: 0; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0;
    padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); background: var(--bar); border-top: 1px solid var(--border); }
  .tabs a { flex-direction: column; gap: 3px; min-height: 52px; justify-content: center; padding: 0; font-size: .7rem; background: none !important; }
  .tabs a .icon { width: 22px; height: 22px; }
  .tabs a[aria-current="page"] { color: var(--accent); }
  .night { padding: 16px; }
  .night-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpi { font-size: .92rem; white-space: normal; }
  .night-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .night-plot { height: 56px; }
  .filters { flex-basis: 100%; gap: 12px; }
  .filters-toggle { display: block; }
  .filter-more { display: none; }
  .filters.expanded .filter-more { display: flex; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .chips button { flex: none; }
  .results-panel { flex-basis: 100%; }
  .result-scroll { max-height: 480px; }
  .col-target { width: 46%; }
  .col-window { width: 84px; }
  .results-table th:first-child, .results-table td:first-child { padding-left: 12px; }
  .results-table th:last-child, .results-table td:last-child { padding-right: 12px; }
  .mobile-link { display: inline-block; }
  .custom-fields { grid-template-columns: 1fr 1fr; }
  .exposure-settings, .sky-measure, .source-copy { padding: 16px; }
}
@media (max-width: 520px) {
  .badge { display: none; }
  /* Zeilen als Karten: Name und Fenster oben, Zeitbalken darunter. */
  .results-table thead { display: none; }
  .results-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--border); }
  .results-table tbody tr:last-child { border-bottom: 0; }
  .results-table td { border-bottom: 0; padding: 10px 12px 0; }
  .results-table td.track-cell { grid-column: 1 / -1; grid-row: 2; padding: 6px 12px 12px; }
  .results-table .track { height: 18px; }
  .night-summary .kpi-note { display: none; }
  .plan-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .details-grid, .exposure-kpis { grid-template-columns: 1fr 1fr; }
  #sky-result .details-grid { grid-template-columns: 1fr; }
}

/* Belichtung: Herkunft der Himmelshelligkeit, Messung */
.data-table tr.muted-row th, .data-table tr.muted-row td { color: var(--dim); }
input[type="file"] { padding: 7px 8px; font-size: .84rem; }
.inline-button { min-height: 30px; padding: 3px 9px; margin-left: 6px; font-size: .82rem; }
a.quiet-button { display: inline-flex; align-items: center; text-decoration: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
.sky-source strong { color: var(--text); }

/* Session (Tab) – nur Tokens, damit der Rotlicht-Modus greift */
.session-panel { padding: 22px 24px 24px; }
.session-panel .context { font-size: .8rem; color: var(--muted); }
.tab-badge { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); font: 600 .7rem/16px var(--mono); text-align: center; }
.session-fields { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.session-dark { display: flex; align-items: end; }
.session-entries { display: grid; gap: 8px; margin: 14px 0 4px; }
.session-entry { display: grid; grid-template-columns: minmax(140px, 1.3fr) minmax(140px, 1fr) minmax(130px, 1fr) auto; gap: 10px; align-items: end; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--sunken); }
.session-entry-name { align-self: center; color: var(--muted); font-size: .9rem; }
.session-entry-name strong { color: var(--text); }
.session-sky { margin-top: 12px; }
.session-chart { position: relative; margin-top: 14px; }

.session-timeline { display: block; width: 100%; height: auto; background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-s); }
.session-timeline .tl-label { fill: var(--soft); font: 500 12px var(--sans); }
.session-timeline .tl-slot-text { fill: var(--page); font: 600 11px var(--mono); }
.session-timeline .tl-hour { stroke: var(--line); stroke-width: 1; }
.session-timeline .tl-window { fill: var(--accent); opacity: .16; }
.session-timeline .bar-slot { fill: var(--accent); }
.session-timeline .bar-slot.duo { fill: var(--moon); }
.session-timeline .slot-gap { fill: var(--warn); opacity: .28; }
.session-key span::before { height: 8px; border: 0; }
.session-key span:nth-child(1)::before { border-top: 0; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.session-key span:nth-child(2)::before { border-top: 0; background: var(--accent); }
.session-key span:nth-child(3)::before { border-top: 0; background: var(--moon); }
.session-key span:nth-child(4)::before { border-top: 0; background: var(--warn); opacity: .4; }
.session-table td, .session-table th { white-space: normal; vertical-align: top; }
.session-table .reason-cell { min-width: 260px; font-size: .76rem; line-height: 1.45; }
.session-export { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.session-export h3 { font-size: 1.05rem; margin: 0 0 8px; }
.session-export h4 { font-size: .9rem; margin: 12px 0 6px; }
.session-export-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.session-qr { display: grid; gap: 8px; justify-items: start; }
/* QR bleibt schwarz auf weiß (Scanbarkeit). */
.qr-canvas { width: min(100%, 360px); height: auto; image-rendering: pixelated; border-radius: var(--radius-s); background: #fff; }
.qr-reveal { display: none; }
:root[data-theme="red"] .session-qr:not(.revealed) .qr-canvas { display: none; }
:root[data-theme="red"] .session-qr:not(.revealed) .qr-reveal { display: inline-flex; }
.session-copy { white-space: pre-wrap; overflow-wrap: anywhere; font: .76rem/1.5 var(--mono); background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 10px; color: var(--muted); max-height: 320px; overflow: auto; }
.session-add { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.tag.session { color: var(--accent); border-color: var(--accent-line); }
.track .bar-slot { fill: var(--accent-strong); }
.track .bar-slot.duo { fill: var(--moon); }
.session-export-grid > *, .session-entry > *, #session-body > * { min-width: 0; }
@media (max-width: 780px) {
  .session-panel { padding: 16px; }
  .session-export-grid { grid-template-columns: 1fr; }
  .session-entry { grid-template-columns: 1fr 1fr; }
  .session-entry-name { grid-column: 1 / -1; }
  .tabs a .tab-badge { position: absolute; transform: translate(14px, -14px); }
  .tabs a { position: relative; }
}
@media (max-width: 520px) { #sky-result .details-grid { grid-template-columns: 1fr; } }
.session-chart .axis.session-axis { margin: 0 1% 4px 7%; }
.share-links { display: grid; gap: 6px; justify-items: start; width: 100%; }
.share-link { font: .78rem/1.4 var(--mono); overflow-wrap: anywhere; color: var(--accent); }
.share-open { font-weight: 600; }

/* Geräteprofile */
.device-panel { padding: 22px 24px 24px; margin-bottom: 18px; }
.device-panel .context { font-size: .8rem; color: var(--muted); }
.device-pick { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }
.device-pick > label { min-width: min(320px, 100%); flex: 1 1 280px; }
.device-pick .sky-actions { margin: 0; }
.device-summary { font-family: var(--mono); font-size: .8rem; }
.device-group { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 10px 12px 12px; margin: 12px 0 0; min-width: 0; }
.device-group legend { padding: 0 6px; color: var(--soft); font-size: .86rem; font-weight: 600; }
.check-group { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; grid-column: 1 / -1; }
.check-group legend { color: var(--muted); font-size: .82rem; margin-bottom: 4px; width: 100%; }
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--soft); }
.check-label input { width: auto; min-height: 0; }
.file-button { position: relative; cursor: pointer; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
fieldset:disabled .check-label { opacity: .6; }
@media (max-width: 780px) { .device-panel { padding: 16px; } }
.more-results { display: block; margin: 10px auto 14px; }

/* Session: Verlauf (Höhe über Zeit, Himmelskarte) */
:root { --series-1: #7fe0c8; --series-2: #83bdf1; --series-3: #c9a2f0; --conflict: rgba(233, 184, 114, .13); }
:root[data-theme="red"] { --series-1: #ff7a66; --series-2: #d9483a; --series-3: #ff9a8a; --conflict: rgba(255, 122, 102, .12); }
.session-history { margin-top: 18px; }
.history-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.history-head h4 { margin: 0; font-size: .95rem; }
.chart-view { margin-top: 8px; }
.session-chart-svg, .session-map-svg { display: block; width: 100%; height: auto; background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-s); touch-action: pan-y; }
.map-view { display: flex; justify-content: center; }
.session-map-svg { max-width: 520px; }
.chart-session { fill: var(--accent); opacity: .05; }
.conflict-band { fill: var(--warn); opacity: .55; }
.session-chart-svg .chart-label, .session-map-svg .chart-label { fill: var(--dim); font: 400 11px var(--mono); }
.chart-min { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 5 5; fill: none; opacity: .8; }
.chart-cursor { stroke: var(--text); stroke-width: 1; opacity: .7; }
.series { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.series.faint { stroke-width: 1.2; opacity: .35; }
.series.slot { stroke-width: 5; opacity: .9; }
.series.s0 { stroke: var(--series-1); }
.series.s1 { stroke: var(--series-2); stroke-dasharray: 9 4; }
.series.s2 { stroke: var(--series-3); stroke-dasharray: 2 4; }
.series.slot.s1, .series.slot.s2 { stroke-dasharray: none; }
.series-dot.s0 { fill: var(--series-1); } .series-dot.s1 { fill: var(--series-2); } .series-dot.s2 { fill: var(--series-3); }
.series-dot { stroke: var(--page); stroke-width: 1.5; }
.series-dot.small { stroke-width: 0; opacity: .8; }
.series-dot.cursor, .moon-dot.cursor { stroke: var(--text); stroke-width: 2; }
.moon-path { fill: none; stroke: var(--moon); stroke-width: 1.8; stroke-dasharray: 4 4; }
.moon-dot { fill: var(--moon); }
.near-moon { fill: none; stroke: var(--warn); stroke-width: 7; opacity: .35; stroke-linecap: round; }
.near-moon.crit { stroke: var(--crit); opacity: .55; }
.map-sky { fill: var(--panel); stroke: var(--line-strong); }
.map-ring { fill: none; stroke: var(--line); }
.map-label { fill: var(--soft); font: 600 13px var(--sans); }
.sector-mask { fill: var(--page); opacity: .55; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: .78rem; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item::before { content: ""; width: 18px; border-top: 3px solid var(--series-1); }
.legend-item.s1::before { border-top: 3px dashed var(--series-2); }
.legend-item.s2::before { border-top: 3px dotted var(--series-3); }
.legend-item.moon::before { border-top: 2px dashed var(--moon); }
.legend-item.conflict::before { height: 6px; border: 0; background: var(--warn); opacity: .55; border-radius: 2px; }
.legend-item.near::before { height: 6px; border: 0; background: var(--warn); opacity: .5; border-radius: 3px; }
.chart-time-label { margin-top: 10px; display: grid; gap: 4px; font-size: .82rem; }
.chart-time-label input { min-height: 28px; padding: 0; accent-color: var(--accent); }
.chart-info { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 0; font: 400 .8rem/1.5 var(--mono); color: var(--muted); min-height: 1.5em; }
.cursor-time { color: var(--text); font-weight: 600; }
.cursor-item strong { color: var(--text); }
.cursor-item.s0 strong { color: var(--series-1); } .cursor-item.s1 strong { color: var(--series-2); } .cursor-item.s2 strong { color: var(--series-3); }
.cursor-item.moon strong { color: var(--moon); }
.chart-summary { margin-top: 10px; }
.history-head .segmented { grid-template-columns: repeat(2, auto); }
.history-head .segmented button { padding: 0 14px; }
.legend-item.min::before { border-top: 1px dashed var(--muted); }
.legend-item.slotline::before { border-top: 5px solid var(--soft); border-radius: 3px; }
