:root {
  color-scheme: dark;
  --black: #050505;
  --surface: #0d0d0d;
  --surface-raised: #141414;
  --line: #292929;
  --line-strong: #464646;
  --text: #f5f5f2;
  --muted: #969692;
  --danger: #d9a6a2;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: var(--black); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
a { color: inherit; }
.shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }

.topbar { display: flex; min-height: 78px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 780; letter-spacing: -0.02em; text-decoration: none; }
.brand img, .auth-logo { object-fit: cover; object-position: 50% 42%; }
.brand img { width: 38px; height: 38px; border: 1px solid var(--line-strong); border-radius: 50%; }
.top-actions { display: flex; gap: 8px; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(58px, 7vw, 92px); font-weight: 740; line-height: 0.92; letter-spacing: -0.068em; }
h2 { margin-bottom: 0; font-size: 26px; line-height: 1.15; letter-spacing: -0.035em; }
.eyebrow, .compact { margin-bottom: 13px; color: #b5b5b0; font-size: 11px; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; }

.auth-stage { display: grid; min-height: calc(100vh - 78px); grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.62fr); gap: clamp(48px, 9vw, 120px); align-items: center; padding: 58px 0 82px; }
.auth-copy p:last-child { max-width: 590px; color: var(--muted); font-size: 18px; line-height: 1.55; }
.auth-panel, .subscription-panel, .account-panel, .history-panel { border: 1px solid var(--line); background: var(--surface); }
.auth-panel { padding: 34px; border-radius: var(--radius); }
.auth-logo { display: block; width: 88px; height: 88px; margin-bottom: 24px; border: 1px solid var(--line-strong); border-radius: 50%; }
.auth-panel h2 { margin-bottom: 10px; }
.muted { color: var(--muted); line-height: 1.5; }
.status-line { min-height: 22px; margin: 10px 0; color: var(--danger); font-size: 13px; }
.status-line.ok { color: var(--text); }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: #73736f; font-size: 11px; }
.divider::before, .divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }

form { display: grid; gap: 9px; }
label { margin-top: 5px; color: #c5c5c0; font-size: 12px; font-weight: 650; }
input { width: 100%; height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--text); background: #080808; transition: border-color 150ms ease; }
input:focus { border-color: #777; }

.primary, .secondary, .ghost, .bot-link, .support-link { border: 0; font-size: 14px; font-weight: 720; text-align: center; text-decoration: none; cursor: pointer; }
.primary, .secondary { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; padding: 0 20px; border-radius: 9px; }
.primary { margin-top: 10px; color: #101010; background: var(--text); border: 1px solid var(--text); }
.primary:hover { background: #d8d8d4; border-color: #d8d8d4; }
.secondary { border: 1px solid var(--line-strong); background: transparent; }
.secondary:hover { background: var(--surface-raised); }
.ghost { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 0 16px; border: 1px solid var(--line); border-radius: 9px; color: #c3c3be; background: transparent; }
.ghost:hover { border-color: var(--line-strong); color: var(--text); }
.bot-link { display: block; margin-top: 18px; color: var(--muted); font-size: 13px; }
.bot-link:hover, .support-link:hover { color: var(--text); }

.dashboard { padding: 78px 0 82px; }
.welcome { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 38px; }
.welcome h1 { margin-bottom: 0; font-size: clamp(48px, 6.5vw, 80px); }
.balance { min-width: 190px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.balance span { display: block; color: var(--muted); font-size: 12px; }
.balance strong { display: block; margin-top: 6px; font-size: 24px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.76fr); gap: 18px; }
.subscription-panel, .account-panel, .history-panel { border-radius: var(--radius); }
.subscription-panel, .account-panel, .history-panel { padding: 30px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.status { padding: 8px 11px; border: 1px solid #535353; border-radius: 999px; color: var(--text); background: #181818; font-size: 11px; font-weight: 730; white-space: nowrap; }
.status.inactive { color: var(--muted); border-color: var(--line); background: transparent; }

.subscription-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 40px 0 28px; }
.subscription-facts div { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #080808; }
.subscription-facts dt { margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.subscription-facts dd { margin: 0; font-size: 14px; font-weight: 680; }
.action { margin-right: 7px; }
.account-row { display: flex; justify-content: space-between; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.account-row span { color: var(--muted); }
.account-row strong { max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-link { display: inline-flex; align-items: center; min-height: 42px; margin-top: 22px; color: #c9c9c4; }
.account-logout { width: 100%; margin-top: 12px; }
.history-panel { margin-top: 18px; }
.history-list { margin-top: 22px; }
.history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 20px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.history-item:first-child { border-top: 0; }
.history-title { font-weight: 680; }
.history-meta { color: var(--muted); font-size: 11px; }
.history-amount { grid-row: 1 / 3; grid-column: 2; font-size: 15px; font-weight: 760; }
.history-amount.positive { color: var(--text); }
.history-amount.negative { color: #bababa; }
.empty { margin: 24px 0 0; color: var(--muted); }
footer { padding: 26px 0 42px; color: #666662; font-size: 11px; text-align: center; }
.hidden { display: none !important; }

@media (max-width: 820px) {
  .shell { width: min(100% - 28px, 620px); }
  .auth-stage { display: block; min-height: auto; padding: 72px 0; }
  .auth-copy { margin-bottom: 40px; }
  .auth-copy h1 { font-size: clamp(54px, 14vw, 76px); }
  .auth-copy p:last-child { font-size: 16px; }
  .dashboard { padding-top: 52px; }
  .welcome { align-items: stretch; flex-direction: column; }
  .balance { min-width: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .shell { width: calc(100% - 24px); }
  .brand span { font-size: 15px; }
  .brand img { width: 36px; height: 36px; }
  .top-actions .ghost { min-height: 36px; padding-inline: 12px; font-size: 12px; }
  .auth-panel, .subscription-panel, .account-panel, .history-panel { padding: 23px; border-radius: 14px; }
  .auth-logo { width: 76px; height: 76px; }
  .welcome h1 { font-size: 45px; }
  .subscription-facts { grid-template-columns: 1fr; margin-top: 28px; }
  .action { display: flex; width: 100%; margin: 9px 0 0; }
  .history-item { gap: 7px 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  .auth-panel, .dashboard { animation: reveal 320ms ease-out both; }
  @keyframes reveal { from { opacity: 0; transform: translateY(10px); } }
}
