/* ============================================================
   TryVue Customer Portal — Design System (mobile-first)
   Shares the admin console's tokens; adds a responsive shell
   with a desktop sidebar and a mobile bottom-nav.
   ============================================================ */
:root {
  --bg: #0a0b0f;
  --bg-elev: #12141b;
  --bg-elev-2: #171a23;
  --surface: #1b1f2a;
  --surface-hover: #222735;
  --border: #262b38;
  --border-soft: #1e2330;
  --text: #e8eaf0;
  --text-dim: #9aa1b3;
  --text-faint: #626a7e;
  --brand: #6d5efc;
  --brand-2: #8b7bff;
  --brand-glow: rgba(109, 94, 252, 0.35);
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --pink: #f472b6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 70px -20px rgba(0, 0, 0, 0.75);
  --sidebar-w: 250px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(109, 94, 252, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, 0.07), transparent 55%),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3040; border-radius: 8px; border: 2px solid var(--bg); }

/* ---------- Boot ---------- */
.boot { height: 100vh; display: flex; flex-direction: column; gap: 22px; align-items: center; justify-content: center; }
.boot__logo { font-weight: 800; font-size: 26px; letter-spacing: -0.5px; background: linear-gradient(120deg, var(--brand-2), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.boot__spinner, .spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.auth__card {
  width: 100%; max-width: 410px;
  background: linear-gradient(180deg, rgba(27,31,42,.9), rgba(18,20,27,.9));
  border: 1px solid var(--border); border-radius: 20px; padding: 34px 28px;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(12px); animation: fadeIn .4s ease;
}
.auth__brand { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.auth__mark { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--brand), var(--cyan)); display: grid; place-items: center; font-size: 21px; box-shadow: 0 8px 26px -8px var(--brand-glow); }
.auth__title { font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.auth__sub { color: var(--text-dim); margin: 14px 0 24px; font-size: 13.5px; line-height: 1.5; }
.auth__switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-dim); }
.auth__switch b { color: var(--brand-2); cursor: pointer; font-weight: 600; }

/* ---------- Forms ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; letter-spacing: .2px; }
.input, .select, textarea.input {
  width: 100%; background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 13px; font-size: 15px; transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 16px; font-size: 14px; font-weight: 600;
  transition: all .15s; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-hover); border-color: #333a4a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; box-shadow: 0 8px 24px -10px var(--brand-glow); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--danger { color: var(--red); border-color: rgba(248,113,113,.25); }
.btn--danger:hover { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.4); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface); }
.btn--sm { padding: 8px 12px; font-size: 13px; }
.btn--block { width: 100%; }

/* ---------- Layout / shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, var(--bg-elev), var(--bg));
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 22px; }
.sidebar__mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--cyan)); display: grid; place-items: center; font-size: 17px; box-shadow: 0 6px 18px -6px var(--brand-glow); }
.sidebar__name { font-weight: 800; font-size: 16px; letter-spacing: -.3px; }
.sidebar__tag { font-size: 10px; color: var(--text-faint); font-weight: 600; letter-spacing: .8px; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav__item {
  display: flex; align-items: center; gap: 12px; padding: 11px;
  border-radius: 10px; color: var(--text-dim); font-weight: 500; font-size: 14px;
  transition: all .13s; border: 1px solid transparent;
}
.nav__item:hover { background: var(--surface); color: var(--text); }
.nav__item.active { background: linear-gradient(90deg, rgba(109,94,252,.16), rgba(109,94,252,.04)); color: #fff; border-color: rgba(109,94,252,.25); }
.nav__item.active .nav__icon { color: var(--brand-2); }
.nav__icon { width: 20px; height: 20px; flex-shrink: 0; opacity: .9; }
.sidebar__foot { border-top: 1px solid var(--border-soft); padding-top: 14px; margin-top: 8px; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.userchip__av { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--pink), var(--brand)); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; }
.userchip__meta { min-width: 0; flex: 1; }
.userchip__email { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userchip__role { font-size: 10.5px; color: var(--text-faint); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 22px;
  border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; z-index: 20;
  background: rgba(10,11,15,.78); backdrop-filter: blur(14px);
}
.topbar__mbrand { display: none; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; }
.topbar__mbrand .m { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--cyan)); display: grid; place-items: center; font-size: 15px; }
.topbar__title { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.topbar__spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 6px 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.content { padding: 22px; max-width: 980px; width: 100%; margin: 0 auto; animation: fadeIn .3s ease; }

/* ---------- Mobile bottom nav ---------- */
.bottomnav { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar__mbrand { display: flex; }
  .topbar__title { display: none; }
  .content { padding: 18px 15px calc(84px + var(--safe-b)); }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(14,16,22,.92); backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-soft);
    padding: 8px 6px calc(8px + var(--safe-b));
  }
  .bottomnav__item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 4px 0; color: var(--text-faint); font-size: 10.5px; font-weight: 600;
    -webkit-tap-highlight-color: transparent; border-radius: 10px;
  }
  .bottomnav__item .nav__icon { width: 22px; height: 22px; }
  .bottomnav__item.active { color: var(--brand-2); }
}

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 15px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid--3 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid--2 { grid-template-columns: 1fr; } }

