/* Gestaltungssystem. Grundlage sind Tokens (Farben kommen je Farbwelt aus /design.css); die Formen –
   flache Karten, klare Kanten, Onest und Bricolage Grotesque – legt der Abschnitt „Console“ am Ende fest.
   Alle Farben als Tokens; Dunkelmodus folgt dem System. Der Posteingang (mail.css) nutzt dieselben Tokens. */

/* Schriften der Console: Onest für die Oberfläche, Bricolage Grotesque für Überschriften (beide SIL OFL) */
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/onest-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/onest-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/bricolage-grotesque-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --canvas: #f5f5f7;
  --sidebar: #ececef;
  --surface: #ffffff;
  --field: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --line: rgba(60, 60, 67, .14);
  --line-strong: rgba(60, 60, 67, .26);
  --hover: rgba(60, 60, 67, .06);
  --press: rgba(60, 60, 67, .1);
  --accent: #2f5bd3;
  --accent-ink: #ffffff;
  --accent-tint: rgba(47, 91, 211, .11);
  --ok: #248a3d;
  --ok-tint: rgba(36, 138, 61, .12);
  --warn: #b25000;
  --warn-tint: rgba(255, 149, 0, .14);
  --danger: #d1312b;
  --danger-tint: rgba(209, 49, 43, .1);
  --focus: 0 0 0 3px rgba(47, 91, 211, .32);
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .08);
  --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: "Bricolage Grotesque", "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #1c1c1e;
    --sidebar: #232325;
    --surface: #2c2c2e;
    --field: #1c1c1e;
    --text: #f2f2f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --line: rgba(235, 235, 245, .12);
    --line-strong: rgba(235, 235, 245, .24);
    --hover: rgba(235, 235, 245, .06);
    --press: rgba(235, 235, 245, .1);
    --accent: #6d8ff0;
    --accent-ink: #0d1020;
    --accent-tint: rgba(109, 143, 240, .2);
    --ok: #4cc970;
    --ok-tint: rgba(76, 201, 112, .16);
    --warn: #ffb340;
    --warn-tint: rgba(255, 179, 64, .16);
    --danger: #ff6961;
    --danger-tint: rgba(255, 105, 97, .14);
    --focus: 0 0 0 3px rgba(109, 143, 240, .4);
    --shadow-pop: 0 12px 34px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(255, 255, 255, .1);
    color-scheme: dark;
  }
}

[hidden] { display: none !important; }   /* hidden gewinnt immer, auch gegen .btn { display: inline-flex } */

/* --- Grundlagen ------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font-family: var(--font); line-height: 1.45;
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -.012em; }
h1, h2, .brand__text strong { font-family: var(--font-display); }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.022em; margin-bottom: 18px; }
h1 + p { margin-top: -10px; }
h2 { font-size: 17px; font-weight: 600; margin-bottom: 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 18px 0 8px; }
p { margin: 0 0 .7em; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88em; }
small, .muted { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pre { white-space: pre-line; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.ico { flex: none; }

/* --- Rahmen: Seitenleiste + Inhalt ------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 236px; flex: none; display: flex; flex-direction: column;
  background: var(--sidebar); border-right: 1px solid var(--line); padding: 14px 10px 10px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; margin: 0; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__mark { display: block; width: 30px; height: 30px; border-radius: 7px; flex: none;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .12); }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand__text strong { font-size: 14px; }
.brand__text small { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 9px; border-radius: 7px; color: var(--text);
  font-size: 13.5px; }
.nav a:hover { background: var(--hover); text-decoration: none; }
.nav a .ico { color: var(--accent); opacity: .9; }
.nav a[aria-current="page"] { background: var(--accent-tint); font-weight: 600; }
.nav__group { margin: 16px 9px 4px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.sidebar__foot { display: flex; align-items: center; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 5px 7px; border-radius: 8px; color: var(--text); }
.me:hover, .me.is-current { background: var(--hover); text-decoration: none; }
.me__avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--text-3);
  color: #fff; font-size: 12.5px; font-weight: 600; flex: none; }
.me__text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.me__text strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me__text small { font-size: 11.5px; }
.iconbtn { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: none;
  color: var(--text-2); cursor: pointer; }
.iconbtn:hover { background: var(--hover); color: var(--text); }

.main { flex: 1; min-width: 0; padding: 28px 40px 64px; }
.main > * { max-width: 1120px; }

/* --- Seitenkopf -------------------------------------------------------------------------- */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.head > h1, .head > div > h1 { margin: 0; }
.head .form--inline { margin: 0; align-items: center; flex-wrap: nowrap; }
.head select { min-width: 230px; }
.form--inline input[type=search] { min-width: 300px; }
.form--inline .check { align-self: center; }
.backlink { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 13.5px; color: var(--accent); }
.subtitle { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }

/* Segmentschalter (Filter) */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; margin: 0 0 16px; border-radius: 9px; background: var(--press); }
.tabs a { padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px var(--line); }

/* --- Gruppierte Flächen ------------------------------------------------------------------- */
.card { background: var(--surface); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 16px;
  box-shadow: 0 0 0 .5px var(--line), 0 1px 2px rgba(0, 0, 0, .03); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card--narrow { width: 100%; max-width: 400px; }
.card--table { padding: 0; overflow-x: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 0; font-variant-numeric: tabular-nums; }

/* Kennzahlen (Übersicht) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { display: block; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  box-shadow: 0 0 0 .5px var(--line); }
a.stat:hover { text-decoration: none; background: var(--hover); }
.stat__label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.stat__label .ico { color: var(--accent); }
.stat__value { display: block; margin-top: 6px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat__hint { display: block; font-size: 12.5px; color: var(--text-3); }
.stat--warn .stat__value { color: var(--warn); }
.stat--danger .stat__value { color: var(--danger); }

/* --- Formulare ----------------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form > .btn, .form > button, .card > .btn { align-self: flex-start; }
/* Formulare lesbar schmal halten (Rechnungs-Editor mit Positionen darf breit sein) */
.main--narrow > * { max-width: 880px; }
.form--inline > .btn, .form--inline > button { align-self: flex-end; }
input[type=file] { font: inherit; font-size: 13px; color: var(--text-2); }
input[type=file]::file-selector-button { font: inherit; font-size: 13px; font-weight: 500; margin-right: 10px; padding: 5px 12px;
  border: 0; border-radius: 7px; background: var(--press); color: var(--text); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--line-strong); }
.head .form--inline > .btn { align-self: center; }
.seq > .btn { align-self: end; }
.form--inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
fieldset[disabled] { opacity: .75; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid-form .span-2 { grid-column: span 2; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; color: var(--text); }
input, select, textarea { font: inherit; font-size: 14px; font-weight: 400; color: var(--text); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea {
  width: 100%; min-height: 34px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--field);
  box-shadow: inset 0 .5px 1px rgba(0, 0, 0, .04); transition: box-shadow .12s, border-color .12s; }
textarea { resize: vertical; line-height: 1.45; }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
  linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: right 14px center, right 9px center;
  background-size: 5px 5px; background-repeat: no-repeat; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.form--inline label { min-width: 140px; }

/* --- Knöpfe -------------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 14px;
  border: 0; border-radius: 8px; background: var(--press); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .12s, filter .12s; }
.btn:hover { background: var(--line); text-decoration: none; }
.btn:active { filter: brightness(.95); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn--danger { color: var(--danger); }
.btn--small { min-height: 26px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn .ico { margin-left: -2px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
form.htmx-request .btn, .btn[aria-busy="true"] { opacity: .55; pointer-events: none; }

/* --- Menüs (aufklappend, wie Popover) -------------------------------------------------- */
.menu { position: relative; }
.menu--end { margin-left: auto; }
.menu[open] > .tbtn { background: var(--hover); }
.menu__panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 10; width: 280px; display: flex; flex-direction: column; gap: 6px;
  padding: 8px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-pop); }
.menu--end .menu__panel { left: auto; right: 0; }
.menu__item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 7px; background: none;
  color: var(--text); font: inherit; font-size: 13.5px; text-align: left; text-decoration: none; cursor: pointer; }
