* { box-sizing: border-box; }
:root {
  --text: #0f1c2a;
  --text-muted: #5b6b7c;
  --text-faint: #8595a6;
  --border: #e3e9f0;
  --border-strong: #cfd9e3;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ring: color-mix(in srgb, var(--primary) 18%, transparent);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px -8px rgba(16, 24, 40, 0.10);
  --radius: 12px;
  --radius-lg: 16px;
}
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-family);
  background: var(--page-bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

header.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 28px;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 8px 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: center;
}
.brand-logo { display: block; width: auto; }
.brand-name { font-size: 15.5px; font-weight: 650; color: var(--text); white-space: nowrap; }
.brand-name span { color: var(--text-faint); font-weight: 450; }

/* Markenfarbener Header (z. B. für ein weißes Logo) */
header.topbar.brand {
  background: var(--primary);
  border-bottom: none;
}
header.topbar.brand .brand-name { color: #fff; }
header.topbar.brand nav a { color: rgba(255, 255, 255, 0.88); }
header.topbar.brand nav a:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
header.topbar.brand nav a.user {
  color: #fff; background: rgba(255, 255, 255, 0.16);
}
header.topbar.brand nav a.user:hover { background: rgba(255, 255, 255, 0.26); }

header.topbar nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
header.topbar nav a {
  color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 520;
  padding: 7px 13px; border-radius: 99px; transition: background 0.15s, color 0.15s;
}
header.topbar nav a:hover { background: var(--surface-2); color: var(--text); }
header.topbar nav a.user {
  color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent);
  font-weight: 600; margin-left: 6px;
}
header.topbar nav a.user:hover { background: color-mix(in srgb, var(--primary) 14%, transparent); }

main { max-width: 1120px; margin: 36px auto 0; padding: 0 24px; }
h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin: 0 0 6px; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); margin: 32px 0 12px; }
p.intro { color: var(--text-muted); max-width: 720px; margin: 0 0 26px; font-size: 15px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }

.breadcrumb { font-size: 13px; color: var(--text-faint); margin: 0 0 10px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* Produktgruppen-Kacheln */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 8px; }
.tile {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow 0.2s, transform 0.2s;
}
.tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tile-media { height: 150px; background: var(--surface-2); }
.tile-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-media-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.tile-media-fallback span { color: #fff; font-size: 52px; font-weight: 700; opacity: 0.92; }
.tile-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 5px; }
.tile-body h3 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.tile-body p { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.tile-meta { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--primary); }

.product-card { display: flex; flex-direction: column; gap: 0; transition: box-shadow 0.2s, transform 0.2s; }
.product-card:hover { box-shadow: var(--shadow-md); }
.product-head { display: flex; gap: 18px; align-items: flex-start; }
.product-info { flex: 1; min-width: 0; }
.product-card h3 { margin: 0 0 2px; font-size: 16.5px; font-weight: 650; letter-spacing: -0.01em; }
.product-card .dims { color: var(--text-faint); font-size: 13px; margin-bottom: 4px; }
.chip {
  display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  padding: 2px 9px; border-radius: 99px; letter-spacing: 0.02em;
}

.poster-mini {
  flex: none; width: 86px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  background: #fff; display: flex; flex-direction: column;
}
.poster-mini.sticker {
  background: color-mix(in srgb, var(--primary) 10%, #fff);
  justify-content: center;
}
.poster-mini .pm-band { background: var(--primary); height: 26%; display: flex; align-items: center; justify-content: center; }
.poster-mini .pm-band i { display: block; width: 60%; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.85); }
.poster-mini .pm-zins {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--primary-dark); font-weight: 800; font-size: 14px; letter-spacing: -0.02em;
  padding: 2px;
}
.poster-mini .pm-foot { background: var(--primary-dark); height: 9%; }

.order-head { padding: 20px 24px 24px; }
.order-head-fields { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-end; }
.order-head-fields > div { min-width: 220px; }
.order-head-fields label { margin-top: 0; }
input.big { font-size: 20px; font-weight: 650; padding: 10px 14px; max-width: 240px; letter-spacing: -0.01em; }

.seg {
  display: inline-flex; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px;
}
.seg button {
  background: transparent; color: var(--text-muted); box-shadow: none;
  border-radius: 99px; padding: 8px 18px; font-size: 14px; font-weight: 600;
}
.seg button:hover { background: #fff; color: var(--text); transform: none; box-shadow: none; }
.seg button.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.seg button.active:hover { background: var(--primary-dark); }

label { display: block; font-size: 13px; color: var(--text-muted); margin: 14px 0 5px; font-weight: 600; }
input[type="text"], input[type="number"], input[type="password"], input[type="email"], textarea, select {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 14.5px; font-family: inherit; background: var(--surface); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; min-height: 320px; }
.qty { max-width: 120px; }
input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; vertical-align: -2px; margin-right: 6px; }

button, .btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary); color: #fff; border: none;
  padding: 9px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
button:hover, .btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
button:active, .btn:active { transform: translateY(0); }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.small { padding: 5px 13px; font-size: 13px; font-weight: 550; }
.btn.danger { background: #c03434; }
button.block, .btn.block { width: 100%; justify-content: center; }

.table-wrap, table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
th {
  text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-faint); background: var(--surface-2);
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tr:hover td { background: var(--surface-2); }
td a { color: var(--primary); font-weight: 550; text-decoration: none; }
td a:hover { text-decoration: underline; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600;
  background: #eef1f5; color: #46586a;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; opacity: 0.7; }
.badge.in_pruefung { background: #fdf3da; color: #8a6410; }
.badge.freigegeben, .badge.geliefert, .badge.abgerechnet { background: #e0f3e6; color: #1a703c; }
.badge.abgelehnt { background: #fbe3e3; color: #9c2626; }
.badge.bestellt { background: color-mix(in srgb, var(--primary) 10%, #fff); color: var(--primary-dark); }

.alert {
  background: #fbe9e9; color: #8d2222; border: 1px solid #f2c5c5;
  border-radius: var(--radius); padding: 11px 16px; margin-bottom: 14px; font-size: 14px;
}
.alert.ok { background: #e0f3e6; color: #1a703c; border-color: #bfe4cb; }

.events td { padding: 8px 16px; font-size: 13px; color: var(--text-muted); }
.kv { display: grid; grid-template-columns: 210px 1fr; gap: 7px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; font-weight: 500; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.hint { font-size: 13px; color: var(--text-faint); }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 12.5px; }

.login-wrap { max-width: 410px; margin: 9vh auto 0; }
.login-wrap .brand-mark { width: 46px; height: 46px; border-radius: 13px; font-size: 17px; margin: 0 auto 18px; }
.login-logo {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); border-radius: 14px; padding: 14px 22px; margin: 0 auto 18px;
}
.login-logo img { height: 34px; width: auto; display: block; }
.login-wrap { text-align: center; }
.login-wrap .card { text-align: left; }
.login-wrap h1 { text-align: center; font-size: 23px; }
.login-wrap p.intro { text-align: center; margin-bottom: 8px; }
.login-wrap .card { padding: 26px 28px 28px; box-shadow: var(--shadow-md); }

footer { text-align: center; color: var(--text-faint); font-size: 12.5px; margin: 56px 0 28px; }

@media (max-width: 720px) {
  header.topbar { height: auto; padding: 10px 16px; flex-wrap: wrap; }
  main { margin-top: 24px; padding: 0 16px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
}
