:root {
  color-scheme: dark;
  --bg: #050914;
  --panel: #0b1222;
  --panel-2: #101a2f;
  --panel-3: #15223b;
  --elevated: #111c31;
  --line: rgba(151, 171, 207, 0.13);
  --line-strong: rgba(72, 204, 255, 0.3);
  --text: #f7f9ff;
  --muted: #93a2bd;
  --blue: #356df3;
  --blue-hover: #4b7df7;
  --cyan: #4ad5ff;
  --cyan-soft: rgba(74, 213, 255, 0.1);
  --danger: #ff6b81;
  --success: #5ee4b8;
  --warning: #ffca68;
  --shadow: 0 20px 70px rgba(0, 3, 16, 0.34);
  --shadow-soft: 0 10px 32px rgba(0, 3, 16, 0.2);
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --nav-height: 72px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-2: #f2f5fb;
  --panel-3: #e9eef8;
  --elevated: #ffffff;
  --line: rgba(31, 54, 94, 0.1);
  --line-strong: rgba(53, 109, 243, 0.24);
  --text: #101828;
  --muted: #65738b;
  --blue: #356df3;
  --blue-hover: #255bd9;
  --cyan: #087f9c;
  --cyan-soft: rgba(8, 127, 156, 0.08);
  --danger: #d63d5b;
  --success: #087d69;
  --warning: #a86800;
  --shadow: 0 18px 60px rgba(34, 54, 92, 0.11);
  --shadow-soft: 0 8px 28px rgba(34, 54, 92, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  min-width: 0;
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

button,
.section,
.connection-copy,
.list-row,
.detail-row,
.device-row,
.history-row,
.bonus-nudge {
  overflow-wrap: anywhere;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.app {
  width: 100%;
  min-height: 100dvh;
}

.side-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 224px;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.brand,
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  padding: 0 8px 26px;
}

.brand img,
.mobile-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  transform: scale(1.45);
}

.brand span {
  display: grid;
  line-height: 1.05;
}

.brand b,
.mobile-brand b {
  font-size: 15px;
  font-weight: 850;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.rail-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  position: relative;
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 650;
}

.nav-item.active {
  color: var(--text);
  background: var(--panel-3);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--cyan);
}

.nav-item.active svg {
  color: var(--cyan);
}

.rail-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 8px 0;
  border-top: 1px solid var(--line);
}

.presence {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.presence i,
.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 15%, transparent);
}

.workspace {
  width: calc(100% - 224px);
  min-width: 0;
  margin-left: 224px;
  padding: 0 clamp(24px, 4vw, 56px) 48px;
}

.app-bar {
  width: min(100%, 1200px);
  min-width: 0;
  height: 104px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.page-heading h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

.page-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.mobile-brand {
  display: none;
}

.avatar,
.icon-btn,
.quick-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 8px;
  color: white;
  background: var(--blue);
  font-weight: 800;
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 8px;
}

.screen {
  width: min(100%, 1200px);
  min-width: 0;
  margin: 28px auto 0;
}

.screen-stack {
  display: grid;
  gap: 20px;
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 20px;
}

.section {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section.plain {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2,
.sheet-head h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.overline {
  margin: 0 0 5px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.connection-panel {
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  overflow: hidden;
  padding: 34px;
  border: 1px solid rgba(11, 69, 255, 0.42);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.connection-copy {
  position: relative;
  z-index: 1;
  max-width: 560px;
}

.connection-copy h2 {
  max-width: 520px;
  margin: 10px 0 10px;
  font-size: 32px;
  line-height: 1.12;
  letter-spacing: 0;
}

.connection-copy > p {
  max-width: 500px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
}

.connection-visual {
  width: 188px;
  height: 188px;
  flex: 0 0 188px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 18px rgba(11, 69, 255, 0.08);
}

.connection-visual img {
  width: 150px;
  height: 150px;
  object-fit: contain;
}

.connection-visual > svg {
  width: 72px;
  height: 72px;
  color: var(--cyan);
  stroke-width: 1.5;
}

.state-label {
  width: max-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--success);
  font-size: 12px;
  font-weight: 750;
}

.state-label.expired {
  color: var(--danger);
}

.state-label.expired .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 15%, transparent);
}

.rev-share-value {
  width: max-content;
  max-width: 100%;
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 20px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--cyan-soft);
}

