/**
 * PhotoMagnet – ein Stylesheet für alles.
 *
 * Die Anwendung ist bewusst immer hell, auch wenn das Gerät im Dunkelmodus läuft.
 *
 * Zwei Gründe: Fotos wirken auf hellem Grund, und ein Gast auf einer Hochzeit erwartet
 * etwas Freundliches. Vor allem aber ist ein einziges, durchgestaltetes Erscheinungsbild
 * verlässlicher als zwei – jede Farbe, die man in einem der beiden Modi vergisst, wird
 * genau dort unlesbar. `color-scheme: light` sagt dem Browser ausdrücklich, dass er nichts
 * umdrehen soll; ohne diese Zeile faucht iOS die Formularfelder und Hintergründe eigenmächtig
 * dunkel.
 *
 * Mobile-first: Der Gast bedient die Seite auf dem Handy, der Betreiber am Laptop. Beide
 * bekommen dieselbe Formensprache.
 */

/* ---------------------------------------------------------------------------------------
   Farben und Maße
   --------------------------------------------------------------------------------------- */

:root {
    color-scheme: light;

    --brand: #4f46e5;
    --brand-hover: #4338ca;
    --brand-soft: #eef2ff;
    --on-brand: #fff;

    --bg: #f7f7f9;
    --surface: #fff;
    --surface-2: #f2f3f5;
    --text: #16181d;
    --text-muted: #6b7280;
    --line: #e4e6ea;

    --ok-bg: #ecfdf5;   --ok-text: #065f46;   --ok-line: #a7f3d0;
    --warn-bg: #fffbeb; --warn-text: #92400e; --warn-line: #fde68a;
    --err-bg: #fef2f2;  --err-text: #991b1b;  --err-line: #fecaca;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 4px 16px rgb(16 24 40 / 6%);
    --shadow-lg: 0 8px 32px rgb(16 24 40 / 10%);

    --step: 0.25rem;
}

/* ---------------------------------------------------------------------------------------
   Grundlagen
   --------------------------------------------------------------------------------------- */

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;

    /* Sonst zieht ein Wisch im Editor die ganze Seite mit. */
    overscroll-behavior-y: none;
}

h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 calc(var(--step) * 2); }
h2 { font-size: 1.15rem; font-weight: 650; margin: calc(var(--step) * 8) 0 calc(var(--step) * 3); }

p { margin: 0 0 calc(var(--step) * 4); }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.875em;
    background: var(--surface-2);
    padding: 0.15em 0.4em;
    border-radius: 6px;
}

hr { border: 0; border-top: 1px solid var(--line); margin: calc(var(--step) * 6) 0; }

/* Das hidden-Attribut muss auch dann greifen, wenn ein Element per Klasse ein eigenes display
   bekommt (etwa .btn--block). Ohne dieses !important bleiben so markierte Knöpfe sichtbar,
   obwohl JavaScript sie ausblendet – so tauchte der "Foto senden"-Knopf trotz JS auf. */
[hidden] { display: none !important; }

.muted { color: var(--text-muted); font-size: 0.875rem; }
.center { text-align: center; }
.stack > * + * { margin-top: calc(var(--step) * 4); }

/* Immer sichtbarer Fokusring – auf einer Feier bedient auch mal jemand mit Tastatur. */
:where(a, button, input, select, textarea):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ---------------------------------------------------------------------------------------
   Aufbau
   --------------------------------------------------------------------------------------- */

