/* Strich – Erscheinungsbild (Design „A neu / C neu“) */
:root {
  --bg: #F4F4F1;
  --surface: #FFFFFF;
  --surface-2: #F7F7F4;
  --fill: #EEEEE9;
  --fill-2: rgba(21,23,26,.05);
  --hover: rgba(21,23,26,.045);
  --selected: #F2F6E8;
  --selected-ring: inset 0 0 0 1px #CFE3A3;
  --glass: rgba(255,255,255,.72);
  --glass-strong: rgba(255,255,255,.92);
  --glass-ring: 0 0 0 1px #E4E4DF;
  --line: #E4E4DF;
  --line-soft: #ECECE7;
  --text: #15171A;
  --text-2: #3A3D42;
  --muted: #63666C;
  --faint: #A4A7AD;
  --accent: #C6F36B;
  --accent-text: #0E0F11;
  --accent-ink: #3F6E08;
  --accent-soft: #EAF5D6;
  --link: #3F6E08;
  --focus: #5E9A10;
  --on-focus: #FFFFFF;
  --focus-soft: rgba(94,154,16,.14);
  --red: #C9372A;
  --red-soft: #FBE5E2;
  --green: #3F6E08;
  --green-soft: #EAF5D6;
  --orange: #9A5B00;
  --orange-soft: #FBF0DC;
  --blue: #1F5FA8;
  --blue-soft: #E5EEF8;
  --gray-soft: #ECECE7;
  --nav-box: #ECECE7;
  --switch-off: #DCDCD5;
  --shadow-pop: 0 0 0 1px #E4E4DF, 0 16px 40px rgba(21,23,26,.14);
  color-scheme: light;
  --radius: 16px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
/* Nacht: folgt dem System, außer der Benutzer hat Tag/Nacht fix gewählt */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="day"]) {
  --bg: #0E0F11;
  --surface: #16181B;
  --surface-2: #1B1D21;
  --fill: #1F2226;
  --fill-2: rgba(255,255,255,.05);
  --hover: rgba(255,255,255,.045);
  --selected: #1F2226;
  --selected-ring: inset 0 0 0 1px #3A3E45;
  --glass: rgba(22,24,27,.78);
  --glass-strong: rgba(27,29,33,.94);
  --glass-ring: 0 0 0 1px #24272C;
  --line: #24272C;
  --line-soft: #1E2024;
  --text: #ECEDEF;
  --text-2: #C9CBCF;
  --muted: #8C9099;
  --faint: #5A5E66;
  --accent: #C6F36B;
  --accent-text: #0E0F11;
  --accent-ink: #C6F36B;
  --accent-soft: rgba(198,243,107,.14);
  --link: #C6F36B;
  --focus: #C6F36B;
  --on-focus: #0E0F11;
  --focus-soft: rgba(198,243,107,.14);
  --red: #FF6B5B;
  --red-soft: rgba(255,107,91,.14);
  --green: #C6F36B;
  --green-soft: rgba(198,243,107,.14);
  --orange: #F5B94A;
  --orange-soft: rgba(245,185,74,.14);
  --blue: #7DB8FF;
  --blue-soft: rgba(125,184,255,.14);
  --gray-soft: #24272C;
  --nav-box: #1B1D21;
  --switch-off: #3A3E45;
  --shadow-pop: 0 0 0 1px #2A2D32, 0 16px 40px rgba(0,0,0,.55);
  color-scheme: dark;
  }
}
:root[data-theme="night"] {
  --bg: #0E0F11;
  --surface: #16181B;
  --surface-2: #1B1D21;
  --fill: #1F2226;
  --fill-2: rgba(255,255,255,.05);
  --hover: rgba(255,255,255,.045);
  --selected: #1F2226;
  --selected-ring: inset 0 0 0 1px #3A3E45;
  --glass: rgba(22,24,27,.78);
  --glass-strong: rgba(27,29,33,.94);
  --glass-ring: 0 0 0 1px #24272C;
  --line: #24272C;
  --line-soft: #1E2024;
  --text: #ECEDEF;
  --text-2: #C9CBCF;
  --muted: #8C9099;
  --faint: #5A5E66;
  --accent: #C6F36B;
  --accent-text: #0E0F11;
  --accent-ink: #C6F36B;
  --accent-soft: rgba(198,243,107,.14);
  --link: #C6F36B;
  --focus: #C6F36B;
  --on-focus: #0E0F11;
  --focus-soft: rgba(198,243,107,.14);
  --red: #FF6B5B;
  --red-soft: rgba(255,107,91,.14);
  --green: #C6F36B;
  --green-soft: rgba(198,243,107,.14);
  --orange: #F5B94A;
  --orange-soft: rgba(245,185,74,.14);
  --blue: #7DB8FF;
  --blue-soft: rgba(125,184,255,.14);
  --gray-soft: #24272C;
  --nav-box: #1B1D21;
  --switch-off: #3A3E45;
  --shadow-pop: 0 0 0 1px #2A2D32, 0 16px 40px rgba(0,0,0,.55);
  color-scheme: dark;
}
@font-face { font-family: "Manrope"; src: url("fonts/Manrope-latin.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; src: url("fonts/Manrope-latin-ext.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 13px; line-height: 1.4; letter-spacing: -.003em; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 10px; }
.num, td.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- Shell (Variante G) ---------- */
.shell { min-height: 100vh; display: flex; }
.sidebar { position: sticky; top: 0; align-self: flex-start; height: 100vh; flex: 0 0 236px; width: 236px; padding: 16px 12px 12px; border-right: 1px solid var(--line); background: var(--bg);
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; transition: flex-basis .18s ease, width .18s ease; }
.main { flex: 1; min-width: 0; margin: 10px; border-radius: var(--radius); background: var(--surface); box-shadow: 0 0 0 1px var(--line); display: flex; flex-direction: column; min-height: calc(100vh - 20px); }
.side-head { display: flex; align-items: center; gap: 6px; padding: 0 0 14px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px 6px; border-radius: 10px; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; }
button.brand { cursor: pointer; }
button.brand:hover, a.brand:hover { background: var(--hover); }
.brand-mark { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.brand-mark svg { color: #0E0F11; }
.brand-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.brand-name { font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11px; color: var(--muted); }
.brand-chev { color: var(--muted); display: inline-flex; }
.nav-toggle { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.nav-toggle:hover { color: var(--text); background: var(--hover); }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 6px; border-radius: 10px; color: var(--muted); font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: 0 0 0 1px var(--line); }
.nav-ic { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; background: var(--nav-box); display: inline-flex; align-items: center; justify-content: center; }
.nav a[aria-current="page"] .nav-ic { background: var(--accent); color: #0E0F11; }
.nav-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--fill); color: var(--muted); font-variant-numeric: tabular-nums; }
.nav .badge { margin-left: auto; }
.sidebar .spacer { flex: 1; min-height: 12px; }
.theme-seg { display: flex; gap: 3px; padding: 3px; margin: 8px 0 6px; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.theme-seg button { flex: 1; height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0 8px; }
.theme-seg button:hover { color: var(--text); }
.theme-seg button[aria-pressed="true"] { background: var(--fill); color: var(--text); }
.user-box { display: flex; align-items: center; gap: 10px; padding: 10px 4px 0; border-top: 1px solid var(--line); font-size: 12px; }
.user-av { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 16px; background: var(--fill); box-shadow: 0 0 0 1px var(--line); font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.user-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-t b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-t span { font-size: 11px; color: var(--muted); }
.user-box form { margin-left: auto; }
.user-box .btn.ghost { color: var(--muted); }

/* Schmaler Bildschirm: Leiste automatisch eingeklappt */
@media (max-width: 1100px) {
  .sidebar { flex-basis: 68px; width: 68px; }
  .side-head { flex-direction: column; gap: 10px; }
  .brand { flex: none; padding: 4px; }
  .brand-text, .brand-chev, .nav-t, .theme-seg span, .user-t, .nav-toggle { display: none; }
  .nav-label { font-size: 0; padding: 0; height: 1px; margin: 9px 10px; background: var(--line); }
  .nav a { justify-content: center; padding: 0; }
  .nav .count, .nav .badge { position: absolute; top: 3px; right: 6px; min-width: 0; width: 8px; height: 8px; padding: 0; font-size: 0; border-radius: 4px; background: var(--muted); box-shadow: 0 0 0 2px var(--bg); }
  .nav .badge { background: var(--red); }
  .theme-seg { flex-direction: column; }
  .user-box { flex-direction: column; padding: 10px 0 0; gap: 6px; }
  .user-box form { margin: 0; }
}

/* Eingeklappt: nur die Icon-Boxen */
html.nav-mini .sidebar { flex-basis: 68px; width: 68px; }
html.nav-mini .side-head { flex-direction: column; gap: 10px; }
html.nav-mini .brand { flex: none; padding: 4px; }
html.nav-mini .brand-text, html.nav-mini .brand-chev, html.nav-mini .nav-t, html.nav-mini .theme-seg span, html.nav-mini .user-t { display: none; }
html.nav-mini .nav-toggle svg { transform: scaleX(-1); }
html.nav-mini .nav-label { font-size: 0; padding: 0; height: 1px; margin: 9px 10px; background: var(--line); }
html.nav-mini .nav a { justify-content: center; padding: 0; }
html.nav-mini .nav .count, html.nav-mini .nav .badge { position: absolute; top: 3px; right: 6px; min-width: 0; width: 8px; height: 8px; padding: 0; font-size: 0; border-radius: 4px; background: var(--muted); box-shadow: 0 0 0 2px var(--bg); }
html.nav-mini .nav .badge { background: var(--red); }
html.nav-mini .theme-seg { flex-direction: column; }
html.nav-mini .theme-seg button { padding: 0; height: 28px; }
html.nav-mini .user-box { flex-direction: column; padding: 10px 0 0; gap: 6px; }
html.nav-mini .user-box form { margin: 0; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 18px 14px 26px; min-height: 64px; }
.topbar .title { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; }
.topbar .crumb { font-size: 11px; color: var(--muted); }
.topbar .crumb a { color: var(--muted); }
.topbar h1 { font-size: 20px; font-weight: 800; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar h1 > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 .status { flex: 0 0 auto; }
.topbar .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.content { padding: 8px 26px 40px; flex: 1; }
.content.narrow { max-width: 860px; }
.content.mid { max-width: 1120px; }

/* ---------- Buttons ---------- */
.btn { height: 34px; padding: 0 14px; border-radius: 10px; border: 0; background: var(--fill); color: var(--text); font: inherit; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.blue { background: var(--focus); color: var(--on-focus); font-weight: 600; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.ghost { background: transparent; color: var(--link); font-weight: 500; }
.btn.ghost:hover { background: var(--hover); filter: none; }
.btn.sm { height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; }
.btn.lg { height: 44px; padding: 0 20px; border-radius: 12px; font-size: 14px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--fill); }
.seg button, .seg a { height: 30px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; font: inherit; font-weight: 500; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; text-decoration: none !important; }
.seg [aria-selected="true"], .seg [aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 .5px var(--line), 0 2px 6px rgba(0,0,0,.08); }
.seg.sm button, .seg.sm a { height: 24px; padding: 0 12px; font-size: 12.5px; }
.pill-total { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; background: var(--fill); font-variant-numeric: tabular-nums; }
.pill-total b { font-weight: 600; }
.pill-total span { font-size: 11px; color: var(--muted); }

/* ---------- Status ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 4px; background: var(--faint); }
.status.blue::before { background: var(--orange); }
.status.green { color: var(--accent-ink); }
.status.green::before { background: var(--accent); }
.status.red { color: var(--red); }
.status.red::before { background: var(--red); }
.status.orange { color: var(--orange); }
.status.orange::before { background: var(--orange); }
.badge { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--red-soft); color: var(--red); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; background: var(--fill); font-size: 11.5px; color: var(--text-2); }

/* ---------- Formulare ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
label.field .field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
label.field .field-row a { font-weight: 400; color: var(--link); text-decoration: none; }
label.field .field-row a:hover { text-decoration: underline; }
.bare-card .errors { margin-bottom: 0; }
.bare-card a.btn { justify-content: center; }
.input, input[type=text].input, input[type=email].input, input[type=password].input, input[type=number].input, input[type=date].input, select.input, textarea.input {
  height: 34px; padding: 0 11px; border-radius: 10px; border: 0; background: var(--fill); color: var(--text); font: inherit; font-size: 13.5px; width: 100%; min-width: 0;
  box-shadow: inset 0 0 0 .5px var(--line-soft); }
textarea.input { height: auto; min-height: 76px; padding: 9px 11px; line-height: 1.5; resize: vertical; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14' fill='none' stroke='%236E6E73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:focus { outline: none; box-shadow: 0 0 0 2px var(--focus); background: var(--surface); }
.input.plain { background: transparent; box-shadow: none; padding: 0; height: auto; border-radius: 4px; }
.input.plain:focus { box-shadow: 0 0 0 2px var(--focus-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--focus); }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: var(--switch-off); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 9px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { background: #0E0F11; }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.errors, .alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 13px; }
.errors { background: var(--red-soft); color: var(--red); }
.alert.info { background: var(--blue-soft); color: var(--blue); }
.alert.ok { background: var(--green-soft); color: var(--green); }
.alert.warn { background: var(--orange-soft); color: var(--orange); }
.errors ul { margin: 0; padding-left: 18px; }

/* Gruppierte Liste (wie Systemeinstellungen) */
.group { border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 .5px var(--line); overflow: hidden; }
.group-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 14px; border-bottom: .5px solid var(--line); }
.group-row:last-child { border-bottom: 0; }
.group-row .lbl { color: var(--text); }
.group-row .val { color: var(--muted); text-align: right; }
.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head p { margin: 2px 0 0; color: var(--muted); }
.card { border-radius: 14px; background: var(--surface-2); padding: 16px; }
.kv { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; }
.kv > div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: .5px solid var(--line); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Tabellen / Listen ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 10px; background: var(--fill); min-width: 240px; flex: 0 1 320px; }
.search input { flex: 1; border: 0; background: transparent; font: inherit; color: var(--text); outline: none; min-width: 0; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); padding: 0 10px 8px; border-bottom: .5px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 10px; border-bottom: .5px solid var(--line-soft); vertical-align: middle; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--hover); }
table.list td.r, table.list th.r { text-align: right; }
table.list .sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
table.list td:first-child, table.list th:first-child { padding-left: 10px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 17px; background: var(--blue-soft); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.avatar.lg { width: 46px; height: 46px; flex-basis: 46px; border-radius: 23px; font-size: 15px; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat { border-radius: 14px; background: var(--surface-2); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none !important; color: inherit; }
.stat:hover { background: var(--fill); }
.stat .lbl { font-size: 12px; color: var(--muted); }
.stat .val { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .val.red { color: var(--red); }
.stat .sub { font-size: 12px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; }
.bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 140px; padding-top: 10px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar .b { width: 100%; max-width: 26px; border-radius: 5px 5px 2px 2px; background: var(--accent); min-height: 2px; position: relative; }
.bar .b.prev { background: var(--faint); opacity: .5; position: absolute; bottom: 0; }
.bar .m { font-size: 10.5px; color: var(--muted); }
.bar .stack { position: relative; width: 100%; max-width: 26px; height: 100%; display: flex; align-items: flex-end; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--accent); }
.legend span.prev::before { background: var(--faint); }

/* ---------- Popover / Menüs / Dialoge ---------- */
.pop { position: absolute; z-index: 50; min-width: 180px; padding: 6px; border-radius: 14px; background: var(--glass-strong); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; font-size: 13px; }
.pop button, .pop a { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 8px; border: 0; background: transparent; font: inherit; color: var(--text); text-align: left; cursor: pointer; text-decoration: none !important; }
.pop button:hover, .pop a:hover, .pop .active { background: var(--focus); color: var(--on-focus); }
.pop .sep { height: .5px; background: var(--line); margin: 4px 8px; }
.pop .head { font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 9px 2px; }
.pop .danger { color: var(--red); }
.menu-wrap { position: relative; display: inline-flex; }
dialog { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.28); backdrop-filter: blur(2px); }
.dlg { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg h2 { font-size: 17px; }
.dlg .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.toast-wrap { position: fixed; z-index: 100; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 999px; background: var(--glass-strong); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: var(--shadow-pop); font-weight: 500; pointer-events: auto; }
.toast.error { background: var(--red); color: #fff; }

/* Befehlspalette ⌘K */
.palette { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.2); display: flex; justify-content: center; padding-top: 12vh; }
.palette-box { width: min(560px, calc(100vw - 32px)); max-height: 60vh; border-radius: 16px; background: var(--glass-strong); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden; }
.palette-box input { height: 52px; border: 0; border-bottom: .5px solid var(--line); background: transparent; padding: 0 18px; font: inherit; font-size: 16px; color: var(--text); outline: none; }
.palette-list { overflow-y: auto; padding: 6px; }
.palette-list a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.palette-list a.active, .palette-list a:hover { background: var(--focus); color: var(--on-focus); }
.palette-list a .k { margin-left: auto; font-size: 11.5px; opacity: .7; }

/* ---------- Editor ---------- */
.ed-wrap { display: flex; flex-wrap: wrap; gap: 28px; padding: 10px 26px 36px; align-items: flex-start; }
.ed-form { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 26px; }
.ed-preview { flex: 1 1 300px; max-width: 360px; min-width: 0; position: sticky; top: 10px; border-radius: 16px; background: var(--fill); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.ed-preview .frame { position: relative; width: 100%; aspect-ratio: 1 / 1.414; border-radius: 3px; overflow: hidden; background: #fff; box-shadow: 0 0 0 .5px rgba(0,0,0,.08), 0 6px 18px rgba(0,0,0,.08); }
.ed-preview iframe { position: absolute; top: 0; left: 0; border: 0; width: 210mm; height: 297mm; transform-origin: 0 0; background: #fff; pointer-events: none; }
.ed-preview .updating { position: absolute; top: 8px; right: 8px; font-size: 11px; color: var(--muted); background: var(--glass-strong); padding: 2px 8px; border-radius: 10px; }
.ed-head { display: flex; flex-wrap: wrap; gap: 20px 32px; align-items: flex-start; }
.cust-btn { flex: 1 1 260px; display: flex; align-items: center; gap: 14px; padding: 6px 8px 6px 0; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 12px; min-width: 0; }
.cust-btn:hover .cn { text-decoration: underline; }
.cust-btn .cn { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.cust-btn .ca { color: var(--muted); }
.cust-btn .cl { color: var(--link); font-size: 12px; }
.meta { flex: 1 1 300px; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; }
.meta label { white-space: nowrap; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 36px; border-bottom: .5px solid var(--line); color: var(--muted); }
.meta input, .meta select { border: 0; background: transparent; font: inherit; color: var(--text); text-align: right; min-width: 0; width: 132px; font-variant-numeric: tabular-nums; padding: 4px 0; border-radius: 4px; }
.meta select { width: auto; direction: rtl; cursor: pointer; }
.meta input:focus, .meta select:focus { outline: none; box-shadow: 0 0 0 2px var(--focus-soft); }
.meta .ro { color: var(--muted); }
.subject { border: 0; padding: 0; font: inherit; font-size: 24px; font-weight: 700; letter-spacing: -.022em; color: var(--text); background: transparent; outline: none; width: 100%; border-radius: 4px; }
.subject::placeholder { color: var(--faint); }
.prose { border: 0; padding: 0; font: inherit; font-size: 14px; line-height: 1.55; color: var(--text-2); background: transparent; resize: none; outline: none; width: 100%; overflow: hidden; border-radius: 4px; }
.subject:focus, .prose:focus { box-shadow: 0 0 0 4px var(--focus-soft); background: var(--focus-soft); }

.pos-table { min-width: 0; }
.pos-head, .pos-row { display: grid; grid-template-columns: 22px minmax(140px, 1fr) 56px 96px 84px 74px 92px 28px; column-gap: 10px; }
.pos-row { row-gap: 4px; }
.pos-row > .pos-main { display: contents; }
.pos-row .t-cell { grid-column: 2; grid-row: 1; min-width: 0; }
.pos-row .d-cell { grid-column: 2 / 8; grid-row: 2; min-width: 0; }
.pos-row .tot small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); margin-top: 2px; }
.pos-disc { grid-column: 2 / 9; grid-row: 3; display: grid; grid-template-columns: subgrid; align-items: baseline; font-style: italic; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.pos-disc button { border: 0; background: none; font: inherit; color: inherit; padding: 0; cursor: pointer; text-align: left; }
.pos-disc .pd-l { grid-column: 1; justify-self: start; }
.pos-disc .pd-l:hover { color: var(--text); text-decoration: underline; }
.pos-disc .pd-u { grid-column: 4; text-align: right; }
.pos-disc .pd-n { grid-column: 6; text-align: right; }
.pos-disc .pd-n small { display: block; font-size: 11px; margin-top: 2px; }
.pos-disc .pd-x { grid-column: 7; justify-self: center; font-style: normal; font-size: 16px; line-height: 1; }
.pos-disc .pd-x:hover { color: var(--red); }
.pos-row > .handle { grid-column: 1; grid-row: 1 / 3; }
.pos-row > .row-menu { grid-column: 8; grid-row: 1; }
.pos-row textarea.t { overflow-wrap: break-word; resize: none; overflow: hidden; line-height: 1.35; display: block; }
.pos-row input, .pos-row select, .pos-row .tot { align-self: start; }
.pos-head { padding: 0 10px 8px; font-size: 11px; font-weight: 600; color: var(--muted); border-bottom: .5px solid var(--line); }
.pos-head .r, .pos-row .r { text-align: right; }
.pos-row { align-items: start; padding: 12px 10px 14px; border-radius: 12px; border-bottom: .5px solid var(--line-soft); position: relative; }
.pos-row:hover { background: var(--surface-2); }
.pos-row.sel { background: var(--surface-2); border-bottom-color: transparent; }
.pos-row.dragging { opacity: .4; }
.pos-row.drop-before { box-shadow: inset 0 2px 0 var(--focus); }
.pos-row .handle { color: var(--faint); cursor: grab; padding-top: 4px; font-variant-numeric: tabular-nums; font-size: 12px; user-select: none; }
.pos-row input, .pos-row textarea { border: 0; background: transparent; font: inherit; color: var(--text); width: 100%; min-width: 0; padding: 3px 4px; margin: -3px -4px; border-radius: 6px; }
.pos-row input:focus, .pos-row textarea:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 2px var(--focus); }
.pos-row .t { font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.pos-row textarea.d { color: var(--muted); resize: none; overflow: hidden; line-height: 1.4; margin-top: 0; }
.pos-row input.n { text-align: right; font-variant-numeric: tabular-nums; }
.pos-row input.n.dim { color: var(--faint); }
.pos-row .tot { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 3px; }
.pos-row.k-title { grid-template-columns: 22px minmax(0, 1fr) 28px; }
.pos-row.k-title > .row-menu, .pos-row.k-text > .row-menu { grid-column: 3; }
.pos-row.k-title > .handle, .pos-row.k-text > .handle { grid-row: 1; }
.pos-row.k-title input { font-weight: 700; font-size: 15px; }
.pos-row.k-text { grid-template-columns: 22px minmax(0, 1fr) 28px; }
.chip { height: 24px; padding: 0 22px 0 10px; border-radius: 999px; border: 0; background: var(--fill); font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; appearance: none; -webkit-appearance: none; max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.chip:focus { outline: none; box-shadow: 0 0 0 2px var(--focus); }
.row-menu { opacity: 0; }
.pos-row:hover .row-menu, .pos-row.sel .row-menu, .row-menu:focus { opacity: 1; }
.add-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 4px 0; align-items: center; }
.sums { display: flex; justify-content: flex-end; padding-top: 18px; }
.sums dl { margin: 0; width: 300px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; font-variant-numeric: tabular-nums; }
.sums dt { color: var(--muted); }
.sums dd { margin: 0; text-align: right; }
.sums .g { font-weight: 600; color: var(--text); padding-top: 10px; border-top: .5px solid var(--line); }
.sums dd.g { font-size: 22px; font-weight: 700; letter-spacing: -.02em; padding-top: 6px; }
.ed-more { display: flex; flex-direction: column; gap: 10px; }
.ed-more summary { cursor: pointer; font-weight: 600; color: var(--text); list-style: none; display: flex; align-items: center; gap: 6px; }
.ed-more summary::-webkit-details-marker { display: none; }
.ed-more summary::before { content: "›"; display: inline-block; transition: transform .15s; color: var(--muted); }
.ed-more[open] summary::before { transform: rotate(90deg); }

/* Kunden-Auswahl */
.picker { position: absolute; z-index: 60; width: 380px; max-width: calc(100vw - 40px); padding: 8px; border-radius: 16px; background: var(--glass-strong); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); box-shadow: var(--shadow-pop); }
.picker input { width: 100%; height: 36px; border: 0; border-radius: 10px; background: var(--fill-2); padding: 0 12px; font: inherit; color: var(--text); outline: none; }
.picker .res { max-height: 300px; overflow-y: auto; margin-top: 6px; display: flex; flex-direction: column; }
.picker .res button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 10px; border: 0; border-radius: 9px; background: transparent; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.picker .res button span { font-size: 12px; color: var(--muted); }
.picker .res button:hover, .picker .res button.active { background: var(--focus); color: var(--on-focus); }
.picker .res button:hover span, .picker .res button.active span { color: rgba(255,255,255,.8); }

/* Blatt-Ansicht */
.sheet-mode .main { background: transparent; box-shadow: none; }
.sheet-area { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; flex: 1; }
.sheet-scroll { flex: 999 1 640px; min-width: 0; padding: 4px 56px 120px; display: flex; justify-content: center; align-items: flex-start; position: relative; }
.sheet { position: relative; width: 210mm; max-width: 100%; min-height: 297mm; flex: 0 0 auto; box-sizing: border-box; background: #fff; color: #222226; border-radius: 4px; box-shadow: 0 0 0 .5px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04), 0 24px 60px rgba(0,0,0,.10); padding: 56px 62px 40px; display: flex; flex-direction: column; gap: 20px; font-size: 12px; line-height: 1.5; }
.sheet input, .sheet textarea, .sheet select { font: inherit; color: inherit; background: transparent; border: 0; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; width: 100%; min-width: 0; resize: none; overflow: hidden; }
.sheet input:hover, .sheet textarea:hover { background: rgba(0,102,204,.05); }
.sheet input:focus, .sheet textarea:focus { outline: none; background: rgba(0,102,204,.06); box-shadow: 0 0 0 1.5px rgba(0,102,204,.5); }
.sheet .s-logo { text-align: right; }
.sheet .s-logo img { max-height: 70px; }
.sheet .s-logo .lt { font-size: 25px; letter-spacing: .08em; }
.sheet .s-logo .lc { font-size: 9.5px; letter-spacing: .18em; color: #6a6a72; }
.sheet .s-top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.sheet .s-addr { position: relative; padding: 8px 10px; margin: -8px -10px; border-radius: 8px; cursor: pointer; min-width: 220px; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; }
.sheet .s-addr:hover { box-shadow: 0 0 0 1.5px rgba(0,102,204,.35); background: rgba(0,102,204,.03); }
.sheet .s-addr .sender { font-size: 8.5px; color: #8a8a92; margin-bottom: 6px; }
.sheet .s-addr .lines { font-size: 12.5px; line-height: 1.5; }
.sheet .s-addr .tagc { position: absolute; top: -12px; left: 8px; height: 20px; padding: 0 8px; border-radius: 10px; background: #0066CC; color: #fff; font-family: var(--font); font-size: 11px; font-weight: 600; display: none; align-items: center; }
.sheet .s-addr:hover .tagc { display: inline-flex; }
.sheet .s-info { display: grid; grid-template-columns: auto 112px; gap: 3px 18px; font-size: 10.5px; align-content: start; }
.sheet .s-info .l { color: #55555d; white-space: nowrap; }
.sheet .s-info > span:nth-child(2n) { text-align: right; justify-self: end; width: 100%; font-variant-numeric: tabular-nums; }
.sheet .s-info input { text-align: right; margin: -2px 0; padding: 2px 0; }
.sheet input[type=date] { cursor: pointer; -webkit-appearance: none; appearance: none; display: block; }
.sheet input[type=date]::-webkit-calendar-picker-indicator { display: none; }
.sheet input[type=date]::-webkit-datetime-edit, .sheet input[type=date]::-webkit-date-and-time-value { text-align: right; padding: 0; }
.sheet input[type=date]::-webkit-datetime-edit-fields-wrapper { padding: 0; }
.sheet input[type=date].empty { color: #b4b4bc; }
.sheet .s-break { position: absolute; left: -26px; right: -26px; height: 0; border-top: 1px dashed #c9cad2; pointer-events: none; z-index: 2; }
.sheet .s-break span { position: absolute; right: 0; top: -9px; transform: translateX(100%); padding-left: 8px; font-family: var(--font); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.sheet .s-break::before { content: ""; position: absolute; left: 26px; right: 26px; top: -7px; height: 14px; background: linear-gradient(transparent, rgba(0,0,0,.035), transparent); }
.sheet .s-info .big { font-style: italic; font-size: 14px; }
.sheet .s-subject { font-size: 15px; font-weight: 600; font-style: italic; }
.sheet .s-table { display: flex; flex-direction: column; }
.sheet .s-th, .sheet .s-tr { display: grid; grid-template-columns: 26px minmax(0, 1fr) 70px 86px 88px; gap: 10px; }
.sheet .s-th.g, .sheet .s-tr.g { grid-template-columns: 22px minmax(0, 1fr) 58px 80px 80px 80px; gap: 8px; }
.sheet .s-th.tx, .sheet .s-tr.tx { grid-template-columns: 26px minmax(0, 1fr) 64px 82px 40px 86px; gap: 8px; }
.sheet .s-th.g.tx, .sheet .s-tr.g.tx { grid-template-columns: 22px minmax(0, 1fr) 52px 76px 78px 38px 78px; gap: 7px; }
.sheet .s-tr.s-disc { font-style: italic; color: #55555d; padding-top: 0; margin-top: -6px; cursor: default; }
.sheet .s-tr.s-disc:hover { background: none; }
.sheet .s-disc button { border: 0; background: none; font: inherit; color: inherit; padding: 0; cursor: pointer; }
.sheet .s-disc button:hover { text-decoration: underline; }
.sheet .s-disc button.x { font-style: normal; color: #8a8a92; padding: 0 4px; }
.sheet .s-disc button.x:hover { color: #c0392b; text-decoration: none; }
.sheet .s-th { padding-bottom: 6px; border-bottom: 1px solid #222226; font-size: 10px; font-style: italic; color: #55555d; }
.sheet .s-th .r, .sheet .s-tr .r { text-align: right; }
.sheet .s-tr { position: relative; padding: 9px 8px; margin: 0 -8px; border-radius: 8px; cursor: text; }
.sheet .s-tr:hover { background: rgba(0,102,204,.025); }
.sheet .s-tr.sel { box-shadow: 0 0 0 2px #0066CC; background: rgba(0,102,204,.04); }
.sheet .s-tr .t { font-weight: 600; }
.sheet .s-tr .d { color: #3b3b42; }
.sheet .s-tr > div { min-width: 0; }
.sheet .s-tr > span { overflow-wrap: anywhere; }
.sheet .s-tr textarea.t { font-weight: 600; }
.sheet textarea { display: block; overflow-wrap: break-word; }
.sheet .s-tr.k-title, .sheet .s-tr.k-text { grid-template-columns: 26px minmax(0, 1fr); }
.sheet .s-tr.k-title input { font-weight: 700; }
.sheet .s-sums { margin-left: auto; width: 270px; display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid #222226; font-variant-numeric: tabular-nums; }
.sheet .s-sums div { display: flex; justify-content: space-between; }
.sheet .s-sums .g { font-weight: 600; font-size: 12.5px; }
.sheet .s-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 18px; margin-top: auto; padding-top: 10px; border-top: 1px solid #E4E5EA; font-size: 8.5px; color: #6a6a72; white-space: pre-line; }
.sheet .s-add { margin-top: 6px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: #0066CC; font-family: var(--font); font-size: 12.5px; font-weight: 600; text-align: left; padding: 0 8px; cursor: pointer; }
.sheet .s-add span { font-weight: 400; color: #6E6E73; }
.sheet-tools { position: absolute; right: -10px; top: -42px; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: var(--glass-strong); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); box-shadow: var(--shadow-pop); font-family: var(--font); font-size: 12.5px; color: var(--text); white-space: nowrap; }
.sheet-tools label { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 6px 0 10px; }
.sheet-tools input { width: 48px !important; height: 22px; border-radius: 11px !important; background: var(--fill) !important; text-align: center; font-weight: 600; margin: 0 !important; color: var(--text) !important; }
.sheet-tools input.price { width: 76px !important; }
.sheet-tools select { height: 26px; padding: 0 22px 0 10px; border-radius: 13px; background-color: var(--fill); font-size: 12.5px; color: var(--text); margin: 0 !important; width: auto !important; }
.sheet-tools .sep { width: .5px; height: 16px; background: var(--line); margin: 0 4px; }
.floatbar { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--glass-strong); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); box-shadow: var(--glass-ring), 0 14px 36px rgba(0,0,0,.14); white-space: nowrap; }
.floatbar .sum { display: inline-flex; align-items: baseline; gap: 6px; padding-right: 10px; font-variant-numeric: tabular-nums; }
.floatbar .sum b { font-size: 15px; font-weight: 700; letter-spacing: -.015em; }
.floatbar .sum span { font-size: 11px; color: var(--muted); }
.floatbar .btn { height: 36px; border-radius: 18px; }
.inspector { flex: 1 1 290px; max-width: 300px; min-width: 0; padding: 18px 16px; border-radius: var(--radius); background: var(--glass); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); box-shadow: var(--glass-ring); display: flex; flex-direction: column; gap: 18px; align-self: flex-start; position: sticky; top: 10px; }
.inspector .btn { white-space: normal; text-align: left; height: auto !important; min-height: 36px; padding-top: 7px; padding-bottom: 7px; line-height: 1.3; overflow-wrap: anywhere; }
.inspector .lbl { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.inspector .group-row input, .inspector .group-row select { border: 0; background: transparent; font: inherit; color: var(--text); text-align: right; width: 110px; font-variant-numeric: tabular-nums; }
.inspector .group-row select { width: auto; }

/* Gesperrter Beleg */
.doc-view { display: flex; flex-wrap: wrap; gap: 28px; padding: 10px 26px 36px; align-items: flex-start; }
.doc-pdf { flex: 999 1 560px; min-width: 0; border-radius: 14px; background: var(--fill); padding: 14px; }
.doc-pdf iframe { width: 100%; height: calc(100vh - 140px); min-height: 600px; border: 0; border-radius: 6px; background: #fff; }
.doc-side { flex: 1 1 300px; max-width: 360px; display: flex; flex-direction: column; gap: 18px; }
.timeline { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--muted); }
.timeline div { display: flex; gap: 8px; }
.timeline div::before { content: ""; width: 6px; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--faint); flex: 0 0 6px; }

/* Designer */
.designer { display: flex; flex-wrap: wrap; align-items: stretch; flex: 1; border-top: .5px solid var(--line); }
.designer .controls { flex: 1 1 340px; max-width: 390px; min-width: 0; padding: 20px 22px 40px; border-right: .5px solid var(--line); display: flex; flex-direction: column; gap: 22px; }
.designer .stage { flex: 999 1 460px; min-width: 0; background: var(--fill); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.designer .stage .frame { width: 100%; max-width: 600px; aspect-ratio: 1 / 1.414; position: relative; overflow: hidden; background: #fff; box-shadow: 0 0 0 .5px rgba(0,0,0,.06), 0 18px 48px rgba(0,0,0,.10); }
.designer .stage iframe { position: absolute; top: 0; left: 0; width: 210mm; height: 297mm; border: 0; transform-origin: 0 0; pointer-events: none; }
.layouts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.layouts label { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }
.layouts input { position: absolute; opacity: 0; }
.layouts .thumb { width: 100%; aspect-ratio: 1 / 1.3; border-radius: 6px; background: #fff; box-shadow: 0 0 0 .5px rgba(0,0,0,.15); display: flex; flex-direction: column; gap: 3px; padding: 8px; }
.layouts input:checked + .thumb { box-shadow: 0 0 0 2px var(--focus); }
.layouts input:focus-visible + .thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
.layouts .thumb i { display: block; height: 2px; background: #E5E5EA; }
.layouts .thumb i.h { height: 4px; width: 55%; background: #1D1D1F; margin-bottom: 8px; }
.layouts .thumb.modern i.h { height: 8px; width: 100%; }
.layouts .thumb.classic i.h { margin-left: auto; }
.layouts .thumb.minimal i.h { height: 2px; }
.layouts .thumb.clean i.h { width: 45%; height: 3px; margin-bottom: 4px; }
.layouts .thumb.clean i:nth-child(2) { height: 9px; background: #EDEDF1; border-radius: 2px; margin-bottom: 3px; }
.swatches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatches label { width: 24px; height: 24px; border-radius: 12px; cursor: pointer; position: relative; box-shadow: inset 0 0 0 1px rgba(128,128,140,.35); }
.swatches input[type=radio] { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatches label:has(input:checked) { box-shadow: inset 0 0 0 1px rgba(128,128,140,.35), 0 0 0 2px var(--surface), 0 0 0 4px var(--focus); }
.disclose { border-top: .5px solid var(--line); }
.disclose details { border-bottom: .5px solid var(--line); }
.disclose summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 0; cursor: pointer; list-style: none; box-sizing: border-box; }
.disclose summary > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.disclose summary::-webkit-details-marker { display: none; }
.disclose summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; }
.disclose details[open] summary::after { transform: rotate(45deg); }
.disclose summary b { display: block; font-weight: 600; font-size: 13.5px; color: var(--text); }
.disclose summary span { font-size: 12px; color: var(--muted); }
.disclose .inner { padding: 4px 0 18px; display: flex; flex-direction: column; gap: 12px; }
.row-2 { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 8px 10px; align-items: center; }
.row-2 > span:nth-child(odd) { color: var(--muted); }

/* Bare-Layout (Login, Setup, öffentliche Seiten) */
.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.bare-card { width: min(440px, 100%); border-radius: 22px; background: var(--surface); box-shadow: 0 0 0 .5px var(--line), 0 20px 60px rgba(0,0,0,.08); padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.bare-card.wide { width: min(640px, 100%); }
.bare-card.xwide { width: min(980px, 100%); }
.bare-card .logo { width: 44px; height: 44px; border-radius: 13px; background: var(--accent); color: #0E0F11; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.checks { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.checks div { display: flex; gap: 8px; align-items: center; }
.checks .ok { color: var(--green); }
.checks .no { color: var(--red); }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; font-family: var(--mono); font-size: 14px; padding: 14px; border-radius: 12px; background: var(--fill); }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three, .meta, .kv { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .ed-preview, .inspector { position: relative; top: 0; max-width: none; }
  .content, .ed-wrap, .doc-view { padding-left: 14px; padding-right: 14px; }
  .sheet { padding: 28px 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (prefers-reduced-transparency: reduce) { .sidebar, .inspector, .pop, .floatbar, .picker, .palette-box, .sheet-tools { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); } }

/* Segment-Auswahl mit Radio-Buttons */
.seg-opt { height: 28px; padding: 0 16px; border-radius: 999px; display: inline-flex; align-items: center; font-weight: 500; color: var(--text-2); cursor: pointer; }
.seg.sm .seg-opt { height: 24px; padding: 0 12px; font-size: 12.5px; }
.seg input:checked + .seg-opt { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 .5px var(--line), 0 2px 6px rgba(0,0,0,.08); }
.seg input:focus-visible + .seg-opt { outline: 2px solid var(--focus); outline-offset: 1px; }
.settings-table td { vertical-align: middle; }
.settings-table input.input, .settings-table select.input { height: 30px; }
.progress { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--focus); width: 0; transition: width .3s; }
.import-log { font-family: var(--mono); font-size: 12px; max-height: 260px; overflow-y: auto; background: var(--fill); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }

/* Kleine Text-Schaltfläche und Ladeanzeige */
.link-btn { align-self: flex-start; border: 0; background: transparent; padding: 2px 0; font: inherit; font-size: 12.5px; color: var(--link); cursor: pointer; border-radius: 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus-soft); }
.spin { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--line); border-top-color: var(--focus); animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

/* Einstellungen: Seitenleiste wie in den Systemeinstellungen */
.settings-shell { display: flex; flex: 1; min-height: 0; align-items: flex-start; }
.settings-side { flex: 0 0 196px; position: sticky; top: 0; padding: 2px 6px 28px 18px; display: flex; flex-direction: column; gap: 16px; }
.ss-group { display: flex; flex-direction: column; gap: 1px; }
.ss-label { font-size: 11px; font-weight: 600; color: var(--muted); padding: 0 10px 4px; }
.settings-side a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text); font-size: 13.5px; text-decoration: none !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-side a:hover { background: var(--fill-2); }
.settings-side a[aria-current="page"] { background: var(--fill); font-weight: 600; }
.settings-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-self: stretch; }
.settings-main > .content:first-child { padding-top: 2px; }
@media (max-width: 980px) {
  .settings-shell { flex-direction: column; align-items: stretch; }
  .settings-side { position: static; flex: none; flex-direction: row; gap: 4px; overflow-x: auto; padding: 0 14px 10px; scrollbar-width: none; }
  .settings-side::-webkit-scrollbar { display: none; }
  .ss-group { flex-direction: row; gap: 2px; }
  .ss-label { display: none; }
}

/* Beträge und Fristen nie umbrechen */
.num, td.num, .sub.num, .stat .val, table.list td.r { white-space: nowrap; }
table.list td.r .sub { white-space: nowrap; }
.qr-box { width: 180px; height: 180px; flex: 0 0 180px; background: #fff; border-radius: 12px; padding: 2px; box-sizing: border-box; box-shadow: 0 0 0 .5px var(--line); overflow: hidden; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--fill-2); margin-bottom: 6px; cursor: pointer; }
.radio-card:has(input:checked) { background: var(--fill); box-shadow: 0 0 0 1.5px var(--focus); }
.radio-card > span { display: flex; flex-direction: column; gap: 2px; }
.radio-card input { margin-top: 3px; accent-color: var(--focus); }

/* KI-Assistenten verbinden */
.alert.warn { background: var(--orange-soft); color: var(--orange); }
details.assist { border-radius: 14px; background: var(--fill-2); margin-bottom: 8px; }
details.assist[open] { background: var(--surface); box-shadow: 0 0 0 .5px var(--line), 0 6px 20px rgba(0,0,0,.05); }
details.assist summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; border-radius: 14px; }
details.assist summary::-webkit-details-marker { display: none; }
details.assist summary > span:last-child { display: flex; flex-direction: column; flex: 1; min-width: 0; }
details.assist summary > span:last-child span { font-size: 12.5px; color: var(--muted); }
details.assist summary::after { content: "›"; color: var(--muted); font-size: 18px; transition: transform .15s; }
details.assist[open] summary::after { transform: rotate(90deg); }
details.assist summary:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus); }
details.assist .inner { padding: 0 16px 16px 58px; }
details.assist h3 { font-size: 13.5px; margin: 16px 0 6px; }
.ai-badge { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #fff; background: #C96442; }
.ai-badge.gpt { background: #10A37F; }
.ai-badge.gem { background: linear-gradient(135deg, #4285F4, #9B72CB 60%, #D96570); }
.ai-badge.other { background: var(--text-2); }
ol.steps { margin: 4px 0 10px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; line-height: 1.5; }
ol.steps li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { details.assist .inner { padding-left: 16px; } }
.pay-btn { height: 26px; padding: 0 12px; white-space: nowrap; }

/* Designer: Farben im Detail */
.color-list { display: flex; flex-direction: column; border-radius: 12px; background: var(--fill-2); }
.color-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px 7px 12px; font-size: 13px; }
.color-row + .color-row { border-top: .5px solid var(--line-soft, var(--line)); }
.color-row .cp { display: inline-flex; align-items: center; gap: 6px; }
.color-row input[type=color] { width: 28px; height: 22px; border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: 6px; }
.color-row.is-auto input[type=color] { opacity: .35; }
.color-row [data-auto] { height: 22px; padding: 0 8px; font-size: 11.5px; }
.color-row [data-auto][aria-pressed="true"] { background: var(--fill); font-weight: 600; }
.ed-preview a.frame { display: block; cursor: zoom-in; transition: box-shadow .15s, transform .15s; }
.ed-preview a.frame:hover { box-shadow: 0 0 0 .5px rgba(0,0,0,.1), 0 10px 28px rgba(0,0,0,.14); }
.ed-preview a.frame:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.ed-preview .pv-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-preview .pv-actions .btn { background: var(--surface); box-shadow: 0 0 0 .5px var(--line); }
.ed-preview .pv-actions .btn:hover { background: var(--surface-2); }

/* ---------- KI-Assistent (rechts unten) ---------- */
.ai-fab { position: fixed; right: 22px; bottom: 22px; z-index: 60; width: 52px; height: 52px; border-radius: 26px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-text); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-pop); transition: transform .15s; }
.ai-fab:hover { transform: scale(1.05); }
.ai-fab:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.ai-fab.open { transform: scale(.92); }
.ai-panel { position: fixed; right: 22px; bottom: 86px; z-index: 60; width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 120px));
  display: flex; flex-direction: column; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-pop); overflow: hidden; }
.ai-panel[hidden] { display: none; }
.ai-head { display: flex; align-items: center; gap: 4px; padding: 12px 12px 10px 16px; border-bottom: .5px solid var(--line-soft); }
.ai-head > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ai-head b { font-size: 14px; }
.ai-head span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.45; }
.ai-msg { max-width: 88%; padding: 9px 12px; border-radius: 16px; overflow-wrap: anywhere; }
.ai-msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 6px; }
.ai-msg.assistant { align-self: flex-start; background: var(--fill); color: var(--text); border-bottom-left-radius: 6px; }
.ai-msg.error { align-self: stretch; background: var(--red-soft); color: var(--red); font-size: 12.5px; }
.ai-msg p { margin: 0 0 6px; }
.ai-msg p:last-child, .ai-msg ul:last-child { margin-bottom: 0; }
.ai-msg ul { margin: 2px 0 6px; padding-left: 18px; }
.ai-msg li { margin: 2px 0; }
.ai-msg a { color: var(--link); }
.ai-msg code { font-family: var(--mono); font-size: 12px; }
.ai-thinking { display: inline-flex; gap: 4px; padding: 12px 14px; }
.ai-thinking span { width: 6px; height: 6px; border-radius: 3px; background: var(--muted); animation: ai-dot 1.1s infinite ease-in-out; }
.ai-thinking span:nth-child(2) { animation-delay: .15s; }
.ai-thinking span:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .ai-thinking span { animation: none; opacity: .6; } .ai-fab { transition: none; } }
.ai-confirm { align-self: stretch; padding: 12px; border-radius: 14px; background: var(--orange-soft); font-size: 13px; }
.ai-confirm p { margin: 0 0 10px; }
.ai-confirm .btn-row { justify-content: flex-end; }
.ai-note { align-self: center; font-size: 12px; color: var(--muted); }
.ai-note a { color: var(--link); }
.ai-empty { margin: auto 0; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.ai-empty b { color: var(--text); font-size: 15px; }
.ai-sugg { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.ai-chip { border: 0; background: var(--fill); color: var(--text); font: inherit; font-size: 12.5px; padding: 7px 12px; border-radius: 14px; cursor: pointer; }
.ai-chip:hover { background: var(--hover); }
.ai-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 12px; border-top: .5px solid var(--line-soft); }
.ai-form textarea { flex: 1; resize: none; border: 0; border-radius: 16px; background: var(--fill); color: var(--text); font: inherit; font-size: 13.5px; padding: 8px 12px; min-height: 34px; max-height: 140px; line-height: 1.35; }
.ai-form textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--focus-soft); }
.ai-form .btn { border-radius: 17px; height: 34px; width: 34px; flex: 0 0 34px; }
.ai-form.busy .btn { opacity: .5; pointer-events: none; }
@media (max-width: 640px) { .ai-panel { right: 8px; left: 8px; width: auto; bottom: 80px; height: calc(100vh - 100px); } .ai-fab { right: 14px; bottom: 14px; } }
@media print { .ai-fab, .ai-panel { display: none !important; } }
.ai-head .btn.ghost { color: var(--muted); }
.ai-head .btn.ghost:hover { color: var(--text); }
.ai-confirm p { white-space: pre-line; }
.ai-table { overflow-x: auto; margin: 4px 0 8px; }
.ai-table table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.ai-table th, .ai-table td { text-align: left; padding: 4px 8px 4px 0; border-bottom: .5px solid var(--line-soft); vertical-align: top; white-space: nowrap; }
.ai-table th { font-weight: 600; color: var(--muted); }
.ai-att { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.ai-att span { font-size: 11.5px; padding: 2px 8px; border-radius: 8px; background: rgba(255,255,255,.18); }
.ai-msg.assistant .ai-att span { background: var(--fill-2); }
.ai-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.ai-files[hidden] { display: none; }
.ai-file { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 4px 4px 10px; border-radius: 12px; background: var(--fill); max-width: 100%; }
.ai-file small { color: var(--muted); }
.ai-file button { border: 0; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 4px; }
.ai-attach { color: var(--muted); cursor: pointer; flex: 0 0 34px; height: 34px; width: 34px; border-radius: 17px; display: inline-flex; align-items: center; justify-content: center; }
.ai-attach:hover { color: var(--text); }
.ai-panel.drop { box-shadow: var(--shadow-pop), 0 0 0 3px var(--focus); }
.ai-hint { font-size: 12px; max-width: 280px; margin: 0; }
.ai-thinking em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 6px; }
.ai-fab.badge::after { content: ""; position: absolute; top: 6px; right: 6px; width: 11px; height: 11px; border-radius: 6px; background: var(--red); box-shadow: 0 0 0 2px var(--accent); }
.ai-msg blockquote { margin: 4px 0 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface); font-size: 13px; position: relative; }
.ai-copy { position: absolute; top: 4px; right: 4px; border: 0; background: var(--fill); color: var(--muted); font: inherit; font-size: 11px; padding: 2px 8px; border-radius: 8px; cursor: pointer; }
.ai-form .ai-attach.btn { color: var(--muted); background: transparent; }
.ai-form .ai-attach.btn:hover { color: var(--text); background: var(--hover); }

/* ---------- Smartphone ---------- */
.tabbar, .nav-close { display: none; }
@media (max-width: 760px) {
  body { -webkit-text-size-adjust: 100%; }
  .main { margin: 0; border-radius: 0; box-shadow: none; min-height: 100vh; padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  /* Seitenleiste wird zum Menü hinter „Mehr“ */
  .sidebar { display: none; }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { display: flex; position: fixed; inset: 0; z-index: 80; height: auto; width: auto; flex-direction: column; flex-wrap: nowrap;
    border-radius: 0; padding: calc(14px + env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom)); overflow-y: auto; background: var(--bg); }
  body.nav-open .sidebar .nav { display: flex; flex-direction: column; }
  body.nav-open .sidebar .nav-label { display: block; font-size: 10.5px; height: auto; margin: 0; padding: 14px 10px 6px; background: none; }
  body.nav-open .sidebar .user-box { display: flex; flex-direction: row; padding: 10px 4px 0; }
  body.nav-open .sidebar .side-head { flex-direction: row; }
  body.nav-open .sidebar .brand { flex: 1; padding: 4px 6px; }
  body.nav-open .sidebar .brand-text, body.nav-open .sidebar .nav-t, body.nav-open .sidebar .user-t, body.nav-open .sidebar .theme-seg span { display: flex; }
  body.nav-open .sidebar .nav-t { display: block; }
  body.nav-open .sidebar .nav a { justify-content: flex-start; padding: 0 6px; }
  body.nav-open .sidebar .nav .count, body.nav-open .sidebar .nav .badge { position: static; width: auto; height: 18px; min-width: 20px; padding: 0 7px; font-size: 11px; box-shadow: none; }
  body.nav-open .sidebar .nav .count { background: var(--fill); }
  body.nav-open .sidebar .theme-seg { flex-direction: row; }
  body.nav-open .sidebar .spacer { display: block; flex: 0 0 12px; }
  .sidebar .nav a { height: 46px; font-size: 16px; }
  .sidebar .nav-toggle { display: none; }
  .nav-close { display: inline-flex; position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--glass-strong, var(--surface)); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 -.5px 0 var(--line); }
  .tabbar a, .tabbar button { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border: 0; background: none;
    font: inherit; font-size: 10.5px; color: var(--muted); text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabbar [aria-current="page"] { color: var(--text); font-weight: 700; }
  .tabbar .nav-ic { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; background: var(--nav-box); color: var(--muted); transition: background .15s, color .15s; }
  .tabbar [aria-current="page"] .nav-ic { background: var(--accent); color: #0E0F11; }
  .tabbar [aria-expanded="true"] .nav-ic { background: var(--nav-box); color: var(--text); }
  .tb-badge { position: absolute; top: 0; left: calc(50% + 9px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-style: normal; font-size: 10.5px; font-weight: 600; line-height: 17px; text-align: center; }
  /* Kopf und Inhalt */
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; gap: 8px; min-height: 0; }
  .topbar .title { flex-basis: 100%; }
  .topbar h1 { font-size: 20px; }
  .topbar .actions { justify-content: flex-start; }
  .content, .ed-wrap, .doc-view { padding-left: 16px; padding-right: 16px; }
  .two-col { grid-template-columns: 1fr !important; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .seg::-webkit-scrollbar { display: none; }
  .seg a { white-space: nowrap; }
  .toolbar .search { flex: 1 1 100%; }
  .input, select.input, textarea.input { font-size: 16px; } /* verhindert Zoom auf iOS */
  .btn { min-height: 36px; }
  /* Listen als Karten */
  table.list.docs thead, table.list.contacts thead { display: none; }
  table.list.docs tr, table.list.contacts tr { display: grid; column-gap: 10px; row-gap: 3px; padding: 12px 2px; border-bottom: .5px solid var(--line-soft); align-items: center; }
  table.list.docs td, table.list.contacts td { padding: 0; border: 0; min-width: 0; }
  table.list.docs tr { grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "name name name open" "status no due due" "act act act act"; }
  table.list.docs td:nth-child(1) { grid-area: status; }
  table.list.docs td:nth-child(2) { grid-area: no; color: var(--muted); font-size: 13px; }
  table.list.docs td:nth-child(2) .sub { display: none; }
  table.list.docs td:nth-child(3) { grid-area: name; }
  table.list.docs td:nth-child(4), table.list.docs td:nth-child(6) { display: none; }
  table.list.docs td:nth-child(5) { grid-area: due; text-align: right; font-size: 13px; color: var(--muted); }
  table.list.docs td:nth-child(7) { grid-area: open; font-weight: 600; }
  table.list.docs td:nth-child(8) { grid-area: act; }
  table.list.docs td:nth-child(8):empty, table.list.docs td:nth-child(8):not(:has(*)) { display: none; }
  table.list.docs td:nth-child(8) form { margin-top: 6px; }
  table.list.docs tfoot tr { display: flex; justify-content: space-between; border: 0; }
  table.list.docs tfoot td { display: block !important; padding-top: 12px !important; }
  table.list.docs tfoot td:nth-child(2), table.list.docs tfoot td:nth-child(4) { display: none !important; }
  table.list.contacts tr { grid-template-columns: 36px minmax(0, 1fr) auto; grid-template-areas: "av name open" "av ort open"; }
  table.list.contacts td:nth-child(1) { grid-area: av; }
  table.list.contacts td:nth-child(2) { grid-area: name; }
  table.list.contacts td:nth-child(3), table.list.contacts td:nth-child(5) { display: none; }
  table.list.contacts td:nth-child(4) { grid-area: ort; font-size: 13px; color: var(--muted); }
  table.list.contacts td:nth-child(6) { grid-area: open; }
  /* Editor: Positionen untereinander */
  .pos-head { display: none; }
  .pos-row:not(.k-title):not(.k-text) { grid-template-columns: 20px 44px minmax(84px, 1fr) 80px 64px 28px; column-gap: 6px; row-gap: 6px; padding-top: 12px; padding-bottom: 12px; }
  .pos-row:not(.k-title):not(.k-text) > .t-cell { grid-column: 2 / 6; grid-row: 1; }
  .pos-row:not(.k-title):not(.k-text) > .d-cell { grid-column: 2 / 7; grid-row: 2; }
  .pos-row:not(.k-title):not(.k-text) > :nth-child(4) { grid-column: 2; grid-row: 3; }
  .pos-row:not(.k-title):not(.k-text) > :nth-child(5) { grid-column: 3; grid-row: 3; }
  .pos-row:not(.k-title):not(.k-text) > :nth-child(6) { grid-column: 4; grid-row: 3; }
  .pos-row:not(.k-title):not(.k-text) > :nth-child(7) { grid-column: 5; grid-row: 3; }
  .pos-row:not(.k-title):not(.k-text) > .tot { grid-column: 2 / 7; grid-row: 4; text-align: right; font-weight: 600; }
  .pos-row:not(.k-title):not(.k-text) > .tot::before { content: "Netto € "; font-weight: 400; color: var(--muted); font-size: 12px; }
  .pos-row:not(.k-title):not(.k-text) > .row-menu, .pos-row:not(.k-title):not(.k-text) > :last-child { grid-column: 6; grid-row: 1; }
  .pos-row > .handle { grid-row: 1 / 6; }
  .pos-row:not(.k-title):not(.k-text) > .pos-disc { grid-column: 2 / 7; grid-row: 5; display: flex; gap: 10px; align-items: baseline; }
  .pos-disc .pd-l { flex: 1; } .pos-disc .pd-u { display: none; }
  .pos-row select.chip { width: 100%; max-width: none; }
  .ed-hint, .kbd-hint { display: none; }
  .sheet-wrap, .ed-sheet { overflow-x: auto; }
  /* Assistent über der Leiste */
  .ai-fab { bottom: calc(78px + env(safe-area-inset-bottom)); right: 14px; width: 48px; height: 48px; }
  .ai-panel { left: 0; right: 0; bottom: 0; top: env(safe-area-inset-top); width: auto; height: auto; border-radius: 0; z-index: 90; }
  .ai-form { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast-wrap { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
.time-grid { display: grid; grid-template-columns: 140px minmax(0,1.2fr) minmax(0,2fr) 110px 110px auto; gap: 10px; align-items: end; }
@media (max-width: 760px) { .time-grid { grid-template-columns: 1fr 1fr; } .time-grid > :nth-child(2), .time-grid > :nth-child(3) { grid-column: 1 / -1; } .time-grid > button { grid-column: 1 / -1; } }

/* Editor-Kopfzeile: klare Anordnung bei jeder Breite */
#ed-top { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: 14px; row-gap: 10px; }
#ed-top .title { grid-column: 1; min-width: 0; }
#ed-top .seg { grid-column: 2; }
#ed-top .actions { grid-column: 3; flex-wrap: nowrap; justify-content: flex-end; }
#ed-top .actions > * { flex: none; }
@media (max-width: 1180px) {
  #ed-top { grid-template-columns: auto minmax(0, 1fr); }
  #ed-top .title { grid-column: 1 / -1; }
  #ed-top .seg { grid-column: 1; grid-row: 2; }
  #ed-top .actions { grid-column: 2; grid-row: 2; }
}
@media (max-width: 600px) {
  #ed-top .seg { display: none; }            /* Blattansicht ist für große Bildschirme */
  #ed-top { grid-template-columns: minmax(0, 1fr); }
  #ed-top .actions { grid-column: 1; justify-content: space-between; }
  #ed-state { display: none; }
  #ed-top .actions .menu-wrap { margin-left: auto; }
}

/* Firmen-Check */
.fbc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.fbc-light { width: 12px; height: 12px; border-radius: 6px; flex: 0 0 12px; }
.fbc-light.gruen { background: var(--green); } .fbc-light.gelb { background: var(--orange); } .fbc-light.rot { background: var(--red); }
.fbc-sum { margin: 0 0 8px; line-height: 1.5; }
.fbc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 4px 0 10px; }
.fbc-table th, .fbc-table td { padding: 6px 8px 6px 0; border-bottom: .5px solid var(--line-soft); text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fbc-table th { font-size: 11px; color: var(--muted); font-weight: 600; }
.fbc-table .r { text-align: right; }
.fbc-table .neg { color: var(--red); }
.fbc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.fbc-list li { position: relative; padding-left: 18px; line-height: 1.4; }
.fbc-list li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 8px; height: 8px; border-radius: 4px; background: var(--muted); }
.fbc-list li.pos::before { background: var(--green); } .fbc-list li.sig.mittel::before { background: var(--orange); } .fbc-list li.sig.hoch::before { background: var(--red); }
.fbc-src { font-size: 11px; color: var(--muted); margin: 10px 0 0; line-height: 1.4; }
.fbc-src a { color: var(--link); }
.fbc-wait { margin-bottom: 8px; }
#fb-check-new .fbc-body { padding: 14px; border-radius: 14px; background: var(--fill-2); }

/* Hinweise vor dem Abschließen */
.ed-warn { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.ed-warn li::marker { color: var(--warn, #c77700); }
.fbc-changes { border: 1px solid var(--warn, #c77700); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; background: color-mix(in srgb, var(--warn, #c77700) 8%, transparent); }
.fbc-changes ul { margin: 6px 0 0; padding-left: 18px; }
.fbc-watch { display: flex; gap: 8px; align-items: center; margin-top: 10px; cursor: pointer; }
.ai-mic.rec { color: #fff; background: #e5484d; animation: ai-pulse 1.2s ease-in-out infinite; }
@keyframes ai-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, #e5484d 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .ai-mic.rec { animation: none; } }

/* Bank */
.bank-drop { display: block; border: 1.5px dashed var(--line, rgba(0,0,0,.15)); border-radius: 16px; padding: 18px 20px; margin: 4px 0 22px; background: var(--surface-2); transition: border-color .15s, background .15s; }
.bank-drop.over { border-color: var(--focus, #0A84FF); background: color-mix(in srgb, var(--focus, #0A84FF) 7%, var(--surface-2)); }
.bank-drop-in { display: flex; gap: 14px; align-items: flex-start; }
.bank-drop-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface, #fff); color: var(--muted); }
.bank-drop .link { color: var(--focus, #0A84FF); cursor: pointer; font-weight: 500; }
.bank-drop .small { margin-top: 4px; max-width: 760px; line-height: 1.45; }
.bank-busy { margin-top: 10px; display: flex; gap: 8px; align-items: center; color: var(--muted); }
.bank-list td { vertical-align: top; }
.bank-list tr.sel td { background: color-mix(in srgb, var(--focus, #0A84FF) 4%, transparent); }
.bank-list tr.sel.bank-invalid td:last-child { box-shadow: inset 3px 0 0 var(--red, #FF3B30); }
.bank-text { word-break: break-word; }
.bank-why { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.bank-lines { display: flex; flex-direction: column; gap: 6px; }
.bank-line { display: grid; grid-template-columns: 1fr 104px 28px; gap: 6px; align-items: center; }
.bank-line .input.sm { height: 30px; font-size: 13px; min-width: 0; }
.bank-line.warn .bank-amt { border-color: #FF9F0A; }
.bank-amt { text-align: right; }
.bank-line-tools { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 4px; }
.bank-diff.neg { color: var(--red, #FF3B30); }
.bank-bar { z-index: 45; }
@media (max-width: 760px) {
  .bank-list thead { display: none; }
  .bank-list tr { display: grid; grid-template-columns: 30px 1fr auto; gap: 2px 8px; padding: 12px 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.08)); }
  .bank-list td { display: block; padding: 0; border: 0; }
  .bank-list td:nth-child(2) { grid-column: 2; font-size: 12px; color: var(--muted); }
  .bank-list td:nth-child(3) { grid-column: 2 / 4; grid-row: 2; }
  .bank-list td:nth-child(4) { grid-column: 3; grid-row: 1; }
  .bank-list td:nth-child(5) { grid-column: 1 / 4; margin-top: 8px; }
  .bank-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
.bank-reason { flex-basis: 100%; }
.content.has-floatbar { padding-bottom: 96px; }

/* Finanzen */
.fin-grid > div { min-width: 0; }
.fin-mob { display: none; }
@media (max-width: 900px) { .fin-desk { display: none; } .fin-mob { display: block; } }
.hbar { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar .track { height: 10px; border-radius: 5px; background: var(--fill, rgba(0,0,0,.06)); overflow: hidden; }
.hbar .track > span { display: block; height: 100%; border-radius: 5px; background: #0A84FF; min-width: 2px; }
.hbar.warn .track > span { background: #FF9F0A; }
.hbar.bad .track > span { background: var(--red, #FF3B30); }
.hbar .v { min-width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.share { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--fill, rgba(0,0,0,.06)); gap: 2px; }
.share > span { display: block; height: 100%; }
.share .rest { background: var(--fill, rgba(0,0,0,.08)); }
.fin-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0 4px; }
.fin-kpis > div { display: flex; flex-direction: column; gap: 2px; }
.fin-kpis b { font-size: 20px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fin-table td, .fin-table th { font-size: 13px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; margin-right: 8px; vertical-align: 1px; }
.fin-big { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.fin-big b { font-size: 28px; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.fin-calc { width: 100%; border-collapse: collapse; font-size: 13px; }
.fin-calc td { padding: 5px 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.06)); }
.fin-calc tr.sum td { font-weight: 600; }
.fin-form { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.fin-form .form-grid { width: 100%; }
.fin-form .seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 10px; background: var(--fill, rgba(0,0,0,.05)); }
.fin-form .seg label { padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.fin-form .seg label:has(input:checked) { background: var(--surface, #fff); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 500; }
.fin-form .seg input { position: absolute; opacity: 0; pointer-events: none; }
.fin-list { display: flex; flex-direction: column; padding: 4px 16px; }
.fin-list > a, .fin-list > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.06)); color: inherit; text-decoration: none; }
.fin-list > :last-child { border-bottom: 0; }
.fin-list .sub { display: block; font-size: 12px; color: var(--muted); }
.stat .sub.red { color: var(--red); }
@media (max-width: 760px) {
  .hbar { grid-template-columns: 1fr auto; }
  .hbar .track { grid-column: 1 / 3; grid-row: 2; }
  .fin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fin-table .hide-m { display: none; }
}

/* Benutzer */
.users-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat .val.orange { color: #C27500; }
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-cell > span:last-child { min-width: 0; }
.user-cell .sub { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.avatar.admin { background: color-mix(in srgb, #AF52DE 14%, transparent); color: #8E3EB8; }
.role-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; background: var(--fill); font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.role-tag.admin { background: color-mix(in srgb, #AF52DE 13%, transparent); color: #8E3EB8; }
.users-list tr.is-off td { opacity: .55; }
.users-list tr.row-link { cursor: pointer; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.role-card { border-radius: 12px; background: var(--surface-2); padding: 12px 14px; font-size: 13px; }
.role-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.role-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
@media (max-width: 560px) { .role-pick { grid-template-columns: 1fr; } }
.role-opt { position: relative; cursor: pointer; }
.role-opt input { position: absolute; opacity: 0; pointer-events: none; }
.role-opt > span { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 .5px var(--line); transition: box-shadow .12s, background .12s; height: 100%; }
.role-opt small { color: var(--muted); font-size: 11.5px; }
.role-opt input:checked + span { box-shadow: 0 0 0 2px var(--focus); background: color-mix(in srgb, var(--focus) 5%, var(--surface)); }
.role-opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.role-opt input:disabled + span { opacity: .55; cursor: default; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; padding: 16px; border-radius: 12px; background: var(--surface-2); }
.perm-group { display: flex; flex-direction: column; gap: 10px; }
.perm-group .ss-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.check.perm { align-items: flex-start; }
.check.perm input { margin-top: 2px; }
.check.perm span { display: flex; flex-direction: column; gap: 1px; }
.check.perm small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.perm-grid .admin-only { display: none; }
.perm-grid[data-admin] .admin-only { display: flex; }
.perm-grid[data-admin] .check.perm { opacity: .6; }
.firm-pick { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.firm-pick .ss-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.invite-box { border-radius: 14px; padding: 14px 16px; margin-bottom: 22px; background: var(--green-soft); color: var(--text); }
.invite-box p { margin: 4px 0 10px; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; font-size: 12px; background: var(--surface); }
.user-form .group-row input[type=radio] { accent-color: var(--focus); margin-right: 4px; }
@media (max-width: 760px) {
  .users-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .users-stats .stat { padding: 10px 12px; }
  .users-stats .stat .val { font-size: 20px; }
  .users-stats .stat .sub { display: none; }
  .perm-grid { grid-template-columns: 1fr; }
  .users-list thead { display: none; }
  table.list.users-list tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.list.users-list td { display: block; padding: 0; border: 0 !important; }
  .users-list td:first-child { grid-column: 1 / 3; }
  table.list.users-list td:last-child { display: none !important; }
  .copy-row { flex-direction: column; }
}

/* ---------- Variante G: Belegliste mit Kennzahlen und Kurzansicht ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 4px 0 16px; }
.kpi { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 6px; }
.kpi span { color: var(--muted); }
.kpi b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.kpi b.red { color: var(--red); }
.kpi b.green { color: var(--accent-ink); }
.dl-split { display: flex; gap: 14px; align-items: flex-start; }
.dl-list { flex: 1; min-width: 0; }
.dl-peek { display: none; }
table.list tr.sel td { background: var(--selected); }
table.list tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.list tr[data-peek]:focus-visible { outline: none; }
table.list tr[data-peek]:focus-visible td { background: var(--hover); }
@media (min-width: 1200px) {
  .dl-peek { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; flex: 0 0 360px; width: 360px; padding: 18px; border-radius: 16px; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); max-height: calc(100vh - 32px); overflow-y: auto; transition: opacity .12s; }
  .dl-peek.loading { opacity: .55; }
  .dl-split .col-net, .dl-split .col-act { display: none; }
}
.peek-empty { margin: 0; padding: 30px 6px; text-align: center; }
.peek-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.peek-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.peek-title h2 { font-size: 18px; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.peek-pill { flex: none; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.peek-pill.red { background: var(--red-soft); color: var(--red); }
.peek-pill.green { background: var(--accent-soft); color: var(--accent-ink); }
.peek-pill.orange { background: var(--orange-soft); color: var(--orange); }
.peek-pill.blue { background: var(--orange-soft); color: var(--orange); }
.peek-sum { padding: 14px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 10px; }
.peek-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.peek-row b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.peek-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.peek-bar span { display: block; height: 100%; background: var(--accent); }
.peek-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.peek-actions .btn { width: 100%; height: 40px; border-radius: 12px; }
.peek-actions form { margin: 0; }
.peek-log { display: flex; flex-direction: column; }
.peek-cap { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-bottom: 6px; }
.peek-log > div { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.peek-log i { width: 7px; height: 7px; border-radius: 4px; background: var(--faint); }
.peek-log i.ok { background: var(--accent); }
@media (max-width: 760px) { .kpis { gap: 6px; margin-bottom: 12px; } .kpi { padding: 10px; gap: 3px; border-radius: 12px; } .kpi span { font-size: 11px; } .kpi b { font-size: 14px; letter-spacing: -.01em; } }

/* Zurück zur Liste */
.topbar .back-btn { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: transparent; box-shadow: 0 0 0 1px var(--line); color: var(--text); }
.topbar .back-btn:hover { background: var(--hover); filter: none; }
.topbar .title.has-back { flex-direction: row; align-items: center; gap: 12px; }
.topbar .title-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
@media (max-width: 760px) {
  body.nav-open .sidebar .side-head .pop { position: absolute; left: 0 !important; right: 0 !important; top: 46px !important; width: auto; }
  .topbar .back-btn { flex-basis: 36px; width: 36px; height: 36px; }
}
.pop .brand-mark { background: var(--fill); color: var(--text); font-size: 9.5px; font-weight: 700; }
.pop .active .brand-mark { background: rgba(14,15,17,.14); color: inherit; }


/* Editor: Sprache DE/EN neben dem Betreff */
.subj-row { display: flex; align-items: center; gap: 12px; }
.subj-row .subject { flex: 1; min-width: 0; }
.lang-seg { flex: none; display: inline-flex; padding: 3px; border-radius: 10px; background: var(--fill); }
.lang-seg button { height: 28px; min-width: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: .03em; cursor: pointer; }
.lang-seg button:hover { color: var(--text); }
.lang-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
#editor.translating .ed-form, #editor.translating .sheet-area { opacity: .55; pointer-events: none; transition: opacity .15s; }

.ai-mic { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* Editor: Rabatt auf den Gesamtbetrag */
.disc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 0 auto; max-width: 560px; padding: 10px 12px; border-radius: 12px; background: var(--fill); }
.disc-ic { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #0E0F11; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.disc-row .disc-l { flex: 1 1 200px; min-width: 0; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; box-shadow: inset 0 0 0 1px var(--line); }
.disc-p { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.disc-p input { width: 64px; height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; text-align: right; box-shadow: inset 0 0 0 1px var(--line); }
.disc-row .disc-l:focus, .disc-p input:focus { outline: none; box-shadow: 0 0 0 2px var(--focus); }
.disc-row .hint { flex-basis: 100%; padding-left: 36px; margin-top: -4px; }

.pop .pop-note { display: flex; flex-direction: column; gap: 3px; padding: 6px 9px; color: var(--muted); max-width: 280px; }
.pop .pop-note span { display: flex; align-items: center; gap: 8px; }
.pop .pop-note small { font-size: 11.5px; line-height: 1.35; padding-left: 23px; }

/* PDF-Import */
.pi-table td { vertical-align: top; padding-top: 8px; padding-bottom: 8px; }
.pi-table .pi-in { height: 30px; font-size: 13px; padding: 0 8px; }
.pi-table .chip { margin-top: 3px; }
.pi-table th { white-space: nowrap; }
.pi-table .c { width: 30px; text-align: center; }
.pi-file { width: 170px; }
.pi-fn { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.pi-fn:hover { color: var(--text); }
.pi-w { margin-top: 4px; font-size: 11.5px; color: var(--orange); line-height: 1.35; }
.pi-sub { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.pi-warn { background: var(--orange-soft); }

/* Bankkonten (Firmendaten) */
.acc-list { display: flex; flex-direction: column; gap: 12px; }
.acc-row { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 10px; }
.acc-row.acc-new { border-style: dashed; }
.acc-head { margin: -2px 0 8px; }
.acc-grid { grid-template-columns: 1fr 1fr 1.4fr .8fr; }
.acc-opts { display: flex; gap: 18px; margin-top: 10px; }
.acc-opts .check { display: flex; align-items: center; gap: 6px; }
@media (max-width: 900px) { .acc-grid { grid-template-columns: 1fr 1fr; } }

/* ============ UI-Feinschliff: Desktop, Tablet, Smartphone ============ */
.m-only { display: none; }
.log-list td { vertical-align: top; }
.log-list b { font-weight: 600; }
.empty { border: 1px dashed var(--line); border-radius: 16px; margin-top: 8px; }
.group-row > .mono, .group-row > .val { min-width: 0; overflow-wrap: anywhere; }
.group-row > input.mono { min-width: 0; }
/* Tastatur-Hinweise nur dort, wo es eine Tastatur gibt */
@media (hover: none) {
  .ed-hint, .kbd-hint, .btn kbd { display: none; }
  .row-menu { opacity: 1 !important; }
}

/* Tablet (eingeklappte Seitenleiste): Listen luftiger, Formulare zweispaltig */
@media (min-width: 761px) and (max-width: 1100px) {
  table.list.docs .col-date, table.list.docs .col-net, table.list.docs .col-act { display: none; }
  table.list.docs th:nth-child(1) { width: 104px !important; }
  table.list.docs th:nth-child(2) { width: 96px !important; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid .span-2 { grid-column: span 2; }
  .doc-side { flex: 1 1 100%; max-width: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; align-items: start; }
  .doc-pdf iframe { height: 72vh; min-height: 520px; }
  .time-grid { grid-template-columns: 150px minmax(0, 1fr) 110px 120px; }
  .time-grid > :nth-child(3) { grid-column: 1 / 3; grid-row: 2; }
  .time-grid > :nth-child(4) { grid-column: 3; grid-row: 1; }
  .time-grid > :nth-child(5) { grid-column: 4; grid-row: 1; }
  .time-grid > button { grid-column: 3 / 5; grid-row: 2; }
}
@media (max-width: 980px) {
  /* waagrechte Einstellungs-Leiste: weicher Rand zeigt, dass es weitergeht */
  .settings-side { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); padding-right: 28px; scroll-behavior: smooth; }
  .settings-side a { flex: none; }
}

/* Smartphone */
@media (max-width: 760px) {
  .m-only { display: inline; }
  .d-only { display: none; }
  .acc-grid { grid-template-columns: 1fr !important; }
  /* Beleg: zuerst die Eckdaten, dann das PDF */
  .doc-side { order: -1; max-width: none; flex-basis: 100%; }
  .doc-pdf { padding: 8px; }
  .doc-pdf iframe { height: 64vh; min-height: 380px; }
  table.list.docs tfoot td:nth-child(2), table.list.docs tfoot td:nth-child(3), table.list.docs tfoot td:nth-child(4), table.list.docs tfoot td:nth-child(6) { display: none !important; }
  table.list.docs tfoot td:nth-child(5) { display: block !important; }
  /* Editor: Positionen passen in die Breite, Zahlenfelder als erkennbare Eingabefelder */
  .pos-row:not(.k-title):not(.k-text) { grid-template-columns: 18px 40px minmax(0, 1fr) 76px 60px 22px; column-gap: 6px; padding-left: 4px; padding-right: 4px; }
  .pos-row input.n { background: var(--fill); padding: 6px 8px; margin: 0; border-radius: 8px; height: 32px; }
  .pos-row input.n.dim { color: var(--muted); }
  .pos-row .chip { width: 100%; height: 32px; }
  .pos-row:not(.k-title):not(.k-text) > .tot { padding-right: 2px; }
  /* Tabellen als Karten: Zeiten, Produkte */
  table.list.time-list thead, table.list.prod-list thead { display: none; }
  table.list.time-list tr, table.list.prod-list tr { display: grid; column-gap: 10px; row-gap: 2px; padding: 12px 2px; border-bottom: .5px solid var(--line-soft); align-items: center; }
  table.list.time-list td, table.list.prod-list td { padding: 0; border: 0; min-width: 0; }
  table.list.time-list tr { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "kunde std betrag" "text text act" "datum datum act"; }
  table.list.time-list td:nth-child(1) { grid-area: datum; font-size: 12.5px; color: var(--muted); }
  table.list.time-list td:nth-child(2) { grid-area: kunde; font-weight: 600; }
  table.list.time-list td:nth-child(3) { grid-area: text; font-size: 13px; color: var(--muted); }
  table.list.time-list td:nth-child(4) { grid-area: std; }
  table.list.time-list td:nth-child(4)::after { content: " Std"; color: var(--muted); font-size: 12px; }
  table.list.time-list td:nth-child(5) { grid-area: betrag; font-weight: 600; min-width: 74px; }
  table.list.time-list td:nth-child(6) { grid-area: act; }
  table.list.prod-list tr { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name name act" "unit price act"; }
  table.list.prod-list td:nth-child(1) { grid-area: name; }
  table.list.prod-list td:nth-child(2) { grid-area: unit; font-size: 13px; color: var(--muted); }
  table.list.prod-list td:nth-child(3) { grid-area: price; text-align: left; font-weight: 600; }
  table.list.prod-list td:nth-child(3)::after { content: " netto"; font-weight: 400; color: var(--muted); font-size: 12px; }
  table.list.prod-list td:nth-child(4) { display: none; }
  table.list.prod-list td:nth-child(5) { grid-area: act; }
  /* Einstellungs-Tabellen: innerhalb der Karte waagrecht scrollen statt die Seite zu sprengen */
  .settings-table { min-width: 520px; }
  .table-wrap:has(> .settings-table), .settings-main .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Protokoll kompakt */
  table.list.log-list thead { display: none; }
  table.list.log-list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "act zeit" "obj user"; gap: 2px 10px; padding: 10px 2px; border-bottom: .5px solid var(--line-soft); }
  table.list.log-list td { padding: 0; border: 0; min-width: 0; }
  table.list.log-list td:nth-child(1) { grid-area: zeit; color: var(--muted); }
  table.list.log-list td:nth-child(2) { grid-area: act; }
  table.list.log-list td:nth-child(3) { grid-area: obj; font-size: 13px; }
  table.list.log-list td:nth-child(4) { grid-area: user; color: var(--muted); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
  table.list.log-list td:nth-child(5) { display: none; }
  .group-row:has(> .mono) { flex-wrap: wrap; }
  .group-row > .mono { flex: 1 1 100%; text-align: left; font-size: 12.5px; }
}
@media (max-width: 760px) { .x-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; } }
@media (min-width: 761px) and (max-width: 1100px) { .doc-side > :first-child { grid-row: span 3; } }
@media (max-width: 760px) { .settings-table { min-width: 640px; } .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
/* Online-Annahme */
.accept-form { display: flex; flex-direction: column; gap: 12px; }
.accept-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.accept-check input { margin-top: 3px; flex: none; width: 18px; height: 18px; accent-color: var(--accent-ink, #3b6d11); }
.withdrawal { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.withdrawal summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.accept-proof .val { text-align: right; }
/* E-Mail-Versand */
.mail-opt { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.mail-opt > summary { list-style: none; cursor: pointer; }
.mail-opt > summary::-webkit-details-marker { display: none; }
.mail-opt .check, .kind-row .check, .fin-dlg > .check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; }
.mail-fields { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.kind-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
@media (max-width: 760px) { .hide-sm { display: none; } }
.status.orange { color: var(--orange); }
@media (max-width: 760px) {
  table.list.rec-list thead { display: none; }
  table.list.rec-list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name status" "kunde next" "rhythm rhythm" "act act"; gap: 3px 10px; padding: 12px 2px; border-bottom: .5px solid var(--line-soft); }
  table.list.rec-list td { padding: 0; border: 0; min-width: 0; }
  table.list.rec-list td:nth-child(1) { grid-area: name; }
  table.list.rec-list td:nth-child(2) { grid-area: kunde; color: var(--muted); font-size: 13px; }
  table.list.rec-list td:nth-child(3) { grid-area: rhythm; color: var(--muted); font-size: 13px; }
  table.list.rec-list td:nth-child(4) { grid-area: next; text-align: right; font-size: 13px; }
  table.list.rec-list td:nth-child(5) { grid-area: status; text-align: right; }
  table.list.rec-list td:nth-child(6) { grid-area: act; margin-top: 8px; }
  table.list.rec-list td:nth-child(6) .btn-row { justify-content: flex-start !important; flex-wrap: wrap; }
}
[data-kind][hidden] { display: none !important; }
@media (max-width: 900px) { .pc-spacer { display: none; } }
.dlg [hidden] { display: none !important; }
.nc-dlg { width: min(520px, calc(100vw - 32px)); }
[data-pk-support][hidden], #pk-nosupport[hidden] { display: none !important; }
.pk-login .btn { justify-content: center; gap: 8px; }
.pk-login { display: flex; flex-direction: column; gap: 14px; }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 12.5px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
