/* ==========================================================================
   regisafe Angebotskonfigurator - Ultra-Modern Enterprise Design System
   Typography: Plus Jakarta Sans & JetBrains Mono
   ========================================================================== */

:root {
  /* Surface & Neutral Scale */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --sunk: #f1f5f9;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  /* Brand Accent: Official regisafe Blue (#23AFE6) */
  --accent: #23afe6;
  --accent-hover: #199fd4;
  --accent-ink: #ffffff;
  --accent-soft: #f0faff;
  --accent-border: #bae6fd;
  --accent-glow: rgba(35, 175, 230, 0.22);

  /* Semantic Feedback Colors */
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --ok-ink: #065f46;
  --ok-border: #a7f3d0;

  --warn: #d97706;
  --warn-soft: #fffbeb;
  --warn-ink: #92400e;
  --warn-border: #fde68a;

  --err: #dc2626;
  --err-soft: #fef2f2;
  --err-ink: #991b1b;
  --err-border: #fecaca;

  /* Typography */
  --f-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Radii */
  --r-sm: 6px;
  --r: 8px;
  --r-md: 12px;
  --r-lg: 14px;
  --r-pill: 9999px;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090e17;
    --surface: #111a28;
    --surface-raised: #182335;
    --sunk: #162030;
    --ink: #f1f5f9;
    --ink-secondary: #cbd5e1;
    --muted: #889bb0;
    --line: #202e42;
    --line-strong: #2d3f57;

    --accent: #23afe6;
    --accent-hover: #56c7f1;
    --accent-ink: #052636;
    --accent-soft: #08293d;
    --accent-border: #14557b;
    --accent-glow: rgba(35, 175, 230, 0.25);

    --ok: #34d399;
    --ok-soft: #064e3b;
    --ok-ink: #a7f3d0;
    --ok-border: #065f46;

    --warn: #fbbf24;
    --warn-soft: #451a03;
    --warn-ink: #fde68a;
    --warn-border: #78350f;

    --err: #f87171;
    --err-soft: #450a0a;
    --err-ink: #fecaca;
    --err-border: #7f1d1d;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #090e17;
  --surface: #111a28;
  --surface-raised: #182335;
  --sunk: #162030;
  --ink: #f1f5f9;
  --ink-secondary: #cbd5e1;
  --muted: #889bb0;
  --line: #202e42;
  --line-strong: #2d3f57;

  --accent: #23afe6;
  --accent-hover: #56c7f1;
  --accent-ink: #052636;
  --accent-soft: #08293d;
  --accent-border: #14557b;
  --accent-glow: rgba(35, 175, 230, 0.25);
  color-scheme: dark;
}

/* Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mono {
  font-family: var(--f-mono);
  font-size: .88em;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ==========================================================================
   Header & Brand Navigation
   ========================================================================== */

header.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) header.top {
    background: rgba(17, 26, 40, 0.88);
  }
}
:root[data-theme="dark"] header.top {
  background: rgba(17, 26, 40, 0.88);
}

.topin {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding-block: 10px;
}

/* Modern Brand Logo Pill */
.brand {
  margin-right: auto;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-img {
  height: 30px;
  width: auto;
  object-fit: contain;
  display: block;
  transition: transform 0.2s ease;
}

.brand-logo-img:hover {
  transform: scale(1.02);
}

.brand-divider {
  width: 1.5px;
  height: 24px;
  background: var(--line-strong);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-version {
  background: rgba(35, 175, 230, 0.12);
  color: #0b8ec2;
  font-size: 11px;
  padding: 2.5px 9px;
  border-radius: var(--r-pill);
  font-weight: 700;
  border: 1px solid rgba(35, 175, 230, 0.35);
  white-space: nowrap;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 450;
}

/* Modern Segmented Tabs */
.tabs {
  display: flex;
  gap: 3px;
  background: var(--sunk);
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}

.tabs button {
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 13px var(--f-body);
  padding: 7px 16px;
  border-radius: var(--r);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.tabs button:hover:not([aria-selected="true"]) {
  color: var(--ink);
}

.tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  color: var(--ink-secondary);
  font-weight: 500;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.role-icon {
  font-size: 12px;
}

.role-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-badge select {
  border: 0;
  background: none;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: 12.5px;
  outline: none;
}

.db-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ok);
  font-weight: 600;
  background: var(--ok-soft);
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ok-border);
}