.card { background: linear-gradient(180deg, var(--surface), var(--bg-elev)); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border-soft); }
.card__title { font-size: 15px; font-weight: 700; }
.card__body { padding: 18px; }

/* Stat card */
.stat { padding: 18px; }
.stat__icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 13px; background: rgba(109,94,252,.14); color: var(--brand-2); }
.stat__icon.c-green { background: rgba(52,211,153,.14); color: var(--green); }
.stat__icon.c-cyan { background: rgba(34,211,238,.14); color: var(--cyan); }
.stat__icon.c-amber { background: rgba(251,191,36,.14); color: var(--amber); }
.stat__icon.c-pink { background: rgba(244,114,182,.14); color: var(--pink); }
.stat__label { font-size: 12.5px; color: var(--text-dim); font-weight: 500; }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -.6px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat__meta { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

/* ---------- Section heading ---------- */
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.page-desc { color: var(--text-dim); font-size: 13.5px; margin-top: 4px; }
.section-head { margin-bottom: 16px; }

/* ---------- Plan cards ---------- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
@media (max-width: 860px) { .plans { grid-template-columns: 1fr; } }
.plan {
  position: relative; background: linear-gradient(180deg, var(--surface), var(--bg-elev));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.plan.current { border-color: rgba(109,94,252,.5); box-shadow: 0 0 0 1px rgba(109,94,252,.35), var(--shadow); }
.plan__badge { position: absolute; top: 14px; right: 14px; }
.plan__name { font-size: 17px; font-weight: 800; }
.plan__price { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin: 8px 0 2px; }
.plan__price small { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.plan__desc { font-size: 13px; color: var(--text-dim); min-height: 34px; }
.plan__feats { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 14px 0 18px; }
.plan__feats li { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text); }
.plan__feats li svg { color: var(--green); flex-shrink: 0; margin-top: 1px; }
.plan__feats li.off { color: var(--text-faint); }
.plan__feats li.off svg { color: var(--text-faint); }

/* ---------- Top-up packs ---------- */
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
@media (max-width: 860px) { .packs { grid-template-columns: 1fr; } }
.pack { background: linear-gradient(180deg, var(--surface), var(--bg-elev)); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.pack__credits { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.pack__label { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .6px; }
.pack__price { font-size: 16px; font-weight: 700; color: var(--brand-2); margin: 8px 0 14px; }

/* ---------- Table / ledger ---------- */
.tablewrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--text-faint); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .mono { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.amt-pos { color: var(--green); font-weight: 600; }
.amt-neg { color: var(--text); font-weight: 600; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 20px; border: 1px solid transparent; white-space: nowrap; }
.badge--green { color: var(--green); background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.2); }
.badge--amber { color: var(--amber); background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.2); }
.badge--red { color: var(--red); background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.2); }
.badge--gray { color: var(--text-dim); background: var(--surface); border-color: var(--border); }
.badge--brand { color: var(--brand-2); background: rgba(109,94,252,.12); border-color: rgba(109,94,252,.2); }
.badge--cyan { color: var(--cyan); background: rgba(34,211,238,.12); border-color: rgba(34,211,238,.2); }

/* ---------- Toggle ---------- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { display: none; }
.switch__track { position: absolute; inset: 0; background: var(--border); border-radius: 20px; transition: .18s; }
.switch__track::after { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .18s; }
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.switch-row:last-child { border-bottom: none; }
.switch-row__label { font-size: 14px; font-weight: 600; }
.switch-row__desc { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; line-height: 1.4; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(5,6,10,.7); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100; padding: 18px; animation: fadeIn .18s ease; }
.modal { width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); animation: fadeIn .22s ease; }
.modal__head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border-soft); }
.modal__title { font-size: 17px; font-weight: 700; }
.modal__close { margin-left: auto; background: transparent; border: none; color: var(--text-dim); font-size: 24px; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.modal__close:hover { background: var(--surface); color: var(--text); }
.modal__body { padding: 22px; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 15px 22px; border-top: 1px solid var(--border-soft); }
@media (max-width: 560px) { .modal { max-width: 100%; margin-top: auto; border-radius: 18px 18px 0 0; } .modal-overlay { place-items: end center; padding: 0; } }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--text-faint); }
.empty__icon { font-size: 36px; margin-bottom: 12px; opacity: .5; }
.loading-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 44px; color: var(--text-dim); }
.toast-wrap { position: fixed; top: 16px; left: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { background: var(--bg-elev-2); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 11px; padding: 13px 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; animation: fadeIn .2s ease; font-size: 13.5px; }
.toast--ok { border-left-color: var(--green); }
.toast--err { border-left-color: var(--red); }
.muted { color: var(--text-dim); }
.mono { font-family: var(--mono); }
.sep { height: 1px; background: var(--border-soft); margin: 16px 0; }
.err-banner { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.25); color: var(--red); padding: 11px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.info-banner { background: rgba(109,94,252,.1); border: 1px solid rgba(109,94,252,.25); color: var(--brand-2); padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; line-height: 1.5; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 12px 18px; font-size: 14px; }
.kv dt { color: var(--text-dim); font-weight: 500; }
.kv dd { font-weight: 600; text-align: right; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.keyhint { font-family: var(--mono); font-size: 13px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text-dim); }
