/* =====================================================================
   ReSeCards Warenwirtschaft – Designsystem
   Alle Farben, Größen, Abstände, Rundungen und Schatten sind hier zentral
   als Variablen definiert. Seiten verwenden nur diese Bausteine.
   ===================================================================== */
:root {
  /* Farben */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #16a34a;
  --accent-dark: #15803d;
  --accent-bg: #ecfdf3;
  --accent-ring: rgba(22, 163, 74, .22);
  --orange: #d97706;
  --orange-bg: #fff4e0;
  --blue: #2563eb;
  --blue-bg: #eaf1ff;
  --red: #dc2626;
  --red-bg: #fef0ef;
  --grey-bg: #f1f2f4;
  /* Rückwärtskompatible Namen */
  --card: var(--surface);
  --primary: var(--accent);
  --primary-dark: var(--accent-dark);
  --green: var(--accent-dark);
  --green-bg: var(--accent-bg);
  /* Schrift */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-table: 13.5px;
  --fs-base: 14.5px;
  --fs-h2: 17px;
  --fs-h1: 26px;
  --fs-kpi: 30px;
  /* Abstände */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  /* Rundungen */
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px;
  --radius: var(--r-lg);
  /* Schatten */
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .04);
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 4px 16px rgba(17, 24, 39, .04);
  --shadow-lg: 0 12px 40px rgba(17, 24, 39, .18);
  /* Bedienelemente */
  --control-h: 40px;
  --nav-w: 248px;
  --nav-w-collapsed: 72px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: var(--fs-base); line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 var(--sp-2); line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: var(--fs-h1); font-weight: 700; }
h2 { font-size: var(--fs-h2); font-weight: 650; }
h3 { font-size: var(--fs-base); font-weight: 650; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.error { color: var(--red); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Anmeldung ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-4); }
.login-card { background: var(--surface); padding: 32px; border-radius: var(--r-lg); width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); display: grid; gap: var(--sp-4); text-align: center; }
.login-card .field { text-align: left; margin: 0; }
.login-card p { margin: 0; }
.login-logo { width: 130px; height: 130px; border-radius: 24px; margin: 0 auto; display: block; box-shadow: var(--shadow); }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { flex: 1; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; }
.nav { display: none; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 12px 14px; gap: 2px; }
.nav.open { display: flex; }
.nav-logo { display: none; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; position: relative; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-bg); color: var(--accent-dark); font-weight: 600; }
.nav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav .ghost { margin-top: var(--sp-2); }
.nav-collapse { display: none; }
.main { padding: var(--sp-4); max-width: 1500px; margin: 0 auto; width: 100%; }
@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: var(--nav-w) 1fr; grid-template-rows: 1fr; transition: grid-template-columns .2s ease; }
  .app.collapsed { grid-template-columns: var(--nav-w-collapsed) 1fr; }
  .topbar { display: contents; }
  .topbar > :not(#status) { display: none; }
  .nav { display: flex; grid-row: 1; position: sticky; top: 0; height: 100vh; padding: 20px 14px 16px; z-index: 50; border-bottom: 0; border-right: 1px solid var(--line); gap: 4px; }
  .nav-logo { display: block; margin: 0 auto 20px; }
  .nav-logo img { width: 96px; height: 96px; border-radius: 20px; display: block; box-shadow: var(--shadow); transition: width .2s, height .2s; }
  .nav #logout { margin-top: auto; }
  .nav-collapse { display: flex; align-items: center; gap: 12px; margin-top: var(--sp-2); padding: 10px 12px; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-weight: 500; border: 0; min-height: 0; width: 100%; text-align: left; }
  .nav-collapse:hover { background: var(--surface-2); color: var(--text); filter: none; }
  .nav-collapse svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; transition: transform .2s; }
  .app.collapsed .nav-collapse svg { transform: rotate(180deg); }
  .main { grid-row: 1; padding: 28px 36px 40px; max-width: none; margin: 0; }
  /* eingeklappt: nur Icons */
  .app.collapsed .nav { padding-left: 10px; padding-right: 10px; }
  .app.collapsed .nav-logo img { width: 44px; height: 44px; border-radius: 12px; }
  .app.collapsed .nav a, .app.collapsed .nav-collapse { justify-content: center; padding-left: 0; padding-right: 0; }
  .app.collapsed .nav a span, .app.collapsed .nav-collapse span, .app.collapsed #logout .t { display: none; }
  .app.collapsed .nav a:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); background: var(--text); color: #fff; padding: 5px 10px; border-radius: 6px; font-size: var(--fs-sm); white-space: nowrap; z-index: 60; pointer-events: none; font-weight: 500; }
}
#logout { display: flex; align-items: center; justify-content: center; gap: 10px; }
#logout svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.status { font-size: var(--fs-xs); padding: 3px 10px; border-radius: 99px; background: var(--grey-bg); color: var(--muted); }
.status.live { background: var(--accent-bg); color: var(--accent-dark); }
.status.off { background: var(--red-bg); color: var(--red); }
@media (min-width: 900px) { .status { position: fixed; right: 16px; bottom: 12px; z-index: 30; box-shadow: var(--shadow); background: var(--surface); border: 1px solid var(--line); } .status.live { background: var(--accent-bg); } }

