/* ============================================================
   FixBuddy Buchhaltung — Dark Theme (FixBuddy-DNA)
   v5 (2026-08): komplette Neufassung auf Design-Tokens
   Tokens gespiegelt aus css/variables.css (Public-Seiten inlinen)
   ============================================================ */

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #151515;
    --bg-card: #1a1a1a;
    --bg-elevated: #2a2a2a;
    --accent: #b8935f;
    --accent-light: #D4AF7A;
    --accent-dark: #A5885A;
    --accent-glow: rgba(184, 147, 95, 0.15);
    --accent-gradient: linear-gradient(135deg, #D4AF7A 0%, #b8935f 50%, #A5885A 100%);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #666666;
    --border-color: #2A2A2A;
    --border-light: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(201, 169, 98, 0.3);
    --success: #43A047;
    --success-bg: rgba(67, 160, 71, 0.12);
    --warning: #FFA726;
    --warning-bg: rgba(255, 167, 38, 0.1);
    --danger: #E53935;
    --danger-bg: rgba(229, 57, 53, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4);
}

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

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100dvh;
    line-height: 1.6;
    font-size: 16px;
}

.container {
    max-width: 920px;
    margin: 0 auto;
    padding: 24px 16px 112px;   /* Platz für fixe Bottom-Nav */
}

/* ---------- Header ---------- */

.header {
    text-align: center;
    padding: 24px 0 8px;
    margin-bottom: 16px;
}

.header h1 {
    font-size: clamp(26px, 5vw, 36px);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.gold { color: var(--accent); }

.subtitle {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 15px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Tabs ---------- */

.tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 6px;
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 0 auto;
    min-height: 44px;
    padding: 10px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
}

.tab svg { flex-shrink: 0; }

.tab:hover { color: var(--text-primary); background: var(--bg-elevated); }

.tab.active {
    background: var(--accent-gradient);
    color: #141414;
    font-weight: 600;
}

/* ---------- Cards ---------- */

.tab-content { display: none; }
.tab-content.active { display: block; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}

.card h2 {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 12px;
}

.card h3 { font-size: 16px; font-weight: 600; }

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.card-header-row h2, .card-header-row h3 { margin-bottom: 0; }

.abschnitt-titel { margin-top: 24px; margin-bottom: 12px; }

.info-text { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; }
.info-text.center { text-align: center; margin-top: 12px; margin-bottom: 0; }

.info-text.warning {
    color: var(--warning);
    background: var(--warning-bg);
    border-left: 3px solid var(--warning);
    padding: 10px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ---------- Upload-Zonen ---------- */

.upload-area {
    border: 2px dashed var(--border-accent);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.upload-area p { color: var(--text-secondary); font-size: 14px; margin-top: 12px; }

.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.upload-icon { display: inline-block; }

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--success-bg);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.file-name { color: var(--text-primary); font-size: 14px; word-break: break-all; }

.btn-remove {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.btn-remove:hover { color: var(--danger); border-color: var(--danger); }

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

.hinweise-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 16px 18px;
    margin-bottom: 16px;
}

.hinweise-box h3 { font-size: 14px; margin-bottom: 10px; color: var(--accent-light); }

.hinweise-box ul { list-style: none; }

.hinweise-box li {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 3px 0 3px 16px;
    position: relative;
}

.hinweise-box li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.hinweise-box strong { color: var(--text-primary); }

.hinweis-klein { margin-top: 10px; font-size: 13px; color: var(--text-secondary); }

/* ---------- Stats ---------- */

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

.anlagen-stats { margin-bottom: 20px; }

.stat-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

.total-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--accent-glow);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-weight: 600;
}

.total-value { color: var(--accent-light); font-size: 18px; font-variant-numeric: tabular-nums; }

.kategorie-list { display: grid; gap: 6px; }

.kategorie-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
}

.kategorie-item .label { color: var(--text-secondary); }
.kategorie-item .value { color: var(--text-primary); font-variant-numeric: tabular-nums; font-weight: 500; }

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

input[type="text"], input[type="number"], input[type="date"], input[type="time"], select {
    width: 100%;
    min-height: 44px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-family: var(--font);
    font-size: 16px;
    transition: border-color 0.18s ease;
}

input::placeholder { color: var(--text-tertiary); }