.db-indicator::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

.db-indicator.err {
  color: var(--err-ink);
  background: var(--err-soft);
  border-color: var(--err-border);
}

.db-indicator.err::before {
  background: var(--err);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

/* ==========================================================================
   Main Layout & Stepper Timeline
   ========================================================================== */

main {
  max-width: 1280px;
  margin: 0 auto;
  padding-block: 28px 80px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.wrap {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* Modern Stepper Container */
nav.steps {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  padding: 14px 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* Stepper Progress Bar */
.stepper-progress {
  padding: 2px 6px 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.stepper-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stepper-progress-track {
  height: 4px;
  background: var(--sunk);
  border-radius: 9999px;
  overflow: hidden;
}

.stepper-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #23afe6, #67d2f9);
  border-radius: 9999px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Timeline connected list */
.steps-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.steps-list::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: linear-gradient(180deg, #23afe6 0%, var(--line) 100%);
  z-index: 1;
}

/* ONLY direct buttons inside steps-list */
nav.steps > button,
.steps-list > button {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 13px var(--f-body);
  padding: 8px 10px;
  border-radius: var(--r);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  z-index: 2;
  width: 100%;
}

nav.steps > button:hover,
.steps-list > button:hover {
  background: var(--sunk);
  color: var(--ink);
}

nav.steps > button.cur,
.steps-list > button.cur {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 750;
  color: var(--muted);
  background: var(--surface);
  position: relative;
  z-index: 3;
  transition: all 0.15s ease;
}

nav.steps > button.cur .dot,
.steps-list > button.cur .dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.dot.ok {
  background: var(--ok);
  border-color: var(--ok);
  color: #ffffff;
  font-size: 11px;
}

.dot.err {
  border-color: var(--err);
  color: var(--err);
  background: var(--err-soft);
}

.cnt {
  font-size: 10.5px;
  font-weight: 700;
  border-radius: var(--r-pill);
  padding: 2px 7px;
  line-height: 1.2;
}

.cnt.err {
  background: var(--err-soft);
  color: var(--err-ink);
  border: 1px solid var(--err-border);
}

.cnt.warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
  border: 1px solid var(--warn-border);
}

/* Nav Footer - Sleek Mini-Dashboard */
.navfoot {
  margin-top: 14px;
  padding: 14px 2px 2px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Nav Rabatt Schnell-Einstellung */
.nav-rabatt-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.nav-rabatt-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-rabatt-label-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.nav-rabatt-icon {
  font-size: 14px;
}

.nav-rabatt-current {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.nav-rabatt-pct {
  font-size: 14px;
  font-family: var(--f-mono);
  font-weight: 750;
  color: #107c41;
}

.nav-rabatt-savings {
  font-size: 11px;
  font-family: var(--f-mono);
  color: var(--ok-ink);
  font-weight: 600;
}

.nav-rabatt-ctrl-row {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  gap: 6px;
  align-items: center;
}

.nav-rabatt-btn {
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--r-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.nav-rabatt-btn:hover:not(:disabled) {
  border-color: #107c41;
  color: #107c41;
  background: #f0fdf4;
}

.nav-rabatt-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.nav-rabatt-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-rabatt-input {
  width: 100%;
  height: 28px;
  padding: 2px 22px 2px 8px;
  text-align: center;
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 13.5px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
}

.nav-rabatt-input:focus {
  outline: none;
  border-color: #107c41;
  box-shadow: 0 0 0 2px rgba(16, 124, 65, 0.2);
  background: #ffffff;
}

.nav-rabatt-unit {
  position: absolute;
  right: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.nav-rabatt-pills {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.nav-rabatt-pill {
  flex: 1 1 0;
  min-width: 22px;
  padding: 3px 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--sunk);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: all 0.12s ease;
}

.nav-rabatt-pill:hover {
  border-color: #107c41;
  color: #107c41;
  background: #f0fdf4;
}

.nav-rabatt-pill.active {
  background: #107c41;
  color: #ffffff;
  border-color: #0c6434;
  font-weight: 700;
}

.nav-rabatt-hint {
  font-size: 10.5px;
  line-height: 1.3;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.nav-rabatt-hint.warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
  border: 1px solid var(--warn-border);
}

.nav-rabatt-hint.err {
  background: var(--err-soft);
  color: var(--err-ink);
  border: 1px solid var(--err-border);
}

.navsum {
  background: linear-gradient(180deg, var(--surface) 0%, var(--sunk) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: var(--shadow-sm);
}

.navsum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
}

.navsum-row b {
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.navsum-row.rabatt b {
  color: var(--ok);
}

.nav-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: var(--r);
  font-weight: 600;
  line-height: 1.25;
}

.nav-status-pill.pending {
  background: var(--warn-soft);
  color: var(--warn-ink);
  border: 1px solid var(--warn-border);
}

.nav-status-pill.ready {
  background: var(--ok-soft);
  color: var(--ok-ink);
  border: 1px solid var(--ok-border);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-status-pill.pending .status-dot {
  background: var(--warn);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.25);
}

.nav-status-pill.ready .status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.25);
}

.navfoot-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.navfoot-actions .btn {
  width: 100%;
  font-size: 11.5px;
  padding: 7px 8px;
  justify-content: center;
  white-space: nowrap;
}

/* ==========================================================================
   Content Cards & Typography
   ========================================================================== */

h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  color: var(--ink);
  text-wrap: balance;
}

.lead {
  color: var(--muted);
  font-size: 14.5px;
  margin: 0 0 22px;
  max-width: 74ch;
  line-height: 1.6;
}

section.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

section.card>h2 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 16px;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 8px;
}

section.card>h2::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px 20px;
}

.fld {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.fld.w2 {
  grid-column: span 2;
}

.fld.full {
  grid-column: 1 / -1;
}

.fld>label, .fld>.lbl {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.req::after {
  content: " *";
  color: var(--err);
  font-weight: 700;
}

.help {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

/* Modern Form Controls */
input[type=text],
input[type=email],
input[type=tel],
input[type=number],
input[type=date],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  padding: 9px 12px;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

input:hover, select:hover, textarea:hover {
  border-color: var(--line-strong);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
  resize: vertical;
  min-height: 76px;
}

/* Radio & Checkbox Card Options (Segmented Choice Cards) */
.opts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.opts label.opt {
  flex: 1 1 200px;
}

label.opt {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 16px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

label.opt:hover {
  background: var(--bg);
  border-color: var(--line-strong);
}

label.opt:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

input[type=radio], input[type=checkbox] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  margin: 0;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ==========================================================================
   Module Catalog Styles (High-End Feature Cards)
   ========================================================================== */

.items {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}

.grp {
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--sunk);
  padding: 11px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.items > .grp:first-child {
  border-top: 0;
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 18px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.grp + .item {
  border-top: 0;
}

.item:hover {
  background: #f8fafc;
}

.item.on {
  background: var(--accent-soft);
  box-shadow: inset 4px 0 0 var(--accent);
}

.item .chk {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.4;
}

.item .chk input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 4px;
}

/* Price Pill on Right */
.price {
  font-family: var(--f-mono);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  text-align: right;
  line-height: 1.25;
  background: var(--sunk);
  padding: 6px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  align-self: start;
  transition: all 0.15s ease;
}

.item.on .price {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0369a1;
  box-shadow: 0 1px 2px rgba(14, 116, 144, 0.08);
}

.price small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--f-body);
  font-weight: 450;
  margin-top: 2px;
}

.meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 30px;
  font-size: 12px;
}

.tag {
  border-radius: var(--r-pill);
  padding: 3px 10px;
  background: var(--sunk);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}

.tag.need {
  background: var(--err-soft);
  color: var(--err-ink);
  border: 1px solid var(--err-border);
}

.tag.met {
  background: var(--ok-soft);
  color: var(--ok-ink);
  border: 1px solid var(--ok-border);
}

.tag.rec {
  background: var(--warn-soft);
  color: var(--warn-ink);
  border: 1px solid var(--warn-border);
}

.tag.gw {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.note {
  grid-column: 1 / -1;
  padding-left: 30px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.art {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  align-self: start;
  padding-top: 3px;
}

/* Sub-inputs when module is active */
.sub {
  grid-column: 1 / -1;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-md);
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: flex-end;
  box-shadow: var(--shadow-sm);
}

.sub .fld {
  min-width: 140px;
  flex: 0 1 180px;
  max-width: 240px;
}

.sub .fld input[type="number"],
.sub .fld select {
  padding: 7px 12px;
  font-size: 13.5px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.sub .fld.inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  max-width: none;
  flex: 0 1 auto;
}

.miss input,
.miss select,
.miss textarea {
  border-color: var(--err) !important;
  box-shadow: 0 0 0 3px var(--err-soft) !important;
}

/* ==========================================================================
   Buttons & Interactive Elements
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: 600 13.5px var(--f-body);
  padding: 8px 16px;
  border-radius: var(--r);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--sunk);
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn.sm {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: var(--r-sm);
}

.btn.pri {
  background: linear-gradient(135deg, #23afe6 0%, #159cd0 100%);
  border-color: #199fd4;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(35, 175, 230, 0.35);
  font-weight: 700;
}

.btn.pri:hover {
  background: linear-gradient(135deg, #1ba6dd 0%, #0e8ec1 100%);
  border-color: #0e8ec1;
  box-shadow: 0 4px 12px rgba(35, 175, 230, 0.45);
}

.btn.pdf {
  background: linear-gradient(180deg, #be123c 0%, #9f1239 100%);
  color: #ffffff;
  border-color: #9f1239;
  box-shadow: 0 1px 3px rgba(190, 18, 60, 0.25);
}

.btn.pdf:hover {
  background: linear-gradient(180deg, #9f1239 0%, #881337 100%);
  box-shadow: 0 4px 8px -1px rgba(190, 18, 60, 0.35);
}

.btn.excel {
  background: linear-gradient(180deg, #107c41 0%, #0c6434 100%);
  color: #ffffff;
  border-color: #0c6434;
  box-shadow: 0 1px 3px rgba(16, 124, 65, 0.25);
  font-weight: 650;
}

.btn.excel:hover {
  background: linear-gradient(180deg, #0d6e39 0%, #084f29 100%);
  border-color: #084f29;
  box-shadow: 0 4px 10px rgba(16, 124, 65, 0.35);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  box-shadow: none;
}

.btn.ghost:hover {
  background: var(--sunk);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn.demo-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
  font-weight: 600;
}

.btn.demo-btn:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Tables, Lists & KPI Dashboard Cards
   ========================================================================== */

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--sunk);
  font-weight: 700;
}

tr.gh td {
  background: var(--sunk);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

td.q {
  text-align: right;
  white-space: nowrap;
}

td.h {
  color: var(--muted);
  font-size: 12.5px;
}

td.e {
  text-align: right;
  white-space: nowrap;
  font-family: var(--f-mono);
  font-size: 13px;
}

/* Modern Dashboard Stat Cards */
.sumgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Top Gradient Lines on KPI Cards */
.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #23afe6, #7dd3fc);
}

.sumgrid .kpi:nth-child(2)::before {
  background: linear-gradient(90deg, #6366f1, #a855f7);
}

.sumgrid .kpi:nth-child(3)::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.kpi:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.kpi span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.kpi b {
  display: block;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  margin-top: 4px;
}

/* Financial Sum List */
.sum {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 20px;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.sum .r {
  text-align: right;
  font-family: var(--f-mono);
  font-size: 13.5px;
}

.sum .tot {
  font-weight: 750;
  font-size: 15px;
  border-top: 1.5px solid var(--line);
  padding-top: 8px;
  color: var(--ink);
}

.sum .neg {
  color: var(--err);
}

.sum .muted {
  color: var(--muted);
  font-size: 13px;
}

/* ==========================================================================
   Badges, Chips & Statuses
   ========================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--r-pill);
  padding: 3px 10px;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.st-Neu {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.st-In {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.st-Angebot {
  background: #d1fae5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.st-Zur {
  background: #ffe4e6;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.st-Frei {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Issues & Banners */
.iss {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r);
  font-size: 13.5px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.iss.err {
  background: var(--err-soft);
  color: var(--err-ink);
  border-color: var(--err-border);
}

.iss.warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
  border-color: var(--warn-border);
}

.banner {
  border-radius: var(--r);
  padding: 13px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  font-size: 13.5px;
  margin-bottom: 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* ==========================================================================
   Inbox & Row Cards
   ========================================================================== */

.inbox {
  display: grid;
  grid-template-columns: minmax(0, 390px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.row:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.row.cur {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.row .r1 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.row .r2 {
  font-size: 12.5px;
  color: var(--muted);
}

.empty {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: 36px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  background: var(--surface);
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: #0f172a;
  color: #f8fafc;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: toastIn 0.2s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   TCO- & Diff-Cards
   ========================================================================== */

.tco-container {
  margin-top: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--accent-border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.tco-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 960px) {
  .tco-grid {
    grid-template-columns: 1fr;
  }
}

.tco-col {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.tco-col.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow);
  background: var(--surface);
}

.tco-col h3 {
  font-size: 15px;
  margin: 0 0 4px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tco-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.tco-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
  font-size: 13.5px;
}

.tco-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 5px;
}

.tco-row.total {
  border-bottom: 0;
  border-top: 1.5px solid var(--line);
  padding-top: 7px;
  font-weight: 700;
  font-size: 14.5px;
}

.tco-row.tco5 {
  font-weight: 750;
  color: var(--accent);
  font-size: 15px;
}

/* Diff & Versioning View */
.diff-container {
  background: var(--sunk);
  border-radius: var(--r);
  padding: 16px;
  margin-top: 14px;
  font-size: 13.5px;
  border: 1px solid var(--line);
}

.diff-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.diff-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
}

.diff-kpi span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
}

.diff-kpi b {
  display: block;
  font-size: 14.5px;
  margin-top: 3px;
}

.diff-pos-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.diff-tag-add {
  color: var(--ok-ink);
  background: var(--ok-soft);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-weight: 600;
  border: 1px solid var(--ok-border);
}

.diff-tag-del {
  color: var(--err-ink);
  background: var(--err-soft);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-weight: 600;
  text-decoration: line-through;
  border: 1px solid var(--err-border);
}

/* ==========================================================================
   Responsive & Print
   ========================================================================== */

@media (max-width: 860px) {
  .wrap, .inbox {
    grid-template-columns: minmax(0, 1fr);
  }
  nav.steps {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 6px;
  }
  .steps-list::before {
    display: none;
  }
  nav.steps > button,
  .steps-list > button {
    grid-template-columns: 20px auto auto;
    white-space: nowrap;
  }
  .navfoot {
    display: none;
  }
  .fld.w2 {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Print Styles */
@media print {
  header.top, nav.steps, .bar, .tabs, .navfoot, .toast, .role-badge, .db-indicator {
    display: none !important;
  }
  body, main, #app {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .wrap {
    display: block !important;
  }
  section.card {
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 20px !important;
  }
}

/* ==========================================================================
   Catalog Toolbar, Live Search & Filters
   ========================================================================== */
.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
}

.catalog-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 280px;
  position: relative;
}

.catalog-search-icon {
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

.catalog-search-input {
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--sunk);
  padding: 8px 30px 8px 12px;
  border-radius: var(--r);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  transition: all 0.15s ease;
}

.catalog-search-input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

.catalog-search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 50%;
}

.catalog-search-clear:hover {
  color: var(--ink);
  background: var(--line);
}

.catalog-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.catalog-filter-btn {
  background: var(--sunk);
  border: 1px solid var(--line);
  color: var(--muted);
  font: 600 12px var(--f-body);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.catalog-filter-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.catalog-filter-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #0b8ec2;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(35, 175, 230, 0.15);
}

.catalog-filter-btn.warn.active {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--warn-ink);
}

.catalog-empty {
  text-align: center;
  padding: 36px 20px;
  background: var(--surface);
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  margin-bottom: 20px;
  color: var(--muted);
}

.catalog-empty-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.7;
}

.catalog-empty p {
  margin: 0 0 14px;
  font-size: 14px;
}

/* ==========================================================================
   Smart Dependency Auto-Fix & Jump
   ========================================================================== */
.auto-fix-banner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fde68a;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.auto-fix-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auto-fix-title {
  font-size: 14.5px;
  font-weight: 750;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 6px;
}

.auto-fix-desc {
  font-size: 13px;
  color: #78350f;
}

.auto-fix-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.auto-fix-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--r-sm);
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.auto-fix-item-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink);
}

