/* ==========================================================================
   Immocierge – Components (tokens live in tokens.css)
   ========================================================================== */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Component-level vars only. All design tokens come from tokens.css.
       --tap and --font kept for legacy refs in this file. */
    --tap:    44px;
    --font:   var(--font-sans);
}

html { font-size: 15px; }
body {
    font-family: var(--font-sans);
    background: var(--cream);
    color: var(--ink-2);
    line-height: 1.45;
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--ink); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--gold-2); }
input[type="date"] { color-scheme: light; }
img { max-width: 100%; }
code, kbd, samp { font-family: var(--font-mono); }
.mono, td.amount, .amount { font-family: var(--font-mono); font-feature-settings: "tnum"; }

/* ---- Typography ---- */
h1 {
    font-family: var(--font-display); font-weight: 400;
    font-size: 2.1rem; letter-spacing: -0.015em; line-height: 1.15;
    color: var(--ink);
}
h2 {
    font-family: var(--font-display); font-weight: 400;
    font-size: 1.55rem; letter-spacing: -0.015em; line-height: 1.2;
    color: var(--ink);
}
h3 {
    font-family: var(--font-sans); font-weight: 600;
    font-size: 1.05rem; letter-spacing: -0.005em; color: var(--ink);
}
h4 {
    font-family: var(--font-sans); font-weight: 500;
    font-size: 0.82rem; letter-spacing: -0.005em; color: var(--ink-3);
}
p  { margin-bottom: 0.75rem; }
small { font-size: 0.85rem; color: var(--ink-3); }
hgroup { margin-bottom: 0.5rem; }
hgroup p { margin: 0; color: var(--ink-3); font-size: 0.95rem; font-weight: 400; }

/* ---- Buttons ---- */
button, .btn, a[role="button"] {
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-sans); font-size: 0.85rem; font-weight: 500;
    padding: 0.55rem 1.15rem; border-radius: var(--r-pill);
    border: 1px solid transparent; cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    text-decoration: none; line-height: 1.4;
    min-height: var(--tap);
    box-shadow: none;
    letter-spacing: -0.005em;
}
button, .btn-primary, a[role="button"] {
    background: var(--forest); color: var(--white);
}
button:hover, .btn-primary:hover, a[role="button"]:hover {
    background: var(--forest-2);
}
button:active, .btn-primary:active, a[role="button"]:active {
    background: var(--forest-3);
}
.secondary, button.secondary, a[role="button"].secondary {
    background: var(--cream-2); color: var(--ink);
    border-color: var(--line);
}
.secondary:hover, button.secondary:hover, a[role="button"].secondary:hover {
    background: var(--cream-3); border-color: var(--line-2);
}
.outline, button.outline {
    background: var(--white); color: var(--ink-2);
    border: 1px solid var(--line);
}
.outline:hover, button.outline:hover {
    background: var(--cream); border-color: var(--line-2); color: var(--ink);
}
button.secondary.outline, a[role="button"].secondary.outline {
    background: var(--white); color: var(--ink-3);
    border: 1px solid var(--line);
}
button.secondary.outline:hover, a[role="button"].secondary.outline:hover {
    background: var(--cream); color: var(--ink-2);
}
button.contrast.outline, a[role="button"].contrast.outline {
    background: var(--white); color: var(--neg);
    border: 1px solid var(--line);
}
button.contrast.outline:hover {
    background: rgba(168,63,31,0.06); border-color: var(--neg);
}

/* ---- Forms ---- */
label {
    display: block; font-size: 0.85rem; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 1rem;
}
/* The author `label { display: block }` rule above overrides the UA
   default for the `hidden` attribute, which would otherwise apply
   `display: none`. Restore that so elements with `hidden` actually
   disappear (used by the Buchhaltung period filter, the IMAP funnel,
   etc.). */
[hidden] { display: none !important; }
input, select, textarea {
    display: block; width: 100%; margin-top: 0.35rem;
    font-family: var(--font-sans); font-size: 0.92rem;
    padding: 0.55rem 0.85rem; border-radius: var(--r-input);
    border: 1px solid var(--line); background: var(--white);
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-height: var(--tap);
}
input:hover, select:hover, textarea:hover {
    border-color: var(--line-2);
}
input:focus, select:focus, textarea:focus {
    outline: none; background: var(--white);
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(184,138,46,0.12);
}
select { appearance: auto; }
input[type="radio"], input[type="checkbox"] {
    display: inline-block; width: auto; margin-top: 0;
    padding: 0; min-height: 0;
    appearance: auto; -webkit-appearance: auto;
    accent-color: var(--forest);
}
textarea { resize: vertical; min-height: 5rem; }