.menu__item:hover { background: var(--hover); }
.menu__item--accent { justify-content: center; background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.menu__item--accent:hover { background: var(--accent); filter: brightness(1.08); }
.menu__text { margin: 2px 4px 4px; font-size: 12.5px; line-height: 1.4; color: var(--text-2); }
.menu__field { display: flex; flex-direction: column; gap: 4px; padding: 2px 4px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.menu__field input, .menu__field select, .menu__field textarea { font: inherit; font-size: 13.5px; color: var(--text); padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--canvas); }
.menu__check { display: flex; align-items: center; gap: 8px; padding: 4px; font-size: 13.5px; font-weight: 400; color: var(--text); overflow-wrap: anywhere; }
.menu__check.is-disabled { color: var(--text-3); }


/* --- Hinweise (unten, wie Banner in macOS) --------------------------------------------------- */
.note { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px; border-radius: 12px; background: var(--note-bg, #1d1d1f); color: #f5f5f7; font-size: 13.5px; box-shadow: var(--shadow-pop);
  animation: noteIn .2s ease-out; cursor: default; }
.note--error { background: #b42318; }
.note.is-leaving { opacity: 0; transform: translate(-50%, 6px); transition: opacity .25s, transform .25s; }
@keyframes noteIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.flash { padding: 10px 14px; border-radius: var(--radius); background: var(--accent-tint); color: var(--text); margin-bottom: 14px; font-size: 14px; }
.flash--error { background: var(--danger-tint); color: var(--danger); }

/* --- Listen (Tabellen) ----------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 9px 14px; font-size: 12px; font-weight: 600; color: var(--text-3); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { position: relative; }
tbody tr:hover td { background: var(--hover); }
td a { font-weight: 500; }
/* ganze Zeile klickbar: der Link mit .rowlink deckt die Zeile ab */
tr .rowlink::after { content: ""; position: absolute; inset: 0; }
.card--table td:first-child, .card--table th:first-child { padding-left: 18px; }
.card--table td:last-child, .card--table th:last-child { padding-right: 18px; }
.empty-row td { color: var(--text-2); text-align: center; padding: 28px 14px; }

/* Status als Punkt + Text */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 8px; border-radius: 99px; font-size: 12px;
  font-weight: 500; line-height: 20px; background: var(--press); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge--draft { background: transparent; box-shadow: inset 0 0 0 .5px var(--line-strong); }
.badge--final, .badge--sent, .badge--hochgeladen, .badge--wartend, .badge--hochladen { background: var(--accent-tint); color: var(--accent); }
.badge--paid, .badge--abgelegt, .badge--gesendet { background: var(--ok-tint); color: var(--ok); }
.badge--overdue, .badge--fehler, .badge--aufgegeben { background: var(--danger-tint); color: var(--danger); }
.badge--cancelled { text-decoration: line-through; }
.badge--plain::before { display: none; }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; color: var(--text-2); font-size: 13px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; font-size: 14px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.facts .total { font-weight: 700; }
.codes { columns: 2; font-size: 15px; padding-left: 18px; }
.qr { background: #fff; border-radius: 10px; padding: 6px; }
.seq-label { min-width: 110px; align-self: center; font-weight: 600; }

/* --- Rechnungspositionen --------------------------------------------------------------------- */
.items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
fieldset.items { border: 0; padding: 0; min-width: 0; }
.items__head, .items__row { display: grid; grid-template-columns: minmax(0, 4fr) 5.5rem 6.5rem 7rem 4.5rem 4.5rem auto; gap: 8px; }
.items__tools { display: flex; gap: 0; align-self: start; }
.items__tools .iconbtn { width: 26px; height: 30px; color: var(--text-3); }
.items__tools .iconbtn:hover { color: var(--text); }
.items__tools .iconbtn--danger:hover { color: var(--danger); }
.items__head + .items__row [data-item-move="up"], .items__row:last-of-type [data-item-move="down"] { visibility: hidden; }
.items__row.is-new { animation: item-in .18s ease-out; }
@keyframes item-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .items__row.is-new { animation: none; } }
fieldset:disabled .items__tools { display: none; }
.items__add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 8px; }
.items__add select { max-width: 320px; }
.items__head { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 0 2px; }
.items__row { align-items: start; padding: 8px; border-radius: var(--radius); background: var(--canvas); }
.items__text { display: flex; flex-direction: column; gap: 6px; }
.items__row input, .items__row select, .items__row textarea { min-width: 0; }
.sums { display: flex; gap: 22px; justify-content: flex-end; align-items: baseline; margin: 16px 0; font-variant-numeric: tabular-nums; color: var(--text-2); }
.sums strong { color: var(--text); font-size: 17px; }

/* --- Avatare: Farbe folgt der Absenderadresse ------------------------------------------- */
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: 13px; font-weight: 600;
  letter-spacing: .01em; color: #fff; user-select: none; }
.avatar--lg { width: 42px; height: 42px; font-size: 15px; }
.avatar--0 { background: #5b7fd6; } .avatar--1 { background: #c2607a; } .avatar--2 { background: #3f9b8a; }
.avatar--3 { background: #c98a2e; } .avatar--4 { background: #8a68c9; } .avatar--5 { background: #5f8f3e; }
.avatar--6 { background: #c76b4a; } .avatar--7 { background: #6b7a8f; }

/* --- Listen in Karten (wie gruppierte Tabellen in iOS) ---------------------------------------- */
.head__sub { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.card--list { padding: 6px 0; }
.card__head { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 18px 6px; }
.card__head h2 { margin: 0; font-size: 15px; }
.card__head a { font-size: 13px; }
.card__empty { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px 18px 16px; color: var(--text-2); font-size: 14px; }
.card__empty .ico { color: var(--ok); }
.li { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 18px; color: var(--text); min-height: 48px; }
a.li:hover { background: var(--hover); text-decoration: none; }
a.li:active { background: var(--press); }
.li + .li::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; border-top: 1px solid var(--line); }
.li .avatar + .li__main { min-width: 0; }
.li__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.li__title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li__sub { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li__meta { flex: none; font-size: 12.5px; color: var(--text-3); }
.li__meta--num { font-size: 14px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
/* Systemampel */
.lamp { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, transparent); }
.lamp--ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.lamp--warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent); }
.lamp--fehler { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.lamp--aus { background: var(--line-strong); }
.nav__lamp { margin-left: auto; }
.sysrow, .mbox { align-items: flex-start; }
.mbox .lamp { margin-top: 5px; }
.mbox .li__sub { white-space: normal; }
.mbox__actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.mbox__actions form { margin: 0; }
@media (max-width: 640px) { .mbox { flex-wrap: wrap; } .mbox__actions { width: 100%; justify-content: flex-start; padding-left: 22px; } }
.sysrow .lamp { margin-top: 5px; }
.sysrow .li__sub { white-space: normal; }
.sysrow__item--fehler { color: var(--danger); }
.sysrow__item--warn { color: var(--warn); }
.linkbtn { border: 0; padding: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.card__head form { margin: 0; }
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius-lg);
  color: var(--text); font-size: 14px; }
.alert:hover { text-decoration: none; }
.alert--fehler { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); box-shadow: 0 0 0 .5px color-mix(in srgb, var(--danger) 40%, transparent); }
.alert--warn { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); box-shadow: 0 0 0 .5px color-mix(in srgb, var(--warn) 40%, transparent); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot--high { background: var(--warn); }
.li .dot--urgent { background: var(--danger); }
.card__loading { margin: 0; padding: 14px 18px 16px; color: var(--text-3); font-size: 14px; }
.timer--link { color: var(--text); }
.timer--link:hover { text-decoration: none; }

/* Nummernkreise: eine Zeile je Belegart */
.seq { display: grid; grid-template-columns: 7rem minmax(0, 1fr) 8rem auto auto; gap: 12px; align-items: end; max-width: 880px;
  padding: 14px 18px; margin-bottom: 8px; }
.seq .seq-label { align-self: center; }
.seq .check { padding-bottom: 8px; }
input.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
@media (max-width: 720px) { .seq { grid-template-columns: 1fr 1fr; } .seq .seq-label { grid-column: span 2; } }

/* --- Sheets (modale Dialoge wie in macOS) ------------------------------------------------------ */
.card__bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.card__bar h2 { margin: 0 0 2px; }
.card__bar p { margin: 0; font-size: 13.5px; }
dialog.sheet { border: 0; padding: 0; width: min(480px, calc(100vw - 32px)); border-radius: 14px; background: var(--surface);
  color: var(--text); box-shadow: var(--shadow-pop), 0 0 0 .5px var(--line-strong); }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .28); backdrop-filter: blur(2px); }
dialog.sheet[open] { animation: sheet-in .18s ease-out; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }
.sheet__form { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px 18px; }
.sheet__head h2 { margin: 0; font-size: 17px; }
.sheet__head p { margin: 2px 0 0; font-size: 13px; }
.sheet__hint { margin: 0; font-size: 12.5px; color: var(--text-3); }
.sheet__actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.datefield { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.datefield:disabled { opacity: .45; }
.datefield legend { padding: 0; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.seg { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 9px; background: var(--press); }
.seg button { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 5px 10px; border: 0;
  border-radius: 7px; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.seg button span { font-size: 11px; font-weight: 400; color: var(--text-3); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px var(--line); }
.seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* --- Bank (Kontoansicht im Stil von MoneyMoney) --------------------------------------------- */
.head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.head__actions form { margin: 0; }
.head__actions select { width: auto; min-width: 110px; }
form.head__actions { flex-wrap: nowrap; }
.accounts { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 16px; scrollbar-width: thin; }
.account { flex: 0 0 auto; min-width: 170px; display: flex; flex-direction: column; gap: 1px; padding: 10px 14px; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: 0 0 0 .5px var(--line); }
.account:hover { text-decoration: none; background: var(--hover); }
.account.is-active { box-shadow: 0 0 0 1.5px var(--accent); }
.account__name { font-size: 13px; color: var(--text-2); font-weight: 500; }
.account__balance { font-size: 18px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.account__meta { font-size: 11.5px; color: var(--text-3); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .tabs { margin: 0; }
.tabs .count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--accent);
  color: var(--accent-ink, #fff); font-size: 11px; line-height: 17px; text-align: center; }
.search { display: flex; align-items: center; gap: 8px; margin: 0; }
.search__field { position: relative; display: flex; align-items: center; }
.search__field .ico { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
/* spezifischer als die Grundregel für Eingabefelder (vier :not) */
.search__field > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]) { padding-left: 32px; min-width: 280px; border-radius: 9px; }
.txlist td { vertical-align: top; }
.txlist__main { position: relative; max-width: 0; width: 60%; }
.txlist__main a { font-weight: 500; color: var(--text); }
.txlist__main small { display: block; color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txlist tfoot td { font-size: 13px; color: var(--text-2); padding-top: 10px; padding-bottom: 10px; }
.txlist tfoot .num { color: var(--text); font-weight: 600; }
.amount--in { color: var(--ok); font-weight: 600; }
.amount--out { color: var(--text); }
.empty { text-align: center; padding: 32px 24px; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--text-2); max-width: 520px; margin: 0 auto 12px; }
.empty .ico { color: var(--ok); vertical-align: -3px; }
dialog.sheet--wide { width: min(620px, calc(100vw - 32px)); }
.sheet__body:empty::before { content: "Lädt …"; display: block; padding: 28px; color: var(--text-3); text-align: center; }
.txhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.txhead h2 { margin: 0; font-size: 18px; }
.txhead p { margin: 2px 0 0; font-size: 13px; }
.txhead .txhead__amount { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.facts dd.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet__section { margin: 4px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.suggest { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 0 6px; border-radius: 10px; background: var(--canvas); }
.suggest__main { flex: 1; min-width: 0; font-size: 14px; }
.suggest__main small { display: block; font-size: 12px; color: var(--text-2); }
.suggest--manual select { flex: 1 1 auto; min-width: 0; width: 100%; }
.suggest--manual input { flex: 0 0 110px; width: 110px; }
.kindform { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.kindform > .btn { align-self: flex-start; }
.seg--kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg--kinds button { padding: 7px 10px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; }
.steps p { margin: 6px 0; }
.steps pre { margin: 8px 0; padding: 10px 12px; border-radius: 8px; background: var(--canvas); overflow-x: auto; font-size: 12.5px; }
code.secret { display: inline-block; padding: 8px 10px; border-radius: 8px; background: var(--canvas); font-size: 13px; user-select: all; overflow-wrap: anywhere; }
.acctrow { display: grid; grid-template-columns: minmax(0, 1fr) 10rem auto auto; gap: 10px 12px; align-items: end; padding: 10px 0;
  border-bottom: 1px solid var(--line); }
.acctrow:last-of-type { border-bottom: 0; }
.acctrow .check { padding-bottom: 8px; }
.acctrow__meta { grid-column: 1 / -1; margin: -4px 0 0; font-size: 12px; color: var(--text-3); }
.back { margin: 0 0 6px; font-size: 14px; }
.paycands { display: flex; flex-direction: column; gap: 6px; }
.paycands .paycand { display: flex; flex-direction: row; align-items: center; text-align: left; font-weight: 400; color: var(--text); gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--canvas); cursor: pointer;
  box-shadow: 0 0 0 .5px var(--line); }
.paycands .paycand:has(input:checked) { box-shadow: 0 0 0 1.5px var(--accent); background: var(--accent-tint); }
.paycand input { margin: 0; }
.paycand__main { flex: 1; min-width: 0; font-size: 13.5px; }
.paycand__main small { display: block; color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paycand__amount { font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .search__field, .search__field > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]) { min-width: 0; width: 100%; flex: 1; }
  .search { flex: 1; }
  .acctrow { grid-template-columns: 1fr 1fr; }
  .txlist__main { width: auto; max-width: none; }
}

/* --- Belege (Prüfansicht wie Receipts) ------------------------------------------------------ */
label.btn { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; cursor: pointer; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.main--wide > * { max-width: none; }
.dropzone { position: relative; margin: 0; }
.dropzone__hint { display: none; }
body.is-dragging .dropzone__hint { display: grid; place-items: center; position: fixed; inset: 16px; z-index: 50; margin: 0;
  border: 2px dashed var(--accent); border-radius: 18px; background: color-mix(in srgb, var(--accent) 10%, var(--canvas));
  color: var(--accent); font-size: 20px; font-weight: 600; pointer-events: none; }
.txlist__name { font-weight: 500; }
.review { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 1fr); gap: 16px; align-items: start; }
.review__doc { position: sticky; top: 16px; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.review__doc iframe, .review__doc img { width: 100%; height: calc(100vh - 170px); min-height: 480px; border: 0; background: #fff; object-fit: contain; }
.review__files { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 8px 14px; font-size: 12.5px; border-top: 1px solid var(--line); }
.review__side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.review__side > .card { margin-bottom: 0; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
fieldset.plain:disabled input, fieldset.plain:disabled select, fieldset.plain:disabled textarea { background: transparent; color: var(--text); opacity: 1; }
.taxrows { display: flex; flex-direction: column; gap: 6px; }
.taxrows__head, .taxrows__row { display: grid; grid-template-columns: 6rem 1fr 1fr; gap: 8px; }
.taxrows__head { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.checklist { margin: 0; padding: 10px 14px 10px 32px; border-radius: var(--radius-lg); font-size: 13.5px;
  background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.hint { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--accent-tint); font-size: 13px; }
.note--inline { position: static; transform: none; margin: 0; }
.grow { flex: 1; }
.sheet__actions .btn--danger { margin-right: auto; }
details.card summary { cursor: pointer; font-weight: 500; }
details.card[open] summary { margin-bottom: 10px; }
@media (max-width: 1000px) {
  .review { grid-template-columns: 1fr; }
  .review__doc { position: static; }
  .review__doc iframe, .review__doc img { height: 70vh; }
}

/* --- Steuer ---------------------------------------------------------------------------------- */
.inline-setting { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 16px; }
.inline-setting > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.inline-setting .seg { width: auto; }
.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; }
.result { display: flex; flex-direction: column; gap: 2px; }
.result__label { font-size: 13px; color: var(--text-2); }
.result__label small { color: var(--text-3); }
.result__value { font-size: 22px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.result--main .result__value { color: var(--accent); }
.taxline { border-top: 1px solid var(--line); }
.taxcard .card__head + .taxline { border-top: 0; }
.taxline summary { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto 32px; align-items: center; gap: 12px;
  padding: 10px 18px; cursor: pointer; list-style: none; }
.taxline summary::-webkit-details-marker { display: none; }
.taxline summary:hover { background: var(--hover); }
.taxline__ref { display: flex; gap: 8px; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.taxline__ref b { color: var(--text-2); font-weight: 600; }
.taxline__label { font-size: 14px; }
.taxline__value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.taxline--info .taxline__value { color: var(--text-3); font-weight: 400; }
.taxline__copy { width: 28px; height: 28px; }
.taxline__copy.is-copied { color: var(--ok); }
.taxline__note { margin: 0 18px 8px 160px; font-size: 12.5px; color: var(--warn); }
.taxline__items { list-style: none; margin: 0 0 10px; padding: 0 18px 0 160px; font-size: 13px; }
.taxline__items li { display: grid; grid-template-columns: minmax(0, 1fr) 6rem 7rem; gap: 10px; padding: 4px 0; border-top: 1px solid var(--line); }
.taxline__items a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taxline__items span { color: var(--text-2); font-variant-numeric: tabular-nums; }
.small { font-size: 12.5px; }
@media (max-width: 760px) {
  .taxline summary { grid-template-columns: minmax(0, 1fr) auto 28px; }
  .taxline__ref { grid-column: 1 / -1; }
  .taxline__items, .taxline__note { padding-left: 18px; margin-left: 0; }
}

.logo-card { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 18px; align-items: center; }
.logo-card__preview { display: grid; place-items: center; height: 110px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 .5px var(--line); padding: 12px; }
.logo-card__preview img { max-width: 100%; max-height: 86px; }
.logo-card__preview--empty { color: #999; font-size: 13px; }
.logo-card p { margin-top: 0; }

.push-state { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 14px; font-size: 14px; }

/* --- Assistent (Chat im Stil von iMessage) ---------------------------------------------------- */
.main--chat { padding-bottom: 0; }
.chat { display: flex; flex-direction: column; height: calc(100dvh - 48px); max-width: 820px; margin: 0 auto; }
.chat__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.chat__head h1 { margin: 0; }
.chat__head form { margin: 0; }
.chat__log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 18px 2px; scroll-behavior: smooth; }
.chat__empty { margin: auto; text-align: center; color: var(--text-2); max-width: 460px; }
.chat__orb { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: var(--accent);
  background: var(--accent-tint); margin-bottom: 10px; }
.chat__starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.chip { border: 0; border-radius: 16px; padding: 7px 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px;
  cursor: pointer; box-shadow: 0 0 0 .5px var(--line); }
.chip:hover { background: var(--hover); }
.chat__note { align-self: center; font-size: 13px; color: var(--text-2); }
.bubble { max-width: min(78%, 620px); padding: 9px 13px; border-radius: 18px; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 6px; }
.bubble p:last-child, .bubble ul:last-child { margin-bottom: 0; }
.bubble ul { margin: 2px 0 6px; padding-left: 18px; }
.bubble--me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.bubble--ai { align-self: flex-start; background: var(--surface); color: var(--text); border-bottom-left-radius: 6px; box-shadow: 0 0 0 .5px var(--line); }
.bubble--error { box-shadow: 0 0 0 1px var(--danger); }
.bubble .bubble__sources { margin: 6px 0 0; font-size: 11.5px; color: var(--text-3); }
.bubble__step { font-size: 13px; color: var(--text-2); }
.typing { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .6; } }
.proposal { align-self: flex-start; display: flex; gap: 10px; max-width: min(86%, 640px); padding: 11px 13px; border-radius: 14px;
  background: var(--accent-tint); box-shadow: 0 0 0 .5px color-mix(in srgb, var(--accent) 35%, transparent); }
.proposal__icon { color: var(--accent); margin-top: 2px; }
.proposal__title { margin: 0 0 8px; font-weight: 500; font-size: 14px; }
.proposal__actions { display: flex; gap: 8px; margin: 0; }
.proposal__result { margin: 0; font-size: 13px; color: var(--text-2); }
.proposal--ausgefuehrt .proposal__icon { color: var(--ok); }
.proposal--verworfen { opacity: .65; }
.chat__input { position: sticky; bottom: 0; display: flex; align-items: flex-end; gap: 8px; padding: 10px 0 max(14px, env(safe-area-inset-bottom));
  background: var(--canvas); border-top: 1px solid var(--line); margin: 0; }
.chat__input textarea { flex: 1; resize: none; max-height: 160px; min-height: 40px; border-radius: 20px; padding: 9px 14px; line-height: 1.4; }
.chat__send { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--accent);
  color: var(--accent-ink); cursor: pointer; }
.chat__send:disabled { opacity: .5; }
.chat__input.htmx-request .chat__send { opacity: .5; pointer-events: none; }
@media (max-width: 640px) { .chat { height: calc(100dvh - 20px); } .bubble { max-width: 88%; } }

.offer-actions__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.offer-actions__or { color: var(--text-3); font-size: 13px; }
.offer-actions__pct { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; }
.offer-actions__pct input { width: 64px; }
.badge--accepted { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge--declined { background: var(--press); color: var(--text-2); }

.contact-actions { display: flex; gap: 6px; margin: 0; flex: none; }
.contact-add { display: grid; grid-template-columns: 1.2fr 1.2fr 1.4fr 1fr auto auto; gap: 8px; align-items: center; padding: 12px 18px 14px;
  border-top: 1px solid var(--line); margin: 0; }
@media (max-width: 760px) { .contact-add { grid-template-columns: 1fr 1fr; } .li--static:has(.contact-actions) { flex-wrap: wrap; } }

/* Editor mit Live-Vorschau */
.editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.editor__form { container-type: inline-size; }
@container (max-width: 760px) {
  .items__head, .items__row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .items__head span:first-child { display: none; }
  .items__head { order: -1; }
  .items__text { grid-column: 1 / -1; }
  .items__tools { grid-column: 1 / -1; justify-content: flex-end; margin-top: -4px; }
}
.editor__preview { display: none; padding: 0; overflow: hidden; position: sticky; top: 16px; }
.editor__bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-2); }
.editor__title { font-weight: 600; color: var(--text); }
.editor__state.is-saving { color: var(--text-3); }
.editor__state.is-error { color: var(--danger); }
.editor__preview iframe { display: block; width: 100%; height: calc(100vh - 120px); border: 0; background: #fff; }
@media (min-width: 1280px) {
  .main:has(.editor) > * { max-width: none; }
  .editor { grid-template-columns: minmax(0, 1fr) minmax(380px, 0.85fr); }
  .editor__preview { display: block; }
}

/* --- Zeiterfassung ---------------------------------------------------------------------------- */
.timer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.timer--running { box-shadow: 0 0 0 1px var(--accent), 0 6px 20px rgba(47, 91, 211, .12); }
.timer__clock { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--accent); }
.ticket-hits { display: block; font-weight: 400; }
.ticket-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.ticket-hit { text-align: left; font: inherit; font-size: 13.5px; padding: 7px 10px; border: 0; border-radius: 8px; background: var(--canvas);
  color: var(--text); cursor: pointer; box-shadow: 0 0 0 .5px var(--line); }
.ticket-hit:hover { box-shadow: 0 0 0 1px var(--accent); }
.day { margin-bottom: 18px; }
.day__head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* --- Öffentliche Seiten (Anmeldung) ----------------------------------------------------------- */
.public { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.public .card { padding: 28px 28px 22px; }
.public .brand { justify-content: center; padding: 0 0 18px; }
.public h1 { font-size: 22px; text-align: center; margin-bottom: 16px; }
.public .form .btn { width: 100%; min-height: 36px; }
.public .muted { text-align: center; margin: 14px 0 0; font-size: 13px; }

/* --- Schmale Fenster: Schublade und Kopfleiste stehen im Abschnitt „Console“ am Ende -------------- */
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .form--inline input[type=search] { min-width: 0; width: 100%; }
  .grid-form { grid-template-columns: 1fr; }
  .grid-form .span-2 { grid-column: auto; }
  .items__head { display: none; }
  .items__row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .items__text { grid-column: 1 / -1; }
  .items__tools { grid-column: 1 / -1; justify-content: flex-end; }
  .form--inline label { min-width: 0; flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { .note { animation: none; } .note.is-leaving { transition: none; } }

/* Tastatur in Listen (Belege, Bank) */
tbody tr.is-cursor td { background: var(--hover); }
tbody tr.is-cursor td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.keyhint { margin: 10px 4px 0; font-size: 12px; color: var(--text-3); }
.keyhint--inline { display: none; margin: 0; align-self: center; }
dialog .keyhint--inline { display: inline; }
.keyhint kbd { display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 1.5px;
  border-radius: 5px; font: inherit; font-size: 11px; line-height: 17px; text-align: center; color: var(--text-2); background: var(--surface); }
@media (hover: none), (max-width: 640px) { .keyhint { display: none; } }

/* --- Aufgaben-Board (Kanban) -------------------------------------------------------------- */
.quickadd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.quickadd__input { flex: 1 1 320px; min-height: 36px !important; }
.quickadd__hint { flex-basis: 100%; margin: 0; font-size: 12.5px; color: var(--text-3); }
.quickadd__hint code { font: inherit; padding: 0 4px; border-radius: 4px; background: var(--press); color: var(--text-2); }
.filterchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 16px; font-size: 13px; cursor: pointer;
  background: var(--surface); color: var(--text-2); box-shadow: 0 0 0 .5px var(--line); user-select: none; }
.filterchip input { margin: 0; accent-color: var(--accent); }
.filterchip.is-on { color: var(--text); background: var(--accent-tint); box-shadow: 0 0 0 .5px var(--accent); }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.kanban__msg { grid-column: 1 / -1; }
.kcol { background: var(--sidebar); border-radius: var(--radius-lg); padding: 8px; min-height: 160px; transition: box-shadow .12s; }
.kcol.is-over { box-shadow: inset 0 0 0 2px var(--accent); }
.kcol--done { opacity: .85; }
.kcol__head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 10px; }
.kcol__head h2 { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.kcol__count { min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--press); color: var(--text-2); font-size: 12px;
  line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.kcol__empty { margin: 0; padding: 18px 8px; color: var(--text-3); font-size: 13px; text-align: center; }
.kcard { position: relative; background: var(--surface); border-radius: var(--radius); padding: 10px 12px 8px; margin-bottom: 8px;
  box-shadow: 0 0 0 .5px var(--line), 0 1px 2px rgba(0, 0, 0, .04); cursor: grab; }
.kcard:last-child { margin-bottom: 0; }
.kcard.is-dragging { opacity: .45; cursor: grabbing; }
.kcard--hoch { box-shadow: inset 3px 0 0 var(--warn), 0 0 0 .5px var(--line), 0 1px 2px rgba(0, 0, 0, .04); }
.kcard__row { display: flex; align-items: flex-start; gap: 8px; }
.kcard__kind { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--text-2); background: var(--press); }
.kcard--ticket .kcard__kind { color: var(--accent); background: var(--accent-tint); }
.kcard--mail .kcard__kind { color: var(--warn); background: var(--warn-tint); }
.kcard__title { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 500;
  line-height: 1.35; color: var(--text); text-align: left; overflow-wrap: anywhere; }
.kcard__title--btn { cursor: text; }
.kcard__title--btn:hover, a.kcard__title:hover { color: var(--accent); text-decoration: none; }
.kcard__sub { margin: 4px 0 0 30px; font-size: 12.5px; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; }
.kcard__foot { display: flex; align-items: center; gap: 8px; margin: 6px 0 0 30px; font-size: 12px; color: var(--text-3); }
.kcard__flag { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--warn-tint); color: var(--warn); font-weight: 700; font-size: 11px; }
.kcard__due { display: inline-flex; align-items: center; gap: 3px; }
.kcard__due--over { color: var(--danger); font-weight: 600; }
.kcard__link { color: var(--accent); }
.kcard__inline { margin: 0; }
.kcard__inline .linkbtn { font-size: 12px; }
.kcard__move { margin: 0 0 0 auto; }
.kcard__move select { width: auto; min-height: 24px !important; padding: 0 22px 0 6px !important; font-size: 12px !important; color: var(--text-2);
  border-color: transparent !important; background-color: transparent !important; box-shadow: none !important; }
.kcard__move select:hover { border-color: var(--line-strong) !important; }
.kcard--edit { cursor: default; }
.kcard__form { display: grid; gap: 8px; }
.kcard__form label { display: grid; gap: 3px; font-size: 12.5px; color: var(--text-2); }
.kcard__formrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kcard__formactions { display: flex; gap: 6px; flex-wrap: wrap; }
.kcard__formactions .btn--danger { margin-left: auto; }
@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .kanban { grid-template-columns: 1fr; } .quickadd__input { min-width: 0; } }

/* --- Termine ------------------------------------------------------------------------------ */
.datebox { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 10px; background: var(--accent-tint); color: var(--accent); line-height: 1; }
.datebox b { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.datebox small { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.datebox--open { background: var(--warn-tint); color: var(--warn); }
.datebox--lg { width: 64px; height: 64px; border-radius: 14px; }
.datebox--lg b { font-size: 26px; }
.datebox--lg small { font-size: 12px; }
.appt-row .li__sub { white-space: normal; }
.appt-row__kind { color: var(--text-3); display: grid; place-items: center; }
.badge--bestaetigt { background: var(--ok-tint); color: var(--ok); }
.badge--vorgeschlagen { background: var(--warn-tint); color: var(--warn); }
.badge--abgesagt { background: var(--press); color: var(--text-2); text-decoration: line-through; }
.linkcode { display: inline-block; max-width: 100%; padding: 4px 8px; border-radius: 6px; background: var(--canvas); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); user-select: all; }
.feedlink { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; min-width: 0; }
.feedlink .linkcode { flex: 1; }
.card--inset { margin: 0 -20px -18px; }
details.card > summary + .card--inset { margin-top: 4px; }
.appt-when { font-size: 20px; font-weight: 700; letter-spacing: -.015em; margin: 0 0 2px; }
.appt-when.is-cancelled { text-decoration: line-through; color: var(--text-2); }
.slotlist { margin: 0 0 12px; padding-left: 18px; font-size: 14px; line-height: 1.6; }
.appt-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }
.actions--start { justify-content: flex-start; }
.seg--radio .seg__opt { flex: 1 1 auto; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px;
  border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.seg--radio .seg__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg--radio .seg__opt:hover { color: var(--text); }
.seg--radio .seg__opt:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px var(--line); }
.seg--radio .seg__opt:has(input:focus-visible) { box-shadow: var(--focus); }
.seg--kinds.seg--radio { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.location-field { margin-top: 12px; }
.location-field small { font-weight: 400; }
.slotgrid { display: flex; flex-direction: column; gap: 10px; }
.slotgrid > label { max-width: 260px; }
.slotrow { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 10px; max-width: 420px; }
.slotrow.is-spare { display: none; }
.slotgrid > .btn { align-self: flex-start; }
.weekly { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; margin-bottom: 14px; }
.window-add { display: grid; grid-template-columns: 9rem 10rem 7rem 7rem 10rem 10rem minmax(8rem, 1fr) auto; gap: 10px; align-items: end;
  padding: 12px 18px 14px; border-top: 1px solid var(--line); margin: 0; }
@media (max-width: 1000px) { .window-add { grid-template-columns: repeat(2, minmax(0, 1fr)); } .window-add__note { grid-column: span 2; } }
@media (max-width: 720px) { .seg--kinds.seg--radio { grid-template-columns: repeat(2, minmax(0, 1fr)); } .slotrow { grid-template-columns: 1fr 1fr; } }

/* Öffentliche Terminseite und Buchungsseite */
.public .card--appt { max-width: 560px; padding: 30px 32px 24px; }
.public .card--book { max-width: 920px; padding: 0; overflow: hidden; }
.public .card--appt .brand, .public .card--book .brand { justify-content: flex-start; }
.public .card--book .brand { padding: 22px 26px 0; }
.appt-head__eyebrow { margin: 0 0 4px; font-size: 12.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.public .appt-head__title { text-align: left; font-size: 24px; margin: 0 0 16px; }
.appt-head__title.is-cancelled { text-decoration: line-through; color: var(--text-2); }
.appt-hero { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 14px; background: var(--canvas); margin-bottom: 16px; }
.appt-hero__when { font-size: 16px; font-weight: 600; }
.appt-hero__time { font-size: 20px; font-weight: 700; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.appt-state { display: flex; align-items: flex-start; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--warn-tint); color: var(--text); font-size: 14px; margin: 0 0 16px; }
.appt-state .ico { color: var(--warn); margin-top: 2px; }
.appt-state--off { background: var(--press); }
.appt-state--off .ico { color: var(--text-2); }
.appt-message { font-size: 15px; line-height: 1.55; margin: 0 0 16px; }
.facts--appt { grid-template-columns: 20px 1fr; gap: 6px 10px; margin-bottom: 18px; }
.facts--appt dt { color: var(--text-3); display: grid; place-items: center; height: 22px; }
.appt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 8px; }
.public .appt-actions .btn { width: auto; flex: 1 1 200px; min-height: 40px; }
.appt-url { word-break: break-all; margin: 0 0 14px; text-align: left; }
.appt-more { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.appt-more summary { cursor: pointer; font-size: 14px; color: var(--text-2); }
.appt-more[open] summary { margin-bottom: 12px; color: var(--text); }
.public .appt-more .form .btn { width: auto; align-self: flex-start; }
.appt-foot { margin-top: 20px; }
.slotpick__list { display: flex; flex-direction: column; gap: 8px; }
.slotopt { position: relative; display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 12px; border-radius: 12px; cursor: pointer;
  background: var(--canvas); color: var(--text); font-weight: 400; box-shadow: 0 0 0 .5px var(--line); transition: box-shadow .12s, background .12s; }
.slotopt:hover { background: var(--hover); }
.slotopt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.slotopt__text { flex: 1; display: flex; flex-direction: column; font-size: 14px; }
.slotopt__text b { font-weight: 600; }
.slotopt__text span { color: var(--text-2); font-variant-numeric: tabular-nums; }
.slotopt__check { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.slotopt:has(input:checked) { background: var(--accent-tint); box-shadow: 0 0 0 1.5px var(--accent); }
.slotopt:has(input:checked) .slotopt__check { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.slotopt:has(input:focus-visible) { box-shadow: var(--focus); }
.slotopt.is-past { opacity: .5; cursor: default; }
.book { display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.book__side { padding: 26px 26px 28px; background: var(--canvas); border-right: 1px solid var(--line); }
.public .book__title { text-align: left; font-size: 22px; margin: 0 0 14px; }
.book__meta { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--text-2); }
.book__meta li { display: flex; align-items: center; gap: 8px; }
.book__meta .ico { color: var(--accent); }
.book__desc { font-size: 14px; line-height: 1.55; color: var(--text); margin: 0; }
.book__main { padding: 26px 28px 28px; min-width: 0; }
.book__h2 { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 10px; }
.daystrip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 16px; scrollbar-width: thin; }
.daychip { flex: none; display: flex; flex-direction: column; align-items: center; width: 56px; padding: 8px 0 7px; border-radius: 12px;
  background: var(--surface); color: var(--text); box-shadow: 0 0 0 .5px var(--line); line-height: 1.15; }
.daychip small { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.daychip b { font-size: 19px; font-weight: 700; margin: 2px 0; letter-spacing: -.02em; }
.daychip:hover { text-decoration: none; background: var(--hover); }
.daychip.is-on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.daychip.is-on small { color: var(--accent-ink); opacity: .85; }
.timegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin: 0 0 20px; }
.timeopt { position: relative; cursor: pointer; }
.timeopt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.timeopt span { display: block; padding: 9px 0; border-radius: 10px; text-align: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); transition: background .12s; }
.timeopt:hover span { background: var(--accent-tint); }
.timeopt:has(input:checked) span { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.timeopt:has(input:focus-visible) span { box-shadow: var(--focus); }
.book__fields { border-top: 1px solid var(--line); padding-top: 18px; }
.public .book__form { gap: 0; }
.public .book__fields .btn { width: 100%; min-height: 42px; margin-top: 14px; font-size: 15px; }
.public .book__fields .small { margin-top: 10px; text-align: left; }
.public .card--book .flash { margin: 16px 26px 0; }
@media (max-width: 760px) {
  .book { grid-template-columns: 1fr; }
  .book__side { border-right: 0; border-bottom: 1px solid var(--line); }
  .public .card--appt { padding: 22px 20px 20px; }
}

/* Seite „Module“ */
.module { align-items: flex-start; gap: 12px; }
.module__icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-tint); color: var(--accent); }
.module--aus .module__icon { background: var(--hover); color: var(--text-3); }
.module--aus .li__title { color: var(--text-2); }
.module .li__title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.module form { flex: none; align-self: center; }
.modules-profile { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.modules-profile p { margin: 0; }
@media (max-width: 640px) { .module { flex-wrap: wrap; } .module form { margin-left: 46px; } }
.module .li__sub { white-space: normal; }
/* Hilfe */
.main { position: relative; }
.help-i { position: absolute; top: 14px; right: 18px; z-index: 3; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  font: italic 600 15px Georgia, "Times New Roman", serif; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--surface); }
.help-i:hover { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); text-decoration: none; }
.help-i--inline { position: static; display: inline-grid; width: 20px; height: 20px; font-size: 12px; vertical-align: -4px; }
.help-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: center; padding: 22px 24px; margin-bottom: 8px; }
.help-hero h1 { margin: 0 0 6px; } .help-hero p { margin: 0; color: var(--text-2); }
.help-search { display: flex; gap: 8px; } .help-search .search__field { flex: 1; }
.help-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--accent-tint); color: var(--accent); }
.help-icon--small { width: 32px; height: 32px; border-radius: 9px; }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 8px; }
.help-card { display: flex; gap: 14px; padding: 16px; color: var(--text); margin: 0; }
.help-card:hover { text-decoration: none; box-shadow: 0 0 0 1.5px var(--accent); }
.help-card__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.help-card__body > span:not(.badge) { color: var(--text-2); font-size: 13px; line-height: 1.45; }
.help-card__body .badge { align-self: flex-start; margin-top: 4px; }
.help-card--off .help-icon { background: var(--hover); color: var(--text-3); } .help-card--off strong { color: var(--text-2); }
.help-context { display: flex; gap: 14px; align-items: center; padding: 14px 16px; color: var(--text); box-shadow: 0 0 0 1.5px var(--accent); }
.help-context:hover { text-decoration: none; } .help-context > span:last-child { display: flex; flex-direction: column; }
.help-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 28px; align-items: start; }
.help-article { padding: 26px 30px 30px; margin: 0; }
.help-article__head { display: flex; gap: 16px; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.help-article__head h1 { margin: 0 0 4px; } .help-article__group { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.help-article__lead { margin: 0; color: var(--text-2); }
.help-note { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-tint); color: var(--text); font-size: 13.5px; }
.help-body { max-width: 72ch; line-height: 1.6; }
.help-body h2 { margin: 28px 0 8px; font-size: 18px; } .help-body h2:first-child { margin-top: 0; }
.help-body h3 { margin: 20px 0 6px; font-size: 15px; }
.help-body ul, .help-body ol { padding-left: 22px; } .help-body li { margin: 4px 0; }
.help-body ol.help-steps { list-style: none; padding: 0; counter-reset: schritt; }
.help-steps > li { position: relative; padding-left: 38px; margin: 10px 0; counter-increment: schritt; }
.help-steps > li::before { content: counter(schritt); position: absolute; left: 0; top: 0; width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent-tint); color: var(--accent); font-weight: 600; font-size: 13px; }
.help-ui { padding: 1px 7px; border-radius: 6px; background: var(--press); box-shadow: inset 0 0 0 .5px var(--line-strong); font-size: .92em; font-weight: 500; white-space: nowrap; }
.help-body table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.help-body th, .help-body td { text-align: left; vertical-align: top; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); }
.help-tip { margin: 14px 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-tint); border-radius: 0 8px 8px 0; }
.help-toc { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.help-toc__group { margin: 12px 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.help-toc__group:first-child { margin-top: 0; }
.help-toc a { padding: 4px 8px; border-radius: 6px; color: var(--text-2); }
.help-toc a:hover { background: var(--hover); text-decoration: none; }
.help-toc a[aria-current="page"] { background: var(--accent-tint); color: var(--accent); font-weight: 500; }
.help-toc a.is-off { color: var(--text-3); }
@media (max-width: 860px) { .help-hero, .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; } .help-article { padding: 18px; } }
@media (max-width: 640px) { .help-i { top: 8px; right: 10px; } .help-search { flex-wrap: wrap; } }
@media print { .help-i, .help-toc { display: none !important; } }
/* Einrichtung beim ersten Start */
.public .card--setup { width: 100%; max-width: 620px; padding: 30px 34px 28px; }
.public .card--setup h1 { text-align: left; font-size: 24px; margin-bottom: 8px; }
.public .card--setup .form .btn { width: auto; min-width: 140px; }
.public .card--setup .muted { text-align: left; }
.setup-lead { margin: 0 0 20px; color: var(--text-2); line-height: 1.55; }
.setup-hint { display: block; margin: 4px 0 0; font-size: 12.5px; font-weight: 400; line-height: 1.45; color: var(--text-3); }
.setup-steps { display: flex; gap: 4px; list-style: none; margin: 0 0 22px; padding: 0; font-size: 12px; }
.setup-steps li { flex: 1; padding-top: 7px; border-top: 3px solid var(--line-strong); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setup-steps li.is-done { border-color: var(--accent); } .setup-steps li.is-done a { color: var(--text-2); }
.setup-steps li.is-current { border-color: var(--accent); color: var(--text); font-weight: 600; }
.setup-choice { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 0; padding: 0; border: 0; }
.setup-choice legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.setup-choice legend small { font-weight: 400; }
.setup-choice label.check { align-items: flex-start; padding: 11px 13px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line-strong); line-height: 1.5; cursor: pointer; }
.setup-choice label.check:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--accent); background: var(--accent-tint); }
.setup-choice label.check input { margin-top: 4px; flex: none; }
.setup-choice[disabled], .setup-choice.is-off { opacity: .5; }
.setup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.setup-next { padding-left: 20px; line-height: 1.6; } .setup-next li { margin: 6px 0; }
.startlist { padding: 0; } .startlist__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px 6px; }
.startlist__head h2 { margin: 0; } .startlist .li__sub { white-space: normal; }
.startlist__mark { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); color: transparent; }
.startlist .is-done .startlist__mark { background: var(--ok); box-shadow: none; color: #fff; }
.startlist .is-done .li__title { color: var(--text-2); text-decoration: line-through; }
@media (max-width: 640px) { .public .card--setup { padding: 22px 18px; } .setup-steps li { font-size: 0; } .setup-steps li.is-current { font-size: 12px; } }
/* Beleg-Eingang */
.only-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .only-touch { display: inline-flex; } }
.keyshow { display: block; margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--press); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; word-break: break-all; white-space: pre-wrap; user-select: all; }
details.sheet__hint { margin: 4px 0 10px; } details.sheet__hint summary { cursor: pointer; color: var(--text-2); }
details.sheet__hint p, details.sheet__hint ol { color: var(--text-2); font-size: 13px; line-height: 1.5; }
/* Design-Auswahl */
.design-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.design-row { display: flex; flex-wrap: wrap; gap: 8px; }
.design-row > label { flex: none; }
.design-form legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.design-swatch { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 99px;
  box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 13.5px; font-weight: 500; color: var(--text); cursor: pointer; }