.rev-share-value span {
  color: var(--muted);
  font-size: 12px;
}

.rev-share-value strong {
  color: var(--cyan);
  font-size: 24px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  max-width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
}

.primary-btn {
  color: #fff;
  background: var(--blue);
}

.primary-btn:hover {
  background: var(--blue-hover);
}

.secondary-btn {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-2);
}

.danger-btn {
  color: #fff;
  background: var(--danger);
}

.wide {
  width: 100%;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat {
  min-width: 0;
  padding: 18px 20px;
}

.stat + .stat {
  border-left: 1px solid var(--line);
}

.stat span,
.detail-row span,
.list-row p,
.device-info p {
  color: var(--muted);
}

.stat span {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.stat strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  min-height: 86px;
  flex-direction: column;
  gap: 8px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

.quick-action svg {
  color: var(--cyan);
}

.bonus-nudge {
  width: 100%;
  min-width: 0;
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  text-align: left;
}

.bonus-nudge > span:nth-child(2) {
  min-width: 0;
  flex: 1;
  display: grid;
}

.bonus-nudge strong {
  font-size: 14px;
}

.bonus-nudge small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.bonus-nudge > svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.maintenance-screen {
  min-height: calc(100dvh - 180px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
}

.maintenance-screen img {
  width: 210px;
  height: 160px;
  margin-bottom: 4px;
  object-fit: contain;
}

.maintenance-screen h1 {
  max-width: 520px;
  margin: 4px 0 10px;
  font-size: 28px;
  letter-spacing: 0;
}

.maintenance-screen > p:not(.overline) {
  max-width: 470px;
  margin: 0 0 22px;
  color: var(--muted);
}

.progress-wrap {
  display: grid;
  gap: 8px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel-3);
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.detail-list,
.list,
.device-list,
.history-list {
  display: grid;
}

.detail-row,
.list-row,
.device-row,
.history-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row:last-child,
.list-row:last-child,
.device-row:last-child,
.history-row:last-child {
  border-bottom: 0;
}

.detail-row span,
.detail-row strong {
  min-width: 0;
}

.detail-row strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.list-row {
  width: 100%;
  padding: 15px 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.list-row > div:first-child,
.list-row > div,
.device-info,
.history-row > div {
  min-width: 0;
}

.list-row > div {
  flex: 1;
}

.list-row h3,
.device-info h3,
.history-row h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.list-row p,
.device-info p,
.history-row p {
  margin: 3px 0 0;
  font-size: 12px;
}

.row-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--cyan);
  background: var(--cyan-soft);
}

.list-row .chevron {
  margin-left: auto;
  color: var(--muted);
}

.device-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.small-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 11%, transparent);
}

.referral-link {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.referral-link code {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.withdraw-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 13px;
}

.withdraw-note.ready {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--cyan-soft);
}

.withdraw-note svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--cyan);
}

.reward-strip {
  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);
}

.reward-step {
  padding: 18px;
  background: var(--panel);
}

.reward-step b {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
}

.reward-step span {
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  min-height: 150px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  margin: 0 auto 10px;
  color: var(--cyan);
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.theme-option,
.tariff-option,
.payment-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
}

.theme-option {
  min-height: 42px;
}

.theme-option.active,
.tariff-option.active {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 15%, var(--panel));
}

.field-row {
  display: flex;
  gap: 10px;
}

.field-row input {
  height: 44px;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  padding: 0 13px;
  color: var(--text);
  background: var(--panel-2);
}

