/* ==========================================================================
   MQXXS Design (shadcn/ui-Theme) — gemeinsame Grundlage aller Seiten
   Einbinden: Geist-Font (Google Fonts) + /static/theme.css + /static/app-shell.js
   Standard ist dunkel (<html class="dark">); Umschalter in der Sidebar.
   ========================================================================== */

:root {
  --background: oklch(1 0 0); --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0); --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0); --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.5 0.134 242.749); --primary-foreground: oklch(0.977 0.013 236.62);
  --secondary: oklch(0.967 0.001 286.375); --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.97 0 0); --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0); --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0); --input: oklch(0.922 0 0); --ring: oklch(0.708 0 0);
  --chart-1: oklch(0.828 0.111 230.318); --chart-2: oklch(0.685 0.169 237.323);
  --chart-3: oklch(0.588 0.158 241.966); --chart-4: oklch(0.5 0.134 242.749); --chart-5: oklch(0.443 0.11 240.79);
  --radius: 0.45rem;
  --sidebar: oklch(0.985 0 0); --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.588 0.158 241.966); --sidebar-primary-foreground: oklch(0.977 0.013 236.62);
  --sidebar-accent: oklch(0.97 0 0); --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0); --sidebar-ring: oklch(0.708 0 0);

  --font-sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, Consolas, monospace;
  --sidebar-width: 240px;
  --radius-sm: calc(var(--radius) * 0.8);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 30px -10px rgb(0 0 0 / 0.35);
}
.dark {
  --background: oklch(0.145 0 0); --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0); --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0); --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.443 0.11 240.79); --primary-foreground: oklch(0.977 0.013 236.62);
  --secondary: oklch(0.274 0.006 286.033); --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0); --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0); --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%); --input: oklch(1 0 0 / 15%); --ring: oklch(0.556 0 0);
  --sidebar: oklch(0.205 0 0); --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.685 0.169 237.323); --sidebar-primary-foreground: oklch(0.293 0.066 243.157);
  --sidebar-accent: oklch(0.269 0 0); --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%); --sidebar-ring: oklch(0.556 0 0);
  --shadow-lg: 0 10px 30px -10px rgb(0 0 0 / 0.7);
}

/* Alte Variablennamen der Seiten → neues Theme. Damit passen auch Inline-Styles,
   die das JavaScript der Seiten erzeugt (z.B. style="color:var(--ink-dim)"). */
:root, .dark {
  --bg-0: var(--background); --bg-1: var(--background);
  --surface: var(--card); --surface-2: var(--card);
  --ink: var(--foreground); --ink-dim: var(--muted-foreground); --ink-mute: var(--muted-foreground);
  --line: var(--border); --line-strong: var(--input); --line-red: var(--ring);
  --red-core: var(--primary); --red-glow: var(--primary); --red-deep: var(--primary);
  --green: var(--foreground); --orange: var(--muted-foreground); --blue: var(--primary); --purple: var(--muted-foreground);
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; }
html.dark { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh;
  background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }
code, kbd, .mono { font-family: var(--font-mono); font-size: 12.5px; }
.tnum, table, .mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted-foreground); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.lucide, [data-icon] > svg { width: 16px; height: 16px; flex-shrink: 0; }
::selection { background: color-mix(in oklch, var(--primary) 45%, transparent); }

/* ---------- App-Rahmen: Sidebar + Inhalt ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.app-sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sidebar); color: var(--sidebar-foreground);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column;
}
.app-main { min-width: 0; display: flex; flex-direction: column; }
.page { padding: 20px 24px 48px; width: 100%; }
.page-narrow { max-width: 1100px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  min-height: 64px; padding: 12px 24px; border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 16px; font-weight: 500; margin: 0; }
.page-header p { margin: 2px 0 0; color: var(--muted-foreground); font-size: 13px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.section-title { font-size: 14px; font-weight: 500; margin: 0 0 4px; }
.section-desc { font-size: 13px; color: var(--muted-foreground); margin: 0 0 12px; }

/* Sidebar */
.sb-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.sb-logo {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--sidebar-primary); color: var(--sidebar-primary-foreground);
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.sb-brand { font-weight: 600; font-size: 14px; line-height: 1.2; }
.sb-brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted-foreground); }
.sb-nav { padding: 4px 8px; flex: 1; }
.sb-group { padding: 6px 0; }
.sb-group-label { font-size: 12px; font-weight: 500; color: var(--muted-foreground); padding: 4px 8px; }
.sb-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  height: 32px; padding: 0 8px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--sidebar-foreground);
  font: 400 14px var(--font-sans); text-decoration: none; cursor: pointer; text-align: left;
}
.sb-item:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.sb-item.active { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); font-weight: 500; }
.sb-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.sb-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sidebar-primary); color: var(--sidebar-primary-foreground);
  font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.sb-foot { padding: 8px; border-top: 1px solid var(--sidebar-border); }
