/*
 * Personal account workspace.
 * Loaded only by dashboard.html after the Stage 4.1 token and primitive layers.
 */

.dashboard-main > .container-fluid > .row > .col-xl-3 {
  display: none;
}

.dashboard-main #wrapper_main_menu_content {
  width: 100%;
  max-width: 100%;
  flex: 0 0 100%;
}

.dashboard-page,
.billing-page {
  --account-panel: color-mix(in srgb, var(--color-surface-1) 92%, transparent);
  --account-panel-strong: color-mix(in srgb, var(--color-surface-2) 96%, transparent);
  --account-accent-border: color-mix(
    in srgb,
    var(--color-interactive-primary) 34%,
    var(--color-border-default)
  );
  width: 100%;
  max-width: 1180px;
}

@media (min-width: 1200px) {
  .dashboard-page,
  .billing-page {
    width: 50vw;
  }
}

.dashboard-page {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: var(--space-8) var(--space-3) var(--space-20);
  color: var(--color-text-primary);
}

.dashboard-page::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 64px 0 auto;
  height: 520px;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 0, rgb(110 168 254 / 8%), transparent 34%),
    radial-gradient(circle at 86% 8%, rgb(155 138 251 / 5%), transparent 28%);
}

.dashboard-shell,
.dashboard-primary-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-shell {
  gap: var(--space-4);
}

.dashboard-card {
  min-width: 0;
  padding: var(--space-5);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--account-panel);
  color: var(--color-text-primary);
  box-shadow: 0 14px 36px rgb(0 0 0 / 20%);
}

.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-5);
  align-items: center;
  overflow: hidden;
  padding-block: var(--space-4);
  border-color: var(--account-accent-border);
  background:
    linear-gradient(110deg, rgb(110 168 254 / 6%), transparent 42%),
    var(--account-panel-strong);
  box-shadow: 0 14px 36px rgb(0 0 0 / 20%);
}

.profile-main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.profile-main > div:last-child {
  min-width: 0;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--account-accent-border);
  border-radius: var(--radius-md);
  background: linear-gradient(
    145deg,
    var(--color-interactive-soft),
    var(--color-surface-2)
  );
}

.profile-avatar img {
  width: 34px;
  height: 34px;
}

.profile-name {
  overflow-wrap: anywhere;
  color: var(--color-text-primary);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xl);
  letter-spacing: var(--letter-spacing-heading);
}

.profile-email,
.profile-fullname {
  overflow-wrap: anywhere;
  font-size: var(--text-sm);
  line-height: var(--line-height-sm);
}

.profile-email {
  margin-top: var(--space-1);
  color: var(--color-text-secondary);
}

.profile-fullname {
  margin-top: var(--space-1);
  color: var(--color-success);
}

.dashboard-status-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid rgb(104 201 152 / 26%);
  border-radius: var(--radius-pill);
  background: var(--color-success-soft);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-xs);
  white-space: nowrap;
}

.dashboard-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 10px rgb(104 201 152 / 38%);
}

.section-title {
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-lg);
  letter-spacing: var(--letter-spacing-heading);
}

.section-subtitle {
  margin-top: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: var(--line-height-body-sm);
}

.dashboard-balance-card {
  position: relative;
  overflow: hidden;
  padding: var(--space-6);
  border-color: var(--account-accent-border);
  background:
    linear-gradient(110deg, rgb(110 168 254 / 7%), transparent 42%),
    var(--account-panel-strong);
}

:is(.dashboard-hero, .dashboard-balance-card)::after {
  content: "";
  position: absolute;
  top: 0;
  right: 9%;
  left: 9%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgb(110 168 254 / 44%),
    transparent
  );
}

.dashboard-balance-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) fit-content(45%);
  align-items: start;
  gap: var(--space-6);
}

.dashboard-balance-copy {
  min-width: 0;
  max-width: 700px;
}

.dashboard-balance-copy .section-title {
  font-size: var(--text-2xl);
  line-height: var(--line-height-2xl);
}

.dashboard-balance-copy .section-subtitle {
  max-width: 660px;
  margin-top: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--text-ui);
  line-height: var(--line-height-body-sm);
}

.dashboard-balance-value-wrap {
  min-width: 214px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--account-accent-border);
  border-radius: var(--radius-md);
  background: linear-gradient(
    145deg,
    var(--color-interactive-soft),
    var(--color-surface-2)
  );
  text-align: right;
}

.dashboard-balance-label {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-xs);
  letter-spacing: var(--letter-spacing-label);
}

.billing-balance {
  margin-top: var(--space-1);
  color: var(--color-text-primary);
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-3xl);
  letter-spacing: var(--letter-spacing-tight);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-benefit-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2) var(--space-6);
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
}

