/* FugaShop · Admin Panel
 * Strategy: Restrained — tinted-gray neutrals + single steel-blue accent ≤10% surface.
 * No glass on cards (inset elevation only). No gradient text. No #fff/#000.
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Surface (cool-tinted gray, not blue) ───────────────────────────── */
  --bg-shell:    oklch(0.13 0.006 250);    /* основной фон */
  --bg-elev-1:   oklch(0.17 0.007 250);    /* sidebar, вдох-поверхность */
  --bg-elev-2:   oklch(0.21 0.008 250);    /* модал */
  --bg-input:    oklch(0.10 0.005 250);    /* впадина инпута */
  --bg-row-hover: oklch(1 0 0 / 0.02);

  /* ── Ink (cool-tinted whites, not #fff) ─────────────────────────────── */
  --ink:         oklch(0.97 0.005 250);
  --ink-muted:   oklch(0.74 0.008 250);
  --ink-low:     oklch(0.58 0.008 250);
  --ink-trace:   oklch(0.45 0.008 250);    /* чуть выше старого .28 — WCAG AA */

  /* ── Hairline (borders) ─────────────────────────────────────────────── */
  --hairline:        oklch(1 0 0 / 0.07);
  --hairline-strong: oklch(1 0 0 / 0.12);

  /* ── Accent: steel-blue (НЕ royal, НЕ neon-cyan) ────────────────────── */
  --accent:      oklch(0.62 0.10 250);
  --accent-soft: oklch(0.62 0.10 250 / 0.14);
  --accent-hot:  oklch(0.70 0.12 250);
  --accent-trace: oklch(0.62 0.10 250 / 0.05);

  /* ── Semantic ───────────────────────────────────────────────────────── */
  --money:       oklch(0.78 0.155 155);    /* emerald, как в магазине */
  --money-soft:  oklch(0.78 0.155 155 / 0.12);
  --danger:      oklch(0.66 0.20 25);
  --danger-soft: oklch(0.66 0.20 25 / 0.14);
  --warn:        oklch(0.78 0.16 75);
  --warn-soft:   oklch(0.78 0.16 75 / 0.14);

  /* ── Layout ─────────────────────────────────────────────────────────── */
  --sidebar-w: 240px;
  --header-h:  60px;

  /* ── Radii (DESIGN.md scale: 8/14/22/28) ────────────────────────────── */
  --r-chip:    8px;
  --r-input:   14px;
  --r-card:    22px;
  --r-modal:   28px;

  /* ── Elevation (inset highlights, как в DESIGN.md) ──────────────────── */
  --elev-card:
    0 1px 0 inset oklch(1 0 0 / 0.06),
    0 -1px 0 inset oklch(0 0 0 / 0.30),
    0 8px 24px -10px oklch(0 0 0 / 0.50);
  --elev-modal:
    0 -1px 0 inset oklch(1 0 0 / 0.10),
    0 -20px 60px -10px oklch(0 0 0 / 0.85);
  --elev-cta:
    0 1px 0 inset oklch(1 0 0 / 0.18),
    0 6px 16px -8px oklch(0.62 0.10 250 / 0.45);

  /* ── Motion ─────────────────────────────────────────────────────────── */
  --ease-out:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-soft: cubic-bezier(0.16, 1, 0.3, 1);
}

html, body { height: 100%; }

body {
  background: var(--bg-shell);
  color: var(--ink);
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Тонкое сияние в правом верху — даёт глубину без glassmorphism. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 600px at 88% -10%, oklch(0.62 0.10 250 / 0.08), transparent 70%),
    radial-gradient(700px 500px at 5% 105%, oklch(0.78 0.155 155 / 0.04), transparent 70%);
}