/* ---- Grid ---- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ---- Cards ---- */
.card {
    background: var(--white);
    border: none;
    border-radius: var(--r-card);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.1rem;
    box-shadow: none;
}
.card h3 { margin-bottom: 0.75rem; }
.card h3 a { color: var(--ink); transition: color 0.15s; }
.card h3 a:hover { color: var(--gold-2); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; margin: -0.5rem; padding: 0.5rem; }
table {
    width: 100%; border-collapse: collapse;
    font-size: 0.9rem;
}
thead th {
    text-align: left; font-weight: 500; font-size: 0.72rem;
    color: var(--muted); padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--line);
    text-transform: uppercase; letter-spacing: 0.05em;
}
tbody td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--line-3);
    vertical-align: middle;
    color: var(--ink-2);
}
tbody tr { transition: background 0.15s ease; }
tbody tr:hover { background: var(--paper); }
table .right { text-align: right; }
td.actions { display: flex; gap: 0.4rem; align-items: center; }
td.actions form { display: inline; margin: 0; }
td.actions button { padding: 0.3rem 0.75rem; font-size: 0.78rem; min-height: 30px; }
td.actions a {
    padding: 0.3rem 0.75rem; font-size: 0.78rem; min-height: 30px;
    border: 1px solid var(--line); border-radius: var(--r-pill);
    background: var(--white);
    color: var(--ink-3); display: inline-flex; align-items: center;
    transition: background 0.12s ease, color 0.12s ease;
}
td.actions a:hover { background: var(--cream); color: var(--ink); border-color: var(--line-2); }

/* ==========================================================================
   Layout shell — Sidebar + Topbar + Content
   ========================================================================== */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
    background: var(--white);
    border-right: 1px solid var(--line);
    padding: 1.25rem 0.85rem 1rem;
    position: sticky; top: 0; align-self: start;
    height: 100vh; max-height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column;
}

.sidebar-brand {
    padding: 0.25rem 0.5rem 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--line);
}
.sidebar-brand .brand {
    display: inline-flex; align-items: center; gap: 0.55rem;
    color: var(--ink); text-decoration: none;
}
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--forest); color: #fff;
    font-family: var(--font-display); font-size: 1.1rem; line-height: 1;
}
.brand-word {
    font-family: var(--font-display); font-size: 1.25rem;
    letter-spacing: -0.015em; color: var(--ink);
}