.design-swatch > input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.design-swatch:has(input[type="radio"]:checked) { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-tint); }
.design-swatch:has(input[type="radio"]:focus-visible) { box-shadow: var(--focus); }
.design-swatch__dot { width: 22px; height: 22px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.design-swatch__dot--console { background: #7c5cf0; } .design-swatch__dot--ozean { background: #1d7fb8; }
.design-swatch__dot--wald { background: #2f8f5b; } .design-swatch__dot--glut { background: #d9772b; }
.design-swatch__dot--auto { background: conic-gradient(#7c5cf0 0 25%, #1d7fb8 0 50%, #2f8f5b 0 75%, #d9772b 0); }
.design-swatch__picker { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; flex: none; }
.design-swatch__picker::-webkit-color-swatch-wrapper { padding: 0; } .design-swatch__picker::-webkit-color-swatch { border: 0; border-radius: 50%; }
.design-swatch__picker::-moz-color-swatch { border: 0; border-radius: 50%; }
.design-modes label.check { padding: 6px 12px; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--line-strong); cursor: pointer; }
.design-modes label.check:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-tint); }
.design-row > label { white-space: nowrap; }


/* ==========================================================================================================
   Console: flache Flächen mit klarer Kante statt Schatten, 12er/8er Radien, ruhige Navigation, Farbe nur als
   Akzent. Steht am Ende und gewinnt deshalb gegen die älteren Regeln oben.
   ========================================================================================================== */
:root { --radius: 8px; --radius-lg: 12px; }
body { line-height: 1.5; }
h1 { font: 650 clamp(24px, 2.6vw, 30px)/1.15 var(--font-display); letter-spacing: -.015em; }
h2 { font: 600 17px/1.25 var(--font-display); letter-spacing: -.005em; }
:focus-visible { border-radius: var(--radius); }

/* Zeichen der Anwendung – folgt der Farbwelt */
.logo { border-radius: 23%; }
.logo__bg { fill: var(--accent); }
.logo__fg { fill: var(--accent-ink); }
.logo__line { fill: var(--accent); opacity: .38; }
.logo__check { fill: none; stroke: var(--accent); stroke-width: 22; stroke-linecap: round; stroke-linejoin: round; }

/* Seitenleiste */
.sidebar { width: 228px; padding: 18px 12px 12px; border-right: 1px solid var(--line); }
.brand { gap: 11px; padding: 0 8px 20px; }
.brand__mark { width: 36px; height: 36px; border-radius: 9px; box-shadow: none; }
.brand__text strong { font: 650 15.5px/1.15 var(--font-display); }
.brand__text small { font-size: 12.5px; color: var(--text-3); }
.nav { gap: 2px; }
.nav a { height: auto; min-height: 36px; gap: 11px; padding: 6px 10px; border-radius: var(--radius); color: var(--text-2);
  font-size: 14px; font-weight: 500; }
.nav a .ico { color: inherit; opacity: 1; }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-tint); color: var(--text); font-weight: 550; }
.nav a[aria-current="page"] .ico { color: var(--accent); }
.nav__group { margin: 16px 10px 4px; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.sidebar__foot { padding-top: 12px; border-top: 1px solid var(--line); }
.me__avatar { width: 34px; height: 34px; background: var(--press); color: var(--text); font-size: 13px; }
.iconbtn { width: 34px; height: 34px; border-radius: var(--radius); }
.main { padding: 26px 28px 48px; }
.topbar, .scrim { display: none; }

/* Flächen */
.card { border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: none; }
.stat { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: none; }
.stat__value { margin-top: 8px; font: 650 30px/1.05 var(--font-display); letter-spacing: -.02em; }
.big { font: 650 32px/1.1 var(--font-display); }
.card__head h2 { font-size: 16px; }
.li { min-height: 50px; }
.li + .li::before { border-top-width: 1px; }

/* Formulare */
label { font-size: 13.5px; font-weight: 500; }
input, select, textarea { font-size: 15px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea {
  min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: none; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):hover, select:hover, textarea:hover {
  border-color: var(--text-3); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):focus-visible, select:focus-visible,
textarea:focus-visible { border-color: var(--accent); box-shadow: var(--focus); }
select { padding-right: 34px; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; }
input[type="color"]:not([type="checkbox"]) { padding: 3px; }
input[type=file]::file-selector-button { padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--press); }
.menu__field input, .menu__field select, .menu__field textarea { border-width: 1px; border-radius: var(--radius); }

/* Knöpfe */
.btn { min-height: 38px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--hover);
  font-size: 14px; font-weight: 600; }