.app-header {
    display: flex;
    align-items: center;
    gap: calc(var(--step) * 4);
    padding: calc(var(--step) * 3) calc(var(--step) * 5);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header .brand {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}
.app-header .brand:hover { text-decoration: none; }

.app-header nav { display: flex; gap: calc(var(--step) * 4); font-size: 0.9375rem; }
.app-header .spacer { flex: 1; }

/* Auf dem Handy passen Marke, fünf Navigationspunkte, Name und Abmelden nicht nebeneinander.
 * Ohne Umbruch schob die Kopfleiste die ganze Seite auf 739 Pixel Breite – jede Betreiberseite
 * ließ sich seitlich wegschieben, auch die, deren Inhalt längst passte. */
@media (max-width: 52rem) {
    .app-header {
        flex-wrap: wrap;
        row-gap: calc(var(--step) * 2);
    }

    /* Die Navigation rutscht unter Marke und Abmelden und darf selbst umbrechen. */
    .app-header nav {
        order: 3;
        width: 100%;
        flex-wrap: wrap;
        column-gap: calc(var(--step) * 4);
        row-gap: calc(var(--step) * 1);
    }

    /* Der Name des Angemeldeten ist auf dem Handy verzichtbar – er steht auch auf der
       Kontoseite, die einen Fingertipp entfernt ist. Abmelden bleibt. */
    .app-header > a.muted { display: none; }
}

.page { padding: calc(var(--step) * 6) calc(var(--step) * 5); max-width: 64rem; margin: 0 auto; }
.page--narrow { max-width: 30rem; }

/* ---------------------------------------------------------------------------------------
   Karten
   --------------------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: calc(var(--step) * 5);
    box-shadow: var(--shadow);
    margin-bottom: calc(var(--step) * 4);
}

.card--flush { padding: 0; overflow: hidden; }
.card > :last-child { margin-bottom: 0; }

.card--done {
    background: var(--ok-bg);
    border-color: var(--ok-line);
    color: var(--ok-text);
}

/* ---------------------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: calc(var(--step) * 2);
    padding: 0.7rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: var(--on-brand);
    font: inherit;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .05s, opacity .15s;

    /* Auf dem Handy muss man ihn mit dem Daumen sicher treffen. */
    min-height: 44px;
}

.btn:hover { background: var(--brand-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn--ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}
.btn--ghost:hover { background: var(--surface-2); }

.btn--danger { background: #dc2626; color: #fff; }
.btn--danger:hover { background: #b91c1c; }

.btn--block { display: flex; width: 100%; }
.btn--sm { padding: 0.45rem 0.8rem; min-height: 36px; font-size: 0.875rem; }

/* Die zentrale Aktion der Gastseite: unübersehbar und mit dem Daumen sicher zu treffen. */
.btn--hero {
    padding: 1.15rem 1.1rem;
    min-height: 68px;
    font-size: 1.1875rem;
    gap: calc(var(--step) * 2.5);
    border-radius: var(--radius);
}
.btn--hero span[aria-hidden] { font-size: 1.5rem; line-height: 1; }

/* Sichtbare Quittung, sobald ein Foto gewählt ist: Der Knopf wird grün und trägt ein Häkchen. */
.btn--hero.is-selected,
.btn--hero.is-selected:hover {
    background: var(--ok-bg);
    color: var(--ok-text);
    border-color: var(--ok-line);
}

.btn-row { display: flex; flex-wrap: wrap; gap: calc(var(--step) * 2); }

/* Das echte Dateifeld liegt unsichtbar hinter dem großen Knopf, bleibt aber für die native
   Formularvalidierung fokussierbar (deshalb clip statt display:none). */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.upload-hint { margin-top: calc(var(--step) * 2); margin-bottom: 0; text-align: center; }

/* ---------------------------------------------------------------------------------------
   Formulare
   --------------------------------------------------------------------------------------- */

.field { margin-bottom: calc(var(--step) * 4); }
.field > label { display: block; font-size: 0.875rem; font-weight: 550; margin-bottom: calc(var(--step) * 1.5); }
.field .help { display: block; font-size: 0.8125rem; color: var(--text-muted); margin-top: calc(var(--step) * 1.5); }

.input, .select, .textarea {
    display: block;
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;

    /* Unter 16px zoomt iOS beim Antippen ins Feld hinein. */
    font-size: 16px;
    transition: border-color .15s, box-shadow .15s;
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.textarea { resize: vertical; min-height: 4.5rem; }

.select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                      linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.2rem;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 calc(var(--step) * 4); }
@media (max-width: 34rem) { .field-row { grid-template-columns: 1fr; } }

.check {
    display: flex;
    gap: calc(var(--step) * 2.5);
    align-items: flex-start;
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: calc(var(--step) * 3);
    cursor: pointer;
}
.check input { margin-top: .2rem; width: 1.05rem; height: 1.05rem; accent-color: var(--brand); flex: none; }

/* Mehrfachauswahl mit Vorschau – die Rahmen, die ein Event freigibt (Kapitel 6.5). */
.picks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: calc(var(--step) * 3);
}

.pick { position: relative; cursor: pointer; text-align: center; }
.pick[hidden] { display: none; }

.pick input {
    position: absolute;
    top: calc(var(--step) * 1.5);
    left: calc(var(--step) * 1.5);
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--brand);
    z-index: 1;
}

.pick__preview {
    display: block;
    aspect-ratio: 1;
    margin-bottom: calc(var(--step) * 1.5);
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);

    /* Karierter Grund: Ein Overlay ist überwiegend durchsichtig, auf Weiß wäre ein heller
       Rahmen unsichtbar. */
    background:
        linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%),
        linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%),
        var(--surface);
    background-size: 12px 12px;
    background-position: 0 0, 6px 6px;
    overflow: hidden;
}