.field-row input:focus {
  border-color: var(--blue);
}

.sheet-layer[hidden],
.toast[hidden] {
  display: none;
}

.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  background: rgba(0, 4, 18, 0.74);
  backdrop-filter: blur(4px);
}

.sheet {
  position: relative;
  width: min(100%, 620px);
  max-height: min(760px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sheet-handle {
  display: none;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.sheet-body {
  max-height: calc(100dvh - 150px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
}

.tariff-scroll {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.tariff-option {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
  text-align: left;
}

.tariff-option strong,
.tariff-option span {
  display: block;
}

.tariff-option span {
  color: var(--muted);
  font-size: 12px;
}

.selected-plan {
  margin: 18px 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.selected-plan > div {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.selected-plan h3 {
  margin: 0;
  font-size: 16px;
}

.selected-plan strong {
  font-size: 24px;
}

.selected-plan p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.payment-list {
  display: grid;
  gap: 8px;
}

.payment-option {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  text-align: left;
}

.payment-option .row-icon {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.payment-option span:nth-child(2) {
  flex: 1;
  font-weight: 700;
}

.qr-wrap {
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

.qr-wrap img {
  width: min(100%, 300px);
  aspect-ratio: 1;
  border-radius: 8px;
  background: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 80;
  max-width: calc(100vw - 28px);
  display: flex;
  align-items: center;
  gap: 9px;
  transform: translateX(-50%);
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-3);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.toast svg {
  color: var(--cyan);
}

.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 18px;
  border-radius: 6px;
  background: var(--panel-2);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(142, 162, 200, 0.16), transparent);
  animation: shimmer 1.2s infinite;
}

.skeleton.hero-skeleton {
  height: 280px;
}

.skeleton.line-skeleton {
  width: 70%;
}

.bottom-nav {
  display: none;
}

.maintenance-mode .bottom-nav {
  display: none;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

@media (max-width: 900px) {
  .side-rail {
    width: 190px;
  }

  .workspace {
    width: calc(100% - 190px);
    margin-left: 190px;
    padding-inline: 22px;
  }

  .columns {
    grid-template-columns: 1fr;
  }

  .connection-visual {
    width: 150px;
    height: 150px;
    flex-basis: 150px;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 14px;
  }

  .side-rail,
  .page-heading {
    display: none;
  }

  .workspace {
    width: 100%;
    margin-left: 0;
    padding: 0 12px calc(var(--nav-height) + 20px + env(safe-area-inset-bottom));
  }

  .maintenance-mode .workspace {
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .app-bar {
    position: sticky;
    top: 0;
    z-index: 9;
    height: calc(58px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px);
  }

  .mobile-brand {
    display: flex;
  }

  .mobile-brand img {
    width: 30px;
    height: 30px;
  }

  .mobile-brand b {
    font-size: 13px;
  }

  .avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 12px;
  }

  .screen {
    margin-top: 12px;
  }

  .screen-stack,
  .columns {
    gap: 14px;
  }

  .section {
    padding: 15px;
    box-shadow: none;
  }

  .section-head {
    gap: 10px;
    margin-bottom: 13px;
  }

  .section-head h2,
  .sheet-head h2 {
    font-size: 17px;
  }

  .connection-panel {
    min-height: 0;
    display: block;
    padding: 16px;
    box-shadow: none;
  }

  .connection-copy h2 {
    max-width: 100%;
    margin-top: 7px;
    font-size: 23px;
    line-height: 1.16;
  }

  .connection-copy > p {
    margin-bottom: 14px;
    font-size: 14px;
  }

  .connection-visual {
    position: absolute;
    right: -26px;
    top: -30px;
    width: 126px;
    height: 126px;
    opacity: 0.28;
    box-shadow: none;
  }

  .connection-visual img {
    width: 110px;
    height: 110px;
  }

  .maintenance-screen {
    min-height: calc(100dvh - 100px - env(safe-area-inset-top));
    padding: 24px 12px;
  }

  .maintenance-screen img {
    width: 170px;
    height: 130px;
  }

  .maintenance-screen h1 {
    font-size: 24px;
  }

  .connection-copy {
    max-width: 100%;
    padding-right: 72px;
  }

  .button-row .primary-btn,
  .button-row .secondary-btn {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
  }

  .stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat {
    padding: 13px 10px;
  }

  .stat span {
    font-size: 10px;
  }

  .stat strong {
    font-size: 13px;
  }

  .quick-action {
    min-height: 76px;
    padding: 9px 5px;
    font-size: 12px;
  }

  .quick-action span,
  .bottom-nav .nav-item span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .reward-strip {
    grid-template-columns: 1fr;
  }

  .reward-step {
    padding: 14px;
  }

  .referral-link,
  .field-row {
    align-items: stretch;
    flex-direction: column;
  }

  .referral-link .secondary-btn,
  .field-row .primary-btn {
    width: 100%;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 6px 8px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    backdrop-filter: blur(16px);
  }

  .bottom-nav .nav-item {
    height: 56px;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    font-size: 10px;
    text-align: center;
  }

  .bottom-nav .nav-item.active {
    color: var(--cyan);
    background: transparent;
  }

  .bottom-nav .nav-item.active::before {
    display: none;
  }

  .bottom-nav .nav-item svg {
    width: 19px;
    height: 19px;
  }

  .sheet-layer {
    padding: 0;
    align-items: flex-end;
  }

  .sheet {
    width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top) - 8px);
    display: flex;
    flex-direction: column;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .sheet-handle {
    width: 40px;
    height: 4px;
    display: block;
    margin: 8px auto 0;
    border-radius: 4px;
    background: var(--line);
  }

  .sheet-head {
    flex: 0 0 auto;
    padding: 13px 16px;
  }

  .sheet-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .tariff-scroll {
    display: flex;
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .tariff-scroll::-webkit-scrollbar {
    display: none;
  }

  .tariff-option {
    min-width: 132px;
    flex: 0 0 132px;
    scroll-snap-align: start;
  }

  .toast {
    bottom: calc(var(--nav-height) + 12px + env(safe-area-inset-bottom));
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .workspace {
    padding-inline: 9px;
  }

  .connection-panel {
    padding: 14px;
  }

  .connection-copy h2 {
    font-size: 21px;
  }

  .connection-copy {
    padding-right: 58px;
  }

  .connection-visual {
    right: -34px;
    top: -36px;
    width: 118px;
    height: 118px;
  }

  .stat {
    padding-inline: 7px;
  }

  .stat strong {
    font-size: 12px;
  }

  .quick-action {
    font-size: 11px;
  }

  .section-head {
    flex-direction: column;
  }
}

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

/* Premium dashboard refresh */
body {
  background:
    radial-gradient(circle at 82% -10%, color-mix(in srgb, var(--blue) 11%, transparent), transparent 34rem),
    var(--bg);
}

button,
a,
input {
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease,
    box-shadow 160ms ease, transform 160ms ease, opacity 160ms ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--cyan) 48%, transparent);
  outline-offset: 3px;
}

.side-rail {
  border-right-color: var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
}

.nav-item {
  min-height: 46px;
  border-radius: var(--radius-sm);
}

.nav-item.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 18%, var(--panel)), var(--panel-3));
}

.avatar,
.icon-btn,
.row-icon,
.small-btn {
  border-radius: var(--radius-sm);
}

.avatar,
.icon-btn {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
}

.avatar {
  background: linear-gradient(145deg, var(--blue), color-mix(in srgb, var(--cyan) 68%, var(--blue)));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--blue) 26%, transparent);
}

.screen-stack {
  gap: 18px;
}

.section,
.connection-panel,
.stats-row,
.bonus-nudge,
.reward-strip {
  border-radius: var(--radius);
}

.section {
  border-color: var(--line);
  background: linear-gradient(145deg, var(--elevated), var(--panel));
  box-shadow: var(--shadow-soft);
}

.premium-hero {
  isolation: isolate;
  min-height: 280px;
  border: 1px solid color-mix(in srgb, var(--blue) 35%, var(--line));
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 85% 30%, color-mix(in srgb, var(--cyan) 12%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 12%, var(--panel)), var(--panel) 58%);
  box-shadow: var(--shadow);
}

.premium-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -10% -55% 35%;
  height: 240px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--blue) 9%, transparent);
  filter: blur(36px);
}