.dashboard-benefit-list li {
  position: relative;
  min-width: 0;
  padding-left: var(--space-5);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-height-body-sm);
}

.dashboard-benefit-list li::before {
  content: "✓";
  position: absolute;
  top: 0;
  left: 0;
  color: var(--color-interactive-primary);
  font-weight: var(--font-weight-bold);
}

.dashboard-topup-section {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: var(--border-subtle);
}

.dashboard-topup-title {
  font-size: var(--text-body);
  line-height: var(--line-height-body);
}

.dashboard-topup-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.dashboard-topup-card {
  min-width: 0;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface-1);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.dashboard-topup-card:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-2);
  transform: translateY(-1px);
}

.dashboard-topup-amount {
  color: var(--color-text-primary);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-xl);
  letter-spacing: var(--letter-spacing-tight);
  font-variant-numeric: tabular-nums;
}

.dashboard-topup-card p {
  margin: var(--space-2) 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: var(--line-height-body-sm);
}

.dashboard-topup-action,
.dashboard-service-cta {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--color-interactive-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-sm);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.dashboard-topup-action {
  width: 100%;
  margin-top: auto;
  padding: var(--space-2) var(--space-3);
}

.dashboard-topup-action:hover:not(:disabled),
.dashboard-service-link:hover .dashboard-service-cta {
  background: var(--color-interactive-hover);
}

.dashboard-topup-action:active:not(:disabled) {
  background: var(--color-interactive-active);
  transform: translateY(1px);
}

.dashboard-topup-action:disabled {
  background: var(--color-surface-3);
  color: var(--color-text-disabled);
  cursor: wait;
}

.billing-status {
  min-height: var(--line-height-sm);
  margin-top: var(--space-3);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-height-sm);
}

.dashboard-balance-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: var(--border-subtle);
}

.dashboard-balance-note {
  max-width: 740px;
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: var(--line-height-body-sm);
}

.dashboard-history-link,
.dashboard-support-link {
  display: inline-flex;
  align-items: center;
  color: var(--color-link);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-sm);
  text-decoration: none;
}

.dashboard-history-link {
  flex: 0 0 auto;
  white-space: nowrap;
}

.dashboard-history-link:hover,
.dashboard-support-link:hover {
  color: var(--color-link-hover);
}

.dashboard-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

.dashboard-services-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
  min-width: 0;
}

.dashboard-service-link {
  min-width: 0;
  color: var(--color-text-primary);
  text-decoration: none;
}

.dashboard-service-link--ai {
  position: relative;
  isolation: isolate;
  min-height: 252px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
  overflow: hidden;
  padding: var(--space-5);
  border: var(--border-default);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 100% 0, rgb(110 168 254 / 11%), transparent 42%),
    var(--color-surface-1);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.dashboard-service-link--video {
  background:
    radial-gradient(circle at 100% 0, rgb(155 138 251 / 9%), transparent 42%),
    var(--color-surface-1);
}

.dashboard-service-link--ai:hover {
  border-color: var(--account-accent-border);
  background-color: var(--color-surface-2);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

.dashboard-service-icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--account-accent-border);
  border-radius: var(--radius-md);
  background: var(--color-interactive-soft);
  color: var(--color-interactive-primary);
}

.dashboard-service-link--video .dashboard-service-icon {
  border-color: rgb(155 138 251 / 28%);
  background: var(--color-intelligence-soft);
  color: var(--color-intelligence);
}

.dashboard-service-icon img {
  width: 32px;
  height: 32px;
}

.dashboard-service-icon .bi {
  font-size: 25px;
  line-height: 1;
}

.dashboard-service-content {
  min-width: 0;
}

.dashboard-service-link--ai .dashboard-service-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.dashboard-service-title {
  display: block;
  margin: 0;
  overflow-wrap: break-word;
  color: var(--color-text-primary);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xl);
  letter-spacing: var(--letter-spacing-heading);
}

.dashboard-service-text {
  display: block;
  max-width: 620px;
  margin-top: var(--space-2);
  overflow-wrap: break-word;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-height-body-sm);
}

.dashboard-ai-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.dashboard-ai-capabilities span {
  padding: var(--space-1) var(--space-2);
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  line-height: var(--line-height-xs);
  white-space: nowrap;
}

.dashboard-service-action {
  width: 100%;
  display: flex;
  margin-top: auto;
  padding-top: var(--space-5);
}

.dashboard-service-cta {
  padding: var(--space-2) var(--space-4);
}

.dashboard-transactions-card .tx-list {
  margin-top: var(--space-3);
}

.tx-list {
  border-top: var(--border-subtle);
}

.tx-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: var(--border-subtle);
  transition: background-color var(--duration-fast) var(--ease-standard);
}

.tx-row:last-child {
  border-bottom: 0;
}