/* Tabular numbers для денег / id / дат */
.mono, td .mono, .stat-value, .balance-input, [data-num] {
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* ── Scrollbar (тонкий, без глянца) ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: oklch(1 0 0 / 0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: oklch(1 0 0 / 0.16); }

/* ── Preloader ────────────────────────────────────────────────────────── */
#preloader {
  position: fixed; inset: 0;
  background: var(--bg-shell);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity .3s var(--ease-out), visibility .3s var(--ease-out);
}
#preloader.hidden { opacity: 0; visibility: hidden; }
.loader-ring {
  width: 36px; height: 36px;
  border: 2px solid var(--hairline);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login ────────────────────────────────────────────────────────────── */
.login-wrap {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 10;
}
.login-card {
  max-width: 380px; width: 100%;
  background: var(--bg-elev-1);
  border-radius: var(--r-card);
  padding: 36px 28px 28px;
  box-shadow: var(--elev-card);
  text-align: center;
}
.login-logo {
  font-family: 'Unbounded', sans-serif;
  font-size: 28px; font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.login-subtitle {
  color: var(--ink-low);
  margin-bottom: 28px;
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0;
  color: var(--ink-trace);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--hairline);
}
.magic-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  color: var(--ink);
  font-family: inherit; font-size: 13px;
  padding: 11px 14px;
  outline: none;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.magic-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.magic-input::placeholder { color: var(--ink-trace); }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  background: var(--accent);
  color: var(--ink);
  border: none;
  border-radius: var(--r-input);
  font-family: 'Unbounded', sans-serif;
  font-size: 12px; font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 12px 20px;
  cursor: pointer;
  box-shadow: var(--elev-cta);
  transition: background .15s var(--ease-out), transform .12s var(--ease-out);
  margin-top: 8px;
}
.btn-primary:hover { background: var(--accent-hot); }
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.app-wrap {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Sidebar (solid, без backdrop-blur) ───────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--bg-elev-1);
  border-right: 1px solid var(--hairline);
  padding: 0;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s var(--ease-out);
}
.sidebar-header {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--hairline);
}
.sidebar-logo {
  font-family: 'Unbounded', sans-serif;
  font-size: 16px; font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-transform: uppercase;
}
.sidebar-badge {
  font-size: 10px;
  color: var(--ink-trace);
  font-family: ui-monospace, monospace;
  margin-top: 4px;
  letter-spacing: .5px;
}
.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-chip);
  color: var(--ink-low);
  cursor: pointer;
  transition: background .15s var(--ease-out), color .15s var(--ease-out);
  font-size: 13px; font-weight: 500;
  margin-bottom: 1px;
  user-select: none;
  touch-action: manipulation;
  min-height: 40px;
}
.nav-item:hover {
  background: oklch(1 0 0 / 0.03);
  color: var(--ink-muted);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--ink);
  position: relative;
  box-shadow: 0 0 0 1px oklch(0.62 0.10 250 / 0.20) inset;
}
.nav-item.active::after {
  content: '';
  position: absolute;
  right: 8px; top: 50%;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
  box-shadow: 0 0 12px oklch(0.62 0.10 250 / 0.65);
  animation: pulseDot 2.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--hairline);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-chip);
  background: oklch(1 0 0 / 0.02);
}
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hot);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Unbounded', sans-serif;
  font-weight: 900;
  font-size: 13px;
  flex-shrink: 0;
}
.user-info { min-width: 0; flex: 1; }
.user-name {
  font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.user-role {
  font-size: 10px;
  color: var(--ink-trace);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: oklch(0 0 0 / 0.55);
  z-index: 99;
}

/* ── Main / Topbar ────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
.topbar {
  height: var(--header-h);
  display: flex; align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-shell);
  position: sticky; top: 0; z-index: 50;
  gap: 16px;
}
.topbar-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 14px; font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  flex: 1;
  color: var(--ink);
}
.menu-btn {
  display: none;
  background: none; border: none;
  color: var(--ink-low);
  cursor: pointer;
  padding: 6px;
}
.content {
  padding: 24px 24px 56px;
  flex: 1;
  overflow-y: auto;
  max-width: 1280px;
}

/* ── Surface (raised tile, не glass) ──────────────────────────────────── */
.surface,
.card {
  background: var(--bg-elev-1);
  border-radius: var(--r-card);
  box-shadow: var(--elev-card);
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.card { padding: 18px 20px; }

/* Лёгкий лифт при hover — глубина без glass. */
.card:hover,
.surface:hover,
.table-wrap:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 inset oklch(1 0 0 / 0.08),
    0 -1px 0 inset oklch(0 0 0 / 0.30),
    0 14px 32px -10px oklch(0 0 0 / 0.55);
}

/* ── Page header ──────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 22px; font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-transform: uppercase;
}
.page-sub {
  color: var(--ink-trace);
  font-size: 11px;
  margin-top: 6px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ── Stats: text-first overview, без hero-metric template ─────────────── */
.stats-overview {
  background: var(--bg-elev-1);
  border-radius: var(--r-card);
  box-shadow: var(--elev-card);
  padding: 22px 24px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto;
  gap: 28px;
  align-items: center;
}
.stats-lead {
  font-family: 'Unbounded', sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.05;
}
.stats-lead em {
  font-style: normal;
  color: var(--money);
  text-shadow: 0 0 24px oklch(0.78 0.155 155 / 0.35);
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.stats-row {
  display: flex; gap: 22px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-muted);
}
.stats-row > div { display: flex; flex-direction: column; gap: 2px; }
.stats-row .stats-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--ink-trace);
}
.stats-row .stats-value {
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--ink);
}
.stats-row .stats-value.money { color: var(--money); }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-elev-1);
  border-radius: var(--r-card);
  box-shadow: var(--elev-card);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--hairline); }
