@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Manrope:wght@500;600;700&display=swap');

:root {
  color-scheme: dark;
  --ink: #080909;
  --surface: #101312;
  --surface-raised: #151817;
  --surface-soft: #0c0e0d;
  --paper: #ebe9e1;
  --muted: #aaa9a3;
  --line: rgba(235, 233, 225, 0.14);
  --line-strong: rgba(235, 233, 225, 0.28);
  --accent: #d4b77f;
  --accent-strong: #e2c890;
  --accent-soft: rgba(212, 183, 127, 0.09);
  --success: #9cc9aa;
  --danger: #e7a4a1;
  --warning: #d4b77f;
  --radius: 12px;
  --gap: 18px;
  --max: 1560px;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--paper);
  background: var(--ink);
  font: 400 15px/1.55 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
  overflow-x: clip;
}

button,
input { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  color: var(--ink);
  background: var(--accent);
}

.portal {
  min-height: 100vh;
  background:
    radial-gradient(circle at 73% 22%, rgba(72, 98, 94, 0.27), transparent 30rem),
    linear-gradient(160deg, #121817 0%, #070808 68%);
}

.skip {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10000;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--ink);
  font-weight: 600;
  border-radius: 8px;
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 80px;
  background: rgba(8, 9, 9, 0.74);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
  padding: 0 clamp(20px, 3vw, 52px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: Manrope, sans-serif;
  color: var(--paper);
}
.brand:hover .mark { filter: drop-shadow(0 0 9px rgba(212, 183, 127, 0.28)); transform: translateY(-1px) rotate(-3deg); }
.mark {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  transition: transform 0.25s ease, filter 0.25s ease;
}
.brand-name { display: flex; align-items: baseline; font-size: 13px; line-height: 1; letter-spacing: -0.035em; }
.brand-name strong { font-weight: 700; }
.brand-name em { color: var(--accent); font-style: normal; font-weight: 600; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 0 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.back:hover {
  color: var(--paper);
  border-color: var(--line);
  background: var(--surface);
}

/* Balance pill */
.balance-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid rgba(212, 183, 127, 0.26);
  background: linear-gradient(145deg, rgba(212, 183, 127, 0.1), rgba(12, 14, 13, 0.72));
  color: var(--paper);
  white-space: nowrap;
  border-radius: 8px;
}
.balance-pill[hidden] { display: none; }
.balance-pill__label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.balance-pill strong {
  color: var(--accent-strong);
  font: 700 14px/1 Manrope, sans-serif;
}
.balance-pill.is-loading strong,
.balance-pill.is-error strong { color: var(--muted); }

/* Wrap */
.wrap {
  width: min(calc(100% - clamp(40px, 10vw, 172px)), var(--max));
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px) 0;
}

/* Head */
.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin: clamp(28px, 4vw, 56px) 0 28px;
}
.head h1 {
  margin: 0;
  font: 500 clamp(38px, 5vw, 72px)/1.02 Manrope, sans-serif;
  letter-spacing: -0.055em;
}
.head .eyebrow { margin-bottom: 10px; }
.head .hint { margin-top: 8px; }
.head .ghost { flex: 0 0 auto; margin-top: 4px; }

/* Card */
.card {
  position: relative;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 0;
  background: #101312;
  box-shadow: none;
}
.card::after {
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 183, 127, 0.5));
  content: "";
}
.card + .card { margin-top: var(--gap); }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-index {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.section-heading h2 {
  margin: 0;
  font: 500 clamp(20px, 3vw, 26px)/1.2 Manrope, sans-serif;
  letter-spacing: -0.02em;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--gap);
}
.span2 { grid-column: 1 / -1; }
.grid > .card { min-width: 0; }