.premium-hero.expired-hero {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  background:
    radial-gradient(circle at 85% 25%, color-mix(in srgb, var(--danger) 10%, transparent), transparent 36%),
    linear-gradient(135deg, color-mix(in srgb, var(--danger) 7%, var(--panel)), var(--panel) 60%);
}

.connection-copy h2 {
  letter-spacing: -0.035em;
}

.connection-copy > p {
  line-height: 1.6;
}

.hero-orbit {
  border-color: color-mix(in srgb, var(--cyan) 26%, transparent);
  background:
    radial-gradient(circle, color-mix(in srgb, var(--blue) 14%, var(--panel-2)), var(--panel-2) 65%);
  box-shadow:
    inset 0 0 0 18px color-mix(in srgb, var(--blue) 7%, transparent),
    0 0 80px color-mix(in srgb, var(--cyan) 10%, transparent);
}

.hero-actions {
  width: min(100%, 420px);
  display: grid;
  gap: 10px;
}

.hero-actions > .primary-btn {
  width: 100%;
}

.hero-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.active-dashboard .premium-hero {
  min-height: 238px;
  padding: 26px 28px;
}

.active-dashboard .connection-copy h2 {
  max-width: 430px;
  margin-bottom: 10px;
  font-size: clamp(28px, 3.2vw, 36px);
  line-height: 1.08;
}

