/* ==========================================================================
   PaintUpdater – Gestaltung wie der SR-LigaManager (liga.css): gleiche Farben,
   Schrift Inter, Kopfzeile, Karten, Tabellen, Hell- und Dunkelmodus.
   Farben nur über die Variablen unten verwenden.
   ========================================================================== */
:root,
[data-theme=light] {
  color-scheme: light;
  --bg: #f7f7f8;
  --panel: #ffffff;
  --surface-2: #f2f3f5;
  --line: #e4e5e9;
  --text: #18181b;
  --muted: #6b6b76;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-rgb: 13, 148, 136;
  --accent-soft: rgba(13, 148, 136, .1);
  --accent-text: #ffffff;
  --shadow: 0 1px 2px rgba(16, 16, 24, .04), 0 1px 1px rgba(16, 16, 24, .03);
  --header-bg: rgba(255, 255, 255, .85);
  /* Meldungen wie die Bootstrap-Alerts im LigaManager */
  --ok: #0a3622;
  --ok-bg: #d1e7dd;
  --ok-line: #a3cfbb;
  --warn: #664d03;
  --warn-bg: #fff3cd;
  --warn-line: #ffe69c;
  --err: #58151c;
  --err-bg: #f8d7da;
  --err-line: #f1aeb5;
  --err-strong: #dc3545;
}

[data-theme=dark] {
  color-scheme: dark;
  --bg: #0f1012;
  --panel: #17181b;
  --surface-2: #1e1f23;
  --line: #2a2b30;
  --text: #ececef;
  --muted: #9a9aa5;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-rgb: 45, 212, 191;
  --accent-soft: rgba(45, 212, 191, .12);
  --accent-text: #0f1012;
  --shadow: none;
  --header-bg: rgba(15, 16, 18, .85);
  --ok: #75b798;
  --ok-bg: #051b11;
  --ok-line: #0f5132;
  --warn: #ffda6a;
  --warn-bg: #332701;
  --warn-line: #997404;
  --err: #ea868f;
  --err-bg: #2c0b0e;
  --err-line: #842029;
  --err-strong: #ea868f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0 0 1.25rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; }
code { font-size: .875em; background: var(--surface-2); border: 1px solid var(--line); padding: .1em .4em; border-radius: 6px; overflow-wrap: anywhere; }
pre { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; overflow: auto; }
.muted { color: var(--muted); }
.icon { display: block; flex: none; }

/* ---------- Seitenbreite ---------- */
.container { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 16px; }
.wrap { width: 100%; max-width: 1320px; margin: 0 auto; padding: 2.25rem 16px 3rem; }
.narrow { max-width: 600px; }

/* ---------- Kopfzeile ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner { display: flex; align-items: center; gap: 1.5rem; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em; white-space: nowrap; min-width: 0; }
.brand:hover { color: var(--text); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.brand-mark .icon { width: 16px; height: 16px; }
.brand-group { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.brand-league { color: var(--muted); font-weight: 500; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16rem; text-decoration: none; }
.brand-group .brand-league::before { content: "·"; margin-right: .45rem; color: var(--muted); }
a.brand-league:hover { color: var(--text); }
.main-nav { display: flex; gap: .25rem; }
.main-nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .92rem; padding: .4rem .7rem; border-radius: 8px; white-space: nowrap; }
.main-nav a:hover, .main-nav a.active { color: var(--text); background: var(--surface-2); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.lang-switch { display: inline-flex; align-items: center; gap: .1rem; margin-right: .2rem; font-size: .8rem; font-weight: 600; }
.lang-switch a, .lang-switch span { padding: .3rem .4rem; border-radius: 6px; color: var(--muted); text-decoration: none; }
.lang-switch a:hover { color: var(--text); background: var(--surface-2); }
.lang-switch .active { color: var(--text); background: var(--surface-2); }
.header-user { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .88rem; padding: .25rem .4rem; border-radius: 8px; text-decoration: none; }
.header-user:hover { color: var(--text); background: var(--surface-2); }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; padding: 0; border-radius: 8px;
  color: var(--muted); background: transparent; border: 1px solid transparent; cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.theme-icon-dark { display: none; }
[data-theme=dark] .theme-icon-dark { display: inline; }
[data-theme=dark] .theme-icon-light { display: none; }
.logout { margin: 0; }

@media (max-width: 767.98px) {
  .site-header .inner { height: auto; flex-wrap: wrap; gap: .25rem 1rem; padding: .6rem 16px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; margin: 0 -.7rem; }
  .brand-league, .header-user-name { display: none; }
}

/* ---------- Admin-Reiter ---------- */
.admin-bar { background: var(--panel); border-bottom: 1px solid var(--line); }
.admin-bar .container { display: flex; gap: .25rem; overflow-x: auto; }
.admin-bar a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .85rem; padding: .65rem .75rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.admin-bar a:hover { color: var(--text); }
.admin-bar a.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Formulare ---------- */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.row.top { align-items: flex-start; }
.row label { flex: 1 1 160px; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 500; font-size: .9rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
label small { font-weight: 400; color: var(--muted); font-size: .875em; }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--text); background-color: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: .375rem .75rem; width: 100%; min-width: 0;
  line-height: 1.5; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 .2rem var(--accent-soft); }
