/*
 * Karacast — ein Satz Regeln für beide Hälften des Panels.
 *
 * Die Verkaufsseiten und die Verwaltung liefen bisher mit zwei getrennten
 * Stilvorlagen, und das sah man: zwei Blautöne, zwei Schriftgrößen für dasselbe,
 * zwei Sorten Knöpfe. Ab hier gibt es einen Satz Werte, und beide Seiten bedienen
 * sich daraus.
 *
 * Herkunft der Entscheidungen: Struktur, Abstandsskala, Typografie und die
 * Zugänglichkeitsregeln stammen aus dem UI/UX-Pro-Max-Design-System (Stil
 * „Minimalism & Swiss“, Schriftpaar Outfit + Work Sans). Die Farben nicht — die
 * sind aus Theme.kt der App übernommen. Wer am Fernseher einen QR-Code scannt,
 * soll auf einer Seite landen, die sichtbar zum selben Produkt gehört.
 */

/* ------------------------------------------------------------------ Schriften
 * Selbst ausgeliefert, nicht von Google geladen: die Seite baut damit keine
 * Verbindung zu einem Dritten auf, über die jede Besucher-IP mitginge. Beide
 * Schriften stehen unter der SIL Open Font License (Lizenztexte liegen daneben).
 * `font-display: swap` — lieber sofort Text in einer Ersatzschrift als eine
 * halbe Sekunde leere Fläche.
 */
@font-face {
    font-family: 'Outfit'; font-style: normal; font-weight: 600; font-display: swap;
    src: url('fonts/outfit-latin-600-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Outfit'; font-style: normal; font-weight: 600; font-display: swap;
    src: url('fonts/outfit-latin-ext-600-normal.woff2') format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0;
}
@font-face {
    font-family: 'Outfit'; font-style: normal; font-weight: 700; font-display: swap;
    src: url('fonts/outfit-latin-700-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Outfit'; font-style: normal; font-weight: 700; font-display: swap;
    src: url('fonts/outfit-latin-ext-700-normal.woff2') format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0;
}
@font-face {
    font-family: 'Work Sans'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('fonts/work-sans-latin-400-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Work Sans'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('fonts/work-sans-latin-ext-400-normal.woff2') format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0;
}
@font-face {
    font-family: 'Work Sans'; font-style: normal; font-weight: 500; font-display: swap;
    src: url('fonts/work-sans-latin-500-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Work Sans'; font-style: normal; font-weight: 500; font-display: swap;
    src: url('fonts/work-sans-latin-ext-500-normal.woff2') format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0;
}
@font-face {
    font-family: 'Work Sans'; font-style: normal; font-weight: 600; font-display: swap;
    src: url('fonts/work-sans-latin-600-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Work Sans'; font-style: normal; font-weight: 600; font-display: swap;
    src: url('fonts/work-sans-latin-ext-600-normal.woff2') format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0;
}

:root {
    /* ------------------------------------------------------------- Farben
     * Eins zu eins aus Theme.kt der App. Geprüfter Kontrast gegen den
     * Hintergrund: Text 15,6:1, gedämpfter Text 7,1:1, Orange 8,2:1 — alles
     * über den geforderten 4,5:1, auch für die kleinen Schriftgrade.
     */
    --bg:            #0A0C14;
    --surface:       #161A26;
    --surface-high:  #20263A;
    --border:        #2C3348;
    --border-strong: #3F4761;
    --text:          #F2F4F8;
    --muted:         #9AA3B8;
    --accent:        #FF7A00;
    --accent-soft:   #FFBA3C;
    --on-accent:     #101010;
    --ok:            #3DDC84;
    --danger:        #FF5A5A;

    /* --------------------------------------------------------- Abstände
     * Eine Skala, keine gewürfelten Werte. „Standard“-Dichte aus dem
     * Design-System: 4 → 64. Wer einen Zwischenwert braucht, nimmt den
     * nächstgelegenen — nicht einen neuen.
     */
    --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
    --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

    /* ------------------------------------------------------- Schriftgrade
     * Basis 16px, Zeilenhöhe 1,6 im Fließtext. Überschriften wachsen mit der
     * Fensterbreite (clamp), damit auf dem Telefon nichts umbricht, was auf
     * dem Bildschirm gut aussah.
     */
    --t-xs: 13px; --t-sm: 14px; --t-md: 16px; --t-lg: 18px;
    --t-h3: clamp(18px, 2.2vw, 21px);
    --t-h2: clamp(22px, 3vw, 30px);
    --t-h1: clamp(30px, 5.2vw, 52px);

    --radius:    14px;
    --radius-sm: 10px;
    --radius-pill: 999px;

    --ring: 0 0 0 3px rgba(255,122,0,.45);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);

    /* Eine Dauer für kleine Zustandswechsel, eine für Bewegung im Raum.
       Nicht überall dieselbe — das ist der häufigste Animationsfehler. */
    --t-fast: 150ms;
    --t-base: 250ms;
}
* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: var(--t-md)/1.65 'Work Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
    font-family: 'Outfit', 'Work Sans', system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.15;
    /* Verhindert die einsame letzte Silbe in einer eigenen Zeile. */
    text-wrap: balance;
}
h1 { font-size: var(--t-h1); margin: 0 0 var(--s-4); }
h2 { font-size: var(--t-h2); margin: 0 0 var(--s-3); }
h3 { font-size: var(--t-h3); margin: 0 0 var(--s-2); font-weight: 600; }
p  { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-soft); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.dim   { color: var(--muted); }
.lead  { font-size: var(--t-lg); color: var(--muted); max-width: 62ch; }
.mono  { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; overflow-wrap: anywhere; }
code   { background: var(--surface-high); padding: 2px 6px; border-radius: 6px; font-size: var(--t-sm); overflow-wrap: anywhere; }
.small { font-size: var(--t-sm); }

/* --------------------------------------------------------------- Fokus
 * Der Rahmen um das gerade angesteuerte Element wird nie entfernt, sondern
 * sichtbarer gemacht. Wer mit der Tastatur bedient, sieht sonst nicht, wo er
 * ist — und das ist kein Randfall, sondern die halbe Zugänglichkeit.
 */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Sprungmarke: erste Station der Tastaturbedienung, sichtbar nur dann. */
.skip {
    position: absolute; left: -9999px; top: var(--s-2);
    background: var(--accent); color: var(--on-accent);
    padding: var(--s-2) var(--s-4); border-radius: var(--radius-sm); font-weight: 600; z-index: 100;
}
.skip:focus { left: var(--s-4); }

/* ------------------------------------------------------------- Bausteine */
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 var(--s-4); }
.wrap.narrow { max-width: 720px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--s-5);
}
.card + .card { margin-top: var(--s-4); }

.grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.row  { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: var(--s-4); }

/* Knöpfe: mindestens 44px hoch, damit sie am Telefon zuverlässig zu treffen
   sind — der meistübersehene Wert in dieser ganzen Datei. */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
    min-height: 44px; padding: var(--s-3) var(--s-5);
    border-radius: var(--radius-sm); border: 1px solid var(--accent);
    background: var(--accent); color: var(--on-accent);
    font: 600 var(--t-md)/1 'Work Sans', system-ui, sans-serif;
    text-decoration: none; cursor: pointer;
    transition: background var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-fast) ease;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--on-accent); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-high); border-color: var(--muted); color: var(--text); }