.btn:hover { background: var(--press); }
.btn--primary { border-color: var(--accent); background: var(--accent); }
.btn--primary:hover { background: var(--accent); filter: brightness(1.1); }
.btn--small { min-height: 30px; padding: 0 11px; border-radius: 7px; font-size: 13px; }

/* Segmentschalter */
.tabs, .seg { padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--hover); }
.tabs a { padding: 6px 13px; border-radius: 6px; font-size: 14px; font-weight: 550; }
.tabs a[aria-current="page"], .seg button[aria-pressed="true"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.seg button { border-radius: 6px; }

/* Listen */
th { padding: 12px 16px 8px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 500; }
td { padding: 11px 16px; border-bottom: 1px solid var(--line); }
.card--table td:first-child, .card--table th:first-child { padding-left: 20px; }
.card--table td:last-child, .card--table th:last-child { padding-right: 20px; }
.badge { padding: 1px 9px; border: 1px solid var(--line); font-size: 12.5px; font-weight: 550; }
.badge--draft { box-shadow: none; border-color: var(--line-strong); }

/* Menüs, Dialoge, Meldungen */
.menu__panel { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); }
dialog.sheet { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .45); backdrop-filter: none; }
.flash { border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--radius); }
.flash--error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.note { border-radius: var(--radius-lg); }

