/*
 * eRechnungen – Designsystem (handgeschrieben, kein Build-Schritt).
 * Struktur: 1 Tokens · 2 Basis · 3 Layout · 4 Komponenten · 5 Formulare · 6 Tabellen · 7 Hilfsklassen · 8 Druck
 * Farblogik Prüfungen: grün = ok, gelb = prüfen, rot = Fehler/erforderlich.
 */

/* ---------- 1 Tokens ---------- */
:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #dde3ea;
  --border-strong: #c5cdd8;
  --text: #1b2430;
  --text-muted: #5b6878;
  --text-subtle: #8492a3;

  --primary: #1f4fa3;
  --primary-hover: #183f84;
  --primary-soft: #e8effb;
  --primary-text: #ffffff;

  --green: #1e7f4f;  --green-soft: #e3f4ea;  --green-border: #b7e0c8;
  --yellow: #8a5a00; --yellow-soft: #fff4d6; --yellow-border: #f0d48a;
  --red: #b42318;    --red-soft: #fdecea;    --red-border: #f3b8b2;
  --blue: #1f4fa3;   --blue-soft: #e8effb;   --blue-border: #bcd0f0;
  --gray: #4b5563;   --gray-soft: #eef1f4;   --gray-border: #d5dbe2;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);

  --sidebar-width: 248px;
  --topbar-height: 60px;
  --focus: 0 0 0 3px rgba(31, 79, 163, .3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141b; --surface: #161d27; --surface-2: #1b2430; --surface-3: #222c3a;
    --border: #2b3646; --border-strong: #3a475a; --text: #e6ebf2; --text-muted: #a4b0bf; --text-subtle: #7d8a9b;
    --primary: #5b8ee6; --primary-hover: #77a2ec; --primary-soft: #1c2b45; --primary-text: #0b1220;
    --green: #5fcf94; --green-soft: #12301f; --green-border: #23573a;
    --yellow: #f2c35c; --yellow-soft: #33280e; --yellow-border: #5c4816;
    --red: #f2877d; --red-soft: #3a1714; --red-border: #6b2a24;
    --blue: #7ea6ee; --blue-soft: #1c2b45; --blue-border: #2e4a7a;
    --gray: #b3bdc9; --gray-soft: #232d3a; --gray-border: #364253;
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --bg: #0f141b; --surface: #161d27; --surface-2: #1b2430; --surface-3: #222c3a;
  --border: #2b3646; --border-strong: #3a475a; --text: #e6ebf2; --text-muted: #a4b0bf; --text-subtle: #7d8a9b;
  --primary: #5b8ee6; --primary-hover: #77a2ec; --primary-soft: #1c2b45; --primary-text: #0b1220;
  --green: #5fcf94; --green-soft: #12301f; --green-border: #23573a;
  --yellow: #f2c35c; --yellow-soft: #33280e; --yellow-border: #5c4816;
  --red: #f2877d; --red-soft: #3a1714; --red-border: #6b2a24;
  --blue: #7ea6ee; --blue-soft: #1c2b45; --blue-border: #2e4a7a;
  --gray: #b3bdc9; --gray-soft: #232d3a; --gray-border: #364253;
}