.sidebar-user {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.5rem 0.85rem;
    margin-bottom: 0.25rem;
}
.sidebar-user .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--cream-2); color: var(--ink-2);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 600;
    flex-shrink: 0;
}
.sidebar-user .user-meta { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user .user-meta strong {
    font-size: 0.85rem; font-weight: 500; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .user-meta small { font-size: 0.72rem; color: var(--muted); }

.sidebar-switcher { padding: 0 0.25rem 0.85rem; }
.sidebar-switcher select {
    width: 100%; padding: 0.45rem 0.6rem;
    font-size: 0.82rem; font-family: var(--font-sans);
    background: var(--cream); color: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%237d8593' d='M5 6 0 0h10z'/></svg>");
    background-repeat: no-repeat; background-position: right 0.85rem center;
    padding-right: 1.85rem;
}
.sidebar-switcher select:hover { border-color: var(--line-2); }
.sidebar-switcher select:focus {
    outline: none; border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(184,138,46,0.12);
}

.sidebar-nav { flex: 1; }
.sidebar-nav section { margin-bottom: 1.1rem; }
.sidebar-nav h4 {
    display: flex; align-items: center; justify-content: space-between;
    margin: 0 0.3rem 0.4rem;
    font-size: 0.625rem; font-weight: 500;
    color: var(--muted); text-transform: uppercase;
    letter-spacing: 0.10em;
}
.sidebar-nav h4 .count {
    font-family: var(--font-mono); font-size: 0.625rem;
    font-weight: 400; color: var(--muted-2);
    letter-spacing: 0;
}
.sidebar-nav ul { list-style: none; }
.sidebar-nav li { margin-bottom: 1px; }
.sidebar-nav li a {
    display: block; padding: 6px 10px;
    border-radius: 7px; color: var(--ink-2);
    font-size: 0.81rem; line-height: 1.35;
    transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-nav li a:hover { background: var(--cream); color: var(--ink-2); }
.sidebar-nav li.active a {
    background: var(--cream-2);
    color: var(--forest);
    box-shadow: inset 2px 0 0 var(--forest);
    font-weight: 500;
}
.sidebar-nav li a strong { display: block; font-weight: 500; color: var(--ink); }
.sidebar-nav li a small { display: block; color: var(--muted); font-size: 0.72rem; margin-top: 1px; }
.sidebar-nav .muted { padding: 0 0.35rem; font-size: 0.78rem; color: var(--muted); }

/* Sidebar footer */
.sidebar-foot {
    margin-top: auto; padding-top: 0.85rem;
    border-top: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 0.55rem;
}
.sidebar-foot .add-menu { position: relative; }
.sidebar-foot .add-menu summary {
    display: block; cursor: pointer; list-style: none;
    padding: 6px 10px; border-radius: 7px;
    background: var(--cream-2);
    color: var(--forest); font-size: 0.81rem; font-weight: 500;
    text-align: center;
    transition: background 0.12s;
}
.sidebar-foot .add-menu summary:hover { background: var(--cream-3); }
.sidebar-foot .add-menu summary::-webkit-details-marker { display: none; }
.sidebar-foot .add-menu[open] summary { margin-bottom: 0.4rem; }
.sidebar-foot .add-menu ul { list-style: none; }
.sidebar-foot .add-menu li a {
    display: block; padding: 6px 10px;
    border-radius: 7px; color: var(--ink-2);
    font-size: 0.78rem;
}
.sidebar-foot .add-menu li a:hover { background: var(--cream); }
.sidebar-foot .settings-link {
    display: block; text-align: center;
    color: var(--muted); font-size: 0.78rem;
    padding: 4px 0;
}
.sidebar-foot .settings-link:hover { color: var(--ink-2); }
.sidebar-foot .logout-form button {
    width: 100%; font-size: 0.78rem; padding: 6px 10px;
    background: transparent; color: var(--muted);
    border: 1px solid var(--line);
    border-radius: var(--r-pill); min-height: 0;
}
.sidebar-foot .logout-form button:hover {
    background: var(--cream); color: var(--ink-2);
    border-color: var(--line-2); transform: none;
}

/* ── Main content + Topbar ────────────────────────────────────────────── */
.content {
    min-width: 0;
    display: flex; flex-direction: column;
}

.topbar {
    position: sticky; top: 0; z-index: 50;
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.75rem;
    background: rgba(250,248,242,0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.breadcrumbs {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.82rem;
}
.breadcrumbs a { color: var(--ink-3); }
.breadcrumbs a:hover { color: var(--ink); }
.breadcrumbs .bc-sep { color: var(--muted-2); font-size: 0.85rem; }
.breadcrumbs .bc-current { color: var(--forest); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 0.5rem; }
.topbar-search {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 6px 12px; min-height: 0;
    background: var(--white); color: var(--muted);
    border: 1px solid var(--line); border-radius: var(--r-pill);
    font-family: var(--font-mono); font-size: 0.72rem;
    letter-spacing: 0.04em;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.topbar-search:not(:disabled):hover { border-color: var(--line-2); color: var(--ink-3); }
.topbar-search:focus {
    outline: none; border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(184,138,46,0.12);
}
.topbar-search:disabled { opacity: 0.6; cursor: not-allowed; }

.page {
    padding: 1.75rem 2.25rem 3rem;
    min-width: 0; max-width: 1180px;
}

.menu-toggle {
    display: none; position: fixed;
    top: 0.6rem; left: 0.85rem; z-index: 100;
    min-width: 40px; min-height: 40px;
    padding: 0; border-radius: var(--r-pill);
    background: var(--white);
    border: 1px solid var(--line); color: var(--ink); font-size: 1.05rem;
    box-shadow: var(--shadow-card);
}

/* Backdrop when sidebar is open on mobile */
.nav-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 85; opacity: 0;
    transition: opacity 0.2s;
}
body.nav-open .nav-backdrop {
    display: block; opacity: 1;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        width: 85%; max-width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 90;
        box-shadow: var(--shadow-pop);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .topbar { padding-left: 3.5rem; padding-right: 1rem; }
    .page { padding: 1.25rem 1rem 2rem; }
    .card { padding: 1.25rem; }
    .summary-row { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
    .summary-row div strong { font-size: 1.15rem; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.1rem; }
    .page-header { margin-bottom: 1.5rem; }
    .sidebar li a { padding: 0.75rem 0.9rem; min-height: var(--tap); display: flex; align-items: center; }
}

/* ---- Page header / tabs ---- */
.page-header { margin-bottom: 1.75rem; }
.page-header h1 { margin-bottom: 0.25rem; }
.page-header hgroup p { color: var(--ink-3); }

.tabs {
    display: inline-flex; gap: 2px; margin-top: 0.85rem;
    background: var(--cream-3);
    border: 1px solid var(--line-2);
    border-radius: var(--r-pill);
    padding: 3px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    padding: 0.4rem 0.95rem; color: var(--ink-3);
    border-radius: var(--r-pill);
    font-size: 0.8rem; font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
    white-space: nowrap;
    min-height: 30px;
    display: inline-flex; align-items: center;
}
.tabs a:hover { color: var(--ink-2); }
.tabs a.active {
    color: var(--ink); background: var(--white);
    border: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(20,23,28,0.06);
}

/* ---- Flash messages ---- */
.flash {
    padding: 0.75rem 1.1rem; border-radius: var(--r-card);
    margin-bottom: 1rem; font-size: 0.88rem;
    border: 1px solid;
    font-weight: 500;
}
.flash-success {
    color: var(--pos);
    background: rgba(47,107,62,0.06);
    border-color: rgba(47,107,62,0.18);
}
.flash-error {
    color: var(--neg);
    background: rgba(168,63,31,0.06);
    border-color: rgba(168,63,31,0.18);
}
.flash-info {
    color: var(--gold-2);
    background: rgba(184,138,46,0.06);
    border-color: rgba(184,138,46,0.18);
}

/* ---- Summary row ---- */
.summary-row {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 1rem; align-items: start;
}
.summary-row div {
    background: var(--white);
    border-radius: var(--r-card);
    padding: 1.1rem 1.25rem;
    border: none;
    box-shadow: none;
}
.summary-row div small {
    color: var(--muted); display: block;
    margin-bottom: 0.35rem; font-size: 0.7rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.summary-row div strong {
    font-family: var(--font-display); font-size: 1.6rem;
    font-weight: 400; letter-spacing: -0.015em; color: var(--ink);
    font-feature-settings: "tnum";
}

/* ---- Tags ---- */
.tag {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-pill); font-size: 0.7rem;
    font-weight: 500; border: 1px solid transparent;
    letter-spacing: 0;
    transition: opacity 0.15s;
}
.tag.pos { color: var(--pos); background: rgba(47,107,62,0.10); border-color: rgba(47,107,62,0.18); }
.tag.neg { color: var(--neg); background: rgba(168,63,31,0.08); border-color: rgba(168,63,31,0.20); }

/* ---- Utility ---- */
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--text-secondary); font-style: normal; font-size: 0.9rem; }
.form-actions { display: flex; gap: 0.85rem; align-items: center; margin-top: 1.25rem; flex-wrap: wrap; }

/* ---- Inline checkbox label ---- */
label.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
}
label.checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--accent);
}

/* ---- Auth pages ---- */
.auth-container {
    max-width: 440px; margin: 0 auto;
    padding: 6rem 1.5rem 2rem;
    display: flex; flex-direction: column; align-items: center;
    min-height: 100vh; justify-content: center;
}
.auth-brand {
    font-size: 1.9rem; font-weight: 700; color: var(--brand);
    margin-bottom: 2.5rem; letter-spacing: -0.025em;
}
.auth-card {
    background: var(--bg-card); border: none;
    border-radius: var(--radius); padding: 2.5rem; width: 100%;
    box-shadow: var(--shadow-lg);
}
.auth-card hgroup { margin-bottom: 1.5rem; }
.auth-card h1 { font-size: 1.4rem; }
.auth-card button { width: 100%; margin-top: 0.75rem; }
.auth-card p { text-align: center; margin-top: 1rem; }

/* ---- OCR status tags ---- */
.tag.tag-property { color: var(--pos); background: rgba(47,107,62,0.10); border-color: rgba(47,107,62,0.18); }
.tag.tag-company  { color: var(--gold-2); background: rgba(184,138,46,0.10); border-color: rgba(184,138,46,0.22); }
.tag.ocr-done    { color: var(--pos); background: rgba(47,107,62,0.10); border-color: rgba(47,107,62,0.18); }
.tag.ocr-failed  { color: var(--neg); background: rgba(168,63,31,0.08); border-color: rgba(168,63,31,0.20); }
.tag.ocr-pending { color: var(--gold-2); background: rgba(184,138,46,0.10); border-color: rgba(184,138,46,0.22); }

/* ---- Upload area / Drop zone ---- */
.upload-area, .drop-zone {
    border: 2px dashed rgba(0,0,0,0.12); border-radius: var(--radius);
    padding: 2.5rem; text-align: center;
    transition: all 0.2s ease;
    background: var(--bg-card);
}
.upload-area:hover, .drop-zone:hover { border-color: var(--accent); background: rgba(61,107,68,0.03); }
.upload-area .btn, .drop-zone .btn { cursor: pointer; }
.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(61,107,68,0.06);
}