.active-dashboard .connection-copy > p {
  max-width: 430px;
  margin-bottom: 16px;
  line-height: 1.45;
}

.active-dashboard .hero-actions {
  width: min(100%, 400px);
  gap: 8px;
}

.active-dashboard .hero-tools {
  gap: 8px;
}

.active-dashboard .hero-tools .icon-action {
  min-height: 44px;
  background: color-mix(in srgb, var(--panel-2) 76%, transparent);
}

.primary-btn,
.secondary-btn,
.danger-btn,
.icon-action,
.text-btn {
  min-height: 46px;
  border-radius: var(--radius-sm);
}

.primary-btn {
  background: linear-gradient(135deg, var(--blue), color-mix(in srgb, var(--blue) 76%, var(--cyan)));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--blue) 24%, transparent);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 28px color-mix(in srgb, var(--blue) 29%, transparent);
}

.primary-btn:active,
.secondary-btn:active,
.icon-action:active,
.quick-action:active {
  transform: translateY(1px) scale(0.99);
}

.primary-btn-lg {
  min-height: 52px;
  padding-inline: 22px;
  font-size: 15px;
}

.secondary-btn {
  background: color-mix(in srgb, var(--panel-2) 88%, transparent);
}

.icon-action {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  color: var(--text);
  background: color-mix(in srgb, var(--panel-2) 88%, transparent);
  font-size: 12px;
  font-weight: 700;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  padding: 0;
  color: var(--cyan);
  background: transparent;
  font-weight: 720;
}

.text-btn svg {
  width: 17px;
  height: 17px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.compact-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.compact-metric {
  min-width: 0;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--elevated), var(--panel));
  box-shadow: var(--shadow-soft);
}

.compact-metric-icon,
.expiry-notice-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 11%, var(--panel-2));
}

.compact-metric-icon svg,
.expiry-notice-icon svg {
  width: 18px;
  height: 18px;
}

