/*
 * SeoTranslationPro Designsystem: Tokens, Grundlagen, Komponenten. Gemeinsam für Portal (/app) und Homepage.
 * Zwei visuelle Richtungen über data-palette am <html>: "ink" (Standard, Tintenblau + Türkis) und "paper" (warmes Papier + Violett).
 * Hell/Dunkel: prefers-color-scheme, übersteuerbar mit data-theme="light|dark".
 * Status-System mit genau vier Zuständen: ok (aktuell/fertig), warn (veraltet/wartet), bad (fehlt/fehlgeschlagen), off (ausgeschlossen/inaktiv).
 * Schrift: Inter (variabel, nur Latin, selbst gehostet, SIL OFL – fonts/Inter-LICENSE.txt); andere Schriftsysteme fallen auf Systemschriften zurück.
 */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin-var.woff2") format("woff2");
  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 {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: .75rem; --fs-s: .875rem; --fs-m: 1rem; --fs-l: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem; --fs-3xl: clamp(2rem, 4.5vw, 3.25rem);
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem; --sp-8: 4.5rem;
  --r-s: 6px; --r-m: 10px; --r-l: 16px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgb(15 23 42 / .06), 0 1px 1px rgb(15 23 42 / .04);
  --shadow-2: 0 8px 24px rgb(15 23 42 / .10), 0 2px 6px rgb(15 23 42 / .06);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --maxw: 1180px;

  /* Palette ink, hell */
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #eef1f7; --line: #dde2ec;
  --text: #121a2b; --text-2: #4a5568; --text-3: #6b7588;
  --brand: #1b2a4a; --brand-ink: #ffffff; --accent: #0f9f94; --accent-ink: #ffffff; --accent-soft: #d8f3f0;
  --focus: #2563eb;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2; --off: #64748b; --off-soft: #e9edf3;
}
:root[data-palette="paper"] {
  --bg: #faf7f2; --surface: #fffdf9; --surface-2: #f2ede4; --line: #e4ddd0;
  --text: #1d1a16; --text-2: #574f44; --text-3: #7a7062;
  --brand: #1d1a16; --brand-ink: #fffdf9; --accent: #6d4aed; --accent-ink: #ffffff; --accent-soft: #ebe5fd;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1322; --surface: #141c2e; --surface-2: #1b2539; --line: #2a3550;
    --text: #e8ecf4; --text-2: #b3bdd0; --text-3: #8b96ad;
    --brand: #e8ecf4; --brand-ink: #0d1322; --accent: #2cc9bb; --accent-ink: #062320; --accent-soft: #123a37;
    --focus: #60a5fa;
    --ok: #4ade80; --ok-soft: #12321f; --warn: #fbbf24; --warn-soft: #3a2c0c; --bad: #f87171; --bad-soft: #3d1414; --off: #94a3b8; --off-soft: #222b3d;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 8px 24px rgb(0 0 0 / .45);
  }
  :root[data-palette="paper"]:not([data-theme="light"]) { --bg: #151310; --surface: #1d1a16; --surface-2: #26221c; --line: #383128; --accent: #a68bff; --accent-ink: #160d33; --accent-soft: #2c2347; }
}
:root[data-theme="dark"] {
  --bg: #0d1322; --surface: #141c2e; --surface-2: #1b2539; --line: #2a3550;
  --text: #e8ecf4; --text-2: #b3bdd0; --text-3: #8b96ad;
  --brand: #e8ecf4; --brand-ink: #0d1322; --accent: #2cc9bb; --accent-ink: #062320; --accent-soft: #123a37;
  --focus: #60a5fa;
  --ok: #4ade80; --ok-soft: #12321f; --warn: #fbbf24; --warn-soft: #3a2c0c; --bad: #f87171; --bad-soft: #3d1414; --off: #94a3b8; --off-soft: #222b3d;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 8px 24px rgb(0 0 0 / .45);
}
:root[data-theme="dark"][data-palette="paper"] { --bg: #151310; --surface: #1d1a16; --surface-2: #26221c; --line: #383128; --accent: #a68bff; --accent-ink: #160d33; --accent-soft: #2c2347; }

/* Grundlagen */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--fs-m)/1.6 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--sp-3); letter-spacing: -.01em; }
h1 { font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -.035em; line-height: 1.08; }
h2 { font-size: var(--fs-2xl); font-weight: 680; letter-spacing: -.025em; }
h3 { font-size: var(--fs-l); font-weight: 620; letter-spacing: -.012em; }
p { margin: 0 0 var(--sp-4); }
a { color: var(--accent); text-underline-offset: 2px; }
img, svg { max-width: 100%; height: auto; }
code, .mono { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); } .small { font-size: var(--fs-s); } .xs { font-size: var(--fs-xs); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: var(--sp-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }

/* Buttons: genau ein primärer je Bildschirmbereich */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 40px; padding: 0 var(--sp-4);
  border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); color: var(--text); font: 600 var(--fs-s)/1 var(--font);
  text-decoration: none; cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease); text-align: center; line-height: 1.2; padding-block: 6px; }
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.btn-dark { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-l { min-height: 48px; padding: 0 var(--sp-5); font-size: var(--fs-m); border-radius: var(--r-l); }
.btn-s { min-height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: var(--sp-5); box-shadow: var(--shadow-1); }
.card-tight { padding: var(--sp-4); }
.card h3 { margin-bottom: var(--sp-2); }
.kpi { font-size: var(--fs-2xl); font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 650; }

/* Chips und Status (vier Zustände) */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-pill); background: var(--surface-2);
  color: var(--text-2); font: 600 var(--fs-xs)/1 var(--font); border: 1px solid transparent; }