.pick__preview img { width: 100%; height: 100%; object-fit: contain; display: block; }

.pick__name {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pick:has(input:checked) .pick__preview { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pick:has(input:checked) .pick__name { color: var(--text); font-weight: 600; }

input[type=file] {
    width: 100%;
    padding: calc(var(--step) * 3);
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: calc(var(--step) * 3);
}

/* ---------------------------------------------------------------------------------------
   Hinweise
   --------------------------------------------------------------------------------------- */

.notice {
    padding: calc(var(--step) * 3) calc(var(--step) * 4);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    margin-bottom: calc(var(--step) * 4);
    font-size: 0.9375rem;
}

.notice--ok   { background: var(--ok-bg);   color: var(--ok-text);   border-color: var(--ok-line); }
.notice--warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.notice--err  { background: var(--err-bg);  color: var(--err-text);  border-color: var(--err-line); }
.notice--info { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.notice ul { margin: 0; padding-left: 1.1rem; }

/* ---------------------------------------------------------------------------------------
   Badges und Kacheln
   --------------------------------------------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-muted);
    white-space: nowrap;
}

.badge--NEW, .badge--QUEUED   { background: var(--brand-soft); color: var(--brand); }
.badge--PRINTING              { background: var(--warn-bg); color: var(--warn-text); }
.badge--PRINTED,
.badge--COMPLETED             { background: var(--ok-bg); color: var(--ok-text); }
.badge--CANCELLED,
.badge--ERROR                 { background: var(--err-bg); color: var(--err-text); }

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: calc(var(--step) * 3);
    margin-bottom: calc(var(--step) * 5);
}

.tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: calc(var(--step) * 4);
    box-shadow: var(--shadow);
}
.tile .k { font-size: 0.8125rem; color: var(--text-muted); }
.tile .v { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }

/* ---------------------------------------------------------------------------------------
   Tabellen
   --------------------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

th, td {
    text-align: left;
    padding: calc(var(--step) * 3) calc(var(--step) * 3.5);
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--surface-2);
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }

/* Dichte Tabellen mit vielen Spalten (Kontenverwaltung: Name, E-Mail, Rolle, Passwort …).
 * Mit dem normalen Zellenabstand lief die Tabelle bei 64rem Seitenbreite über den Rand –
 * und weggeschoben wurde ausgerechnet die Knopfspalte, die dann abgeschnitten war. Der engere
 * seitliche Abstand holt die Breite zurück, ohne die Eingabefelder zu stauchen. Im Kartenlayout
 * (unter 52rem) gewinnt die spätere --cards-Regel und setzt den Abstand ohnehin auf 0. */
.table-wrap--dense th,
.table-wrap--dense td {
    padding-left: calc(var(--step) * 2);
    padding-right: calc(var(--step) * 2);
}

/* Tabellen auf schmalen Bildschirmen: aus jeder Zeile wird eine Karte.
 *
 * Vorher lief die Tabelle einfach seitlich aus dem Bild (overflow-x). Auf einem Telefon war
 * damit genau die Spalte unerreichbar, auf die es ankommt – die mit den Knöpfen. Wer am
 * Eventabend am Drucker steht, hat kein Tablet dabei, sondern sein Handy.
 *
 * Die Kopfzeile fällt weg; stattdessen trägt jede Zelle ihre Beschriftung selbst (data-label).
 * Zellen ohne data-label – die Knopfleisten – stehen ohne Beschriftung über die volle Breite.
 */
@media (max-width: 52rem) {
    .table-wrap--cards { overflow-x: visible; }

    .table-wrap--cards table {
        border: 0;
        background: none;
        box-shadow: none;
        border-radius: 0;
    }

    .table-wrap--cards thead { display: none; }

    .table-wrap--cards table,
    .table-wrap--cards tbody,
    .table-wrap--cards tr,
    .table-wrap--cards td {
        display: block;
        width: 100%;
    }

    .table-wrap--cards tr {
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        padding: calc(var(--step) * 2) calc(var(--step) * 3.5);
        margin-bottom: calc(var(--step) * 3);
    }

    .table-wrap--cards tbody tr:hover { background: var(--surface); }

    .table-wrap--cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: calc(var(--step) * 4);
        padding: calc(var(--step) * 2) 0;
        border-bottom: 1px solid var(--line);
        text-align: right;
    }

    .table-wrap--cards td::before {
        content: attr(data-label);
        flex: none;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
        text-align: left;
    }

    /* Zellen ohne Beschriftung sind die Knopfleisten: volle Breite, kein Rand darunter. */
    .table-wrap--cards td:not([data-label]) {
        display: block;
        text-align: left;
        border-bottom: 0;
        padding-top: calc(var(--step) * 3);
    }

    .table-wrap--cards td:not([data-label])::before { content: none; }

    .table-wrap--cards tbody tr td:last-child { border-bottom: 0; }

    /* Die Knöpfe brechen um, statt aus der Karte zu laufen, und sind mit dem Daumen zu treffen. */
    .table-wrap--cards td .btn-row {
        flex-wrap: wrap !important;
        gap: calc(var(--step) * 2);
    }

    .table-wrap--cards td .btn-row .btn,
    .table-wrap--cards td .btn-row form {
        flex: 1 1 auto;
        min-width: 6.5rem;
    }

    .table-wrap--cards td .btn-row form .btn { width: 100%; }

    /* Das Status-Auswahlfeld füllt seine Zelle. */
    .table-wrap--cards td .select { width: 100%; min-width: 0 !important; }
}

/* ---------------------------------------------------------------------------------------
   Kontingent
   --------------------------------------------------------------------------------------- */

.quota {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: calc(var(--step) * 4);
    margin-bottom: calc(var(--step) * 5);
    box-shadow: var(--shadow);
}

.quota--warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }
.quota--full { background: var(--err-bg);  border-color: var(--err-line);  color: var(--err-text); }

.bar {
    height: 0.5rem;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    margin: calc(var(--step) * 2) 0;
}
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s; }
.quota--warn .bar > i { background: #f59e0b; }
.quota--full .bar > i { background: #dc2626; }

/* ---------------------------------------------------------------------------------------
   Gast: Schritte, Editor, Status
   --------------------------------------------------------------------------------------- */

.steps {
    display: flex;
    gap: calc(var(--step) * 1.5);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: calc(var(--step) * 5);
    list-style: none;
    padding: 0;
}
.steps li { display: flex; align-items: center; gap: calc(var(--step) * 1.5); }
.steps li + li::before { content: "›"; color: var(--line); }
.steps .now { color: var(--brand); font-weight: 650; }

.progress { display: flex; gap: calc(var(--step) * 1.5); }
.progress i {
    flex: 1;
    height: 0.3rem;
    border-radius: 999px;
    background: var(--surface-2);
    transition: background .3s;
}
.progress i.on { background: var(--brand); }

.order-no {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.thumb {
    width: 100%;
    border-radius: var(--radius-sm);
    display: block;
    background: var(--surface-2);
}

/* Bewusst groß: Der Betreiber muss vor dem Druck eine Sichtprüfung vornehmen können
   (Kapitel 20 und 75.1). */
.thumb--queue {
    width: 112px;
    height: 112px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
    background: var(--surface-2);
}

#canvas {
    touch-action: none;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-2);
    display: block;
}

.hint { text-align: center; font-size: 0.9375rem; margin: calc(var(--step) * 3) 0; }
.hint--ok      { color: var(--ok-text); }
.hint--warn    { color: var(--warn-text); }
.hint--blocked { color: var(--err-text); font-weight: 600; }

/* Rahmenauswahl im Editor (Kapitel 6.5).
   Waagerecht scrollbar statt umgebrochen: Auf einem Telefon in Hochformat sollen die Kacheln
   groß genug bleiben, um den Rahmen wirklich zu erkennen. */
.frames {
    display: flex;
    gap: calc(var(--step) * 2);
    overflow-x: auto;
    padding-bottom: calc(var(--step) * 2);
    -webkit-overflow-scrolling: touch;
}

.frame {
    flex: 0 0 auto;
    width: 74px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font: inherit;
    color: var(--text-muted);
    text-align: center;
}

.frame__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    margin-bottom: calc(var(--step) * 1.5);
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);

    /* Ein Rahmen ist überwiegend durchsichtig. Auf Weiß sähe man von einem hellen Rahmen
       nichts – ein karierter Grund zeigt, was Bild bleibt und was der Rahmen bedeckt. */
    background:
        linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%),
        linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%),
        var(--surface);
    background-size: 12px 12px;
    background-position: 0 0, 6px 6px;
    overflow: hidden;
}