.btn.bad { background: var(--danger); border-color: var(--danger); color: #1a0505; }
.btn.bad:hover { background: #ff7a7a; border-color: #ff7a7a; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label { display: block; margin-bottom: var(--s-4); color: var(--muted); font-size: var(--t-sm); font-weight: 500; }

input[type=text], input[type=password], input[type=email], select, textarea {
    display: block; width: 100%; margin-top: var(--s-2);
    min-height: 44px; padding: var(--s-3);
    color: var(--text); background: var(--bg);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font: var(--t-md)/1.4 'Work Sans', system-ui, sans-serif;
    transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--t-lg); }
textarea { resize: vertical; min-height: 96px; }

.check { display: flex; gap: var(--s-3); align-items: flex-start; color: var(--text); font-size: var(--t-sm); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: 0 0 auto; }

.tag {
    display: inline-block; padding: var(--s-1) var(--s-3);
    border-radius: var(--radius-pill); font-size: var(--t-xs); font-weight: 600;
    border: 1px solid transparent;
}
.tag.active  { background: rgba(61,220,132,.14); color: var(--ok);         border-color: rgba(61,220,132,.3); }
.tag.trial   { background: rgba(255,186,60,.14); color: var(--accent-soft); border-color: rgba(255,186,60,.3); }
.tag.blocked { background: rgba(255,90,90,.14);  color: var(--danger);      border-color: rgba(255,90,90,.3); }

/* Meldungen. Farbe allein trägt die Bedeutung nie — davor steht ein Zeichen,
   damit sie auch ohne Farbwahrnehmung ankommt. */
.note { border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); border: 1px solid; }
.note::before { font-weight: 700; margin-right: var(--s-2); }
.note.ok  { background: rgba(61,220,132,.08); border-color: rgba(61,220,132,.35); color: var(--ok); }
.note.ok::before  { content: '✓'; }
.note.err { background: rgba(255,90,90,.08);  border-color: rgba(255,90,90,.35);  color: var(--danger); }
.note.err::before { content: '!'; }

table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: var(--t-xs);
     text-transform: uppercase; letter-spacing: .06em; padding: var(--s-2) var(--s-3); }
td { padding: var(--s-3); border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover td { background: rgba(255,255,255,.02); }

/* Auf schmalen Bildschirmen rollt eine Tabelle waagrecht in ihrem eigenen
   Kasten — nicht die ganze Seite. */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------- Bewegung
 * Sparsam und kurz, und für alle abschaltbar, die im Betriebssystem
 * „weniger Bewegung“ eingestellt haben. Das ist keine Nettigkeit: für
 * Menschen mit vestibulärer Störung verursacht Bewegung echte Übelkeit.
 */
@media (prefers-reduced-motion: no-preference) {
    .reveal { animation: reveal var(--t-base) ease-out both; }
    @keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
    .reveal:nth-child(2) { animation-delay: 60ms; }
    .reveal:nth-child(3) { animation-delay: 120ms; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
