@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #18181b;
  --surface-raised: #1c1c1f;
  --surface-hover: #222225;
  --divider: rgba(255, 255, 255, 0.06);
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --muted: #71717a;
  --primary: #e53935;
  --primary-hover: #c62828;
  --primary-soft: rgba(229, 57, 53, 0.1);
  --radius: 10px;
  --radius-sm: 8px;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(229, 57, 53, 0.35);
}

* { box-sizing: border-box; }

html {
  font-size: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Inter",
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  line-height: 1.55;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-size: calc(15px * var(--sa-a11y-font-scale, 1));
}

button,
input { font: inherit; }

.portal-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.topbar,
.brand-row,
.content-grid,
.agent-hero,
.credit-row,
.check-line {
  display: flex;
  align-items: flex-start;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
}

.dashboard-section {
  margin-bottom: 28px;
}

.section-head {
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
}

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

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  text-transform: none;
}

.card-head-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.card-head-note {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.billing-sandbox-badge {
  color: var(--muted);
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.brand-row { gap: 14px; align-items: center; }

.portal-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.portal-page-title {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 28px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.035em;
  color: var(--text);
}

.portal-page-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}

.brand-mark,
.avatar {
  display: block;
  background: transparent;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.btn:hover {
  background: var(--surface-hover);
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-ghost {
  color: var(--muted);
  background: transparent;
}
.btn-ghost:hover {
  color: var(--text);
  background: var(--surface);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
p { margin-top: 0; }
h1 {
  margin-bottom: 8px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}
h2 { font-size: 20px; margin-bottom: 10px; font-weight: 600; letter-spacing: -0.02em; }
h3 { margin: 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.hero-badge {
  color: var(--text-secondary);
  background: var(--surface-2);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.onboarding,
.card,
.kpi {
  background: var(--surface);
  border-radius: var(--radius);
}

.onboarding {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
  padding: 22px 24px;
  margin-bottom: 18px;
  background: linear-gradient(90deg, var(--primary-soft) 0, var(--primary-soft) 3px, var(--surface) 3px);
}
.onboarding-intro {
  max-width: 100%;
}
.onboarding-intro h2 {
  margin-bottom: 12px;
  line-height: 1.35;
  max-width: 28ch;
  font-size: 21px;
  letter-spacing: -0.025em;
}
.onboarding-points {
  margin: 0;
  padding: 0 20px 0 0;
  display: grid;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
  max-width: 640px;
}
.onboarding-points li {
  padding-right: 4px;
}
.onboarding-points strong {
  color: var(--text);
  font-weight: 600;
}
.onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 560px;
}
.onboarding-consent {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.payment-consent-ack {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin: 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}
.payment-consent-ack.payment-consent-pending {
  border-style: dashed;
}
.payment-consent-ack.hidden { display: none; }
.payment-consent-check.hidden {
  display: none;
}
.payment-consent-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.16);
  color: #4ade80;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.payment-consent-ack a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.onboarding-cta {
  align-self: flex-start;
  min-width: min(100%, 240px);
  text-align: center;
}
.onboarding-payment {
  width: 100%;
  max-width: 560px;
  margin-top: 4px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
}
.onboarding-payment-hint {
  margin: 0 0 12px;
  font-size: 13px;
}
.onboarding-setup-hint,
.onboarding-billing-hint {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
}
.onboarding-billing-hint {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
}
#onboarding-checkout,
#card-replace-checkout,
#credits-checkout,
#embedded-checkout,
.paddle-checkout-frame {
  min-height: 360px;
  background: #09090b !important;
  color-scheme: dark;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.paddle-checkout-frame iframe,
#onboarding-checkout iframe,
#card-replace-checkout iframe,
#credits-checkout iframe,
#embedded-checkout iframe {
  background: #09090b !important;
  color-scheme: dark;
}

.content-grid {
  align-items: stretch;
  gap: 18px;
  margin-bottom: 18px;
}
.content-grid-two-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.content-grid > .card {
  flex: 1;
  min-width: 0;
}
.billing-card-wide {
  width: 100%;
}
.card { padding: 22px; }
.agent-card {
  padding: 0;
  overflow: hidden;
}
.billing-settings-card .card-head h3 {
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.settings-tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.settings-tab:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.settings-tab.active {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.settings-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.settings-panel .billing-panel-block:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 360px;
}

.password-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.password-form label span {
  font-size: 13px;
  color: var(--text-secondary);
}

.password-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}

.password-form input:focus {
  outline: none;
  border-color: rgba(229, 57, 53, 0.5);
  box-shadow: var(--focus-ring);
}

.onboarding-page .portal-shell {
  max-width: 640px;
}

.onboarding-card {
  margin-top: 8px;
}

.onboarding-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.onboarding-step-dot {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}

.onboarding-step-dot.active,
.onboarding-step-dot.done {
  background: var(--primary);
}

.onboarding-terms-box {
  max-height: 220px;
  overflow-y: auto;
  padding: 14px 16px;
  margin: 0 0 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.onboarding-terms-box + .onboarding-terms-box {
  margin-top: -6px;
}

.onboarding-terms-box h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.onboarding-panel.hidden {
  display: none;
}

.billing-panel-block {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--divider);
}
.billing-panel-block:first-of-type {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}
.billing-panel-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.billing-panel-desc {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
}
.agent-card .card-head {
  padding: 20px 22px 0;
  margin-bottom: 0;
}
.billing-card .card-head {
  margin-bottom: 14px;
}

.billing-card-split {
  display: flex;
  align-items: flex-start;
  gap: 22px;
}

.billing-card-info {
  flex: 0 1 44%;
  min-width: 280px;
}

.billing-card-controls {
  flex: 1 1 56%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auto-recharge-intro {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
}

.check-line {
  gap: 10px;
  padding: 8px 0;
  margin: 0;
  width: 100%;
  cursor: pointer;
  line-height: 1.45;
  font-size: 14px;
  color: var(--text-secondary);
  user-select: none;
}
.check-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.check-line span {
  flex: 1;
  min-width: 0;
}
.check-line strong {
  font-weight: 600;
  color: var(--text);
}
.check-line small {
  display: inline;
  color: var(--muted);
  font-size: 12px;
  font-weight: normal;
  margin-inline-start: 6px;
}
.check-line a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.agent-showcase {
  position: relative;
  padding: 18px 22px 22px;
}

.agent-showcase-glow {
  display: none;
}

.agent-showcase-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
}

.agent-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  padding: 6px;
}
.avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.agent-live-dot {
  position: absolute;
  left: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--muted);
}
.agent-live-dot.ok { background: var(--primary); }
.agent-live-dot.wait { background: var(--text-secondary); }
.agent-live-dot.off { background: #52525b; }

.agent-showcase-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.agent-title {
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.agent-business {
  color: var(--muted);
  font-size: 14px;
}

.agent-status-pill {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 5px 12px;
  background: var(--surface-2);
  color: var(--muted);
  letter-spacing: -0.01em;
}
.agent-status-pill.ok {
  color: var(--text);
  background: var(--primary-soft);
}
.agent-status-pill.wait {
  color: var(--text-secondary);
  background: var(--surface-raised);
}
.agent-status-pill.off {
  color: var(--muted);
}

.agent-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.agent-meta-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex: 1;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.agent-meta-chip.has-value {
  background: var(--surface-raised);
}
.agent-meta-chip.has-value strong {
  color: var(--text);
}
.agent-meta-chip.is-empty strong {
  color: var(--muted);
  font-weight: 500;
}
.agent-meta-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.agent-stats-compact {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
}

.agent-stat {
  padding: 14px 14px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  min-height: 72px;
}
.agent-stat > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
}
.agent-stat strong {
  display: block;
  font-size: clamp(20px, 2.8vw, 26px);
  line-height: 1.1;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
}
.agent-stat strong .dual-currency-main {
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  color: inherit;
  align-items: flex-end;
}
.agent-stat strong .currency-line-usd {
  font-size: 0.72em;
  font-weight: 500;
  color: var(--text-secondary);
}
.agent-stat small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.agent-package-bar {
  margin-top: 12px;
  padding: 14px 14px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.agent-package-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.agent-package-head span { color: var(--muted); }
.agent-package-head strong {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.agent-stats-note {
  margin: 10px 0 0;
  font-size: 12px;
  text-align: center;
  color: var(--muted);
}

.client-billing-summary {
  padding: 0 22px 18px;
  border-bottom: 1px solid var(--border);
}
.client-billing-summary .agent-stats-compact {
  margin-top: 0;
}
.agent-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.agent-showcase-compact {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.agent-showcase-compact:last-child {
  border-bottom: none;
}
.agent-showcase-compact .agent-showcase-top {
  padding-bottom: 12px;
}
.agent-showcase-compact .avatar-lg {
  width: 56px;
  height: 56px;
}
.agent-showcase-compact .agent-title {
  font-size: 20px;
}
.agent-meta-chip-stat strong {
  font-size: 18px;
}

.progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 0 8px;
}
.progress i {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.agent-phone {
  font-size: clamp(17px, 2.5vw, 20px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.plan-box {
  display: grid;
  gap: 0;
  padding: 0;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0;
}

.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
}
.plan-row + .plan-row {
  box-shadow: inset 0 1px 0 var(--divider);
}
.plan-row span:first-child { color: var(--muted); font-size: 13px; }
.plan-row strong {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.02em;
}
.dual-currency-main {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  direction: ltr;
  unicode-bidi: isolate;
  line-height: 1.35;
}
.currency-line {
  display: block;
  white-space: nowrap;
}
.currency-source-mark {
  position: relative;
  display: inline-block;
  color: var(--muted);
  font-size: 0.72em;
  font-weight: 400;
  margin-inline-end: 1px;
  cursor: help;
  outline: none;
}
.currency-source-mark::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  min-width: 168px;
  max-width: 240px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(18, 20, 28, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color: #f3f4f6;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 40;
}
.currency-source-mark::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(18, 20, 28, 0.96);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 41;
  pointer-events: none;
}
.currency-source-mark:hover::after,
.currency-source-mark:focus-visible::after,
.currency-source-mark:hover::before,
.currency-source-mark:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.plan-row strong .dual-currency-main,
.purchase-meta strong .dual-currency-main {
  align-items: flex-end;
}

.plan-row-main {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 14px;
  background: var(--surface-raised);
}
.plan-row-main strong {
  font-size: 20px;
  letter-spacing: -0.025em;
}

.plan-no-subscription-note {
  margin: 0 14px 4px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(229, 57, 53, 0.1);
  border: 1px solid rgba(229, 57, 53, 0.22);
  font-size: 14px;
  line-height: 1.5;
}

.plan-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 4px 10px;
  letter-spacing: 0.01em;
}
.plan-tag.muted-tag {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}
.plan-tag.wait-tag {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
}

.billing-panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.billing-panel-title-row .billing-panel-title {
  margin: 0;
}

.auto-recharge-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 10px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.auto-recharge-status-badge.is-on {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.14);
}

.auto-recharge-status-badge.is-off {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.payment-note {
  margin: 12px 0 0;
  font-size: 14px;
  padding-top: 12px;
  color: var(--text-secondary);
}

.purchase-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.purchase-history-head {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
}
.purchase-history-head-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.purchase-history-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 320px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.purchase-history-search-ico {
  color: var(--muted);
  font-size: 14px;
  flex-shrink: 0;
}
.purchase-history-search input {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.purchase-history-search input::placeholder {
  color: var(--muted);
}
.purchase-ref {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-all;
}
.purchase-ref bdi {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.purchase-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: background 0.15s ease;
}
.purchase-row:hover {
  background: var(--surface-hover);
}

.purchase-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.purchase-main strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.purchase-type {
  font-size: 13px;
  color: var(--muted);
}

.purchase-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  margin-inline-start: 6px;
}
.purchase-status--succeeded { background: rgba(46, 160, 67, 0.15); color: #3fb950; }
.purchase-status--failed { background: rgba(248, 81, 73, 0.15); color: #f85149; }
.purchase-status--pending { background: rgba(210, 153, 34, 0.15); color: #d29922; }
.purchase-status--refunded,
.purchase-status--partially_refunded { background: rgba(139, 148, 158, 0.15); color: #8b949e; }
.purchase-status--canceled { background: rgba(139, 148, 158, 0.12); color: #8b949e; }

.purchase-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.purchase-meta strong {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.purchase-meta time {
  font-size: 12px;
  color: var(--muted);
}

.purchase-empty {
  margin: 0;
  padding: 8px 0 4px;
}

.switch-row {
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  background: var(--surface-2);
}
.switch-row input {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-top: 3px;
  accent-color: var(--primary);
  cursor: pointer;
}
.switch-row span { display: flex; flex-direction: column; gap: 4px; }
.switch-row strong { font-weight: 600; font-size: 14px; color: var(--text); }
.switch-row small { color: var(--muted); line-height: 1.45; }

.credit-row { gap: 12px; align-items: end; }
.auto-recharge-settings {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auto-recharge-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.auto-recharge-hint {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.credit-row label,
.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  padding: 9px 12px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
input:not([type="checkbox"]):not([type="radio"]):hover {
  background: #0c0c0e;
}
input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: none;
  background: var(--bg);
  box-shadow: var(--focus-ring);
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.proration-notice {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
  color: var(--text-secondary);
  box-shadow: inset 3px 0 0 var(--primary);
}
.proration-notice strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.proration-notice p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.billing-alert-banner {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
  color: var(--text-secondary);
  box-shadow: inset 3px 0 0 var(--primary);
  background: var(--surface-2);
}
.billing-alert-banner--warn {
  box-shadow: inset 3px 0 0 #d29922;
  background: rgba(210, 153, 34, 0.08);
}
.billing-alert-banner--error {
  box-shadow: inset 3px 0 0 #f85149;
  background: rgba(248, 81, 73, 0.08);
}
.billing-alert-banner strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.billing-alert-banner p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}


.saved-card-body {
  margin-bottom: 14px;
}
.saved-card-display {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.saved-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-raised);
  font-size: 20px;
  flex-shrink: 0;
}
.saved-card-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.saved-card-details strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.saved-card-details span {
  font-size: 13px;
  color: var(--muted);
}
.saved-card-empty {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}
.saved-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.saved-card-actions + .payment-consent-ack {
  margin-top: 12px;
  max-width: none;
}
.card-replace-payment {
  width: 100%;
  margin-top: 14px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
}
.card-replace-payment-hint {
  margin: 0 0 12px;
  font-size: 13px;
}
.btn-danger-text {
  color: #f85149;
}
.btn-danger-text:hover {
  color: #ff7b72;
  background: rgba(248, 81, 73, 0.08);
}
.billing-no-card-note {
  margin: 8px 0 0;
  font-size: 13px;
}

.onboarding-proration {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 0 0 14px;
  box-shadow: inset 3px 0 0 var(--primary);
}
.onboarding-proration.hidden { display: none; }
.onboarding-proration strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}
.onboarding-proration p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.onboarding-proration-stats {
  margin: 0;
  padding-right: 18px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}
.onboarding-proration-stats strong { color: var(--text); }

.legal-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  cursor: pointer;
  user-select: none;
  margin: 0 0 12px;
}
.legal-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.legal-check a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legal-check a:hover {
  text-decoration-color: var(--primary);
}

.help-card {
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.help-card a {
  color: var(--text);
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.25);
}
.help-card a:hover {
  text-decoration-color: var(--primary);
}

.help-card h2 {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.help-card p {
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  left: 20px;
  bottom: 20px;
  background: var(--surface-raised);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.toast.err {
  background: var(--primary);
  color: #fff;
}

.checkout-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(6px);
}

.checkout-overlay.hidden {
  display: none;
}

.checkout-modal {
  width: min(520px, 100%);
  max-height: min(92vh, 720px);
  background: #09090b;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.checkout-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--divider);
  background: var(--bg);
}

.checkout-modal-head-text {
  flex: 1;
  min-width: 0;
}

.checkout-modal-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.checkout-modal-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.checkout-close {
  min-width: 36px;
  padding: 6px 10px;
  font-size: 16px;
  line-height: 1;
}

.checkout-modal-body {
  padding: 0 18px 12px;
  overflow: auto;
  min-height: 200px;
  background: #09090b;
}

.checkout-modal .paddle-checkout-frame,
#embedded-checkout {
  min-height: 420px;
  background: #09090b !important;
  color-scheme: dark;
  border-radius: var(--radius-sm);
}

.checkout-modal .paddle-checkout-frame iframe,
#embedded-checkout iframe {
  background: #09090b !important;
  color-scheme: dark;
}

.credits-payment,
.card-replace-payment,
.onboarding-payment {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
}

.credits-payment-hint,
.card-replace-payment-hint,
.onboarding-payment-hint {
  margin: 0 0 10px;
  font-size: 13px;
}

.onboarding-auto-recharge {
  margin: 12px 0 0;
  font-size: 14px;
}

.checkout-loading {
  margin: 24px 0;
  text-align: center;
  font-size: 14px;
}

.stripe-elements-checkout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 4px 0;
}

.stripe-express-checkout {
  min-height: 44px;
}

.stripe-express-checkout.hidden {
  display: none;
}

.stripe-payment-divider {
  margin: 0;
  text-align: center;
  font-size: 13px;
  position: relative;
}

.stripe-payment-divider.hidden {
  display: none;
}

.stripe-payment-divider::before,
.stripe-payment-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 72px);
  height: 1px;
  background: var(--divider);
}

.stripe-payment-divider::before {
  right: 0;
}

.stripe-payment-divider::after {
  left: 0;
}

.stripe-payment-element {
  min-height: 72px;
}

.stripe-checkout-submit {
  width: 100%;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.login-shell {
  width: min(420px, calc(100% - 32px));
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
}
.login-card h1 {
  font-size: 28px;
  margin-top: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.login-card form { display: grid; gap: 14px; margin-top: 18px; }
.login-card .brand-row strong {
  display: block;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.login-card .brand-row span {
  display: block;
  font-size: 13px;
  color: var(--muted);
}
.error { color: var(--primary); min-height: 24px; margin: 0; font-size: 14px; }
.skeleton,
.empty {
  color: var(--muted);
  padding: 16px;
}

@media (max-width: 900px) {
  .content-grid-two-cols {
    grid-template-columns: 1fr;
  }
  .hero,
  .content-grid,
  .credit-row {
    display: grid;
    grid-template-columns: 1fr;
  }
  .agent-stats-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .onboarding-actions { max-width: none; }
  .onboarding-cta { align-self: stretch; }
}

@media (max-width: 560px) {
  .portal-shell { width: min(100% - 20px, 1120px); padding-top: 14px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .agent-stats-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .agent-meta-row { flex-direction: column; }
  .agent-showcase-top { flex-wrap: wrap; }
  .agent-status-pill { width: 100%; text-align: center; }
  .card-head { flex-direction: column; align-items: flex-start; }
  .purchase-row { flex-direction: column; gap: 8px; }
  .purchase-meta {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
  .hero,
  .billing-settings-card,
  .onboarding,
  .help-card { padding: 18px; }
  .agent-card { padding: 0; }
  .agent-card .card-head { padding: 18px 18px 0; }
  .agent-showcase { padding: 16px 18px 18px; }
  .auto-recharge-fields {
    grid-template-columns: 1fr;
  }
  .settings-tabs {
    flex-direction: column;
  }
  .settings-tab {
    width: 100%;
    text-align: start;
  }
}

:root {
  --sa-scroll-size: 10px;
  --sa-scroll-track: var(--bg);
  --sa-scroll-thumb: rgba(255, 255, 255, 0.12);
  --sa-scroll-thumb-hover: rgba(255, 255, 255, 0.18);
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--sa-scroll-thumb) var(--sa-scroll-track);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--sa-scroll-thumb) var(--sa-scroll-track);
}

::-webkit-scrollbar {
  width: var(--sa-scroll-size);
  height: var(--sa-scroll-size);
}

::-webkit-scrollbar-track {
  background: var(--sa-scroll-track);
}

::-webkit-scrollbar-thumb {
  background: var(--sa-scroll-thumb);
  border: 2px solid var(--sa-scroll-track);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--sa-scroll-thumb-hover);
}

::-webkit-scrollbar-corner {
  background: var(--sa-scroll-track);
}

.portal-legal-foot,
.login-page .portal-legal-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  margin-top: 20px;
  font-size: 12px;
}

.portal-legal-foot--bar {
  margin-top: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.portal-legal-foot a {
  color: var(--text-muted);
  text-decoration: none;
}

.portal-legal-foot a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.legal-links-inline {
  margin: 10px 0 0;
  font-size: 13px;
}

.legal-links-inline a {
  color: var(--primary);
  text-decoration: none;
}

.legal-links-inline a:hover {
  text-decoration: underline;
}
