/* ==========================================================================
   MulleLabs Design-System
   Quelle: Landing-Page (static/design-system.css). Wettportal und Mullebot
   kopieren diese Datei UNVERÄNDERT. Änderungen nur hier, danach kopieren.
   Stil: der bisherige MulleLabs-Look (dunkel, Discord-Blau, runde Karten).
   Keine externen Ressourcen: Systemschriften, keine Webfonts.
   ========================================================================== */

/* ---------- Farben (dunkel = Standard-Look wie bisher) ---------- */
:root {
    color-scheme: dark light;

    --bg:           #070b14;
    --surface:      #111827;
    --surface-2:    #1f2937;
    --surface-hover:#182235;
    --border:       #1f2937;
    --text:         #ffffff;
    --text-muted:   #9ca3af;

    --accent:       #5865f2;   /* einziger Akzentton (Discord-Blau) */
    --accent-hover: #4752c4;
    --accent-text:  #a3abff;   /* Links/Text in Akzentfarbe */
    --on-accent:    #ffffff;

    --danger:       #dc2626;
    --danger-hover: #b91c1c;
    --on-danger:    #ffffff;

    --success-bg:   #052e16;  --success-fg: #86efac;
    --warning-bg:   #3a2a05;  --warning-fg: #fcd34d;
    --error-bg:     #3b0f0f;  --error-fg:   #fca5a5;
    --info-bg:      #1e2257;  --info-fg:    #c7ccff;

    --focus:        #8b95ff;
    --shadow:       none;
    --lift:         translateY(-4px);

    --radius-lg:    24px;      /* Karten */
    --radius:       22px;      /* Kacheln */
    --radius-sm:    14px;      /* Buttons, Felder */
    --space-1: .25rem; --space-2: .5rem; --space-3: .75rem;
    --space-4: 1rem;   --space-5: 1.5rem; --space-6: 2.5rem;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    --content-width: 80rem;
}

/* ---------- Farben (hell, gleiche Formen) ---------- */
@media (prefers-color-scheme: light) {
    :root {
        --bg:           #eef0f6;
        --surface:      #ffffff;
        --surface-2:    #e5e8f0;
        --surface-hover:#f5f6ff;
        --border:       #d6dae4;
        --text:         #111827;
        --text-muted:   #4b5563;

        --accent-text:  #3f4bc9;

        --success-bg:   #dcfce7;  --success-fg: #14532d;
        --warning-bg:   #fef3c7;  --warning-fg: #713f12;
        --error-bg:     #fee2e2;  --error-fg:   #991b1b;
        --info-bg:      #e0e3ff;  --info-fg:    #2f37a0;

        --focus:        #4752c4;
        --shadow:       0 1px 3px rgba(17, 24, 39, .08);
    }
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 1rem/1.5 var(--font);
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--space-4); font-weight: 700; overflow-wrap: break-word; hyphens: auto; }
h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 var(--space-3); }

a { color: var(--accent-text); }
a:hover { text-decoration-thickness: 2px; }

img { max-width: 100%; }

code, kbd { font-family: var(--font-mono); font-size: .9em; }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: var(--space-2); top: -100px;
    background: var(--surface); color: var(--text);
    padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
    z-index: 1000;
}
.skip-link:focus { top: var(--space-2); }

@media (prefers-reduced-motion: reduce) {
    :root { --lift: none; }
    * { transition: none !important; animation: none !important; }
}

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--space-5) var(--space-4) var(--space-6);
}
@media (min-width: 48rem) {
    .container { padding: var(--space-6) 2.5rem; }
}
.container--narrow { max-width: 28rem; }

.stack > * + * { margin-top: var(--space-4); }

.grid {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
    align-items: start;
}

.page-head {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.page-head h1 { margin: 0; }
.muted { color: var(--text-muted); }

/* ---------- Kopfleiste ---------- */
.site-header__inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--space-4) var(--space-4) 0;
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
}
@media (min-width: 48rem) {
    .site-header__inner { padding: 2.5rem 2.5rem 0; }
}
.brand {
    font-weight: 700;
    font-size: clamp(2rem, 7vw, 3.6rem);
    line-height: 1.1;
    color: var(--text); text-decoration: none;
    margin-right: auto;
}
.header-nav { display: flex; flex-wrap: wrap; gap: var(--space-2); order: 3; width: 100%; margin-top: var(--space-2); }
.header-nav a {
    color: var(--text-muted); text-decoration: none; font-weight: 600;
    padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
}
.header-nav a:hover { background: var(--surface); color: var(--text); }
.header-nav a[aria-current="page"] { color: var(--on-accent); background: var(--accent); }