input:focus, select:focus, button:focus-visible, .upload-area:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-color: var(--accent);
}

select { cursor: pointer; }

input[type="date"], input[type="time"] { color-scheme: dark; }

.vehicle-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.anlage-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

#jahrAuswahl { width: auto; min-width: 110px; font-weight: 600; color: var(--accent-light); }

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

.batch-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

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

.batch-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.batch-table td { padding: 6px 4px; border-bottom: 1px solid var(--border-color); }
.batch-table tr:last-child td { border-bottom: none; }

.batch-table input { min-height: 40px; font-size: 14px; min-width: 90px; }
.batch-table .route-input, .batch-table .zweck-input { min-width: 140px; }

.row-number { color: var(--text-tertiary); font-size: 13px; text-align: center; min-width: 28px; }

tr.row-error td { background: var(--danger-bg); }
tr.row-error input { border-color: var(--danger); }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.18s ease, color 0.18s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--accent-gradient);
    color: #141414;
}

.btn-primary:hover { box-shadow: 0 4px 16px var(--accent-glow); }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent-light); }

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover { background: var(--danger-bg); }

.btn-small { min-height: 38px; padding: 6px 14px; font-size: 13px; }
.btn-large { padding: 14px 28px; font-size: 16px; }

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-row.center { justify-content: center; }

/* ---------- Listen (Fahrten / Anlagen) ---------- */

.fahrten-liste, .anlagen-liste { display: grid; gap: 8px; }

.fahrt-item, .anlage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.fahrt-content, .anlage-details { flex: 1; min-width: 0; }

.fahrt-datum, .anlage-info { display: block; color: var(--text-tertiary); font-size: 12px; }
.fahrt-route, .anlage-bezeichnung { display: block; font-weight: 500; font-size: 14px; overflow-wrap: anywhere; }
.fahrt-details { display: block; color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }

.fahrt-betrag, .anlage-wert {
    color: var(--accent-light);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fahrt-delete {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: transparent;
    color: var(--text-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.fahrt-delete:hover { color: var(--danger); border-color: var(--danger); }

.empty-state {
    color: var(--text-tertiary);
    text-align: center;
    padding: 24px;
    font-size: 14px;
}

/* ---------- Checkliste ---------- */

.checklist { display: grid; gap: 8px; }

.check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 14px;
}

.check-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    background: var(--bg-elevated);
    color: var(--text-tertiary);
}

.check-item.done { border-color: var(--success); }
.check-item.done .check-icon { background: var(--success-bg); color: var(--success); }

.check-item.missing { border-color: var(--warning); }
.check-item.missing .check-icon { background: var(--warning-bg); color: var(--warning); }

.check-item.optional .check-icon { color: var(--text-tertiary); }

.check-icon svg { display: block; }

/* ---------- Zusammenfassung ---------- */

.summary-table { display: grid; }

.summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-row:last-child { border-bottom: none; }

.summary-value {
    color: var(--text-primary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.summary-row.total {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 2px solid var(--border-accent);
    border-bottom: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
}

.summary-row.total .summary-value { color: var(--accent-light); font-size: 18px; font-weight: 700; }

/* ---------- CTA ---------- */

.fb-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius);
    padding: 28px;
    margin: 32px 0 24px;
    box-shadow: 0 0 32px var(--accent-glow);
}

.fb-cta h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.fb-cta p { color: var(--text-secondary); font-size: 15px; }
.fb-cta-text { flex: 1 1 320px; }
.fb-cta-btn { flex-shrink: 0; }

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

.tool-footer {
    text-align: center;
    padding: 8px 0 16px;
    color: var(--text-tertiary);
    font-size: 13px;
    display: grid;
    gap: 12px;
    justify-items: center;
}

.tool-footer .disclaimer { font-size: 12px; max-width: 480px; }

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 92px;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 14px;
    max-width: min(92vw, 480px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    animation: toast-in 0.25s ease-out;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

@media (min-width: 768px) {
    .container { padding: 32px 24px 60px; }
    .tabs { overflow-x: visible; }
}

@media (max-width: 480px) {
    .card { padding: 18px 14px; }
    .fb-cta { padding: 20px 16px; }
    .btn-large { width: 100%; }
}

/* ---------- Reduced Motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
