:root {
  color-scheme: dark;
  --bg: #080b10;
  --surface: #10151c;
  --surface-2: #151c25;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f7fa;
  --muted: #8993a1;
  --accent: #ff6b32;
  --accent-2: #ff9b4a;
  --success: #36d88f;
  --danger: #ff5f6d;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% -10%, rgba(255, 107, 50, 0.15), transparent 34%),
    linear-gradient(180deg, #0a0e14 0%, #080b10 100%);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(90px);
  pointer-events: none;
  opacity: 0.12;
}
.ambient-one { width: 250px; height: 250px; right: -170px; top: 220px; background: var(--accent); }
.ambient-two { width: 210px; height: 210px; left: -170px; bottom: 140px; background: #7c4dff; }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 0 18px calc(104px + var(--safe-bottom));
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: env(safe-area-inset-top, 0px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.brand-mark { width: 27px; height: 22px; display: flex; align-items: flex-end; gap: 3px; transform: skew(-10deg); }
.brand-mark i { display: block; width: 7px; border-radius: 2px; background: var(--accent); }
.brand-mark i:nth-child(1) { height: 11px; opacity: 0.55; }
.brand-mark i:nth-child(2) { height: 17px; opacity: 0.8; }
.brand-mark i:nth-child(3) { height: 22px; }

.avatar, .profile-avatar {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(145deg, #242b34, #11161d);
  color: #fff;
  font-weight: 700;
}
.avatar { width: 38px; height: 38px; border-radius: 13px; font-size: 12px; }

.view { display: none; animation: enter 220ms ease-out; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.hero { padding: 40px 0 28px; }
.eyebrow, .kicker, .label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(54, 216, 143, 0.1); }

.hero h1, .page-heading h1, .profile-hero h1 {
  margin: 0;
  line-height: 0.99;
  letter-spacing: -0.055em;
}
.hero h1 { font-size: clamp(39px, 11vw, 56px); font-weight: 800; }
.hero h1 span { color: var(--accent); }
.hero p { max-width: 420px; margin: 18px 0 26px; color: #9ba4af; font-size: 14px; line-height: 1.65; }

.primary-button, .secondary-button, .admin-button {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 120ms ease, filter 120ms ease;
}
.primary-button:active, .secondary-button:active, .admin-button:active { transform: scale(0.98); }
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 22px;
  background: linear-gradient(135deg, var(--accent), #ff8646);
  color: #130905;
  box-shadow: 0 12px 34px rgba(255, 107, 50, 0.22);
}
.primary-button.wide { width: 100%; }
.plus { font-size: 22px; font-weight: 400; line-height: 1; }

.plan-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 62px;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(22, 28, 37, 0.95), rgba(13, 17, 23, 0.95));
  overflow: hidden;
}
.plan-card::after { content: ""; position: absolute; width: 150px; height: 150px; border-radius: 50%; right: -90px; top: -90px; background: rgba(255,107,50,.12); filter: blur(22px); }
.plan-card h2 { margin: 5px 0 0; font-size: 25px; letter-spacing: -0.04em; }
.usage-ring {
  --usage: 0deg;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--usage), rgba(255,255,255,.08) 0);
  position: relative;
}
.usage-ring::after { content: ""; position: absolute; inset: 5px; border-radius: inherit; background: #121820; }
.usage-ring span { position: relative; z-index: 1; font-size: 11px; font-weight: 800; }
.plan-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 14px; font-size: 12px; color: var(--muted); }
.plan-meta strong { color: #cbd1d9; }
.text-button { grid-column: 1 / -1; display: flex; justify-content: space-between; border: 0; padding: 8px 0 0; background: transparent; color: var(--accent-2); font-size: 13px; font-weight: 700; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; margin: 30px 0 14px; }
.section-heading h2 { margin: 4px 0 0; font-size: 22px; letter-spacing: -0.04em; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--accent); font-size: 24px; }

.search-list { display: grid; gap: 12px; margin-top: 18px; }
.search-list.compact { margin-top: 0; }
.search-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(16, 21, 28, 0.88);
}
.search-symbol { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: rgba(255, 107, 50, 0.1); color: var(--accent); font-size: 18px; }
.search-card h3 { margin: 0 0 4px; font-size: 14px; }
.search-card p { margin: 0; color: var(--muted); font-size: 11px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.status-pill::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.status-pill.paused { color: #7f8995; }
.card-actions { display: flex; align-items: center; gap: 6px; }
.mini-action { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 11px; background: transparent; color: #9ba5b2; }

.empty-state { padding: 30px 22px; border: 1px dashed rgba(255,255,255,.12); border-radius: 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); margin-bottom: 6px; }

.page-heading { padding: 35px 0 22px; }
.page-heading h1 { margin-top: 7px; font-size: 38px; }
.page-heading p { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.billing-note { margin: 0 0 14px; padding: 11px 14px; border-radius: 13px; background: rgba(255,107,50,.08); color: #e3a17f; font-size: 12px; text-align: center; }

.plans-list { display: grid; gap: 12px; }
.tier-card { position: relative; padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); overflow: hidden; }
.tier-card.featured { border-color: rgba(255,107,50,.5); background: linear-gradient(145deg, rgba(39,25,20,.95), rgba(16,20,27,.96)); }
.tier-badge { position: absolute; right: 14px; top: 14px; padding: 6px 9px; border-radius: 999px; background: var(--accent); color: #1d0b04; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.tier-top { display: flex; justify-content: space-between; align-items: flex-end; padding-right: 62px; }
.tier-card h2 { margin: 0; font-size: 20px; }
.tier-price { margin-top: 8px; font-size: 28px; font-weight: 800; letter-spacing: -.04em; }
.tier-price small { font-size: 12px; color: var(--muted); font-weight: 600; }
.tier-features { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.tier-features span { padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.045); color: #b7bfc8; font-size: 11px; }
.tier-card button { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 13px; background: #1a212b; font-weight: 700; }
.tier-card.featured button { border: 0; background: var(--accent); color: #1c0a04; }

.profile-hero { display: flex; align-items: center; gap: 16px; padding: 38px 0 24px; }
.profile-avatar { width: 66px; height: 66px; border-radius: 22px; font-size: 18px; }
.profile-hero h1 { margin-top: 5px; font-size: 25px; }
.profile-hero p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats-grid article { padding: 17px; min-height: 91px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.stats-grid .accent-stat { grid-column: 1 / -1; min-height: 82px; background: linear-gradient(135deg, rgba(255,107,50,.18), rgba(255,107,50,.06)); }
.stats-grid span { color: var(--muted); font-size: 11px; }
.stats-grid strong { font-size: 20px; letter-spacing: -.03em; }
.accent-stat strong { color: var(--accent-2); }

.referral-card { display: grid; grid-template-columns: 58px 1fr; gap: 14px; margin-top: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.referral-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: var(--accent); color: #1f0b04; font-size: 15px; font-weight: 800; }
.referral-card h2 { margin: 3px 0 5px; font-size: 16px; }
.referral-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.secondary-button { grid-column: 1 / -1; min-height: 44px; background: #1c232d; border: 1px solid var(--line); }

.settings-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.settings-card strong, .settings-card span { display: block; }
.settings-card strong { font-size: 14px; }
.settings-card span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.switch input { position: absolute; opacity: 0; }
.switch > span { position: relative; width: 46px; height: 27px; display: block; border-radius: 999px; background: #29313b; transition: .2s; }
.switch > span::after { content: ""; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(19px); }
.admin-button { width: 100%; min-height: 48px; margin-top: 12px; border: 1px solid rgba(255,107,50,.35); background: transparent; color: var(--accent-2); }

.back-link { display: block; margin: 0 0 20px; padding: 0; border: 0; background: transparent; color: var(--accent-2); font-size: 13px; font-weight: 800; }
.system-heading { padding-bottom: 16px; }
.system-overview { padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.system-state { display: flex; align-items: center; gap: 13px; }
.system-state > span { font-size: 28px; }
.system-state strong, .system-state small { display: block; }
.system-state strong { font-size: 17px; }
.system-state small, .event-row small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.system-ok, .system-error { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.45; }
.system-ok { color: #8cd1ae; }.system-error { color: #f09a88; }
.system-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.system-controls .secondary-button { min-height: 48px; padding: 8px; font-size: 11px; }
.system-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.system-stats article { min-height: 88px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.system-stats article:last-child { grid-column: 1 / -1; min-height: 68px; }
.system-stats span, .system-stats strong { display: block; }.system-stats span { color: var(--muted); font-size: 10px; }.system-stats strong { margin-top: 10px; font-size: 17px; }
.event-list { display: grid; gap: 8px; margin: 12px 0 24px; }
.event-row { display: flex; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: rgba(16,21,28,.88); }
.event-row > span { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: rgba(84,206,143,.15); color: var(--success); font-size: 12px; font-weight: 800; }
.event-row.error > span { background: rgba(255,110,90,.15); color: var(--danger); }.event-row strong, .event-row small { display: block; }.event-row strong { font-size: 11px; line-height: 1.35; }

.bottom-nav {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 9px 12px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(9, 12, 17, .9);
  backdrop-filter: blur(20px);
}
.bottom-nav button { min-height: 55px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; background: transparent; color: #6f7885; font-size: 9px; font-weight: 700; }
.bottom-nav button.active { color: var(--accent); }
.nav-icon { font-size: 23px; line-height: 1; font-weight: 400; }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.68); opacity: 0; visibility: hidden; transition: .2s; }
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal { width: min(100%, 520px); padding: 12px 20px calc(24px + var(--safe-bottom)); border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0; background: #11161d; transform: translateY(24px); transition: .22s; }
.modal-backdrop.open .modal { transform: none; }
.modal-handle { width: 42px; height: 4px; margin: 0 auto 20px; border-radius: 4px; background: #353d48; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.modal-heading h2 { margin: 5px 0 18px; font-size: 25px; }
.close-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--muted); font-size: 24px; }
form { display: grid; gap: 15px; }
form label { display: grid; gap: 7px; color: #aeb6c0; font-size: 11px; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 14px; outline: 0; resize: none; background: #0b0f14; color: var(--text); font-size: 14px; }
input:focus, textarea:focus { border-color: rgba(255,107,50,.65); box-shadow: 0 0 0 3px rgba(255,107,50,.08); }
.form-error { min-height: 15px; margin: -5px 0 0; color: var(--danger); font-size: 11px; }

.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(86px + var(--safe-bottom)); transform: translate(-50%, 18px); width: max-content; max-width: calc(100% - 32px); padding: 12px 16px; border: 1px solid var(--line); border-radius: 13px; background: #202733; color: #fff; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.hidden { display: none !important; }

@media (min-width: 600px) {
  body { padding: 18px 0; }
  .app-shell { min-height: calc(100vh - 36px); border: 1px solid var(--line); border-radius: 30px; background: rgba(8,11,16,.75); box-shadow: 0 30px 90px rgba(0,0,0,.35); }
  .bottom-nav { bottom: 18px; width: min(calc(100% - 36px), 520px); border: 1px solid var(--line); border-radius: 0 0 30px 30px; }
}

@media (max-width: 360px) {
  .hero h1 { font-size: 38px; }
  .app-shell { padding-left: 14px; padding-right: 14px; }
}
