:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f3f4f6);
  --text: var(--tg-theme-text-color, #111827);
  --hint: var(--tg-theme-hint-color, #8b8f98);
  --accent: #ff6b00;
  --accent2: #ff8a33;
  --ok: #16a34a;
  --warn: #f59e0b;
  --bad: #dc2626;
  --card: var(--tg-theme-bg-color, #ffffff);
  --line: rgba(127, 127, 127, .15);
  --r: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg2); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: 140px; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; width: 100%; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }
.hidden { display: none !important; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.center { text-align: center; }
.bold { font-weight: 700; }

/* Loader */
.loader { display: flex; justify-content: center; padding: 80px 0; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Header */
.header { background: var(--bg); padding: 14px 16px 10px; }
.header h1 { margin: 0; font-size: 22px; }
.banner { margin: 10px 16px 0; padding: 12px 14px; border-radius: 12px; background: #fff4e5; color: #8a4b00; font-size: 14px; }
.banner.red { background: #fde8e8; color: #9b1c1c; }
.search { margin-top: 10px; }

/* Kategoriyalar */
.chips { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px;
  background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: var(--bg2); font-weight: 600; font-size: 14px; }
.chip.on { background: var(--accent); color: #fff; }
.chip .cnt { background: rgba(0,0,0,.15); border-radius: 999px; padding: 0 7px; margin-left: 6px; font-size: 12px; }

.section { padding: 16px 16px 4px; }
.section h2 { margin: 0 0 12px; font-size: 19px; }

/* Taom kartochkasi */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { background: var(--card); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); position: relative; }
.card .img { aspect-ratio: 1/1; background: var(--bg2) center/cover no-repeat; display: flex; align-items: center;
  justify-content: center; font-size: 54px; }
.card .body { padding: 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .name { font-weight: 600; font-size: 15px; line-height: 1.25; }
.card .price { font-weight: 800; margin-top: auto; }
.old { text-decoration: line-through; color: var(--hint); font-weight: 400; font-size: 13px; margin-left: 4px; }
.card.stop { opacity: .5; }
.badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; }
.badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 999px; }
.badge.new { background: #2563eb; }
.badge.spicy { background: var(--bad); }
.badge.off { background: #111; }
.add-btn { margin-top: 6px; padding: 9px; border-radius: 12px; background: var(--bg2); font-weight: 700; text-align: center; }
.add-btn.in { background: var(--accent); color: #fff; }

/* Tugmalar */
.btn { display: block; width: 100%; padding: 14px; border-radius: 14px; background: var(--accent); color: #fff;
  font-weight: 700; text-align: center; font-size: 16px; }
.btn:disabled { opacity: .5; }
.btn.sec { background: var(--bg2); color: var(--text); }
.btn.red { background: var(--bad); }
.btn.green { background: var(--ok); }
.btn.sm { display: inline-block; width: auto; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.link { color: var(--accent); font-weight: 600; }

/* Pastki panel */
#bar { position: fixed; left: 0; right: 0; bottom: 62px; padding: 0 12px 8px; z-index: 20; }
#bar .btn { box-shadow: 0 6px 20px rgba(255,107,0,.35); display: flex; justify-content: space-between; }
#nav { position: fixed; left: 0; right: 0; bottom: 0; height: 62px; background: var(--bg); border-top: 1px solid var(--line);
  display: flex; z-index: 21; padding-bottom: env(safe-area-inset-bottom); }
#nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; color: var(--hint); gap: 2px; position: relative; }
#nav button .ic { font-size: 22px; }
#nav button.on { color: var(--accent); font-weight: 700; }
#nav .dot { position: absolute; top: 6px; right: calc(50% - 22px); background: var(--bad); color: #fff; font-size: 10px;
  border-radius: 999px; padding: 1px 6px; font-weight: 700; }

/* Bloklar */
.box { background: var(--bg); border-radius: var(--r); padding: 14px; margin: 12px 16px; }
.box h3 { margin: 0 0 10px; font-size: 17px; }
.page-title { padding: 16px 16px 0; font-size: 22px; font-weight: 800; margin: 0; }
.list-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.list-item:last-child { border-bottom: 0; }
.thumb { width: 56px; height: 56px; border-radius: 12px; background: var(--bg2) center/cover; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 28px; }
.qty { display: flex; align-items: center; gap: 6px; background: var(--bg2); border-radius: 12px; padding: 2px; }
.qty button { width: 32px; height: 32px; font-size: 20px; font-weight: 700; border-radius: 10px; }
.qty span { min-width: 22px; text-align: center; font-weight: 700; }
.sum-row { display: flex; justify-content: space-between; padding: 4px 0; }
.sum-row.total { font-weight: 800; font-size: 18px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 6px; }

/* Segment va tanlov */
.seg { display: flex; background: var(--bg2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 9px 6px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.seg button.on { background: var(--bg); box-shadow: 0 1px 3px rgba(0,0,0,.1); color: var(--accent); }
.opt { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.opt:last-child { border-bottom: 0; }
.opt .mark { width: 22px; height: 22px; border: 2px solid var(--hint); border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; }
.opt.chk .mark { border-radius: 6px; }
.opt.on .mark { background: var(--accent); border-color: var(--accent); }
.opt.off { opacity: .45; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 13px; color: var(--hint); margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.req { color: var(--bad); }

/* Modal (pastdan chiqadigan) */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; }
.sheet { background: var(--bg); width: 100%; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 0 0 20px; animation: up .22s ease; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.sheet .hero { aspect-ratio: 16/11; background: var(--bg2) center/cover; display: flex; align-items: center;
  justify-content: center; font-size: 90px; position: relative; }
.sheet .pad { padding: 16px; }
.sheet .close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.45); color: #fff; font-size: 18px; }
.sheet-foot { position: sticky; bottom: 0; background: var(--bg); padding: 10px 16px 4px; display: flex; gap: 10px;
  border-top: 1px solid var(--line); }

/* Xarita */
.map-wrap { position: relative; height: 46vh; }
#map { position: absolute; inset: 0; }
.pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); font-size: 40px; z-index: 500;
  pointer-events: none; filter: drop-shadow(0 3px 3px rgba(0,0,0,.3)); }
.map-btn { position: absolute; right: 12px; bottom: 12px; z-index: 500; background: var(--bg); border-radius: 50%;
  width: 46px; height: 46px; font-size: 22px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.addr-line { padding: 12px 16px; background: var(--bg); font-weight: 600; }

/* Buyurtma holati */
.steps { display: flex; justify-content: space-between; position: relative; margin: 8px 0 4px; }
.steps::before { content: ""; position: absolute; left: 14px; right: 14px; top: 14px; height: 3px; background: var(--line); }
.step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; color: var(--hint); width: 20%; text-align: center; }
.step .c { width: 30px; height: 30px; border-radius: 50%; background: var(--bg2); display: flex; align-items: center;
  justify-content: center; font-size: 15px; border: 2px solid var(--line); }
.step.on { color: var(--text); font-weight: 600; }
.step.on .c { background: var(--accent); border-color: var(--accent); }
.status-pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--bg2); }
.st-new { background: #dbeafe; color: #1e40af; }
.st-accepted, .st-cooking { background: #fef3c7; color: #92400e; }
.st-ready, .st-delivering { background: #e0e7ff; color: #3730a3; }
.st-done { background: #dcfce7; color: #166534; }
.st-cancelled { background: #fee2e2; color: #991b1b; }

/* Admin */
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px; background: var(--bg); position: sticky;
  top: 0; z-index: 5; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.order-card { background: var(--bg); border-radius: var(--r); padding: 14px; margin: 10px 16px; border-left: 4px solid var(--line); }
.order-card.late { border-left-color: var(--warn); }
.order-card.very-late { border-left-color: var(--bad); }
.order-card.fresh { border-left-color: var(--ok); }
.stat { background: var(--bg2); border-radius: 12px; padding: 12px; }
.stat .v { font-size: 20px; font-weight: 800; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.bars div { flex: 1; background: var(--accent2); border-radius: 3px 3px 0 0; min-height: 2px; }
.switch { position: relative; width: 46px; height: 28px; background: var(--line); border-radius: 999px; flex-shrink: 0; transition: .2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; background: #fff;
  border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--ok); }
.switch.on::after { left: 21px; }
.group-ed { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; background: var(--bg2); font-size: 16px; flex-shrink: 0; }

.toast { position: fixed; left: 16px; right: 16px; top: 14px; background: #111; color: #fff; padding: 12px 16px;
  border-radius: 12px; z-index: 100; text-align: center; font-weight: 600; animation: up .2s; }
.empty { text-align: center; padding: 50px 20px; color: var(--hint); }
.empty .e { font-size: 60px; margin-bottom: 8px; }
