/* ── Profile page ── */
.profile-body {
  min-height: 100vh;
}

.profile-page-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.profile-hero {
  text-align: center;
  margin-bottom: 28px;
}

.profile-hero h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.profile-hero-sub {
  color: var(--apex-muted);
  font-size: 15px;
  margin: 0;
  line-height: 1.6;
}

/* ── Guest promo ── */
.profile-guest {
  margin-top: 8px;
}

.profile-guest-card {
  text-align: center;
  padding: 48px 28px;
  border-radius: var(--apex-radius-lg);
  border: 1px solid var(--apex-border);
  background: var(--apex-bg-2);
}

.profile-guest-icon {
  font-size: 40px;
  margin-bottom: 16px;
}

.profile-guest-card h2 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  margin: 0 0 12px;
}

.profile-guest-card p {
  color: var(--apex-muted);
  font-size: 15px;
  line-height: 1.65;
  max-width: 480px;
  margin: 0 auto 24px;
}

/* ── Dashboard grid ── */
.profile-dashboard {
  margin-top: 4px;
  position: relative;
}

.profile-dashboard-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 48px 24px;
  text-align: center;
  border-radius: var(--apex-radius-lg);
  border: 1px solid var(--apex-border);
  background: var(--apex-bg-2);
  margin-bottom: 20px;
}

.profile-dashboard-error[hidden] {
  display: none !important;
}

.profile-dashboard-error p {
  margin: 0;
  color: var(--apex-muted);
  font-size: 14px;
  max-width: 420px;
}

.profile-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .profile-dashboard-grid {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    align-items: start;
  }
}

.profile-dashboard-main,
.profile-dashboard-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.profile-dashboard-grid.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

/* ── Cards ── */
.profile-card {
  border-radius: var(--apex-radius-lg);
  border: 1px solid var(--apex-border);
  background: var(--apex-bg-2);
  padding: 22px 24px;
}

.profile-card--accent {
  border-color: var(--apex-accent-border);
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.06) 0%, var(--apex-bg-2) 60%);
}

.profile-card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--apex-text);
}

/* ── Subscription card ── */
.profile-subscription-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
}

.profile-subscription-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 20px;
  min-width: 0;
}

.profile-plan-name {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--apex-accent) 0%, var(--apex-accent-light) 50%, var(--apex-accent-hover) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.profile-balance-text {
  font-size: 14px;
  color: var(--apex-muted);
  font-weight: 500;
}

.profile-expires-text {
  font-size: 13px;
  color: var(--apex-accent-light);
  font-weight: 600;
}

.profile-subscription-cta {
  flex-shrink: 0;
}

/* ── Settings card ── */
.profile-field-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.profile-field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--apex-muted);
  font-weight: 600;
}

.profile-field-value {
  font-size: 14px;
  color: var(--apex-text);
  word-break: break-word;
}

.profile-google-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--apex-text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--apex-border);
}

.profile-google-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.profile-password-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--apex-border);
}

.profile-password-section h4 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--apex-text);
}

.profile-password-section .apex-field {
  margin-bottom: 12px;
}

.profile-password-msg {
  font-size: 12px;
  margin-top: 8px;
  min-height: 18px;
}

.profile-password-msg--ok {
  color: var(--apex-success, #6ee7b7);
}

.profile-password-msg--err {
  color: var(--apex-danger, #f87171);
}

/* ── Side footer ── */
.profile-side-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px 0;
}

.profile-stats-line {
  font-size: 12px;
  color: var(--apex-muted);
  margin: 0;
  line-height: 1.5;
}

.profile-logout-btn {
  align-self: flex-start;
  padding: 8px 0;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: rgba(248, 113, 113, 0.85);
  transition: color 0.15s ease;
}

.profile-logout-btn:hover {
  color: #f87171;
}

/* ── Payments table ── */
.profile-payments-wrap {
  overflow-x: auto;
}

.profile-payments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.profile-payments-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--apex-muted);
  border-bottom: 1px solid var(--apex-border);
}