th {
  text-align: left; padding: 12px 16px;
  font-size: 10px; font-weight: 600;
  color: var(--ink-trace);
  text-transform: uppercase;
  letter-spacing: .8px;
  white-space: nowrap;
  user-select: none;
}
th.th-sort {
  cursor: pointer;
  transition: color .15s var(--ease-out);
}
th.th-sort:hover {
  color: var(--accent-hot);
}
th.th-sort:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--r-chip);
}
td {
  padding: 13px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-muted);
  vertical-align: middle;
}
td:first-child, th:first-child { padding-left: 20px; }
td:last-child, th:last-child { padding-right: 20px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-row-hover); }
td strong, td b { color: var(--ink); font-weight: 600; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px; font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-green  { background: var(--money-soft);  color: var(--money); }
.badge-blue   { background: var(--accent-soft); color: var(--accent-hot); }
.badge-purple { background: var(--accent-soft); color: var(--accent-hot); }
.badge-yellow { background: var(--warn-soft);   color: var(--warn); }
.badge-red    { background: var(--danger-soft); color: var(--danger); }
.badge-gray   { background: oklch(1 0 0 / 0.05); color: var(--ink-low); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-chip);
  font-family: 'Jost', sans-serif;
  font-size: 12px; font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  color: var(--ink-muted);
  transition: background .15s var(--ease-out), color .15s var(--ease-out), border-color .15s var(--ease-out);
  white-space: nowrap;
}
.btn-sm  { padding: 5px 10px; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-accent {
  background: var(--accent);
  color: var(--ink);
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  box-shadow: var(--elev-cta);
}
.btn-accent:hover { background: var(--accent-hot); }

.btn-danger {
  color: var(--danger);
  background: var(--danger-soft);
}
.btn-danger:hover { background: oklch(0.66 0.20 25 / 0.22); }

.btn-outline {
  border-color: var(--hairline-strong);
  color: var(--ink-muted);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--accent-trace);
}

.btn-ghost {
  color: var(--ink-low);
}
.btn-ghost:hover { color: var(--ink); background: oklch(1 0 0 / 0.04); }

.btn svg { width: 14px; height: 14px; stroke-width: 2; }