.sb-label, .sb-group-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dialog "Sidebar anpassen" (app-shell.js) */
.dialog.sbc { max-width: 640px; }
.sbc-group { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 10px; overflow: hidden; }
.sbc-ghead {
  display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 10px;
  background: color-mix(in oklch, var(--muted) 60%, transparent); border-bottom: 1px solid var(--border);
}
.sbc-gicon { display: inline-flex; color: var(--muted-foreground); }
.sbc-gicon svg { width: 16px; height: 16px; }
.sbc-ghead .input { height: 30px; padding: 0 8px; border-color: transparent; font-weight: 600; font-size: 13px; }
.sbc-ghead .input:hover { border-color: var(--input); }
.sbc-ghead .input:focus { border-color: var(--ring); }
.sbc-row {
  display: grid; grid-template-columns: 16px 32px 34px minmax(0, 1fr) 28px 28px 28px;
  align-items: center; gap: 6px; padding: 5px 8px; border-top: 1px solid var(--border); background: var(--background);
}
.sbc-ghead + .sbc-row { border-top: 0; }
.sbc-row .input { height: 30px; }
.sbc-row.is-off .sbc-ibtn, .sbc-row.is-off .input { opacity: .5; }
.sbc-row.is-dragging { opacity: .35; }
.sbc-row.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.sbc-row.drop-after { box-shadow: inset 0 -2px 0 var(--primary); }
.sbc-grip { display: inline-flex; justify-content: center; color: var(--muted-foreground); cursor: grab; }
.sbc-grip svg { width: 16px; height: 16px; }
.sbc-ibtn {
  width: 34px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid var(--input); border-radius: var(--radius-sm); background: transparent; color: var(--foreground); cursor: pointer;
}
.sbc-ibtn:hover, .sbc-ibtn[aria-expanded="true"] { background: var(--accent); border-color: var(--ring); }
.sbc-ibtn svg { width: 16px; height: 16px; }
.sbc-empty {
  margin: 8px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  text-align: center; font-size: 13px; color: var(--muted-foreground);
}
.sbc-ghead.drop-in, .sbc-empty.drop-in { background: color-mix(in oklch, var(--primary) 14%, transparent); }
.sbc-picker { padding: 10px; border-top: 1px solid var(--border); background: color-mix(in oklch, var(--muted) 60%, transparent); }
.sbc-picker-head { display: flex; gap: 8px; margin-bottom: 8px; }
.sbc-picker-head .btn { flex-shrink: 0; height: 32px; }
.sbc-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 4px; max-height: 200px; overflow-y: auto; }
.sbc-ico {
  height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--background); color: var(--foreground); cursor: pointer;
}
.sbc-ico[hidden] { display: none; }
.sbc-ico:hover { border-color: var(--ring); }
.sbc-ico.is-sel { background: var(--primary); color: var(--primary-foreground); }
.sbc-ico svg { width: 18px; height: 18px; }
.sbc-add { width: 100%; justify-content: center; border-style: dashed; }
.sbc-ghead .btn:disabled, .sbc-row .btn:disabled { opacity: .25; }
@media (hover: none) and (pointer: coarse) {   /* Handy/Tablet: kein Ziehen, nur Pfeile */
  .sbc-grip { display: none; }
  .sbc-row { grid-template-columns: 32px 34px minmax(0, 1fr) 28px 28px 28px; }
}
@media (max-width: 520px) {
  .dialog.sbc { max-height: 94vh; }
  .dialog.sbc .dialog-body { padding: 10px 12px; }
  .sbc-row { gap: 4px; padding: 5px 6px; }
}