/* Subscription facts */
.subscription-facts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 28px 0 0;
  border-top: 1px solid var(--line);
}
.subscription-facts > div {
  min-width: 0;
  padding: 22px 20px 4px 0;
}
.subscription-facts > div + div {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}
.subscription-facts dt {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.subscription-facts dd {
  margin: 0;
  color: var(--paper);
  font: 500 clamp(17px, 2vw, 24px)/1.2 Manrope, sans-serif;
  letter-spacing: -.025em;
}

/* Status badge */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.status.active { color: var(--success); }
.status.trialing { color: var(--accent); }
.status.pending { color: var(--warning); }
.status.canceled,
.status.expired,
.status.inactive { color: var(--danger); }

/* Trial box */
.trialbox {
  margin: 20px 0 16px;
  padding: 18px 20px;
  border: 0;
  border-left: 2px solid var(--accent);
  border-radius: 0;
  background: rgba(212, 183, 127, .055);
  color: var(--paper);
  font-size: 13px;
  line-height: 1.5;
}

/* Identity buttons */
.identity {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Controls — same restrained geometry as the marketing site */
.primary,
.ghost,
.danger {
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 2px;
  font: 600 11px/1 Inter, sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform .2s, color .2s, background .2s, border-color .2s;
}
.primary {
  color: var(--ink);
  background: var(--paper);
}
.primary:hover:not(:disabled) { background: #fff; transform: translateY(-2px); }
.ghost {
  color: var(--paper);
  background: transparent;
  border-color: var(--line-strong);
}
.ghost:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, .06);
  border-color: rgba(235, 233, 225, .5);
  transform: translateY(-2px);
}
.danger {
  color: var(--danger);
  background: rgba(231, 164, 161, .05);
  border-color: rgba(231, 164, 161, .3);
}
.primary:disabled,
.ghost:disabled,
.danger:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* Plans */
.plans-card { margin-top: 0; }

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.plan {
  display: flex;
  flex-direction: column;
  min-height: 330px;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #111413;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.plan:hover {
  border-color: rgba(212, 183, 127, 0.37);
  background: #151817;
  transform: translateY(-2px);
}
.plan.current {
  border-color: rgba(212, 183, 127, 0.55);
  background: linear-gradient(#d4b77f17, #111413 32%);
  box-shadow: inset 0 1px rgba(235, 220, 190, 0.15), 0 12px 36px rgba(150, 100, 40, 0.1);
}
.plan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.plan-name {
  font: 600 18px/1.2 Manrope, sans-serif;
  letter-spacing: -0.02em;
}
.plan-price {
  color: var(--accent);
  font: 600 13px/1 Manrope, sans-serif;
  white-space: nowrap;
}
.plan-price span { color: var(--muted); font-weight: 400; font-size: 11px; }
.plan-description {
  flex: 1;
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.plan-features {
  flex: 1;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}
.plan-features li::before {
  content: "✓";
  display: inline-block;
  width: 1.2em;
  color: var(--success);
  font-weight: 600;
}
.plan-footer {
  margin-top: auto;
}
.plan-action {
  width: 100%;
  padding: 12px 16px;
  font-weight: 600;
  border-radius: 8px;
}

/* Business plan link */
.business-plan {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 20px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(212, 183, 127, 0.07), rgba(14, 17, 15, 0.92));
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}
.business-plan:hover {
  border-color: var(--accent-strong);
  transform: translateY(-2px);
}
.plan-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.plan-heading .plan-name { color: var(--accent-strong); }
.plan-heading .plan-price { color: var(--muted); font-weight: 400; font-size: 12px; }
.plan-description { color: var(--muted); font-size: 12px; }
.plan-select {
  margin-top: 16px;
  color: var(--accent);
  font: 600 12px/1 Manrope, sans-serif;
}

/* Bot card */
.botname {
  font: 600 20px/1.2 Manrope, sans-serif;
  color: var(--accent-strong);
}
.botname::before { content: "@"; }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.row > * { flex: 1 1 auto; min-width: 120px; }

.tokenrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.tokenrow input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--paper);
}
.tokenrow input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.tokenrow .primary { flex: 0 0 auto; }