/* ---- Document preview ---- */
.doc-preview-card { }
.doc-preview img {
    max-width: 100%; max-height: 500px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.doc-preview iframe {
    width: 100%; height: 500px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: #fff;
}

/* ---- OCR pre-fill banner ---- */
.ocr-banner {
    background: rgba(61,107,68,0.08);
    border: none;
    border-radius: var(--radius-xs);
    padding: 0.65rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #2c5a30;
    font-weight: 500;
}

/* ---- Booking form: section titles ---- */
.section-title {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: none;
}
.section-title:first-of-type { margin-top: 0; }

/* ---- Booking form: segmented switch (Brutto/Netto) ---- */
.segmented {
    display: inline-flex;
    border: none;
    border-radius: var(--radius-xs);
    padding: 3px;
    background: rgba(0,0,0,0.06);
    margin-bottom: 1rem;
}
.segmented label {
    margin: 0;
    cursor: pointer;
    padding: 0;
}
.segmented label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.segmented label span {
    display: inline-flex;
    align-items: center; justify-content: center;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.2s ease;
    min-height: 32px;
}
.segmented label input:checked + span {
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    font-weight: 600;
}
.upload-segmented { display: flex; width: 100%; }
.upload-segmented label { flex: 1; }
.upload-segmented label span { width: 100%; }

/* ---- Booking form: items table ---- */
.items-table {
    margin-top: 0.25rem;
}
.items-table thead th {
    padding: 0.5rem 0.75rem;
}
.items-table tbody td {
    padding: 0.4rem 0.5rem;
    vertical-align: middle;
}
.items-table input, .items-table select {
    margin-top: 0;
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
}
.items-table input.right { text-align: right; }
.items-table .item-remove {
    padding: 0.3rem 0.55rem;
    font-size: 0.85rem;
    line-height: 1;
}
.items-table tfoot td {
    border-bottom: none;
    padding-top: 0.5rem;
    padding-bottom: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.items-table tfoot tr.totals-row.strong td {
    color: var(--text);
    font-weight: 700;
    font-size: 1rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border-soft);
}

/* ---- Booking list: document-type tags ---- */
.tag.doctype-income        { color: var(--pos); background: rgba(47,107,62,0.10); border-color: rgba(47,107,62,0.18); }
.tag.doctype-expense       { color: var(--neg); background: rgba(168,63,31,0.08); border-color: rgba(168,63,31,0.20); }
.tag.doctype-income-red    { color: var(--neg); background: rgba(168,63,31,0.08); border-color: rgba(168,63,31,0.20); }
.tag.doctype-expense-red   { color: var(--pos); background: rgba(47,107,62,0.10); border-color: rgba(47,107,62,0.18); }
.tag.doctype-transfer      { color: var(--ink-3); background: var(--cream-2); border-color: var(--line); }

/* ---- Review status tags ---- */
.tag.review-auto         { color: var(--pos); background: rgba(47,107,62,0.10); border-color: rgba(47,107,62,0.18); }
.tag.review-plausible    { color: var(--gold-2); background: rgba(184,138,46,0.10); border-color: rgba(184,138,46,0.22); }
.tag.review-needs-review { color: var(--neg); background: rgba(168,63,31,0.08); border-color: rgba(168,63,31,0.20); }
.tag.review-verified     { color: var(--pos); background: rgba(47,107,62,0.16); border-color: rgba(47,107,62,0.28); }

.review-filter { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.review-filter .tag { text-decoration: none; cursor: pointer; opacity: 0.6; }
.review-filter .tag.active { opacity: 1; font-weight: 600; }
.review-filter .tag:hover { opacity: 0.9; }

/* ---- Booking form: SKR03 category helper ---- */
.category-help {
    margin: 0.75rem 0 1.25rem;
    padding: 0.5rem 0.85rem;
    border: none;
    border-radius: var(--radius-xs);
    background: rgba(0,0,0,0.03);
}
.category-help summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.9rem;
    list-style: none;
    user-select: none;
}
.category-help summary::-webkit-details-marker { display: none; }
.category-help[open] summary { margin-bottom: 0.6rem; }
.category-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.category-list li { line-height: 1.5; }
.category-list code {
    display: inline-block;
    min-width: 3em;
    margin-right: 0.35rem;
    padding: 0.05rem 0.4rem;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
    color: var(--accent);
    background: rgba(61,107,68,0.08);
}
@media (max-width: 720px) {
    .category-list { grid-template-columns: 1fr; }
}

/* ---- IMAP accounts ---- */
.imap-table th,
.imap-table td { vertical-align: middle; }
.imap-table .actions { white-space: nowrap; }
.imap-table .actions button { margin-left: 0.25rem; }
details.imap-add {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius-xs);
    background: rgba(0,0,0,0.02);
}
details.imap-add summary {
    cursor: pointer;
    color: var(--accent);
    list-style: none;
    user-select: none;
}
details.imap-add summary::-webkit-details-marker { display: none; }
details.imap-add[open] summary { margin-bottom: 0.85rem; }
details.imap-add label.checkbox { margin-top: 0.5rem; }