/* ---------- Seiten, Karten, Kennzahlen ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.page-head h1 { margin: 0; flex: 1; min-width: 160px; }
.head-actions, .actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.toolbar input, .toolbar select { flex: 1; min-width: 160px; width: auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: var(--sp-5); box-shadow: var(--shadow); }
.card h2 { margin-bottom: var(--sp-3); }
.section-title { margin: var(--sp-5) 0 var(--sp-3); }
.grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: var(--sp-5); }
.stats { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-height: 112px; display: flex; flex-direction: column; justify-content: center; gap: 2px; position: relative; }
.stat .k { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.stat .v { white-space: nowrap; font-size: clamp(22px, 1vw + 12px, var(--fs-kpi)); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.stat.has-icon { padding-right: 20px; }
.stat .k { padding-right: 52px; }
.stat .v { padding-right: 0; }
.stat.has-icon .ico { top: 14px; right: 14px; width: 38px; height: 38px; }
.stat .ico { position: absolute; right: 18px; top: 18px; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent-dark); }
.stat .ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat .ico.orange { background: var(--orange-bg); color: var(--orange); }
.stat .ico.blau { background: var(--blue-bg); color: var(--blue); }
.stat .ico.grau { background: var(--grey-bg); color: var(--muted); }
.stat.gedimmt { opacity: .6; }
.stat .v.gut { color: var(--accent-dark); }
.kvs { display: grid; gap: 14px 24px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kv .k { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; text-transform: none; }
.kv .v { font-weight: 550; word-break: break-word; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: var(--sp-3); font-weight: 500; color: var(--muted); }
.back:hover { color: var(--text); text-decoration: none; }

/* Rückfluss */
.rueck { display: grid; gap: var(--sp-3); }
.rueck-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.rueck-top .v { font-size: var(--fs-kpi); font-weight: 700; letter-spacing: -.02em; }
.bar { height: 12px; border-radius: 99px; background: var(--grey-bg); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s; }
.rueck-meta { display: grid; gap: var(--sp-2) var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.rueck-meta .k { color: var(--muted); font-size: var(--fs-xs); }
.rueck-meta .v { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Formulare ---------- */
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); min-height: var(--control-h); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #9ca3af; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); }
.field { display: grid; gap: 6px; margin-bottom: var(--sp-4); }
.field .label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.hint { color: var(--muted); font-size: var(--fs-xs); }
.form-grid { display: grid; gap: 0 var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end; margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-base); cursor: pointer; }
.check input { margin: 0; }

