/* ============================================================
   Pix API v2 — design system
   Clean, compact, mobile-first. One accent (teal), neutral base.
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --surface-sunken: #f1f3f6;

  --line: #e8ebf0;
  --line-strong: #d7dce4;

  --text: #0f1729;
  --text-soft: #3b4658;
  --text-muted: #6b7585;
  --text-faint: #97a0ad;

  --accent: #0f766e;
  --accent-hover: #0c645d;
  --accent-soft: #e7f3f1;
  --accent-ring: rgba(15, 118, 110, 0.16);

  --success: #15803d;
  --success-soft: #e7f6ec;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fdecec;
  --warning: #b45309;
  --warning-soft: #fdf3e2;
  --info: #1d4ed8;
  --info-soft: #e8eefc;

  --sidebar: #0f1419;
  --sidebar-soft: #1a2027;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #c4ccd6;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 14px rgba(16, 24, 40, 0.06), 0 14px 30px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.16);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.auth-body {
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(15, 118, 110, 0.10), transparent 60%),
    radial-gradient(900px 480px at 108% 8%, rgba(29, 78, 216, 0.06), transparent 55%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
::selection { background: var(--accent-ring); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.auth-shell { display: block; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
  transition: background 0.16s ease;
}
.brand:hover { background: var(--sidebar-soft); }
.brand img { width: 28px; height: 28px; border-radius: 7px; }

.sidebar-user {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--sidebar-line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #14b8a6, var(--accent));
  color: #fff;
  font-weight: 800;
  text-transform: uppercase;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-info strong, .sidebar-user-info small {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-info strong { font-size: 13px; color: #fff; font-weight: 650; }
.sidebar-user-info small { font-size: 12px; color: #8b95a1; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }

.nav-link, .logout {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-weight: 550;
  font-size: 13.5px;
  border: 1px solid transparent;
  transition: background 0.16s ease, color 0.16s ease;
}
.nav-link .ico, .logout .ico { width: 19px; height: 19px; flex-shrink: 0; opacity: 0.85; }
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link:hover .ico { opacity: 1; }
.nav-link.active {
  background: rgba(20, 184, 166, 0.16);
  color: #fff;
  box-shadow: inset 2px 0 0 #14b8a6;
}
.nav-link.active .ico { opacity: 1; color: #2dd4bf; }

.sidebar-footer { margin-top: auto; }
.logout {
  width: 100%;
  border-color: var(--sidebar-line);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
}
.logout:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }

.content {
  min-width: 0;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 28px calc(40px + env(safe-area-inset-bottom));
}
.content-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  max-width: none;
}

/* ---------- Typography ---------- */
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; font-weight: 750; }
h1 { font-size: 26px; line-height: 1.15; font-variant-numeric: tabular-nums; }
h2 { font-size: 16px; line-height: 1.3; }
h3 { font-size: 14px; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.eyebrow a { color: var(--accent); }
.lead { margin: 6px 0 0; color: var(--text-muted); line-height: 1.6; font-size: 13.5px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease,
    box-shadow 0.18s ease, transform 0.12s var(--ease-out);
}
.button:hover { background: var(--accent-hover); box-shadow: 0 6px 18px rgba(15, 118, 110, 0.22); }
.button:active { transform: scale(0.975); }
.button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.button-muted {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text-soft);
}
.button-muted:hover { background: var(--surface-soft); border-color: var(--text-faint); color: var(--text); box-shadow: var(--shadow-sm); }

.button-danger { background: var(--danger); }
.button-danger:hover { background: var(--danger-hover); box-shadow: 0 6px 18px rgba(220, 38, 38, 0.22); }

.button-block { width: 100%; }

/* ---------- Forms ---------- */
label { display: grid; gap: 7px; font-weight: 600; font-size: 13px; color: var(--text-soft); }

input, textarea, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
textarea { padding: 10px 12px; min-height: 84px; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:hover, textarea:hover, select:hover { border-color: var(--text-faint); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
input[type="file"] { padding: 9px 12px; }

/* ---------- Panels & cards ---------- */
.panel {
  position: relative;
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.panel:last-child { margin-bottom: 0; }
.panel::-webkit-scrollbar { height: 6px; }
.panel::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}

/* ---------- Grids ---------- */
.split, .docs-grid, .api-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stats-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}
.split > *, .stats-grid > *, .api-grid > *, .docs-grid > * { min-width: 0; }
.api-grid .panel, .stats-grid .panel { margin-bottom: 0; }

/* ---------- Dashboard hero ---------- */
.dash-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1.15fr 0.85fr;
  margin-bottom: 16px;
  align-items: stretch;
}
.dash-grid > * { min-width: 0; margin-bottom: 0; }