/* IMAP funnel: preview message + step containers */
#imap-preview-msg {
    margin: 0.75rem 0 0;
    padding: 0.5rem 0.85rem;
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    font-size: 0.9rem;
    background: rgba(61,107,68,0.06);
}
#imap-preview-msg.error {
    border-left-color: var(--neg);
    background: rgba(220,74,74,0.06);
    color: #b83232;
}
#imap-preview-msg.ok {
    border-left-color: var(--pos);
    background: rgba(61,107,68,0.06);
    color: #1a7a4a;
}
[data-imap-step="2"] #imap-folder-select {
    width: 100%;
}
[data-imap-step="2"] .form-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* ================================================================
   Upload tabs (Datei / Kamera)
   ================================================================ */
.upload-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.upload-tab-btn {
    background: none;
    border: none;
    color: var(--muted);
    padding: 0.35rem 0.9rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.upload-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* ================================================================
   Camera tab: page thumbnails
   ================================================================ */
.page-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    min-height: 1rem;
}
.page-thumb {
    position: relative;
    width: 72px;
}
.page-thumb img {
    width: 72px;
    height: 96px;
    object-fit: cover;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: block;
}
.page-thumb-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    border: none;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}
.page-thumb-label {
    display: block;
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.2rem;
}
.camera-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

/* (old crop-modal removed – replaced by crop-overlay below) */

/* ================================================================
   Bank transactions table
   ================================================================ */
.bank-tx-table .purpose-cell,
.reason-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.amt-positive { color: var(--pos); font-weight: 600; }
.amt-negative { color: var(--neg); font-weight: 600; }
.nowrap { white-space: nowrap; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}
.pagination a {
    padding: 0.45rem 0.9rem;
    border: none;
    border-radius: 980px;
    background: rgba(0,0,0,0.04);
    text-decoration: none;
    font-size: 0.88rem;
}
.pagination a:hover {
    background: rgba(0,0,0,0.08);
}
.pagination span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---- Sortable table headers ---- */
.sortable-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.sortable-table th[data-sort]::after {
    content: '⇅';
    margin-left: 0.35em;
    opacity: 0.3;
    font-size: 0.8em;
}
.sortable-table th[data-sort-active="asc"]::after {
    content: '↑';
    opacity: 0.8;
}
.sortable-table th[data-sort-active="desc"]::after {
    content: '↓';
    opacity: 0.8;
}

/* ---- Action-menu (three-dot dropdown) ---- */
.action-menu {
    position: relative;
    display: inline-block;
}
.action-menu-trigger {
    background: rgba(0,0,0,0.04);
    border: none;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    min-width: 0;
}
.action-menu-trigger:hover {
    background: rgba(0,0,0,0.08);
    color: var(--text);
}
.action-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    z-index: 100;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 0.4rem;
}
.action-menu.open .action-menu-dropdown { display: block; }
.action-menu-dropdown a,
.action-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 0.45rem 0.75rem;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text);
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.1s;
}
.action-menu-dropdown a:hover,
.action-menu-dropdown button:hover {
    background: rgba(0,0,0,0.04);
    color: var(--accent);
}
.action-menu-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-soft);
    margin: 0.3rem 0.4rem;
}