/* Admin panel */
.adminbox { overflow: hidden; }
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
.admin-toolbar label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}
.admin-toolbar .input {
  min-width: min(360px, 70vw);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--paper);
}
.admin-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.admintable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admintable th,
.admintable td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.admintable th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.admintable tbody tr:hover { background: rgba(212, 183, 127, 0.025); }
.admintable select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--paper);
  font-size: 12px;
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.admin-actions .ghost {
  padding: 7px 10px;
  font-size: 12px;
}
.admin-subtitle {
  margin: 22px 0 10px;
  font: 600 15px Manrope, sans-serif;
}
.admin-events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.admin-events article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
}
.admin-events time { color: var(--muted); font-size: 11px; }
.admin-events strong { color: var(--paper); }
.admin-events span { color: var(--muted); }
.admin-head { align-items: flex-end; }
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.admin-stats article {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.admin-stats strong { color: var(--accent-strong); font: 600 24px Manrope, sans-serif; }
.admin-stats span { color: var(--muted); font-size: 12px; }
.admin-page .adminbox { overflow: hidden; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  margin: 18px 0 20px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 99px;
}
.tab-btn {
  position: relative;
  min-height: 38px;
  padding: 0 18px;
  color: var(--muted);
  font: 500 13px/1 Manrope, sans-serif;
  background: transparent;
  border: none;
  border-radius: 99px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.tab-btn:hover { color: var(--paper); background: var(--surface); }
.tab-btn.active {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.08);
}
.tab-btn.active::after { display: none; }
.tab-panel {
  animation: fadeIn 0.15s ease;
}
.tab-panel[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Top-up form */
.topup-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 16px;
}
.topup-form .field {
  display: grid;
  gap: 6px;
}
.topup-form label { font-size: 12px; color: var(--muted); }
.topup-form input,
.topup-form select {
  min-height: 50px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #0c0e0d;
  color: var(--paper);
}
.topup-form input:focus,
.topup-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.topup-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.topup-form .submit-row { margin-top: 4px; }
.topup-form .primary { width: 100%; }

/* Notices */
.notice {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(212, 183, 127, 0.26);
  border-radius: 8px;
  background: rgba(212, 183, 127, 0.08);
  color: var(--paper);
  font-size: 13px;
}
.notice[hidden] { display: none; }
.notice.ok { border-color: rgba(156, 201, 170, 0.3); background: rgba(156, 201, 170, 0.08); color: var(--success); }

/* Error & hint */
.hint {
  margin-block: 10px 0;
  color: var(--muted);
  font-size: 13px;
}
.hint:empty { display: none; }

.error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 154, 154, 0.2);
  border-radius: 8px;
  color: var(--danger);
  background: rgba(255, 112, 112, 0.06);
  font-size: 13px;
}
.error.ok {
  color: var(--success);
  border-color: rgba(105, 213, 163, 0.22);
  background: rgba(105, 213, 163, 0.07);
}
.error[hidden] { display: none; }