/* ---------- Buttons ---------- */
button { cursor: pointer; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 0 16px; min-height: var(--control-h); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s, box-shadow .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:hover:not(:disabled) { background: var(--surface-2); border-color: #bfc5cd; }
button:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--accent-ring); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
button.primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
button.ghost { background: var(--surface); }
button.danger { background: var(--surface); border-color: #f3b4b0; color: var(--red); }
button.danger:hover:not(:disabled) { background: var(--red); border-color: var(--red); color: #fff; }
button.small { padding: 0 12px; min-height: 32px; font-size: var(--fs-sm); }
.icon-btn { background: transparent; border-color: transparent; padding: 0 10px; min-height: 36px; font-size: 1.1rem; color: var(--muted); }
.icon-btn:hover:not(:disabled) { background: var(--grey-bg); border-color: transparent; color: var(--text); }

/* ---------- Tabellen ---------- */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--sp-5); box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 16px; border-bottom: 1px solid #eef0f3; text-align: left; vertical-align: middle; font-size: var(--fs-table); }
.table th { background: var(--surface-2); font-size: var(--fs-xs); color: var(--muted); font-weight: 600; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); padding-top: 12px; padding-bottom: 12px; }
.table th.num, .table td.num { text-align: right; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th.asc::after { content: "↑"; margin-left: 5px; color: var(--accent-dark); font-weight: 700; }
.table th.desc::after { content: "↓"; margin-left: 5px; color: var(--accent-dark); font-weight: 700; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f8faf9; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.empty { text-align: center; color: var(--muted); padding: 32px; }
.table tr.warn td { background: var(--red-bg); }
.table tr.storniert td { color: var(--muted); text-decoration: line-through; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.pager-info { color: var(--muted); font-size: var(--fs-sm); }
.table td strong { font-weight: 600; }

.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge.gruen { background: var(--accent-bg); color: var(--accent-dark); }
.badge.orange { background: var(--orange-bg); color: #b45309; }
.badge.blau { background: var(--blue-bg); color: #1d4ed8; }
.badge.grau { background: var(--grey-bg); color: var(--muted); }
.badge.rot { background: var(--red-bg); color: #b91c1c; }

.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: var(--r-sm); background: var(--grey-bg); border: 1px solid var(--line); display: inline-block; vertical-align: middle; flex: none; }
.thumb.empty { display: inline-grid; place-items: center; color: var(--muted); }
.thumb.big { width: 160px; height: 160px; border-radius: var(--r-md); }
.table td .thumb { display: block; }
.table td .thumb.empty { display: grid; }
.art-cell { display: flex; align-items: center; gap: 12px; }

/* ---------- Dialoge ---------- */
dialog.modal { border: 0; border-radius: var(--r-lg); padding: 0; width: min(620px, calc(100vw - 20px)); max-height: calc(100vh - 24px); color: var(--text); background: var(--surface); box-shadow: var(--shadow-lg); }
dialog.modal.wide { width: min(980px, calc(100vw - 20px)); }
dialog.modal::backdrop { background: rgba(17, 24, 39, .45); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-body { padding: 24px; }
.modal-body h3 { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.modal-body h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.pos-list { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.pos { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); background: var(--surface-2); }
.pos .form-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.pos .field { margin-bottom: var(--sp-2); }
.pos-head { display: flex; gap: var(--sp-2); align-items: end; }
.pos-head .field { flex: 1; }
.sum { display: grid; gap: 4px; margin: var(--sp-3) 0; padding: var(--sp-3) var(--sp-4); background: var(--accent-bg); border-radius: var(--r-md); }
.sum div { display: flex; justify-content: space-between; gap: 10px; }
.hinweis { margin: 0 0 var(--sp-3); padding: 10px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); }
.hinweis.orange { background: var(--orange-bg); color: #92400e; }
.details { border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 14px; margin: 6px 0 var(--sp-3); background: var(--surface-2); }
.details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.details[open] summary { margin-bottom: 10px; }
.neg { color: var(--red); font-weight: 650; }
.pos-gewinn { color: var(--accent-dark); font-weight: 650; }

.toasts { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 300; display: grid; gap: var(--sp-2); width: min(460px, calc(100vw - 24px)); }
.toast { padding: 12px 16px; border-radius: var(--r-md); color: #fff; box-shadow: var(--shadow-lg); font-weight: 500; }
.toast.ok { background: var(--accent-dark); }
.toast.err { background: var(--red); }

/* Artikelauswahl mit Bild */
.picker { position: relative; }
.picker-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg); max-height: 340px; overflow: auto; }
.picker-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; }
.picker-item:hover { background: var(--accent-bg); }
.picker-item .muted { font-size: var(--fs-sm); }
.picker-empty { padding: 12px 14px; color: var(--muted); }

/* Diagramme */
.chart-row { display: grid; gap: var(--sp-5); grid-template-columns: 1fr; margin-bottom: var(--sp-5); }
.chart-row .card { margin: 0; }
.chart-box { position: relative; height: 300px; }
@media (min-width: 1100px) { .chart-row { grid-template-columns: 3fr 2fr; } }
.dash-cols { display: grid; gap: var(--sp-5); grid-template-columns: 1fr; align-items: start; }
.dash-cols > div > .table-card { margin-bottom: 0; }
@media (min-width: 1300px) { .dash-cols.zwei { grid-template-columns: 1fr 1fr; } }

/* Handy: Tabellenzeilen als Karten */
@media (max-width: 640px) {
  :root { --fs-h1: 23px; --fs-kpi: 26px; }
  .main { padding: var(--sp-3); }
  .card { padding: 16px; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .table.cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 3px 0; text-align: right; }
  .table.cards td.num { text-align: right; }
  .table.cards td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-xs); text-align: left; flex: none; }
  .table.cards td[data-label=""] { justify-content: flex-start; }
  .table.cards td[data-label=""]::before, .table.cards td.empty::before { content: none; }
  .table.cards td.empty { display: block; text-align: center; }
  .stat { min-height: 96px; }
}


/* ---------- Artikel: Kategorie- und Produktkacheln ---------- */
.back-arrow { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); flex: none; }
.back-arrow:hover { background: var(--surface-2); text-decoration: none; }
.back-arrow svg, .kat-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.page-head .back-arrow + h1 { flex: 1; }
.kat-grid { display: grid; gap: var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); max-width: 900px; }
.kat-tile { display: flex; flex-direction: column; gap: 6px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); transition: transform .15s, box-shadow .15s, border-color .15s; }
.kat-tile:hover { text-decoration: none; transform: translateY(-2px); border-color: #bbf7d0; box-shadow: 0 8px 28px rgba(22, 163, 74, .12); }
.kat-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent-dark); margin-bottom: 10px; }
.kat-ico svg { width: 26px; height: 26px; }
.kat-name { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.kat-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: var(--fs-sm); }
.kat-go { margin-top: 12px; color: var(--accent-dark); font-weight: 600; font-size: var(--fs-sm); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); flex: none; }
.seg-btn { border: 0; border-radius: 0; min-height: calc(var(--control-h) - 2px); background: transparent; color: var(--muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line-strong); }
.seg-btn.active { background: var(--accent-bg); color: var(--accent-dark); }
.seg-btn:hover:not(:disabled):not(.active) { background: var(--surface-2); }
.art-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-bottom: var(--sp-5); }
.art-tile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; color: var(--text); transition: transform .15s, box-shadow .15s, border-color .15s; }
.art-tile:hover { text-decoration: none; transform: translateY(-2px); border-color: #bbf7d0; box-shadow: 0 8px 24px rgba(17, 24, 39, .10); }
.art-img { position: relative; aspect-ratio: 1 / 1; background: #fff; border-bottom: 1px solid var(--line); overflow: hidden; }
.art-img .thumb, .art-img .thumb.big { position: absolute; inset: 18px; width: calc(100% - 36px); height: calc(100% - 36px); min-width: 0; min-height: 0; max-width: none; border: 0; border-radius: var(--r-sm); object-fit: contain; object-position: center; background: transparent; }
.art-body { padding: 14px 16px 16px; display: grid; gap: 6px; }
.art-name { font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.art-nr { color: var(--muted); font-size: var(--fs-xs); }
.art-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); }
.art-prices { display: block; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); }
.art-prices > div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 5px 0; }
.art-prices > div + div { border-top: 1px dashed var(--line); }
.art-prices .k { color: var(--muted); font-size: 13px; white-space: nowrap; }
.art-prices .v { font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
@media (max-width: 640px) { .art-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); } .art-body { padding: 10px 12px 12px; } .kat-tile { padding: 20px; } }