/* ---------- 2 Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-sans); font-size: 15px; line-height: 1.5;
  color: var(--text); background: var(--bg);
}
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--font-mono); font-size: .875em; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; overflow: auto; max-height: 520px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
[x-cloak] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- 3 Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100vh; }
.sidebar {
  background: #14243f; color: #d6e0f0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.1rem; font-weight: 700; color: #fff; font-size: 1.05rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .logo { width: 30px; height: 30px; border-radius: 8px; background: #2f6bd0; display: grid; place-items: center; font-size: .8rem; }
.nav { padding: .75rem .6rem; flex: 1; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #8ea3c3; margin: 1rem .6rem .35rem; }
.nav a {
  display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: var(--radius);
  color: #d6e0f0; font-size: .92rem; text-decoration: none;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: #2b4f8c; color: #fff; font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.sidebar-footer { padding: .75rem 1rem; font-size: .75rem; color: #8ea3c3; border-top: 1px solid rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-height); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem; position: sticky; top: 0; z-index: 20;
}
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { padding-left: 2.1rem; }
.topbar .search svg { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-subtle); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.menu-toggle { display: none; }
.content { padding: 1.5rem; max-width: 1440px; width: 100%; }
.content-narrow { max-width: 920px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-header .subtitle { color: var(--text-muted); margin-top: .2rem; }
.page-header .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumbs { font-size: .82rem; color: var(--text-muted); margin-bottom: .35rem; }
.breadcrumbs a { color: var(--text-muted); }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stack > * + * { margin-top: 1rem; }
.stack-sm > * + * { margin-top: .5rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-full { grid-column: 1 / -1; }

.guest { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(160deg, #14243f 0%, #1f4fa3 100%); }
.guest-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 2rem; }
.guest-card .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; margin-bottom: 1.25rem; }
.guest-card .brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: .85rem; }

/* ---------- 4 Komponenten ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { margin: 0; font-size: 1rem; }
.card-body { padding: 1.1rem; }
.card-footer { padding: .8rem 1.1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-flush .card-body { padding: 0; }

.stat { padding: 1rem 1.1rem; }
.stat .label { color: var(--text-muted); font-size: .82rem; }
.stat .value { font-size: 1.55rem; font-weight: 700; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: .8rem; color: var(--text-subtle); margin-top: .2rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .5rem .95rem;
  border-radius: var(--radius); border: 1px solid transparent; font: inherit; font-size: .9rem; font-weight: 550;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.3; transition: background .12s, border-color .12s;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-success { background: var(--green); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.btn-lg { padding: .7rem 1.2rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-microsoft { background: #fff; color: #1b1b1b; border-color: #8c8c8c; }
.btn-microsoft:hover { background: #f3f3f3; }

.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .76rem;
  font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); border-color: var(--green-border); }
.badge-yellow { background: var(--yellow-soft); color: var(--yellow); border-color: var(--yellow-border); }
.badge-red { background: var(--red-soft); color: var(--red); border-color: var(--red-border); }
.badge-blue { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-border); }
.badge-gray { background: var(--gray-soft); color: var(--gray); border-color: var(--gray-border); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

.alert { display: flex; gap: .75rem; padding: .85rem 1rem; border-radius: var(--radius); border: 1px solid; font-size: .92rem; }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: .05rem; }
.alert-title { font-weight: 650; margin-bottom: .15rem; }
.alert > div > :last-child { margin-bottom: 0; }
.alert-success, .alert-green { background: var(--green-soft); border-color: var(--green-border); color: var(--green); }
.alert-warning, .alert-yellow { background: var(--yellow-soft); border-color: var(--yellow-border); color: var(--yellow); }
.alert-danger, .alert-red { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.alert-info, .alert-blue { background: var(--blue-soft); border-color: var(--blue-border); color: var(--blue); }
.alert .alert-text { color: var(--text); }

/* Prüfbox (E-Rechnungsprüfung, Validierung) */
.check-box { border-radius: var(--radius-lg); border: 1px solid; padding: 1rem 1.1rem; }
.check-box.green { background: var(--green-soft); border-color: var(--green-border); }
.check-box.yellow { background: var(--yellow-soft); border-color: var(--yellow-border); }
.check-box.red { background: var(--red-soft); border-color: var(--red-border); }
.check-box .check-title { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1rem; }
.check-box.green .check-title { color: var(--green); }
.check-box.yellow .check-title { color: var(--yellow); }
.check-box.red .check-title { color: var(--red); }
.check-box ul { margin: .5rem 0 0; padding-left: 1.2rem; }
.check-box li { margin: .15rem 0; }
.check-box .meta { font-size: .78rem; color: var(--text-muted); margin-top: .6rem; }