.profile-payments-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(46, 38, 64, 0.6);
  vertical-align: middle;
}

.profile-payments-table tr:last-child td {
  border-bottom: none;
}

.profile-payments-table tr:hover td {
  background: var(--apex-surface-subtle);
}

.profile-amount-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.profile-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.profile-status-badge--paid {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.profile-status-badge--pending {
  color: #fcd34d;
  background: rgba(252, 211, 77, 0.1);
  border: 1px solid rgba(252, 211, 77, 0.35);
}

.profile-status-badge--muted {
  color: var(--apex-muted);
  background: rgba(139, 130, 160, 0.1);
  border: 1px solid rgba(139, 130, 160, 0.25);
}

.profile-status-badge--danger {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.profile-payments-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--apex-muted);
  font-size: 13px;
}

.profile-tx-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--apex-accent);
  border: 1px solid var(--apex-accent-border);
  background: var(--apex-accent-soft);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.profile-tx-link:hover {
  background: var(--apex-accent-soft);
  box-shadow: 0 0 12px var(--apex-accent-glow);
}

.profile-tx-link svg {
  width: 14px;
  height: 14px;
}

/* ── Skeleton ── */
.profile-skeleton {
  background: linear-gradient(90deg, var(--apex-bg-2) 25%, var(--apex-border) 50%, var(--apex-bg-2) 75%);
  background-size: 200% 100%;
  animation: profile-shimmer 1.4s infinite;
  border-radius: var(--apex-radius);
}

.profile-skeleton--title {
  height: 36px;
  width: 120px;
  margin-bottom: 12px;
}

.profile-skeleton--line {
  height: 14px;
  width: 60%;
  margin-bottom: 8px;
}

.profile-skeleton--line-sm {
  height: 12px;
  width: 40%;
}

.profile-skeleton--btn {
  height: 40px;
  width: 160px;
  border-radius: var(--apex-radius);
}

.profile-skeleton--table-row {
  height: 44px;
  width: 100%;
  margin-bottom: 8px;
}

@keyframes profile-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Toast ── */
.profile-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 9999;
  padding: 12px 20px;
  border-radius: var(--apex-radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--apex-text);
  background: var(--apex-bg-2);
  border: 1px solid var(--apex-accent-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.profile-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.profile-toast[hidden] {
  display: block;
}

/* ── Account status & jobs ── */
.profile-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  margin-bottom: 14px;
}

@media (max-width: 560px) {
  .profile-status-grid {
    grid-template-columns: 1fr;
  }
}

.profile-status-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-processed-summary {
  font-size: 13px;
  color: var(--apex-muted);
  margin: 0 0 10px;
  line-height: 1.5;
}

.profile-processed-summary strong {
  color: var(--apex-text);
  font-weight: 700;
}

.profile-referral-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--apex-accent);
  text-decoration: none;
  margin-bottom: 20px;
  transition: color 0.15s ease;
}

.profile-referral-link:hover {
  color: var(--apex-accent-light);
}

.profile-referral-link--muted {
  color: var(--apex-muted);
}

.profile-referral-link--muted:hover {
  color: var(--apex-accent);
}

.profile-section-subtitle {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 12px;
  padding-top: 4px;
  border-top: 1px solid var(--apex-border);
  color: var(--apex-text);
}

.profile-jobs-table th:last-child,
.profile-jobs-table td:last-child {
  text-align: center;
  width: 72px;
}

.profile-job-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--apex-accent);
  border: 1px solid var(--apex-accent-border);
  background: var(--apex-accent-soft);
  text-decoration: none;
  transition: box-shadow 0.15s ease;
}

.profile-job-dl:hover {
  box-shadow: 0 0 12px var(--apex-accent-glow);
}

.profile-job-dl-muted {
  color: var(--apex-muted);
  font-size: 12px;
}