.mobile-bar { display: none; }
.sb-scrim { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: 60;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .app.sb-open .app-sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.sb-open .sb-scrim { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .5); z-index: 50; }
  .mobile-bar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 40;
    height: 52px; padding: 0 12px; background: var(--background); border-bottom: 1px solid var(--border);
  }
  .mobile-bar .title { font-weight: 500; }
  .page { padding: 16px 16px 40px; }
  .page-header { padding: 12px 16px; }
}

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--foreground);
  font: 500 13px/1 var(--font-sans); white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:focus-visible, .sb-item:focus-visible, .tab:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary, .btn-success { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover, .btn-success:hover { background: color-mix(in oklch, var(--primary) 88%, var(--foreground)); }
.btn-secondary, .btn-link { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover, .btn-link:hover { background: color-mix(in oklch, var(--secondary) 80%, var(--foreground)); }
.btn-outline, .btn-ghost, .btn-warn { border-color: var(--border); background: transparent; color: var(--foreground); }
.btn-outline:hover, .btn-ghost:hover, .btn-warn:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-plain { border-color: transparent; }
.btn-plain:hover { background: var(--accent); }
.btn-danger, .btn-destructive {
  color: var(--destructive); background: color-mix(in oklch, var(--destructive) 10%, transparent);
  border-color: color-mix(in oklch, var(--destructive) 25%, transparent);
}
.btn-danger:hover, .btn-destructive:hover { background: color-mix(in oklch, var(--destructive) 20%, transparent); }
.btn-sm, .btn-small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg, .btn-large { height: 36px; padding: 0 16px; font-size: 14px; }
.btn-icon { width: 32px; padding: 0; }
.btn-sm.btn-icon, .btn-small.btn-icon { width: 28px; }

/* ---------- Karten ---------- */
.card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.card-header { padding: 16px 20px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title { font-size: 14px; font-weight: 500; margin: 0; }
.card-desc { font-size: 13px; color: var(--muted-foreground); margin: 2px 0 0; }
.card-content { padding: 16px 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px;
  border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
  background: var(--secondary); color: var(--secondary-foreground);
  font-size: 12px; font-weight: 500; line-height: 1;
}
.badge-outline { background: transparent; border-color: var(--border); color: var(--foreground); }
.badge-destructive { background: color-mix(in oklch, var(--destructive) 15%, transparent); color: var(--destructive); }
.badge-primary { background: color-mix(in oklch, var(--primary) 30%, transparent); color: var(--foreground); }

/* ---------- Eingaben ---------- */
.input, .select, .textarea {
  width: 100%; height: 32px; padding: 0 10px;
  background: transparent; color: var(--foreground);
  border: 1px solid var(--input); border-radius: var(--radius-sm);
  font: 400 14px var(--font-sans); outline: none;
}
.textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 30%, transparent); }
.select option, .field select option { background: var(--popover); color: var(--popover-foreground); }
.label { display: block; font-size: 13px; font-weight: 500; margin: 0 0 6px; }
/* Altes Muster: <div class="field"><input …></div> */
.field {
  display: flex; align-items: center; width: 100%; min-height: 32px;
  border: 1px solid var(--input); border-radius: var(--radius-sm); background: transparent;
}
.field:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 30%, transparent); }
.field input, .field select, .field textarea {
  flex: 1; width: 100%; height: 30px; padding: 0 10px; border: 0; outline: none;
  background: transparent; color: var(--foreground); font: 400 14px var(--font-sans);
}
.field textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* ---------- Tabs / Filter ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--muted); border-radius: var(--radius); flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer;
  color: var(--muted-foreground); font: 500 13px var(--font-sans);
}
.tab:hover { color: var(--foreground); }
.tab.active { background: var(--background); color: var(--foreground); box-shadow: var(--shadow); }
.tab .count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--secondary); color: var(--secondary-foreground); font-size: 11px; font-variant-numeric: tabular-nums;
}

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; height: 38px; padding: 0 12px; white-space: nowrap;
  color: var(--muted-foreground); font-weight: 500; border-bottom: 1px solid var(--border);
}
.table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in oklch, var(--muted) 50%, transparent); }
.table tr.is-click { cursor: pointer; }

