:root {
  --bg: #e8ecf1;
  --panel: #f7f9fb;
  --ink: #1a1f26;
  --muted: #6b7582;
  --line: #d0d6de;
  --accent: #e87a2e;
  --accent-soft: #f09a55;
  --accent-ink: #1a1f26;
  --accent-2: #c5ced8;
  --accent-rgb: 232, 122, 46;
  --danger: #b33a2b;
  --ok: #2f6b4a;
  --warn: #c47a2a;
  --sidebar: #1a1f26;
  --sidebar-mid: #252b34;
  --sidebar-ink: #f2f4f6;
  --sidebar-rgb: 26, 31, 38;
  --bg-rgb: 232, 236, 241;
  --silver: #c5ced8;
  --steel: #8b97a5;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(26, 31, 38, 0.07);
  --font: "Manrope", "Segoe UI", "Helvetica Neue", sans-serif;
  --sidebar-width: 260px;
  --topbar-height: 56px;
  --main-topbar-height: 52px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  /* Anker-Sprünge unter der fixen Kopfzeile freistellen */
  scroll-padding-top: calc(var(--main-topbar-height) + 1.25rem);
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
}

.app-shell-viewer {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell-viewer .main-topbar {
  left: 0;
}

.role-fieldset {
  border: 1px solid var(--border, #d8dee6);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.role-fieldset legend {
  padding: 0 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.theme-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 1rem;
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.75rem;
  max-width: 640px;
  width: 100%;
}

.theme-fieldset legend {
  padding: 0 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem 1.25rem;
}

.theme-color {
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.theme-color-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.theme-color-input {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  height: 44px;
  padding: 0 !important;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  overflow: hidden;
}

.theme-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.theme-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

.theme-color-input::-moz-color-swatch {
  border: none;
  border-radius: 6px;
}

.theme-hex {
  flex: 1 1 auto;
  width: auto !important;
  min-width: 7.5rem;
  max-width: none;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.mail-fieldset .mail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem 1rem;
}

.mail-enable {
  margin: 0.25rem 0 0.15rem;
}

.mail-test-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin-top: 0.35rem;
}

.mail-test-to {
  flex: 1 1 200px;
  min-width: 180px;
}

.smtp-test-log {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.smtp-test-log.is-ok {
  border-color: #b7d8be;
  background: #f3faf4;
}

.smtp-test-log.is-fail {
  border-color: #e2b8b1;
  background: #fdf6f4;
}

.smtp-test-log ol {
  margin: 0.55rem 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
}

.smtp-test-log li {
  font-size: 0.88rem;
}

.smtp-test-log li.fail .smtp-step {
  color: var(--danger);
}

.smtp-test-log .smtp-step {
  font-weight: 600;
  margin-right: 0.35rem;
}

.smtp-test-log code {
  display: inline;
  word-break: break-word;
  font-size: 0.84em;
  color: var(--muted);
}

.topbar { display: none; }

.topbar-logout {
  margin-left: 0.25rem;
  flex-shrink: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow: hidden;
}

.brand { display: flex; gap: 0.75rem; align-items: center; }
.brand strong {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand small { opacity: 0.75; }
.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.brand-text strong {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-text small {
  display: block;
  opacity: 0.75;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #f4f6f8 0%, #c8d0d9 45%, #a8b3c0 100%);
  color: #2a313a;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.18);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar nav a {
  color: var(--sidebar-ink);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  opacity: 0.85;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: rgba(var(--accent-rgb), 0.12);
  opacity: 1;
  text-decoration: none;
}

.sidebar nav a.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-foot {
  display: none;
}

.linkish {
  background: none; border: 0; color: var(--accent-soft); cursor: pointer; padding: 0; font: inherit;
}

.nav-backdrop {
  display: none;
}

.main {
  padding: calc(var(--main-topbar-height) + 1.25rem) 2rem 3rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.main-topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 30;
  height: var(--main-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 2rem;
  background: var(--accent);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 10px rgba(var(--accent-rgb), 0.12);
}

.main-topbar-stats {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  min-width: 0;
  overflow: hidden;
}

.stats-reload {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: -0.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-ink) 12%, transparent);
  color: var(--accent-ink);
  cursor: pointer;
}

.stats-reload:hover {
  background: color-mix(in srgb, var(--accent-ink) 22%, transparent);
}

.stats-reload:active {
  transform: rotate(-45deg);
}

.stats-reload.is-loading svg {
  animation: stats-reload-spin 0.7s linear infinite;
}

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

.main-topbar-stat {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  color: var(--accent-ink);
  white-space: nowrap;
}

.main-topbar-stat strong {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.main-topbar-stat span {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.main-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
  margin-left: auto;
}

.main-topbar-user {
  color: var(--accent-ink);
  font-size: 0.92rem;
  font-weight: 600;
  max-width: min(28vw, 220px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-topbar-logout {
  margin: 0;
}

.main-topbar-logout .btn {
  white-space: nowrap;
  background: color-mix(in srgb, var(--accent-ink) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent-ink) 28%, transparent);
  color: var(--accent-ink);
  font-weight: 600;
}

.main-topbar-logout .btn:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
  color: var(--accent);
  text-decoration: none;
}

.page-content {
  min-width: 0;
  max-width: 100%;
}

.page-header h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.page-help {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.page-help:hover {
  opacity: 1;
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-ink, #fff);
  border-color: var(--accent);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.panel-head h2 { margin: 0; font-size: 1.1rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.stat-card span { color: var(--muted); font-size: 0.9rem; }
.stat-card strong { display: block; font-size: 1.8rem; margin-top: 0.25rem; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

th, td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.th-sort:hover { color: var(--ink); text-decoration: none; }
.th-sort.is-active { color: var(--ink); }

.sort-arrows {
  display: inline-flex;
  flex-direction: column;
  line-height: 0.65;
  font-size: 0.55rem;
  opacity: 0.35;
  gap: 0.05rem;
}
.th-sort:hover .sort-arrows { opacity: 0.55; }
.th-sort.is-active .sort-arrows { opacity: 0.9; }
.th-sort.is-asc .sort-up,
.th-sort.is-desc .sort-down { color: var(--accent); opacity: 1; }
.th-sort.is-asc .sort-down,
.th-sort.is-desc .sort-up { opacity: 0.25; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; border-color: var(--steel); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(0.96); }
.btn-danger { background: #f8e9e6; border-color: #e2b8b1; color: var(--danger); }
.btn-small { padding: 0.35rem 0.65rem; font-size: 0.85rem; }

.filters,
.row-form,
.actions-bar,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filters { margin-bottom: 1rem; }
.filters > * { min-width: 0; }

.import-status-filters .check {
  margin: 0;
  gap: 0.35rem;
}
.import-status-filters .badge {
  cursor: pointer;
}

/* Buttons auf Höhe der Date-Inputs, nicht der Labels „Von/Bis“ */
.filters > .btn,
.filters > a.btn {
  align-self: flex-end;
}

.filters-thirds {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.5rem;
  align-items: stretch;
  width: 100%;
}

.filters-thirds .filter-field {
  width: 100%;
}

.filters-thirds .btn {
  white-space: nowrap;
  align-self: stretch;
}

@media (max-width: 960px) {
  .filters-thirds {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filters-thirds .btn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

.filter-date {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.filter-date input[type="date"] {
  min-width: 9.5rem;
}

/* Hilfe */
.help-doc {
  max-width: none;
  width: 100%;
}

.help-toc {
  margin-bottom: 1.5rem;
  padding: 1rem 1.15rem;
  background: #f3f5f7;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.help-toc ol {
  margin: 0.55rem 0 0;
  padding-left: 1.2rem;
}

.help-toc a {
  text-decoration: none;
}

.help-toc a:hover {
  text-decoration: underline;
}

.help-section {
  margin-bottom: 1.75rem;
  padding: 0.65rem 0.75rem 1.25rem;
  margin-left: -0.75rem;
  margin-right: -0.75rem;
  border-bottom: 1px solid var(--line);
  border-radius: 10px;
  scroll-margin-top: calc(var(--main-topbar-height) + 1.25rem);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.help-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0.65rem;
}

.help-section h2 {
  margin: 0 0 0.65rem;
  font-size: 1.25rem;
}

.help-section.is-help-flash,
.help-section:target {
  animation: help-section-flash 2.8s ease-out;
}

@keyframes help-section-flash {
  0% {
    background: rgba(var(--accent-rgb), 0.18);
    box-shadow: inset 3px 0 0 var(--accent);
  }
  35% {
    background: rgba(var(--accent-rgb), 0.12);
    box-shadow: inset 3px 0 0 var(--accent);
  }
  100% {
    background: transparent;
    box-shadow: inset 3px 0 0 transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .help-section.is-help-flash,
  .help-section:target {
    animation: none;
    background: rgba(var(--accent-rgb), 0.1);
    box-shadow: inset 3px 0 0 var(--accent);
  }
}

.help-section h3 {
  margin: 1rem 0 0.45rem;
  font-size: 1.05rem;
}

.help-section p,
.help-section ul {
  margin: 0 0 0.75rem;
  line-height: 1.55;
}

.help-section ul {
  padding-left: 1.2rem;
}

.help-section li {
  margin-bottom: 0.35rem;
}

.help-section code {
  font-size: 0.88em;
}

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack.narrow { max-width: 420px; }

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

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1rem;
}

label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.92rem; }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: #fff;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
}
.inline-form { display: inline; }

.edit-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
}

.edit-grid-row {
  display: grid;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.edit-grid-suppliers .edit-grid-row {
  grid-template-columns: minmax(120px, 0.8fr) minmax(160px, 1.4fr) 90px auto;
}

.edit-grid-users .edit-grid-row {
  grid-template-columns: minmax(120px, 0.9fr) minmax(160px, 1.2fr) 90px minmax(150px, 1fr) auto;
}

.edit-grid-attributes .edit-grid-row {
  grid-template-columns: minmax(110px, 0.8fr) minmax(140px, 1.2fr) 110px 90px auto;
}

.edit-grid-head {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
  margin: 0;
}

.edit-grid-header { margin-bottom: 0.15rem; }

.edit-grid-row > input,
.edit-grid-row > select {
  width: 100%;
  min-width: 0;
}

.edit-grid-row > .check {
  margin: 0;
  white-space: nowrap;
}

.edit-grid-row > .btn,
.edit-grid-row > .actions {
  justify-self: start;
}

.edit-grid-empty { margin: 0.25rem 0 0; }

.muted { color: var(--muted); }

.alert {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid;
  word-break: break-word;
}

.alert-success { background: #e8f4ea; border-color: #b7d8be; color: var(--ok); }
.alert-error { background: #f8e9e6; border-color: #e2b8b1; color: var(--danger); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: #e8ecf1;
  color: var(--muted);
}

.badge-active, .badge-success { background: #e5f0ea; color: var(--ok); }
.badge-inactive, .badge-failed { background: #f8e9e6; color: var(--danger); }
.badge-partial, .badge-running { background: #f7ebe0; color: var(--warn); }
.badge-skipped { background: #e8ecf1; color: var(--muted); }
.badge-retention-daily { background: #e8eef6; color: #2f4f7a; }
.badge-retention-weekly { background: #ebe8f4; color: #4a3f6b; }
.badge-retention-monthly { background: #e8f3ef; color: #2d5c4a; }

.billing-box {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--panel-soft, #eef2f6);
  border-radius: 8px;
}
.billing-lines {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}
.billing-lines li { margin: 0.15rem 0; }

.cell-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* API-Nutzung: Zeitraum */
.usage-period-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.usage-period-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem;
  background: var(--panel-soft, #eef2f6);
  border-radius: 10px;
  width: fit-content;
}
.usage-period-tab {
  margin: 0;
  cursor: pointer;
}
.usage-period-tab input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.usage-period-tab span {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}
.usage-period-tab input:checked + span {
  background: var(--panel, #fff);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.usage-period-tab input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.usage-period-pickers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}
.usage-period-pickers .usage-picker {
  margin: 0;
  min-width: 12rem;
}
.usage-period-pickers .usage-picker[hidden] {
  display: none !important;
}

/* API-Preislisten bearbeiten */
.price-list-edit {
  max-width: none;
  width: 100%;
}
.price-list-meta {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) minmax(12rem, 1fr) auto auto;
  gap: 0.65rem 0.85rem;
  align-items: end;
}
.price-list-meta-active {
  align-self: center;
  margin-bottom: 0.35rem;
}
.price-list-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.version-nav {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.version-nav-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border, #d5dce4);
  text-decoration: none;
  color: inherit;
  background: var(--panel, #fff);
}
.version-nav-item:hover {
  border-color: var(--accent);
}
.version-nav-item.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, white);
}
.version-nav-from {
  font-weight: 700;
}
.version-nav-fee {
  font-size: 0.85rem;
  color: var(--muted);
}
.version-create {
  border-top: 1px solid var(--border, #d5dce4);
  padding-top: 0.75rem;
}
.version-create summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.price-version-basics {
  display: grid;
  grid-template-columns: repeat(2, minmax(10rem, 14rem));
  gap: 0.75rem;
}
.tier-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.tier-block h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.tier-block .table-wrap {
  overflow: visible;
  margin: 0;
  padding: 0;
}
.tier-table {
  table-layout: fixed;
}
.tier-table th:nth-child(1),
.tier-table td:nth-child(1),
.tier-table th:nth-child(2),
.tier-table td:nth-child(2) {
  width: 28%;
}
.tier-table th:nth-child(3),
.tier-table td:nth-child(3) {
  width: 44%;
}
.tier-table input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .price-list-meta {
    grid-template-columns: 1fr;
  }
  .price-list-layout,
  .tier-columns {
    grid-template-columns: 1fr;
  }
  .price-version-basics {
    grid-template-columns: 1fr;
  }
}

.thumb {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #eee;
}

.thumb.placeholder {
  display: inline-grid;
  place-items: center;
  color: var(--muted);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem;
}

.image-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.image-thumb {
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.image-thumb:hover,
.image-thumb:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(26, 31, 38, 0.16);
  outline: 2px solid var(--accent, #e87a2e);
  outline-offset: 2px;
}

.image-thumb img {
  display: block;
  pointer-events: none;
}

/* Bild-Lightbox */
.lightbox {
  border: 0;
  padding: 0;
  max-width: min(96vw, 1100px);
  max-height: 94vh;
  width: 100%;
  background: transparent;
  color: #fff;
}

.lightbox::backdrop {
  background: rgba(12, 15, 20, 0.82);
  backdrop-filter: blur(4px);
}

.lightbox-inner {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 0.5rem 0.75rem;
}

.lightbox-stage {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 0.65rem;
}

.lightbox-stage img {
  max-width: min(88vw, 1000px);
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  background: #111;
}

.lightbox-caption {
  font-size: 0.9rem;
  color: rgba(232, 236, 240, 0.85);
  letter-spacing: 0.04em;
}

.lightbox-close,
.lightbox-nav {
  appearance: none;
  border: 0;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(var(--accent-rgb), 0.9);
}

.lightbox-close {
  position: absolute;
  top: 0;
  right: 0.25rem;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.6rem;
  line-height: 1;
  z-index: 2;
}

.lightbox-nav {
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.25rem;
  display: grid;
  place-items: center;
}

.lightbox-nav[hidden] {
  visibility: hidden;
}

tr.row-focus {
  outline: 2px solid var(--accent, #e87a2e);
  outline-offset: -2px;
  background: rgba(var(--accent-rgb), 0.1);
  animation: focus-pulse 1.4s ease-out 1;
}

tr.row-filtered {
  opacity: 0.65;
}

@keyframes focus-pulse {
  0% { box-shadow: inset 0 0 0 0 rgba(var(--accent-rgb), 0.45); }
  100% { box-shadow: inset 0 0 0 12px rgba(var(--accent-rgb), 0); }
}

@media (max-width: 700px) {
  .lightbox-inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    justify-items: center;
  }

  .lightbox-nav {
    position: static;
  }

  .lightbox-stage img {
    max-height: 62vh;
  }
}

.kv {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 0.45rem 1rem;
  margin: 0;
}

.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.pagination {
  display: flex;
  gap: 0.35rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.pagination a {
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}

.pagination a.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}

.small-code {
  display: inline-block;
  max-width: min(420px, 70vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-raw .small-code {
  display: block;
  max-width: 100%;
  max-height: 7.5rem;
  overflow: auto;
  white-space: pre-wrap;
  background: #eef1f5;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  text-overflow: unset;
}

.wa-raw-details {
  margin: 0;
}
.wa-raw-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.wa-config-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  flex: 0 0 auto;
  margin-bottom: 0.85rem;
}
.wa-config-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.wa-config-toolbar input {
  min-width: 8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  background: #fff;
}
.wa-qty input { width: 6.5rem; min-width: 0; }
.wa-filter { flex: 1; min-width: 12rem; }
.wa-filter input { width: 100%; }
.wa-config-hint {
  margin: 0 0 0.35rem;
  white-space: nowrap;
}

.wa-tier-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  flex: 1 1 12rem;
  min-width: 0;
}
.wa-tier-label {
  font-size: 0.8rem;
  margin-right: 0.1rem;
}
.wa-tier-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  line-height: 1.2;
}
.wa-tier-chip:hover {
  border-color: var(--steel);
}
.wa-tier-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.wa-config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  gap: 1rem;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.wa-option-pane {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f8fa;
  overflow: hidden;
}

.wa-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 0.55rem;
  padding: 0.75rem;
  overflow: auto;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
}

.wa-option-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.45rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: 0 1px 2px rgba(18, 22, 28, 0.04);
}
.wa-option-card:hover { border-color: var(--steel); }
.wa-option-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.wa-option-thumb {
  height: 72px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  flex: 0 0 auto;
}
.wa-option-thumb img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.wa-option-thumb.is-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

.wa-option-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.wa-option-body strong {
  font-size: 0.8rem;
  line-height: 1.25;
}
.wa-option-body .muted {
  font-size: 0.74rem;
}
.wa-option-code {
  font-size: 0.7rem;
  color: var(--steel);
  font-family: ui-monospace, monospace;
}

.wa-preview {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}
.wa-preview-visual {
  height: 120px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  flex: 0 0 auto;
}
.wa-preview-visual img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.wa-preview-placeholder { padding: 1rem; text-align: center; }
.wa-preview-title {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  line-height: 1.3;
}
.wa-preview-meta {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  line-height: 1.35;
}
.wa-price-sheet {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
}
.wa-price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 0.9rem;
}
.wa-price-label {
  color: var(--muted);
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
}
.wa-price-hint {
  color: var(--steel);
  font-size: 0.78rem;
  font-weight: 500;
}
.wa-price-hint:empty {
  display: none;
}
.wa-price-row > strong {
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  justify-self: end;
}
.wa-price-row.wa-price-grand {
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}
.wa-price-row.wa-price-grand .wa-price-label,
.wa-price-row.wa-price-grand > strong {
  color: var(--ink);
  font-weight: 700;
  font-size: 1.02rem;
}
.wa-unit-total {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  text-align: right;
}
.wa-preview .small { font-size: 0.78rem; margin: 0.7rem 0 0; line-height: 1.35; }

.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.wa-modal {
  border: none;
  padding: 0;
  max-width: min(1180px, calc(100vw - 1.25rem));
  width: 100%;
  height: min(860px, calc(100vh - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  background: transparent;
  overflow: hidden;
}
.wa-modal::backdrop {
  background: rgba(18, 22, 28, 0.58);
}
.wa-modal-inner {
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(18, 22, 28, 0.28);
  height: 100%;
  max-height: inherit;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wa-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
}
.wa-modal-titles {
  min-width: 0;
}
.wa-modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
}
.wa-modal-head .muted {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}
.wa-modal-close {
  appearance: none;
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 2px rgba(18, 22, 28, 0.06);
}
.wa-modal-close:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #1a1410;
}
.wa-modal-body {
  padding: 0.9rem 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.wa-modal-loading,
.wa-modal-error {
  padding: 2.5rem 1.15rem;
  text-align: center;
  flex: 1 1 auto;
}
.wa-modal-foot-note {
  margin: 0.7rem 0 0;
  flex: 0 0 auto;
}

@media (max-width: 960px) {
  .wa-modal {
    height: calc(100vh - 1rem);
    max-height: calc(100vh - 1rem);
  }
  .wa-config-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .wa-option-pane {
    min-height: 280px;
    max-height: 42vh;
  }
  .wa-preview {
    overflow: visible;
  }
}

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--sidebar);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.auth-brand { margin-bottom: 1.25rem; }

.api-tester-docs {
  margin-bottom: 1.25rem;
}

.api-tester-split {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.code-block {
  margin: 0;
  padding: 0.85rem 1rem;
  background: #1a1f26;
  color: #e8edf2;
  border-radius: 8px;
  overflow: auto;
  font-size: 0.86rem;
  line-height: 1.45;
  max-width: 100%;
  border: 1px solid rgba(197, 206, 216, 0.12);
}

.code-block code {
  font-family: ui-monospace, Consolas, monospace;
  color: inherit;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-meta { margin-bottom: 0.5rem; }
.break-all { word-break: break-all; white-space: pre-wrap; }
.response-block { max-height: 480px; min-height: 140px; }
.small-note { margin: 0.75rem 0 0; font-size: 0.9rem; }

.mapping-table td {
  vertical-align: top;
}

.mapping-table .mapping-target-cell {
  min-width: 18rem;
  vertical-align: top;
}

.mapping-target-ui .target-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: flex-start;
}

/* display:flex überschreibt sonst das native [hidden] */
.mapping-target-ui .target-panel[hidden] {
  display: none !important;
}

.mapping-target-ui .target-product-select,
.mapping-target-ui .target-wa-select,
.mapping-target-ui .target-attribute-input {
  min-width: 14rem;
  width: 100%;
}

.price-builder .price-field,
.image-sort-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.price-builder .price-field-label,
.image-sort-wrap .price-field-label {
  font-weight: 500;
  line-height: 1.2;
}

.price-builder .price-kind,
.price-builder .price-currency {
  min-width: 8.5rem;
}

.price-builder .price-n,
.image-sort-wrap .target-image-sort {
  width: 5.5rem;
}

.price-builder .price-currency-wrap[hidden] {
  display: none !important;
}

.mapping-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  max-width: 22rem;
}

.mapping-hint[hidden] {
  display: none !important;
}

.mapping-actions {
  margin-top: 1rem;
  gap: 0.75rem;
}


.api-key-cell { min-width: 0; }
.api-key-full { display: inline-block; max-width: 100%; word-break: break-all; }

.reveal-details { margin-top: 0.4rem; }
.reveal-details > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
}
.reveal-details > summary::-webkit-details-marker { display: none; }

.reveal-form {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1f5;
  max-width: 100%;
}

.key-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #ffffff;
  min-width: 0;
}

.key-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.whitelist-box {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.whitelist-box h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.access-box {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.access-box h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.access-section {
  margin-bottom: 1rem;
}

.access-section > strong {
  display: block;
  margin-bottom: 0.25rem;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.35rem 0.75rem;
  margin: 0.5rem 0;
}

.segment-mode {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin: 0.75rem 0 0;
  background: #f7f8fa;
}

.segment-mode legend {
  padding: 0 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.segment-mode .check {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0.35rem 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.rules-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem;
  background: #fafbfc;
}

.rules-table {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.2fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.rule-summary {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.rule-summary li {
  background: #eef1f5;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  font-size: 0.9rem;
}

.ip-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0.75rem;
}

.ip-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid #e4e8ee;
}

.inline-add-ip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.inline-add-ip input,
.inline-add-ip select {
  flex: 1 1 140px;
  min-width: 0;
}

.stacked-actions {
  flex-direction: column;
  align-items: stretch;
}

/* ===== Mobile ===== */
@media (max-width: 980px) {
  html {
    scroll-padding-top: calc(var(--topbar-height) + 0.85rem);
  }

  .help-section {
    scroll-margin-top: calc(var(--topbar-height) + 0.85rem);
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-height) auto;
  }

  .topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-height);
    padding: 0 0.85rem;
    background: var(--sidebar);
    color: var(--sidebar-ink);
    box-shadow: 0 2px 10px rgba(0,0,0,0.14);
  }

  .topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex: 1;
    min-width: 0;
  }

  .topbar-brand strong,
  .topbar-brand .brand-text strong {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  .topbar-brand .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 0.85rem;
  }

  .topbar-user {
    font-size: 0.82rem;
    opacity: 0.85;
    max-width: 28vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-toggle {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
  }

  .nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--accent-soft);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  body.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  body.nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
  }
  body.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 24, 20, 0.55);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(var(--sidebar-width), 86vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 12px 0 40px rgba(0,0,0,0.25);
    padding-top: max(1.25rem, env(safe-area-inset-top));
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .main {
    padding: 1rem 0.9rem 2.5rem;
    grid-column: 1;
  }

  .main-topbar {
    display: none;
  }

  .sidebar-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.12);
  }

  .panel {
    padding: 0.9rem;
    border-radius: 12px;
  }

  .stats-grid,
  .split,
  .detail-grid,
  .api-tester-split,
  .param-grid {
    grid-template-columns: 1fr;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 0.15rem 0;
  }

  .kv dt {
    margin-top: 0.55rem;
    font-size: 0.82rem;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filters .btn {
    width: 100%;
  }

  .filters-thirds {
    grid-template-columns: 1fr;
  }

  .filters-thirds .btn {
    width: 100%;
  }

  .actions-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-bar .btn {
    width: 100%;
  }

  .edit-grid-suppliers .edit-grid-row,
  .edit-grid-users .edit-grid-row,
  .edit-grid-attributes .edit-grid-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
  }

  .edit-grid-header {
    display: none;
  }

  .edit-grid-row > .btn,
  .edit-grid-row > .actions {
    width: 100%;
  }

  .edit-grid-row > .btn {
    justify-self: stretch;
  }

  .key-card-head {
    flex-direction: column;
  }

  .key-card-head .actions {
    width: 100%;
  }

  .key-card-head .actions .btn {
    flex: 1;
  }

  .form-grid,
  .rule-row {
    grid-template-columns: 1fr;
  }

  .inline-add-ip {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-add-ip .btn {
    width: 100%;
  }

  .stacked-actions .btn,
  .stacked-actions select {
    width: 100%;
  }

  /* Artikel-Tabelle: auf Mobile als Karten */
  .table-wrap table.responsive-cards {
    min-width: 0;
  }

  table.responsive-cards thead {
    display: none;
  }

  table.responsive-cards,
  table.responsive-cards tbody,
  table.responsive-cards tr,
  table.responsive-cards td {
    display: block;
    width: 100%;
  }

  table.responsive-cards tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: #ffffff;
  }

  table.responsive-cards td {
    border: 0;
    padding: 0.25rem 0;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
  }

  table.responsive-cards td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    flex-shrink: 0;
  }

  table.responsive-cards td:last-child {
    margin-top: 0.4rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--line);
  }

  table.responsive-cards td:last-child::before {
    display: none;
  }

  table.responsive-cards .thumb {
    margin-left: auto;
  }

  table.responsive-cards tr.empty-row {
    background: transparent;
    border: 0;
    padding: 0.5rem 0;
  }

  table.responsive-cards tr.empty-row td {
    display: block;
    justify-content: flex-start;
  }

  table.responsive-cards tr.empty-row td::before {
    display: none;
  }

  table.responsive-cards td[data-label=""] {
    justify-content: flex-end;
  }

  table.responsive-cards td[data-label=""] .btn {
    width: 100%;
  }
}

@media (max-width: 1200px) {
  .main-topbar-stats {
    gap: 0.75rem;
  }

  .main-topbar-stat span {
    font-size: 0.62rem;
  }

  .main-topbar-stat strong {
    font-size: 0.9rem;
  }
}

@media (max-width: 1050px) {
  .main-topbar-stat:nth-child(2) {
    display: none;
  }
}

/* Öffentliches Layout (API-Tester ohne Login) */
.public-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg, #f4f6f8);
}

.public-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.public-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--sidebar, #1a1f26);
  color: var(--sidebar-ink, #e8edf2);
}

.public-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.public-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.public-nav a:not(.btn) {
  color: #c5ced8;
  text-decoration: none;
  font-size: 0.92rem;
}

.public-nav a:not(.btn):hover {
  color: #fff;
}

.public-main {
  flex: 1;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 1.25rem;
}

.public-main .page-header {
  margin-bottom: 1rem;
}