/* Öffentliche Seiten */
.public { align-content: center; gap: 14px; }
.public .card { padding: 30px 28px 26px; }
.public .brand { padding: 0 0 22px; }
.public h1 { font-size: 25px; }
.public .form .btn { min-height: 44px; }
.public__foot { margin: 0; font-size: 13px; color: var(--text-3); text-align: center; }
.public__foot a { color: inherit; }
.public .card--legal { width: 100%; max-width: 760px; }
.public .card--legal h1 { text-align: left; }
.legal { max-width: 720px; }
.actions--start { justify-content: flex-start; }
.li__sub--wrap { white-space: normal; }
.legal h2 { margin-top: 22px; }
.legal p, .legal li { color: var(--text-2); }

/* --- Schmale Fenster: Kopfleiste mit Menüknopf, Navigation als Schublade ---------------------------------- */
@media (max-width: 900px) {
  .shell { display: block; }
  .topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 8px; min-height: 54px;
    padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
    background: var(--sidebar); border-bottom: 1px solid var(--line); }
  .topbar .iconbtn { width: 44px; height: 44px; }
  .topbar__brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--text); }
  .topbar__brand:hover { text-decoration: none; }
  .topbar__brand .brand__mark { width: 30px; height: 30px; border-radius: 8px; }
  .topbar__brand strong { font: 650 16px/1.2 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .me__avatar { width: 30px; height: 30px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(300px, 86vw); height: 100dvh; visibility: hidden;
    transform: translateX(-102%); transition: transform .22s ease, visibility 0s .22s;
    padding: calc(16px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .nav-open .sidebar { visibility: visible; transform: none; transition: transform .22s ease; box-shadow: var(--shadow-pop); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .22s; }
  .nav-open .scrim { opacity: 1; }
  .nav-open { overflow: hidden; }
  .nav a { min-height: 44px; font-size: 15px; }
  .main { padding: 18px max(16px, env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .help-i { top: 10px; right: 12px; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) { .sidebar, .nav-open .sidebar, .scrim { transition: none; } }

@media (max-width: 640px) {
  /* 16 px in Eingaben: sonst zoomt iOS beim Antippen; 44 px Höhe: sicher zu treffen */
  input, select, textarea { font-size: 16px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea { min-height: 44px; }
  .btn { min-height: 44px; }
  .btn--small { min-height: 36px; }
  .head { flex-direction: column; align-items: stretch; gap: 12px; }
  .head .form--inline { flex-wrap: wrap; }
  .head select { min-width: 0; }
  .head > .btn, .head > a.btn { align-self: flex-start; }
  .tabs { display: flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .grid, .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat__value { font-size: 24px; }
  .card { padding: 16px; }
  .card--table { padding: 0; }
  .card--list { padding: 6px 0; }
  .facts { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); }
  .facts dd { overflow-wrap: anywhere; }
  .actions { justify-content: stretch; }
  .actions > .btn { flex: 1 1 auto; }
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-width: 1px 0 0; border-radius: 16px 16px 0 0; }
  .sheet__form { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .menu__panel, .menu--end .menu__panel { position: fixed; inset: auto 12px calc(12px + env(safe-area-inset-bottom)) 12px; width: auto;
    max-height: 70dvh; overflow-y: auto; }
  .note { bottom: calc(16px + env(safe-area-inset-bottom)); }

  /* Listen als Karten: Kopfzeile weg, jede Zeile ein Block, die Spaltennamen setzt app.js als data-label */
  table.karten thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.karten, table.karten tbody, table.karten tfoot { display: block; }
  table.karten tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.karten tbody tr:last-child { border-bottom: 0; }
  table.karten td, .card--table table.karten td:first-child, .card--table table.karten td:last-child {
    display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 2px 0; border: 0; text-align: right; }
  table.karten td[data-label]::before { content: attr(data-label); flex: none; color: var(--text-3); font-size: 13px; text-align: left; }
  table.karten tbody td:first-child { display: block; margin-bottom: 4px; font-size: 15.5px; font-weight: 600; text-align: left; }
  table.karten tbody td:first-child::before { display: none; }
  table.karten td:empty { display: none; }
  table.karten td[colspan] { display: block; text-align: left; }
  table.karten tbody tr:hover td { background: none; }
  table.karten tfoot tr { border-bottom: 0; border-top: 1px solid var(--line); }
}

/* Aufklappbarer Abschnitt in Formularen (z. B. Konten für den DATEV-Export) */
details.drawer { padding-top: 12px; border-top: 1px solid var(--line); }
details.drawer > summary { cursor: pointer; color: var(--accent); font-weight: 550; list-style: none; }
details.drawer > summary::-webkit-details-marker { display: none; }
details.drawer[open] > summary { margin-bottom: 12px; }

/* Kleinunternehmer-Wächter: Balken bis 25.000 € – kräftig = eingegangen, blass = dazu die offenen Rechnungen */
.guard { --guard: var(--ok); border-left: 3px solid var(--guard); }
.guard--hinweis { --guard: var(--accent); }
.guard--warn { --guard: var(--warn); }
.guard--rot { --guard: var(--danger); }
.guard__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.guard__head h2 { margin: 0; }
.guard__bar { position: relative; height: 10px; margin: 12px 0; border-radius: 99px; background: var(--press); overflow: hidden; }
.guard__bar span { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--guard); }
.guard__open { opacity: .35; }
.guard__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 18px; margin: 0; }
.guard__facts dt { font-size: 12.5px; color: var(--text-3); }
.guard__facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.guard-w-0 { width: 0%; }
.guard-w-5 { width: 5%; }
.guard-w-10 { width: 10%; }
.guard-w-15 { width: 15%; }
.guard-w-20 { width: 20%; }
.guard-w-25 { width: 25%; }
.guard-w-30 { width: 30%; }
.guard-w-35 { width: 35%; }
.guard-w-40 { width: 40%; }
.guard-w-45 { width: 45%; }
.guard-w-50 { width: 50%; }
.guard-w-55 { width: 55%; }
.guard-w-60 { width: 60%; }
.guard-w-65 { width: 65%; }
.guard-w-70 { width: 70%; }
.guard-w-75 { width: 75%; }
.guard-w-80 { width: 80%; }
.guard-w-85 { width: 85%; }
.guard-w-90 { width: 90%; }
.guard-w-95 { width: 95%; }
.guard-w-100 { width: 100%; }

/* Jahresabschluss: Schritte mit Ampel oder Abhak-Feld */
.closing--done { border-left: 3px solid var(--ok); }
.step { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.step .lamp { margin-top: 5px; }
.step.is-done .li__title { color: var(--text-2); }
.step__tick { margin: 0; flex: none; }
.step__box { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 1.5px solid var(--line-strong); border-radius: 7px;
  background: var(--field); color: var(--accent-ink); cursor: pointer; }
.step__box:hover { border-color: var(--accent); }
.step__box[aria-checked="true"] { border-color: var(--accent); background: var(--accent); }
.step__links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: 13.5px; }
@media (max-width: 640px) { .step__box { width: 30px; height: 30px; } }
.flash--link { display: flex; align-items: center; gap: 10px; color: var(--text); }
.flash--link:hover { text-decoration: none; border-color: var(--accent); }

/* --- Nachträge aus dem UI-Audit ------------------------------------------------------------------------------ */
.back { margin: 0 0 8px; font-size: 13.5px; }                                   /* Rücklink über der Überschrift */
.alert--ok { background: var(--ok-tint); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 30%, transparent); }
.alert--aus { background: var(--hover); }
@media (max-width: 640px) {
  .help-i { width: 36px; height: 36px; top: 6px; right: 8px; }                 /* Tippfläche */
  .tabs a { padding: 9px 13px; }
  .iconbtn { width: 40px; height: 40px; }
  .back, .backlink { display: inline-flex; min-height: 36px; align-items: center; }
  .step__links a, .card__head a { padding: 6px 0; }
  h1 { overflow-wrap: anywhere; }
  .main > * { max-width: 100%; }
  pre, code { overflow-wrap: anywhere; white-space: pre-wrap; }
}

/* --- Aus dem Audit im echten Chrome (scripts/audit) ------------------------------------------------------------ */
/* Kennzeichen und rote Knöpfe: Farbe leicht zur Textfarbe gezogen – 4,5 : 1 auch auf der eigenen Tönung */
.badge--final, .badge--sent, .badge--hochgeladen, .badge--wartend, .badge--hochladen { color: color-mix(in srgb, var(--accent) 62%, var(--text)); }
.badge--paid, .badge--abgelegt, .badge--gesendet, .badge--accepted, .badge--bestaetigt { color: color-mix(in srgb, var(--ok) 62%, var(--text)); }
.badge--overdue, .badge--fehler, .badge--aufgegeben { color: color-mix(in srgb, var(--danger) 62%, var(--text)); }
.badge--vorgeschlagen { color: color-mix(in srgb, var(--warn) 62%, var(--text)); }
.btn--danger { color: color-mix(in srgb, var(--danger) 70%, var(--text)); }
.public__foot, .help-toc__group, .keyhint, .seg button span, .logo-card__preview--empty { color: var(--text-2); }
.keyshow { color: var(--text); }
.help-toc a[aria-current], .help-toc a.is-current { color: var(--text); }
.help-toc a.is-off { color: var(--text-2); }
.tabs a, .seg button { color: var(--text-2); }
/* Farbwähler: feste Größe statt volle Breite */
input[type="color"]:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]) { width: 46px; min-height: 30px; padding: 2px; flex: none; }
.design-swatch { max-width: 100%; }
table.karten td.is-leer { display: none; }
.card form + form { margin-top: 8px; }

@media (max-width: 640px) {
  /* Werkzeugleisten: Suche und Auswahl brechen um statt die Seite zu verbreitern */
  .toolbar > *, .toolbar form, .search { min-width: 0; max-width: 100%; }
  .toolbar form, .search { flex: 1 1 100%; flex-wrap: wrap; }
  .search__field { flex: 1 1 160px; min-width: 0; }
  .search__field > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]) { min-width: 0; width: 100%; }
  .toolbar select, .search select { flex: 1 1 140px; min-width: 0; }
  /* Hilfe: Artikel darf nie breiter sein als der Bildschirm; breite Tabellen rollen in sich */
  .help-layout > *, .help-article { min-width: 0; max-width: 100%; }
  .help-article table { display: block; max-width: 100%; overflow-x: auto; }
  .help-article { overflow-wrap: anywhere; }
  /* Knopfreihen brechen um, statt links aus dem Bild zu laufen */
  .sheet__actions { flex-wrap: wrap; }
  .sheet__actions .grow { display: none; }
  .sheet__actions .btn { flex: 1 1 auto; }
  .sheet__actions .btn--danger { margin-right: 0; }
  .form--inline select { min-width: 0; flex: 1 1 120px; }
  /* Tippflächen */
  .topbar__brand { min-height: 44px; }
  .card__head a, .linkbtn, summary { display: inline-flex; align-items: center; min-height: 36px; }
  details > summary { display: flex; }
  .step__box { width: 36px; height: 36px; }
  .items__tools .iconbtn { width: 40px; height: 40px; }
  .skip-link { padding: 10px 12px; }
}

