.account-shell {
  max-width: 980px;
}

[hidden] {
  display: none !important;
}

.account-intro {
  padding: 58px 0 30px;
}

.account-intro h1 {
  margin: 10px 0 12px;
  font-size: clamp(42px, 8vw, 76px);
  line-height: .95;
  letter-spacing: 0;
}

.account-intro > p:last-child {
  max-width: 680px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.55;
}

.auth-card {
  /* Fixed width so the card never resizes when switching tabs or note text. */
  width: min(100%, 470px);
  margin: 0 auto 60px;
  padding: 26px;
}

/* Reserve note height so a 1- vs 2-line note doesn't shift the card. */
.account-form .form-note[data-auth-note] {
  min-height: 40px;
  margin: 0;
}

.auth-forgot {
  justify-self: center;
  margin-top: -2px;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color .18s ease;
}

.auth-forgot:hover {
  color: var(--ink);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 28px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
}

.auth-tab {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  color: var(--ink-soft);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.auth-tab.is-active {
  color: var(--ink);
  background: var(--surface-strong);
  box-shadow: 0 8px 22px rgb(0 0 0 / 12%);
}

.account-form {
  display: grid;
  gap: 14px;
}

.dashboard {
  display: grid;
  gap: 28px;
  padding-bottom: 58px;
}

.dashboard-head,
.section-head {
  align-items: center;
}

.dashboard-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-head h2 {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: clamp(24px, 4vw, 38px);
}

.compact-button {
  width: auto;
  min-width: 112px;
}

.icon-refresh {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface-2);
  font-size: 26px;
  cursor: pointer;
}

.subscription-list {
  display: block;
}

.subscription-products {
  margin: 0 0 14px;
}

.subscription-card {
  display: grid;
  gap: 12px;
  min-height: 220px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: var(--shadow-card);
}

.subscription-card.is-empty {
  align-content: center;
  color: var(--ink-soft);
  border-style: dashed;
  box-shadow: none;
}

.subscription-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subscription-card h3,
.subscription-card p {
  margin: 0;
}

.subscription-card h3 {
  font-size: 22px;
}

.subscription-status {
  padding: 6px 10px;
  border-radius: 999px;
  color: #052a20;
  background: #65e0b8;
  font-size: 12px;
  font-weight: 900;
}

.subscription-date {
  color: var(--accent);
  font-size: 28px;
  font-weight: 900;
}

.subscription-meta {
  color: var(--ink-soft);
  line-height: 1.45;
}

.subscription-devices {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.subscription-devices li {
  border-top: 1px solid var(--border);
}

.subscription-device {
  overflow: hidden;
}

.subscription-device summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 2px;
  list-style: none;
  cursor: pointer;
}

.subscription-device summary::-webkit-details-marker {
  display: none;
}

.subscription-device-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.subscription-device-expiry {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 12px;
}

.subscription-device-chevron {
  color: var(--ink-soft);
  transition: transform 0.22s ease;
}

.subscription-device[open] .subscription-device-chevron {
  transform: rotate(180deg);
}

.subscription-device-access {
  display: grid;
  gap: 9px;
  padding: 4px 0 14px;
}

.subscription-device-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.subscription-link {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.subscription-device-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.device-action {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.device-action-secondary {
  color: var(--ink);
  background: var(--surface);
}

.device-action-primary {
  color: #052a20;
  border-color: var(--accent);
  background: var(--accent);
}

.subscription-action {
  min-height: 46px;
  margin-top: auto;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.subscription-action:hover {
  background: color-mix(in srgb, var(--accent) 15%, var(--surface-2));
}

.extra-device-panel {
  margin-top: 14px;
  padding: 22px;
}

.extra-device-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.extra-device-head h3 {
  margin: 5px 0 0;
  font-size: 25px;
}

.extra-device-close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface-2);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.extra-device-note {
  max-width: 620px;
  margin: 18px 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.extra-device-note strong {
  color: var(--ink);
}

.extra-device-pay {
  width: auto;
  min-width: 220px;
  margin-top: 14px;
}

.account-buy {
  padding: 26px;
}

.account-products {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0;
}

.account-product {
  display: grid;
  gap: 5px;
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: var(--surface-2);
  cursor: pointer;
}

.account-product span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.account-product.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.account-plans {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.account-plan {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: var(--surface-2);
  cursor: pointer;
}

.account-plan strong,
.account-plan span {
  display: block;
}

.account-plan span {
  margin-top: 12px;
  color: var(--accent);
  font-size: 20px;
  font-weight: 900;
}

.account-plan.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-2));
}

.account-device {
  max-width: 500px;
}

.account-pay {
  margin-top: 16px;
}

.account-price-note {
  margin: -8px 0 18px;
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 720px) {
  .account-intro {
    padding-top: 38px;
  }

  .topbar .bot-link {
    padding-inline: 12px;
    font-size: 13px;
  }

  .subscription-list,
  .account-products {
    grid-template-columns: 1fr;
  }

  .account-plans {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-card,
  .account-buy {
    padding: 18px;
  }

  .subscription-device summary {
    grid-template-columns: minmax(0, 1fr) 20px;
  }

  .subscription-device-expiry {
    grid-column: 1;
    grid-row: 2;
  }

  .subscription-device-chevron {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .device-action {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .account-shell .topbar-actions {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .account-intro {
    padding: 20px 0 4px;
  }

  .account-intro h1 {
    margin: 10px 0 10px;
    font-size: clamp(36px, 11vw, 48px);
    line-height: 1;
    overflow-wrap: anywhere;
  }

  .account-intro > p:last-child {
    font-size: 15px;
  }

  .auth-card {
    width: 100%;
    margin-bottom: 36px;
    padding: 18px;
  }

  .auth-tabs {
    margin-bottom: 22px;
  }

  .auth-tab {
    min-width: 0;
    padding-inline: 8px;
    font-size: 14px;
  }

  .dashboard {
    gap: 22px;
    padding-bottom: 38px;
  }

  .dashboard-head {
    align-items: flex-start;
  }

  .dashboard-head > div {
    min-width: 0;
  }

  .dashboard-head h2 {
    font-size: 21px;
    line-height: 1.25;
  }

  .compact-button {
    min-width: 88px;
    padding-inline: 14px;
  }

  html[data-product-chosen][data-product="vless"] .account-products,
  html[data-product-chosen][data-product="amneziawg"] .account-products,
  .account-products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .account-product {
    min-width: 0;
    min-height: 76px;
    padding: 12px;
  }

  .account-product strong {
    overflow-wrap: anywhere;
  }

  html[data-product-chosen] .account-product:not(.is-active) > span {
    opacity: 1;
  }

  .subscription-card {
    min-height: 0;
    padding: 17px;
  }

  .subscription-card-head {
    align-items: flex-start;
  }

  .subscription-card h3 {
    font-size: 19px;
  }

  .subscription-date {
    font-size: 25px;
  }

  .account-buy {
    padding: 17px;
  }

  .account-plans {
    gap: 8px;
  }

  .account-plan {
    min-height: 82px;
    padding: 12px;
  }

  .account-plan span {
    margin-top: 8px;
    font-size: 18px;
  }

  .account-pay,
  .extra-device-pay {
    width: 100%;
    min-width: 0;
  }
}
