:root {
  color-scheme: dark;
  --bg: #080a0e;
  --surface: #111419;
  --surface-strong: #171b21;
  --line: #292f38;
  --text: #f5f7fa;
  --muted: #8f98a5;
  --cyan: #36f1cd;
  --cyan-dark: #0f8f80;
  --magenta: #ff4fd8;
  --violet: #8b6cff;
  --lime: #c7ff4a;
  --danger: #ff667a;
  --warning: #ffc65c;
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
html { width: 100%; min-height: 100%; background: var(--bg); }
body { width: 100%; min-width: 320px; min-height: 100vh; margin: 0; overflow-x: hidden; color: var(--text); background: var(--bg); letter-spacing: 0; }
button, input, a { min-width: 0; font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 28px; line-height: 1.12; overflow-wrap: anywhere; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.25; }
h3 { margin-bottom: 0; font-size: 16px; line-height: 1.3; }
.hidden { display: none !important; }
.disabled-link { pointer-events: none; opacity: .48; }

.app-shell { width: min(1180px, 100%); min-width: 0; min-height: 100vh; margin: 0 auto; }
.app-header { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px; min-height: 72px; padding: max(12px, env(safe-area-inset-top)) 24px 10px; border-bottom: 1px solid rgba(54, 241, 205, .12); background: rgba(8, 10, 14, .94); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 10px; width: fit-content; min-width: 0; }
.brand-mark, .auth-mark { display: block; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 0 20px rgba(255, 114, 40, .14); }
.brand-mark { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 8px; }
.brand > span { display: grid; gap: 1px; min-width: 0; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); font-size: 11px; }
.header-status, .live-status { display: inline-flex; align-items: center; gap: 7px; color: #dfffdc; font-size: 12px; white-space: nowrap; }
.header-status i, .live-status i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 18px; }
.icon-button:hover { border-color: var(--cyan-dark); color: var(--cyan); }

.main-content { width: 100%; min-width: 0; padding: 18px 24px 64px; }
.dashboard, .views, .view { width: 100%; min-width: 0; }
.desktop-tabs { position: sticky; top: 72px; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 8px 0 10px; background: rgba(8, 10, 14, .94); backdrop-filter: blur(18px); }
.desktop-tabs .tab { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 8px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 750; }
.desktop-tabs .tab span { display: grid; place-items: center; width: 24px; height: 24px; color: inherit; font-size: 17px; }
.desktop-tabs .tab:hover { color: var(--text); background: rgba(255,255,255,.035); }
.desktop-tabs .tab.active { color: var(--cyan); background: rgba(54, 241, 205, .07); text-shadow: 0 0 12px rgba(54, 241, 205, .36); }
.desktop-tabs .tab.active::after { position: absolute; right: 18%; bottom: 0; left: 18%; height: 2px; border-radius: 2px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); content: ""; }
.mobile-tabs { display: none; }

