:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #0f172a;
  --text-strong: #020617;
  --muted: #475569;
  --line: #d8e0ea;
  --brand: #0f172a;
  --brand-text: #ffffff;
  --accent: #0284c7;
  --danger: #b91c1c;
  --ok: #15803d;
  --warn: #c2410c;
  --warn-bg: #fff7ed;
  --shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body, #root { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; color: var(--text); }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
a { color: inherit; }

.app { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}
.brand { font-weight: 850; font-size: 20px; color: var(--text-strong); }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
}

.nav { display: flex; gap: 8px; overflow: auto; }
.nav button, .btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 10px 13px;
  min-height: 42px;
  color: var(--text);
  font-weight: 750;
}
.nav button.active, .btn.primary {
  background: var(--brand);
  color: var(--brand-text);
  border-color: var(--brand);
}
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }

.main { padding: 18px; max-width: 1600px; width: 100%; margin: 0 auto; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: minmax(0, 1fr) 420px; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.section-title { font-size: 18px; font-weight: 850; margin: 0 0 12px; color: var(--text-strong); }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc, #e0f2fe);
}
.login {
  width: min(440px, 100%);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login h1 { margin: 0 0 6px; font-size: 30px; color: var(--text-strong); }
.field { display: grid; gap: 6px; margin: 10px 0; }
.field span { font-weight: 750; font-size: 14px; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--text);
  min-height: 46px;
}
.field input::placeholder, .field textarea::placeholder { color: #64748b; }
.error {
  background: #fee2e2;
  color: #7f1d1d;
  padding: 10px;
  border-radius: 8px;
  margin: 10px 0;
  border: 1px solid #fecaca;
}

.tabs { display: flex; gap: 8px; overflow: auto; padding-bottom: 8px; }
.tab {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  white-space: nowrap;
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.products { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.product {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  min-height: 142px;
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
  transition: .15s transform, .15s box-shadow;
}
.product:hover { box-shadow: 0 12px 26px rgba(15, 23, 42, .1); }
.product:active { transform: scale(.98); }
.product .icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
}
.svg-icon {
  width: 25px;
  height: 25px;
  display: block;
}
.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}
.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product .name { font-weight: 850; line-height: 1.15; color: var(--text-strong); }
.product .price { font-size: 22px; font-weight: 900; margin-top: auto; color: var(--text-strong); }

.cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
.cart-row strong { color: var(--text-strong); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 900;
}
.total {
  font-size: 42px;
  font-weight: 950;
  line-height: 1;
  margin: 14px 0;
  color: var(--text-strong);
}
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick button {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text-strong);
  font-weight: 850;
}

.dialog-back {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 18px;
}
.dialog {
  width: min(520px, 100%);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .25);
}
.dialog h2 { color: var(--text-strong); }
.order-number {
  font-size: 72px;
  font-weight: 950;
  text-align: center;
  margin: 20px 0;
  color: var(--text-strong);
}
.output-number-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.output-number-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.output-number-card span {
  color: var(--muted);
  font-weight: 800;
}
.output-number-card strong {
  color: var(--text-strong);
  font-size: 56px;
  line-height: 1;
}
.output-number-card small {
  color: var(--text);
  font-weight: 700;
}
.change { font-size: 36px; font-weight: 950; color: var(--ok); }

.board { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.order-card {
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 18px;
  min-height: 210px;
  text-align: left;
  box-shadow: var(--shadow);
}
.order-card.warn { border-color: var(--warn); background: var(--warn-bg); }
.order-no { font-size: 52px; font-weight: 950; line-height: 1; color: var(--text-strong); }
.items { margin: 12px 0 0; padding: 0; list-style: none; }
.items li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  padding: 6px 0;
  border-bottom: 1px solid #e8eef5;
  color: var(--text-strong);
}

.table-wrap { overflow: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  color: var(--text);
}
.table th, .table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}
.table th {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
}
.table td { color: var(--text); }
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
}
.status-offen { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.status-teilweise_erledigt { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.status-erledigt { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.status-storniert { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.product-dialog { width: min(720px, 100%); }
.sale-detail { width: min(860px, 100%); }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.detail-grid > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.detail-grid strong {
  color: var(--text-strong);
  font-size: 17px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  color: var(--text);
  font-weight: 750;
}
.check input { width: 20px; height: 20px; }
.image-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.image-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat strong { display: block; font-size: 30px; color: var(--text-strong); }

@media (max-width: 980px) {
  .cols-2 { grid-template-columns: 1fr; }
  .topbar { height: auto; flex-wrap: wrap; }
  .main { padding: 12px; }
  .products { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .total { font-size: 36px; }
}