.auto-fix-step-badge {
  font-size: 11px;
  padding: 1.5px 7px;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 600;
}

.auto-fix-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auto-fix-single-btn {
  font-size: 12px !important;
  padding: 5px 10px !important;
}

.auto-fix-goto-btn {
  font-size: 12px !important;
  padding: 5px 10px !important;
}

.auto-fix-actions-all {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid rgba(245, 158, 11, 0.25);
  padding-top: 10px;
}

.auto-fix-btn {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
  color: #ffffff !important;
  border-color: #b45309 !important;
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.3) !important;
  font-weight: 700;
  font-size: 12.5px;
  padding: 7px 14px;
}

.auto-fix-btn:hover {
  background: linear-gradient(135deg, #b45309 0%, #92400e 100%) !important;
}

.tag-fix-btn {
  margin-left: 6px;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.25;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tag-fix-btn.add {
  border: 1px solid #0284c7;
  background: #f0f9ff;
  color: #0369a1;
}

.tag-fix-btn.add:hover {
  background: #0284c7;
  color: #ffffff;
}

.tag-fix-btn.goto {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.tag-fix-btn.goto:hover {
  border-color: #23afe6;
  color: #23afe6;
  background: #f0f9ff;
}

.tag-fix-btn.rec {
  border-color: var(--warn-border);
  color: var(--warn-ink);
  background: var(--warn-soft);
}

.tag-fix-btn.rec:hover {
  background: var(--warn);
  color: #ffffff;
}

/* Pulsierender Fokus beim Hineinspringen */
@keyframes itemPulseHighlight {
  0% {
    box-shadow: 0 0 0 0 rgba(35, 175, 230, 0.7);
    border-color: #23afe6;
    transform: scale(1.015);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(35, 175, 230, 0.25);
    border-color: #23afe6;
    transform: scale(1.015);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(35, 175, 230, 0);
    border-color: var(--line);
    transform: scale(1);
  }
}

.item-pulse-highlight {
  animation: itemPulseHighlight 1.4s ease-in-out 2 !important;
  border-color: #23afe6 !important;
  background: #f0f9ff !important;
}

.iss-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 6px;
}

/* Keyboard Shortcut Hint */
.kbd-hint {
  display: inline-block;
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  padding: 1.5px 6px;
  border-radius: 4px;
  margin-left: 8px;
  font-family: var(--f-mono);
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.35);
  letter-spacing: -0.02em;
}

/* ==========================================================================
   PDF Quick-Preview Modal Overlay
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeInBackdrop 0.15s ease-out;
}

.modal-backdrop[hidden] {
  display: none !important;
}

@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-window {
  width: min(1040px, 95vw);
  height: 88vh;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--ink);
}

.modal-title b {
  font-weight: 750;
  letter-spacing: -0.02em;
}

.modal-icon {
  font-size: 18px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  flex: 1 1 0;
  position: relative;
  background: #525659;
  overflow: hidden;
}

.pdf-modal-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.modal-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  z-index: 10;
}

.modal-loading[hidden] {
  display: none !important;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Excel Export Choice Modal
   ========================================================================== */
.excel-modal-window {
  width: min(680px, 95vw);
  height: auto;
  max-height: 88vh;
}

.excel-modal-body {
  flex: 1 1 auto;
  max-height: calc(88vh - 70px);
  background: var(--bg);
  padding: 22px 24px;
  overflow-y: auto;
}

.excel-modal-intro {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
}

.excel-choice-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.excel-choice-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 18px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
  width: 100%;
}