/* ================================================================
   Mobile enhancements
   ================================================================ */
@media (max-width: 600px) {
    .camera-actions button {
        flex: 1;
        padding: 0.75rem 0.5rem;
        font-size: 1rem;
    }
    #build-pdf-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
    }
    .page-thumb {
        width: 60px;
    }
    .page-thumb img {
        width: 60px;
        height: 80px;
    }
    /* Tables: allow horizontal scroll + hint with soft fade */
    .table-wrap {
        margin-left: -1.1rem;
        margin-right: -1.1rem;
        padding-left: 1.1rem;
        padding-right: 1.1rem;
    }
    table { font-size: 0.85rem; }
    thead th { padding: 0.5rem 0.6rem; font-size: 0.7rem; }
    tbody td { padding: 0.6rem; }
    td.actions { flex-wrap: wrap; gap: 0.3rem; }
    td.actions button, td.actions a {
        padding: 0.45rem 0.7rem;
        font-size: 0.8rem;
        min-height: 36px;
    }
    .summary-row { grid-template-columns: 1fr; text-align: left; }
    .summary-row div strong { font-size: 1.1rem; }
    /* Forms stack full-width on mobile */
    form button, form .btn { width: 100%; }
    form button.inline, form .btn.inline { width: auto; }
    .card { padding: 1.1rem; margin-bottom: 1rem; }
}

/* ------------------------------------------------------------------ */
/* Bank-TX manual matching                                             */
/* ------------------------------------------------------------------ */
.bank-tx-detail {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
}
.bank-tx-detail dt {
    color: var(--muted-color, #666);
    font-weight: 500;
}
.bank-tx-detail dd {
    margin: 0;
}
.bank-tx-detail .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9em;
}

.bank-match-table {
    width: 100%;
    border-collapse: collapse;
}
.bank-match-table th,
.bank-match-table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border-color, #e5e5e5);
    vertical-align: middle;
}
.bank-match-table tbody tr {
    cursor: pointer;
}
.bank-match-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}
.bank-match-table tbody tr.is-matched {
    opacity: 0.55;
}
.bank-match-table .right {
    text-align: right;
}
.bank-match-table .nowrap {
    white-space: nowrap;
}
.bank-match-table label {
    cursor: pointer;
    display: block;
}

.score-bar {
    position: relative;
    width: 90px;
    height: 6px;
    background: var(--border-color, #e5e5e5);
    border-radius: 3px;
    overflow: hidden;
    margin-left: auto;
}
.score-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #d9534f 0%, #f0ad4e 50%, #5cb85c 100%);
    transition: width 0.2s;
}

@media (max-width: 600px) {
    .bank-match-table {
        font-size: 0.85rem;
    }
    .bank-match-table th,
    .bank-match-table td {
        padding: 0.4rem 0.3rem;
    }
    .score-bar {
        width: 50px;
    }
}

/* ================================================================
   Property evaluations
   ================================================================ */
.eval-label-pos      { color: #2c5a30; background: rgba(61,107,68,0.12); }
.eval-label-warn     { color: #946800; background: rgba(255,204,0,0.15); }
.eval-label-neg      { color: #922020; background: rgba(192,57,43,0.10); }
.eval-label-neutral  { color: var(--text-secondary); background: rgba(0,0,0,0.05); }

.eval-row-pos:hover  { background: rgba(61,107,68,0.04) !important; }
.eval-row-neg:hover  { background: rgba(220,74,74,0.04) !important; }

.eval-computed {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-xs);
    background: var(--bg);
    border: none;
}

/* ---- Inline edit forms (Kontakte) ---- */
.inline-edit-form {
    padding: 0.5rem 0;
}
.actions-cell {
    white-space: nowrap;
}

/* ---- Unit profile overview (cards grid) ---- */
.unit-profile-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.unit-profile-card {
    display: flex; flex-direction: column; overflow: hidden;
}
.unit-profile-thumb {
    height: 180px; overflow: hidden; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    margin: -1.25rem -1.25rem 1rem;
}
.unit-profile-thumb img {
    width: 100%; height: 100%; object-fit: cover;
}
.unit-profile-thumb-empty {
    background: var(--bg-input); display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 0.85rem;
}
.unit-profile-info { flex: 1; }
.unit-profile-info h3 { margin: 0 0 0.25rem; }
.unit-profile-meta {
    display: flex; gap: 0.75rem; margin-top: 0.5rem;
    font-size: 0.85rem; color: var(--text-secondary);
}
.unit-profile-actions { margin-top: 1rem; }

/* ---- Unit profile detail ---- */
.features-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.25rem 1rem;
}
.feature-check {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.88rem; cursor: pointer; padding: 0.3rem 0;
}
.feature-check input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: var(--accent);
}