button.chip { cursor: pointer; } button.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.lang { font: 700 .7rem/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; padding: 4px 6px; border-radius: 5px; background: var(--brand); color: var(--brand-ink); }
.status { display: inline-flex; align-items: center; gap: 6px; font: 600 var(--fs-xs)/1 var(--font); padding: 5px 9px; border-radius: var(--r-pill); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-ok { color: var(--ok); background: var(--ok-soft); }
.status-warn { color: var(--warn); background: var(--warn-soft); }
.status-bad { color: var(--bad); background: var(--bad-soft); }
.status-off { color: var(--off); background: var(--off-soft); }
.status-run::before { animation: stp-pulse 1.2s infinite; }
@keyframes stp-pulse { 50% { opacity: .25; } }

/* Gestapelter Abdeckungsbalken */
.bar { display: flex; height: 10px; border-radius: var(--r-pill); overflow: hidden; background: var(--off-soft); }
.bar > span { display: block; height: 100%; }
.bar .b-ok { background: var(--ok); } .bar .b-warn { background: var(--warn); } .bar .b-bad { background: var(--bad); } .bar .b-off { background: var(--off); opacity: .45; }
.progress { height: 6px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .4s var(--ease); }

/* Tabellen */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-s); }
.t th { text-align: left; font-weight: 650; color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.t td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Formulare */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: var(--fs-s); font-weight: 600; }
.input, select.input, textarea.input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); color: var(--text); font: inherit; }
textarea.input { min-height: 90px; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.check { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-s); }
.check input { margin-top: 3px; accent-color: var(--accent); }
.hint { font-size: var(--fs-xs); color: var(--text-3); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 8px 14px; font: 600 var(--fs-s)/1 var(--font); color: var(--text-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }

/* Hinweise und Toasts */
.note { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-m); background: var(--surface-2); font-size: var(--fs-s); border-left: 3px solid var(--text-3); }
.note-ok { border-color: var(--ok); background: var(--ok-soft); } .note-warn { border-color: var(--warn); background: var(--warn-soft); } .note-bad { border-color: var(--bad); background: var(--bad-soft); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: var(--sp-2); z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--brand); color: var(--brand-ink); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-m); box-shadow: var(--shadow-2); font-size: var(--fs-s); animation: stp-in .2s var(--ease); }
.toast-bad { background: var(--bad); color: #fff; }
@keyframes stp-in { from { transform: translateY(8px); opacity: 0; } }
.empty { text-align: center; padding: var(--sp-7) var(--sp-4); color: var(--text-2); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: stp-sk 1.2s infinite; border-radius: var(--r-s); min-height: 1em; }
@keyframes stp-sk { to { background-position: -200% 0; } }

/* Dialog */
dialog.dlg { border: 1px solid var(--line); border-radius: var(--r-l); padding: 0; background: var(--surface); color: var(--text); width: min(640px, calc(100vw - 32px)); box-shadow: var(--shadow-2); }
dialog.dlg::backdrop { background: rgb(9 13 24 / .55); }
.dlg-head, .dlg-body, .dlg-foot { padding: var(--sp-4) var(--sp-5); }
.dlg-head { border-bottom: 1px solid var(--line); } .dlg-foot { border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: var(--sp-2); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
