/* Fakturus Finance — Designsystem der Oberfläche.
   Quelle: design/tokens.css, design/DESIGNSYSTEM.md und die Gestaltung des Klickdummys
   (prototype/index.html, nur UX-Referenz). Schriften lokal (OFL, fonts/DM-Sans-OFL.txt), kein CDN. */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/dm-sans-regular.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/dm-sans-medium.woff2") format("woff2"); }

:root {
    --ink: #1d1d1f;
    --muted: #6b6b75;
    --blue: #0071e3;
    --blue-strong: #0066cc;
    --silver: #f5f5f7;
    --line: #e6e6eb;
    --green: #247052;
    --orange: #93601e;
    --red: #b13838;
    --radius-card: 17px;
    --radius-input: 9px;
    --radius-button: 22px;
    --sidebar: 230px;
    --font: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--silver); font-size: 14px; font-synthesis: none; }
button, input, select, textarea { font: inherit; }
a { color: var(--blue); }
button, a, input, select, textarea, summary { outline-offset: 4px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, main:focus-visible { outline: 3px solid var(--blue); }
main:focus:not(:focus-visible) { outline: none; }
/* Programmatischer Fokus (Skiplink-Ziel, H1 nach Seitenwechsel) ohne Rahmen; Tastaturfokus bleibt sichtbar. */
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

/* Schaltflächen: Standard hell, Hauptaktion blau (eine pro Bereich) */
button, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    cursor: pointer; border: 1px solid var(--line); border-radius: var(--radius-button);
    background: #fff; padding: 10px 17px; min-height: 40px; color: var(--ink);
    font-weight: 500; text-decoration: none; font-size: 14px; line-height: 1.2;
}
button:hover, .button:hover { background: #f1f5fa; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary, .button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--blue-strong); }
.danger { color: var(--red); }
button.flat, .button.flat { border: 0; background: transparent; padding: 7px 10px; }
button.flat:hover, .button.flat:hover { background: #f1f5fa; }
.linkbtn { padding: 0; min-height: 30px; border: 0; border-radius: 0; background: none; color: var(--blue); font-size: 12px; }

.icon { width: 18px; height: 18px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.skip { position: absolute; left: 8px; top: -80px; z-index: 60; background: #fff; padding: 12px; border-radius: 9px; }
.skip:focus { top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Seitenleiste */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar); background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 25px 16px; z-index: 5; }
.brand { display: flex; gap: 9px; align-items: center; padding: 0 10px; font-size: 25px; letter-spacing: -1.1px; font-weight: 500; color: var(--ink); text-decoration: none; }
.brand img { width: 29px; height: 29px; }
.product { font-size: 11px; color: var(--muted); padding: 8px 49px 23px; letter-spacing: 1.6px; text-transform: uppercase; }
.company { padding: 13px; border: 1px solid var(--line); border-radius: 13px; margin: 0 3px 22px; line-height: 1.6; overflow-wrap: anywhere; }
.company small { color: var(--muted); }
.navlabel { padding: 5px 14px; font-size: 10px; letter-spacing: 1.3px; color: var(--muted); text-transform: uppercase; }
.sidebar nav { overflow: auto; flex: 1; }
.sidebar nav ul { list-style: none; margin: 0 0 18px; padding: 0; }
.sidebar nav a { display: flex; width: 100%; align-items: center; gap: 12px; border-radius: 9px; color: var(--ink); text-decoration: none; margin: 2px 0; padding: 10px 14px; font-size: 13px; }
.sidebar nav a:hover { background: #f5f8fc; }
.sidebar nav a.active { background: #eaf3fd; color: var(--blue-strong); font-weight: 500; }
.sidebar nav .count { margin-left: auto; font-size: 10px; background: #e9e9ed; border-radius: 5px; padding: 2px 5px; }
.sidebar-foot { border-top: 1px solid var(--line); padding: 17px 12px 0; font-size: 11px; line-height: 1.7; color: var(--muted); display: flex; gap: 10px; align-items: flex-start; }
.sidebar-foot strong { color: var(--ink); font-weight: 500; display: block; }
.avatar { display: inline-flex; flex: none; border-radius: 50%; width: 32px; height: 32px; background: #eeeff2; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; color: var(--ink); }

/* Kopfzeile und Inhalt */
.shell { margin-left: var(--sidebar); min-height: 100vh; }
.topbar { height: 76px; background: #ffffffdf; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 38px; gap: 20px; }
.crumb { color: var(--muted); font-size: 12px; }
.crumb b { color: var(--ink); font-weight: 500; }
.topright { display: flex; align-items: center; gap: 12px; }
.topright form { margin: 0; }
.demo { font-size: 10px; background: #f0f0f3; color: #666670; padding: 5px 9px; border-radius: 6px; letter-spacing: .4px; }
.menu-btn { display: none; }
.main { padding: 32px 38px 50px; max-width: 1560px; margin: auto; }

.eyebrow { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 0 0 9px; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 27px; }
.heading h1 { font-size: 33px; letter-spacing: -1.3px; font-weight: 500; margin: 0 0 8px; }
.heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

/* KPI-Karten, Panels, Aufgaben */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; margin-bottom: 22px; }
.card, .panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); padding: 22px; }
.card .label { font-size: 12px; color: var(--muted); }
.card .value { font-size: 29px; font-weight: 500; letter-spacing: -1px; margin: 18px 0 9px; font-variant-numeric: tabular-nums; }
.card .value .unit { font-size: 14px; color: var(--muted); letter-spacing: 0; }
.card small { font-size: 11px; color: var(--muted); }
.card.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.card.dark .label, .card.dark small { color: #b6b6bf; }
.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; margin-bottom: 22px; }
.gridhalf { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.featuregrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.panel h2 { font-size: 17px; font-weight: 500; letter-spacing: -.35px; margin: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head > * { min-width: 0; }
.sub { font-size: 12px; color: var(--muted); line-height: 1.7; }
.task { padding: 15px 0; border-bottom: 1px solid #f0f0f3; display: flex; gap: 13px; align-items: center; }
.task:last-child { border-bottom: 0; }
.task .symbol { padding: 10px; background: #f3f7fc; border-radius: 10px; color: var(--blue); display: inline-flex; }
.task .grow { flex: 1; min-width: 0; }
.task strong { font-size: 12px; font-weight: 500; }
.task p { font-size: 11px; color: var(--muted); margin: 5px 0 0; }
.task .button, .task button { font-size: 11px; min-height: 34px; padding: 7px 12px; }

/* Tabellen und Status */
.tablewrap { overflow: auto; position: relative; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12px; }
th { text-align: left; color: var(--muted); font-weight: 400; font-size: 10px; letter-spacing: .5px; padding: 13px 12px; border-bottom: 1px solid var(--line); text-transform: uppercase; }
td { padding: 17px 12px; border-bottom: 1px solid #f0f0f3; }
tr:last-child td { border-bottom: 0; }
td strong { font-weight: 500; }
td .sub { font-size: 10px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 6px; font-size: 10px; background: #f0f0f3; color: #666670; }
.badge.blue { background: #eaf3fd; color: var(--blue-strong); }
.badge.green { background: #eaf5ef; color: var(--green); }
.badge.orange { background: #fbf1df; color: var(--orange); }
.badge.red { background: #faeded; color: var(--red); }

/* Hinweise und Zustände */
.notice { padding: 14px 18px; border: 1px solid #d8e8fb; background: #eff6ff; border-radius: 12px; font-size: 12px; line-height: 1.7; color: #30577d; margin-bottom: 20px; }
.notice.warn { background: #fff8e9; border-color: #efdfb9; color: #805d26; }
.notice.error { background: #faeded; border-color: #efcaca; color: var(--red); }
.notice strong { font-weight: 500; }
.empty { padding: 50px; text-align: center; color: var(--muted); line-height: 1.7; }
.empty h2 { color: var(--ink); margin-bottom: 8px; }
.placeholder-list { margin: 0; padding: 0 0 0 18px; font-size: 12px; line-height: 1.9; color: var(--muted); }
.panel h3.sub { font-size: 12px; font-weight: 500; color: var(--ink); margin: 0 0 6px; border-top: 1px solid var(--line); padding-top: 16px; }
.empty .badge { margin-bottom: 12px; }
.footer { font-size: 10px; color: var(--muted); margin-top: 25px; display: flex; justify-content: space-between; gap: 12px; }
.splitrow { display: flex; justify-content: space-between; gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--line); }

/* Formulare */
input, select, textarea { border: 1px solid #d8d8df; border-radius: var(--radius-input); padding: 11px 12px; background: #fff; color: var(--ink); min-height: 42px; max-width: 100%; }
input::placeholder, textarea::placeholder { color: #9696a0; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 17px; }
.field label { font-size: 12px; color: var(--muted); }
.error { color: var(--red); font-size: 12px; min-height: 20px; }

/* Anmeldung und Statusseiten ohne Seitenleiste */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: min(520px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 34px; }
.auth-card .brand { padding: 0; margin-bottom: 4px; }
.auth-card .product { padding: 6px 0 24px 38px; }
.auth-card h1 { font-size: 29px; letter-spacing: -1.1px; font-weight: 500; margin: 0 0 8px; }
.auth-card form { margin: 0; }
.auth-card details { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.auth-card summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.auth-card textarea { width: 100%; min-height: 92px; font-family: ui-monospace, monospace; font-size: 11px; }

.auth > .panel { width: min(560px, 100%); }
.status-title { font-size: 29px; letter-spacing: -1.1px; font-weight: 500; margin: 0 0 8px; color: var(--ink); }
.empty .button { margin-top: 10px; }

#blazor-error-ui { color-scheme: light only; background: #fff8e9; color: #805d26; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; font-size: 13px; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* UI-Batch 2 „Verkauf“: Werkzeugleiste, Reiter, Formulare, Dialoge, Belegansicht (aus dem Klickdummy) */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar form { display: flex; gap: 8px; margin: 0; flex-wrap: wrap; }
.tabs { display: flex; gap: 5px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.tabs a { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; padding: 8px 13px; min-height: 36px; color: var(--ink); text-decoration: none; background: #fff; }
.tabs a:hover { background: #f1f5fa; }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.search { min-width: 240px; }
.mono { font-family: ui-monospace, monospace; font-size: 11px; word-break: break-all; white-space: normal; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.formgrid.three { grid-template-columns: 2fr 1fr 1fr; }
.field input, .field select, .field textarea { width: 100%; }
.field .hint { font-size: 11px; color: var(--muted); margin: 0; }
.field [aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.field .error { margin: 0; min-height: 0; }
fieldset.group { border: 1px solid var(--line); border-radius: 13px; padding: 16px 18px 4px; margin: 0 0 18px; min-width: 0; }
fieldset.group legend { font-size: 12px; font-weight: 500; padding: 0 6px; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 17px; font-size: 13px; }
.checks label { display: inline-flex; gap: 8px; align-items: center; }
.checks input { min-height: 0; width: 18px; height: 18px; }
/* UI-Batch 4: einzelnes Bestätigungs-Ankreuzfeld, Scopes, Geheimnisanzeige, Abschnittsbreite. */
.check-label { display: inline-flex; gap: 10px; align-items: center; font-size: 14px; }
.field .check-label input, .check-label input { width: 18px; height: 18px; min-height: 0; flex: none; }
.scope { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: #f1f1f4; border-radius: 6px; padding: 2px 6px; margin: 0 4px 4px 0; }
.secret { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre.file { max-height: 360px; overflow: auto; background: #f7f7f9; border-radius: 9px; padding: 12px; font-size: 12px; white-space: pre; }
fieldset.field { border: 0; padding: 0; margin: 0 0 17px; min-width: 0; }
fieldset.field legend { font-weight: 600; margin-bottom: 6px; }
/* WCAG 2.2 (UI-Batch 4): scrollbare Tabellen per Tastatur erreichbar, Fokus sichtbar. */
.tablewrap:focus-visible, pre.file:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.form-actions { display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 4px; }
.error-summary ul { margin: 6px 0 0; padding-left: 18px; }
.error-summary a { color: var(--red); display: inline-block; min-height: 24px; padding: 2px 0; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 9px 22px; margin: 0; font-size: 13px; }
dl.facts dt { color: var(--muted); font-size: 12px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; font-size: 12px; color: var(--muted); }
.pager .actions { gap: 6px; }
.axes { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.axis-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.dialog { border: 1px solid var(--line); border-radius: 22px; background: #fff; margin-bottom: 22px; box-shadow: 0 20px 60px #0000001a; }
.dialog-head { padding: 22px 26px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 21px; font-weight: 500; letter-spacing: -.6px; }
.dialog-body { padding: 22px 26px; }
.dialog-foot { padding: 16px 26px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fafafa; border-radius: 0 0 22px 22px; flex-wrap: wrap; }
.dialog-foot form { margin: 0; }
button.danger, .button.danger { color: #fff; background: var(--red); border-color: var(--red); }
button.danger:hover, .button.danger:hover { background: #962f2f; }
.paper { padding: 35px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.paper h3 { font-size: 24px; font-weight: 500; letter-spacing: -.6px; margin: 22px 0 6px; }
.totals { margin: 20px 0 0 auto; max-width: 320px; font-size: 13px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-variant-numeric: tabular-nums; }
.totals .total { font-size: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.grid-doc { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.grid-doc > aside { display: flex; flex-direction: column; gap: 22px; }
.sim { display: inline-block; font-size: 10px; letter-spacing: .5px; text-transform: uppercase; background: #fff8e9; color: #805d26; border: 1px dashed #d9b86b; border-radius: 6px; padding: 4px 8px; }
.preview-mail { border: 1px dashed #d9b86b; border-radius: 12px; padding: 18px; background: #fffdf7; font-size: 13px; line-height: 1.7; }
.loading { color: var(--muted); font-size: 12px; }
@media (max-width: 1150px) { .grid-doc { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
    .formgrid, .formgrid.three { grid-template-columns: 1fr; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .search { width: 100%; min-width: 0; }
    .paper { padding: 20px; }
    .dialog-head, .dialog-body, .dialog-foot { padding-left: 18px; padding-right: 18px; }
    dl.facts { grid-template-columns: 1fr; gap: 2px 0; }
    dl.facts dd { margin-bottom: 8px; }
}

@media (max-width: 1150px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid2 { grid-template-columns: 1fr; }
    .main { padding: 25px; }
    .topbar { padding: 0 25px; }
    .heading { align-items: flex-start; }
    .heading h1 { font-size: 29px; }
    .featuregrid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
    .sidebar { display: none; }
    .sidebar.open { display: flex; box-shadow: 10px 0 40px #0003; }
    .shell { margin-left: 0; }
    .menu-btn { display: inline-flex; }
    .main { padding: 20px 16px; }
    .topbar { padding: 0 16px; height: 65px; }
    .crumb, .demo { display: none; }
    .topright { gap: 8px; }
    .heading { flex-direction: column; gap: 15px; }
    .cards { gap: 10px; }
    .card { padding: 18px; }
    .card .value { font-size: 25px; }
    .gridhalf, .featuregrid { grid-template-columns: 1fr; }
    .panel { padding: 17px; }
    .footer { flex-direction: column; }
    .auth-card { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* UI-Batch 3: Banking-Unternavigation, Kontokacheln (Klickdummy .account), Upload. */
.subnav { margin-bottom: 18px; }
.account { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px; background: #f7f8fa; border-radius: 12px; margin-bottom: 15px; flex-wrap: wrap; }
.account strong { font-variant-numeric: tabular-nums; }
.inline-form { display: inline; }
.issues { margin: 0; padding-left: 18px; }
.issues li { margin: 4px 0; }