/* Listen werden schon unter 900 px zu Karten: auf dem Tablet (Navigation als Schublade) sind sieben Spalten zu eng */
@media (min-width: 641px) and (max-width: 900px) {
  /* Listen als Karten: Kopfzeile weg, jede Zeile ein Block, die Spaltennamen setzt app.js als data-label */
  table.karten thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.karten, table.karten tbody, table.karten tfoot { display: block; }
  table.karten tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.karten tbody tr:last-child { border-bottom: 0; }
  table.karten td, .card--table table.karten td:first-child, .card--table table.karten td:last-child {
    display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 2px 0; border: 0; text-align: right; }
  table.karten td[data-label]::before { content: attr(data-label); flex: none; color: var(--text-3); font-size: 13px; text-align: left; }
  table.karten tbody td:first-child { display: block; margin-bottom: 4px; font-size: 15.5px; font-weight: 600; text-align: left; }
  table.karten tbody td:first-child::before { display: none; }
  table.karten td:empty { display: none; }
  table.karten td[colspan] { display: block; text-align: left; }
  table.karten tbody tr:hover td { background: none; }
  table.karten tfoot tr { border-bottom: 0; border-top: 1px solid var(--line); }
  table.karten td.is-leer { display: none; }
}

/* Audit, zweite Runde */
.logo-card__preview--empty { color: #5f5f66; }                 /* steht immer auf Weiß – auch im dunklen Modus */
@media (max-width: 900px) {
  table.karten tbody td:first-child a { display: inline-block; padding: 7px 0; }      /* Titel der Karte: gut zu treffen */
  .help-toc a { padding-top: 9px; padding-bottom: 9px; }
  input[type="color"]:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]) { width: 52px; min-height: 38px; }
}
@media (max-width: 900px) {
  /* Karten-Listen: Zellen mit Name + Zusatzzeile (Belege, Bank) – rechtsbündig untereinander, volle Breite */
  table.karten td.txlist__main { width: auto; max-width: none; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; }
  table.karten td.txlist__main::before { grid-row: span 2; }
  table.karten td.txlist__main > * { grid-column: 2; text-align: right; min-width: 0; }
  table.karten td.nowrap { white-space: normal; }
  table.karten td .badge + .badge { margin-left: 6px; }
  table.karten td:has(.badge) { justify-content: flex-start; gap: 0; }
  table.karten td:has(.badge)::before { margin-right: auto; }
}
@media (max-width: 640px) {
  /* Zahlung von Hand vermerken: Art, Datum und Knopf untereinander statt gequetscht */
  .suggest--manual { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .suggest--manual .btn { grid-column: 1 / -1; min-height: 44px; }
}
@media (max-width: 640px) { .suggest--manual select, .suggest--manual input { width: 100%; flex: none; } }
@media (max-width: 640px) {
  /* Module: Text bekommt die ganze Zeile, der Schalter rückt darunter */
  .module .li__main { flex: 1 1 calc(100% - 60px); }
  .module form { flex: 1 1 100%; margin-left: 46px; }
  .module form .btn { width: auto; }
}
p > .lamp { display: inline-block; vertical-align: 1px; margin-right: 6px; }      /* Ampel im Fließtext */
@media (max-width: 900px) { .back a { display: inline-flex; align-items: center; min-height: 36px; } }

/* Schmale Fenster: der Hilfe-Knopf sitzt in der Kopfleiste neben dem Konto – so verdeckt er keine Knöpfe im Seitenkopf */
@media (max-width: 900px) {
  .help-i { position: fixed; top: calc(env(safe-area-inset-top) + 9px); right: calc(max(10px, env(safe-area-inset-right)) + 52px); z-index: 41; }
  .topbar__brand { padding-right: 48px; }
}

/* Einrichtung: Zwischenüberschrift vor der Farbwahl */
.setup-sub { margin: 18px 0 2px; font-size: 17px; }
.public .design-form fieldset { margin-bottom: 6px; }
.public .design-form legend { padding: 0; margin-bottom: 6px; font-size: 13.5px; font-weight: 500; color: var(--text-2); }

/* Fehlermeldungen: rote Schrift zur Textfarbe gezogen – lesbar auf der eigenen roten Tönung */
.flash--error { color: color-mix(in srgb, var(--danger) 58%, var(--text)); }

/* Einrichtung: wechselnder Name im Kopf, solange noch keiner gewählt ist */
.brand__wechsel { display: inline-block; min-width: 11ch; transition: opacity .28s ease, transform .28s ease; }
.brand__wechsel.is-weg { opacity: 0; transform: translateY(-4px); }
@media (prefers-reduced-motion: reduce) { .brand__wechsel { transition: none; } .brand__wechsel.is-weg { opacity: 1; transform: none; } }

/* Bankabruf: Grafik der Bank für die Freigabe (photoTAN, QR) */
.tan-bild { max-width: min(260px, 100%); border-radius: var(--radius); background: #fff; padding: 8px; }
.step__links form { margin: 0; }

/* Letzte kleine Tippflächen aus dem Audit */
@media (max-width: 900px) {
  .review__doc a, .chip, .tbtn { min-height: 38px; display: inline-flex; align-items: center; }
  .tbtn { min-width: 40px; justify-content: center; }
  input[type=file] { min-height: 44px; }
}
@media (max-width: 900px) { table.karten td a { display: inline-block; padding: 7px 0; } }   /* Links in Karten-Zeilen: gut zu treffen */
@media (max-width: 900px) {
  /* Kopfzelle einer Karte mit zwei Zeilen (Name und Zusatz): untereinander, nicht nebeneinander */
  .card--table table.karten tbody td:first-child { display: block; text-align: left; }
}

/* Rechnungslayout: Einstellungen links, Vorschau des Beispielbelegs rechts */
.layout-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; max-width: none; }
.layout-edit > .card { margin: 0; }
.layout-edit__preview { position: sticky; top: 16px; }
.layout-edit__preview iframe { width: 100%; height: min(78vh, 900px); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
@media (max-width: 1100px) { .layout-edit { grid-template-columns: minmax(0, 1fr); } .layout-edit__preview { position: static; } .layout-edit__preview iframe { height: 70vh; } }
