/* Spesen-App – dunkles, mobile-first UI (Vorlage: bereitgestellter Screenshot) */

:root {
    /* ---- Design-Tokens · Dark (Standard) --------------------------------- */
    --bg:             #0d0d0f;
    --surface:        #1b1b1f;
    --surface-alt:    #26262b;
    --text:           #f2f3f5;
    --text-muted:     #9aa3ad;
    --border:         #2e2e34;
    --primary:        #2bb6c4;        /* Teal – Akzent / Links / Fokus */
    --primary-grad-a: #ffa482;        /* Koralle – Haupt-Button-Verlauf */
    --primary-grad-b: #f7805f;
    --on-primary:     #ffffff;
    --success:        #5fcf8a;
    --warning:        #ffd166;
    --danger:         #f26d6d;
    --on-accent:      #0d0d0f;        /* Text/Punkt auf hellem Teal-Chip */
    --accent-violet:  #b07cf5;        /* „privat"-Akzent */
    --shadow:         rgba(0,0,0,.5);
    --overlay:        rgba(8,8,10,.94);
    --success-bg:     rgba(95,207,138,.12);
    --success-fg:     #a8f5c8;
    --warning-bg:     rgba(255,200,0,.12);
    --warning-fg:     #ffd166;
    --danger-bg:      rgba(242,109,109,.12);
    --danger-fg:      #ffb3b3;

    /* ---- Aliase auf alte Namen (Bestandskompatibilität; Step 2 räumt auf) - */
    --surface-2:      var(--surface-alt);
    --line:           var(--border);
    --muted:          var(--text-muted);
    --accent:         var(--primary);
    --primary-a:      var(--primary-grad-a);
    --primary-b:      var(--primary-grad-b);
    --done:           var(--success);
    --surface-1:      var(--surface);   /* Fix: war undefiniert (Suchfeld/Intro/Kachel transparent) */

    --radius:         20px;
    --radius-sm:      14px;

    /* Inhaltsbreite (mobile-first; wird auf Tablets breiter) */
    --cmax:           540px;
}

/* Tablet/iPad: komfortablere Spaltenbreite */
@media (min-width: 768px) {
    :root { --cmax: 720px; }
}

/* ---- Design-Tokens · Light (per Umschalter / data-theme) ------------------ */
:root[data-theme="light"] {
    --bg:             #f4f5f7;
    --surface:        #ffffff;
    --surface-alt:    #eceef1;
    --text:           #1a1d21;
    --text-muted:     #667085;
    --border:         #e2e5ea;
    --primary:        #0f8a99;
    --primary-grad-a: #ff9a73;
    --primary-grad-b: #f2704c;
    --on-primary:     #ffffff;
    --success:        #2c9d63;
    --warning:        #b7791f;
    --danger:         #d64545;
    --on-accent:      #ffffff;
    --accent-violet:  #7c4dff;
    --shadow:         rgba(16,24,40,.10);
    --overlay:        rgba(20,22,26,.45);
    --success-bg:     #e7f6ee;
    --success-fg:     #1a7f4f;
    --warning-bg:     #fdf3e2;
    --warning-fg:     #8a5a12;
    --danger-bg:      #fbe9e9;
    --danger-fg:      #b42318;
}