.tx-row:hover {
  background: linear-gradient(90deg, var(--color-interactive-soft), transparent);
}

.tx-desc {
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-sm);
  overflow-wrap: anywhere;
}

.tx-meta {
  margin-top: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: var(--line-height-xs);
}

.tx-row > div:first-child { min-width: 0; }
.tx-breakdown {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.tx-breakdown summary {
  cursor: pointer;
  padding-block: var(--space-3);
  min-height: 44px;
}
.tx-breakdown summary:hover { color: var(--color-text-primary); }
.tx-breakdown summary:focus-visible {
  outline: 2px solid var(--color-interactive-primary);
  outline-offset: 2px;
}
.tx-breakdown ul { list-style: none; padding: 0; margin: 0; }
.tx-breakdown li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
  margin-bottom: var(--space-2);
}
.tx-breakdown li span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }

.tx-amount {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tx-amount.plus {
  color: var(--color-success);
}

.tx-amount.minus {
  color: var(--color-danger);
}

.dashboard-transactions-card .dashboard-history-link {
  margin-top: var(--space-4);
}

.dashboard-account-card {
  padding-block: var(--space-4);
  border-color: var(--color-border-subtle);
  background: color-mix(in srgb, var(--color-surface-1) 82%, transparent);
  box-shadow: none;
}

.danger-actions {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.danger-zone .btn,
.dashboard-support-link {
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-xs);
}

#delete-account-btn {
  border-color: var(--color-border-default);
  background: transparent;
  color: var(--color-text-muted);
}

#delete-account-btn:hover {
  border-color: rgb(239 135 146 / 44%);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.dashboard-logout-btn {
  border-color: rgb(239 135 146 / 34%);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.dashboard-logout-btn:hover {
  border-color: rgb(239 135 146 / 52%);
  background: rgb(239 135 146 / 18%);
  color: var(--color-text-primary);
}

.dashboard-support-link {
  margin-left: auto;
  border: var(--border-default);
  background: var(--color-surface-1);
  color: var(--color-text-secondary);
}

.danger-note {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: var(--line-height-body-sm);
}

.dashboard-page :is(
  .dashboard-topup-action,
  .dashboard-service-link,
  .dashboard-history-link,
  .dashboard-support-link,
  .danger-zone .btn
):focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  box-shadow: none;
}

@media (max-width: 991.98px) {
  .dashboard-hero,
  .dashboard-balance-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-balance-value-wrap {
    min-width: 0;
    text-align: left;
  }

  .dashboard-topup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .dashboard-page {
    padding-top: var(--space-5);
  }

  .dashboard-services-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-service-link--ai {
    min-height: 0;
  }
}

@media (max-width: 575.98px) {
  .dashboard-page {
    padding: var(--space-4) var(--space-1) var(--space-12);
  }

  .dashboard-shell {
    gap: var(--space-3);
  }

  .dashboard-card,
  .dashboard-balance-card {
    padding: var(--space-4);
    border-radius: var(--radius-md);
  }

  .dashboard-hero {
    padding-block: var(--space-3);
  }

  .profile-main {
    align-items: flex-start;
  }

  .profile-name {
    font-size: var(--text-lg);
    line-height: var(--line-height-lg);
  }

  .dashboard-status-pill {
    justify-self: start;
  }

  .dashboard-balance-copy .section-title {
    font-size: var(--text-xl);
    line-height: var(--line-height-xl);
  }

  .billing-balance {
    font-size: var(--text-2xl);
    line-height: var(--line-height-2xl);
  }

  .dashboard-benefit-list,
  .dashboard-topup-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-topup-card {
    min-height: 0;
  }

  .dashboard-topup-action {
    min-height: 44px;
  }

  .dashboard-balance-footer,
  .danger-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-history-link,
  .dashboard-support-link {
    margin-left: 0;
    white-space: normal;
  }

  .dashboard-service-link--ai {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-4);
  }

  .dashboard-service-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
  }

  .dashboard-service-icon img {
    width: 28px;
    height: 28px;
  }

  .dashboard-service-title {
    font-size: var(--text-lg);
    line-height: var(--line-height-lg);
  }

  .dashboard-service-action {
    grid-column: 1 / -1;
  }

  .dashboard-service-cta {
    width: 100%;
    min-height: 44px;
  }

  .tx-row {
    gap: var(--space-2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-topup-card,
  .dashboard-topup-action,
  .dashboard-service-link,
  .tx-row {
    transition-duration: 0ms;
  }
}

@media (forced-colors: active) {
  .dashboard-card,
  .dashboard-topup-card,
  .dashboard-service-link--ai,
  .profile-avatar,
  .dashboard-balance-value-wrap {
    border-color: CanvasText;
  }
}

/* Full Credits history: directly linked from the personal account. */
.billing-page {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: var(--space-8) var(--space-3) var(--space-20);
  color: var(--color-text-primary);
}

.billing-page::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 64px 0 auto;
  height: 440px;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 0, rgb(110 168 254 / 7%), transparent 34%),
    radial-gradient(circle at 82% 8%, rgb(155 138 251 / 4%), transparent 28%);
}

