:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #f97316;
  --accent-dark: #ea580c;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 18px 45px rgba(17, 24, 39, .12);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 760px; margin: 0 auto; padding-bottom: 128px; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  background: #111827;
  color: #fff;
  box-shadow: 0 8px 26px rgba(17, 24, 39, .18);
}
.app-header h1 { margin: 0; font-size: 28px; line-height: 1.05; }
.eyebrow { margin: 0 0 4px; color: #fbbf24; font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.app-main { padding: 18px; }
.hero-card, .stat-card, .menu-card, .page-head-card, .list-card, .info-card, .modal form {
  background: var(--card);
  border: 1px solid rgba(229, 231, 235, .9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  margin-bottom: 16px;
}
.hero-card.vertical { align-items: stretch; flex-direction: column; }
.hero-card h2, .page-head-card h2 { margin: 2px 0 0; font-size: 25px; }
.muted { color: var(--muted); margin: 0; }
.primary-btn, .secondary-btn, .icon-btn, .link-btn {
  border: 0;
  border-radius: 18px;
  font-weight: 900;
  min-height: 48px;
}
.primary-btn { background: var(--accent); color: #fff; padding: 0 20px; }
.primary-btn:active { background: var(--accent-dark); }
.secondary-btn { background: #fff7ed; color: #9a3412; padding: 0 18px; border: 1px solid #fed7aa; }
.icon-btn { width: 58px; height: 58px; background: rgba(255,255,255,.12); color: inherit; font-size: 28px; }
.modal .icon-btn { background: #f3f4f6; color: var(--text); }
.link-btn { color: var(--accent-dark); background: transparent; min-height: auto; padding: 8px 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { padding: 14px 12px; box-shadow: none; border-radius: 18px; text-align: left; }
.stat-button { width: 100%; border: 1px solid rgba(229, 231, 235, .9); }
.stat-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.stat-card strong { display: block; margin-top: 3px; font-size: 24px; }
.menu-card, .page-head-card { padding: 18px; margin-bottom: 16px; box-shadow: none; }
.menu-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0;
}
.menu-row b { display: block; font-size: 18px; }
.menu-row small { display: block; margin-top: 4px; color: var(--muted); font-weight: 700; }
.menu-row strong { font-size: 28px; color: var(--accent); }

.segmented-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.segmented-filter button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f9fafb;
  color: var(--muted);
  font-weight: 900;
}
.segmented-filter button.active {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.pallet-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  margin-top: 16px;
}
.pallet-grid.compact { margin-top: 0; }
.pallet-tile {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  display: grid;
  place-items: center;
  gap: 1px;
  padding: 8px 4px;
}
.pallet-tile span { font-size: 18px; font-weight: 950; }
.pallet-tile small { font-size: 10px; font-weight: 900; color: var(--muted); text-transform: uppercase; }
.pallet-tile.filled { background: #ecfdf5; border-color: #bbf7d0; }
.pallet-tile.filled small { color: #166534; }
.pallet-tile.empty { background: #f9fafb; }
.toolbar { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 0 0; }
.inline-toolbar { display: grid; grid-template-columns: 1fr; }
.search-box { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 900; }
.search-box input, .toolbar select, .modal input, .modal textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 14px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.toolbar select { min-height: 48px; }
.count-row { display: flex; align-items: center; justify-content: space-between; margin: -4px 2px 12px; color: var(--muted); font-weight: 900; }
.list-stack { display: grid; gap: 12px; }
.list-card { padding: 16px; box-shadow: none; }
.list-card h3 { margin: 0 0 4px; }
.list-card p { margin: 0; color: var(--muted); line-height: 1.4; }
.info-grid { display: grid; gap: 12px; margin-bottom: 16px; }
.info-card { padding: 16px; box-shadow: none; overflow-wrap: anywhere; }
.info-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 900; }
.info-card strong { display: block; margin-top: 4px; font-size: 17px; }
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(730px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px;
  border-radius: 24px;
  background: #111827;
  box-shadow: 0 18px 40px rgba(17, 24, 39, .25);
  z-index: 10;
}
.nav-btn { border: 0; border-radius: 17px; min-height: 46px; color: #d1d5db; background: transparent; font-weight: 900; }
.nav-btn.active { background: var(--accent); color: #fff; }
.modal {
  width: min(640px, calc(100% - 24px));
  border: 0;
  padding: 0;
  background: transparent;
}
.modal::backdrop { background: rgba(17, 24, 39, .58); }
.modal form { padding: 18px; display: grid; gap: 12px; max-height: calc(100vh - 40px); overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.modal-head h2 { margin: 0; }
.modal label { display: grid; gap: 6px; font-size: 13px; font-weight: 900; color: #374151; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.form-message { min-height: 22px; margin: 0; color: var(--muted); font-weight: 800; }
@media (max-width: 560px) {
  .app-header h1 { font-size: 24px; }
  .hero-card { align-items: stretch; flex-direction: column; }
  .hero-card .primary-btn { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  
.segmented-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.segmented-filter button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f9fafb;
  color: var(--muted);
  font-weight: 900;
}
.segmented-filter button.active {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.pallet-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .pallet-tile { min-height: 58px; border-radius: 16px; }
  .modal-actions { grid-template-columns: 1fr; }
  .nav-btn { font-size: 14px; }
}

.detail-panel {
  background: var(--card);
  border: 1px solid rgba(229, 231, 235, .9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 40px);
  overflow: auto;
}
.detail-content { display: grid; gap: 14px; }
.detail-status {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  display: grid;
  gap: 4px;
}
.detail-status strong { font-size: 20px; }
.detail-status span { color: var(--muted); font-weight: 800; }
.detail-status.filled { background: #ecfdf5; border-color: #bbf7d0; }
.detail-status.filled strong { color: #166534; }
.detail-status.empty { background: #f9fafb; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-grid article {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: #fff;
  overflow-wrap: anywhere;
}
.detail-grid article.wide { grid-column: 1 / -1; }
.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 5px;
}
.detail-grid strong {
  display: block;
  font-size: 16px;
  line-height: 1.25;
}

.quantity-card { background: #fffaf5; }
.quantity-stepper {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 10px;
}
.quantity-stepper button {
  border: 0;
  border-radius: 16px;
  font-size: 30px;
  font-weight: 900;
  min-height: 54px;
  line-height: 1;
}
.quantity-stepper button[data-qty-action="dec"] {
  background: #eef0f4;
  color: #111827;
}
.quantity-stepper button[data-qty-action="inc"] {
  background: var(--accent);
  color: #fff;
}
.quantity-input {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  outline: none;
  appearance: textfield;
}
.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}
.quantity-input:focus {
  background: #fff7ed;
  border-radius: 14px;
}

.quantity-stepper strong {
  text-align: center;
  font-size: 28px;
}

@media (max-width: 560px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.print-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.print-actions button:disabled {
  opacity: .45;
}
.print-item-card {
  background: var(--card);
  border: 1px solid rgba(229, 231, 235, .9);
  border-radius: 22px;
  padding: 16px;
  box-shadow: none;
}
.print-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.print-item-head h3 {
  margin: 0 0 5px;
  font-size: 18px;
}
.print-item-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}
.remove-btn {
  border: 0;
  border-radius: 15px;
  min-width: 44px;
  min-height: 44px;
  background: #f3f4f6;
  color: #111827;
  font-size: 26px;
  font-weight: 900;
}
.print-qty-row {
  display: grid;
  gap: 8px;
}
.print-qty-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.mini-stepper {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 10px;
}
.mini-stepper button {
  border: 0;
  border-radius: 16px;
  min-height: 52px;
  font-size: 28px;
  font-weight: 900;
}
.mini-stepper button:first-child {
  background: #eef0f4;
  color: #111827;
}
.mini-stepper button:last-child {
  background: var(--accent);
  color: #fff;
}
.mini-stepper input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  min-height: 52px;
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  color: var(--text);
  outline: none;
}
.mini-stepper input:focus {
  border-color: #fed7aa;
  background: #fff7ed;
}
.empty-print-card {
  text-align: center;
}
@media (max-width: 560px) {
  .print-actions { grid-template-columns: 1fr; }
}


.scanner-card {
  background: var(--card);
  border: 1px solid rgba(229, 231, 235, .9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 14px;
}
.scanner-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 22px;
  background: #111827;
  display: grid;
  place-items: center;
}
.scanner-frame::before {
  content: 'Kamera-Vorschau';
  color: #9ca3af;
  font-weight: 900;
  letter-spacing: .03em;
}
.scanner-frame.active::before { content: ''; }
.scanner-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-box {
  position: absolute;
  inset: 18%;
  border: 3px solid rgba(249, 115, 22, .9);
  border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(17, 24, 39, .28);
  pointer-events: none;
}
.scan-box span {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: rgba(249, 115, 22, .95);
  border-radius: 999px;
}
.scanner-status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  line-height: 1.35;
}
.scanner-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.manual-ean-btn { width: 100%; }
.scanner-warning {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 4px;
}
.scanner-warning strong { font-size: 16px; }
.scanner-warning span { font-weight: 700; line-height: 1.35; }
@media (max-width: 560px) {
  .scanner-actions { grid-template-columns: 1fr; }
}