.excel-choice-card:hover {
  border-color: #107c41;
  background: #f0fdf4;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(16, 124, 65, 0.14);
}

.excel-choice-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.excel-choice-icon.primary {
  background: linear-gradient(135deg, #107c41 0%, #0c6434 100%);
  color: #ffffff;
  border-color: #0c6434;
  box-shadow: 0 3px 8px rgba(16, 124, 65, 0.28);
}

.excel-choice-content {
  flex: 1 1 0;
  min-width: 0;
}

.excel-choice-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.excel-choice-title b {
  font-size: 14.5px;
  font-weight: 750;
  color: var(--ink);
}

.excel-choice-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.excel-choice-tag.neutral {
  background: var(--sunk);
  color: var(--muted);
  border-color: var(--line);
}

.excel-choice-desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

.excel-choice-desc strong {
  color: var(--ink);
}

.excel-choice-arrow {
  font-size: 20px;
  opacity: 0.6;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.excel-choice-card:hover .excel-choice-arrow {
  opacity: 1;
  transform: translateX(3px) scale(1.1);
}


/* ==========================================================================
   Admin & Catalog Management (Preise, Produkte & Abhängigkeiten)
   ========================================================================== */
.admin-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  min-height: 80vh;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.admin-header-title-wrap {
  flex: 1 1 540px;
}

.admin-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  margin-bottom: 10px;
}

.admin-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.admin-main-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.admin-lead {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  max-width: 740px;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* KPI Stats Grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.admin-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.admin-stat-card:hover {
  border-color: var(--line-strong);
}

.admin-stat-card.highlight {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.admin-stat-icon {
  font-size: 26px;
  line-height: 1;
}

.admin-stat-info {
  display: flex;
  flex-direction: column;
}

.admin-stat-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
}

.admin-stat-lbl {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

/* Toolbar & Filterleiste */
.admin-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 520px;
}

.admin-search-icon {
  position: absolute;
  left: 14px;
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
  z-index: 2;
}

input.admin-search-input,
.admin-search-wrap input {
  width: 100%;
  padding: 9px 36px 9px 40px !important;
  font-size: 13.5px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.admin-clear-search {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

.admin-clear-search:hover {
  color: var(--ink);
}

.admin-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-tab-btn {
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-tab-btn:hover {
  background: var(--sunk);
  border-color: var(--line-strong);
}

.admin-tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 6px var(--accent-glow);
}

.admin-tab-btn.highlight:not(.active) {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Produkttabelle */
.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.admin-table th {
  background: var(--sunk);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}

.admin-row {
  transition: background 0.12s ease;
}

.admin-row:hover {
  background: rgba(35, 175, 230, 0.04);
}

.admin-row.is-custom {
  background: rgba(16, 185, 129, 0.04);
}

.admin-row.is-modified {
  background: rgba(245, 158, 11, 0.04);
}

.admin-col-num {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  width: 32px;
}

.admin-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-status-badge.standard {
  background: var(--sunk);
  color: var(--muted);
  border: 1px solid var(--line);
}

.admin-status-badge.modified {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.admin-status-badge.custom {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.admin-col-art {
  width: 110px;
}

.admin-art-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  background: var(--sunk);
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--ink);
}

.admin-col-name {
  min-width: 220px;
}

.admin-col-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 3px;
  max-width: 400px;
}

.admin-grp-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--sunk);
  color: var(--ink-secondary);
  white-space: nowrap;
}

/* Preis-Eingabe in Tabellenzeile */
.admin-col-price {
  min-width: 130px;
}

.admin-price-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.admin-price-input {
  width: 95px;
  padding: 6px 20px 6px 8px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, monospace;
  text-align: right;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: all 0.15s;
}

.admin-price-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.admin-price-input.changed {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}

.admin-price-currency {
  position: absolute;
  right: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
}

.admin-price-orig {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.admin-col-unit {
  min-width: 120px;
}

.admin-unit-select {
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

/* Abhängigkeiten Spalte */
.admin-col-deps {
  min-width: 170px;
}

.admin-deps-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.admin-dep-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.2;
}

.admin-dep-chip.req {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.admin-dep-chip.rec {
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #bae6fd;
}

.admin-dep-remove {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 2px;
  font-size: 10px;
  font-weight: 800;
  border-radius: 2px;
}

.admin-dep-remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.admin-add-dep-btn {
  background: none;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.admin-add-dep-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.admin-add-dep-btn.rec:hover {
  border-color: #0284c7;
  color: #0284c7;
  background: #f0f9ff;
}

.admin-actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.admin-empty-table {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* Admin Modal Window & Chips Selector */
.admin-modal-window {
  width: min(840px, 95vw);
  height: auto;
  max-height: 90vh;
}

.admin-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: calc(90vh - 120px);
}

.admin-chips-selector {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--bg);
  max-height: 140px;
  overflow-y: auto;
}

.admin-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
}

.admin-chip-toggle:hover {
  border-color: var(--line-strong);
  background: var(--sunk);
}

.admin-chip-toggle.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.admin-chip-toggle input {
  margin: 0;
  cursor: pointer;
}

/* Dark Mode Overrides for Status & Chips */
:root[data-theme="dark"] .admin-status-badge.modified,
:root:not([data-theme="light"]) .admin-status-badge.modified {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

:root[data-theme="dark"] .admin-status-badge.custom,
:root:not([data-theme="light"]) .admin-status-badge.custom {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

:root[data-theme="dark"] .admin-dep-chip.req,
:root:not([data-theme="light"]) .admin-dep-chip.req {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

:root[data-theme="dark"] .admin-dep-chip.rec,
:root:not([data-theme="light"]) .admin-dep-chip.rec {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border-color: rgba(14, 165, 233, 0.4);
}

:root[data-theme="dark"] .admin-price-input.changed,
:root:not([data-theme="light"]) .admin-price-input.changed {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  color: #fef3c7;
}
