:root {
    --bg: #eef2f5;
    --panel: #ffffff;
    --panel-soft: #f8fafb;
    --ink: #15222d;
    --muted: #63717d;
    --line: #d9e1e7;
    --line-strong: #c7d1d9;
    --accent: #08715c;
    --accent-strong: #045844;
    --accent-soft: #e4f4ef;
    --accent-faint: #f2faf7;
    --danger: #a33232;
    --danger-soft: #fff1f1;
    --warning: #7f5600;
    --warning-soft: #fff8df;
    --success: #176a43;
    --shadow-sm: 0 8px 24px rgba(31, 48, 61, .07);
    --shadow-lg: 0 24px 70px rgba(31, 48, 61, .13);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
img, svg { max-width: 100%; }
address { color: var(--muted); font-style: normal; line-height: 1.7; }
code { padding: .12rem .35rem; border-radius: 6px; color: #33424e; background: #edf2f5; font-size: .9em; }

h1, h2, h3 { color: var(--ink); letter-spacing: -.025em; }
h1 { margin: 8px 0 12px; font-size: clamp(2rem, 4vw, 2.85rem); line-height: 1.08; }
h2 { margin: 0 0 8px; font-size: 1.25rem; }
h3 { margin: 0 0 6px; }
p { color: var(--muted); line-height: 1.65; }
small, .muted { color: var(--muted); }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 850; }
.lead { margin: 0 0 26px; font-size: 1.02rem; }
.page-intro { max-width: 760px; margin: 8px 0 0; }

.panel { background: var(--panel); border: 1px solid rgba(210, 220, 227, .92); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 15px; cursor: pointer; font-weight: 780; transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); box-shadow: 0 7px 18px rgba(8, 113, 92, .19); }
.button.primary:hover { color: #fff; box-shadow: 0 10px 24px rgba(8, 113, 92, .25); }
.button.ghost { color: var(--ink); background: #fff; border-color: var(--line); }
.button.ghost:hover { border-color: var(--line-strong); background: var(--panel-soft); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.wide { width: 100%; }
.small-button { min-height: 35px; padding: 6px 10px; font-size: .82rem; }

.alert { margin: 0 0 20px; padding: 14px 16px; border-radius: 12px; line-height: 1.55; }
.alert.error { color: var(--danger); background: var(--danger-soft); border: 1px solid #efcaca; }
.alert.success { color: var(--success); background: var(--accent-soft); border: 1px solid #cce8de; }
.alert.warning { color: var(--warning); background: var(--warning-soft); border: 1px solid #ebdda8; }
.alert ul { margin-bottom: 0; }
.security-note { margin-top: 18px; padding: 15px 16px; border-left: 4px solid var(--accent); border-radius: 8px; color: #42515c; background: var(--accent-faint); line-height: 1.6; }

/* Authentication */
.auth-body { background: radial-gradient(circle at 15% 15%, rgba(91, 188, 157, .28), transparent 30%), radial-gradient(circle at 88% 82%, rgba(102, 151, 189, .18), transparent 34%), #edf2f4; }
.auth-shell { min-height: calc(100vh - 54px); display: grid; place-items: center; padding: 36px 18px; }
.auth-layout { width: min(100%, 980px); display: grid; grid-template-columns: 1.15fr .85fr; overflow: hidden; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.auth-intro { position: relative; min-height: 560px; display: flex; flex-direction: column; justify-content: center; padding: clamp(34px, 6vw, 72px); color: #fff; background: linear-gradient(145deg, #075a4a 0%, #0a8069 58%, #0a685a 100%); }
.auth-intro::after { content: ""; position: absolute; inset: auto -90px -120px auto; width: 280px; height: 280px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; box-shadow: 0 0 0 48px rgba(255,255,255,.035), 0 0 0 96px rgba(255,255,255,.025); }
.auth-intro .eyebrow { color: #bdebdc; }
.auth-intro h1 { max-width: 590px; color: #fff; }
.auth-intro p { max-width: 560px; color: rgba(255,255,255,.78); }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; flex: 0 0 auto; margin-bottom: 24px; border-radius: 15px; color: #fff; background: var(--accent); box-shadow: 0 12px 30px rgba(0,0,0,.15); font-size: 1.65rem; font-weight: 900; }
.auth-intro .brand-mark { color: var(--accent-strong); background: #fff; }
.brand-mark.small { width: 38px; height: 38px; margin: 0; border-radius: 11px; font-size: 1.1rem; }
.security-list { position: relative; z-index: 1; display: grid; gap: 12px; margin: 24px 0 0; padding: 0; list-style: none; }
.security-list li { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.9); }
.security-list li::before { content: "✓"; width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; color: #075a4a; background: #d9f4eb; font-size: .78rem; font-weight: 900; }
.auth-form-column { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 5vw, 58px); background: #fff; }
.auth-form-column h2 { margin-top: 8px; font-size: 2rem; }
.auth-help { margin: 20px 0 0; font-size: .82rem; text-align: center; }
.auth-footer { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 24px; padding: 12px 18px; color: var(--muted); font-size: .88rem; }

/* Forms */
.stack { display: grid; gap: 18px; }
.form-grid, .form-sections { display: grid; gap: 22px; }
fieldset { display: grid; gap: 16px; margin: 0; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, #fff, #fcfdfd); }
legend { padding: 0 8px; color: #273641; font-weight: 850; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 14px; }
.grid-2-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: span 4; }
label { display: grid; align-content: start; gap: 7px; color: #34434e; font-size: .87rem; font-weight: 760; }
label small { line-height: 1.45; font-weight: 450; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid #c9d3db; border-radius: 10px; padding: 10px 12px; color: var(--ink); background: #fff; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #aebbc5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(8, 113, 92, .12); }
input[readonly] { color: #687681; background: #f2f5f7; }
.checkbox { display: flex; align-items: center; gap: 10px; }
.checkbox input { width: 19px; min-height: 19px; margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding-top: 2px; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: .82rem; }

/* App shell */
.topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: .96rem; }
.brand-copy small { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.user-name { color: #465560; font-size: .86rem; font-weight: 700; }
.secure-indicator { display: inline-flex; align-items: center; gap: 7px; color: var(--success); font-size: .75rem; font-weight: 760; }
.secure-indicator span { width: 8px; height: 8px; border-radius: 50%; background: #2a9d68; box-shadow: 0 0 0 4px rgba(42,157,104,.12); }
.app-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.sidebar-wrap { position: sticky; top: 72px; height: calc(100vh - 72px); display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fff; }
.sidebar { flex: 1; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; padding: 24px 15px; }
.sidebar a, .nav-disabled { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; color: #42515c; font-size: .89rem; font-weight: 680; }
.sidebar a:hover { color: var(--accent-strong); background: #f3f7f6; }
.sidebar a.active { color: var(--accent-strong); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.nav-disabled { color: #9aa5ad; cursor: not-allowed; }
.nav-disabled small { font-size: .64rem; font-weight: 600; }
.nav-label { margin: 19px 12px 5px; color: #8b98a1; font-size: .65rem; font-weight: 850; text-transform: uppercase; letter-spacing: .12em; }
.sidebar-security { display: grid; gap: 5px; margin: 0 15px 18px; padding: 13px; border: 1px solid #d9e9e3; border-radius: 12px; color: #315044; background: var(--accent-faint); }
.sidebar-security strong { font-size: .76rem; }
.sidebar-security span { color: #64756d; font-size: .7rem; line-height: 1.45; }
.main-column { min-width: 0; display: flex; flex-direction: column; }
.content { width: min(100%, 1420px); flex: 1; padding: 36px clamp(20px, 3vw, 42px); }
.app-footer { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px clamp(20px, 3vw, 42px); border-top: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,.55); font-size: .8rem; }
.app-footer nav, .public-footer nav { display: flex; gap: 20px; }
.mobile-navigation { display: none; }

.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { margin-bottom: 0; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.workspace-panel { margin-bottom: 22px; padding: 24px; box-shadow: none; }
.narrow-panel { max-width: 880px; }
.section-heading p { margin: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 22px; }
.metric-card { position: relative; overflow: hidden; display: grid; gap: 8px; padding: 21px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(150deg, #fff 65%, #f3faf7); box-shadow: 0 5px 18px rgba(31,48,61,.04); }
.metric-card::after { content: ""; position: absolute; top: -20px; right: -18px; width: 70px; height: 70px; border-radius: 50%; background: rgba(8,113,92,.06); }
.metric-card span { color: var(--muted); font-size: .84rem; font-weight: 730; }
.metric-card strong { font-size: 2.25rem; letter-spacing: -.04em; }
.metric-card small { font-size: .78rem; }
.status-badge { display: inline-flex; align-items: center; white-space: nowrap; padding: 6px 10px; border-radius: 999px; color: var(--accent-strong); background: var(--accent-soft); font-size: .72rem; font-weight: 820; }
.status-badge.neutral { color: #65717a; background: #edf1f3; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-top: 22px; }
.module-grid article { padding: 19px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(180deg, #fff, #fcfdfd); }
.module-grid p { min-height: 52px; margin: 8px 0 12px; }
.done, .planned { font-size: .75rem; font-weight: 820; }
.done { color: var(--success); }
.planned { color: #91640c; }
.toolbar-form { display: flex; align-items: end; gap: 12px; }
.grow { flex: 1; }
.upload-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 14px; margin-top: 20px; }
.upload-form input[type="file"] { padding: 9px; }
.invoice-items { display: grid; gap: 16px; }
.invoice-item { padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }
.item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }

/* Tables */
.table-wrap { margin-top: 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; background: #fff; }
th, td { padding: 14px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #6a7781; background: #f7f9fa; font-size: .7rem; text-transform: uppercase; letter-spacing: .065em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfc; }
td code { white-space: nowrap; }

/* Public legal pages */
.public-body { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(circle at 10% 10%, rgba(8,113,92,.10), transparent 30%), var(--bg); }
.public-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px max(20px, calc((100vw - 1080px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); }
.public-header .brand > span:last-child { display: grid; gap: 1px; }
.public-header .brand small { font-size: .72rem; }
.legal-shell { width: min(100%, 1080px); flex: 1; margin: 0 auto; padding: 38px 20px; }
.legal-card { padding: clamp(25px, 5vw, 56px); }
.legal-heading { max-width: 790px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.legal-heading p { margin-bottom: 0; }
.legal-section { max-width: 830px; padding: 25px 0; border-bottom: 1px solid var(--line); }
.legal-section:last-child { border-bottom: 0; }
.legal-section p:last-child { margin-bottom: 0; }
.legal-list { display: grid; gap: 8px; margin: 0; }
.legal-list > div { display: grid; grid-template-columns: minmax(150px, .4fr) 1fr; gap: 16px; padding: 8px 0; }
.legal-list dt { color: #4f5d67; font-weight: 760; }
.legal-list dd { margin: 0; color: var(--muted); }
.public-footer { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px max(20px, calc((100vw - 1080px) / 2)); border-top: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,.72); font-size: .82rem; }

.installer-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: radial-gradient(circle at top right, #d9efe8, transparent 35%), var(--bg); }
.installer-panel { width: min(100%, 760px); padding: 38px; }

@media (max-width: 1050px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .span-4 { grid-column: span 2; }
    .app-layout { grid-template-columns: 220px minmax(0,1fr); }
}

@media (max-width: 850px) {
    .auth-layout { grid-template-columns: 1fr; }
    .auth-intro { min-height: auto; padding: 38px; }
    .security-list { grid-template-columns: 1fr; }
    .sidebar-wrap { display: none; }
    .app-layout { grid-template-columns: 1fr; }
    .mobile-navigation { display: block; position: sticky; top: 72px; z-index: 15; border-bottom: 1px solid var(--line); background: #fff; }
    .mobile-navigation summary { padding: 13px 20px; color: #3d4c57; cursor: pointer; font-weight: 760; list-style: none; }
    .mobile-navigation summary::-webkit-details-marker { display: none; }
    .mobile-navigation summary::after { content: "+"; float: right; color: var(--accent); }
    .mobile-navigation[open] summary::after { content: "−"; }
    .mobile-navigation nav { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding: 0 16px 16px; }
    .mobile-navigation a { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: #42515c; }
    .mobile-navigation a.active { color: var(--accent-strong); background: var(--accent-soft); border-color: #c8e5db; }
    .content { padding-top: 26px; }
}

@media (max-width: 650px) {
    .topbar { min-height: 66px; padding: 0 14px; }
    .app-layout { min-height: calc(100vh - 66px); }
    .mobile-navigation { top: 66px; }
    .brand-copy small, .secure-indicator, .user-name { display: none; }
    .topbar-actions { gap: 8px; }
    .topbar .button { min-height: 38px; padding: 7px 10px; }
    .auth-shell { padding: 18px 12px; }
    .auth-layout { border-radius: 18px; }
    .auth-intro, .auth-form-column { padding: 28px 24px; }
    .auth-intro h1 { font-size: 2rem; }
    .security-list { display: none; }
    .grid-2, .grid-2-equal, .grid-3, .grid-4, .metric-grid, .module-grid { grid-template-columns: 1fr; }
    .span-2, .span-4 { grid-column: span 1; }
    .content { padding: 22px 14px; }
    .page-heading, .section-heading { align-items: flex-start; flex-direction: column; }
    .heading-actions { width: 100%; }
    .heading-actions .button { flex: 1; }
    .workspace-panel { padding: 18px; }
    fieldset { padding: 17px; }
    .toolbar-form, .upload-form { display: grid; grid-template-columns: 1fr; }
    .form-actions .button { width: 100%; }
    .app-footer, .public-footer { align-items: flex-start; flex-direction: column; }
    .legal-shell { padding: 22px 12px; }
    .legal-card { padding: 24px 20px; }
    .legal-list > div { grid-template-columns: 1fr; gap: 3px; }
    .public-header { padding: 12px 14px; }
    .public-header .brand small { display: none; }
    .mobile-navigation nav { grid-template-columns: 1fr; }
}
.metric-date { font-size: 1.45rem !important; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-actions form { margin: 0; }

/* Version 0.4.0: Rechnungsfestschreibung und Zahlungen */
.page-actions, .table-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .7fr); gap: 22px; margin-bottom: 22px; }
.detail-card { padding: 24px; }
.detail-card h2 { margin-top: 0; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 26px; margin: 0; }
.detail-list div { min-width: 0; }
.detail-list .span-all { grid-column: 1 / -1; }
.detail-list dt, .totals-list dt { color: var(--muted); font-size: .8rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.detail-list dd, .totals-list dd { margin: 4px 0 0; }
.hash-code { display: block; max-width: 100%; overflow-wrap: anywhere; padding: 8px 10px; }
.totals-list { margin: 0; }
.totals-list div { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.totals-list .grand { margin-top: 5px; font-size: 1.08rem; font-weight: 850; }
.totals-list .open { color: var(--accent-strong); font-weight: 850; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 24px; border-color: #fecaca; background: var(--danger-soft); }
.danger-zone h2 { margin: 0 0 8px; color: var(--danger); }
.danger-zone p { margin: 0; max-width: 760px; }
.button.danger { color: #fff; background: var(--danger); border-color: var(--danger); white-space: nowrap; }
.button.danger:hover { filter: brightness(.94); }
.inline-callout { margin-top: 20px; padding: 16px 18px; border-left: 4px solid var(--accent); border-radius: 10px; background: var(--accent-faint); }
.empty-state { padding: 18px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); background: var(--panel-soft); }
.status-finalized { color: #075a4a; background: #d9f4eb; }
.status-partial { color: #8a4b08; background: #fff1d4; }
.status-paid { color: #166534; background: #dcfce7; }
.status-cancelled { color: #991b1b; background: #fee2e2; }
.metric-money { font-size: clamp(1.25rem, 2vw, 1.8rem) !important; }

@media (max-width: 900px) {
    .detail-grid { grid-template-columns: 1fr; }
    .danger-zone { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 620px) {
    .detail-list { grid-template-columns: 1fr; }
    .detail-list .span-all { grid-column: auto; }
    .page-actions { width: 100%; }
    .page-actions .button { flex: 1 1 auto; }
}
.finalize-form { display: grid; gap: 12px; min-width: min(100%, 330px); }
.confirm-check { display: flex; align-items: flex-start; gap: 9px; font-size: .88rem; line-height: 1.4; }
.confirm-check input { width: auto; margin-top: 3px; }
.narrow-panel { max-width: 820px; }
.status-matched { color: #075a4a; background: #d9f4eb; }
.status-reversed { color: #7f1d1d; background: #fee2e2; }

/* Version 0.5.0: Angebote und Aufträge */
.status-accepted { color: #166534; background: #dcfce7; }
.status-rejected { color: #991b1b; background: #fee2e2; }
.status-draft { color: #475569; background: #e2e8f0; }

.document-text { white-space: normal; line-height: 1.7; padding: 4px 0; max-width: 80ch; }

/* Version 0.7.0: Verträge, wiederkehrende Rechnungsentwürfe und Listenfilter */
.filter-panel { margin-bottom: 20px; padding: 18px 20px; }
.filter-grid { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(4, minmax(135px, 1fr)); gap: 13px; align-items: end; }
.filter-grid label { min-width: 0; }
.filter-search { grid-column: span 2; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-checkbox { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); }
.filter-checkbox input { width: auto; }
.inline-form { display: inline-flex; margin: 0; }
.status-active { color: #166534; background: #dcfce7; }
.status-paused { color: #854d0e; background: #fef3c7; }
.status-terminated { color: #64748b; background: #e2e8f0; }
.contract-summary { display: grid; gap: 12px; }
.contract-summary > div { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.contract-summary > div:last-child { border-bottom: 0; }

@media (max-width: 1180px) {
    .filter-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
    .filter-search { grid-column: span 2; }
}
@media (max-width: 760px) {
    .filter-grid { grid-template-columns: 1fr; }
    .filter-search { grid-column: auto; }
    .filter-actions { width: 100%; }
    .filter-actions .button { flex: 1 1 auto; }
}
.attachment-upload-form { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; align-items: end; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .attachment-upload-form { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .attachment-upload-form { grid-template-columns: 1fr; } .attachment-upload-form .span-2 { grid-column: auto; } }
.status-ending { color: #7a4f00; background: #fff4d6; border-color: #f1d08a; }

/* Version 0.7.1: Belegsuche und aufklappbare Navigation */
.sr-only { 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; }
.document-lookup { display: flex; align-items: center; gap: 8px; }
.document-lookup input { min-height: 40px; }
.topbar-lookup { width: min(430px, 38vw); margin-left: auto; }
.topbar-lookup input { min-width: 0; background: #f8fafb; }
.topbar-lookup .button { min-height: 40px; padding: 7px 12px; }
.mobile-lookup { grid-column: 1 / -1; align-items: end; padding: 4px 0 8px; }
.mobile-lookup label { flex: 1; }

.nav-group { margin: 8px 0 0; }
.nav-group > summary { position: relative; display: flex; min-height: 34px; align-items: center; justify-content: space-between; margin: 0 9px; padding: 6px 4px; color: #7d8b95; cursor: pointer; list-style: none; font-size: .67rem; font-weight: 850; text-transform: uppercase; letter-spacing: .11em; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: "›"; color: var(--accent); font-size: 1rem; line-height: 1; transform: rotate(0deg); transition: transform .15s ease; }
.nav-group[open] > summary::after { transform: rotate(90deg); }
.nav-group > summary:hover { color: var(--accent-strong); }
.nav-group-links { display: grid; gap: 4px; }

@media (max-width: 1050px) {
    .topbar-lookup { width: min(340px, 34vw); }
}
@media (max-width: 850px) {
    .topbar-lookup { display: none; }
    .mobile-navigation nav > .nav-group { grid-column: 1 / -1; margin: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
    .mobile-navigation .nav-group > summary { margin: 0; padding: 11px 12px; color: #596873; font-size: .74rem; }
    .mobile-navigation .nav-group-links { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding: 0 10px 10px; }
    .mobile-navigation .nav-group-links a, .mobile-navigation .nav-group-links .nav-disabled { min-height: 40px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; }
}
@media (max-width: 650px) {
    .mobile-navigation .nav-group-links { grid-template-columns: 1fr; }
    .mobile-lookup { display: grid; grid-template-columns: 1fr auto; }
}

/* Dashboard 0.7.3 */
.dashboard-heading { align-items: flex-end; }
.page-heading-actions { display: flex; align-items: flex-end; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.period-selector { display: flex; align-items: flex-end; gap: 8px; }
.period-selector label { min-width: 150px; font-size: .76rem; }
.period-selector select { min-height: 38px; padding-block: 7px; }
.dashboard-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card-link { color: inherit; text-decoration: none; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.metric-card-link:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 11px 28px rgba(31,48,61,.09); }
.metric-card-link:focus-visible { outline: 3px solid rgba(8,113,92,.25); outline-offset: 2px; }
.metric-card-warning { background: linear-gradient(150deg, #fff 62%, #fff5e7); }
.metric-card-warning::after { background: rgba(176,92,7,.08); }
.metric-delta { display: inline-flex; align-items: center; width: fit-content; padding: 3px 7px; border-radius: 999px; font-weight: 760; }
.metric-delta.positive { color: #166534; background: #dcfce7; }
.metric-delta.negative { color: #9f1239; background: #ffe4e6; }
.metric-delta.neutral { color: #475569; background: #e2e8f0; }
.dashboard-chart-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .48fr); gap: 18px; margin-bottom: 20px; }
.dashboard-chart-panel { min-width: 0; overflow: hidden; }
.dashboard-chart-wide { grid-column: 1 / -1; }
.chart-scroll { overflow-x: auto; padding-bottom: 4px; }
.dashboard-flow-chart { display: block; width: 100%; min-width: 720px; height: auto; }
.dashboard-horizontal-chart { display: block; width: 100%; height: auto; max-height: 265px; }
.chart-grid-line { stroke: #dce5e9; stroke-width: 1; }
.chart-zero-line { stroke: #8999a1; stroke-width: 1.4; }
.chart-axis-label, .chart-month-label, .chart-category-label, .chart-value-label { fill: #60717a; font-family: Arial, sans-serif; font-size: 11px; }
.chart-category-label { font-size: 12px; font-weight: 700; }
.chart-value-label { font-size: 11px; font-weight: 700; }
.chart-bar { opacity: .92; }
.chart-bar:hover { opacity: 1; }
.chart-bar-billed { fill: #08715c; }
.chart-bar-paid { fill: #4e8fb4; }
.chart-track { fill: #edf2f4; }
.chart-horizontal-bar { fill: #08715c; }
.aging-not_due { fill: #4e8fb4; }
.aging-days_1_30 { fill: #d5a129; }
.aging-days_31_60 { fill: #d9792b; }
.aging-days_61_plus { fill: #b33a3a; }
.pipeline-offer_open { fill: #6a78b8; }
.pipeline-order_open { fill: #7d6db2; }
.pipeline-invoice_draft { fill: #7c8b91; }
.pipeline-invoice_open { fill: #d28a2f; }
.pipeline-invoice_paid { fill: #2f8b67; }
.chart-legend { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.legend-swatch.billed { background: #08715c; }
.legend-swatch.paid { background: #4e8fb4; }
.chart-footnote { margin: 8px 0 0; color: var(--muted); font-size: .76rem; }
.dashboard-detail-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 18px; }
.dashboard-actions-panel { align-self: start; }
.dashboard-action-list { display: grid; gap: 9px; }
.dashboard-action-list > a { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; background: var(--panel-soft); }
.dashboard-action-list > a:hover { border-color: var(--accent); background: var(--accent-soft); }
.dashboard-action-list span { display: grid; gap: 3px; }
.dashboard-action-list small { color: var(--muted); }
.dashboard-action-list b { color: var(--accent); font-size: 1.15rem; }
.numeric-cell { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 1120px) {
    .dashboard-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-chart-grid, .dashboard-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .dashboard-heading, .page-heading-actions { align-items: stretch; }
    .page-heading-actions, .period-selector { width: 100%; }
    .period-selector label { flex: 1; }
    .dashboard-metric-grid { grid-template-columns: 1fr; }
    .chart-legend { white-space: normal; flex-wrap: wrap; }
}

/* Version 0.7.3: einheitliche Listen und Seitennavigation */
.list-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.result-count { margin: 0; color: var(--muted); font-size: .84rem; }
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-link { display: inline-flex; min-width: 38px; min-height: 36px; align-items: center; justify-content: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); text-decoration: none; background: #fff; font-weight: 720; font-size: .82rem; }
.page-link:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.page-link.active { color: #fff; border-color: var(--accent); background: var(--accent); }
.page-link.disabled { pointer-events: none; opacity: .45; }
.pagination-gap { color: var(--muted); padding: 0 2px; }
@media (max-width: 650px) { .list-footer { align-items: flex-start; flex-direction: column; } .pagination { width: 100%; } .page-link { flex: 1 1 auto; } }

/* Version 0.7.4: allgemeine UI-Überarbeitung und stabiles Dashboard */
:root {
    --bg: #f3f5f7;
    --panel: #ffffff;
    --panel-soft: #f7f9fa;
    --panel-strong: #eef3f4;
    --ink: #17242e;
    --text: #17242e;
    --muted: #66757f;
    --line: #dce3e7;
    --line-strong: #c9d3d9;
    --accent: #08715c;
    --accent-strong: #055845;
    --accent-soft: #e5f3ef;
    --accent-faint: #f2f8f6;
    --danger: #a53636;
    --danger-soft: #fff2f2;
    --warning: #855607;
    --warning-soft: #fff7e2;
    --success: #176a43;
    --shadow-xs: 0 1px 2px rgba(25, 42, 54, .04);
    --shadow-sm: 0 8px 24px rgba(25, 42, 54, .055);
    --shadow-md: 0 16px 42px rgba(25, 42, 54, .085);
    --radius-sm: 9px;
    --radius: 14px;
    --radius-lg: 20px;
}

body { background: linear-gradient(180deg, #f7f9fa 0, var(--bg) 220px); }
::selection { color: #fff; background: var(--accent); }
a, button, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(8, 113, 92, .24); outline-offset: 2px; }
h1 { font-size: clamp(1.85rem, 3vw, 2.45rem); }
h2 { font-size: 1.18rem; }
p { margin-block: .55em; }

.panel { border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.workspace-panel { padding: clamp(20px, 2.2vw, 28px); box-shadow: var(--shadow-xs); }
.section-heading { align-items: flex-start; }
.section-heading > div { min-width: 0; }
.section-heading h2 { line-height: 1.25; }
.section-heading p { max-width: 78ch; font-size: .88rem; }
.page-heading { align-items: flex-end; margin-bottom: 28px; }
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { margin-top: 5px; }
.page-intro { max-width: 840px; margin-top: 8px; }
.eyebrow { font-size: .68rem; letter-spacing: .14em; }

.button { min-height: 41px; border-radius: 9px; padding: 8px 14px; box-shadow: none; font-size: .86rem; font-weight: 760; }
.button:hover { transform: none; }
.button.primary { background: var(--accent); box-shadow: 0 5px 14px rgba(8, 113, 92, .16); }
.button.primary:hover { background: var(--accent-strong); box-shadow: 0 7px 18px rgba(8, 113, 92, .2); }
.button.ghost { background: #fff; }
.button.ghost:hover { border-color: #aebbc3; background: #f7f9fa; }
.compact-button { min-height: 38px; padding: 7px 11px; }

.alert { border-radius: 10px; box-shadow: var(--shadow-xs); }
.status-badge { gap: 6px; border: 1px solid rgba(8, 113, 92, .12); border-radius: 999px; }
.status-badge.neutral { border-color: #dde3e7; }

/* Kopfbereich und Navigation */
.topbar { min-height: 68px; padding-inline: 20px; border-bottom-color: #dbe3e7; background: rgba(255,255,255,.97); box-shadow: 0 1px 0 rgba(25,42,54,.025); backdrop-filter: blur(16px); }
.brand { min-width: 215px; }
.brand-mark.small { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 5px 14px rgba(8, 113, 92, .18); font-size: 1rem; }
.brand-copy strong { font-size: .94rem; letter-spacing: -.01em; }
.brand-copy small { color: #77858d; }
.topbar-actions { gap: 10px; }
.user-chip { display: inline-flex; min-width: 0; align-items: center; gap: 8px; padding: 4px 9px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.user-avatar { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--accent-strong); background: var(--accent-soft); font-size: .75rem; font-weight: 850; }
.user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secure-indicator { padding: 5px 8px; border-radius: 999px; background: #f1f8f5; }
.secure-indicator span { width: 7px; height: 7px; box-shadow: none; }

.document-lookup { position: relative; }
.lookup-icon { position: absolute; left: 11px; z-index: 1; width: 18px; height: 18px; display: grid; place-items: center; color: #71808a; pointer-events: none; }
.lookup-icon svg { width: 18px; height: 18px; fill: currentColor; }
.topbar-lookup { width: min(470px, 39vw); }
.topbar-lookup input { min-height: 40px; padding-left: 37px; border-color: #d5dee3; border-radius: 10px; background: #f7f9fa; }
.topbar-lookup input:focus { background: #fff; }

.app-layout { grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar-wrap { top: 68px; height: calc(100vh - 68px); border-right-color: #dce3e7; background: #f9fafb; }
.sidebar { gap: 3px; padding: 20px 12px; }
.sidebar a, .nav-disabled { min-height: 40px; justify-content: flex-start; padding: 8px 10px; border: 1px solid transparent; border-radius: 9px; font-size: .86rem; }
.sidebar a:hover { border-color: #e1e8eb; background: #fff; }
.sidebar a.active { border-color: #cfe5de; background: #edf7f3; box-shadow: none; }
.nav-link { display: flex; align-items: center; }
.nav-icon { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; color: #75838c; background: transparent; }
.nav-icon svg { width: 17px; height: 17px; fill: currentColor; }
.nav-link:hover .nav-icon { color: var(--accent-strong); background: var(--accent-soft); }
.nav-link.active .nav-icon { color: #fff; background: var(--accent); box-shadow: 0 3px 8px rgba(8,113,92,.18); }
.nav-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group { margin-top: 10px; }
.nav-group > summary { min-height: 32px; margin: 0 8px; padding-inline: 3px; color: #84919a; }
.nav-group > summary::after { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; font-size: .92rem; }
.nav-group > summary:hover::after { background: #eef2f4; }
.nav-group-links { gap: 3px; }
.sidebar-security { display: flex; align-items: flex-start; gap: 9px; margin: 0 12px 15px; padding: 12px; border-color: #d9e7e2; background: #f3f8f6; }
.sidebar-security-icon { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; background: var(--accent); font-size: .72rem; font-weight: 900; }
.sidebar-security > span:last-child { display: grid; gap: 3px; }
.sidebar-security strong { color: #315044; }
.sidebar-security small { color: #6d7c75; font-size: .68rem; line-height: 1.4; }

.main-column { background: transparent; }
.content { width: min(100%, 1540px); margin-inline: auto; padding: 34px clamp(22px, 3vw, 46px) 46px; }
.app-footer { background: rgba(255,255,255,.64); }

/* Formulare */
fieldset { padding: clamp(18px, 2vw, 24px); border-color: var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-xs); }
legend { padding-inline: 7px; font-size: .92rem; }
label { color: #3f4d56; font-size: .84rem; }
input, select, textarea { min-height: 44px; border-color: #cfd8de; border-radius: 9px; background: #fff; box-shadow: inset 0 1px 1px rgba(25,42,54,.025); }
input::placeholder, textarea::placeholder { color: #9aa5ac; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(8, 113, 92, .105); }
input[readonly] { border-color: #dbe2e6; background: #f4f6f7; }
.checkbox { min-height: 36px; }
.form-actions { margin-top: 2px; padding-top: 12px; border-top: 1px solid #eef1f3; }
.invoice-item { border-color: #dde4e8; background: #fafbfc; box-shadow: var(--shadow-xs); }

/* Listen, Filter und Tabellen */
.filter-panel { border-color: #dce3e7; background: #fff; box-shadow: var(--shadow-xs); }
.filter-grid { gap: 12px; }
.filter-checkbox { border-color: #d7e0e4; background: #f8fafb; }
.table-wrap { border-radius: 11px; background: #fff; box-shadow: var(--shadow-xs); scrollbar-gutter: stable; }
table { font-size: .84rem; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 14px; }
th { position: sticky; top: 0; z-index: 2; color: #60707a; background: #f5f7f8; box-shadow: inset 0 -1px 0 var(--line); font-size: .68rem; }
tbody tr { transition: background .12s ease; }
tbody tr:nth-child(even) td { background: #fcfdfd; }
tbody tr:hover td { background: #f4f8f7; }
td strong { color: #26343d; }
.table-actions { row-gap: 7px; }
.list-footer { margin-top: 16px; }
.page-link { border-radius: 8px; background: #fff; }
.page-link.active { box-shadow: 0 3px 8px rgba(8,113,92,.15); }

/* Dashboard: ruhige Karten ohne dekorative Kreise und ohne Layoutsprünge */
.metric-card::after, .metric-card-warning::after { display: none !important; content: none !important; }
.dashboard-heading { align-items: flex-end; }
.page-heading-actions { padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.72); box-shadow: var(--shadow-xs); }
.period-selector { align-items: center; }
.period-selector label { gap: 3px; min-width: 145px; padding-left: 4px; }
.period-selector select { min-height: 36px; border: 0; padding: 6px 30px 6px 0; box-shadow: none; background-color: transparent; font-weight: 720; }
.dashboard-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; gap: 14px; }
.metric-card { min-height: 148px; align-content: start; grid-template-rows: auto minmax(38px, auto) minmax(24px, auto); gap: 10px; padding: 18px; border-color: #dce3e7; border-radius: 13px; background: #fff; box-shadow: var(--shadow-xs); contain: layout paint; }
.metric-card-link { border-top: 3px solid var(--metric-accent, var(--accent)); }
.metric-card-link:hover { transform: translateY(-1px); border-color: var(--metric-accent, var(--accent)); box-shadow: var(--shadow-sm); }
.metric-card-top { display: flex !important; align-items: center; gap: 9px; min-width: 0; color: inherit !important; }
.metric-icon { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; color: var(--metric-accent, var(--accent)); background: var(--metric-soft, var(--accent-soft)); }
.metric-icon svg { width: 17px; height: 17px; fill: currentColor; }
.metric-label { min-width: 0; overflow: hidden; color: #596872 !important; font-size: .78rem !important; font-weight: 790 !important; text-overflow: ellipsis; white-space: nowrap; }
.metric-card strong { align-self: end; min-width: 0; overflow: hidden; color: #1c2b35; font-size: clamp(1.72rem, 2.5vw, 2.15rem); font-variant-numeric: tabular-nums; line-height: 1.02; text-overflow: ellipsis; white-space: nowrap; }
.metric-card .metric-money { font-size: clamp(1.45rem, 2vw, 1.86rem) !important; }
.metric-card > small { align-self: end; min-height: 22px; overflow: hidden; color: #71808a; font-size: .73rem; line-height: 1.35; }
.metric-delta { min-height: 22px; padding: 3px 7px; white-space: nowrap; }
.metric-tone-primary { --metric-accent: #08715c; --metric-soft: #e5f3ef; }
.metric-tone-blue { --metric-accent: #357ca3; --metric-soft: #e9f2f7; }
.metric-tone-slate { --metric-accent: #5c7180; --metric-soft: #edf1f3; }
.metric-tone-warning { --metric-accent: #a56514; --metric-soft: #fff3df; }
.metric-tone-violet { --metric-accent: #705f9d; --metric-soft: #f0edf7; }
.metric-tone-teal { --metric-accent: #237f7b; --metric-soft: #e7f5f4; }
.metric-tone-indigo { --metric-accent: #526da3; --metric-soft: #ebeff7; }
.metric-tone-neutral { --metric-accent: #6b7780; --metric-soft: #eff2f4; }

.dashboard-chart-grid { align-items: stretch; gap: 16px; }
.dashboard-chart-panel { display: flex; min-height: 338px; flex-direction: column; padding: 22px; border-radius: 14px; box-shadow: var(--shadow-xs); }
.dashboard-chart-wide { min-height: 430px; }
.dashboard-chart-panel > .section-heading { min-height: 61px; margin-bottom: 14px; }
.chart-scroll { min-height: 0; flex: 1; display: flex; align-items: stretch; overflow-x: auto; overflow-y: hidden; }
.dashboard-flow-chart { width: 100%; min-width: 720px; height: 310px; flex: 1 0 auto; }
.dashboard-horizontal-chart { width: 100%; height: 245px; min-height: 245px; flex: 1 0 auto; }
.chart-grid-line { stroke: #e4eaed; }
.chart-zero-line { stroke: #89969e; }
.chart-bar { transition: opacity .12s ease; }
.chart-track { fill: #eff3f5; }
.chart-legend { min-height: 28px; padding: 5px 8px; border: 1px solid #e3e8eb; border-radius: 8px; background: #fafbfc; }
.legend-swatch { width: 10px; height: 10px; }
.chart-footnote { min-height: 32px; margin-top: 10px; padding-top: 8px; border-top: 1px solid #eef1f3; }
.dashboard-detail-grid { align-items: start; gap: 16px; }
.dashboard-detail-grid .workspace-panel { margin-bottom: 0; }
.dashboard-actions-panel { width: 100%; }
.dashboard-action-list > a { min-height: 63px; border-color: #dde4e8; background: #fafbfc; }
.dashboard-action-list > a:hover { border-color: #b9d8ce; background: #f1f8f5; }
.dashboard-action-list strong { color: #2b3942; }
.dashboard-action-list b { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--accent-soft); }

/* Detailansichten */
.detail-card { border-color: var(--line); box-shadow: var(--shadow-xs); }
.detail-list dt, .totals-list dt { font-size: .7rem; }
.totals-list div { align-items: baseline; }
.inline-callout { border-left-width: 3px; }
.empty-state { background: #fafbfc; }

/* Login und öffentliche Seiten ohne dekorative Kreisflächen */
.auth-body { background: linear-gradient(145deg, #edf3f1, #f5f7f8 55%, #eef2f4); }
.auth-intro::after { display: none; }
.public-body { background: linear-gradient(180deg, #f4f8f6 0, var(--bg) 260px); }

@media (max-width: 1180px) {
    .app-layout { grid-template-columns: 238px minmax(0,1fr); }
    .topbar-lookup { width: min(390px, 34vw); }
    .dashboard-metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 850px) {
    .topbar { min-height: 66px; }
    .app-layout { min-height: calc(100vh - 66px); }
    .mobile-navigation { top: 66px; box-shadow: var(--shadow-xs); }
    .mobile-navigation > summary { display: flex; align-items: center; justify-content: space-between; }
    .mobile-navigation > summary::after { display: none; }
    .mobile-nav-state::before { content: "+"; color: var(--accent); font-size: 1.1rem; }
    .mobile-navigation[open] .mobile-nav-state::before { content: "−"; }
    .mobile-navigation .nav-link { border-color: var(--line); background: #fff; }
    .mobile-navigation .nav-link.active { border-color: #c7e1d8; }
    .mobile-navigation .nav-icon { width: 26px; height: 26px; }
    .content { padding-top: 28px; }
}

@media (max-width: 700px) {
    .dashboard-heading { align-items: stretch; }
    .page-heading-actions { display: grid; padding: 8px; }
    .period-selector { display: grid; grid-template-columns: 1fr auto; }
    .dashboard-chart-panel, .dashboard-chart-wide { min-height: auto; padding: 18px; }
    .dashboard-chart-panel > .section-heading { min-height: auto; }
    .dashboard-flow-chart { height: 280px; }
    .chart-legend { width: fit-content; }
}

@media (max-width: 650px) {
    .topbar { padding-inline: 12px; }
    .brand { min-width: auto; }
    .user-chip { display: none; }
    .content { padding: 22px 13px 34px; }
    .page-heading { margin-bottom: 22px; }
    .workspace-panel { padding: 18px; }
    fieldset { padding: 17px; }
    .dashboard-metric-grid { gap: 10px; }
    .metric-card { min-height: 132px; }
    .metric-label { white-space: normal; }
    .metric-card strong { font-size: 1.85rem; }
    th, td { padding: 12px 11px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
/* Spezifitätskorrekturen gegenüber älteren Basisregeln */
.sidebar-security .sidebar-security-icon { color: #fff; font-size: .72rem; line-height: 1; }
.metric-card .metric-icon { color: var(--metric-accent, var(--accent)); background: var(--metric-soft, var(--accent-soft)); font-size: inherit; font-weight: inherit; }

/* Eingangsrechnungen 0.8.0 */
.review-layout { display:grid; grid-template-columns:minmax(280px,.72fr) minmax(0,1.7fr); gap:20px; align-items:start; }
.review-source { position:sticky; top:90px; }
.review-form-panel { min-width:0; }
.review-items input { min-width:96px; }
.review-items td:first-child input { min-width:260px; }
.confidence { display:inline-flex; align-items:center; margin-left:6px; padding:2px 7px; border-radius:999px; font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; background:#eef2f4; color:#5c6870; }
.confidence.sicher { background:#e4f4ed; color:#176244; }
.confidence.prüfen { background:#fff3d6; color:#795500; }
.confidence.unsicher { background:#fde7e5; color:#9a2e25; }
.approval-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
.approval-form { display:grid; gap:14px; align-content:start; padding:18px; border:1px solid var(--line); border-radius:var(--radius-md); background:#fafbfc; }
.danger-zone { border-color:#efd1ce; background:#fffafa; }
.alert.warning { border-color:#ead59a; background:#fffaf0; color:#654d0b; }
.compact-stats { margin-bottom:20px; }
.numeric { text-align:right; font-variant-numeric:tabular-nums; }
.page-actions { display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
@media (max-width:1050px){.review-layout{grid-template-columns:1fr}.review-source{position:static}.approval-actions{grid-template-columns:1fr}}

/* Version 0.8.2: robuste Eingangsrechnungsprüfung und Einheitenkatalog */
.review-layout { grid-template-columns: minmax(320px, .78fr) minmax(0, 1.65fr); }
.review-source, .review-form-panel, .review-form-panel fieldset { min-width: 0; }
.review-source .detail-list { grid-template-columns: 1fr; gap: 13px; }
.review-source .detail-list > div, .review-source dd, .review-source code { min-width: 0; max-width: 100%; }
.review-source dd, .review-source code, .review-form-panel input[name="document_profile"] {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.review-form-panel .table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.review-items { width: 100%; min-width: 790px; table-layout: fixed; }
.review-items th:nth-child(1) { width: 31%; }
.review-items th:nth-child(2) { width: 11%; }
.review-items th:nth-child(3) { width: 13%; }
.review-items th:nth-child(4), .review-items th:nth-child(5), .review-items th:nth-child(6) { width: 15%; }
.review-items input, .review-items td:first-child input { width: 100%; min-width: 0; }
.review-items td { vertical-align: top; }
.unit-help { display: block; margin-top: 6px; color: var(--muted); font-size: .74rem; line-height: 1.45; }

@media (max-width: 1240px) {
    .review-layout { grid-template-columns: 1fr; }
    .review-source { position: static; }
    .review-source .detail-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
    .review-source .detail-list { grid-template-columns: 1fr; }
}

/* Version 0.8.3: echte Einheitenwahl und PDF-Textebenen-Hinweise */
.review-items select.incoming-unit-select { width: 100%; min-width: 0; }
.alert.info { border-color: #b9d9e7; background: #f0f8fb; color: #234f61; }

/* 0.8.4: Abo-Produkte und OCR-Prüfqualität */
.is-hidden { display: none !important; }
.subscription-product-fields { margin-top: 16px; }
.subscription-product-fields .inline-callout { margin-bottom: 16px; }
.quality-panel { display: grid; gap: 14px; margin-bottom: 18px; }
.quality-summary { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.quality-score { min-width: 88px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-subtle, #f7f9fa); text-align: center; }
.quality-score strong { display: block; font-size: 1.35rem; line-height: 1.1; }
.quality-score.good { background: #eaf7f0; border-color: #b8dfca; }
.quality-score.review { background: #fff7df; border-color: #ead69a; }
.quality-score.low { background: #fff0ee; border-color: #e7b9b3; }
.quality-score.manual { background: #f3f5f6; }
.quality-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quality-field { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface, #fff); min-width: 0; }
.quality-field strong, .quality-field small { display: block; }
.quality-field small { margin-top: 3px; color: var(--muted); }
.quality-warnings { margin: 0; padding-left: 20px; }
.quality-warnings li + li { margin-top: 5px; }
@media (max-width: 900px) { .quality-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .quality-fields { grid-template-columns: 1fr; } }


/* 0.8.5: Abo-Positionen auf Angeboten/Aufträgen/Rechnungen */
.subscription-position-note { margin-top:.7rem; padding:.65rem .8rem; border:1px solid var(--border,#d8dee8); border-radius:.7rem; background:var(--surface-soft,#f6f8fb); color:var(--text-muted,#586174); font-size:.88rem; line-height:1.4; }
.subscription-position-note::before { content:"Abo"; display:inline-block; margin-right:.55rem; padding:.08rem .42rem; border-radius:999px; background:rgba(37,99,235,.10); color:#1d4ed8; font-size:.72rem; font-weight:700; letter-spacing:.02em; text-transform:uppercase; }
.subscription-position-note.is-hidden { display:none; }
.recurring-inline-label { color:var(--text-muted,#586174); font-weight:600; }