/* ── Form inputs ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  color: var(--ink-low);
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input::placeholder { color: var(--ink-trace); }
.form-input[type="number"] { font-family: ui-monospace, monospace; }
textarea.form-input { resize: vertical; min-height: 96px; line-height: 1.55; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-actions {
  display: flex; gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

/* ── Toggle ───────────────────────────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px; height: 20px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: oklch(1 0 0 / 0.08);
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s var(--ease-out);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; bottom: 3px;
  background: var(--ink-low);
  border-radius: 50%;
  transition: transform .2s var(--ease-out), background .2s var(--ease-out);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
  background: var(--ink);
}

/* ── Modal (единственное место где допустим backdrop-filter) ──────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: oklch(0 0 0 / 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .2s var(--ease-out) both;
}
.modal {
  width: min(520px, 100% - 24px);
  background: var(--bg-elev-2);
  border-radius: var(--r-modal);
  padding: 24px 24px 22px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: var(--elev-modal);
  animation: slideUp .35s var(--ease-out-soft) both;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-transform: uppercase;
}
.close-btn {
  background: none; border: none;
  color: var(--ink-trace);
  cursor: pointer;
  padding: 6px;
  margin: -6px;
  display: flex; align-items: center;
  border-radius: var(--r-chip);
  transition: color .15s, background .15s;
}
.close-btn:hover { color: var(--ink); background: oklch(1 0 0 / 0.04); }
.close-btn svg { width: 18px; height: 18px; stroke-width: 2; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Upload zone ──────────────────────────────────────────────────────── */
.upload-zone {
  border: 1.5px dashed var(--hairline-strong);
  border-radius: var(--r-input);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s var(--ease-out), background .18s var(--ease-out);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-trace);
}
.upload-zone input { display: none; }
.upload-icon {
  color: var(--ink-trace);
  margin-bottom: 8px;
}
.upload-text {
  font-size: 13px;
  color: var(--ink-muted);
}
.upload-hint {
  font-size: 11px;
  color: var(--ink-trace);
  margin-top: 4px;
  letter-spacing: .3px;
}

/* ── Alert / Toast ────────────────────────────────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: var(--r-input);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.alert-success {
  background: var(--money-soft);
  color: var(--money);
}
.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--ink-trace);
}
.empty-state svg {
  width: 36px; height: 36px;
  margin-bottom: 14px;
  opacity: .5;
  stroke-width: 1.5;
}
.empty-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-low);
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 6px;
  padding: 16px 20px 0;
  justify-content: center;
  flex-wrap: wrap;
}
.page-btn {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-chip);
  color: var(--ink-low);
  cursor: pointer;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease-out);
}
.page-btn:hover {
  border-color: var(--hairline-strong);
  color: var(--ink);
}
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}
.page-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── Animations ───────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up   { animation: fadeUp .28s var(--ease-out) both; }
.fade-up-1 { animation-delay: .04s; }
.fade-up-2 { animation-delay: .08s; }
.fade-up-3 { animation-delay: .12s; }
.fade-up-4 { animation-delay: .16s; }

/* Reduce motion respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ── Mono helper ──────────────────────────────────────────────────────── */
.mono {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: .92em;
}

/* ── Native select (dark option list) ─────────────────────────────────── */
select.form-input option,
select option {
  background: var(--bg-elev-2);
  color: var(--ink);
}
select.form-input { cursor: pointer; }

/* ── Broadcast toolbar ────────────────────────────────────────────────── */
.fmt-toolbar {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: 0;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input) var(--r-input) 0 0;
  border-bottom: none;
}
.fmt-btn {
  background: oklch(1 0 0 / 0.04);
  border: 1px solid transparent;
  border-radius: var(--r-chip);
  color: var(--ink-low);
  font-family: inherit;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: all .15s var(--ease-out);
  line-height: 1.4;
}
.fmt-btn:hover {
  background: var(--accent-soft);
  color: var(--ink);
}
.fmt-toolbar + .form-input {
  border-radius: 0 0 var(--r-input) var(--r-input);
}