* { 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", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.45;
    padding-bottom: env(safe-area-inset-bottom);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.icon { display: block; }

/* ---- App-Bar -------------------------------------------------------------- */
.appbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 8px;
    padding: 12px max(16px, calc((100% - var(--cmax)) / 2 + 16px));
    padding-top: calc(12px + env(safe-area-inset-top));
    background: linear-gradient(var(--bg), color-mix(in srgb, var(--bg) 85%, transparent));
    backdrop-filter: blur(8px);
}
.appbar-title {
    margin: 0;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.appbar-action { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.appbar-user { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .3px; background: var(--surface-2); padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.greeting { padding: 4px 0 10px; }

/* Aufklappbare Statistik-Abschnitte */
.collapsible { border: none; }
.collapsible-title { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; user-select: none; margin-bottom: 0; }
.collapsible-title::-webkit-details-marker { display: none; }
.collapsible-title::after { content: '+'; font-size: 18px; font-weight: 400; color: var(--muted); line-height: 1; flex-shrink: 0; transition: transform .2s; }
.collapsible[open] .collapsible-title::after { content: '−'; }
.collapsible > :not(summary) { margin-top: 8px; }
.search-form { position: relative; margin-bottom: 12px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; }
.search-input { width: 100%; padding: 10px 36px 10px 38px; background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; color: var(--text); font-size: 15px; font-family: inherit; outline: none; box-sizing: border-box; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.search-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); text-decoration: none; font-size: 14px; line-height: 1; background: none; border: none; padding: 4px; cursor: pointer; font-family: inherit; }
.search-clear[hidden] { display: none; }
.search-count { font-size: 12px; color: var(--muted); padding: 0 2px 8px; }
.row-owner { color: var(--accent); font-size: 11px; font-weight: 600; }
.row-thumb { width: 21px; min-width: 21px; max-width: 21px; height: 21px; max-height: 21px; border-radius: 4px; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.row-thumb img { width: 21px; height: 21px; object-fit: cover; display: block; }
.greeting-text { font-size: 15px; color: var(--muted); }
.greeting-text strong { color: var(--text); font-weight: 700; }
.app-footer { position: fixed; bottom: calc(56px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); opacity: .4; line-height: 1.6; pointer-events: none; z-index: 10; }
.app-footer a, .footer-version, .footer-gh { color: var(--muted); text-decoration: none; pointer-events: all; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; background: var(--muted); }
.status-online  { background: var(--success); }
.status-offline { background: var(--warning); }
.app-footer a:hover { color: var(--accent); }
.footer-gh .icon { vertical-align: middle; margin-right: 2px; }

.iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: filter 0.15s ease;
}
.iconbtn:hover { filter: brightness(1.2); }
.iconbtn.placeholder { background: transparent; }
.iconbtn.accent { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--accent); }
.iconbtn.danger { background: transparent; color: var(--muted); width: 40px; height: 40px; }
.iconbtn.danger:hover { color: var(--danger); }

/* ---- FAB (Neue Ausgabe) ---------------------------------------------------- */
.fab {
    position: fixed;
    right: max(20px, calc((100% - var(--cmax)) / 2 + 20px));
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent);
    z-index: 25;
    transition: transform .15s ease, filter .15s ease;
}
.fab:hover { filter: brightness(1.08); transform: scale(1.04); }
.fab:active { transform: scale(0.96); }

/* Icon-Picker */
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick-opt input { display: none; }
.icon-pick-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--muted); cursor: pointer; border: 2px solid transparent; transition: border-color .15s, color .15s; }
.icon-pick-opt input:checked + .icon-pick-btn { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--primary) 12%, transparent); }

/* ---- Container ------------------------------------------------------------ */
.container {
    max-width: var(--cmax);
    margin: 0 auto;
    padding: 8px 16px 110px;
    flex: 1;
    width: 100%;
}

/* ---- Übersicht: Summen + Tabs --------------------------------------------- */
.summary { display: flex; gap: 12px; margin: 4px 0 16px; align-items: center; }
.summary-card {
    flex: 1;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.summary-label {
    display: flex; align-items: center; gap: 6px;
    color: var(--muted); font-size: 13px;
}
.summary-value { font-size: 20px; font-weight: 700; }
.summary-value.muted { color: var(--muted); }

/* ---- Kalender ------------------------------------------------------------- */
.cal-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 16px 10px;
    margin-bottom: 14px;
}
.cal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.cal-title { font-size: 15px; font-weight: 700; }
.cal-nav {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--surface-2); color: var(--text);
    text-decoration: none; font-size: 20px; line-height: 1;
}
.cal-nav:hover { filter: brightness(1.2); }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    row-gap: 2px;
    column-gap: 2px;
}
.cal-wd {
    display: block;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    padding: 0 0 8px;
}
.cal-day {
    display: block;
    text-align: center;
    padding: 7px 0 5px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    line-height: 1;
    min-height: 38px;
}
.cal-day.has-data  { color: var(--text); font-weight: 600; }
.cal-day.today     { background: var(--surface-2); color: var(--accent); }
.cal-day.selected  { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cal-day.selected .cal-dot { background: var(--on-accent); }
.cal-day.cal-empty { pointer-events: none; }
.cal-day:not(.cal-empty):hover { background: var(--surface-2); }

.cal-dot {
    display: block;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--accent);
    margin: 3px auto 0;
}
.cal-reset {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
}
.cal-reset a { color: var(--muted); text-decoration: none; }
.cal-reset a:hover { color: var(--accent); }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs-type { margin-top: -8px; }
.tab {
    flex: 1;
    text-align: center;
    padding: 9px 8px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}