.photo-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}
.photo-item {
    position: relative; border-radius: var(--radius-xs); overflow: hidden;
    aspect-ratio: 4/3; background: var(--bg-input);
}
.photo-item img {
    width: 100%; height: 100%; object-fit: cover;
}
.photo-delete {
    position: absolute; top: 0.35rem; right: 0.35rem;
    width: 28px; height: 28px; padding: 0; border: none;
    border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff;
    font-size: 0.8rem; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.15s ease;
}
.photo-item:hover .photo-delete { opacity: 1; }

.doc-list { list-style: none; padding: 0; margin: 0.25rem 0; }
.doc-list li {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.4rem 0; border-bottom: 1px solid var(--border-soft);
}
.doc-list li:last-child { border-bottom: none; }

/* ---- Scanner ---- */
.scanner-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem; margin-bottom: 1.5rem;
}
.scanner-page {
    position: relative; border-radius: var(--radius-xs); overflow: hidden;
    aspect-ratio: 3/4; background: var(--bg-input); box-shadow: var(--shadow-sm);
}
.scanner-page img {
    width: 100%; height: 100%; object-fit: cover;
}
.scanner-page-num {
    position: absolute; top: 0.35rem; left: 0.35rem;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 0.75rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}
.scanner-rotate, .scanner-remove {
    position: absolute; width: 28px; height: 28px; padding: 0;
    border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; opacity: 0; transition: opacity 0.15s;
    min-height: 0;
}
.scanner-page:hover .scanner-rotate,
.scanner-page:hover .scanner-remove { opacity: 1; }
.scanner-rotate {
    bottom: 0.35rem; right: 0.35rem;
    background: rgba(0,0,0,0.55); color: #fff;
}
.scanner-remove {
    top: 0.35rem; right: 0.35rem;
    background: rgba(192,57,43,0.85); color: #fff;
}
.scanner-controls {
    display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
}
.scanner-capture-btn {
    padding: 1rem 2.5rem; font-size: 1.05rem;
    background: var(--accent); color: #fff;
}
.scanner-capture-icon { margin-right: 0.5rem; }
.scanner-finish-btn {
    background: var(--brand); color: #fff;
}
.scanner-finish-btn:hover {
    background: #b8993f;
}
.scanner-finish-btn:disabled {
    opacity: 0.4; cursor: not-allowed; transform: none;
}
.scanner-spinner {
    display: flex; align-items: center; gap: 0.75rem;
    color: var(--text-secondary);
}

/* Crop overlay */
.crop-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    padding: 12px;
}
.crop-wrap {
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
    max-width: 95vw; max-height: 95vh;
}
.crop-canvas-wrap {
    position: relative; user-select: none; touch-action: none;
    border-radius: 6px; overflow: hidden;
}
.crop-canvas {
    display: block; width: 100%; height: 100%;
}
.crop-svg {
    position: absolute; left: 0; top: 0; width: 100%; height: 100%;
    pointer-events: auto;
    touch-action: none;
    overflow: visible;
}
.crop-corner {
    cursor: grab;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}
.crop-corner:active {
    cursor: grabbing;
    fill: var(--gold-soft, #e8c87a);
}
.crop-buttons {
    display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center;
}
.crop-buttons button {
    min-width: 130px;
}

/* Note textarea inside scanner controls */
.scanner-note {
    width: 100%; padding: 0.55rem 0.85rem;
    font-family: var(--font-sans); font-size: 0.92rem;
    border: 1px solid var(--line); border-radius: var(--r-input);
    background: var(--white); color: var(--ink);
    resize: vertical; min-height: 3rem;
}
.scanner-note:focus {
    outline: none; border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(184,138,46,0.12);
}

/* ================================================================
   Tasks / Aufgaben
   ================================================================ */
.task-quick-add { padding: 0.85rem 1rem; }
.task-quick-form {
    display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
}
.task-quick-form input[type="text"] {
    flex: 1 1 18rem; min-width: 12rem;
}
.task-quick-form select { min-width: 8rem; }

.task-filterbar {
    display: flex; gap: 0.4rem; flex-wrap: wrap;
    margin: 0.75rem 0 0.85rem 0;
    align-items: center;
}
.task-filterbar .pill {
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--white);
    color: var(--ink-2);
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.12s ease;
}
.task-filterbar .pill:hover { background: var(--cream-3); }
.task-filterbar .pill.active {
    background: var(--forest);
    color: var(--white);
    border-color: var(--forest);
}
.task-filterbar .pill-divider {
    width: 1px; height: 1.4rem; background: var(--line-2); margin: 0 0.4rem;
}

.task-list-card { padding: 0; }
.task-list-card > h3 { padding: 0.85rem 1rem 0.4rem 1rem; }

.task-row {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--line-3);
}
.task-row:last-child { border-bottom: none; }
.task-row.is-done .task-title-btn { text-decoration: line-through; color: var(--muted); }

.task-toggle-form { display: inline-flex; margin: 0; }
.task-checkbox {
    width: 22px; height: 22px;
    border: 2px solid var(--line); border-radius: 50%;
    background: var(--white);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0; transition: all 0.15s ease;
}
.task-checkbox:hover { border-color: var(--forest); }
.task-checkbox.checked {
    background: var(--forest); border-color: var(--forest);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3E%3Cpath d='M6.2 11.4 2.6 7.8l1.1-1.1 2.5 2.5 5.4-5.4 1.1 1.1-6.5 6.5z'/%3E%3C/svg%3E");
    background-position: center; background-repeat: no-repeat; background-size: 14px;
}