/* ── Promo generator ──────────────────────────────────────────────────── */
.gen-row {
  display: flex; gap: 8px; align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.gen-row .form-group { margin-bottom: 0; flex: 1; min-width: 80px; }

/* ── Search bar (users) ───────────────────────────────────────────────── */
.search-bar {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-bar .form-input {
  flex: 1; min-width: 220px;
  padding: 9px 14px;
}

.user-balance-cell {
  display: flex; align-items: center; gap: 6px;
}
.balance-input {
  width: 80px;
  background: var(--bg-input);
  border: 1px solid var(--hairline);
  border-radius: var(--r-chip);
  color: var(--ink);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
  transition: border-color .18s var(--ease-out);
}
.balance-input:focus { border-color: var(--accent); }

/* ── Product image ────────────────────────────────────────────────────── */
.product-img-thumb {
  width: 38px; height: 38px;
  border-radius: var(--r-chip);
  object-fit: cover;
  background: var(--bg-input);
  border: 1px solid var(--hairline);
}
.no-img {
  width: 38px; height: 38px;
  border-radius: var(--r-chip);
  background: var(--bg-input);
  border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-trace);
}
.no-img svg { width: 16px; height: 16px; stroke-width: 1.5; }

/* ── Screen reader only ───────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 240px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: flex; }
  .content { padding: 16px 14px 56px; }
  .stats-overview {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .stats-row { gap: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .modal { padding: 20px 18px 18px; }
  .modal-title { font-size: 14px; }
}

@media (max-width: 480px) {
  th, td { padding: 10px 12px; font-size: 12px; }
  th:first-child, td:first-child { padding-left: 14px; }
  th:last-child, td:last-child { padding-right: 14px; }
  .page-title { font-size: 19px; }
  .stats-lead { font-size: 22px; }
  .pagination { gap: 4px; }
  .page-btn { width: 28px; height: 28px; }
}

/* ── ConfirmDialog (fuga-confirm) ─────────────────────────────────────────
 * Заменяет браузерный confirm(). focus-trap, esc-close, click-outside.
 * Включается через JS-API window.fugaConfirm({...}) → Promise<boolean>.
 */
.fc-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: oklch(0 0 0 / 0.55);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  opacity: 0;
  transition: opacity 180ms var(--ease-out);
  padding: 24px;
}
.fc-backdrop[hidden] { display: none; }
.fc-backdrop.is-open { opacity: 1; }

.fc-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-modal);
  box-shadow: var(--elev-modal);
  padding: 24px 22px 18px;
  width: min(420px, 100%);
  max-width: 92vw;
  outline: none;
  transform: translateY(8px) scale(0.98);
  transition: transform 200ms var(--ease-out-soft);
}
.fc-backdrop.is-open .fc-card { transform: translateY(0) scale(1); }

.fc-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-hot);
  margin-bottom: 14px;
}
.fc-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.fc-icon svg { width: 22px; height: 22px; }

.fc-title {
  font-size: 16px; font-weight: 600; color: var(--ink);
  margin: 0 0 6px; line-height: 1.35;
}
.fc-body {
  font-size: 13.5px; color: var(--ink-muted);
  margin: 0 0 18px; line-height: 1.55;
  word-break: break-word;
}
.fc-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}
.fc-actions .btn { min-width: 96px; }

[data-fc-confirm].is-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: oklch(0.98 0 0);
  box-shadow: 0 1px 0 inset oklch(1 0 0 / 0.18), 0 6px 16px -8px oklch(0.66 0.20 25 / 0.5);
}
[data-fc-confirm].is-danger:hover { filter: brightness(1.08); }

/* Обе иконки в DOM, переключаем display через .is-danger на родителе. */
.fc-icon svg { width: 22px; height: 22px; display: none; }
.fc-icon:not(.is-danger) .fc-icon-ask { display: block; }
.fc-icon.is-danger .fc-icon-warn { display: block; }
