/* ==========================================================================
   Lager-Status – dunkle Abfahrtstafel für den Lager-Monitor
   Farben aus der Lagerwelt: Hi-Vis-Amber (Raus), Grün (Retour), Signalrot
   (Überfällig). Schrift: Barlow Condensed (Signaletik), Barlow (Text),
   IBM Plex Mono (Nummern/Daten).
   ========================================================================== */

/* --- Lokale Schriften (statt Google Fonts) ------------------------------ */

/* Barlow 400 latin-ext */
@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('files/fonts/barlow-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Barlow 400 latin */
@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('files/fonts/barlow-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Barlow 500 latin-ext */
@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('files/fonts/barlow-500-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Barlow 500 latin */
@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('files/fonts/barlow-500-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Barlow 600 latin-ext */
@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('files/fonts/barlow-600-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Barlow 600 latin */
@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('files/fonts/barlow-600-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Barlow Condensed 500 latin-ext */
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('files/fonts/barlow-condensed-500-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Barlow Condensed 500 latin */
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('files/fonts/barlow-condensed-500-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Barlow Condensed 600 latin-ext */
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('files/fonts/barlow-condensed-600-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Barlow Condensed 600 latin */
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('files/fonts/barlow-condensed-600-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Barlow Condensed 700 latin-ext */
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('files/fonts/barlow-condensed-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Barlow Condensed 700 latin */
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('files/fonts/barlow-condensed-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* IBM Plex Mono 400 latin-ext */
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('files/fonts/ibm-plex-mono-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* IBM Plex Mono 400 latin */
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('files/fonts/ibm-plex-mono-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* IBM Plex Mono 500 latin-ext */
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('files/fonts/ibm-plex-mono-500-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* IBM Plex Mono 500 latin */
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('files/fonts/ibm-plex-mono-500-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* IBM Plex Mono 600 latin-ext */
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('files/fonts/ibm-plex-mono-600-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* IBM Plex Mono 600 latin */
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('files/fonts/ibm-plex-mono-600-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg: #14181d;
    --surface: #1c2229;
    --surface-raised: #222a33;
    --line: #2a323b;
    --text: #e8ecef;
    --muted: #8b98a5;
    --out: #f5a623;
    --return: #3ecf8e;
    --overdue: #e5484d;
    --overdue-bg: rgba(229, 72, 77, 0.10);
    --done-bg: rgba(62, 207, 142, 0.10);
    --done-tag: #4d9fec;
    --alarm: #ff6b1a;
    --alarm-frame: #ff6b1a;
    --alarm-frame-width: 8px;

    --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    --font-body: 'Barlow', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', Menlo, monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px 28px 48px;
}

/* --- Kopfzeile ----------------------------------------------------------- */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    height: 42px;
    width: auto;
}

.header h1 {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.day-select,
.zoom-controls {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
}

.btn-day,
.btn-zoom {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
    background: transparent;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.btn-zoom {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: none;
    padding: 8px 10px;
}

.btn-day + .btn-day,
.btn-zoom + .btn-zoom {
    border-left: 1px solid var(--line);
}

.btn-day:hover,
.btn-zoom:hover {
    color: var(--text);
}

.btn-day.active {
    color: #14181d;
    background: var(--out);
}

.zoom-value {
    min-width: 52px;
}

.btn-zoom:disabled {
    opacity: 0.35;
    cursor: default;
}

.last-update {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}

.btn-toggle {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.btn-toggle:hover {
    color: var(--text);
}

.btn-toggle.active {
    color: #14181d;
    background: var(--return);
    border-color: var(--return);
}

.reload-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.reload-select select {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
}

.btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-refresh:hover {
    background: var(--surface-raised);
    border-color: var(--muted);
}

/* --- Zählerkarten -------------------------------------------------------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.stat-number {
    font-family: var(--font-mono);
    font-size: 30px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-card .stat-number { color: var(--cat, var(--text)); }
.stat-overdue .stat-number { color: var(--overdue); }

/* --- Meldungen ----------------------------------------------------------- */

.error-message {
    background: var(--overdue-bg);
    border: 1px solid var(--overdue);
    color: #f4b7b9;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
}

.stale-note {
    background: rgba(245, 166, 35, 0.10);
    border: 1px solid var(--out);
    color: #f0cf9a;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* --- Tabelle ------------------------------------------------------------- */

.board {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow-x: auto;
}

.movements {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.movements th {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.movements td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    font-size: 15px;
}

.movements tbody tr:last-child td {
    border-bottom: none;
}

.cell-message {
    text-align: center;
    color: var(--muted);
    padding: 36px 16px !important;
    font-size: 15px;
}

/* Tagesgruppen-Zeilen */
.group-row td {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
    background: var(--surface-raised);
    padding: 8px 16px;
}

.group-overdue td {
    color: var(--overdue);
    /* Warnband: diagonale Schraffur wie Absperrband */
    background:
        repeating-linear-gradient(
            -45deg,
            rgba(229, 72, 77, 0.14) 0 10px,
            transparent 10px 20px
        ),
        var(--surface-raised);
}

/* Überfällige Zeilen */
.row-overdue td {
    background: var(--overdue-bg);
}

.row-overdue .col-number {
    box-shadow: inset 4px 0 0 var(--overdue);
}

/* Abgeschlossen-Gruppe: zurück im Lager, kompakte Info-Zeilen */
.group-pinned td {
    color: var(--cat, var(--return));
    background:
        repeating-linear-gradient(
            -45deg,
            color-mix(in srgb, var(--cat, #3ecf8e) 12%, transparent) 0 10px,
            transparent 10px 20px
        ),
        var(--surface-raised);
}

/* Gleicher Stil wie Überfällig, nur in Grün */
.row-pinned td {
    background: color-mix(in srgb, var(--cat, #3ecf8e) 12%, transparent);
}

.row-pinned .col-number {
    box-shadow: inset 4px 0 0 var(--cat, var(--return));
}

.pinned-relative {
    color: var(--cat, var(--return));
    font-weight: 600;
}

/* Spalten */
.col-number {
    font-family: var(--font-mono);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    white-space: nowrap;
    width: 90px;
}

/* Jobnummer als Link zum Rentman-Projekt */
.number-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--muted);
}

.number-link:hover {
    color: var(--text);
    border-bottom-color: var(--text);
}

.col-name .job-name {
    display: block;
    font-weight: 600;
    font-size: 16px;
}

.col-name .job-period {
    display: block;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.col-name .job-parent {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    margin-top: 2px;
}

.sub-badge {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 8px;
    vertical-align: 1px;
}

/* Countdown-Chip in der Datumsspalte */
.countdown {
    display: block;
    font-family: var(--font-mono);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--out);
    margin-top: 3px;
}

.countdown.countdown-past {
    color: var(--overdue);
}

body.countdown-off .countdown {
    display: none;
}

/* Rüst-Alarm: Lauflicht um die Zeile (aktiv), ruhiger Rand danach */
.row-alarm td {
    background-image:
        linear-gradient(90deg, var(--alarm) 50%, transparent 50%),
        linear-gradient(90deg, var(--alarm) 50%, transparent 50%);
    background-size: 16px 2px, 16px 2px;
    background-repeat: repeat-x;
    background-position: 0 0, 0 100%;
    animation: alarm-march 0.6s linear infinite;
}

.row-alarm td:first-child { box-shadow: inset 2px 0 0 var(--alarm); }
.row-alarm td:last-child { box-shadow: inset -2px 0 0 var(--alarm); }

@keyframes alarm-march {
    to { background-position: 16px 0, -16px 100%; }
}

.row-alarm-calm td {
    box-shadow: inset 0 2px 0 var(--alarm), inset 0 -2px 0 var(--alarm);
}

.row-alarm-calm td:first-child {
    box-shadow: inset 2px 0 0 var(--alarm), inset 0 2px 0 var(--alarm), inset 0 -2px 0 var(--alarm);
}

.row-alarm-calm td:last-child {
    box-shadow: inset -2px 0 0 var(--alarm), inset 0 2px 0 var(--alarm), inset 0 -2px 0 var(--alarm);
}

.row-alarm .countdown,
.row-alarm-calm .countdown {
    color: var(--alarm);
    font-weight: 600;
}

/* Bildschirmrand: Lauflicht im Uhrzeigersinn, solange ein Alarm aktiv ist.
   Farbe und Dicke aus den Einstellungen, Strichlänge = 4 × Dicke. */
body.alarm-active::before {
    --w: var(--alarm-frame-width);
    --d: calc(var(--alarm-frame-width) * 4);
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    background:
        linear-gradient(90deg, var(--alarm-frame) 50%, transparent 50%) 0 0 / var(--d) var(--w) repeat-x,
        linear-gradient(90deg, var(--alarm-frame) 50%, transparent 50%) 0 100% / var(--d) var(--w) repeat-x,
        linear-gradient(0deg, var(--alarm-frame) 50%, transparent 50%) 0 0 / var(--w) var(--d) repeat-y,
        linear-gradient(0deg, var(--alarm-frame) 50%, transparent 50%) 100% 0 / var(--w) var(--d) repeat-y;
    animation: alarm-screen 0.9s linear infinite;
}

@keyframes alarm-screen {
    to { background-position: var(--d) 0, calc(-1 * var(--d)) 100%, 0 calc(-1 * var(--d)), 100% var(--d); }
}

.col-direction {
    width: 130px;
}

.col-date {
    font-family: var(--font-mono);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    width: 240px;
}

.date-time {
    color: var(--muted);
    margin-left: 6px;
}

.date-relative {
    display: inline-block;
    margin-left: 8px;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--muted);
}

.overdue-relative {
    color: var(--overdue);
    font-weight: 600;
}

.col-status {
    width: 190px;
    white-space: nowrap;
}

/* --- Richtungs-Tags (Frachtlabel mit Pfeilform) -------------------------- */

.tag {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #14181d;
    padding: 4px 10px;
    line-height: 1.2;
}

.tag {
    background: var(--cat, var(--muted));
}

/* Startdatum: Pfeil nach rechts (raus aus dem Lager) */
.tag-start {
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%);
    padding-right: 16px;
}

/* Enddatum: Pfeil nach links (zurück ins Lager) */
.tag-end {
    clip-path: polygon(9px 0, 100% 0, 100% 100%, 9px 100%, 0 50%);
    padding-left: 16px;
}

.tag-pinned {
    border-radius: 4px;
}

/* --- Status-Badges ------------------------------------------------------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.status::before {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--cat, var(--muted));
    flex-shrink: 0;
}

/* --- Footer -------------------------------------------------------------- */

.footer {
    margin-top: 24px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}

.footer a {
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}

.footer a:hover {
    color: var(--text);
}

/* --- Icons --------------------------------------------------------------- */

.icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    vertical-align: -3px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--out);
}

.header-home {
    display: flex;
    color: inherit;
}

/* Zusatzzeile: Kunde · Owner · Fahrzeuge */
.col-name .job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    margin-top: 3px;
}

.job-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.job-meta .icon {
    width: 14px;
    height: 14px;
    vertical-align: 0;
}

/* --- Benutzer-Menü ------------------------------------------------------- */

.user-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.button:hover {
    border-color: var(--muted);
}

.button-ghost {
    background: transparent;
}

.button-primary {
    background: var(--out);
    border-color: var(--out);
    color: #14181d;
}

.button-primary:hover {
    background: #ffb94a;
}

.button-danger {
    color: var(--overdue);
    border-color: rgba(229, 72, 77, 0.45);
    background: transparent;
}

.button-danger:hover {
    border-color: var(--overdue);
}

.button-small {
    font-size: 13px;
    padding: 5px 10px;
}

/* --- Formular-Seiten (Login, Setup, Profil, Admin) ----------------------- */

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 28px 48px;
}

.page-auth {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 16px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-card h1,
.card h2 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.auth-card h1 {
    font-size: 30px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 20px 22px;
    margin-bottom: 18px;
}

.card h2 {
    font-size: 20px;
    margin-bottom: 14px;
}

.card p.hint {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 14px;
}

.release-notes {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 14px;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px 14px;
    max-height: 320px;
    overflow: auto;
    margin-bottom: 16px;
}

.update-disclaimer {
    display: grid;
    gap: 10px;
    border: 2px solid var(--out);
    border-radius: 8px;
    padding: 16px 18px;
    font-size: 15px;
}

.update-disclaimer a {
    color: var(--text);
    text-decoration: underline;
}

.update-disclaimer > p .icon {
    color: var(--out);
    vertical-align: -3px;
}

.update-source {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    word-break: break-all;
}

.form {
    display: grid;
    gap: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    align-items: end;
}

.field {
    display: grid;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
}

.field small {
    font-weight: 400;
    color: var(--muted);
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="url"],
.field select {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 11px;
    width: 100%;
}

.field input:focus,
.field select:focus {
    outline: 2px solid var(--out);
    outline-offset: 1px;
}

.input-affix {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 400;
    color: var(--muted);
}
.input-affix input[type="text"] { flex: 1; min-width: 0; }

.field input[type="file"] { font-family: var(--font-body); font-size: 14px; color: var(--text); }
.field input[type="color"] {
    width: 64px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.check input {
    width: 18px;
    height: 18px;
    accent-color: var(--out);
}

.code-input {
    font-family: var(--font-mono) !important;
    font-size: 24px !important;
    letter-spacing: 0.3em;
    text-align: center;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.qr {
    background: #fff;
    border-radius: 8px;
    padding: 8px;
    width: 196px;
    height: 196px;
}

.qr svg {
    width: 100%;
    height: 100%;
}

.secret {
    font-family: var(--font-mono);
    font-size: 14px;
    word-break: break-all;
    color: var(--muted);
}

/* --- Meldungen ----------------------------------------------------------- */

.flash {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 14px;
}

.flash-ok {
    background: rgba(62, 207, 142, 0.10);
    border: 1px solid var(--return);
    color: #b5ecd2;
}

.flash-error {
    background: var(--overdue-bg);
    border: 1px solid var(--overdue);
    color: #f4b7b9;
}

/* --- Admin --------------------------------------------------------------- */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    overflow-x: auto;
}

.tabs a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    padding: 10px 14px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .tabs a { font-size: 15px; padding: 10px 7px; gap: 5px; letter-spacing: 0.03em; }
    .tabs a .icon { display: none; }
}

.tabs a.active {
    color: var(--text);
    border-bottom-color: var(--out);
}

.table-admin {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table-admin th {
    text-align: left;
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
}

.table-admin td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table-wrap {
    overflow-x: auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2px 7px;
    color: var(--muted);
}

.badge-ok {
    color: var(--return);
    border-color: rgba(62, 207, 142, 0.45);
}

.badge-warn {
    color: var(--out);
    border-color: rgba(245, 166, 35, 0.45);
}

.swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--cat);
    vertical-align: -2px;
    margin-right: 6px;
}

.demo-note {
    background: rgba(77, 159, 236, 0.10);
    border: 1px solid #4d9fec;
    color: #bcd9f6;
    border-radius: 6px;
    padding: 8px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 900px) {
    .container {
        padding: 16px 12px 32px;
    }

    .header h1 {
        font-size: 24px;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .page {
        padding: 16px 12px 32px;
    }

    .user-menu .button {
        padding: 6px 10px;
    }

    .stat-number {
        font-size: 24px;
    }
}

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

    .row-alarm td,
    body.alarm-active::before {
        animation: none;
    }
}