.compact-metric > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.compact-metric span:not(.compact-metric-icon) {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-metric strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expiry-notice {
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px 9px 13px;
  border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--warning) 7%, var(--panel));
}

.expiry-notice-icon {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, var(--panel-2));
}

.expiry-notice > div {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.expiry-notice strong,
.expiry-notice span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expiry-notice strong {
  font-size: 13px;
}

.expiry-notice > div > span {
  color: var(--muted);
  font-size: 11px;
}

.expiry-notice .secondary-btn {
  min-height: 44px;
  padding-inline: 15px;
  white-space: nowrap;
}

.metric-tile {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--elevated), var(--panel));
  box-shadow: var(--shadow-soft);
}

.metric-tile > div {
  min-width: 0;
  display: grid;
}

.metric-tile span:not(.metric-icon),
.metric-tile small {
  color: var(--muted);
}

.metric-tile span:not(.metric-icon) {
  font-size: 11px;
  font-weight: 700;
}

.metric-tile strong {
  overflow: hidden;
  margin: 2px 0;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-tile small {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--cyan);
  background: var(--cyan-soft);
}

.metric-tile.success .metric-icon {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 11%, transparent);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.lte-card,
.renewal-card {
  min-height: 205px;
  display: flex;
  flex-direction: column;
}

.lte-card .progress-wrap,
.renewal-card .wide {
  margin-top: auto;
}

.renewal-card.attention {
  border-color: color-mix(in srgb, var(--warning) 30%, var(--line));
  background: linear-gradient(145deg, color-mix(in srgb, var(--warning) 7%, var(--elevated)), var(--panel));
}

.progress {
  height: 10px;
}

.progress i {
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.bonus-nudge {
  min-height: 74px;
  border-color: color-mix(in srgb, var(--cyan) 20%, var(--line));
  background: linear-gradient(120deg, color-mix(in srgb, var(--cyan) 7%, var(--panel)), var(--panel));
  box-shadow: var(--shadow-soft);
}

.device-row {
  min-height: 72px;
}

.device-info h3 {
  font-size: 15px;
}

.small-btn {
  min-width: 44px;
  width: 44px;
  height: 44px;
}

.recommended-card {
  border-color: color-mix(in srgb, var(--blue) 25%, var(--line));
}

.plan-price {
  font-size: 22px;
}

.sheet {
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 100px rgba(0, 3, 16, 0.52);
  animation: sheet-in 180ms ease-out;
}

.sheet-backdrop {
  animation: fade-in 160ms ease-out;
}

.theme-option,
.tariff-option,
.payment-option,
.field-row input {
  border-radius: var(--radius-sm);
}

.theme-option {
  min-height: 44px;
}

.tariff-option {
  position: relative;
  min-height: 126px;
  align-content: start;
  padding: 15px;
}

.tariff-option em {
  width: max-content;
  margin-bottom: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.tariff-option b {
  font-size: 17px;
}

.tariff-option small {
  margin-top: auto;
  color: var(--success);
  font-size: 10px;
  font-weight: 750;
}

.tariff-option.active {
  border-color: var(--blue);
  background: linear-gradient(145deg, color-mix(in srgb, var(--blue) 16%, var(--panel)), var(--panel-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 25%, transparent);
}

.selected-plan {
  border-radius: var(--radius);
}

.checkout-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--cyan-soft);
}

.checkout-summary > div {
  min-width: 0;
  flex: 1;
  display: grid;
}

.checkout-summary small {
  margin-top: 2px;
  color: var(--muted);
}

.danger-confirm {
  display: grid;
  justify-items: center;
  padding: 8px 0 2px;
  text-align: center;
}

.danger-confirm-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 11%, transparent);
}

.danger-confirm h3 {
  margin: 16px 0 7px;
  font-size: 18px;
}