.billing-back {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--color-surface-1);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-sm);
  text-decoration: none;
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

.billing-back:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.billing-card {
  min-width: 0;
  margin-bottom: var(--space-4);
  padding: var(--space-5);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--account-panel);
  box-shadow: 0 14px 36px rgb(0 0 0 / 20%);
}

.billing-card:first-of-type {
  border-color: var(--account-accent-border);
  background:
    linear-gradient(110deg, rgb(110 168 254 / 6%), transparent 44%),
    var(--account-panel-strong);
}

.billing-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
}

.billing-title {
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-2xl);
  letter-spacing: var(--letter-spacing-heading);
}

.billing-subtitle {
  max-width: 680px;
  margin-top: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--text-ui);
  line-height: var(--line-height-body-sm);
}

.billing-page .billing-balance {
  flex: 0 0 auto;
  min-width: 190px;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--account-accent-border);
  border-radius: var(--radius-md);
  background: linear-gradient(
    145deg,
    var(--color-interactive-soft),
    var(--color-surface-2)
  );
  font-size: var(--text-2xl);
  line-height: var(--line-height-2xl);
  text-align: right;
}

.billing-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(160px, 0.45fr);
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-5);
}

.billing-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.billing-preset,
.billing-tab,
.billing-load-more {
  min-height: 40px;
  border: var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-sm);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

.billing-preset {
  padding-inline: var(--space-3);
  font-variant-numeric: tabular-nums;
}

.billing-preset:hover,
.billing-tab:hover,
.billing-load-more:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.billing-preset.active,
.billing-tab.active {
  border-color: var(--color-border-accent);
  background: var(--color-interactive-soft);
  color: var(--color-text-primary);
}

.billing-page #billing-page-pay-btn {
  min-height: 40px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--color-interactive-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-sm);
}

.billing-page #billing-page-pay-btn:hover {
  background: var(--color-interactive-hover);
}

.billing-page #billing-page-pay-btn:disabled,
.billing-load-more:disabled {
  background: var(--color-surface-3);
  color: var(--color-text-disabled);
  cursor: wait;
}

.billing-page .billing-status {
  min-height: var(--line-height-sm);
  margin: 0;
}

.billing-note {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid rgb(105 194 220 / 24%);
  border-radius: var(--radius-md);
  background: var(--color-info-soft);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  line-height: var(--line-height-body-sm);
}

.billing-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.billing-tab {
  padding: var(--space-2) var(--space-3);
}

.tx-table {
  border-top: var(--border-subtle);
}

.billing-page .tx-row {
  grid-template-columns: minmax(0, 1fr) 180px 170px;
  align-items: center;
  padding: var(--space-3) var(--space-2);
  border-radius: 0;
  background: transparent;
}

.billing-page .tx-balance {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: var(--line-height-sm);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.billing-page .tx-amount {
  text-align: right;
}

.billing-empty {
  padding: var(--space-6) var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: var(--line-height-body-sm);
  text-align: center;
}

.billing-load-more {
  width: 100%;
  margin-top: var(--space-4);
}

.billing-page :is(
  .billing-back,
  .billing-preset,
  .billing-tab,
  .billing-load-more,
  #billing-page-pay-btn
):focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  box-shadow: none;
}

@media (max-width: 767.98px) {
  .billing-head {
    flex-direction: column;
  }

  .billing-page .billing-balance {
    width: 100%;
    min-width: 0;
    text-align: left;
  }

  .billing-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .billing-page #billing-page-pay-btn {
    min-height: 44px;
  }

  .billing-page .tx-row {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
  }

  .billing-page .tx-balance,
  .billing-page .tx-amount {
    text-align: left;
  }
}

@media (max-width: 575.98px) {
  .billing-page {
    padding: var(--space-4) var(--space-1) var(--space-12);
  }

  .billing-card {
    padding: var(--space-4);
    border-radius: var(--radius-md);
  }

  .billing-title {
    font-size: var(--text-xl);
    line-height: var(--line-height-xl);
  }

  .billing-page .billing-balance {
    font-size: var(--text-xl);
    line-height: var(--line-height-xl);
  }

  .billing-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .billing-preset {
    min-height: 44px;
  }

  .billing-tabs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .billing-tab {
    min-height: 44px;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .billing-back,
  .billing-preset,
  .billing-tab,
  .billing-load-more {
    transition-duration: 0ms;
  }
}