/* ===== Rechnung (Vorschau und Druck) ===== */
.inv-overlay { position: fixed; inset: 0; z-index: 200; background: #e9ebf0; display: flex; flex-direction: column; }
.inv-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.inv-hilfe { padding: 6px 14px; font-size: .8rem; color: var(--muted); }
.inv-scroll { flex: 1; overflow: auto; padding: 12px; }
.inv { background: #fff; width: 210mm; max-width: none; min-height: 297mm; margin: 0 auto; padding: 16mm 18mm 22mm; box-shadow: 0 2px 16px rgba(0,0,0,.15); position: relative; color: #1b2330; font-size: 10.5pt; box-sizing: border-box; }
.inv-head { display: grid; grid-template-columns: 24mm 1fr auto; gap: 6mm; align-items: start; }
.inv-logo { width: 24mm; height: 24mm; border-radius: 3mm; object-fit: cover; }
.inv-firma { font-size: 9.5pt; color: #5b6472; line-height: 1.5; }
.inv-firma strong { display: block; color: #1b2330; font-size: 11.5pt; margin-bottom: 1mm; }
.inv-titel { text-align: right; }
.inv-rechnung { font-size: 22pt; font-weight: 800; letter-spacing: .5pt; }
.inv-nr { font-weight: 700; font-size: 13pt; margin: 1mm 0 2mm; }
.inv-klein { font-size: 9pt; color: #5b6472; }
.inv-status { margin-top: 3mm; font-size: 9pt; font-weight: 800; letter-spacing: .4pt; }
.inv-status.bezahlt { color: #167a43; }
.inv-status.offen { color: #c26a00; }
.inv-strich { width: 12mm; height: .8mm; background: #f08a1c; margin: 7mm 0 5mm; }
.inv-label { font-size: 8pt; font-weight: 800; color: #5b6472; letter-spacing: .5pt; margin: 6mm 0 2mm; }
.inv-adresse { line-height: 1.5; margin-bottom: 9mm; }
.inv-tabelle { width: 100%; border-collapse: collapse; margin-top: 4mm; }
.inv-tabelle th { background: #1f2733; color: #fff; font-size: 8pt; letter-spacing: .4pt; text-align: left; padding: 3.2mm 4mm; }
.inv-tabelle th:first-child { border-radius: 3mm 0 0 3mm; }
.inv-tabelle th:last-child { border-radius: 0 3mm 3mm 0; }
.inv-tabelle td { padding: 3.6mm 4mm; vertical-align: top; }
.inv-tabelle .r { text-align: right; white-space: nowrap; }
.inv-tabelle .b { font-weight: 700; }
.inv-tabelle tr { break-inside: avoid; }
.inv-summe { display: flex; justify-content: space-between; gap: 10mm; width: 85mm; margin: 7mm 0 0 auto; padding-top: 3mm; border-top: .3mm solid #d8dce3; font-size: 12pt; }
.inv-summe strong { font-size: 14pt; }
.inv-gruen { color: #167a43; }
.inv-orange { color: #c26a00; }
.inv-hinweis { margin-top: 6mm; }
.inv-fuss { position: absolute; left: 18mm; right: 18mm; bottom: 10mm; font-size: 8pt; color: #7a8290; }
@media (max-width: 900px) { .inv { transform-origin: top left; zoom: .45; } }
@media print {
  @page { size: A4; margin: 0; }
  body > *:not(#invoice-print) { display: none !important; }
  html, body { background: #fff !important; }
  .inv-overlay { position: static; background: #fff; display: block; }
  .inv-bar, .inv-hilfe { display: none !important; }
  .inv-scroll { overflow: visible; padding: 0; }
  .inv { box-shadow: none; margin: 0; zoom: 1 !important; width: 210mm; }
  .inv-tabelle th, .inv-status, .inv-strich { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Artikelliste: Bezeichnung in zwei Zeilen */
.name2 .n1 { font-weight: 500; color: var(--text); }
.name2 .n2 { font-size: 12.5px; color: var(--muted, #6b7280); margin-top: 1px; }
.row-actions{display:flex;gap:6px;justify-content:flex-end}