.view { display: none; animation: reveal .22s ease-out; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.section-block { width: 100%; min-width: 0; padding: 28px 0; border-top: 1px solid var(--line); }
.view > .section-block:first-child { border-top: 0; }
.compact-section { padding-top: 20px; }
.eyebrow { margin: 0 0 5px; color: var(--cyan); font-size: 10px; font-weight: 800; line-height: 1.2; text-transform: uppercase; }
.welcome-row, .section-heading, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-width: 0; }
.page-heading { align-items: flex-start; margin-bottom: 24px; }
.page-heading > div { min-width: 0; }
.page-heading p:not(.eyebrow), .section-copy, .summary-note { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.subsection-heading { margin: 28px 0 10px; }

.balance-hero { display: grid; gap: 7px; margin-top: 22px; padding: 24px 26px; border: 1px solid rgba(54,241,205,.24); border-radius: 8px; background: linear-gradient(110deg, rgba(54,241,205,.1), rgba(139,108,255,.08) 48%, rgba(255,79,216,.08)); box-shadow: inset 0 0 34px rgba(54,241,205,.03); }
.balance-hero > span { color: var(--muted); font-size: 12px; }
.balance-hero > strong { font-size: 36px; line-height: 1.05; overflow-wrap: anywhere; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.hero-meta b { color: var(--text); }
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.quick-action { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 800; text-align: center; }
.quick-action span { font-size: 18px; }
.quick-action.accent-cyan { border-color: rgba(54,241,205,.35); color: var(--cyan); background: rgba(54,241,205,.06); }
.quick-action.accent-magenta { border-color: rgba(255,79,216,.3); color: #ff9ceb; background: rgba(255,79,216,.055); }

.primary-button, .secondary-button, .bonus-action { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 15px; border-radius: 7px; font-size: 13px; font-weight: 800; text-align: center; }
.primary-button { border: 1px solid rgba(54,241,205,.48); background: var(--cyan); color: #050807; box-shadow: 0 0 18px rgba(54,241,205,.14); }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.secondary-button:hover:not(:disabled) { border-color: var(--cyan-dark); color: var(--cyan); }
.compact-button { min-height: 36px; padding: 7px 11px; }
.text-link { border: 0; padding: 0; background: transparent; color: var(--cyan); cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; white-space: nowrap; }
.action-status { margin: 12px 0 0; color: var(--warning); font-size: 12px; line-height: 1.5; }
.empty-copy { margin: 18px 0 0; color: var(--muted); font-size: 13px; }

.section-count { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--cyan); font-size: 12px; font-weight: 800; }
.status-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 5px 9px; border: 1px solid rgba(199,255,74,.25); border-radius: 14px; background: rgba(199,255,74,.08); color: var(--lime); font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-badge.expired { border-color: rgba(255,102,122,.25); color: var(--danger); background: rgba(255,102,122,.08); }
.status-badge.disabled { border-color: rgba(255,198,92,.25); color: var(--warning); background: rgba(255,198,92,.08); }

.subscription-list, .ledger-list, .payment-list { width: 100%; min-width: 0; border-top: 1px solid var(--line); }
.subscription-row { display: grid; grid-template-columns: 42px minmax(0, 1.4fr) minmax(120px, .65fr) auto auto; align-items: center; gap: 14px; min-height: 84px; min-width: 0; border-bottom: 1px solid var(--line); }
.device-symbol { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-strong); color: var(--cyan); font-weight: 900; }
.subscription-copy, .subscription-metric { display: grid; gap: 4px; min-width: 0; }
.subscription-copy strong, .subscription-metric strong { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.subscription-copy span, .subscription-metric span { min-width: 0; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.subscription-metric { text-align: right; }
.subscription-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.subscription-actions .text-link { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; }
.provision-band .section-heading p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.provision-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; width: min(760px, 100%); margin-top: 20px; }
.provision-form > label { align-self: end; color: var(--muted); font-size: 11px; font-weight: 800; }
.provision-form > input, .provision-form > select { width: 100%; min-width: 0; height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface); color: var(--text); }
.provision-form > input:focus, .provision-form > select:focus { border-color: var(--cyan-dark); box-shadow: 0 0 0 2px rgba(54,241,205,.08); }
.consent-box { grid-column: 1 / -1; display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.consent-box.needs-attention { border-color: var(--warning); box-shadow: 0 0 0 2px rgba(255, 199, 84, .08); }
.consent-copy { display: grid; gap: 4px; }
.consent-copy strong { color: var(--text); font-size: 13px; }
.consent-copy span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.consent-box label { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.consent-box input { flex: 0 0 auto; margin-top: 2px; accent-color: var(--cyan); }
.consent-box a { color: var(--cyan); text-decoration: underline; }
.provision-form .primary-button, .provision-form .action-status { grid-column: 1 / -1; }

.wallet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.wallet-grid div { display: grid; gap: 7px; min-width: 0; padding: 17px; background: var(--surface); }
.wallet-grid span, .wallet-limit { color: var(--muted); font-size: 11px; }
.wallet-grid strong { min-width: 0; overflow-wrap: anywhere; font-size: 22px; }
.wallet-limit { margin: 9px 0 0; }
.balance-actions { margin-top: 22px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.control-group + .control-group { margin-top: 20px; }
.control-label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.amount-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.amount-button { min-height: 43px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 800; }
.amount-button.selected { border-color: var(--cyan); color: #050807; background: var(--cyan); box-shadow: 0 0 14px rgba(54,241,205,.14); }
.method-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.method-button { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); text-align: left; }
.method-button > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 7px; background: rgba(54,241,205,.08); color: var(--cyan); font-size: 11px; font-weight: 900; }
.method-button strong { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.ledger-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; min-height: 62px; border-bottom: 1px solid var(--line); }
.ledger-row div { display: grid; gap: 4px; min-width: 0; }
.ledger-row div strong { font-size: 13px; }
.ledger-row div span { color: var(--muted); font-size: 11px; }
.ledger-positive { color: var(--lime); }
.ledger-negative { color: var(--danger); }

.plan-band, .support-band { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.plan-band { display: grid; align-items: start; }
.plan-band p:not(.eyebrow), .support-band p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.plan-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; }
.plan-option { position: relative; display: grid; gap: 5px; min-width: 0; min-height: 105px; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.plan-option:hover, .plan-option:focus-visible { border-color: var(--cyan); outline: 0; background: rgba(54,241,205,.055); }
.plan-option > span { color: var(--muted); font-size: 11px; }
.plan-option > strong { font-size: 20px; }
.plan-option > small { color: var(--cyan); font-size: 11px; }
.plan-option > i { position: absolute; top: 9px; right: 9px; padding: 3px 6px; border-radius: 5px; background: rgba(199,255,74,.1); color: var(--lime); font-size: 9px; font-style: normal; font-weight: 900; }
.plan-option.best { border-color: rgba(199,255,74,.34); background: linear-gradient(135deg, rgba(199,255,74,.06), rgba(54,241,205,.035)); }
.payment-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px; min-height: 64px; border-bottom: 1px solid var(--line); }
.payment-copy { display: grid; gap: 4px; min-width: 0; }
.payment-copy strong { font-size: 13px; }
.payment-copy span, .payment-status { color: var(--muted); font-size: 11px; }
.payment-amount { font-size: 12px; font-weight: 800; white-space: nowrap; }
.payment-status { min-width: 100px; text-align: right; }
.payment-status.fulfilled { color: var(--lime); }
.payment-status.failed, .payment-status.cancelled { color: var(--danger); }

.bonus-band { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 16px; min-width: 0; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.bonus-band + .bonus-band { margin-top: 14px; }
.bonus-symbol { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(255,79,216,.3); border-radius: 50%; color: var(--magenta); background: rgba(255,79,216,.06); font-size: 21px; }
.channel-band .bonus-symbol { border-color: rgba(54,241,205,.3); color: var(--cyan); background: rgba(54,241,205,.06); }
.bonus-band p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.bonus-action { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.bonus-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 14px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.bonus-metrics div { display: grid; gap: 5px; min-width: 0; padding: 14px; background: var(--surface); }
.bonus-metrics span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; }
.bonus-metrics strong { font-size: 17px; }

.email-form { width: min(640px, 100%); margin-top: 18px; }
.email-form label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
.inline-form-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.inline-form-row input { width: 100%; min-width: 0; height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface); color: var(--text); }
.inline-form-row input:focus { border-color: var(--cyan-dark); box-shadow: 0 0 0 2px rgba(54,241,205,.08); }
.auth-state { display: grid; justify-items: center; width: min(480px, 100%); min-height: 66vh; margin: 0 auto; align-content: center; padding: 30px 0; text-align: center; }
.auth-mark { width: 88px; height: 88px; margin-bottom: 16px; border-radius: 8px; }
.auth-state > p:not(.eyebrow) { max-width: 360px; margin: 12px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-email-form { width: min(390px, 100%); margin: 0 0 10px; text-align: left; }
.auth-divider { display: flex; align-items: center; gap: 10px; width: min(390px, 100%); margin: 10px 0; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.loading-state { display: grid; justify-items: center; gap: 12px; min-height: 62vh; align-content: center; color: var(--muted); font-size: 13px; }
.loader { width: 38px; height: 38px; border: 3px solid var(--line); border-top-color: var(--cyan); border-radius: 50%; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .subscription-row { grid-template-columns: 42px minmax(0, 1fr) auto; padding: 13px 0; }
  .subscription-metric { grid-column: 2; text-align: left; }
  .subscription-row .status-badge { grid-column: 3; grid-row: 1; }
  .subscription-row .subscription-actions { grid-column: 2 / 4; grid-row: 2; justify-content: flex-end; }
}

@media (max-width: 680px) {
  .app-shell { width: 100%; padding-bottom: calc(78px + var(--safe-bottom)); }
  .app-header { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; min-height: 66px; padding: max(10px, env(safe-area-inset-top)) 16px 8px; }
  .header-status { display: none; }
  .brand-mark { width: 36px; height: 36px; flex-basis: 36px; }
  .topbar-actions { justify-self: end; }
  .compact-button { display: none !important; }
  .main-content { padding: 14px 16px 22px; }
  .desktop-tabs { display: none; }
  .mobile-tabs { position: fixed; right: 0; bottom: 0; left: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); min-height: calc(64px + var(--safe-bottom)); padding: 7px 8px var(--safe-bottom); border-top: 1px solid var(--line); background: rgba(12,14,18,.96); backdrop-filter: blur(18px); }
  .mobile-tabs .tab { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; min-width: 0; min-height: 50px; padding: 3px 1px; border: 0; background: transparent; color: #68717d; }
  .mobile-tabs .tab::before { position: absolute; top: -7px; right: 20%; left: 20%; height: 2px; border-radius: 2px; background: transparent; content: ""; }
  .mobile-tabs .tab span { display: grid; place-items: center; width: 26px; height: 26px; font-size: 17px; }
  .mobile-tabs .tab small { width: 100%; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-tabs .tab.active { color: var(--cyan); text-shadow: 0 0 12px rgba(54,241,205,.5); }
  .mobile-tabs .tab.active::before { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
  .mobile-tabs .payment-tab.active { color: var(--magenta); }
  .mobile-tabs .payment-tab.active::before { background: var(--magenta); box-shadow: 0 0 10px var(--magenta); }
  .section-block { padding: 22px 0; }
  h1 { font-size: 25px; }
  .balance-hero { padding: 20px; }
  .balance-hero > strong { font-size: 32px; }
  .wallet-grid { grid-template-columns: 1fr; }
  .wallet-grid div { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 13px 15px; }
  .wallet-grid strong { font-size: 18px; text-align: right; }
  .amount-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-options { grid-template-columns: 1fr; }
  .plan-band, .support-band { align-items: flex-start; flex-direction: column; gap: 18px; }
  .plan-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .support-band .secondary-button { width: 100%; }
  .payment-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px 0; }
  .payment-status { grid-column: 1 / -1; min-width: 0; text-align: left; }
  .bonus-band { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
  .bonus-action { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 480px) {
  .brand small { display: none; }
  .quick-actions { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; }
  .subscription-row { grid-template-columns: 38px minmax(0, 1fr); gap: 9px 10px; }
  .subscription-metric, .subscription-row .status-badge, .subscription-row .subscription-actions { grid-column: 2; grid-row: auto; justify-self: start; text-align: left; }
  .inline-form-row { grid-template-columns: 1fr; }
  .inline-form-row .secondary-button { width: 100%; }
  .provision-form { grid-template-columns: 1fr; }
  .provision-form > *, .consent-box, .provision-form .primary-button, .provision-form .action-status { grid-column: 1; }
  .bonus-metrics { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .view, .loader { animation: none; }
}
