/* SEO-Cockpit – Gestaltung. Farben als Tokens, Dunkelmodus folgt dem System. */
:root {
  color-scheme: light;
  --bg: #f5f5f3;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --text: #1b1b1a;
  --text-2: #52514e;
  --text-3: #7a7974;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-soft: #e5effb;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-prev: #a9a8a2;
  --grid: #e8e7e3;
  --good: #0c7a0c;
  --good-soft: #e3f3e3;
  --bad: #c22f2f;
  --bad-soft: #fbe6e6;
  --warn: #8a5a00;
  --warn-soft: #fdf1d6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 1px rgba(0, 0, 0, .03);
  --radius: 10px;
  --sidebar: #1d2330;
  --sidebar-text: #c9cfdb;
  --sidebar-active: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --border: #2f2f2c;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #8f8e86;
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-soft: #1b2b40;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-prev: #6b6a64;
    --grid: #2a2a27;
    --good: #4cc04c;
    --good-soft: #15301a;
    --bad: #ef7a7a;
    --bad-soft: #3a1c1c;
    --warn: #f0b84a;
    --warn-soft: #382b10;
    --sidebar: #0c0e13;
    --sidebar-text: #aab1bf;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #2f2f2c;
  --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8e86;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #1b2b40;
  --series-1: #3987e5; --series-2: #d95926; --series-prev: #6b6a64; --grid: #2a2a27;
  --good: #4cc04c; --good-soft: #15301a; --bad: #ef7a7a; --bad-soft: #3a1c1c; --warn: #f0b84a; --warn-soft: #382b10;
  --sidebar: #0c0e13; --sidebar-text: #aab1bf;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 1em; }
small, .muted { color: var(--text-3); }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* Layout */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; padding: 4px 10px 14px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, #3987e5, #1baf7a); display: grid; place-items: center; font-size: 13px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7d8597; padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 9px; color: var(--sidebar-text); padding: 7px 10px; border-radius: 7px; font-size: 13.5px; }
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(57, 135, 229, .22); color: var(--sidebar-active); }
.nav svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.project-switch { margin: 0 4px 6px; }
.project-switch select { width: 100%; background: rgba(255, 255, 255, .07); color: #fff; border: 1px solid rgba(255, 255, 255, .12); border-radius: 7px; padding: 7px 8px; font: inherit; }
.project-switch option { color: #111; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 10px; font-size: 12.5px; }
.sidebar-foot .who { padding: 0 10px 6px; color: #fff; }
.sidebar-foot .who small { display: block; color: #7d8597; }

.main { padding: 22px 28px 60px; min-width: 0; }
.topbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.topbar h1 { margin: 0; }
.topbar .sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.mobile-bar { display: none; }

/* Karten & Raster */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.card > h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 16px; }
.grid > .card, .grid > div > .card:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; box-shadow: var(--shadow); }
.kpi .label { color: var(--text-2); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 24px; font-weight: 650; margin: 2px 0 1px; letter-spacing: -.01em; }
.kpi .cmp { font-size: 12px; color: var(--text-3); }
.kpi .src { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }

.delta { font-weight: 600; font-size: 12px; white-space: nowrap; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--text-3); }
.delta.up::before { content: "▲ "; font-size: 9px; }
.delta.down::before { content: "▼ "; font-size: 9px; }

/* Tabellen */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--text-2); font-size: 12px; white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
th a { color: inherit; }
th.sorted { color: var(--text); }
td.num, th.num { text-align: right; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
td .label { word-break: break-word; }
.cell-sub { display: block; font-size: 11.5px; color: var(--text-3); }
.spark { width: 90px; height: 22px; display: block; }

/* Bedienelemente */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 13px; border-radius: 7px; font: inherit; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented a, .segmented button { white-space: nowrap; flex: none; }
.segmented a, .segmented button { padding: 6px 11px; color: var(--text-2); border: 0; background: none; font: inherit; font-size: 13px; cursor: pointer; border-right: 1px solid var(--border); }
.segmented > :last-child { border-right: 0; }
.segmented a:hover, .segmented button:hover { background: var(--surface-2); text-decoration: none; }
.segmented .on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; min-width: 0; max-width: 100%; }
.chart-head > *, .topbar > * { min-width: 0; max-width: 100%; }
.period-custom { display: none; gap: 6px; align-items: center; }
.period-custom.open { display: inline-flex; }

