/* =====================================================================
   Niqua Warenwirtschaft – Design-System
   Abgeleitet aus dms.niquagroup.com (base.css / dms.css), Stand 11/2026.
   Nur CSS – kein JavaScript.
   ===================================================================== */

:root {
  --accent: #263F8C;
  --accent-2: #223059;
  --accent-ink: #FFFFFF;
  --accent-soft: #E2E8F6;

  --side: #223059;
  --side-2: #2C3C6E;
  --side-accent: #5CD7F2;
  --side-ink: #DCE3F2;
  --side-muted: #93A0C2;

  --bg: #F3F5FA;
  --surface: #FFFFFF;
  --surface-2: #ECEFF6;
  --surface-3: #DFE4EF;
  --ink: #0F1A33;
  --muted: #56607A;
  --faint: #8A93AA;
  --line: #DFE4EE;

  --ok: #14915A;      --ok-soft: #DCF5E7;
  --warn: #B07A2E;    --warn-soft: #F8EBD8;
  --bad: #D23A2A;     --bad-soft: #FDE3DF;
  --info: #0099A8;    --info-soft: #DDF3F5;

  --brand-cyan: #5CD7F2;
  --brand-tuerkis: #0099A8;
  --brand-sand: #D9A86C;

  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "SF Pro Display", Roboto, "Helvetica Neue", Arial, sans-serif;

  --r: 18px;
  --r-sm: 12px;
  --r-input: 11px;
  --r-btn: 9px;
  --shadow-sm: 0 1px 2px rgba(15,26,51,.05);
  --shadow: 0 1px 2px rgba(15,26,51,.04), 0 8px 24px -6px rgba(15,26,51,.09);
  --shadow-lg: 0 24px 60px -12px rgba(15,26,51,.3);

  --sidebar-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
a { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Anmeldung (zweigeteilt wie DMS) ---------- */
.login { display: grid; grid-template-columns: minmax(320px, 44%) 1fr; min-height: 100vh; }
.login__brand {
  position: relative; overflow: hidden;
  background: var(--side); color: #fff;
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.login__brand::after {
  content: ""; position: absolute; left: -12%; bottom: -30%;
  width: 90%; aspect-ratio: 1; border-radius: 50%;
  border: 56px solid rgba(255,255,255,.05);
}
.brand-mark { font-family: var(--font-display); line-height: 1; position: relative; z-index: 1; }
.brand-mark__name { font-size: 34px; font-weight: 600; letter-spacing: .02em; }
.brand-mark__name sup { font-size: 11px; }
.brand-mark__group { font-size: 17px; letter-spacing: .62em; margin-top: 10px; font-weight: 400; }
.brand-mark__product { margin-top: 12px; font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--side-accent); display: flex; align-items: center; gap: 8px; }
.brand-mark__product::before { content: ""; width: 22px; height: 2px; background: var(--side-accent); }
.login__clock { position: relative; z-index: 1; }
.login__time { font-family: var(--font-display); font-size: 52px; font-weight: 300; letter-spacing: -.02em; }
.login__date { color: var(--side-muted); font-size: 13px; }
.login__claim { position: relative; z-index: 1; font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1.15; }
.login__claim span { display: block; color: var(--side-accent); }

.login__form-wrap { display: flex; align-items: center; justify-content: center; padding: 48px 24px; position: relative; }
.login__form { width: 100%; max-width: 330px; }
.login__eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--accent-2); text-transform: uppercase; }
.login__form h1 { margin: 6px 0 4px; }
.login__hint { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.lang-switch { position: absolute; top: 24px; right: 24px; display: flex; gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.lang-switch button { border: 0; background: transparent; font: 600 12px var(--font); color: var(--muted); padding: 5px 9px; border-radius: 7px; cursor: pointer; }
.lang-switch button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.login__foot { color: var(--muted); font-size: 12px; margin-top: 16px; }
.login__links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: 600 12.5px var(--font); cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }
.input--code { font: 600 22px ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .3em; text-align: center; }

/* ---------- Zwei-Faktor-Einrichtung ---------- */
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 18px; }
.steps li { display: flex; flex-direction: column; gap: 6px; }
.qr { background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; width: max-content; margin: 6px 0; }
.qr img { display: block; }
code.secret { font: 600 14px ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; width: max-content; max-width: 100%; word-break: break-all; }
.confirm-row { display: flex; gap: 8px; align-items: center; max-width: 340px; }
.recovery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.recovery-grid code { font: 600 15px ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; text-align: center; letter-spacing: .08em; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field small { color: var(--muted); font-size: 12px; }
.input, select.input, textarea.input {
  width: 100%; font: 500 14px var(--font); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-input);
  padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { background: var(--surface-2); color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: span 2; }

/* ---------- Schaltflächen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 13.5px var(--font); border-radius: var(--r-btn); padding: 9px 16px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-2); }
.btn--danger { color: var(--bad); }
.btn--danger:hover { background: var(--bad-soft); border-color: var(--bad-soft); }
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn--block { width: 100%; padding: 12px 16px; border-radius: var(--r-sm); font-size: 14px; }
.btn--sm { padding: 5px 10px; font-size: 12.5px; }

/* ---------- Hinweise ---------- */
.alert { border-radius: var(--r-sm); padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; }
.alert--bad { background: var(--bad-soft); color: #8E2419; }
.alert--ok { background: var(--ok-soft); color: #0D6640; }
.alert--warn { background: var(--warn-soft); color: #7A531D; }
.alert--info { background: var(--info-soft); color: #006B76; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; border-radius: 99px; padding: 2px 9px; background: var(--surface-2); color: var(--muted); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--bad { background: var(--bad-soft); color: var(--bad); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--info { background: var(--accent-soft); color: var(--accent); }

/* ---------- Anwendungsrahmen ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand-mark { padding: 4px 10px 22px; }
.sidebar .brand-mark__name { font-size: 24px; }
.sidebar .brand-mark__group { font-size: 12px; margin-top: 6px; }
.sidebar .brand-mark__product { font-size: 9.5px; margin-top: 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav__section { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); padding: 16px 10px 6px; }
.nav a, .nav__soon {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px;
  color: var(--side-ink); text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav a:hover { background: var(--side-2); }
.nav a.active { background: var(--side-2); color: #fff; box-shadow: inset 3px 0 0 var(--side-accent); }
.nav a.active svg { color: var(--side-accent); }
.nav__soon { color: var(--side-muted); cursor: default; }
.nav__soon em { margin-left: auto; font-style: normal; font-size: 10px; border: 1px solid var(--side-2); border-radius: 99px; padding: 0 7px; }
.sidebar__user { border-top: 1px solid var(--side-2); padding: 14px 6px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-tuerkis); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.sidebar__user-name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.sidebar__user a, .sidebar__user button { font-size: 12px; color: var(--side-muted); background: none; border: 0; padding: 0; cursor: pointer; font-family: var(--font); text-decoration: none; }
.sidebar__user a:hover, .sidebar__user button:hover { color: var(--side-accent); }

.main { min-width: 0; padding: 28px 36px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); border: 1px solid transparent; }
a.tile:hover { border-color: var(--accent-soft); }
.tile__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile__title { font-weight: 650; }
.tile__text { color: var(--muted); font-size: 13px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table tbody tr:hover { background: #F8F9FC; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .muted, .muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.table td.mono, .table .badge { white-space: nowrap; }
/* Eingabetabellen (Ansprechpartner, Bank, SEPA): Felder nicht zusammenquetschen – lieber waagerecht blättern */
.table--form td > .input:not([style]) { min-width: 130px; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--muted); }

/* ---------- Dialog (reines HTML/CSS, ohne JavaScript) ---------- */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(15,26,51,.45); display: grid; place-items: center; padding: 24px; z-index: 50; }
.dialog { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.dialog--wide { max-width: 760px; }
.dialog__head { padding: 20px 24px 8px; display: flex; justify-content: space-between; align-items: center; }
.dialog__body { padding: 12px 24px; overflow-y: auto; }
.dialog__foot { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }

.perm-group { margin-bottom: 14px; }
.perm-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; }

pre.changes { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 12px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; max-width: 520px; }

/* ---------- Responsiv (Tablet / Lager-Handy) ---------- */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login__brand { padding: 28px 24px; min-height: auto; gap: 18px; }
  .login__claim, .login__clock { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav__section { width: 100%; padding-top: 8px; }
  .main { padding: 20px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

/* ---------- Stammdaten: Reiter, zweispaltige Bearbeitung, Rechner ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; flex-wrap: wrap; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab--active { color: var(--accent); border-bottom-color: var(--accent); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.split > .card + .card { margin-top: 0; }
.split > * { min-width: 0; } /* breite Tabellen blättern in ihrer Karte statt die Seite zu verbreitern */
.sticky { position: sticky; top: 20px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 10px; }
.section-title:first-child { margin-top: 0; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.result-big { font-size: 26px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.hint-list { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.clickable { cursor: pointer; }
.row--active td { background: var(--accent-soft); }
.row--deleted td { background: var(--bad-soft); opacity: .6; text-decoration: line-through; }
.input--num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } .form-grid--3, .form-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* ---------- Mandantenwahl in der Seitenleiste ---------- */
.mandant-switch { margin: -10px 4px 14px; padding: 8px 10px; border-radius: 10px; background: var(--side-2); color: #fff; font-size: 12.5px; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.mandant-switch__select { width: 100%; background: transparent; color: #fff; border: 0; font: inherit; cursor: pointer; padding: 0; }
.mandant-switch__select option { color: var(--ink); }
.mandant-switch__none { color: var(--side-muted); font-weight: 500; }
.mandant-switch__error { color: #FFB4A8; font-weight: 500; }

/* Verkauf: Positionstabelle */
.pos-table td { vertical-align: top; }
.pos-table .input { padding: 5px 8px; }
.input--xs { width: 96px; min-width: 0; }
.input--manuell { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Scanner (Portal-Look: Packplatz, Kommissionierung) – Handscanner/Tablet, nur Tastatur ---------- */
.scan-shell { min-height: 100%; background: var(--bg); }
.scan-top { background: var(--side); color: #fff; display: flex; align-items: center; gap: 22px; padding: 0 20px; min-height: 58px; flex-wrap: wrap; }
.scan-brand { font-weight: 800; letter-spacing: .08em; font-size: 17px; white-space: nowrap; }
.scan-brand span { color: var(--side-accent); font-weight: 500; margin: 0 6px; }
.scan-tabs { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.scan-tab { color: var(--side-ink); text-decoration: none; padding: 18px 14px 16px; font-weight: 600; font-size: 15px; border-bottom: 3px solid transparent; }
.scan-tab:hover { color: #fff; }
.scan-tab.active { color: #fff; border-bottom-color: var(--brand-sand); }
.scan-tab--aus { opacity: .45; cursor: default; }
.scan-geraet { color: var(--side-muted); font-size: 13px; white-space: nowrap; }
.scan-main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.scan-main h1 { font-size: 26px; margin: 0 0 14px; }
.scan-card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.scan-input { width: 100%; font-size: 20px; padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--r-input); font-family: inherit; }
.scan-input:focus { outline: none; border-color: var(--accent); }
.scan-row { display: flex; gap: 10px; align-items: center; }
.scan-row .scan-input { flex: 1; }
.btn--gold { background: var(--brand-sand); border-color: var(--brand-sand); color: var(--ink); font-weight: 700; }
.btn--gold:hover { filter: brightness(.95); }
.btn--outline-bad { background: #fff; border: 2px solid var(--bad); color: var(--bad); }
.dialog--gold { border-top: 5px solid var(--brand-sand); }
.treffer { list-style: none; margin: 0; padding: 0; }
.treffer li { padding: 10px 14px; border-left: 4px solid transparent; border-bottom: 1px solid var(--line); cursor: pointer; }
.treffer li:hover { background: var(--surface-2); }
.treffer li.gewaehlt { border-left-color: var(--brand-sand); background: var(--accent-soft); }
.pack-kopf { background: var(--side); color: #fff; border-radius: var(--r); padding: 16px 20px; margin-bottom: 16px; display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; }
.pack-kopf .grau { color: var(--side-muted); }
.pack-kopf .badge { background: var(--brand-sand); color: var(--ink); }
.pack-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; align-items: start; }
.pack-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pack-table th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); }
.pack-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pack-table td.num, .pack-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pack-table tr.offen td { background: #FBE3E6; }
.pack-table tr.teil td { background: #FBF1D6; }
.pack-table tr.voll td { background: #DCF5E7; }
.pack-table tr.aktiv td { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
.pack-table td.edit { background: #fff !important; }
.pack-table td.edit input { width: 90px; text-align: right; font-weight: 700; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; }
.pack-table .art { font-family: ui-monospace, Consolas, monospace; font-weight: 700; }
.pack-table .bez small { display: block; color: var(--muted); }
@media (max-width: 1100px) { .pack-grid { grid-template-columns: 1fr; } }
.ampel { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }
.ampel--gruen { background: var(--ok); } .ampel--gelb { background: #E0B000; } .ampel--rot { background: var(--bad); } .ampel--grau { background: var(--faint); }