.header-actions { display: flex; align-items: center; gap: var(--space-3); }

/* "Zurück zur Startseite" und Benutzermenü als Pillen wie bisher */
.header-home,
.user-menu > summary {
    display: inline-flex; align-items: center; gap: var(--space-2);
    min-height: 3rem; padding: var(--space-3) var(--space-4);
    background: var(--surface); color: var(--text);
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    font-weight: 600; text-decoration: none;
    transition: background .2s;
}
.header-home:hover,
.user-menu > summary:hover { background: var(--surface-2); }

.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; max-width: 15rem; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary::after { content: "▾"; color: var(--text-muted); }
.user-menu__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__panel {
    position: absolute; right: 0; top: calc(100% + var(--space-2));
    min-width: 12rem; z-index: 100;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
    overflow: hidden;
}
.user-menu__panel a {
    display: block; padding: var(--space-3) var(--space-4);
    color: var(--text); text-decoration: none;
}
.user-menu__panel a:hover { background: var(--surface-2); }

@media (max-width: 40rem) {
    .header-home__text { display: none; }
}
@media (min-width: 64rem) {
    .header-nav { order: 0; width: auto; margin-top: 0; margin-right: auto; }
    .header-nav ~ .header-actions { margin-left: auto; }
    .site-header__inner:has(.header-nav) .brand { margin-right: var(--space-4); }
}

/* ---------- Karte ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }
.card__title { font-size: 1.4rem; margin-bottom: var(--space-4); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: 3rem;
    padding: var(--space-3) 1.4rem;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    font: inherit; font-weight: 700; line-height: 1.2;
    text-decoration: none; cursor: pointer;
    background: var(--surface-2); color: var(--text);
    transition: background .2s;
}
.btn--primary   { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn--secondary:hover { background: var(--surface-hover); }
.btn--danger    { background: var(--danger); color: var(--on-danger); }
.btn--danger:hover { background: var(--danger-hover); }
.btn--small { min-height: 2.5rem; padding: var(--space-2) var(--space-4); font-size: .95rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.inline-form { display: inline; margin: 0; }

/* ---------- Formularfelder ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.field > label, .field__label { font-weight: 600; }
.field__hint { color: var(--text-muted); font-size: .9rem; }
.field__error { color: var(--error-fg); font-size: .9rem; font-weight: 600; }

.input, select.input, textarea.input {
    width: 100%; min-height: 3rem;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-2); color: var(--text);
    border: 1px solid transparent; border-radius: var(--radius-sm);
    font: inherit;
}
.input::placeholder { color: var(--text-muted); }
textarea.input { min-height: 6rem; resize: vertical; }
.input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent); }
.input[aria-invalid="true"] { border-color: var(--error-fg); }

.check { display: flex; align-items: center; gap: var(--space-3); min-height: 2.75rem; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }

fieldset { border: 0; padding: 0; margin: 0 0 var(--space-4); min-width: 0; }
legend { font-weight: 600; margin-bottom: var(--space-2); }
fieldset .check {
    background: var(--surface-2); border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-4); justify-content: space-between; flex-direction: row-reverse;
}
fieldset .check + .check { margin-top: var(--space-2); }

details.disclosure > summary { cursor: pointer; font-weight: 600; padding: var(--space-2) 0; }
details.card { padding: 0; }
details.card > summary {
    cursor: pointer; list-style: none;
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-4) var(--space-5); min-height: 3.5rem; font-weight: 700; font-size: 1.1rem;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "▾"; color: var(--text-muted); margin-left: var(--space-2); }
details.card[open] > summary::after { content: "▴"; }
details.card > :not(summary) { padding: 0 var(--space-5) var(--space-5); }

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: var(--space-3) var(--space-4); text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* .table--stack: auf schmalen Bildschirmen wird jede Zeile ein Block; Spaltenname aus td[data-label] */
@media (max-width: 40rem) {
    .table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
    .table--stack tr { border-bottom: 1px solid var(--border); padding: var(--space-3) 0; }
    .table--stack tr:last-child { border-bottom: 0; }
    .table--stack td { border: 0; padding: var(--space-1) var(--space-4); }
    .table--stack td[data-label]::before {
        content: attr(data-label); display: block;
        font-size: .8rem; font-weight: 600; color: var(--text-muted);
    }
}