.tab.active { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--accent); }

/* ---- Listenzeilen --------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list.compact { gap: 6px; margin-bottom: 8px; }

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
}
.row.static { cursor: default; }
.row-icon {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--c) 18%, transparent);
    color: var(--c, var(--accent));
}
.row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--muted); font-size: 11px; }
mark { background: color-mix(in srgb, var(--primary) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-end-top { display: flex; align-items: center; gap: 6px; }
.row-amount { font-weight: 700; font-size: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.row-chf-eq { font-size: 10px; font-weight: 400; color: var(--muted); }
.row-amount-refunded { color: var(--done); }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.badge-open { background: var(--surface-2); color: var(--muted); }
.badge-done { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--done); }

/* ---- Detailansicht -------------------------------------------------------- */
.detail { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.detail-amount {
    margin: 8px 0 0;
    font-size: 30px;
    font-weight: 600;
    color: var(--muted);
}
.detail-amount span { font-size: 52px; font-weight: 800; color: var(--text); }
.detail-amount-refunded span { color: var(--done); }
.detail-chf-eq { font-size: 14px; color: var(--muted); margin-top: -10px; }
.chf-hint { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: -6px; margin-bottom: 4px; padding: 0 2px; }

.status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--muted);
}
.status-pill.status-done    { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.status-pill.type-privat    { background: color-mix(in srgb, var(--accent-violet) 16%, transparent); color: var(--accent-violet); }
.status-pill.type-business  { background: color-mix(in srgb, var(--primary) 16%, transparent);  color: var(--primary); }

.detail-pills { display: flex; flex-wrap: wrap; gap: 8px; }

/* Custom File-Picker */
.file-pick-input { display: none; }
.file-pick {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 10px 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 15%, transparent), color-mix(in srgb, var(--primary) 8%, transparent));
    border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
    border-radius: 10px; color: var(--accent);
    font-size: 13px; font-weight: 600; letter-spacing: 0.3px; cursor: pointer;
    transition: background .2s, border-color .2s;
}
.file-pick:hover { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 25%, transparent), color-mix(in srgb, var(--primary) 14%, transparent)); border-color: color-mix(in srgb, var(--primary) 60%, transparent); }
.file-pick.has-file { border-color: var(--accent); background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 22%, transparent), color-mix(in srgb, var(--primary) 12%, transparent)); }
.file-pick.has-file #file-pick-name { color: var(--text); }

/* Type Toggle im Formular */
.type-toggle { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; }
.type-opt { display: flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 8px;
    font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .18s;
    border: 2px solid transparent; }
.type-opt input[type=radio] { display: none; }
.type-opt:has(input[value="geschäftlich"]:checked) {
    background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 50%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent); }
.type-opt:has(input[value="privat"]:checked) {
    background: color-mix(in srgb, var(--accent-violet) 18%, transparent); color: var(--accent-violet);
    border-color: color-mix(in srgb, var(--accent-violet) 50%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-violet) 10%, transparent); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }

.card { width: 100%; background: var(--surface); border-radius: var(--radius); }
.card.pad { padding: 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.card-icon {
    width: 40px; height: 40px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--c, var(--text-muted)) 18%, transparent);
    color: var(--c, var(--muted));
}
.card-icon.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--muted); }
.card-strong { font-size: 17px; font-weight: 600; }