form.stack { display: grid; gap: 14px; max-width: 720px; }
label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--text-3); font-size: 12.5px; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=url], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input, .inline select { width: auto; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 3px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Hinweise */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.success { background: var(--good-soft); border-color: transparent; color: var(--good); }
.flash.error { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.flash.info, .notice { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.notice { padding: 12px 15px; border-radius: 8px; margin-bottom: 16px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.badge { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-weight: 550; white-space: nowrap; }
.badge.up { background: var(--good-soft); color: var(--good); }
.badge.down { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.blue { background: var(--accent-soft); color: var(--accent-ink); }
.empty { text-align: center; color: var(--text-3); padding: 30px 10px; }

/* Diagramme */
.chart-box { position: relative; height: 280px; }
.chart-box.small { height: 180px; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.legend i.prev { background: repeating-linear-gradient(90deg, var(--series-prev) 0 4px, transparent 4px 7px); }
.legend i.marker { width: 2px; height: 12px; background: var(--series-2); }
.change-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 12.5px; }
.change-list li { display: flex; gap: 8px; align-items: baseline; }
.marker-no { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 99px; background: var(--series-2); color: #fff; font-size: 11px; font-weight: 700; padding: 0 4px; }

/* Änderungsdetails */
.verdict { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius); margin-bottom: 16px; font-weight: 550; }
.verdict.up { background: var(--good-soft); color: var(--good); }
.verdict.down { background: var(--bad-soft); color: var(--bad); }
.verdict.neutral { background: var(--surface-2); color: var(--text-2); }
.compare { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
.compare .kpi .value { font-size: 20px; }
.ba { font-size: 12.5px; color: var(--text-3); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border); align-items: start; }
.timeline li:last-child { border-bottom: 0; }
.timeline .date { font-weight: 600; font-size: 13px; }
.timeline h3 { margin: 0 0 3px; font-size: 14.5px; }
.timeline .desc { color: var(--text-2); font-size: 13px; margin: 3px 0 0; }
.timeline .impact { text-align: right; min-width: 150px; font-size: 12.5px; }

/* KI-Bericht */
.prose { max-width: 820px; font-size: 14.5px; line-height: 1.65; }
.prose h2 { font-size: 17px; margin: 1.5em 0 .5em; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 15px; margin: 1.2em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin: .25em 0; }
.prose table { margin: 1em 0; font-size: 13px; }
.prose code { word-break: break-all; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 380px; }
.login .brand { color: var(--text); justify-content: center; font-size: 18px; padding-bottom: 20px; }

.pw-box { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 12px 15px; margin-bottom: 14px; }
.pw-box code { font-size: 15px; background: var(--surface); color: var(--text); padding: 3px 8px; user-select: all; }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 6px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; }
.list-plain li:last-child { border-bottom: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); margin-right: 6px; }
.status-dot.ok { background: var(--good); }
.status-dot.error { background: var(--bad); }
.status-dot.running { background: var(--warn); }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: none; place-items: center; z-index: 50; }
.overlay.open { display: grid; }
.overlay .card { max-width: 380px; text-align: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 6px auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--sidebar); color: #fff; position: sticky; top: 0; z-index: 30; }
  .mobile-bar button { background: none; border: 0; color: #fff; font-size: 22px; padding: 0 4px; cursor: pointer; }
  .main { padding: 16px 16px 50px; }
  .grid-2, .grid-3, .grid-wide, .row-2 { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .timeline .impact { text-align: left; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .chart-box { height: 230px; }
}
.card + form, form + .card { margin-top: 16px; }

/* Einrichtungsassistent */
.step-head { display: flex; gap: 12px; align-items: flex-start; }
.step-no { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); }
.step-no.done { background: var(--good-soft); color: var(--good); }
.howto { margin: 10px 0 14px; padding-left: 20px; line-height: 1.6; display: grid; gap: 10px; }
.howto .btn { margin-right: 6px; }
.copyrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.copyrow span { min-width: 230px; color: var(--text-2); font-size: 12.5px; }
.copyrow code { font-size: 12.5px; word-break: break-all; }
