/* VerVer – schlichtes Grundlayout ohne Framework. */

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --danger: #b91c1c;
    --success: #15803d;
    --radius: 8px;
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--primary); }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }

.topbar-nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar-nav a { text-decoration: none; }

.household-badge {
    text-decoration: none;
    padding: .15rem .6rem;
    border-radius: 999px;
    background: #dbeafe;
    color: var(--primary-hover);
    font-size: .875rem;
}

.container { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.container-narrow { max-width: 420px; margin: 2rem auto; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

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

/* Formulare */
label { display: block; font-weight: 600; margin: 0 0 .25rem; }

input[type=text], input[type=email], input[type=password], select {
    width: 100%;
    padding: .55rem .7rem;
    font: inherit;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
}

input:focus { outline: 2px solid #93c5fd; outline-offset: 1px; border-color: var(--primary); }

.field { margin-bottom: 1rem; }
.field-error, .form-error { color: var(--danger); font-size: .9rem; margin-top: .25rem; }
.form-error ul, .field-error ul { margin: 0; padding-left: 1rem; }

.code-input { letter-spacing: .3em; font-size: 1.25rem; text-align: center; }

.btn {
    display: inline-block;
    padding: .55rem 1rem;
    font: inherit;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    background: var(--primary);
    color: #fff;
}
.btn:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--text); border-color: #cbd5e1; }
.btn-secondary:hover { background: #f1f5f9; }
.btn-block { width: 100%; }

/* Meldungen */
.flash { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: #f0fdf4; border-color: #bbf7d0; color: var(--success); }
.flash-error { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.flash-info { background: #eff6ff; border-color: #bfdbfe; color: var(--primary-hover); }

/* Tabellen und Listen */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); }
th { font-size: .875rem; color: var(--muted); font-weight: 600; }

.inline-form { display: inline; }

.backup-codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 1.05rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px dashed #94a3b8;
    border-radius: 6px;
}

.qr { display: flex; justify-content: center; margin: 1rem 0; }
.qr img { width: 220px; height: 220px; }

.secret { font-family: ui-monospace, Menlo, monospace; word-break: break-all; }

/* Eingang */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.batch { border-top: 1px solid var(--border); padding: 1rem 0; }
.batch:first-of-type { border-top: 0; padding-top: 0; }
.batch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.batch-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.btn-small { padding: .25rem .6rem; font-size: .875rem; }
.status { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #e5e7eb; color: #374151; }
.status-done, .status-ocr-done { background: #dcfce7; color: var(--success); }
.status-failed, .status-ocr-failed { background: #fee2e2; color: var(--danger); }
.status-processing, .status-received, .status-ocr-pending, .status-ocr-processing { background: #dbeafe; color: var(--primary-hover); }
.status-duplicate { background: #fef3c7; color: #92400e; }
.warning { color: #92400e; font-size: .875rem; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; background: #f1f5f9; padding: .05rem .3rem; border-radius: 4px; }
input[type=file] { font: inherit; }

/* Dokument */
.facts th { width: 11rem; color: var(--muted); font-weight: 600; vertical-align: top; }
.ocr-text { white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: #f8fafc; padding: 1rem; border-radius: 6px; max-height: 32rem; overflow: auto; }
details summary { cursor: pointer; }

/* Prüfliste und Verträge */
.confidence-high { background: #dcfce7; color: var(--success); }
.confidence-medium { background: #fef3c7; color: #92400e; }
.confidence-new { background: #dbeafe; color: var(--primary-hover); }
.confidence-none { background: #e5e7eb; color: #374151; }
.review-group { margin-bottom: 1.5rem; }
label.radio, label.checkbox { font-weight: normal; display: flex; gap: .5rem; align-items: center; margin: .25rem 0; }
label.checkbox.inline { display: inline-flex; margin-right: 1rem; }
.subfields { margin: .5rem 0 0 1.5rem; }
.party-row { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.party-row > span { min-width: 12rem; font-weight: 600; }
textarea, input[type=date] { width: 100%; padding: .55rem .7rem; font: inherit; border: 1px solid #cbd5e1; border-radius: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.timeline-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.origin { font-size: .8rem; }
.link-button { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; font-size: .875rem; text-decoration: underline; }
.nav-count { display: inline-block; min-width: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: .75rem; text-align: center; }

/* Startseite und Fristen */
.dashboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.stat { display: flex; flex-direction: column; gap: .25rem; text-decoration: none; color: inherit; padding: 1.1rem 1.25rem; }
a.stat:hover { border-color: #93c5fd; }
.stat-number { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-money { font-size: 1.3rem; }
.stat-label { color: var(--muted); font-size: .9rem; }
.stat-alert .stat-number { color: var(--danger); }
.list-row { display: flex; gap: .75rem; justify-content: space-between; align-items: baseline; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row .date { flex: 0 0 auto; min-width: 5.5rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.list-row > span:last-child { flex: 1; }
.list-row .amount { text-align: right; font-variant-numeric: tabular-nums; }
.date-soon { color: var(--danger) !important; font-weight: 600; }
.row-past td { color: var(--muted); }

/* Suche */
.topbar-search input { width: 12rem; padding: .35rem .6rem; font: inherit; font-size: .9rem; border: 1px solid #cbd5e1; border-radius: 6px; }
.search-form { display: flex; gap: .5rem; margin-bottom: .5rem; }
.search-form input { flex: 1; padding: .55rem .7rem; font: inherit; border: 1px solid #cbd5e1; border-radius: 6px; }
.search-hit { padding: .65rem 0; border-bottom: 1px solid var(--border); }
.search-hit:last-child { border-bottom: 0; }
.snippet { color: #374151; font-size: .9rem; margin-top: .25rem; }
mark { background: #fef08a; padding: 0 .1rem; border-radius: 2px; }
.inline-add { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.inline-add input[type=text], .inline-add select { width: auto; flex: 1; min-width: 8rem; padding: .3rem .5rem; font-size: .9rem; }

/* Prüfseite zweigeteilt */
.container-wide { max-width: 1500px; }
.review-split { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.review-pdf iframe { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
@media (min-width: 1100px) {
    .review-split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
    .review-pdf { position: sticky; top: 1rem; }
    .review-pdf iframe { height: calc(100vh - 2rem); }
}

/* Kopfzeile auf schmalen Bildschirmen */
.menu-toggle { display: none; background: none; border: 1px solid #cbd5e1; border-radius: 6px; padding: .3rem .6rem; font: inherit; cursor: pointer; }
.topbar { flex-wrap: wrap; }
@media (max-width: 900px) {
    .menu-toggle { display: inline-block; margin-left: auto; }
    .topbar-search { order: 3; flex-basis: 100%; }
    .topbar-search input { width: 100%; }
    .topbar-nav { display: none; order: 4; flex-basis: 100%; flex-direction: column; align-items: flex-start; gap: .6rem; padding-top: .5rem; }
    .topbar.menu-open .topbar-nav { display: flex; }
}
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 1rem; }
.filter-bar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar select { width: auto; }

/* Prüfliste: Gruppenaktionen (Erstimport) */
.group-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1rem; }
.group-actions .checkbox { flex-basis: 100%; }
.group-actions p { flex-basis: 100%; margin: 0; }
.stale-hint { display: block; font-size: .9em; }

/* Import-Übersicht */
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.import-table th { text-align: left; font-weight: normal; color: var(--muted); width: 55%; }
.import-table td { font-variant-numeric: tabular-nums; }
.row-warning th, .row-warning td { color: var(--danger); font-weight: 600; }
.dashboard + .grid-2 { margin-top: 1rem; }
.guide ol > li { margin-bottom: .75rem; }
.duplicate-hint { display: inline-block; margin-top: .2rem; padding: 0 .4rem; border-radius: 4px; background: #fef3c7; color: #92400e; font-size: .8rem; }
