:root {
  --bg: #0f1419;
  --surface: #1a212b;
  --surface-2: #232c38;
  --line: #2d3744;
  --text: #e8edf2;
  --muted: #93a1b0;
  --accent: #ffb627;
  --accent-2: #2dd4a7;
  --danger: #ff6b6b;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  overscroll-behavior-y: none;
}

button { font-family: inherit; cursor: pointer; }

/* ---------- Header ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 8px;
}
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.title-row h1 {
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
}
.search {
  margin-top: 10px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 1rem;
  outline: none;
}
.search:focus { border-color: var(--accent); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.9rem;
  white-space: nowrap;
}
.chip.active {
  background: var(--accent);
  color: #1a1206;
  border-color: var(--accent);
  font-weight: 600;
}
.chip.toggle.active {
  background: var(--accent-2);
  color: #05231b;
  border-color: var(--accent-2);
}

/* ---------- List ---------- */
main { padding: 6px 14px 140px; }
.hint {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 28px 16px;
}
.section-head {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 18px 4px 6px;
  font-weight: 600;
}
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.item.in-basket { border-color: var(--accent-2); }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-name {
  font-size: 0.97rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge.af { color: var(--accent-2); border-color: var(--accent-2); }
.badge.extra { color: var(--accent); border-color: var(--accent); }
.item-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}
.item-sub .price { color: var(--text); font-weight: 600; }
.star {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--line);
  padding: 4px;
  line-height: 1;
}
.star.on { color: var(--accent); }

/* ---------- Stepper ---------- */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
}
.stepper button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.25rem;
  display: grid;
  place-items: center;
}
.stepper button:active { background: var(--accent); color: #1a1206; }
.stepper .minus { border-radius: 10px 0 0 10px; }
.stepper .plus { border-radius: 0 10px 10px 0; }
.stepper .qty {
  min-width: 34px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  height: 34px;
  line-height: 34px;
  background: var(--surface);
}
.add-btn {
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 10px;
  height: 34px;
  padding: 0 14px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- Basket bar ---------- */
.basket-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 30;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: rgba(15,20,25,0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  transform: translateY(120%);
  transition: transform 0.22s ease;
}
.basket-bar.show { transform: translateY(0); }
.basket-bar button.open {
  width: 100%;
  border: none;
  background: var(--accent-2);
  color: #05231b;
  font-weight: 700;
  font-size: 1.02rem;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------- Modal ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: flex-end;
}
.overlay.show { display: flex; }
.sheet {
  background: var(--surface);
  width: 100%;
  max-height: 88vh;
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  animation: up 0.22s ease;
}
@keyframes up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 8px;
}
.sheet-head h2 { margin: 0; font-size: 1.1rem; }
.sheet-body { overflow-y: auto; padding: 6px 18px; }
.sheet-foot {
  padding: 12px 18px calc(16px + var(--safe-bottom));
  border-top: 1px solid var(--line);
}
.line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.line .ln-main { flex: 1; min-width: 0; }
.line .ln-name { font-size: 0.92rem; }
.line .ln-sub { font-size: 0.78rem; color: var(--muted); }
.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 6px 2px 12px;
}
.total-row .muted { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.btn-primary {
  width: 100%;
  border: none;
  background: #25d366;
  color: #04210f;
  font-weight: 700;
  font-size: 1.05rem;
  border-radius: 12px;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-ghost {
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 11px;
  margin-top: 8px;
  font-size: 0.9rem;
}
.field { margin: 10px 0; }
.field label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 5px; }
.field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 1rem;
  outline: none;
}
.field input:focus { border-color: var(--accent); }
.note { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.usual-actions { margin: 10px 4px 4px; }