.priority-badge {
    width: 18px; height: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 0.85rem; font-weight: 700;
    flex-shrink: 0;
}
.priority-badge.prio-high { background: rgba(168,63,31,0.14); color: var(--neg); }
.priority-badge.prio-mid  { background: rgba(184,138,46,0.18); color: var(--gold); }
.priority-badge.prio-low  { background: rgba(47,107,62,0.14); color: var(--pos); font-size: 1.05rem; }

.task-type-icon { flex-shrink: 0; }

.task-title-btn {
    background: none; border: none; padding: 0;
    text-align: left; cursor: pointer;
    font: inherit; color: var(--ink);
    flex: 1 1 auto; min-width: 0;
    white-space: normal; word-break: break-word;
}
.task-title-btn:hover { color: var(--forest); }

.task-recur-icon {
    color: var(--muted); margin-left: 0.4rem; font-size: 0.85rem;
}

.task-due {
    font-size: 0.8rem; padding: 0.15rem 0.55rem;
    border-radius: var(--r-pill);
    flex-shrink: 0; white-space: nowrap;
}
.task-due.due-overdue { background: rgba(168,63,31,0.14); color: var(--neg); }
.task-due.due-today   { background: rgba(168,63,31,0.10); color: var(--neg); }
.task-due.due-soon    { background: rgba(184,138,46,0.14); color: var(--gold); }
.task-due.due-far     { background: var(--cream-3); color: var(--muted); }

/* Edit modal */
.task-modal {
    border: none; border-radius: var(--r-card);
    padding: 1.5rem; max-width: 540px; width: 92vw;
    background: var(--white);
    box-shadow: 0 24px 60px rgba(0,0,0,0.18);
}
.task-modal::backdrop { background: rgba(0,0,0,0.45); }
.task-edit-form { display: flex; flex-direction: column; gap: 0.75rem; }
.recurrence-widget {
    border: 1px solid var(--line); border-radius: var(--r-input);
    padding: 0.5rem 0.75rem; margin: 0;
}
.recurrence-widget legend { padding: 0 0.4rem; font-weight: 500; color: var(--ink-2); }
.recurrence-widget [data-rrule-fields] { margin-top: 0.5rem; }

.weekday-toggle {
    display: inline-flex; align-items: center; gap: 0.2rem;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--line); border-radius: var(--r-pill);
    margin-right: 0.25rem; cursor: pointer; user-select: none;
    font-size: 0.85rem;
}
.weekday-toggle input { margin: 0; accent-color: var(--forest); }

/* ================================================================
   App-Passwords (CalDAV)
   ================================================================ */
.app-password-display {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    background: var(--cream-3);
    padding: 0.85rem;
    border-radius: var(--r-input);
    user-select: all;
    word-break: break-all;
    margin: 0.5rem 0;
}
.ap-list { width: 100%; border-collapse: collapse; }
.ap-list td, .ap-list th { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line-3); }
.ap-list .revoked { color: var(--muted); text-decoration: line-through; }

/* ── Toggle switch (role="switch") ──────────────────────────── */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
}
.toggle-label input[role="switch"] {
    appearance: none;
    -webkit-appearance: none;
    width: 2.75rem;
    height: 1.5rem;
    background: var(--line-3);
    border-radius: 0.75rem;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-label input[role="switch"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(1.5rem - 4px);
    height: calc(1.5rem - 4px);
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-label input[role="switch"]:checked {
    background: var(--forest);
}
.toggle-label input[role="switch"]:checked::after {
    transform: translateX(1.25rem);
}

/* ── Kontakte (globale Verwaltung) ───────────────────────────── */
.filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.6;
}
.filterbar a {
    padding: 0.25rem 0.7rem;
    border: 1px solid var(--line-3);
    border-radius: 999px;
    color: var(--ink-2);
    text-decoration: none;
    font-size: 0.85rem;
    background: var(--cream);
}
.filterbar a:hover { background: var(--cream-2); }
.filterbar a.active {
    background: var(--forest);
    color: #fff;
    border-color: var(--forest);
}
.contacts-table .actions-cell {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.tag.tag-kreditor { color: var(--neg);    background: rgba(168,63,31,0.08); border-color: rgba(168,63,31,0.20); }
.tag.tag-debitor  { color: var(--pos);    background: rgba(47,107,62,0.10); border-color: rgba(47,107,62,0.18); }
.tag.tag-failed   { color: var(--neg);    background: rgba(168,63,31,0.08); border-color: rgba(168,63,31,0.20); }
.tag.tag-pending  { color: var(--gold-2); background: rgba(184,138,46,0.10); border-color: rgba(184,138,46,0.22); }

/* ── Fahrtenbuch ────────────────────────────────────────────── */
.fb-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.fb-summary-grid > div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.fb-summary-grid strong {
    font-size: 1.4rem;
    font-family: 'Instrument Serif', serif;
    color: var(--ink);
    letter-spacing: -0.02em;
}
.fb-summary-section {
    border-top: 1px solid var(--line-3);
    padding-top: 0.6rem;
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.fb-summary-section small.muted {
    margin-right: 0.5rem;
}
.fb-table td.num, .fb-table th.num {
    text-align: right;
    white-space: nowrap;
}
.fb-table td {
    vertical-align: top;
}

