/* HiFi Admin-Bereich — passt zum Look der Hauptseite */
:root {
  --black: #000;
  --white: #fff;
  --yellow: #fee809;
  --ink: #1d1d1f;
  --ink-soft: #424245;
  --gray-600: #6e6e73;
  --gray-300: #d2d2d7;
  --gray-100: #f5f5f7;
  --gray-50: #fbfbfd;
  --red: #c4291c;
  --red-bg: #fdecea;
  --orange-bg: #fff4d6;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--gray-100);
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.75rem; letter-spacing: -0.02em; margin: 0 0 6px; }
.muted { color: var(--gray-600); margin: 0; }
.small { font-size: 0.85rem; margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; border-radius: 999px;
  padding: 11px 22px; cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: #222; }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--gray-300); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-small { padding: 8px 16px; font-size: 0.875rem; }

.icon-btn {
  font: inherit; font-size: 0.8rem; font-weight: 600;
  background: none; border: 1px solid var(--gray-300); border-radius: 999px;
  padding: 5px 10px; cursor: pointer; color: var(--ink); white-space: nowrap;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.save { background: var(--black); color: var(--white); border-color: var(--black); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { border-color: var(--red); background: var(--red-bg); }

input {
  font: inherit; color: var(--ink);
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  padding: 10px 12px; background: var(--white); width: 100%;
}
input:focus { outline: 2px solid var(--yellow); outline-offset: 0; border-color: var(--black); }

.error { color: var(--red); font-size: 0.9rem; min-height: 1.2em; margin: 0; }
.error.banner { background: var(--red-bg); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--black); }
.login-card {
  width: 100%; max-width: 380px; background: var(--white);
  border-radius: var(--radius-lg); padding: 36px 28px; display: grid; gap: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
.login-logo { width: 150px; margin: 0 auto 4px; display: block; }
.login-card h1 { text-align: center; margin: 0; }
.login-card .muted { text-align: center; }
.login-card label { display: grid; gap: 6px; font-weight: 600; font-size: 0.9rem; }
.back-link { text-align: center; color: var(--gray-600); font-size: 0.875rem; text-decoration: none; }
.back-link:hover { color: var(--ink); }

/* Topbar */
.topbar { background: var(--black); color: var(--white); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1480px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 32px; display: block; }
.topbar-title { font-weight: 700; flex: 1; }
.user { color: var(--yellow); font-weight: 600; font-size: 0.9rem; }
.topbar .btn-ghost { background: transparent; color: var(--white); border-color: #444; }
.topbar .btn-ghost:hover { border-color: var(--white); }

/* Layout */
.wrap { max-width: 1480px; margin: 0 auto; padding: 32px 16px 64px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-actions input { width: 200px; padding: 8px 14px; border-radius: 999px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--white); border-radius: var(--radius-md); padding: 16px 18px; box-shadow: var(--shadow-card); }
.stat-label { font-size: 0.8rem; color: var(--gray-600); font-weight: 500; }
.stat-value { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Tabelle */
.table-scroll { overflow-x: auto; background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
table.lager { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 960px; }
.lager th, .lager td { padding: 12px 8px; text-align: left; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.lager thead th {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--gray-600); font-weight: 600; background: var(--gray-50); line-height: 1.3;
}
.lager .num { text-align: right; font-variant-numeric: tabular-nums; }
.lager td.num { white-space: nowrap; }
.lager tbody tr:hover { background: var(--gray-50); }
.lager td.code { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.lager td.name { font-weight: 500; min-width: 170px; }
.lager tr.editing td:nth-child(2) { min-width: 220px; }
.lager .meta { display: block; white-space: nowrap; font-size: 0.72rem; color: var(--gray-600); font-weight: 400; margin-top: 2px; }
.lager .actions-col, .lager td.actions { width: 1%; white-space: nowrap; text-align: right; }
.lager td.actions { padding-left: 14px; border-left: 1px solid var(--gray-100); }
.lager .row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Lagerbestand mit −/+ zum schnellen Buchen */
.stock-ctl { display: inline-flex; align-items: center; gap: 4px; }
.step {
  width: 24px; height: 24px; border-radius: 50%; padding: 0;
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1;
  border: 1px solid var(--gray-300); background: var(--white); color: var(--ink); cursor: pointer;
}
.step:hover:not(:disabled) { border-color: var(--ink); background: var(--yellow); }
.step:disabled { opacity: 0.3; cursor: not-allowed; }

.icon-btn.book { background: var(--yellow); border-color: var(--yellow); }
.icon-btn.book:hover, .icon-btn.book.active { border-color: var(--ink); }

.lager tr.booking td { background: #fffde6; padding: 10px 14px; }
.booking-inner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.booking-inner label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.booking-inner input { width: 90px; padding: 6px 9px; text-align: right; }
.icon-btn.save.sell { background: var(--ink-soft); border-color: var(--ink-soft); }
.booking-hint { font-size: 0.85rem; margin-left: auto; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--black); color: var(--white); padding: 12px 20px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  max-width: calc(100% - 32px); z-index: 20;
}

.stock { display: inline-block; min-width: 2.2em; text-align: center; padding: 2px 10px; border-radius: 999px; font-weight: 700; }
.stock.ok { background: #e7f6ec; color: #1b6b35; }
.stock.low { background: var(--orange-bg); color: #8a5a00; }
.stock.empty { background: var(--red-bg); color: var(--red); }

.lager tr.editing { background: #fffde6 !important; }
.lager tr.editing input { padding: 7px 9px; font-size: 0.9rem; }
.lager tr.editing input.n { text-align: right; min-width: 64px; }
.lager tr.editing .calc { color: var(--gray-600); }

.lager tfoot td { font-weight: 800; background: var(--gray-50); border-bottom: none; }
.lager .empty-row td { text-align: center; color: var(--gray-600); padding: 32px; }

@media (max-width: 640px) {
  h1 { font-size: 1.4rem; }
  .topbar-title { display: none; }
  .user { flex: 1; text-align: right; }
  .head-actions { width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 1.1rem; }
  .head-actions input { flex: 1 1 100%; width: auto; }
}