.row-card { padding: 18px; display: grid; grid-template-columns: 1fr auto; gap: 14px 16px; align-items: center; }
.merchant { display: flex; align-items: center; gap: 12px; }
.merchant-total { grid-column: 1; display: flex; flex-direction: column; gap: 2px; }
.receipt-thumb {
    grid-column: 2; grid-row: 1 / span 2;
    width: 84px; height: 110px;
    border-radius: 10px; overflow: hidden;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.receipt-thumb img, .receipt-thumb-img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.pdf-badge { color: #333; font-weight: 700; font-size: 13px; }

/* PDF-Icon in Listzeile */
.row-thumb-pdf { background: transparent; flex-direction: column; gap: 0; border-radius: 0; width: 21px; height: 21px; }

/* PDF-Thumbnail in detail.php */
.receipt-thumb-pdf { background: var(--surface-2); flex-direction: column; gap: 6px; cursor: pointer; }
.pdf-adobe-icon { width: 48px; height: 55px; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.pdf-type-label { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }

/* PDF-Lightbox */
.lightbox-pdfwrap { padding: 0; }
.lightbox-pdf { width: 96vw; height: 88vh; border-radius: 12px; overflow: hidden; position: relative; display: block; }
.pdf-lb-embed { display: block; width: 100%; height: 100%; border: none; }

/* Lightbox */
.lightbox {
    display: none;
    position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,0.92);
    align-items: center; justify-content: center;
    padding: 16px;
}
.lightbox.open { display: flex; }
.lightbox-inner {
    position: relative;
    max-width: 100%; max-height: 100%;
    display: flex; align-items: center; justify-content: center;
}
.lightbox-inner img {
    max-width: min(96vw, 680px);
    max-height: 88vh;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 8px 48px rgba(0,0,0,0.7);
}
.lightbox-close {
    position: absolute; top: -14px; right: -14px;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 20px; line-height: 1;
}
.lightbox-close:hover { background: var(--surface); }

.kv { padding: 6px 18px; }
.kv-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: none; }
.kv-text { display: flex; flex-direction: column; gap: 2px; }
.kv-text .muted { font-size: 13px; }
.flag { font-size: 26px; width: 40px; text-align: center; }

.muted { color: var(--muted); }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    padding: 16px 20px;
    border: none; border-radius: 16px;
    font-size: 16px; font-weight: 700;
    cursor: pointer; text-decoration: none;
    color: var(--text);
    background: var(--surface-2);
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary-a), var(--primary-b));
    color: #2a1409;
}
.btn-ghost { background: var(--surface); color: var(--text); }
.btn-ghost-danger { background: transparent; color: var(--danger); font-weight: 600; }
.btn-google { background: var(--surface-alt); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.btn-google:hover { background: color-mix(in srgb, var(--text) 8%, var(--surface-alt)); }
.btn:active { transform: translateY(1px); }

.stack { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

/* ---- Formulare ------------------------------------------------------------ */
.form { display: flex; flex-direction: column; gap: 16px; }
.form.boxed { background: var(--surface); border-radius: var(--radius); padding: 18px; margin-top: 8px; }
.form.login { max-width: 360px; margin: 40px auto 0; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-row { display: flex; gap: 12px; }
.field.grow, .grow { flex: 1; }
label { font-size: 13px; color: var(--muted); font-weight: 600; }

input[type="text"], input[type="password"], input[type="date"],
select, textarea {
    width: 100%;
    padding: 13px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    font-size: 16px; /* >=16px verhindert iOS-Zoom */
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: transparent;
}
input[type="color"] { padding: 4px; height: 48px; }
textarea { resize: vertical; }

/* Eingabefeld mit Einheiten-Suffix (z.B. Währung im MwSt-Betrag-Feld) */
.input-suffix-wrap { position: relative; }
.input-suffix-wrap input { padding-right: 52px; }
.input-suffix {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 13px; font-weight: 600; pointer-events: none;
}
.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }
.check input { width: auto; }
.inline { display: inline; }
.hint { font-size: 12px; color: var(--muted); margin: 2px 0 0; }

/* OCR-Button */
#ocr-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-ocr {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 15%, transparent), color-mix(in srgb, var(--primary) 8%, transparent));
    border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
    border-radius: 10px;
    color: var(--accent);
    font-size: 13px; font-weight: 600; letter-spacing: 0.3px;
    cursor: pointer; font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
}
.btn-ocr:hover { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 25%, transparent), color-mix(in srgb, var(--primary) 14%, transparent)); border-color: color-mix(in srgb, var(--primary) 60%, transparent); }
.btn-ocr:disabled { opacity: 0.5; cursor: default; }
.ocr-status { font-size: 12px; color: var(--muted); }