/* Auth page */
.auth {
  min-height: calc(100svh - 80px);
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(72px, 10vw, 150px) clamp(22px, 8vw, 120px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at 73% 45%, rgba(72, 98, 94, 0.27), transparent 28rem),
    linear-gradient(160deg, #121817, #070808 68%);
  border-top: 0;
  border-right: 0;
  border-left: 0;
}
.auth > *:not(.auth-phone) { width: min(100%, 480px); }

.auth-phone {
  position: absolute;
  z-index: 0;
  right: clamp(30px, 8vw, 130px);
  top: 50%;
  width: clamp(250px, 24vw, 390px);
  aspect-ratio: .505;
  pointer-events: none;
  perspective: 1600px;
  transform: translateY(-50%);
  filter: drop-shadow(0 48px 70px rgba(0,0,0,.48));
}
.auth-phone-shadow { position: absolute; z-index: -1; inset: 10% -12%; border-radius: 50%; background: radial-gradient(ellipse,rgba(86,161,156,.14),transparent 65%); filter: blur(24px); }
.auth-phone-frame { position: absolute; inset: 0; padding: 5px; border-radius: clamp(38px,4vw,58px); background: linear-gradient(118deg,#202b2d 0%,#8c9998 18%,#1b2224 38%,#060809 68%,#657274 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.24),inset 0 0 0 3px rgba(0,0,0,.76),0 1px 0 rgba(255,255,255,.25); transform: rotateZ(3deg) rotateY(-8deg) rotateX(2deg); transform-style: preserve-3d; }
.auth-phone-screen { position: relative; width: 100%; height: 100%; overflow: hidden; border: 1px solid rgba(255,255,255,.07); border-radius: clamp(34px,3.7vw,53px); color: #dfe9e8; background: linear-gradient(180deg,#091112,#071011 45%,#090e0f); font-family: Inter,Arial,sans-serif; }
.auth-phone-status { height: 7.2%; padding: 4.3% 8% 0; display: flex; align-items: flex-start; justify-content: space-between; color: #cbd3d2; font-size: clamp(7px,.62vw,10px); font-weight: 700; }
.auth-phone-status i { position: absolute; left: 50%; top: 1.5%; width: 29%; height: 3.8%; transform: translateX(-50%); border-radius: 999px; background: #020303; }
.auth-phone-head { height: 10%; padding: 1% 6%; display: grid; grid-template-columns: 9% 14% 1fr 10%; align-items: center; border-bottom: 1px solid rgba(255,255,255,.055); }
.auth-phone-head > b { color: #91aaa7; font-size: clamp(18px,1.5vw,26px); font-weight: 300; }
.auth-phone-avatar { width: 82%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; color: #091311; background: #83b5ae; font-size: clamp(9px,.8vw,13px); font-weight: 700; }
.auth-phone-head > span:nth-child(3) { display: flex; flex-direction: column; gap: 2px; }
.auth-phone-head strong { font-size: clamp(8px,.72vw,12px); font-weight: 600; }
.auth-phone-head small { color: #71908b; font-size: clamp(5px,.46vw,8px); }
.auth-phone-head em { color: #74908d; font-size: clamp(6px,.55vw,9px); font-style: normal; letter-spacing: 1px; }
.auth-phone-messages { display: flex; height: 72%; padding: 7% 5.5% 3%; flex-direction: column; gap: 3.5%; }
.auth-phone-messages p { width: 80%; margin: 0; padding: 4% 5%; border-radius: 9px; font-size: clamp(6px,.57vw,9.5px); line-height: 1.45; }
.auth-phone-user { align-self: flex-end; color: #dfe8e7; background: #18312f; border: 1px solid rgba(104,172,163,.2); }
.auth-phone-agent { color: #b8c8c5; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.06); }
.auth-phone-result { margin-top: 1%; padding: 6%; border: 1px solid rgba(114,168,160,.2); border-radius: 10px; background: linear-gradient(145deg,rgba(40,68,64,.5),rgba(11,18,18,.8)); box-shadow: 0 14px 30px rgba(0,0,0,.28); }
.auth-phone-result > span { display: block; margin-bottom: 3%; color: #85bdb5; font-size: clamp(5px,.42vw,7px); font-weight: 700; letter-spacing: .13em; }
.auth-phone-result strong { display: block; font-size: clamp(10px,.9vw,15px); }
.auth-phone-result small { display: block; margin-top: 1%; color: #657875; font-size: clamp(5px,.43vw,7px); }
.auth-phone-result ul { margin: 5% 0 5%; padding: 0; list-style: none; color: #a7b9b6; font-size: clamp(6px,.51vw,8px); line-height: 1.75; }
.auth-phone-result li::before { content: "✓"; margin-right: 6px; color: #76aaa2; }
.auth-phone-result em { color: #8abcb5; font-size: clamp(6px,.51vw,8px); font-style: normal; }
.auth-phone-composer { position: absolute; left: 5.5%; right: 5.5%; bottom: 2.5%; height: 7.5%; padding: 0 3%; display: flex; align-items: center; gap: 4%; border: 1px solid rgba(255,255,255,.08); border-radius: 999px; color: #526461; background: rgba(255,255,255,.025); font-size: clamp(6px,.52vw,9px); }
.auth-phone-composer b { font-size: clamp(10px,.9vw,15px); font-weight: 300; }
.auth-phone-composer i { width: 14%; aspect-ratio: 1; margin-left: auto; display: grid; place-items: center; border-radius: 50%; color: #10201e; background: #7dafaa; font-size: clamp(6px,.5vw,8px); font-style: normal; }
.auth > *:not(.auth-phone) { position: relative; z-index: 1; }

@media (max-width: 820px) {
  .auth { min-height: calc(100svh - 64px); padding: 56px 22px 38px; justify-content: flex-start; }
  .auth-phone { position: relative; right: auto; top: auto; width: min(62vw, 255px); margin: 0 auto 40px; order: -1; transform: none; }
  .auth::before { display: none; }
  .auth > *:not(.auth-phone) { width: 100%; }
}

@media (max-width: 420px) {
  .auth { padding-top: 34px; }
  .auth-phone { width: min(65vw, 238px); margin-bottom: 32px; }
}

.auth {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  box-shadow: none;
}
.auth::before {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  margin-bottom: 24px;
  background: linear-gradient(90deg, var(--accent), transparent 78%);
}
.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.19em;
}
.eyebrow > span {
  display: inline-block;
  width: 24px; height: 1px;
  margin: 0 10px 3px 0;
  background: currentColor;
}
.auth h1 {
  max-width: 380px;
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1.1;
  margin: 8px 0 24px;
}
.oauth {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.oauthbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--paper);
  font-weight: 500;
  transition: border-color 0.2s, background 0.2s;
}
.oauthbtn:not(:disabled):hover {
  border-color: rgba(212, 183, 127, 0.55);
  background: #1b1812;
}
.oauthbtn:disabled { opacity: 0.46; cursor: not-allowed; }
.oauthbtn svg { width: 20px; height: 20px; flex-shrink: 0; }
.auth-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 112, 112, 0.06);
  border: 1px solid rgba(255, 154, 154, 0.2);
  color: var(--danger);
  font-size: 13px;
}
.auth-error[hidden] { display: none; }
.auth-consent {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.auth-consent a {
  color: var(--paper);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-consent a:hover { color: var(--accent-strong); }

/* Legal links */
.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 28px;
  margin: 32px 0 12px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.legal-links a { color: inherit; text-decoration: none; transition: color .2s ease; }
.legal-links a:hover { color: var(--paper); }

/* Responsive */
@media (max-width: 920px) {
  .grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .head { align-items: center; flex-direction: column; gap: 16px; }
  .head .eyebrow { margin-bottom: 8px; }
  .head .hint { margin-top: 6px; }
  .head .ghost { margin-top: 0; }
  .nav .wrap { padding: 0 14px; }
  .wrap { width: min(calc(100% - 28px), var(--max)); }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subscription-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subscription-facts > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .subscription-facts > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .plans-grid { grid-template-columns: 1fr; }
  .subscription-facts { grid-template-columns: 1fr; }
  .subscription-facts > div,
  .subscription-facts > div + div,
  .subscription-facts > div:nth-child(odd) {
    padding: 16px 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .subscription-facts > div:first-child { border-top: 0; }
  .nav { height: 52px; }
  .brand { font-size: 10px; }
  .back span:last-child { display: none; }
  .back { padding: 8px; }
  .tab-btn { padding: 8px 12px; font-size: 12px; }
  .topup-form .row { grid-template-columns: 1fr; }
  .plan { min-height: auto; }
  .row { flex-direction: column; }
  .row > * { width: 100%; }
  .tokenrow { flex-direction: column; }
  .tokenrow input { min-width: 0; }
  .tokenrow .primary { width: 100%; }
  .admin-toolbar { flex-direction: column; align-items: stretch; }
  .admin-toolbar .input { min-width: 0; width: 100%; }
  .admin-table-wrap { font-size: 12px; }
  .admin-events { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .admin-page .head { align-items: stretch; }
  .admin-page .adminbox { padding: 14px; }
  .admin-table-wrap {
    margin-inline: -14px;
    padding-inline: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .admintable { min-width: 760px; }
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex: 0 0 auto; min-height: 44px; }
  .nav-actions { gap: 6px; }
  .balance-pill { padding: 7px 9px; }
  .balance-pill__label { display: none; }
  #adminLink { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wrap { padding: clamp(16px, 3vw, 24px) 0; }
}

@media (max-width: 390px) {
  .oauth { gap: 8px; }
  .oauthbtn { width: 100%; }
  .subscription-facts dd { text-align: left; }
  .tab-btn { padding: 8px 10px; font-size: 11px; }
}

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

/* Shared with landing page visual language */
.portal {
  --ink2: #101312;
  background: var(--ink);
}
.portal::before {
  background: linear-gradient(90deg, transparent 0 72%, var(--line) 72% calc(72% + 1px), transparent calc(72% + 1px));
  background-size: auto;
  mask-image: none;
}