/* M-Office – Gestaltungssystem im Geist von macOS/iOS.
   Systemschrift, ruhige Flächen, Haarlinien statt Rahmen, eine Akzentfarbe für Auswahl und Hauptaktion.
   Alle Farben als Tokens; Dunkelmodus folgt dem System. Der Posteingang (mail.css) nutzt dieselben Tokens. */

: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: 12px;
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, 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;
  }
}

/* --- 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 { 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: .5px 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: .5px 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: .5px 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: .5px 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: #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); } }
@media (prefers-color-scheme: dark) { .note { background: #3a3a3c; } }
.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: .5px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: .5px 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; }
.items__head, .items__row { display: grid; grid-template-columns: minmax(0, 4fr) 5.5rem 6.5rem 7rem 4.5rem 4.5rem; gap: 8px; }
.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: .5px 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; }
.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 { position: relative; display: flex; align-items: center; margin: 0; }
.search .ico { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search > input[type="search"] { 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: .5px 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 > input[type="search"] { min-width: 0; width: 100%; }
  .search { flex: 1; }
  .acctrow { grid-template-columns: 1fr 1fr; }
  .txlist__main { width: auto; max-width: none; }
}

/* --- 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 ----------------------------------------------------------------------- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; height: auto; width: auto; border-right: 0; border-bottom: .5px solid var(--line); padding: 10px; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .nav__group { display: none; }
  .nav a span { display: none; }
  .nav a { width: 38px; justify-content: center; padding: 0; }
  .sidebar__foot { display: none; }
  .brand { padding-bottom: 8px; }
  .main { padding: 20px 16px 48px; }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .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; }
  .form--inline label { min-width: 0; flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { .note { animation: none; } .note.is-leaving { transition: none; } }