.balance-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius);
  color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(45, 212, 191, 0.45), transparent 55%),
    linear-gradient(135deg, #115e58 0%, #0f766e 45%, #0b3f3a 100%);
  box-shadow: 0 18px 40px rgba(15, 118, 110, 0.28);
}
.balance-card::after {
  content: "";
  position: absolute;
  right: -60px; bottom: -90px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.balance-card-top {
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.balance-card-chip {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}
.balance-card-mark { width: 30px; height: 30px; opacity: 0.9; }
.balance-card-amount {
  position: relative; z-index: 1;
  font-size: 36px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.balance-card-amount small { font-size: 16px; font-weight: 600; opacity: 0.8; }
.balance-card-btn {
  position: relative; z-index: 1;
  margin-top: auto; align-self: flex-start;
  background: #fff; color: var(--accent);
}
.balance-card-btn:hover { background: #f0fdfa; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18); }

.dash-prices { display: flex; flex-direction: column; }
.price-line {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.price-line:last-child { border-bottom: 0; }
.price-line span { color: var(--text-muted); font-size: 13.5px; }
.price-line strong { font-size: 14px; font-variant-numeric: tabular-nums; }

/* API key row */
.apikey-row { display: flex; align-items: center; gap: 8px; }
.apikey-row .api-key { flex: 1; min-width: 0; margin: 0; }
.icon-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, transform 0.12s var(--ease-out);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn:active { transform: scale(0.92); }

/* ---------- Stat cards ---------- */
.stat-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.stat-card > span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.stat-card > strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-card > small { color: var(--text-faint); font-size: 12px; }

.premium-card .price-stack { display: grid; gap: 8px; margin-top: 12px; }
.premium-card .price-row b {
  display: flex; justify-content: space-between; gap: 10px;
  font-weight: 650; font-size: 13.5px;
}
.premium-card .price-row b small { color: var(--text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  padding: 0 12px 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--surface-soft); }

.load-more-wrap { display: flex; justify-content: center; margin-top: 14px; }
.load-more-wrap .button { min-width: 180px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  text-transform: capitalize;
}
.badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.badge-paid, .badge-completed, .badge-done, .badge-approved {
  background: var(--success-soft); border-color: rgba(21, 128, 61, 0.2); color: var(--success);
}
.badge-pending, .badge-queued, .badge-processing, .badge-open {
  background: var(--warning-soft); border-color: rgba(180, 83, 9, 0.2); color: var(--warning);
}
.badge-rejected, .badge-failed, .badge-error {
  background: var(--danger-soft); border-color: rgba(220, 38, 38, 0.2); color: var(--danger);
}
.badge-expired, .badge-cancelled, .badge-closed {
  background: var(--surface-sunken); border-color: var(--line-strong); color: var(--text-muted);
}

/* ---------- Code / API key ---------- */
code, pre, .api-key {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
.api-key {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-soft);
  font-size: 12.5px;
  overflow-x: auto;
  white-space: nowrap;
}
pre {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #0f1419;
  color: #e6edf3;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
}
pre code { color: inherit; }
.code-block { position: relative; }
.code-block .copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #c4ccd6;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.12s var(--ease-out);
}
.code-block .copy-btn:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.code-block .copy-btn:active { transform: scale(0.92); }
.code-block .copy-btn.copied { color: #4ade80; border-color: rgba(74, 222, 128, 0.5); }
.icon-btn.copied { color: var(--success); border-color: var(--success); }

/* ---------- Admin: receipt list & pricing form ---------- */
.pricing-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
}
.pricing-form .button { grid-column: 1 / -1; justify-self: start; }

.receipt-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.receipt-item {
  display: grid; gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.receipt-meta { display: grid; gap: 8px; }
.receipt-meta > strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.receipt-meta > span { color: var(--text-muted); font-size: 13px; }
.admin-actions { display: flex; gap: 8px; }
.admin-actions input { flex: 1; min-width: 0; min-height: 38px; }
.receipt-preview img {
  width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block;
}

/* ---------- Login (user) ---------- */
.login-redesign {
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 18px;
  align-items: stretch;
}
.login-card, .login-pricing, .login-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.login-main { padding: 32px; display: flex; flex-direction: column; gap: 26px; }
.login-mark { display: flex; align-items: center; gap: 14px; }
.login-mark img { width: 46px; height: 46px; border-radius: 11px; }
.login-kicker { color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.login-mark h1 { font-size: 24px; }
.login-access { display: flex; flex-direction: column; gap: 16px; }
.login-access h2 { font-size: 15px; color: var(--text-soft); }

.login-pricing { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.login-pricing-head { display: flex; align-items: center; justify-content: space-between; }
.login-pricing-head h2 { font-size: 15px; }
.login-pricing-head span {
  font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 3px 9px; border-radius: var(--radius-pill);
}
.login-price-list { display: grid; gap: 2px; }
.login-price-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.login-price-row:last-child { border-bottom: 0; }
.login-price-row span { color: var(--text-muted); font-size: 13.5px; }
.login-price-row strong { font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- Login (admin) centered ---------- */
.login-layout { width: 100%; max-width: 380px; }
.login-panel { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-panel .button { margin-top: 4px; }

/* ---------- Notices / toasts ---------- */
.notice {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  right: 20px;
  left: auto;
  z-index: 999;
  max-width: 360px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.5;
  cursor: pointer;
  animation: notice-in 0.32s var(--ease-out), notice-out 0.4s ease 4s forwards;
}
@keyframes notice-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes notice-out { to { opacity: 0; transform: translateY(14px); } }
.notice-success { border-color: rgba(21, 128, 61, 0.26); background: var(--success-soft); color: var(--success); }
.notice-error { border-color: rgba(220, 38, 38, 0.22); background: var(--danger-soft); color: var(--danger); }

/* Push permission prompt */
.push-prompt {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 998;
  width: min(320px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.28s var(--ease-out), transform 0.28s var(--ease-out);
}
.push-prompt.show { opacity: 1; transform: none; }
.push-prompt-text { font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.push-prompt-text strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.push-prompt-actions { display: flex; justify-content: flex-end; gap: 8px; }
.push-prompt-actions .button { min-height: 36px; padding: 0 14px; }

@media (max-width: 760px) {
  .push-prompt { left: 16px; right: 16px; width: auto; bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* ============================================================
   Balance — reservation flow
   ============================================================ */
.balance-layout { display: flex; flex-direction: column; gap: 16px; max-width: 540px; }

.reserve-panel { gap: 16px; display: flex; flex-direction: column; animation: panel-in 0.3s var(--ease-out) both; }
@keyframes panel-in {
  from { opacity: 0; transform: scale(0.98) translateY(8px); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.reserve-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reserve-note { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.5; }

.countdown {
  min-width: 78px;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  background: var(--warning-soft);
  border: 1px solid rgba(180, 83, 9, 0.22);
  color: var(--warning);
  font-size: 18px; font-weight: 800; text-align: center;
  font-variant-numeric: tabular-nums;
}
.countdown.countdown-low {
  background: var(--danger-soft); border-color: rgba(220, 38, 38, 0.25); color: var(--danger);
  animation: countdown-pulse 1s ease-in-out infinite;
}
@keyframes countdown-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.copy-field {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.copy-field-body { flex: 1; min-width: 0; }
.copy-field-label {
  display: block; margin-bottom: 3px;
  color: var(--accent); font-size: 11px; font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase;
}
.copy-field-body strong {
  display: block; color: var(--text);
  font-size: 20px; font-weight: 800; line-height: 1.2;
  overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.copy-field-primary { border-color: rgba(15, 118, 110, 0.22); background: var(--accent-soft); }
.copy-field-primary .copy-field-body strong { font-size: 27px; letter-spacing: -0.01em; }
.copy-field-primary .copy-icon { border-color: rgba(15, 118, 110, 0.22); }

.copy-icon {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease, transform 0.12s var(--ease-out);
}
.copy-icon:hover { border-color: var(--accent); color: var(--accent); }
.copy-icon:active { transform: scale(0.9); }
.copy-icon.copied { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.copy-icon svg { display: block; }
.copy-icon.copied svg { animation: copy-pop 0.26s var(--ease-out); }
@keyframes copy-pop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ============================================================
   Gifts catalog
   ============================================================ */
.balance-pill {
  display: inline-flex; align-items: center;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700; font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.gift-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
}

.gift-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: center;
  transition: transform 0.16s var(--ease-out), box-shadow 0.18s ease, border-color 0.16s ease;
}
.gift-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.gift-card:active { transform: translateY(-1px) scale(0.99); }

.gift-badge {
  position: absolute; top: 8px; right: 8px;
  padding: 2px 8px; border-radius: var(--radius-pill);
  background: #fef3c7; color: #b45309;
  font-size: 10px; font-weight: 800; letter-spacing: 0.02em;
}

.gift-anim {
  width: 112px; height: 112px;
  display: grid; place-items: center;
  margin-bottom: 6px;
  overflow: hidden;
}
.gift-anim svg, .gift-anim canvas { width: 100% !important; height: 100% !important; display: block; }
.gift-emoji { font-size: 56px; line-height: 1; }
.gift-anim-lg { width: 128px; height: 128px; margin: 0 auto 8px; }
.gift-anim-lg .gift-emoji { font-size: 76px; }

.gift-price { font-size: 15px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.gift-stars { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.gift-idrow {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  margin-top: 8px;
  padding: 2px 2px 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.gift-idrow:hover { border-color: var(--accent); }
.gift-idrow:active { transform: scale(0.99); }
.gift-idrow.copied { border-color: rgba(21,128,61,.35); background: var(--success-soft); }
.gift-idrow.copied .gift-cid { color: var(--success); }
.gift-idrow.copied .gift-copy { color: var(--success); }
.gift-idrow.copied .gift-copy svg { display: none; }
.gift-idrow.copied .gift-copy::after { content: "✓"; font-size: 13px; font-weight: 800; }
.gift-cid {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gift-copy {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
}
.gift-idrow:hover .gift-copy { color: var(--accent); }

/* Modal */
.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(15, 23, 41, 0.5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal-backdrop.show { opacity: 1; }
.modal {
  position: relative;
  width: min(380px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.24s var(--ease-out);
}
.modal-backdrop.show .modal { transform: none; }
.modal h2 { font-size: 17px; }
.modal form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; text-align: left; }
.modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-muted); cursor: pointer; font-size: 15px;
  transition: background 0.16s ease, color 0.16s ease;
}
.modal-close:hover { background: var(--surface-soft); color: var(--text); }
.gm-meta { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.gm-meta > span:first-child { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gm-id {
  display: inline-flex; align-items: center; gap: 6px;
  align-self: center;
  margin: 2px auto 0;
  padding: 4px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  font-size: 11px; color: var(--text-muted);
  font-family: ui-monospace, monospace;
  cursor: pointer;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: border-color 0.16s ease, color 0.16s ease;
}
.gm-id::after { content: "⧉"; font-size: 12px; }
.gm-id:hover { border-color: var(--accent); color: var(--accent); }
.gm-id.copied { border-color: rgba(21,128,61,.3); color: var(--success); }
.gm-id.copied::after { content: "✓"; }

/* ============================================================
   API docs (zamonaviy, bo'limlarga rangli)
   ============================================================ */
.api-key-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.api-key-bar .k-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.api-key-bar code { flex: 1; min-width: 140px; overflow-x: auto; white-space: nowrap; font-size: 12.5px; color: var(--text-soft); font-family: ui-monospace, monospace; }

.api-sections { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.api-sections > .wide { grid-column: 1 / -1; }
.api-sections > * { min-width: 0; }

.api-card {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
  --c: #0f766e; --cbg: #e7f3f1;
}
.api-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
.api-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px 13px 18px;
  background: var(--cbg); border-bottom: 1px solid var(--line);
}
.api-card-head h2 { font-size: 13.5px; font-family: ui-monospace, monospace; font-weight: 700; color: var(--text); letter-spacing: 0; }
.api-card-body { padding: 14px 16px; }
.api-card-body pre { margin-top: 10px; }
.method {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .03em;
  color: #fff; background: var(--c);
}
.tag-public { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--c); background: var(--surface); padding: 2px 9px; border-radius: var(--radius-pill); border: 1px solid var(--c); }

.api-params { width: 100%; margin-top: 10px; font-size: 12px; }
.api-params td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.api-params tr:last-child td { border-bottom: 0; }
.api-params td:first-child { font-family: ui-monospace, monospace; color: var(--c); font-weight: 600; white-space: nowrap; }

.c-green  { --c: #16a34a; --cbg: #e9f7ee; }
.c-teal   { --c: #0f766e; --cbg: #e3f3f0; }
.c-indigo { --c: #4f46e5; --cbg: #ecebfd; }
.c-rose   { --c: #db2777; --cbg: #fce7f1; }
.c-purple { --c: #7c3aed; --cbg: #f1e9fe; }
.c-slate  { --c: #475569; --cbg: #eef1f5; }

/* getInfo RPS segment */
.rps-box { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); }
.rps-current { font-size: 13px; color: var(--text-soft); }
.rps-current b { color: var(--c); }
.rps-seg { display: flex; gap: 8px; }
.rps-opt {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 12px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; text-align: center;
  transition: border-color .16s ease, background .16s ease, transform .12s var(--ease-out);
}
.rps-opt:hover { border-color: var(--c); }
.rps-opt:active { transform: scale(.98); }
.rps-opt.active { border-color: var(--c); background: var(--cbg); cursor: default; box-shadow: inset 0 0 0 1px var(--c); }
.rps-opt .rps-n { font-size: 17px; font-weight: 800; color: var(--text); }
.rps-opt .rps-p { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rps-opt.active .rps-n { color: var(--c); }
.rps-opt.active .rps-p { color: var(--c); }

/* ---------- Utilities ---------- */
.hide-mobile { } /* visible on desktop; hidden in mobile breakpoint below */

/* ============================================================
   Responsive — tablet & mobile
   ============================================================ */
@media (max-width: 980px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .premium-card { grid-column: 1 / -1; }
  .login-redesign { grid-template-columns: 1fr; max-width: 460px; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }

  /* Sidebar -> compact sticky top bar (brand + logout) */
  .sidebar {
    position: sticky; top: 0; z-index: 50;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    padding-top: max(9px, env(safe-area-inset-top));
    border-right: 0;
    border-bottom: 1px solid var(--sidebar-line);
  }
  .brand { flex: 1; min-height: 38px; }
  .sidebar-user { display: none; }

  /* nav -> fixed bottom tab bar (app-like) */
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    flex-direction: row;
    gap: 2px;
    margin: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(12, 17, 23, 0.9);
    -webkit-backdrop-filter: saturate(1.5) blur(14px);
    backdrop-filter: saturate(1.5) blur(14px);
    border-top: 1px solid var(--sidebar-line);
  }
  .nav-link {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-height: 52px;
    padding: 7px 4px;
    border-radius: 11px;
    font-size: 10.5px;
    font-weight: 600;
    text-align: center;
  }
  .nav-link .ico { width: 22px; height: 22px; opacity: 0.9; }
  .nav-link.active { background: rgba(20, 184, 166, 0.16); box-shadow: none; }

  /* footer logout -> icon button in top bar */
  .sidebar-footer { margin: 0; }
  .logout {
    width: 42px; height: 42px; min-height: 42px;
    padding: 0; justify-content: center;
  }
  .logout span { display: none; }
  .logout .ico { width: 20px; height: 20px; }

  .content { padding: 16px 16px calc(82px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 16px; }
  h1 { font-size: 22px; }

  .split, .docs-grid, .api-grid, .stats-grid, .dash-grid, .api-sections { grid-template-columns: 1fr; }
  .api-sections > .wide { grid-column: auto; }
  .premium-card { grid-column: auto; }

  .balance-layout { max-width: none; }
  .hide-mobile { display: none !important; }

  .notice { left: 16px; right: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); max-width: none; }
  .receipt-list { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .content { padding: 16px 13px calc(24px + env(safe-area-inset-bottom)); }
  .panel { padding: 16px; border-radius: 12px; }
  h1 { font-size: 20px; }
  .stat-card > strong { font-size: 24px; }
  .copy-field-primary .copy-field-body strong { font-size: 24px; }
  .login-main, .login-pricing, .login-panel { padding: 22px; }
  .admin-actions { flex-direction: column; }
  .admin-actions .button { width: 100%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