.frame__preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.frame__preview--none { font-size: 0.8125rem; color: var(--text-muted); }

.frame__name {
    display: block;
    font-size: 0.75rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.frame--chosen { color: var(--text); font-weight: 600; }
.frame--chosen .frame__preview { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.frame:focus-visible .frame__preview { outline: 2px solid var(--brand); outline-offset: 2px; }

.upload-status { font-size: 0.9375rem; margin: calc(var(--step) * 2.5) 0 0; }
.upload-status:empty { display: none; }
.upload-status.muted { color: var(--text-muted); }
.upload-status.ok    { color: var(--ok-text); }
.upload-status.warn  { color: var(--warn-text); }
.upload-status.err   { color: var(--err-text); font-weight: 600; }

/* ---------------------------------------------------------------------------------------
   Galerie
   --------------------------------------------------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: calc(var(--step) * 3);
}

.grid a {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    color: inherit;
    box-shadow: var(--shadow);
    transition: transform .1s, box-shadow .15s;
}
.grid a:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.grid img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.grid .meta { padding: calc(var(--step) * 2.5) calc(var(--step) * 3); }

.placeholder {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ---------------------------------------------------------------------------------------
   Pflichtangaben
   --------------------------------------------------------------------------------------- */

/* Impressum und Datenschutz müssen von jeder Seite erreichbar sein (Kapitel 76.4) – auch
   von der Eventseite, auf der der Gast sein Foto hochlädt. */
.legal-links {
    display: flex;
    justify-content: center;
    gap: calc(var(--step) * 2);
    margin-top: calc(var(--step) * 10);
    padding-top: calc(var(--step) * 4);
    border-top: 1px solid var(--line);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.legal-links a { color: var(--text-muted); }
.legal-links a:hover { color: var(--brand); }

/* ---------------------------------------------------------------------------------------
   Auswertung (Kapitel 51, 66.3)
   --------------------------------------------------------------------------------------- */

/* Die Zahlen, die zuerst interessieren – groß, ohne Diagramm drumherum. */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: calc(var(--step) * 3);
    margin-bottom: calc(var(--step) * 4);
}

.tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: calc(var(--step) * 4);
}

.tile__value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.tile__label {
    display: block;
    margin-top: calc(var(--step) * 1);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Zwei Serien, eine Achse. Zwei Skalen in einem Diagramm wären der häufigste Diagrammfehler
   überhaupt – Uploads und Magnete sind ohnehin dieselbe Einheit (Stück). */
.chart {
    display: flex;
    align-items: flex-end;
    gap: calc(var(--step) * 2);
    height: 190px;
    margin: calc(var(--step) * 4) 0 0;
    padding-bottom: 1.5rem;      /* Platz für die Stundenbeschriftung */
    overflow-x: auto;
}

.chart__col {
    flex: 1 1 0;
    min-width: 2.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
}

/* Die Grundlinie – zurückhaltend, sie ist Bezug und nicht Inhalt. */
.chart__bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;                     /* Fills berühren sich nie */
    height: 100%;
    border-bottom: 1px solid var(--line);
}

.bar {
    width: 42%;
    max-width: 1.1rem;
    min-height: 2px;              /* eine Null bleibt sichtbar als Nulllinie */
    border-radius: 4px 4px 0 0;   /* nur das Datenende ist gerundet */
    transition: filter .12s;
}

.bar:hover { filter: brightness(1.12); }

/* Geprüft mit dem Palette-Validator: Helligkeitsband, Chroma, Kontrast und CVD-Abstand
   (ΔE 130 bei Protanopie) alle bestanden. Nicht nach Gefühl gewählt. */
.bar--uploads { background: #4f46e5; }
.bar--magnete { background: #ea580c; }

.chart__tick {
    position: absolute;
    bottom: -1.4rem;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--step) * 4);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.legend__item { display: inline-flex; align-items: center; gap: calc(var(--step) * 1.5); }

.swatch {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 3px;
    flex: none;
}

.swatch--uploads { background: #4f46e5; }
.swatch--magnete { background: #ea580c; }