.danger-confirm p {
  max-width: 410px;
  margin: 0 0 20px;
  color: var(--muted);
}

.toast {
  min-height: 46px;
  border-radius: 14px;
  animation: toast-in 180ms ease-out;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(16px) scale(0.99); }
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
}

@media (max-width: 1050px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  body {
    background:
      radial-gradient(circle at 100% 0, color-mix(in srgb, var(--blue) 10%, transparent), transparent 22rem),
      var(--bg);
  }

  .workspace {
    padding-inline: 14px;
  }

  .app-bar {
    border-bottom: 0;
  }

  .screen {
    margin-top: 8px;
  }

  .premium-hero {
    padding: 20px;
    border-radius: 20px;
  }

  .active-dashboard .premium-hero {
    min-height: 0;
    padding: 17px;
  }

  .active-dashboard .connection-copy {
    padding-right: 0;
  }

  .active-dashboard .connection-copy h2 {
    max-width: 330px;
    margin: 8px 0;
    font-size: clamp(25px, 7.2vw, 30px);
    line-height: 1.08;
  }

  .active-dashboard .connection-copy > p {
    max-width: 390px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.45;
  }

  .active-dashboard .connection-visual {
    display: none;
  }

  .connection-copy {
    padding-right: 54px;
  }

  .connection-copy h2 {
    max-width: 290px;
    font-size: clamp(24px, 7vw, 29px);
  }

  .connection-visual {
    opacity: 0.18;
  }

  .hero-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions .primary-btn {
    width: 100%;
  }

  .hero-actions .secondary-btn {
    grid-column: 1 / -1;
  }

  .icon-action {
    width: 100%;
    min-height: 48px;
  }

  .active-dashboard .hero-tools .icon-action {
    min-height: 44px;
  }

  .new-hero .hero-actions,
  .expired-hero .hero-actions {
    display: flex;
  }

  .metric-grid {
    gap: 10px;
  }

  .compact-metrics {
    gap: 7px;
  }

  .compact-metric {
    min-height: 78px;
    display: grid;
    align-content: center;
    gap: 6px;
    padding: 9px;
  }

  .compact-metric-icon {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    border-radius: 9px;
  }

  .compact-metric-icon svg {
    width: 16px;
    height: 16px;
  }

  .compact-metric strong {
    font-size: 14px;
  }

  .expiry-notice {
    gap: 8px;
  }

  .metric-tile {
    min-height: 104px;
    align-items: flex-start;
    padding: 14px;
  }

  .metric-tile .metric-icon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .metric-tile strong {
    font-size: 15px;
  }

  .metric-tile small {
    white-space: normal;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .lte-card,
  .renewal-card {
    min-height: 184px;
  }

  .section {
    border-radius: var(--radius);
  }

  .bottom-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-inline: max(16px, env(safe-area-inset-left));
  }

  .bottom-nav .nav-item.active {
    color: var(--text);
  }

  .bottom-nav .nav-item.active svg {
    color: var(--cyan);
    filter: drop-shadow(0 0 8px color-mix(in srgb, var(--cyan) 28%, transparent));
  }

  .sheet {
    border-radius: 22px 22px 0 0;
  }

  .tariff-option {
    min-width: 150px;
    flex-basis: 150px;
  }

  .danger-confirm .button-row {
    width: 100%;
  }

  .danger-confirm .button-row > button {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .workspace {
    padding-inline: 10px;
  }

  .premium-hero {
    padding: 17px;
  }

  .active-dashboard .premium-hero {
    padding: 15px;
  }

  .active-dashboard .connection-copy h2 {
    font-size: 24px;
  }

  .active-dashboard .primary-btn-lg {
    padding-inline: 14px;
  }

  .compact-metrics {
    gap: 6px;
  }

  .compact-metric {
    padding: 8px;
  }

  .expiry-notice-icon {
    display: none;
  }

  .metric-tile {
    display: grid;
    gap: 8px;
  }
}
