/* Shopgram — общий стиль (тёмная премиальная тема) */
:root {
  --bg: #0f1117;
  --bg2: #161a23;
  --card: #1c212e;
  --card2: #232a3a;
  --line: #2a3245;
  --text: #eef1f7;
  --muted: #8b93a7;
  --accent: #3fa4ff;
  --accent2: #2d7fd6;
  --green: #34c07c;
  --red: #f2555a;
  --amber: #f5b13d;
  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior: none;
}

body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 300px at 85% -50px, rgba(63,164,255,.14), transparent 70%),
    radial-gradient(500px 300px at -60px 100%, rgba(52,192,124,.07), transparent 70%);
  z-index: 0;
}

#app { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; min-height: 100%; }

/* Навигация */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; max-width: 640px; margin: 0 auto;
  background: rgba(22,26,35,.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 1; background: none; border: none; color: var(--muted);
  font-size: 11px; font-family: inherit; padding: 6px 2px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; transition: color .18s;
}
.tabbar button .ico { font-size: 20px; line-height: 1; }
.tabbar button.active { color: var(--accent); }
.tabbar .badge {
  position: absolute; top: 2px; right: calc(50% - 24px);
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* Общие блоки */
.page { padding: 16px 16px 96px; animation: fadein .22s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; letter-spacing: -.02em; }
h2 { font-size: 16px; font-weight: 700; margin: 18px 0 10px; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.big { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.green { color: var(--green); } .red { color: var(--red); } .amber { color: var(--amber); } .accent { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; border-radius: 14px;
  font: 600 15px/1 inherit; font-family: inherit;
  padding: 14px 20px; cursor: pointer; width: 100%;
  transition: transform .12s, background .18s, opacity .18s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--red); }
.btn.success { background: var(--green); }
.btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; width: auto; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* Товар */
.product {
  display: flex; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
}
.product.out { opacity: .5; }
.p-thumb {
  width: 64px; height: 64px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #2b5aa0, #1c212e);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; overflow: hidden;
}
.p-thumb img { width: 100%; height: 100%; object-fit: cover; }
.p-info { flex: 1; min-width: 0; }
.p-name { font-weight: 700; font-size: 15px; }
.p-desc { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-price { font-weight: 800; font-size: 16px; }
.p-stock { font-size: 12px; color: var(--muted); }
.p-stock.low { color: var(--amber); }
.p-stock.out { color: var(--red); }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card2); color: var(--text); font-size: 18px; font-weight: 700;
  cursor: pointer; transition: background .15s;
}
.stepper button:disabled { opacity: .35; }
.stepper .qty { min-width: 22px; text-align: center; font-weight: 700; }

/* Чипы статусов */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
}
.chip.new { background: rgba(63,164,255,.15); color: var(--accent); }
.chip.accepted { background: rgba(52,192,124,.15); color: var(--green); }
.chip.in_progress { background: rgba(245,177,61,.15); color: var(--amber); }
.chip.done { background: rgba(139,147,167,.18); color: var(--muted); }
.chip.cancelled { background: rgba(242,85,90,.15); color: var(--red); }

/* Формы */
label.f { display: block; margin-bottom: 12px; }
label.f span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
input, select, textarea {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-s);
  font: 400 15px inherit; font-family: inherit; padding: 12px 14px;
  outline: none; transition: border .18s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=time] { -webkit-appearance: none; appearance: none; }

/* Тост */
#toast {
  position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #2a3245; color: var(--text); padding: 12px 20px; border-radius: 14px;
  font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 100; max-width: 90%;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: rgba(242,85,90,.2); border-color: rgba(242,85,90,.5); }

/* Прогресс-бар */
.progress {
  height: 10px; border-radius: 5px; background: var(--bg2);
  border: 1px solid var(--line); overflow: hidden;
}
.progress i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), #6fc3ff);
  border-radius: 5px; transition: width .5s ease;
}
.progress.full i { background: linear-gradient(90deg, var(--green), #7ce3ae); }

/* Список */
.list { display: flex; flex-direction: column; gap: 10px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

/* Заголовок */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-top: 12px; }
.topbar h1 { margin: 0; font-size: 20px; flex: 1; }
.back {
  width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Модалка */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 22px 22px 0 0; width: 100%; max-width: 640px;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 85vh; overflow-y: auto;
  animation: slideup .25s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* Сегменты */
.seg {
  display: flex; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 3px; gap: 3px; overflow-x: auto;
}
.seg button {
  flex: 1; border: none; background: none; color: var(--muted);
  font: 600 12.5px inherit; font-family: inherit; padding: 8px 12px;
  border-radius: 9px; cursor: pointer; white-space: nowrap; transition: .15s;
}
.seg button.active { background: var(--card2); color: var(--text); }

/* Пустое состояние */
.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty .ico { font-size: 42px; margin-bottom: 10px; }

/* Грид дашборда */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px;
}
.stat .lbl { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat .val { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }

/* Таблицы-списки (админ) */
.tl { display: flex; flex-direction: column; }
.tl .ti {
  display: flex; align-items: center; gap: 10px; padding: 12px 4px;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.tl .ti:last-child { border-bottom: none; }
.tl .grow { flex: 1; min-width: 0; }

/* Баннер */
.banner {
  background: linear-gradient(120deg, #1e3a5f, #173042);
  border: 1px solid #2a4a6e; border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; position: relative; overflow: hidden;
}
.banner::after {
  content: '🧊'; position: absolute; right: -6px; top: -10px; font-size: 64px; opacity: .18;
}
.banner h3 { font-size: 17px; margin-bottom: 4px; }
.banner p { font-size: 13px; color: #a9c4e2; }

/* Вкладки времени */
.time-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.time-slots button {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 9px 14px; font: 600 13px inherit; font-family: inherit;
  cursor: pointer;
}
.time-slots button.sel { border-color: var(--accent); color: var(--accent); background: rgba(63,164,255,.1); }

.kbd {
  font-family: ui-monospace, monospace; font-size: 12px;
  background: var(--bg2); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: 6px;
}

/* Скелетон */
.skel { background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); height: 72px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (min-width: 480px) { .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; } }
