:root {
  color-scheme: light dark;
  --bg: #f3f6f9; --surface: #fff; --surface-soft: #edf2f7;
  --ink: #1b3045; --muted: #5c7083; --line: #d5dfe8;
  --accent: #215e81; --accent-hover: #174562; --header: #162f46;
  --green-bg: #e3f3eb; --green: #196143; --blue-bg: #e6f0fb; --blue: #215f92;
  --yellow-bg: #fff2c9; --yellow: #795906; --orange-bg: #ffeadb; --orange: #924719;
  --red-bg: #fae5e8; --red: #9f3447; --gray-bg: #edf0f3; --gray: #586677;
  --radius: 10px; --space: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.6;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
a:active, button:active { opacity: .78; }
:focus-visible { outline: 3px solid #54a8cc; outline-offset: 3px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 20; padding: 8px 18px; background: var(--surface); }
.skip-link:focus { top: 12px; }
h1, h2, h3 { font-family: system-ui, sans-serif; line-height: 1.25; color: var(--ink); }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -.035em; font-weight: 680; margin: 0 0 12px; }
h2 { font-size: 1.2rem; letter-spacing: -.015em; margin: 0 0 18px; }
h3 { font-size: 1.05rem; margin: 0 0 10px; }
p { margin: 0 0 16px; max-width: 78ch; }
small, .muted, .subtle { color: var(--muted); }
small { font-size: .84rem; line-height: 1.5; }
.site-header { background: var(--header); color: #fff; }
.header-inner { max-width: 1240px; padding: 26px 32px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; font-weight: 650; font-size: 1.18rem; line-height: 1.3; }
.brand:hover { color: #d6e8f6; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 46px; border: 1px solid #6e8aa0; border-radius: 9px 9px 3px 3px; font-size: 1.65rem; font-weight: 500; }
.brand-subtitle { display: block; font-size: .74rem; color: #bccbd9; font-weight: 400; margin-top: 3px; }
.header-status { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 24px; background: #29465f; color: #e2edf5; font-size: .77rem; text-decoration: none; }
.status-dot { background: #77d1b2; border-radius: 50%; width: 7px; height: 7px; }
.next-run { color: #bbcddb; font-size: .7rem; }
.navigation { display: flex; align-items: stretch; gap: 6px; max-width: 1240px; padding: 0 32px; margin: auto; }
.navigation > a { padding: 13px 18px; color: #bccbd9; font-size: .88rem; text-decoration: none; border-bottom: 3px solid transparent; }
.navigation > a:hover { color: #fff; background: #ffffff09; }
.navigation > a[aria-current="page"] { color: #fff; border-bottom-color: #8fc4e4; }
.navigation form { margin-left: auto; display: flex; }
.nav-logout { background: transparent; border: 0; color: #bccbd9; padding: 10px; font: inherit; font-size: .8rem; cursor: pointer; }
.nav-logout:hover { color: #fff; }
.main-content { max-width: 1240px; margin: auto; padding: 40px 32px 64px; min-height: calc(100vh - 248px); }
.page-heading, .page-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 28px; }
.page-heading p, .page-header p { color: var(--muted); }
.eyebrow { margin-bottom: 8px; font-size: .8rem; }
.panel, .card, .position-card, .chart-card { min-width: 0; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel + .panel, section + .panel, .panel + section { margin-top: 24px; }
.grid, .position-grid, .cards-grid, .charts-grid, .summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 28px; }
.grid > .panel { margin-top: 0; }
.panel > :last-child, .card > :last-child { margin-bottom: 0; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 28px 0 16px; }
.section-heading h2 { margin: 0; }
.position-heading, .card-heading, .chart-heading { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.position-heading h2, .card-heading h2, .chart-heading h2 { margin: 0; }
.ticker { font-weight: 700; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 5px; font-size: .74rem; font-weight: 650; white-space: nowrap; color: var(--gray); background: var(--gray-bg); }
.badge.gruen, .badge-gruen { color: var(--green); background: var(--green-bg); }
.badge.blau, .badge-blau { color: var(--blue); background: var(--blue-bg); }
.badge.gelb, .badge-gelb { color: var(--yellow); background: var(--yellow-bg); }
.badge.orange, .badge-orange { color: var(--orange); background: var(--orange-bg); }
.badge.rot, .badge-rot { color: var(--red); background: var(--red-bg); }
.badge.grau, .badge-grau { color: var(--gray); background: var(--gray-bg); }
.badge.changed, td.changed, .veraendert { outline: 2px solid var(--accent); outline-offset: -2px; }
.button, button.button { display: inline-flex; justify-content: center; align-items: center; min-height: 42px; padding: 10px 17px; border: 1px solid transparent; border-radius: 6px; background: var(--accent); color: #fff; font: inherit; font-size: .85rem; line-height: 1.4; font-weight: 600; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--accent-hover); color: #fff; }
.button.secondary, button.secondary { background: var(--surface); color: var(--accent); border-color: var(--line); }
.button.secondary:hover, button.secondary:hover { background: var(--surface-soft); }
.button.danger, button.danger { background: var(--red-bg); color: var(--red); }
button:disabled, .button[aria-disabled="true"], fieldset:disabled .button { opacity: .5; cursor: not-allowed; }
.actions, .button-row, .run-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.notice { border: 1px solid #bad5e5; border-left: 3px solid var(--accent); background: var(--blue-bg); color: var(--ink); padding: 15px 18px; border-radius: 6px; margin: 0 0 22px; font-size: .88rem; }
.notice.error { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.notice.warning, .warning { background: var(--yellow-bg); color: var(--yellow); }
.error { color: var(--red); font-size: .84rem; }
.empty-state { padding: 48px 28px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-state p { margin-left: auto; margin-right: auto; }
details { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 20px; }
summary { color: var(--accent); cursor: pointer; font-size: .86rem; font-weight: 600; }
details ul { padding-left: 22px; font-size: .88rem; }
.table-wrap { position: relative; max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .84rem; }
th { font-weight: 600; font-size: .77rem; color: var(--muted); padding: 12px; background: var(--surface-soft); white-space: nowrap; }
td { padding: 14px 12px; vertical-align: top; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-soft) 55%, transparent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.full-width { grid-column: 1 / -1; }
label { font-size: .84rem; font-weight: 600; }
input, textarea, select { width: 100%; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; font: inherit; font-size: .88rem; min-height: 42px; }
input:hover, textarea:hover, select:hover { border-color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--red); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.checkbox-label { display: flex; align-items: center; gap: 10px; min-height: 42px; }
textarea { resize: vertical; }
.config-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.config-fieldset > .button { margin-top: 24px; }
.config-tabs { display: flex; gap: 10px; margin-bottom: 22px; }
.config-tabs [aria-selected="true"] { border-color: var(--accent); box-shadow: inset 0 -2px var(--accent); }
.code-input, pre, code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.positionen-tabelle input { min-width: 90px; }
.positionen-tabelle input[name$="name"] { min-width: 150px; }
.positionen-tabelle select { min-width: 92px; }
.positionen-tabelle { margin-bottom: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.lauf-log pre, .log-output, pre[data-log-scroll], .log-pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #13283a; color: #d7e7f2; border-radius: 6px; padding: 20px; font-size: .78rem; max-height: 440px; overflow: auto; }
.lauf-log { margin-top: 24px; }
.run-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.start-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 28px; }
.status-grid { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 20px; }
.status-grid dt { color: var(--muted); font-size: .8rem; }
.status-grid dd { margin: 4px 0 0; font-weight: 650; }
.status-grid > div { display: flex; flex-direction: column; gap: 3px; }
.status-grid { margin-bottom: 28px; }
.period-switch { display: inline-flex; gap: 4px; }
.period-switch button { border: 1px solid var(--line); border-radius: 4px; background: var(--surface-soft); color: var(--ink); padding: 7px 10px; cursor: pointer; }
.period-switch button:hover, .period-switch [aria-pressed="true"] { background: var(--accent); color: var(--surface); }
.status-laeuft { color: var(--blue); background: var(--blue-bg); }
.status-fertig { color: var(--green); background: var(--green-bg); }
.status-fehler { color: var(--red); background: var(--red-bg); }
.status-abgebrochen { color: var(--gray); background: var(--gray-bg); }
.report-body, .markdown-body { max-width: 88ch; }
.report-body h1, .markdown-body h1 { font-size: 1.8rem; }
.report-body h2, .markdown-body h2 { margin-top: 32px; }
.report-body pre, .markdown-body pre { max-width: 100%; overflow: auto; background: var(--surface-soft); padding: 16px; }
.report-body table, .markdown-body table { display: block; overflow: auto; overflow-wrap: normal; }
.chart-container, .chart-canvas-container, .chart-wrap { position: relative; height: 285px; min-width: 0; }
.chart-periods { display: flex; gap: 4px; }
.chart-periods button { background: var(--surface-soft); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; font: inherit; font-size: .75rem; cursor: pointer; }
.chart-periods button:hover, .chart-periods button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.kpi-row, .kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.kpi-row dt, .kpi-grid dt { font-size: .72rem; color: var(--muted); }
.kpi-row dd, .kpi-grid dd { margin: 3px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.login-layout { display: grid; place-items: center; min-height: calc(100vh - 208px); }
.login-panel { width: 100%; max-width: 460px; padding: 38px; }
.login-panel h1 { margin-bottom: 20px; font-size: 2.15rem; }
.login-panel > p { font-size: .9rem; }
.login-form { display: flex; flex-direction: column; gap: 9px; margin: 26px 0 20px; }
.login-form .button { margin-top: 10px; }
.login-note { font-size: .74rem !important; color: var(--muted); }
.site-footer { max-width: 1240px; margin: auto; padding: 22px 32px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 24px; color: var(--muted); font-size: .7rem; }
.site-footer > span { font-weight: 650; white-space: nowrap; }
.site-footer p { margin: 0; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #142332; --surface: #1c3042; --surface-soft: #263d50; --ink: #e0eaf2; --muted: #a6b9c9; --line: #385064; --accent: #89c2e6; --accent-hover: #b1dbf3; --header: #102332; --green-bg: #214736; --green: #a0dfbc; --blue-bg: #243f59; --blue: #a4cff4; --yellow-bg: #493f25; --yellow: #efd487; --orange-bg: #533a2a; --orange: #f4bc91; --red-bg: #512e3b; --red: #f5b1bf; --gray-bg: #344450; --gray: #becdd7; }
  .button, button.button { color: #102332; }
  .button:hover { color: #102332; }
  .notice { border-color: #4b6a83; }
}
@media (max-width: 760px) {
  .header-inner { padding: 20px; gap: 12px; }
  .next-run { display: none; }
  .status-pill { font-size: .66rem; padding: 4px 8px; }
  .navigation { padding: 0 12px; gap: 0; flex-wrap: wrap; }
  .navigation > a { padding: 12px 10px; font-size: .8rem; }
  .nav-logout { font-size: .75rem; }
  .main-content { padding: 28px 18px 42px; }
  .page-heading, .page-header { flex-direction: column; gap: 12px; margin-bottom: 20px; }
  .grid, .position-grid, .cards-grid, .charts-grid, .summary-grid, .form-grid, .run-options, .start-grid { grid-template-columns: minmax(0, 1fr); }
  .panel, .card, .position-card, .chart-card { padding: 20px; }
  .site-footer { padding: 20px 18px; flex-direction: column; gap: 5px; }
  .login-panel { padding: 28px; }
  .brand-subtitle { font-size: .66rem; }
  .chart-container, .chart-canvas-container, .chart-wrap { height: 245px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
