:root {
  --bg: #0b1120;
  --bg-2: #0e1626;
  --surface: #18233b;
  --surface-2: #1f2c47;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #14b8a6;
  --accent-ink: #04201d;
  --radius: 16px;
  --radius-sm: 11px;
  font-family: "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(20, 184, 166, 0.10), transparent 60%),
    radial-gradient(700px 500px at -10% 0%, rgba(56, 90, 160, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

.ic { display: inline-flex; }
.ic svg { width: 1em; height: 1em; }

/* ── Boot / Spinner ─────────────────────────────────────────────── */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Top App Bar ────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 11px clamp(14px, 3vw, 28px);
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(140deg, var(--accent), #0e8f81); color: var(--accent-ink);
}
.brand .title { font-size: 16px; font-weight: 700; letter-spacing: 0.01em; }
.brand .tag { font-size: 11px; color: var(--muted); margin-top: 1px; }
.spacer { flex: 1; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 6px 5px 12px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface);
}
.user-chip .u-name { font-size: 13px; font-weight: 600; max-width: 24vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  color: var(--accent-ink); background: var(--accent);
}
.btn-logout {
  appearance: none; cursor: pointer; border: 1px solid var(--border);
  border-radius: 999px; background: transparent; color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 14px;
}
.btn-logout:hover { color: var(--text); border-color: var(--border-strong); }

/* ── Layout: Sidebar + Content ──────────────────────────────────── */
.layout { display: flex; align-items: stretch; min-height: calc(100dvh - 57px); }
.sidebar {
  flex: 0 0 212px; padding: 18px 12px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px; cursor: pointer;
  color: var(--muted); font-size: 14px; font-weight: 600;
  border: 1px solid transparent; background: none; text-align: left; width: 100%;
  font-family: inherit;
}
.nav-item .ic { font-size: 19px; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.nav-item.active .ic { color: var(--accent); }
.nav-item:disabled { cursor: default; opacity: 0.55; }
.nav-item:disabled:hover { background: none; color: var(--muted); }
.nav-item .soon {
  margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--faint);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px;
}
.content { flex: 1; min-width: 0; padding: clamp(18px, 3vw, 32px); }

/* ── Produkte: Kopf + Filter ────────────────────────────────────── */
.prod-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.prod-head h1 { margin: 0; font-size: clamp(22px, 3.5vw, 28px); font-weight: 800; letter-spacing: -0.01em; }
.prod-head .sub { color: var(--muted); font-size: 13px; }

.prod-search {
  display: flex; align-items: center; gap: 9px; margin-left: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; min-width: 210px;
}
.prod-search .ic { color: var(--faint); font-size: 17px; }
.prod-search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 13.5px; min-width: 0;
}
.prod-search input::placeholder { color: var(--faint); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.pill {
  cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill .n { opacity: 0.7; margin-left: 5px; font-weight: 700; }

/* ── Kategorie-Gruppen + Raster ─────────────────────────────────── */
.cat-group { margin-bottom: 28px; scroll-margin-top: 70px; }
.cat-title {
  display: flex; align-items: center; gap: 9px; margin: 0 0 13px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint);
}
.cat-title .n { color: var(--muted); font-weight: 600; }

.grid { display: grid; gap: 11px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.prod {
  cursor: pointer; font: inherit; text-align: left;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px 13px; border-radius: var(--radius);
  border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface), var(--bg-2));
  transition: border-color 0.12s, transform 0.12s;
}
.prod:hover { border-color: var(--accent); transform: translateY(-2px); }
.prod img { width: 52px; height: 52px; object-fit: contain; }
.prod .prod-name { font-size: 13.5px; font-weight: 600; text-align: center; line-height: 1.25; }
.prod .prod-bld { font-size: 11px; color: var(--faint); text-align: center; }
.empty { color: var(--muted); font-size: 14px; padding: 40px 0; text-align: center; }

/* ── Detail-Drawer ──────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end;
  background: rgba(3, 7, 18, 0.62); backdrop-filter: blur(2px);
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } }
.drawer {
  width: min(440px, 100%); height: 100%; overflow-y: auto;
  background: var(--bg-2); border-left: 1px solid var(--border);
  padding: 22px clamp(18px, 3vw, 26px) 40px;
  animation: slidein 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slidein { from { transform: translateX(30px); opacity: 0.3; } }
.drawer-top { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 22px; }
.drawer-top img { width: 64px; height: 64px; object-fit: contain; flex: 0 0 auto; }
.drawer-top h2 { margin: 2px 0 7px; font-size: 21px; font-weight: 800; }
.cat-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--accent); background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(20, 184, 166, 0.3); border-radius: 999px; padding: 3px 10px;
}
.drawer-close {
  margin-left: auto; flex: 0 0 auto; cursor: pointer;
  width: 34px; height: 34px; border-radius: 9px; font-size: 18px;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.drawer-close:hover { color: var(--text); border-color: var(--border-strong); }

.d-sect { margin-top: 22px; }
.d-sect > h3 {
  margin: 0 0 11px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--faint);
}
.bld-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.bld-row .ic { font-size: 22px; color: var(--accent); }
.bld-row .bld-name { font-size: 15px; font-weight: 600; }

.io-list { display: flex; flex-direction: column; gap: 7px; }
.io-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; text-align: left;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.io-row:hover { border-color: var(--accent); }
.io-row img { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; }
.io-row .amt { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); min-width: 46px; }
.io-row .io-name { font-size: 14px; font-weight: 500; }
.io-row .ic.go { margin-left: auto; color: var(--faint); font-size: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font: inherit;
  font-size: 12.5px; font-weight: 500; padding: 5px 11px 5px 6px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.chip:hover { border-color: var(--accent); }
.chip img { width: 22px; height: 22px; object-fit: contain; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; }

.error { min-height: 60dvh; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }
.error button { margin-top: 14px; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 780px) {
  .layout { flex-direction: column; min-height: 0; }
  .sidebar {
    flex: none; flex-direction: row; overflow-x: auto; gap: 6px;
    border-right: none; border-bottom: 1px solid var(--border); padding: 10px 12px;
  }
  .nav-item { width: auto; white-space: nowrap; }
  .nav-item .soon { display: none; }
  .prod-search { min-width: 0; width: 100%; margin-left: 0; }
}
@media (max-width: 480px) { .user-chip .u-name { display: none; } }
