:root {
    /* LabX-Markenfarben (aus dem Logo) */
    --brand: #e86008;          /* Orange – nur noch DEKORATIV (Akzentleiste, aktive
                                  Unterstreichung). Als SCHIFT auf hell fällt es
                                  durch WCAG-Kontrast (3,2:1) – dafür --link nutzen. */
    --brand-dark: #c85207;
    --brand-soft: #fdeee2;     /* heller Orange-Ton für Flächen/Badges */
    --link: #b8470a;           /* Orange-Text auf hell, ≥4,5:1 (WCAG 1.4.3) */
    --btn: #a84406;            /* Primär-Button-Füllung, Weiß darauf ≥4,5:1 */
    --btn-hover: #8f3906;
    --blue: #88a8d8;           /* Hellblau – Zahnräder */
    --blue-dark: #4a6ba8;      /* file-ext-Füllung, Weiß darauf ≥4,5:1 */
    --blue-soft: #eef3fb;

    --bg: #f4f6f8;
    --card: #ffffff;
    --ink: #1f2933;
    --muted: #5b6470;          /* Hilfetext/Tabellenkopf, ≥4,5:1 auf bg/white */
    --border: #e5e7eb;         /* dekorative Trennlinien (Karten, Tabellen) */
    --border-strong: #828a95;  /* interaktive UI-Begrenzungen, ≥3:1 (WCAG 1.4.11) */

    /* Fokus-Ring (2.4.7): 2 px Marke mit hellem Spalt, ≥3:1 zur Umgebung */
    --focus-ring: #6b2a08;

    /* Akzent = Marke (für vorhandene Klassen) */
    --accent: var(--brand);
    --accent-dark: var(--brand-dark);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

h1 { font-size: 1.7rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }

/* ---- Marken-Akzentleiste ganz oben ---- */
.accent-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand) 62%, var(--blue) 62%, var(--blue) 100%);
}

/* ---- Topbar ---- */
.topbar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.7rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; }
.brand-logo { height: 40px; width: auto; display: block; }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.topbar nav a { color: #374151; font-weight: 500; position: relative; }
.topbar nav a:hover { color: var(--link); text-decoration: none; }
.topbar nav a.active { color: var(--link); }
.topbar nav a.active::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -7px;
    height: 2px; background: var(--brand); border-radius: 2px;
}
.topbar .user { color: var(--muted); font-size: 0.9rem; display: inline-flex; align-items: center; gap: 0.4rem; }

