/* ==========================================================================
   MSavdogar 4.0 — shared component styles
   Tailwind (CDN) handles layout utilities; this file defines the design
   tokens and the single set of components every page reuses:
   card · button · input · badge · alert · toast · modal · nav · tables.
   ========================================================================== */

:root {
  --c-bg: #0a0d14;
  --c-surface-1: #101522;
  --c-surface-2: #151c2c;
  --c-surface-3: #1c2438;
  --c-border: rgba(255, 255, 255, 0.08);
  --c-border-strong: rgba(255, 255, 255, 0.14);
  --c-text: #e2e8f0;
  --c-text-strong: #f8fafc;
  --c-muted: #94a3b8;
  --c-faint: #64748b;
  --c-brand: #6366f1;
  --c-brand-600: #4f46e5;
  --c-brand-700: #4338ca;
  --c-brand-300: #a5b4fc;
  --c-success: #10b981;
  --c-warning: #f59e0b;
  --c-danger: #f43f5e;
  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 18px;
  --header-h: 64px;
  --bnav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* --- base ---------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; background: var(--c-bg); }
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: "Plus Jakarta Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(99, 102, 241, 0.45); color: #fff; }
[hidden] { display: none !important; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid #818cf8; outline-offset: 2px; border-radius: 6px; }
a { -webkit-tap-highlight-color: transparent; }
button { -webkit-tap-highlight-color: transparent; }
.mono, code, kbd, pre { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
.tabular { font-variant-numeric: tabular-nums; }
.pre-line { white-space: pre-line; overflow-wrap: anywhere; }
.break-anywhere { overflow-wrap: anywhere; }
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 1100;
  padding: 10px 14px; border-radius: var(--radius); background: var(--c-brand-600); color: #fff; font-weight: 600;
  transition: top 0.15s;
}
.skip-link:focus { top: 12px; }

/* ambient glow behind everything */
.ambient {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(640px 420px at 8% -8%, rgba(99, 102, 241, 0.16), transparent 62%),
    radial-gradient(520px 380px at 100% 4%, rgba(16, 185, 129, 0.07), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, rgba(79, 70, 229, 0.07), transparent 60%);
}

/* --- layout -------------------------------------------------------------- */
.page { width: 100%; max-width: 72rem; margin: 0 auto; padding: 24px 16px 48px; }
.page-narrow { max-width: 46rem; }
.page-tight { max-width: 30rem; }
@media (min-width: 640px) { .page { padding: 36px 24px 64px; } }

.h1 { font-size: 24px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; color: var(--c-text-strong); }
.h2 { font-size: 18px; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; color: var(--c-text-strong); }
@media (min-width: 640px) { .h1 { font-size: 30px; } .h2 { font-size: 20px; } }
.muted { color: var(--c-muted); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-brand-300); }
.text-gradient {
  background: linear-gradient(90deg, #c7d2fe, #818cf8 45%, #34d399);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.divider { height: 1px; background: var(--c-border); border: 0; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--c-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--c-border); }

/* --- header -------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 700;
  background: rgba(10, 13, 20, 0.84);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--c-border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px;
  background: linear-gradient(135deg, #818cf8, #4f46e5 55%, #4338ca);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 6px 16px -6px rgba(79, 70, 229, 0.7);
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; color: var(--c-text-strong); }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: #cbd5e1;
  transition: background-color 0.15s, color 0.15s;
}
.nav-link i { font-size: 13px; color: var(--c-muted); }
.nav-link:hover { background: rgba(148, 163, 184, 0.1); color: #fff; }
.nav-link[aria-current="page"] { color: #fff; background: rgba(99, 102, 241, 0.14); }
.nav-link[aria-current="page"] i { color: var(--c-brand-300); }

.user-btn {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 4px;
  border-radius: 999px; border: 1px solid var(--c-border-strong); background: rgba(21, 28, 44, 0.7);
  color: var(--c-text); font-size: 14px; font-weight: 600; transition: border-color 0.15s, background-color 0.15s;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { border-color: rgba(129, 140, 248, 0.5); background: var(--c-surface-2); }
.balance-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 999px;
  background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.25);
  color: #6ee7b7; font-size: 13px; font-weight: 700; transition: background-color 0.15s;
}
.balance-chip:hover { background: rgba(16, 185, 129, 0.14); }

/* dropdown */
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 750; min-width: 248px;
  padding: 6px; border-radius: 16px; background: var(--c-surface-1);
  border: 1px solid var(--c-border-strong); box-shadow: var(--shadow-lg);
  animation: pop-in 0.14s ease-out;
}
.menu-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--c-border); margin-bottom: 6px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: #cbd5e1; text-align: left; transition: background-color 0.12s, color 0.12s;
}
.menu-item > i { width: 18px; text-align: center; color: var(--c-muted); font-size: 14px; }
.menu-item:hover, .menu-item:focus-visible { background: rgba(148, 163, 184, 0.1); color: #fff; outline: none; }
.menu-item:hover > i { color: var(--c-brand-300); }
.menu-item[aria-current="page"] { background: rgba(99, 102, 241, 0.12); color: #fff; }
.menu-item[aria-current="page"] > i { color: var(--c-brand-300); }
.menu-item.is-danger { color: #fda4af; }
.menu-item.is-danger > i { color: #fb7185; }
.menu-item.is-danger:hover { background: rgba(244, 63, 94, 0.1); color: #fecdd3; }
.menu-sep { height: 1px; background: var(--c-border); margin: 6px 4px; }
.menu-label { padding: 10px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-faint); }

/* --- bottom navigation (logged-in, < 1024px) ------------------------------ */
.bnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;
  background: rgba(10, 13, 20, 0.94);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--c-border);
  padding-bottom: var(--safe-b);
}
.bnav-inner { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: var(--bnav-h); max-width: 560px; margin: 0 auto; }
.bnav a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--c-muted); transition: color 0.15s;
}
.bnav a i { font-size: 18px; }
.bnav a:hover { color: #e2e8f0; }
.bnav a[aria-current="page"] { color: #c7d2fe; }
.bnav a[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 3px; margin-left: -14px;
  border-radius: 0 0 4px 4px; background: var(--c-brand);
}
body.has-bnav { padding-bottom: calc(var(--bnav-h) + var(--safe-b)); }
@media (min-width: 1024px) {
  .bnav { display: none; }
  body.has-bnav { padding-bottom: 0; }
}

/* --- footer -------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--c-border); background: rgba(7, 10, 17, 0.7); margin-top: auto; }
.footer-link { color: var(--c-muted); font-size: 14px; transition: color 0.15s; }
.footer-link:hover { color: #fff; }

/* --- cards --------------------------------------------------------------- */
.card {
  position: relative;
  background: rgba(16, 21, 34, 0.78);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
}
@media (min-width: 768px) {
  .card { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
}
.card-pad { padding: 20px; }
@media (min-width: 640px) { .card-pad { padding: 24px; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--c-border); }
@media (min-width: 640px) { .card-head { padding: 18px 24px; } }
.card-title { font-size: 16px; font-weight: 700; color: var(--c-text-strong); letter-spacing: -0.01em; }
.card-subtitle { font-size: 13px; color: var(--c-muted); margin-top: 2px; }
.card-body { padding: 20px; }
@media (min-width: 640px) { .card-body { padding: 24px; } }
.card-body.is-flush { padding: 0; }
.card-hover { transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s; }
.card-hover:hover { border-color: rgba(129, 140, 248, 0.4); box-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.7); }
.card-accent { border-color: rgba(99, 102, 241, 0.35); background: linear-gradient(180deg, rgba(79, 70, 229, 0.14), rgba(16, 21, 34, 0.82) 55%); }
.stretched-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }

.icon-tile {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center;
  background: rgba(99, 102, 241, 0.12); border: 1px solid rgba(99, 102, 241, 0.25); color: var(--c-brand-300); font-size: 16px;
}
.icon-tile.is-success { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.25); color: #6ee7b7; }
.icon-tile.is-warning { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.25); color: #fcd34d; }
.icon-tile.is-danger { background: rgba(244, 63, 94, 0.1); border-color: rgba(244, 63, 94, 0.28); color: #fda4af; }
.icon-tile.is-neutral { background: rgba(148, 163, 184, 0.08); border-color: var(--c-border-strong); color: #cbd5e1; }
.icon-tile.is-lg { width: 52px; height: 52px; border-radius: 16px; font-size: 20px; }

.stat-label { font-size: 12px; font-weight: 600; color: var(--c-muted); }
.stat-value { font-size: 20px; font-weight: 800; color: var(--c-text-strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* --- buttons ------------------------------------------------------------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: var(--radius); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap; text-decoration: none;
  cursor: pointer; user-select: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.06s;
}
.btn:active { transform: translateY(1px); }
.btn > i { font-size: 0.95em; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-sm); gap: 6px; }
.btn-lg { min-height: 50px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 42px; }
.btn-sm.btn-icon { width: 34px; }
.btn-lg.btn-icon { width: 50px; }

html .btn-primary {
  background: linear-gradient(180deg, #5856ee, #4f46e5); color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 8px 22px -10px rgba(79, 70, 229, 0.8);
}
html .btn-primary:hover { background: linear-gradient(180deg, #4f46e5, #4338ca); }
html .btn-secondary { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-border-strong); }
html .btn-secondary:hover { background: var(--c-surface-3); border-color: rgba(255, 255, 255, 0.22); color: #fff; }
/* ghost colour stays at class specificity so text-* utilities (e.g. text-rose-300) can tint it */
.btn-ghost { color: #cbd5e1; }
html .btn-ghost { background: transparent; }
html .btn-ghost:hover { background: rgba(148, 163, 184, 0.1); }
.btn-ghost:hover { color: #fff; }
html .btn-danger { background: rgba(244, 63, 94, 0.1); color: #fda4af; border-color: rgba(244, 63, 94, 0.32); }
html .btn-danger:hover { background: #e11d48; border-color: #e11d48; color: #fff; }

.btn[disabled], .btn.is-disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; box-shadow: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
html .btn-secondary.is-loading::after, html .btn-ghost.is-loading::after { border-color: rgba(203, 213, 225, 0.25); border-top-color: #e2e8f0; }
html .btn-danger.is-loading::after { border-color: rgba(253, 164, 175, 0.3); border-top-color: #fda4af; }

.link { color: var(--c-brand-300); font-weight: 600; text-underline-offset: 3px; }
.link:hover { color: #c7d2fe; text-decoration: underline; }

.spinner {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(203, 213, 225, 0.2); border-top-color: var(--c-brand-300); animation: spin 0.7s linear infinite;
}
.spinner.is-lg { width: 28px; height: 28px; border-width: 3px; }

/* --- forms --------------------------------------------------------------- */
.field + .field { margin-top: 16px; }
.label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #cbd5e1; }
.label .req { color: #fb7185; }
.help { margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--c-muted); }
.field-error { margin-top: 6px; font-size: 12px; line-height: 1.5; color: #fda4af; }
.input {
  display: block; width: 100%; min-height: 44px; padding: 10px 14px;
  background: rgba(10, 13, 20, 0.7); color: #f1f5f9;
  border: 1px solid var(--c-border-strong); border-radius: var(--radius);
  font-size: 16px; line-height: 1.4; appearance: none; -webkit-appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
@media (min-width: 640px) { .input { font-size: 14px; } }
.input::placeholder { color: #7d8ba1; opacity: 1; }
.input:hover { border-color: rgba(255, 255, 255, 0.22); }
.input:focus { outline: none; border-color: var(--c-brand); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.28); background: rgba(10, 13, 20, 0.9); }
.input.is-invalid, .input[aria-invalid="true"] { border-color: rgba(244, 63, 94, 0.7); }
.input.is-invalid:focus, .input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.25); }
.input.is-valid { border-color: rgba(16, 185, 129, 0.6); }
.input:disabled, .input[readonly] { opacity: 0.7; cursor: not-allowed; }
textarea.input { min-height: 112px; resize: vertical; }
select.input {
  padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
select.input option { background: var(--c-surface-1); color: var(--c-text); }
.input-lg { min-height: 52px; font-size: 18px; }
.input-code { text-align: center; letter-spacing: 0.5em; font-family: "JetBrains Mono", monospace; font-size: 22px; font-weight: 600; padding-left: calc(14px + 0.5em); }
.input-group { position: relative; }
.input-group > .input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--c-faint); pointer-events: none; font-size: 14px; }
.input-group > .input.has-icon { padding-left: 42px; }
.input-group > .input-suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.input-group > .input.has-suffix { padding-right: 56px; }

.check { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--c-brand); cursor: pointer; margin-top: 2px; }

/* switch toggle */
.switch { position: relative; flex-shrink: 0; width: 42px; height: 24px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--c-surface-3); border: 1px solid var(--c-border-strong); transition: background-color 0.15s, border-color 0.15s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #cbd5e1; transition: transform 0.15s, background-color 0.15s; }
.switch input:checked + .switch-track { background: var(--c-brand-600); border-color: var(--c-brand); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .switch-track { outline: 2px solid #818cf8; outline-offset: 2px; }

/* selectable option cards (radio) */
.option-card {
  position: relative; display: flex; gap: 14px; padding: 16px; border-radius: 16px; cursor: pointer;
  background: rgba(10, 13, 20, 0.5); border: 1px solid var(--c-border-strong);
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.option-card:hover { border-color: rgba(129, 140, 248, 0.45); }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card .option-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #475569; flex-shrink: 0; margin-top: 2px; display: grid; place-items: center; transition: border-color 0.15s; }
.option-card .option-dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c-brand); transform: scale(0); transition: transform 0.15s; }
.option-card:has(input:checked) { border-color: var(--c-brand); background: rgba(99, 102, 241, 0.1); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16); }
.option-card:has(input:checked) .option-dot { border-color: var(--c-brand); }
.option-card:has(input:checked) .option-dot::after { transform: scale(1); }
.option-card:has(input:focus-visible) { outline: 2px solid #818cf8; outline-offset: 2px; }

/* star rating input (row-reverse trick) */
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 6px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 28px; line-height: 1; color: #334155; cursor: pointer; transition: color 0.1s, transform 0.1s; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: #fbbf24; }
.star-input label:active { transform: scale(0.92); }
.star-input input:focus-visible + label { outline: 2px solid #818cf8; outline-offset: 3px; border-radius: 4px; }

/* --- badges & chips ------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; line-height: 1; white-space: nowrap; border: 1px solid transparent;
}
.badge > i { font-size: 10px; }
.badge-neutral { background: rgba(148, 163, 184, 0.12); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.22); }
.badge-brand { background: rgba(99, 102, 241, 0.15); color: #c7d2fe; border-color: rgba(99, 102, 241, 0.32); }
.badge-success { background: rgba(16, 185, 129, 0.12); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
.badge-danger { background: rgba(244, 63, 94, 0.12); color: #fda4af; border-color: rgba(244, 63, 94, 0.32); }
.badge-info { background: rgba(56, 189, 248, 0.12); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.3); }
.badge-vip { background: linear-gradient(90deg, rgba(245, 158, 11, 0.2), rgba(234, 179, 8, 0.12)); color: #fde68a; border-color: rgba(245, 158, 11, 0.4); }
.badge-solid { background: #e11d48; color: #fff; border-color: transparent; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; height: 36px; padding: 0 14px; border-radius: 999px;
  background: rgba(16, 21, 34, 0.8); border: 1px solid var(--c-border-strong); color: #cbd5e1;
  font-size: 13px; font-weight: 600; white-space: nowrap; transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: rgba(129, 140, 248, 0.45); color: #fff; }
.chip[aria-current="true"], .chip[aria-current="page"], .chip.is-active { background: rgba(99, 102, 241, 0.16); border-color: rgba(129, 140, 248, 0.55); color: #e0e7ff; }
.scroller { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.scroller::-webkit-scrollbar { display: none; }

/* --- avatar -------------------------------------------------------------- */
.avatar {
  position: relative; flex-shrink: 0; display: inline-grid; place-items: center; overflow: hidden; border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #4338ca); color: #fff; font-weight: 700; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 24px; height: 24px; font-size: 11px; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-md { width: 40px; height: 40px; font-size: 15px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 80px; height: 80px; font-size: 28px; border-radius: 24px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #475569; display: inline-block; flex-shrink: 0; }
.status-dot.is-online { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }

/* --- alerts -------------------------------------------------------------- */
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid; font-size: 14px; line-height: 1.55; }
.alert > i { margin-top: 3px; font-size: 15px; flex-shrink: 0; }
.alert-title { font-weight: 700; color: #fff; }
.alert-info { background: rgba(99, 102, 241, 0.08); border-color: rgba(99, 102, 241, 0.28); color: #c7d2fe; }
.alert-info > i { color: #818cf8; }
.alert-success { background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.28); color: #a7f3d0; }
.alert-success > i { color: #34d399; }
.alert-warning { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.28); color: #fde68a; }
.alert-warning > i { color: #fbbf24; }
.alert-error { background: rgba(244, 63, 94, 0.08); border-color: rgba(244, 63, 94, 0.3); color: #fecdd3; }
.alert-error > i { color: #fb7185; }

/* --- toasts -------------------------------------------------------------- */
.toast-root {
  position: fixed; z-index: 1000; top: calc(var(--header-h) + 10px); left: 16px; right: 16px;
  display: flex; flex-direction: column; align-items: stretch; gap: 8px; pointer-events: none;
}
@media (min-width: 640px) { .toast-root { left: auto; right: 20px; width: 380px; } }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px;
  border-radius: 14px; background: rgba(21, 28, 44, 0.97); border: 1px solid var(--c-border-strong);
  border-left-width: 3px; box-shadow: var(--shadow-lg); color: var(--c-text); font-size: 14px; line-height: 1.5;
  animation: toast-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.is-leaving { animation: toast-out 0.18s ease-in forwards; }
.toast-icon { margin-top: 3px; font-size: 15px; }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-x { width: 26px; height: 26px; border-radius: 8px; color: var(--c-muted); display: grid; place-items: center; flex-shrink: 0; }
.toast-x:hover { background: rgba(148, 163, 184, 0.12); color: #fff; }
.toast-success { border-left-color: #10b981; } .toast-success .toast-icon { color: #34d399; }
.toast-error { border-left-color: #f43f5e; } .toast-error .toast-icon { color: #fb7185; }
.toast-warning { border-left-color: #f59e0b; } .toast-warning .toast-icon { color: #fbbf24; }
.toast-info { border-left-color: #6366f1; } .toast-info .toast-icon { color: #818cf8; }

/* --- modal / sheet / drawer ---------------------------------------------- */
html.modal-open, html.modal-open body { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 900; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(2, 6, 12, 0.72);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.2s ease;
}
.modal-panel {
  position: relative; display: flex; flex-direction: column; width: 100%; max-height: calc(100dvh - 32px);
  background: var(--c-surface-1); border: 1px solid var(--c-border-strong); border-bottom: 0;
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); padding-bottom: var(--safe-b);
  transform: translateY(28px); opacity: 0; transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
  overflow: hidden;
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal.is-open .modal-panel { transform: none; opacity: 1; }
.modal-handle { width: 40px; height: 4px; border-radius: 99px; background: #334155; margin: 8px auto 0; flex-shrink: 0; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--c-border); flex-shrink: 0; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--c-text-strong); letter-spacing: -0.01em; }
.modal-body { padding: 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; }
.modal-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--c-border); flex-shrink: 0; }
.modal-footer > .btn { flex: 1 1 auto; }
@media (min-width: 640px) {
  .modal { align-items: center; padding: 24px; }
  .modal-panel { max-width: 480px; border-radius: 22px; border-bottom: 1px solid var(--c-border-strong); max-height: calc(100dvh - 48px); padding-bottom: 0; transform: translateY(12px) scale(0.98); }
  .modal-handle { display: none; }
  .modal-footer > .btn { flex: 0 0 auto; }
  .modal-sm .modal-panel { max-width: 420px; }
  .modal-lg .modal-panel { max-width: 680px; }
}

/* right-side drawer (mobile navigation) */
.modal--drawer { align-items: stretch; justify-content: flex-end; padding: 0 !important; }
.modal--drawer .modal-panel {
  width: min(88vw, 360px); max-width: none; height: 100%; max-height: none; border-radius: 0;
  border: 0; border-left: 1px solid var(--c-border-strong); transform: translateX(100%); opacity: 1; padding-bottom: var(--safe-b);
}
.modal--drawer.is-open .modal-panel { transform: none; }

/* chat sheet: bottom sheet on phones, docked panel on desktop */
.modal--chat .modal-panel { height: min(88dvh, 720px); }
@media (min-width: 640px) {
  .modal--chat { align-items: flex-end; justify-content: flex-end; }
  .modal--chat .modal-panel { max-width: 420px; height: min(680px, calc(100dvh - 48px)); }
  .modal--chat .modal-backdrop { background: rgba(2, 6, 12, 0.4); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* --- chat ---------------------------------------------------------------- */
.chat-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; background: rgba(10, 13, 20, 0.5); }
.chat-list { display: flex; flex-direction: column; gap: 6px; }
.chat-day { align-self: center; margin: 10px 0 4px; padding: 3px 10px; border-radius: 999px; background: rgba(148, 163, 184, 0.1); color: var(--c-muted); font-size: 11.5px; font-weight: 600; }
.chat-msg { display: flex; flex-direction: column; max-width: 84%; }
.chat-msg.is-mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.is-theirs { align-self: flex-start; align-items: flex-start; }
.chat-msg.is-system { align-self: center; max-width: 92%; }
.chat-bubble { position: relative; padding: 8px 12px 6px; border-radius: 16px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.is-mine .chat-bubble { background: var(--c-brand-600); color: #fff; border-bottom-right-radius: 6px; }
.is-theirs .chat-bubble { background: var(--c-surface-3); color: var(--c-text); border-bottom-left-radius: 6px; }
.is-system .chat-bubble { background: rgba(245, 158, 11, 0.1); color: #fde68a; font-size: 13px; text-align: center; }
.chat-quote { margin-bottom: 6px; padding: 4px 8px; border-left: 3px solid rgba(255, 255, 255, 0.5); border-radius: 6px; background: rgba(0, 0, 0, 0.18); font-size: 12.5px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.chat-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 11px; color: var(--c-faint); }
.chat-reply-btn { color: var(--c-muted); font-size: 11px; font-weight: 600; opacity: 0; transition: opacity 0.15s; }
.chat-msg:hover .chat-reply-btn, .chat-reply-btn:focus-visible { opacity: 1; }
@media (hover: none) { .chat-reply-btn { opacity: 1; } }
.chat-compose { padding: 10px 12px; border-top: 1px solid var(--c-border); background: var(--c-surface-1); flex-shrink: 0; }
.chat-reply { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 6px 8px 6px 10px; border-left: 3px solid var(--c-brand); border-radius: 8px; background: rgba(99, 102, 241, 0.08); font-size: 13px; }
.chat-input { min-height: 44px !important; max-height: 140px; resize: none !important; padding-top: 11px; }

/* --- product gallery & cards -------------------------------------------- */
.media { position: relative; overflow: hidden; background: linear-gradient(135deg, #151c2c, #101522); }
.media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media-ph { position: absolute; inset: 0; display: grid; place-items: center; color: #334155; }
.thumb { position: relative; flex-shrink: 0; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; border: 2px solid transparent; background: var(--c-surface-2); opacity: 0.7; transition: opacity 0.15s, border-color 0.15s; }
.thumb:hover { opacity: 1; }
.thumb[aria-current="true"] { border-color: var(--c-brand); opacity: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.price { font-weight: 800; color: var(--c-text-strong); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.price-old { color: var(--c-faint); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.stars { display: inline-flex; gap: 2px; color: #fbbf24; }
.stars .is-empty { color: #334155; }

.buybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 780; padding: 10px 16px calc(10px + var(--safe-b));
  background: rgba(16, 21, 34, 0.96); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--c-border-strong); transform: translateY(110%); transition: transform 0.2s ease;
}
.buybar.is-visible { transform: none; }
.has-bnav .buybar { bottom: calc(var(--bnav-h) + var(--safe-b)); padding-bottom: 10px; }
@media (min-width: 1024px) { .buybar { display: none; } }

/* --- lists & tables ------------------------------------------------------ */
.list > * + * { border-top: 1px solid var(--c-border); }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; }
@media (min-width: 640px) { .list-row { padding: 14px 24px; } }
a.list-row, button.list-row { width: 100%; text-align: left; transition: background-color 0.12s; }
a.list-row:hover, button.list-row:hover { background: rgba(148, 163, 184, 0.05); }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; font-size: 14px; }
.kv + .kv { border-top: 1px dashed var(--c-border); }
.kv dt { color: var(--c-muted); }
.kv dd { color: var(--c-text-strong); font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; border: 1px solid var(--c-border); border-radius: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 700; letter-spacing: 0.03em; color: var(--c-muted); background: rgba(21, 28, 44, 0.7); border-bottom: 1px solid var(--c-border); white-space: nowrap; }
.table td { padding: 11px 14px; color: #cbd5e1; border-bottom: 1px solid var(--c-border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table code { white-space: nowrap; }

/* --- pagination ---------------------------------------------------------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.pg-num { min-width: 36px; height: 36px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 10px; font-size: 14px; font-weight: 600; color: #cbd5e1; border: 1px solid transparent; transition: background-color 0.12s, border-color 0.12s; }
.pg-num:hover { background: rgba(148, 163, 184, 0.1); color: #fff; }
.pg-num[aria-current="page"] { background: rgba(99, 102, 241, 0.16); border-color: rgba(129, 140, 248, 0.5); color: #fff; }
.pg-gap { color: var(--c-faint); padding: 0 2px; }

/* --- code blocks --------------------------------------------------------- */
.code { position: relative; background: #070a10; border: 1px solid var(--c-border); border-radius: 14px; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 4px 6px 4px 14px; border-bottom: 1px solid var(--c-border); background: rgba(21, 28, 44, 0.55); font-size: 12px; font-weight: 600; color: var(--c-muted); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.7; color: #d4dbe7; tab-size: 4; }
.code pre::-webkit-scrollbar { height: 8px; }
.code pre::-webkit-scrollbar-thumb { background: #1c2438; border-radius: 8px; }
.code .tok-c { color: #64748b; }
.method { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; font-family: "JetBrains Mono", monospace; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.method-get { background: rgba(16, 185, 129, 0.14); color: #6ee7b7; }
.method-post { background: rgba(99, 102, 241, 0.18); color: #c7d2fe; }
.endpoint { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #070a10; border: 1px solid var(--c-border); font-family: "JetBrains Mono", monospace; font-size: 13px; color: #e2e8f0; overflow-wrap: anywhere; }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(10, 13, 20, 0.7); border: 1px solid var(--c-border); }
.tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--c-muted); transition: background-color 0.15s, color 0.15s; }
.tab:hover { color: #fff; }
.tab[aria-selected="true"] { background: var(--c-surface-3); color: #fff; box-shadow: inset 0 0 0 1px var(--c-border-strong); }
.tabs-line { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs-line::-webkit-scrollbar { display: none; }
.tabs-line .tab { flex: 0 0 auto; height: 36px; border-radius: 8px; font-size: 13px; }

/* --- long-form documents (terms, privacy, docs) -------------------------- */
.prose-doc { color: #cbd5e1; font-size: 15px; line-height: 1.75; }
.prose-doc > :first-child { margin-top: 0; }
.prose-doc h2 { margin: 44px 0 12px; font-size: 20px; line-height: 1.35; font-weight: 800; color: #fff; letter-spacing: -0.01em; scroll-margin-top: calc(var(--header-h) + 20px); }
.prose-doc h3 { margin: 28px 0 8px; font-size: 16px; font-weight: 700; color: #f1f5f9; scroll-margin-top: calc(var(--header-h) + 20px); }
.prose-doc p { margin: 12px 0; }
.prose-doc ul, .prose-doc ol { margin: 12px 0; padding-left: 22px; }
.prose-doc ul { list-style: disc; }
.prose-doc ol { list-style: decimal; }
.prose-doc li { margin: 6px 0; padding-left: 2px; }
.prose-doc li::marker { color: #818cf8; }
.prose-doc strong { color: #f8fafc; font-weight: 700; }
.prose-doc a { color: var(--c-brand-300); text-decoration: underline; text-underline-offset: 3px; }
.prose-doc a:hover { color: #c7d2fe; }
.prose-doc :not(pre) > code { padding: 2px 6px; border-radius: 6px; background: rgba(148, 163, 184, 0.12); color: #e2e8f0; font-size: 0.86em; overflow-wrap: anywhere; }
.prose-doc .table-wrap, .prose-doc .code, .prose-doc .alert, .prose-doc .endpoint { margin: 16px 0; }
.prose-doc .clause { display: inline-block; min-width: 2.4em; color: #818cf8; font-weight: 700; font-variant-numeric: tabular-nums; }
.toc a { display: block; padding: 6px 10px; border-radius: 8px; font-size: 13.5px; color: var(--c-muted); transition: background-color 0.12s, color 0.12s; }
.toc a:hover { color: #fff; background: rgba(148, 163, 184, 0.08); }
.toc a.is-active { color: #fff; background: rgba(99, 102, 241, 0.12); }

/* --- misc ---------------------------------------------------------------- */
.kbd { display: inline-block; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--c-border-strong); background: var(--c-surface-2); font-size: 12px; }
.skeleton { background: linear-gradient(90deg, rgba(148,163,184,.06), rgba(148,163,184,.14), rgba(148,163,184,.06)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
.qr-frame { display: inline-grid; place-items: center; padding: 12px; border-radius: 16px; background: #fff; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7); }
.qr-frame img, .qr-frame canvas { display: block; }
.bank-card {
  position: relative; overflow: hidden; border-radius: 18px; padding: 18px; aspect-ratio: 1.586 / 1; max-height: 210px;
  background: linear-gradient(135deg, #1e2a4a, #151c2c 55%, #101522); border: 1px solid var(--c-border-strong);
  display: flex; flex-direction: column; justify-content: space-between;
}
.bank-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(99, 102, 241, 0.28), transparent 70%); pointer-events: none; }
.bank-card.is-default { border-color: rgba(129, 140, 248, 0.55); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14); }
.bank-card.is-inactive { opacity: 0.72; }
.brand-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; }
.brand-uzcard { background: #0f4c9c; color: #fff; }
.brand-humo { background: #00897b; color: #fff; }
.brand-visa { background: #1a1f71; color: #fff; }
.brand-mastercard { background: #2b2b2b; color: #fbbf24; }
.brand-card { background: var(--c-surface-3); color: #cbd5e1; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@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; }
}

/* safety net: grid children never force the page wider than the viewport */
.grid > * { min-width: 0; }