/* ---------- Dialoge ---------- */
.dialog-overlay {
  position: fixed; inset: 0; z-index: 100; padding: 16px;
  background: rgb(0 0 0 / .5); display: none; align-items: center; justify-content: center;
}
.dialog-overlay.is-open { display: flex; }
.dialog {
  width: 100%; max-width: 520px; max-height: 90vh; display: flex; flex-direction: column;
  background: var(--background); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.dialog-header { padding: 20px 20px 4px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-title { font-size: 16px; font-weight: 600; margin: 0; }
.dialog-desc { font-size: 13px; color: var(--muted-foreground); margin: 4px 0 0; }
.dialog-body { padding: 12px 20px; overflow-y: auto; }
.dialog-footer { padding: 12px 20px 20px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------- Hinweise (Toasts) ---------- */
.toast-region { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  width: min(380px, calc(100vw - 32px)); padding: 12px 14px;
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  font-size: 13px; animation: mq-toast-in .18s ease;
}
.toast svg { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; }
.toast.is-error svg { color: var(--destructive); }
.toast .toast-close { margin-left: auto; background: none; border: 0; color: var(--muted-foreground); cursor: pointer; padding: 0; }
@keyframes mq-toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Hinweiskasten ---------- */
.callout {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  font-size: 13px; line-height: 1.5;
}
.callout > svg { margin-top: 2px; flex-shrink: 0; }
.callout-primary { border-color: color-mix(in oklch, var(--primary) 60%, transparent); background: color-mix(in oklch, var(--primary) 12%, transparent); }
.callout-destructive { border-color: color-mix(in oklch, var(--destructive) 40%, transparent); background: color-mix(in oklch, var(--destructive) 8%, transparent); }
.callout-destructive > svg { color: var(--destructive); }

/* ---------- Leerzustand ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 40px 16px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted-foreground);
  font-size: 13px;
}
.empty-icon { width: 40px; height: 40px; border-radius: var(--radius); background: var(--muted); color: var(--foreground); display: grid; place-items: center; margin: 0 auto 4px; }
.empty-title { color: var(--foreground); font-weight: 500; font-size: 14px; }

/* ---------- Kennzahlen ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { padding: 16px 20px; }
.kpi-label { font-size: 13px; color: var(--muted-foreground); display: flex; align-items: center; justify-content: space-between; }
.kpi-value { font-size: 24px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- Schalter (shadcn Switch) ---------- */
.switch { position: relative; display: inline-block; width: 32px; height: 18px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--input); transition: background .15s; }
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--background); box-shadow: var(--shadow); transition: transform .15s;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- Kompatibilität: ältere, per JS erzeugte Dialoge (modal-card/-head/-foot) ---------- */
.modal-card {
  width: 100%; max-width: 560px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--background); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.modal-head { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close {
  width: 28px; height: 28px; display: grid; place-items: center; padding: 0; flex-shrink: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: var(--accent); color: var(--foreground); }
.modal-card .modal-body { overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.btn-tiny { height: 26px; padding: 0 9px; font-size: 12px; }
.loader { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--foreground); border-radius: 50%; animation: mq-spin .8s linear infinite; }
@keyframes mq-spin { to { transform: rotate(360deg); } }
/* Log-Kasten (Workflow, Eigenbelege) */
.log-box { font-family: var(--font-mono); font-size: 11.5px; line-height: 1.55; padding: 8px 10px; background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted-foreground); }
.log-ok { color: var(--foreground); }
.log-err { color: var(--destructive); }

/* ---------- Statusfarben (überall gleich: Verkauf + Einkauf) ---------- */
.s-bestellt, .s-offen          { --st: oklch(0.78 0.16 85); }   /* Gelb: noch zu erledigen */
.s-anfrage                     { --st: oklch(0.62 0.20 300); }  /* Violett: Anfrage */
.s-versendet                   { --st: oklch(0.63 0.17 255); }  /* Blau: unterwegs */
.s-abgeschlossen, .s-erhalten  { --st: oklch(0.66 0.15 160); }  /* Grün: fertig */
.s-storniert, .s-fall          { --st: oklch(0.64 0.21 25); }   /* Rot: Problem */
.st-badge[class*="s-"], .status-cell[class*="s-"], .result-status[class*="s-"] {
  background: color-mix(in oklch, var(--st) 18%, transparent);
  color: color-mix(in oklch, var(--st) 75%, var(--foreground));
  border-color: transparent;
}