/* Sprachumschalter (DE / EN) */
.lang-switch {
    display: inline-flex; gap: 2px; margin-left: 0.3rem; padding: 2px;
    background: #f3f4f6; border: 1px solid var(--border); border-radius: 999px;
}
.lang-switch .lang-opt {
    background: none; border: none; cursor: pointer; font: inherit;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em;
    color: var(--muted); padding: 0.2rem 0.55rem; border-radius: 999px;
    min-height: 24px;       /* WCAG 2.5.8 Mindest-Zielgröße */
}
.lang-switch .lang-opt:hover { color: var(--link); }
.lang-switch .lang-opt.active { background: var(--btn); color: #fff; cursor: default; }
.topbar form.inline { margin: 0; }
.linklike {
    background: none; border: none; color: #374151; cursor: pointer;
    font: inherit; font-weight: 500; padding: 0;
}
.linklike:hover { color: var(--link); }

/* ---- Layout ---- */
.container { width: 100%; max-width: 980px; margin: 2rem auto; padding: 0 1.5rem; flex: 1; }

/* ---- Footer ---- */
.footer { background: #1f2933; color: #c7cdd4; margin-top: 3rem; }
.footer-inner {
    max-width: 980px; margin: 0 auto; padding: 1.6rem 1.5rem;
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.footer-logo { height: 42px; width: auto; opacity: 0.95; }
.footer-meta { font-size: 0.85rem; line-height: 1.6; }
.footer-meta p { margin: 0; }
.footer-meta a { color: var(--blue); }
.footer-meta a:hover { color: #fff; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin-top: 2.25rem; gap: 1rem; }
.detail-head { display: flex; align-items: center; gap: 1rem; }

/* ---- Hero (Auth-Seiten / Startbereich) ---- */
.auth-logo { display: block; height: 56px; width: auto; margin: 0 auto 1.25rem; }

/* Begrüßungs-Banner auf der Kundensicht */
.hero {
    background:
        radial-gradient(circle at 100% 0%, rgba(136, 168, 216, 0.35), transparent 46%),
        linear-gradient(135deg, #b8470a 0%, #8f3608 100%);
    color: #fff;
    border-radius: 14px;
    padding: 2.25rem 2.25rem;
    margin: 0.5rem 0 1.75rem;
    box-shadow: 0 8px 22px rgba(232, 96, 8, 0.18);
}
.hero h1 { color: #fff; margin: 0 0 0.5rem; font-size: 1.9rem; }
.hero p { color: #fff; margin: 0 0 1.4rem; max-width: 56ch; }
.btn.hero-btn { background: #fff; color: var(--link) !important; }
.btn.hero-btn:hover { background: #f3f4f6; }

/* ---- Cards & forms ---- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.6rem;
    margin: 1rem 0;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.card.narrow { max-width: 430px; margin: 2.5rem auto; }

form p { margin: 0 0 1rem; }
label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.9rem; }
input, select, textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(232, 96, 8, 0.15);
}
.helptext { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; margin-top: 0.2rem; }
ul.errorlist { color: #b91c1c; list-style: none; padding: 0; margin: 0.2rem 0; font-size: 0.85rem; }

/* ---- Buttons ---- */
.btn, button.btn {
    display: inline-block; background: var(--btn); color: #fff;
    padding: 0.65rem 1.2rem; border: none; border-radius: 8px;
    font: inherit; font-weight: 600; cursor: pointer;
    transition: background 0.15s;
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn-secondary {
    display: inline-block; padding: 0.65rem 1.2rem; margin-left: 0.5rem;
    border: 1px solid var(--border-strong); border-radius: 8px; color: var(--ink); background: #fff;
}
.btn-secondary:hover { background: #f3f4f6; text-decoration: none; }
.btn-small {
    display: inline-block; background: var(--btn); color: #fff !important;
    padding: 0.4rem 0.8rem; border-radius: 8px; font-size: 0.85rem; font-weight: 600;
    transition: background 0.15s;
}
.btn-small:hover { background: var(--btn-hover); text-decoration: none; }

/* ---- Stats ---- */
.stats { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.5rem 0; }
.stat {
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 1.1rem 1.3rem; min-width: 140px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    border-top: 3px solid var(--blue);
}
.stat .num { display: block; font-size: 1.9rem; font-weight: 700; color: var(--link); line-height: 1.1; }

/* ---- Tables ---- */
table.orders { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
table.orders th, table.orders td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
table.orders th { background: #f9fafb; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
table.orders tbody tr:hover { background: #fafbfc; }
table.orders tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge {
    display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
    font-size: 0.78rem; font-weight: 600; background: #e5e7eb; color: #374151;
}
.st-new { background: #dbeafe; color: #1e40af; }
.st-review { background: #fef3c7; color: #92400e; }
.st-progress { background: #e0e7ff; color: #3730a3; }
.st-ready { background: #d1fae5; color: #065f46; }
.st-done { background: #d1d5db; color: #374151; }
.st-rejected { background: #fee2e2; color: #991b1b; }

/* Team-Badge in der Topbar in Markenfarbe */
.topbar .badge { background: var(--brand-soft); color: var(--link); }

/* ---- Detail meta ---- */
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.2rem; margin: 0 0 1rem; }
dl.meta dt { font-weight: 600; color: var(--muted); }
dl.meta dd { margin: 0; }

/* ---- Files ---- */
ul.files { list-style: none; padding: 0; margin: 0; }
ul.files li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
ul.files li:last-child { border-bottom: none; }
.file-ext {
    display: inline-block; min-width: 3rem; text-align: center; font-size: 0.7rem;
    font-weight: 700; padding: 0.2rem 0.4rem; border-radius: 4px;
    background: var(--blue-dark); color: #fff;
}

/* ---- Filters ---- */
.filters { display: flex; align-items: flex-end; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }
.filter-field { display: flex; flex-direction: column; gap: 0.2rem; }
.filters label { margin: 0; }
.filters select { width: auto; }

/* ---- Messages ---- */
ul.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.msg { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 0.5rem; border-left: 4px solid transparent; }
.msg.success { background: #d1fae5; color: #065f46; border-left-color: #059669; }
.msg.error { background: #fee2e2; color: #991b1b; border-left-color: #dc2626; }
.msg.info { background: var(--blue-soft); color: #1e40af; border-left-color: var(--blue-dark); }

.muted { color: var(--muted); }
.empty { font-style: italic; }
.error { color: #b91c1c; }

/* Datei "entfernen"-Button in der Bearbeiten-Ansicht */
.inline-delete { display: inline; margin: 0 0 0 0.4rem; }
.linklike-danger {
    background: none; border: none; color: #b91c1c; cursor: pointer;
    font: inherit; font-size: 0.85rem; padding: 0; text-decoration: underline;
}
.linklike-danger:hover { color: #7f1d1d; }
.actions { display: flex; align-items: center; gap: 0.8rem; margin: 0.5rem 0 1rem; }
.lock { background: var(--brand-soft); border: 1px solid #fbcfa8; padding: 0.6rem 0.9rem; border-radius: 8px; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .topbar { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
    .topbar nav { margin-left: 0; }
    .container { margin: 1.25rem auto; }
}

/* ---- Barrierefreiheit ------------------------------------------------- */

/* Skip-Link (WCAG 2.4.1): erst bei Fokus sichtbar. */
.skip-link {
    position: absolute;
    left: 0.5rem;
    top: -3rem;
    z-index: 1000;
    background: var(--btn);
    color: #fff;
    padding: 0.5rem 0.9rem;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.15s;
}
.skip-link:focus {
    top: 0;
}

/* Einheitliche sichtbare Fokus-Hervorhebung (WCAG 2.4.7 / 2.4.11).
   Zweischichtiger Ring (innen weiß, außen dunkel): keine Einzelfarbe hält
   3:1 auf allen Untergründen (hell, Orange-Button, dunkler Footer) – die
   Kombination ist überall sichtbar. :focus-visible zeigt den Ring nur bei
   Tastaturbedarf, nicht bei Mausklicks. */
a:focus-visible,
.btn:focus-visible,
button:focus-visible,
.linklike:focus-visible,
.linklike-danger:focus-visible,
.lang-opt:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--focus-ring);
    border-radius: 4px;
}

/* Reduzierte Bewegung respektieren (WCAG 2.3.3 / Präferenz). */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
    html {
        scroll-behavior: auto !important;
    }
}