/* ---------- Hinweis-Banner ---------- */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    font-weight: 600; font-size: .95rem;
}
.alert--info    { background: var(--info-bg);    color: var(--info-fg); }
.alert--success { background: var(--success-bg); color: var(--success-fg); }
.alert--warning { background: var(--warning-bg); color: var(--warning-fg); }
.alert--error   { background: var(--error-bg);   color: var(--error-fg); }

/* ---------- Status-Abzeichen ---------- */
.badge {
    display: inline-block; padding: .15rem .65rem;
    border-radius: 999px; font-size: .8rem; font-weight: 600; line-height: 1.5;
    background: var(--surface-2); color: var(--text-muted);
    vertical-align: middle;
}
.badge--accent  { background: var(--accent);     color: var(--on-accent); }
.badge--success { background: var(--success-bg); color: var(--success-fg); }
.badge--warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge--danger  { background: var(--error-bg);   color: var(--error-fg); }

/* ---------- Kennzahl ---------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); }
.stat__label { color: var(--text-muted); font-weight: 600; font-size: .9rem; margin: 0 0 var(--space-1); }
.stat__value { font-size: clamp(1.6rem, 5vw, 2.25rem); font-weight: 800; line-height: 1.1; margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- Leerer Zustand ---------- */
.empty-state {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    background: var(--surface); border-radius: var(--radius-lg);
    color: var(--text-muted);
}
.empty-state__title { color: var(--text); font-weight: 700; font-size: 1.2rem; margin-bottom: var(--space-2); }
.empty-state .btn { margin-top: var(--space-3); }

/* ---------- Kacheln ---------- */
.tile-group + .tile-group { margin-top: var(--space-6); }
.tile-group__title { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: var(--space-3); }
.tiles {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: var(--space-3);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: var(--space-2); text-align: center;
    height: 100%; min-height: 8.5rem; padding: var(--space-4) var(--space-3);
    background: var(--surface); color: var(--text); text-decoration: none;
    border-radius: var(--radius); box-shadow: var(--shadow);
    transition: transform .2s, background .2s;
}
.tile:hover { transform: var(--lift); background: var(--surface-hover); }
.tile__icon, .tile__placeholder {
    flex: 0 0 auto; width: 3.75rem; height: 3.75rem;
    border-radius: 16px; object-fit: contain;
}
.tile__placeholder { display: block; }
/* Rasterbilder (oft weiß auf transparent, z. B. AMP, Admin) immer auf dunkler Unterlage */
.tile__icon--plate { background: #111827; padding: .45rem; }
.tile--hero { padding: 0; overflow: hidden; background: #111827; }
.tile--hero:hover { background: #182235; }
.tile__hero { width: 100%; height: 100%; min-height: 8.5rem; object-fit: contain; display: block; }
@media (min-width: 48rem) { .tile__hero { min-height: 6.9rem; } }
.tile__name { font-weight: 700; font-size: 1.05rem; line-height: 1.25; overflow-wrap: break-word; hyphens: auto; min-width: 0; max-width: 100%; }
@media (min-width: 48rem) {
    .tiles { gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
    .tile { flex-direction: row; justify-content: flex-start; text-align: left; gap: 1.1rem; min-height: 6.9rem; padding: 1.1rem; }
    .tile__name { font-size: 1.4rem; }
}

.search { margin-bottom: var(--space-5); max-width: 28rem; }
/* hidden-Attribut gewinnt immer (sonst zeigt z. B. .table--stack tr {display:block} gefilterte Zeilen) */
[hidden] { display: none !important; }

/* ---------- Seiten: Login / Fehler ---------- */
.auth-page { min-height: calc(100vh - 8rem); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: var(--space-4); }
.auth-page .card { width: 100%; max-width: 24rem; padding: 2.25rem; }
.auth-page h1 { text-align: center; }

.error-page { text-align: center; padding: var(--space-6) var(--space-4); }
.error-page__code { font-size: clamp(4rem, 18vw, 6rem); font-weight: 900; line-height: 1; color: var(--text-muted); margin-bottom: var(--space-3); }
