/* Paketchi design tokens — shared by shop (/) and back-office (/admin/).
   Light/dark follow Telegram theme (body gets .dark from api.js) or the OS when opened in a browser. */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* brand: sky blue #0593C6 + white #FCFFFF; amber accent for promos */
  --brand: #0593C6;
  --brand-strong: #047aa6;
  --brand-soft: #e2f3fa;
  --on-brand: #ffffff;
  --accent: #e8962e;
  --accent-soft: #fdf0dc;

  --bg: #f2f7fa;          /* page */
  --surface: #fcffff;     /* cards */
  --surface-2: #edf3f6;   /* inputs, chips */
  --border: #dfe8ee;
  --text: #0e2633;
  --text-2: #587080;
  --text-3: #8aa0ad;

  --ok: #1f9d55;   --ok-soft: #e2f5e9;
  --warn: #d98a00; --warn-soft: #fff3d6;
  --danger: #d6453d; --danger-soft: #fde6e4;
  --info: #2f6fd6; --info-soft: #e3ecfb;

  /* order status colors */
  --st-new: #2f6fd6;
  --st-accepted: #7a4fd6;
  --st-assembled: #d98a00;
  --st-delivering: #0f8fa8;
  --st-delivered: #1f9d55;
  --st-cancelled: #8d958f;

  --r-sm: 8px; --r: 12px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(5, 60, 90, .06), 0 1px 1px rgba(5, 60, 90, .04);
  --sh-2: 0 6px 20px rgba(5, 60, 90, .08), 0 2px 6px rgba(5, 60, 90, .05);
  --sh-3: 0 18px 50px rgba(5, 60, 90, .16);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --fs-xs: 12px; --fs-sm: 13px; --fs: 15px; --fs-md: 17px; --fs-lg: 20px; --fs-xl: 26px; --fs-2xl: 32px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) { --_auto-dark: 1; }
}

:root.dark {
  --brand: #2bb0e0;
  --brand-strong: #5cc6ec;
  --brand-soft: #0d3445;
  --on-brand: #ffffff;
  --accent: #f0a646;
  --accent-soft: #3a2a12;
  --bg: #08141b;
  --surface: #0f212b;
  --surface-2: #16303d;
  --border: #21404f;
  --text: #e6f3f8;
  --text-2: #9db6c3;
  --text-3: #6d8a99;
  --ok-soft: #12321f; --warn-soft: #3a2c0c; --danger-soft: #3d1715; --info-soft: #14243f;
  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 6px 20px rgba(0,0,0,.35);
  --sh-3: 0 18px 50px rgba(0,0,0,.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs); line-height: 1.4;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--brand); }

/* tiny shared primitives (apps may extend) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--r);
  background: var(--surface-2); color: var(--text); font-weight: 700; cursor: pointer;
  transition: transform .12s var(--ease), background .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-block { width: 100%; }

.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1.5px solid transparent;
  border-radius: var(--r); background: var(--surface-2); outline: none; transition: border-color .15s, background .15s;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); background: var(--surface); }
.label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); margin: 0 0 6px; }

.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border);
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; cursor: pointer;
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.badge-new { background: var(--info-soft); color: var(--info); }
.badge-hit { background: var(--accent-soft); color: var(--accent); }
.badge-sale { background: var(--danger-soft); color: var(--danger); }

.status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.status-new { --c: var(--st-new); } .status-accepted { --c: var(--st-accepted); }
.status-assembled { --c: var(--st-assembled); } .status-delivering { --c: var(--st-delivering); }
.status-delivered { --c: var(--st-delivered); } .status-cancelled { --c: var(--st-cancelled); }

.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }

/* toast */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(24px + var(--safe-bottom)); display: flex; flex-direction: column;
  align-items: center; gap: 8px; z-index: 1000; pointer-events: none; padding: 0 16px; }
.toast { max-width: 420px; padding: 12px 16px; border-radius: var(--r); background: var(--text); color: var(--bg);
  font-weight: 600; box-shadow: var(--sh-3); animation: toast-in .25s var(--ease); pointer-events: auto; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: skel 1.3s ease infinite; border-radius: var(--r); }
@keyframes skel { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* dev user switcher (only in DEV_MODE, injected by api.js) */
.dev-switch { position: fixed; z-index: 2000; right: 8px; top: 8px; font-size: 12px; }
.dev-switch select { font-size: 12px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); box-shadow: var(--sh-2); max-width: 190px; }