input[type=checkbox], input[type=radio] { width: 1.05em; height: 1.05em; padding: 0; accent-color: var(--accent); flex: none; }
input[type=file] { padding: .3rem; }
input[type=file]::file-selector-button { font: inherit; font-size: .9rem; margin-right: .75rem; padding: .3rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); cursor: pointer; }

/* ---------- Schaltflächen ---------- */
/* label.button: Datei-Auswahl, die wie ein Button aussieht (z. B. Admin → Design → Importieren) */
button, a.button, label.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-size: 1rem; font-weight: 500; line-height: 1.5; padding: .375rem .75rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
button:hover, a.button:hover { background: var(--surface-2); color: var(--text); }
button.primary, a.button { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover, a.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
button.danger { color: var(--err-strong); border-color: var(--err-line); }
button.danger:hover { background: var(--err-bg); color: var(--err-strong); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 400; }
button.link:hover { background: none; color: var(--accent-hover); text-decoration: underline; }
button.btn-soft { background: var(--panel); }
button.btn-sm { font-size: .875rem; padding: .25rem .6rem; }
button:disabled { opacity: .55; cursor: default; }
.part-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- Karten, Tabellen ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover > * { background: var(--surface-2); }
th { font-size: .75rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
td form { margin: 0; display: inline; }
td form.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
td form.inline-form input[type=password] { width: 11rem; }
td form.inline-form select { width: auto; }
td a { font-weight: 550; text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ---------- Meldungen, Status ---------- */
.flash { padding: .75rem 1rem; border: 1px solid transparent; border-radius: 10px; margin: 0 0 1rem; }
.flash a { color: inherit; font-weight: 600; }
.flash.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.flash.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.flash.error { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }
.warnings { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); border-radius: 10px; padding: .75rem 1rem .75rem 2.25rem; margin: 0 0 1rem; }
.badge { display: inline-block; background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: .1em .5em; font-size: .75em; font-weight: 600; line-height: 1.4; vertical-align: .1em; }
.status { display: inline-block; font-size: .75rem; font-weight: 600; white-space: nowrap; padding: .2em .55em; border-radius: 6px; border: 1px solid transparent; }
.status-pending { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.status-approved { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.status-rejected, .status-revoked { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }
.status-superseded { background: var(--surface-2); border-color: var(--line); color: var(--muted); }

/* ---------- Kennzahlen ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.75rem; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; margin-bottom: .2rem; }
.stat span { color: var(--muted); font-size: .78rem; }

/* ---------- Filter, Seiten ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { flex: 0 1 200px; }
.filters input, .filters select, .filters button { height: 38px; }
.pager { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: 1rem; color: var(--muted); }

/* ---------- Upload-Fortschritt, Vorschau ---------- */
.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.preview h3 { font-size: .95rem; margin: 0 0 .4rem; }
.current-version { display: flex; flex-direction: column; gap: .4rem; }
.current-version > .muted { font-size: .85rem; margin-top: -.3rem; }
.current-version-preview { display: block; border-radius: 8px; }
.current-version-preview canvas { transition: border-color .15s ease; }
.current-version-preview:hover canvas, .current-version-preview:focus-visible canvas { border-color: var(--accent); }
.preview canvas, .current-version canvas { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 8px; background: repeating-conic-gradient(#999 0 25%, #ccc 0 50%) 0 0 / 20px 20px; }
.layer-toggles { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-bottom: .4rem; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .layout-2 { grid-template-columns: minmax(0, 1fr); } }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .9rem; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

.client-download { margin-top: 2rem; }
.upload-next { margin-top: 1.5rem; }
.client-download p:last-child { margin-bottom: 0; }

/* ---------- Admin → Design ---------- */
a.button.button-soft, label.button.button-soft { background: var(--panel); border-color: var(--line); color: var(--text); }
a.button.button-soft:hover, label.button.button-soft:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }
label.button { flex-direction: row; margin: 0; }
.design-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1.5rem; margin-bottom: 1rem; }
.design-head p { margin: 0; max-width: 46rem; }
.design-head form { margin: 0; }
.design-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 480px) { .design-grid { grid-template-columns: minmax(0, 1fr); } }
.design-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.design-row:last-of-type { border-bottom: 0; }
.design-label { flex: 1 1 12rem; display: flex; flex-direction: column; }
.design-label label { font-weight: 600; font-size: .9rem; display: block; }
.design-input { display: flex; align-items: center; gap: .35rem; }
.design-input input[type=color] { width: 2.6rem; height: 2.1rem; padding: .15rem; cursor: pointer; }
/* Farbfläche abgerundet und ohne eigenen Rahmen, wie Bootstraps .form-control-color im LigaManager */
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 10px; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 10px; }
.design-input input.hex { width: 6.5rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; padding: .3rem .5rem; }
input.invalid { border-color: var(--err-strong); box-shadow: 0 0 0 .2rem var(--err-bg); }
.design-error { width: 100%; text-align: right; color: var(--err-strong); }
/* Vorschau: Variablen kommen aus dem style-Attribut des Elements (je Modus) */
.design-preview { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 1rem; font-size: .9rem; }
.design-preview .dp-header { display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem; background: var(--header-bg); border-bottom: 1px solid var(--line); }
.design-preview .dp-header .muted { font-weight: 400; }
.design-preview .dp-body { padding: .9rem; }
.design-preview .table-wrap { margin-bottom: .75rem; }

/* ---------- Fußzeile ---------- */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 1.75rem 0; margin-top: 2rem; }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.footer-links { display: flex; gap: 1rem; }