.steps { display: flex; gap: .25rem; counter-reset: step; margin-bottom: 1.25rem; flex-wrap: wrap; }
.steps .step {
  flex: 1; min-width: 110px; display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); font-size: .85rem; color: var(--text-muted);
}
.steps .step::before {
  counter-increment: step; content: counter(step); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); font-size: .75rem; font-weight: 700; flex: none;
}
.steps .step.done { color: var(--green); }
.steps .step.done::before { content: "✓"; background: var(--green-soft); color: var(--green); }
.steps .step.current { border-color: var(--primary); color: var(--primary); font-weight: 600; background: var(--primary-soft); }
.steps .step.current::before { background: var(--primary); color: var(--primary-text); }
.steps button.step { cursor: pointer; font: inherit; font-size: .85rem; text-align: left; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a, .tabs button {
  padding: .6rem .9rem; color: var(--text-muted); border: 0; background: none; font: inherit; font-size: .9rem; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none;
}
.tabs .active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.dl { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: .45rem 1rem; margin: 0; }
.dl dt { color: var(--text-muted); font-size: .88rem; }
.dl dd { margin: 0; word-break: break-word; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state svg { width: 40px; height: 40px; color: var(--text-subtle); margin-bottom: .5rem; }
.empty-state h3 { color: var(--text); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .35rem; z-index: 40;
}
.dropdown-menu a, .dropdown-menu button {
  display: block; width: 100%; text-align: left; padding: .45rem .65rem; border-radius: var(--radius-sm); color: var(--text);
  background: none; border: 0; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); }
.dropdown-menu .divider { border-top: 1px solid var(--border); margin: .3rem 0; }
.dropdown-menu .label { padding: .35rem .65rem; font-size: .75rem; color: var(--text-subtle); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 27, .5); z-index: 50; display: grid; place-items: center; padding: 1rem; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-lg { max-width: 960px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 1.2rem; overflow: auto; }
.modal-footer { padding: .9rem 1.2rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; }

.pagination { display: flex; gap: .25rem; align-items: center; justify-content: flex-end; padding: .75rem 1rem; flex-wrap: wrap; }
.pagination a, .pagination span { padding: .3rem .65rem; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: .85rem; color: var(--text); background: var(--surface); }
.pagination .active { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.pagination .disabled { color: var(--text-subtle); }
.pagination .info { border: 0; background: none; color: var(--text-muted); margin-right: auto; }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--border); gap: 1px; }
.calendar .dow { background: var(--surface-2); padding: .45rem; font-size: .78rem; font-weight: 600; color: var(--text-muted); text-align: center; }
.calendar .day { background: var(--surface); min-height: 108px; padding: .35rem; font-size: .8rem; }
.calendar .day.other { background: var(--surface-2); color: var(--text-subtle); }
.calendar .day.today .num { background: var(--primary); color: var(--primary-text); }
.calendar .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 600; }
.calendar .event { display: block; margin-top: .2rem; padding: .1rem .35rem; border-radius: var(--radius-sm); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; text-decoration: none; }
.event-blue { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.event-green { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.event-yellow { background: var(--yellow-soft); border-color: var(--yellow); color: var(--yellow); }
.event-red { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.event-gray { background: var(--gray-soft); border-color: var(--gray); color: var(--gray); }

.xml-tree { font-family: var(--font-mono); font-size: .82rem; line-height: 1.55; }
.xml-tree details { margin-left: 1rem; }
.xml-tree summary { cursor: pointer; }
.xml-tree .tag { color: var(--blue); } .xml-tree .attr { color: var(--yellow); } .xml-tree .val { color: var(--green); }

/* ---------- 5 Formulare ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label, .label { font-size: .86rem; font-weight: 600; color: var(--text); }
.field .required::after { content: " *"; color: var(--red); }
.help { font-size: .8rem; color: var(--text-muted); }
.error { font-size: .8rem; color: var(--red); }
.input, .select, .textarea, input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], input[type="tel"], input[type="url"], input[type="file"], select, textarea {
  width: 100%; padding: .5rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  color: var(--text); font: inherit; font-size: .92rem; line-height: 1.35; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-muted); }
.is-invalid { border-color: var(--red) !important; }
.input-group { display: flex; } .input-group > * + * { margin-left: -1px; }
.input-group .addon { padding: .5rem .7rem; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-muted); border-radius: 0 var(--radius) var(--radius) 0; font-size: .9rem; }
.input-group input { border-radius: var(--radius) 0 0 var(--radius); }
.checkbox { display: flex; align-items: flex-start; gap: .5rem; font-size: .92rem; cursor: pointer; }
.checkbox input { margin-top: .2rem; width: 16px; height: 16px; accent-color: var(--primary); }
.radio-group { display: flex; gap: .35rem; flex-wrap: wrap; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill span { display: inline-block; padding: .35rem .75rem; border: 1px solid var(--border-strong); border-radius: 999px; font-size: .85rem; cursor: pointer; background: var(--surface); }
.radio-pill input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.radio-pill input:focus-visible + span { box-shadow: var(--focus); }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.1rem; margin: 0; }
.fieldset legend { padding: 0 .4rem; font-weight: 650; font-size: .95rem; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1.25rem; }

/* ---------- 6 Tabellen ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 650; background: var(--surface-2); }
.table th, .table td { padding: .6rem .85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 650; background: var(--surface-2); }
.table-compact th, .table-compact td { padding: .4rem .6rem; }
.table input, .table select { padding: .35rem .5rem; font-size: .88rem; }
.totals { width: 100%; max-width: 380px; margin-left: auto; border-collapse: collapse; }
.totals td { padding: .3rem 0; font-variant-numeric: tabular-nums; }
.totals td:last-child { text-align: right; }
.totals .grand td { font-weight: 750; font-size: 1.05rem; border-top: 2px solid var(--border-strong); padding-top: .5rem; }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.filters .field { min-width: 150px; flex: 1; max-width: 240px; }

/* ---------- 7 Hilfsklassen ---------- */
.muted { color: var(--text-muted); } .subtle { color: var(--text-subtle); } .small { font-size: .84rem; } .xsmall { font-size: .76rem; }
.bold { font-weight: 650; } .nowrap { white-space: nowrap; } .text-right { text-align: right; } .text-center { text-align: center; }
.text-green { color: var(--green); } .text-yellow { color: var(--yellow); } .text-red { color: var(--red); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.w-full { width: 100%; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none; }
.icon { width: 16px; height: 16px; vertical-align: -3px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li + li { margin-top: .4rem; }
.divider-list > * + * { border-top: 1px solid var(--border); }
.loading-overlay { opacity: .6; pointer-events: none; }

/* ---------- Responsiv ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-width); z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: inline-flex; }
  .content { padding: 1rem; }
  .grid-2, .grid-3, .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .dl { grid-template-columns: 1fr; gap: .1rem; }
  .dl dd { margin-bottom: .5rem; }
  .topbar .search { display: none; }
  .topbar { padding: 0 .75rem; gap: .5rem; }
  .topbar-right { min-width: 0; gap: .35rem; }
  .topbar-right .dropdown { min-width: 0; }
  .topbar-right > .dropdown > .btn { max-width: 44vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: inline-block; }
  .topbar-right > .dropdown > .btn svg { vertical-align: -3px; }
}
@media (max-width: 480px) {
  .topbar-right > .dropdown:last-child > .btn .truncate { display: none; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .page-header .actions { width: 100%; }
}

/* ---------- 8 Druck ---------- */
@media print {
  .sidebar, .topbar, .page-header .actions, .no-print { display: none !important; }
  .app { display: block; } .content { padding: 0; } .card { box-shadow: none; }
}