.ocr-preview { margin-top: 12px; }
.ocr-preview-stage {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.ocr-preview-stage img { display: block; max-width: 100%; height: auto; }
.ocr-box {
    position: absolute;
    border: 2px solid var(--accent);
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    border-radius: 2px;
    pointer-events: none;
}

.section-title { font-size: 15px; color: var(--muted); margin: 22px 0 10px; font-weight: 700; }

.alert {
    background: var(--danger-bg);
    color: var(--danger-fg);
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 14px;
}
.alert-warn {
    background: var(--warning-bg);
    color: var(--warning-fg);
    border-color: color-mix(in srgb, var(--warning) 35%, transparent);
    display: flex; flex-direction: column; gap: 6px;
}
.alert-warn a { color: var(--accent); text-decoration: underline; }
.alert-warn small { color: var(--muted); }
.lead { color: var(--muted); }

/* ---- Leerzustand ---------------------------------------------------------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .btn { display: inline-flex; width: auto; margin-top: 14px; }

/* ---- Untere Navigation ---------------------------------------------------- */
.bottombar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: space-around;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    z-index: 20;
}
.bottombar-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted); text-decoration: none;
    font-size: 10px; font-weight: 600;
    padding: 4px 6px; border-radius: 12px;
    flex: 1;
    min-width: 0;
}
.bottombar-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}
.bottombar-item.active { color: var(--accent); }
.bottombar-item.logout-item { color: var(--danger); opacity: 0.75; }
.bottombar-item.logout-item:hover,
.bottombar-item.logout-item:focus { opacity: 1; }

@media (min-width: 600px) {
    .bottombar { max-width: var(--cmax); margin: 0 auto; border-radius: 18px 18px 0 0; }
    .bottombar-item { font-size: 11px; padding: 4px 14px; flex: none; }
}

/* ---- Statistik ------------------------------------------------------------ */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.stats-table th,
.stats-table td {
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}
.stats-table thead th {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--surface-2);
}
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-table .num { text-align: right; }
.stats-table .bold { font-weight: 700; }
.stats-table .done-val { color: var(--done); }

/* Übersicht-Kacheln */
.stats-kacheln { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 6px; }
.stats-kachel { background: var(--surface-1); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stats-kachel-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stats-kachel-val { font-size: 18px; font-weight: 700; color: var(--text); }

/* Donut */
.donut-card { display: flex; align-items: center; gap: 24px; padding: 16px 20px; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.donut-leg-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.donut-leg-row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.donut-leg-row span:not(.dot) { flex: 1; color: var(--muted); }
.donut-leg-row strong { font-weight: 600; }

.bar-wrap {
    display: block;
    height: 4px;
    background: var(--surface-2);
    border-radius: 999px;
    margin-top: 5px;
    overflow: hidden;
}
.bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    min-width: 2px;
}

/* ---- Bulk-Selektion ------------------------------------------------------- */
.bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.bulk-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}
.bulk-select-all input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}
.bulk-btn {
    width: auto;
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 12px;
}
.bulk-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.row-checkable {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border-radius: var(--radius-sm);
}
.row-cb-wrap {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding-left: 14px;
    cursor: pointer;
}
.row-cb {
    width: 18px !important;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}
.row-inner {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 12px 4px;
    text-decoration: none;
    color: var(--text);
    min-width: 0;
}

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