:root {
    --bg: #dfe4e8;
    --panel: #f7f7f7;
    --panel-2: #ececec;
    --border: #a9afb5;
    --border-dark: #676d72;
    --text: #1c2328;
    --muted: #5d666d;
    --blue: #175f9f;
    --blue-dark: #104775;
    --focus: #0b6fbd;
    --danger: #9e2f2f;
    --warning: #8a6100;
    --success: #246b38;
    --shadow: 0 2px 8px rgba(0,0,0,.16);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: "Segoe UI", Tahoma, Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, select, input { min-height: 34px; }
input, select, textarea {
    width: 100%; border: 1px solid #7d858c; background: #fff; color: var(--text); padding: 6px 8px; border-radius: 1px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(11,111,189,.25); border-color: var(--focus); }
label { display: grid; gap: 5px; font-weight: 600; color: #30383e; }
small, .help { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
code, .mono { font-family: Consolas, "Courier New", monospace; }
.break-all { word-break: break-all; }

.app-shell { height: 100vh; min-height: 0; overflow: hidden; display: grid; grid-template-columns: 230px minmax(0,1fr); grid-template-rows: 58px minmax(0,1fr) 26px; grid-template-areas: "top top" "side work" "status status"; }
.topbar { grid-area: top; display: grid; grid-template-columns: 230px minmax(260px, 520px) 1fr; align-items: center; gap: 20px; background: linear-gradient(#f8f8f8, #d8d8d8); border-bottom: 1px solid var(--border-dark); box-shadow: 0 1px 3px rgba(0,0,0,.2); padding: 0 12px 0 10px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--blue); color: #fff; border: 1px solid #0b3d66; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); font-weight: 700; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); }
.tenant-switcher { display: grid; grid-template-columns: auto minmax(180px, 1fr); align-items: center; gap: 8px; }
.tenant-switcher label { display: block; }
.user-area { justify-self: end; display: flex; align-items: center; gap: 12px; }
.user-area form { margin: 0; }
.sidebar { grid-area: side; min-height: 0; background: #eef1f3; border-right: 1px solid var(--border); padding: 10px 8px 14px; overflow-y: auto; scrollbar-gutter: stable; }
.sidebar-navigation { display: grid; gap: 6px; }
.sidebar a { display: block; color: var(--text); padding: 8px 10px; border: 1px solid transparent; }
.sidebar a:hover { background: #fff; border-color: #c7ccd0; text-decoration: none; }
.sidebar a.active { background: #d5e7f7; border-color: #7fa7c8; color: #0d3f68; font-weight: 600; }
.nav-home { margin-bottom: 2px; font-weight: 600; }
.nav-group { margin: 0; border: 1px solid #c3c9ce; background: #f5f6f7; }
.nav-group[open] { background: #e8ecef; }
.nav-group summary { position: relative; display: flex; align-items: center; min-height: 35px; padding: 7px 30px 7px 10px; color: #38434b; background: linear-gradient(#f8f9fa, #dfe3e6); font-size: 12px; font-weight: 700; letter-spacing: .025em; cursor: pointer; user-select: none; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::marker { content: ""; }
.nav-group summary::after { content: ''; position: absolute; right: 11px; top: 50%; width: 7px; height: 7px; border-right: 2px solid #4e5961; border-bottom: 2px solid #4e5961; transform: translateY(-65%) rotate(45deg); transition: transform .12s ease; }
.nav-group[open] summary::after { transform: translateY(-35%) rotate(225deg); }
.nav-group summary:hover { background: linear-gradient(#fff, #d5e2ec); }
.nav-group summary:focus-visible { outline: 2px solid rgba(11,111,189,.45); outline-offset: -2px; }
.nav-group.has-active { border-color: #7fa7c8; }
.nav-group.has-active > summary { color: #0d3f68; background: linear-gradient(#eef7ff, #d6e7f5); }
.nav-group-items { display: grid; gap: 2px; padding: 4px; border-top: 1px solid #c8cdd1; }
.nav-group-items a { padding-left: 14px; background: #f7f8f9; }
.nav-heading { margin-top: 13px; padding: 5px 10px 3px; color: #5f6971; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.workspace { grid-area: work; min-height: 0; min-width: 0; padding: 18px; overflow: auto; }
.workspace-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.workspace-head h1 { margin: 0; font-size: 24px; font-weight: 600; }
.workspace-head p { margin: 4px 0 0; color: var(--muted); }
.statusbar { grid-area: status; background: #e8e8e8; border-top: 1px solid var(--border-dark); display: flex; align-items: center; gap: 20px; padding: 0 9px; color: #444; font-size: 12px; }
.statusbar span { border-right: 1px solid #aaa; padding-right: 18px; }

.panel, .window { background: var(--panel); border: 1px solid var(--border-dark); box-shadow: var(--shadow); padding: 14px; margin-bottom: 16px; }
.window { padding: 0; }
.window-titlebar { background: linear-gradient(90deg, #155d9b, #4d8cbc); color: #fff; display: flex; justify-content: space-between; align-items: center; min-height: 34px; padding: 0 10px; font-weight: 600; }
.window-content { padding: 18px; }
.panel h2, .window h1 { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.narrow-panel { max-width: 760px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 6px 13px; border: 1px solid #777f85; background: linear-gradient(#fff, #d7d7d7); color: var(--text); box-shadow: inset 0 0 0 1px rgba(255,255,255,.6); cursor: pointer; border-radius: 1px; text-decoration: none; }
.button:hover { background: linear-gradient(#fff, #c8d8e5); text-decoration: none; }
.button.primary { background: linear-gradient(#2f83c3, #17649f); border-color: #0d4d7d; color: #fff; }
.button.primary:hover { background: linear-gradient(#4596d0, #1d6eaa); }
.button.small { min-height: 28px; padding: 3px 9px; font-size: 12px; }
.button.icon { width: 32px; padding: 0; font-size: 20px; }
.toolbar { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-bottom: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.span-2 { grid-column: span 2; }
fieldset { border: 1px solid var(--border); margin: 0 0 16px; padding: 14px; }
legend { padding: 0 7px; font-weight: 600; }
form > label { margin-bottom: 12px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #d2d6d9; border-right: 1px solid #e1e3e5; padding: 7px 8px; text-align: left; vertical-align: top; }
th { background: linear-gradient(#f7f7f7, #dedede); color: #2d353a; font-size: 12px; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
tbody tr:nth-child(even) { background: #fafafa; }
tbody tr:hover { background: #eef6fc; }
tfoot td { background: #eceff1; font-weight: 700; }
.number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.error-cell { max-width: 360px; word-break: break-word; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.metric { background: linear-gradient(#fff, #e7ebee); border: 1px solid var(--border-dark); box-shadow: var(--shadow); padding: 13px; color: var(--text); }
.metric:hover { text-decoration: none; border-color: var(--blue); }
.metric span { display: block; color: var(--muted); }
.metric strong { display: block; font-size: 28px; margin-top: 8px; }
.split-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.65fr); gap: 16px; align-items: start; }
.split-grid.wide-left { grid-template-columns: minmax(0,2fr) minmax(300px,.7fr); }

.notice { border: 1px solid; padding: 10px 12px; margin: 0 0 14px; background: #fff; }
.notice.info { border-color: #78a2c4; background: #eaf4fb; }
.notice.warning { border-color: #c69a3b; background: #fff5d7; }
.notice.error { border-color: #c66; background: #fdeaea; color: #762020; }
.notice.success { border-color: #71a47e; background: #eaf7ed; color: #194e28; }
.badge { display: inline-block; padding: 2px 7px; border: 1px solid #8a9095; background: #eee; font-size: 11px; text-transform: uppercase; }
.badge.posted, .badge.completed, .badge.processed { border-color: #659675; background: #e2f2e7; color: #245d34; }
.badge.draft, .badge.queued, .badge.needs_review { border-color: #b59343; background: #fff2c9; color: #6c4e08; }
.badge.failed { border-color: #b66565; background: #f9dfdf; color: #7a2424; }
.badge.running, .badge.processing { border-color: #6897b9; background: #e1f0fa; color: #1e567f; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; background: #999; }
.status-dot.ok { background: #2f8247; }
.status-dot.not-ok { background: #bb7a12; }
.empty { color: var(--muted); font-style: italic; }

.details-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin: 0 0 14px; }
.details-grid div, .hash-details div { border: 1px solid #c7ccd0; background: #fff; padding: 9px; }
dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
dd { margin: 0; }
.hash-details { display: grid; gap: 8px; margin-top: 14px; }
.document-list { list-style: none; margin: 0; padding: 0; }
.document-list li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #d5d9dc; padding: 8px 0; }
.document-list li span { color: var(--muted); }
.booking-lines select { min-width: 280px; }
.money-input { min-width: 110px; text-align: right; }
.steps { padding-left: 22px; }
.steps li { margin-bottom: 7px; }
.totp-input { max-width: 220px; font-size: 22px; letter-spacing: .3em; text-align: center; }

.auth-shell, .installer-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #f4f6f8, #cfd6db); }
.auth-window { width: min(440px, 100%); }
.installer-body { background: radial-gradient(circle at top, #f4f6f8, #cfd6db); }
.installer-shell { align-items: start; }
.installer-shell .window { width: min(850px, 100%); margin-top: 30px; }

@media (max-width: 1100px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .split-grid, .split-grid.wide-left { grid-template-columns: 1fr; }
    .details-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
    .app-shell { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0,1fr) 26px; grid-template-areas: "top" "side" "work" "status"; }
    .topbar { grid-template-columns: 1fr; gap: 8px; padding: 10px; }
    .user-area { justify-self: start; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar-navigation { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .nav-home, .nav-group { grid-column: 1 / -1; }
    .nav-group-items { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .nav-heading { grid-column: 1 / -1; }
    .workspace { padding: 10px; }
    .metric-grid, .form-grid, .form-grid.three, .details-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .statusbar { overflow-x: auto; white-space: nowrap; }
}

/* Buchungs- und SKR03-Module ab Version 0.2.0/0.3.0 */
.metric-grid.six { grid-template-columns: repeat(6, minmax(0,1fr)); }
.metric-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.details-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.panel-head.secondary { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); }
.toolbar-start { justify-content: flex-start; flex-wrap: wrap; }
.toolbar form, .button-group { display: flex; gap: 8px; margin: 0; }
.button.danger { color: #7a2424; border-color: #a65c5c; background: linear-gradient(#fff, #efd9d9); }
.badge.open { border-color: #659675; background: #e2f2e7; color: #245d34; }
.badge.review { border-color: #b59343; background: #fff2c9; color: #6c4e08; }
.badge.reversed, .badge.cancelled { border-color: #8b6d99; background: #efe5f3; color: #5a3968; }
.inline-form { align-items: end; margin-bottom: 0; }
.inline-form label:last-child { align-self: end; }
.drop-zone { min-height: 180px; border: 2px dashed #7d94a7; background: #f7fbfe; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 22px; cursor: pointer; text-align: center; transition: background .15s, border-color .15s; }
.drop-zone:hover, .drop-zone:focus, .drop-zone.drag-over { border-color: var(--blue); background: #e3f2fd; outline: none; }
.drop-zone strong { font-size: 18px; }
.drop-zone span { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.upload-queue { display: grid; gap: 6px; margin: 12px 0; }
.upload-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); background: #fff; }
.upload-row.running strong { color: #1e567f; }
.upload-row.completed { border-color: #71a47e; background: #eaf7ed; }
.upload-row.completed strong { color: #194e28; }
.upload-row.failed { border-color: #c66; background: #fdeaea; }
.upload-row.failed strong { color: #762020; }
.js-upload .fallback-upload { display: none; }
textarea { resize: vertical; }

@media (max-width: 1400px) {
    .metric-grid.six { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .form-grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
    .metric-grid.six, .metric-grid.three, .form-grid.four, .details-grid.two { grid-template-columns: 1fr; }
    .button-group { flex-direction: column; width: 100%; }
}

/* Version 0.4.0: unabhängige Scrollbereiche und erweiterter Arbeitsplatz. */
.metric-grid.twelve { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
@media (max-width: 1100px) { .metric-grid.twelve { grid-template-columns: repeat(2, minmax(150px, 1fr)); } }
@media (max-width: 760px) {
    .app-shell { height: auto; min-height: 100vh; overflow: visible; }
    .sidebar, .workspace { min-height: auto; }
    .metric-grid.twelve { grid-template-columns: 1fr; }
}


/* Hotfix 3: Briefpapier- und Dokumentdesign. */
.letterhead-module { grid-template-columns: minmax(300px,.62fr) minmax(620px,1.38fr); }
.letterhead-list-panel { position: sticky; top: 0; max-height: calc(100vh - 132px); overflow: auto; }
.letterhead-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.letterhead-list li { border: 1px solid #c7ccd0; background: #fff; padding: 10px; }
.letterhead-list li.selected { border-color: #6f9fc3; background: #eef7ff; }
.letterhead-list strong, .letterhead-list span { display: block; }
.letterhead-list .toolbar.compact { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.letterhead-form fieldset { background: #fbfbfb; }
.letterhead-form legend { color: #173f60; }
.meta-field-editor { display: grid; gap: 8px; }
.meta-field-row { display: grid; grid-template-columns: 28px minmax(100px,.7fr) minmax(180px,1.3fr); align-items: center; gap: 9px; border: 1px solid #d1d5d8; background: #fff; padding: 7px 9px; }
.meta-field-row input[type=checkbox] { width: 18px; min-height: 18px; }
.letterhead-measurement-note { border-left: 4px solid #7a9fbc; padding: 9px 12px; background: #eef5fa; margin-bottom: 14px; }
@media (max-width: 1200px) {
    .letterhead-module { grid-template-columns: 1fr; }
    .letterhead-list-panel { position: static; max-height: none; }
}
@media (max-width: 760px) {
    .meta-field-row { grid-template-columns: 28px 1fr; }
    .meta-field-row input:not([type=checkbox]) { grid-column: 1 / -1; }
}

/* Hotfix 5: intelligente Belegerfassung, Stammdaten und Reporting */
.invoice-drop-zone {
    min-height: 132px; display: grid; place-items: center; gap: 5px; padding: 18px;
    border: 2px dashed #6e8fa9; background: #f3f8fc; text-align: center; cursor: pointer;
}
.invoice-drop-zone:hover, .invoice-drop-zone.drag-over { background: #e3f1fb; border-color: #17649f; }
.invoice-drop-zone.processing { opacity: .68; cursor: progress; }
.analysis-status { margin: 10px 0 0; font-weight: 600; }
.analysis-status.error { color: #8b2020; }
.analysis-results { margin-top: 12px; padding: 12px; border: 1px solid #8ba6bb; background: #f7fbfe; }
.analysis-results ul { margin: 8px 0 8px 20px; }
.analysis-confidence-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(175px,1fr)); gap: 9px; margin: 12px 0; }
.analysis-confidence { display: grid; gap: 3px; padding: 9px 10px; border: 1px solid #aeb8bf; background: #fff; min-width: 0; }
.analysis-confidence span { color: var(--muted); font-size: 12px; }
.analysis-confidence strong { overflow-wrap: anywhere; }
.analysis-confidence small { font-size: 11px; }
.analysis-confidence.safe { border-left: 5px solid #347a45; background: #f0f8f2; }
.analysis-confidence.probable { border-left: 5px solid #9a6b10; background: #fff8e7; }
.analysis-confidence.review { border-left: 5px solid #9b2f2f; background: #fff1f1; }
.report-card-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.report-card { display: block; padding: 14px; border: 1px solid #9da7ae; background: linear-gradient(#fff,#e8ecef); color: var(--text); box-shadow: var(--shadow); }
.report-card:hover { border-color: var(--blue); text-decoration: none; }
.report-card strong { display: block; margin-bottom: 6px; font-size: 15px; }
.report-card span { color: var(--muted); }
.report-summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 10px; margin-bottom: 14px; }
.report-summary div { padding: 10px; border: 1px solid #bbc2c7; background: #f7f8f9; }
.report-summary strong { display: block; margin-top: 5px; font-size: 18px; }
.report-sheet { margin-bottom: 18px; }
.report-sheet h3 { margin: 0 0 8px; }
.catalog-list { display: grid; gap: 8px; }
.catalog-list details { border: 1px solid #b8c0c6; background: #f7f8f9; }
.catalog-list summary { padding: 9px 11px; cursor: pointer; font-weight: 600; background: linear-gradient(#fff,#e5e8ea); }
.catalog-list details > form { padding: 12px; border-top: 1px solid #c5cbd0; }
.contact-edit-row { border-bottom: 1px solid #ccd1d5; padding: 12px 0; }
.contact-edit-row:last-of-type { border-bottom: 0; }
.contact-edit-list { display: grid; gap: 8px; margin-bottom: 18px; }
.contact-edit-details { border: 1px solid #b8c0c6; background: #f7f8f9; }
.contact-edit-details summary { cursor: pointer; padding: 9px 11px; font-weight: 600; background: linear-gradient(#fff,#e5e8ea); }
.contact-edit-details .contact-edit-row { padding: 12px; border-top: 1px solid #c5cbd0; border-bottom: 0; }
.form-grid.four { grid-template-columns: repeat(4,minmax(0,1fr)); }
.check { display: inline-flex; grid-auto-flow: column; justify-content: start; align-items: center; gap: 7px; font-weight: 500; }
.check input { width: auto; min-height: 0; }
.muted { opacity: .62; }

@media (max-width: 1120px) {
    .report-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .form-grid.four { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 720px) {
    .report-card-grid, .form-grid.four { grid-template-columns: 1fr; }
}

/* Version 0.6.0: Suchleisten, Pagination und Importdiagnostik. */
.filter-actions { display:flex; align-items:flex-end; gap:8px; padding-bottom:1px; }
.filter-actions-wide { grid-column:1 / -1; justify-content:flex-end; }
.pagination { display:flex; justify-content:center; align-items:center; gap:12px; margin-top:14px; }
.error-text { display:block; color:#7a2424; font-weight:600; margin-top:4px; }
.badge.duplicate { background:#e5edf5; color:#284b68; }
.badge.conflict, .badge.error { background:#f8dddd; color:#7a2424; }
.notice strong { font-weight:700; }
@media (max-width:760px) { .filter-actions,.filter-actions-wide { grid-column:auto; justify-content:flex-start; flex-wrap:wrap; } }

/* Version 0.6.1: betriebliche Sicherungs- und Restore-Steuerung. */
.panel.nested { margin: 10px 0; padding: 0; box-shadow: none; border-color: #aeb8bf; }
.panel.nested > summary { cursor: pointer; padding: 10px 12px; background: linear-gradient(#fff,#e8ecef); border-bottom: 1px solid transparent; }
.panel.nested[open] > summary { border-bottom-color: #bcc4ca; }
.panel.nested > form, .panel.nested > .button-row, .panel.nested > p, .panel.nested > .notice { margin: 12px; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button-row form { margin: 0; }
.badge.ok, .badge.verified { background: #dcefdc; color: #245d2c; }
.badge.failed { background: #f8dddd; color: #7a2424; }
.badge.not_checked, .badge.never, .badge.warning { background: #fff0c8; color: #735312; }

/* Version 0.9.0: Arbeitskörbe, globale Suche, gespeicherte Ansichten, PWA und mobile Erfassung. */
.topbar { grid-template-columns: 220px minmax(220px,420px) minmax(260px,1fr) auto; gap: 14px; }
.topbar-search { display:flex; align-items:center; gap:7px; min-width:0; margin:0; }
.topbar-search input { min-width:120px; width:100%; }
.connection-status { position:fixed; right:16px; bottom:38px; z-index:1200; max-width:min(420px,calc(100vw - 32px)); padding:9px 12px; border:1px solid #8b5d15; background:#fff2c9; box-shadow:var(--shadow); font-weight:600; }
.connection-status.online { border-color:#54825e; background:#e5f4e7; color:#234f2d; }
.metric-grid.seven { grid-template-columns:repeat(7,minmax(105px,1fr)); }
.form-grid.six { grid-template-columns:repeat(6,minmax(120px,1fr)); }
.span-all { grid-column:1 / -1; }
.saved-view-bar { display:flex; align-items:flex-end; flex-wrap:wrap; gap:10px; padding:10px; margin-bottom:14px; border:1px solid #b9c2c9; background:#f4f7f9; }
.saved-view-bar > label { min-width:210px; }
.saved-view-bar form { display:flex; align-items:flex-end; flex-wrap:wrap; gap:8px; margin:0; }
.saved-view-bar .saved-view-save label:first-of-type { min-width:220px; }
.saved-view-bar .check-label { display:flex; flex-direction:row; align-items:center; gap:6px; padding-bottom:7px; font-weight:500; }
.saved-view-bar .check-label input { width:auto; min-height:auto; }
.search-panel { max-width:980px; }
.global-search-page-form { margin:0; }
.search-input-row { display:grid; grid-template-columns:minmax(180px,1fr) auto; gap:8px; }
.search-summary { margin:10px 0 14px; font-weight:700; }
.search-result-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.search-result-group { margin:0; }
.search-result-list { display:grid; gap:7px; }
.search-result-item { display:grid; gap:2px; padding:9px 10px; border:1px solid #c3cbd1; background:#fff; color:var(--text); }
.search-result-item:hover { border-color:var(--blue); background:#eef7fd; text-decoration:none; }
.search-result-item span,.search-result-item small { color:var(--muted); overflow-wrap:anywhere; }
.workbasket-metrics .metric { text-decoration:none; }
.work-item-list { display:grid; gap:11px; }
.work-item { border:1px solid #b8c0c6; border-left-width:6px; background:#fff; }
.work-item.priority-urgent { border-left-color:#982f2f; }
.work-item.priority-high { border-left-color:#a06c12; }
.work-item.priority-normal { border-left-color:#487c9f; }
.work-item.priority-low { border-left-color:#7c8a91; }
.work-item.state-done { opacity:.72; }
.work-item-main { padding:12px 14px; }
.work-item-main h3 { margin:7px 0 5px; }
.work-item-main p { margin:0 0 7px; }
.work-item-tags { display:flex; flex-wrap:wrap; gap:6px; }
.work-item-edit { border-top:1px solid #d0d6da; background:#f7f8f9; }
.work-item-edit summary { cursor:pointer; padding:8px 14px; font-weight:600; }
.work-item-edit form { padding:12px 14px; margin:0; }
.badge.urgent { background:#f8dddd; color:#792121; }
.badge.high { background:#fff0c8; color:#735312; }
.badge.normal { background:#e2eef7; color:#28526d; }
.badge.low { background:#e9ecee; color:#4d5960; }
.mobile-capture-shell { display:grid; grid-template-columns:minmax(340px,1.1fr) minmax(300px,.9fr); gap:15px; }
.mobile-capture-panel { align-self:start; }
.camera-picker { min-height:160px; display:grid; place-content:center; text-align:center; gap:7px; padding:18px; border:2px dashed #668eaa; background:#f1f8fc; cursor:pointer; }
.camera-picker:hover,.camera-picker:focus-within { border-color:#17649f; background:#e5f2fa; }
.camera-picker strong { font-size:18px; }
.camera-picker span { color:var(--muted); }
.mobile-preview { display:grid; grid-template-columns:minmax(120px,220px) 1fr; align-items:center; gap:12px; margin:13px 0; padding:10px; border:1px solid #bcc6cd; background:#fff; }
.mobile-preview img { display:block; max-width:100%; max-height:300px; object-fit:contain; }
.mobile-preview small,.mobile-preview strong { display:block; overflow-wrap:anywhere; }
.offline-queue-panel { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-top:12px; padding:10px; border:1px solid #b7c1c8; background:#f5f7f8; }
.offline-queue-panel span { margin-right:auto; color:var(--muted); }
.readiness-wizard.needs-action { border-left:5px solid #a36b12; }
.readiness-wizard.ready { border-left:5px solid #3c7e4a; }
.readiness-steps { list-style:none; counter-reset:ready-step; margin:14px 0; padding:0; display:grid; gap:8px; }
.readiness-steps li { counter-increment:ready-step; display:grid; grid-template-columns:minmax(210px,.75fr) minmax(240px,1fr) auto; align-items:center; gap:12px; padding:10px 12px 10px 48px; border:1px solid #c5ccd1; background:#fff; position:relative; }
.readiness-steps li::before { content:counter(ready-step); position:absolute; left:12px; width:26px; height:26px; border-radius:50%; display:grid; place-items:center; border:1px solid #87949d; background:#eef1f3; font-weight:700; }
.readiness-steps li.configured { border-color:#7fa088; background:#eff7f1; }
.readiness-steps li.configured::before { content:'✓'; border-color:#54805f; background:#dceedd; color:#21542c; }
.readiness-steps li span { color:var(--muted); }
.readiness-steps li form { margin:0; }
.dashboard-workbasket .metric-grid { margin-bottom:0; }

@media (max-width:1350px) {
    .topbar { grid-template-columns:210px minmax(180px,330px) minmax(210px,1fr) auto; gap:9px; }
    .metric-grid.seven { grid-template-columns:repeat(4,minmax(120px,1fr)); }
    .form-grid.six { grid-template-columns:repeat(3,minmax(140px,1fr)); }
}
@media (max-width:1000px) {
    .topbar-search { display:none; }
    .topbar { grid-template-columns:220px minmax(220px,1fr) auto; }
    .mobile-capture-shell,.search-result-grid { grid-template-columns:1fr; }
    .readiness-steps li { grid-template-columns:1fr auto; }
    .readiness-steps li span { grid-column:1 / -1; }
}
@media (max-width:760px) {
    .topbar { grid-template-columns:1fr; height:auto; padding:8px; }
    .app-shell { grid-template-rows:auto auto minmax(0,1fr) 26px; grid-template-columns:1fr; grid-template-areas:'top' 'side' 'work' 'status'; }
    .topbar .tenant-switcher,.topbar .user-area { width:100%; }
    .metric-grid.seven,.form-grid.six { grid-template-columns:1fr; }
    .saved-view-bar,.saved-view-bar form { align-items:stretch; flex-direction:column; }
    .saved-view-bar > label,.saved-view-bar .saved-view-save label:first-of-type { min-width:0; width:100%; }
    .search-input-row { grid-template-columns:1fr; }
    .mobile-preview { grid-template-columns:1fr; }
    .readiness-steps li { grid-template-columns:1fr; padding-left:48px; }
}

/* 0.9.0 · Beleggestützter Buchungsvorschlag */
.booking-document-capture {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.25fr);
    gap: 18px;
    align-items: center;
    margin: 0 0 18px;
    padding: 16px;
    border: 1px solid #9aa8b5;
    background: #eef3f7;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.booking-document-capture h3 { margin: 0 0 6px; }
.booking-document-capture p { margin: 0; line-height: 1.45; }
.drop-zone.compact { min-height: 82px; padding: 14px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.drop-zone.compact.processing { cursor: progress; opacity: .72; }
.booking-proposal-dialog {
    width: min(1220px, calc(100vw - 48px));
    max-height: calc(100vh - 54px);
    padding: 0;
    border: 1px solid #53616f;
    background: #f4f5f6;
    color: #111820;
    box-shadow: 0 18px 55px rgba(0,0,0,.42);
}
.booking-proposal-dialog::backdrop { background: rgba(24,33,42,.46); }
.booking-proposal-dialog form { margin: 0; }
.dialog-titlebar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 14px;
    border-bottom: 1px solid #7d8994;
    background: linear-gradient(#f7f8f9,#dce2e7);
}
.dialog-titlebar h2 { margin: 0 0 3px; font-size: 1.2rem; }
.dialog-titlebar p { margin: 0; color: #465767; }
.dialog-body { padding: 16px; overflow: auto; max-height: calc(100vh - 190px); }
.dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border-top: 1px solid #9aa8b5;
    background: #e6ebef;
}
.proposal-table-wrap { max-height: 46vh; margin: 14px 0; }
.booking-proposal-table select { min-width: 230px; max-width: 360px; }
.booking-proposal-table input[type="text"], .booking-proposal-table input:not([type]) { min-width: 180px; }
.booking-proposal-table .proposal-money { min-width: 92px; width: 110px; text-align: right; }
.booking-proposal-table .proposal-role { white-space: nowrap; font-weight: 600; }
.booking-proposal-table tr.proposal-tax-row { background: #fff9e7; }
.booking-proposal-table tr.proposal-counterpart-row { background: #edf6ee; }
.checkbox-line { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; }
.checkbox-line input { margin-top: 3px; }
#booking-proposal-notices .notice { margin: 0 0 8px; }
#journal-document-status.error { color: #a21f2d; font-weight: 600; }
#journal-document-status.success { color: #246b38; font-weight: 600; }
@media (max-width: 900px) {
    .booking-document-capture { grid-template-columns: 1fr; }
    .booking-proposal-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
    .dialog-body { max-height: calc(100vh - 150px); }
    .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
    .dialog-actions .button-group { display: grid; grid-template-columns: 1fr 1fr; }
}

.check-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px;margin-top:14px}.check-card{border:1px solid #aab3bb;background:#fff;padding:10px 12px;display:flex;flex-direction:column;gap:4px}.check-card.ok{border-left:5px solid #2f7d32}.check-card.warning{border-left:5px solid #b36b00}.check-card span{font-size:.9rem;color:#4b5964}.offline-verify-form{margin-top:8px;padding:10px;border:1px solid #c6cdd3;background:#f8fafb}.offline-verify-form .form-grid{margin-bottom:8px}.account-note{display:block;color:#5d6871;font-size:.78rem;margin-top:2px}
.status-dot.neutral{background:#7b858d}
