*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #44f562;
  --primary-dark: #0cb314;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #ffffff;
  --bg-alt: #f9fafb;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* Nav */
.site-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-size: 3.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .9rem;
  transition: color .15s;
}
.nav-link:hover { color: var(--primary); }
.nav-link--cta {
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: 600;
}
.nav-link--cta:hover { background: var(--primary-dark); color: #fff; }
.nav-user { font-size: .9rem; color: var(--text-muted); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  line-height: 1;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-block { width: 100%; justify-content: center; }

/* Auth pages */
.auth-page {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  padding: 40px 16px;
}
.auth-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  padding: 48px;
  width: 100%;
  max-width: 440px;
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-logo { font-size: 3rem; margin-bottom: 12px; }
.auth-header h1 { font-size: 1.75rem; margin-bottom: 8px; }
.auth-header p { color: var(--text-muted); }
.auth-form { display: flex; flex-direction: column; gap: 20px; }
.auth-footer { text-align: center; margin-top: 24px; color: var(--text-muted); font-size: .9rem; }
.auth-footer a { color: var(--primary); }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--text);
  background: #fff;
  width: 100%;
  transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .9rem;
}
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }

/* Welcome page */
.welcome-page { max-width: 900px; margin: 0 auto; padding: 80px 24px; }
.welcome-hero { text-align: center; margin-bottom: 80px; }
.welcome-icon { font-size: 4rem; margin-bottom: 24px; }
.welcome-hero h1 { font-size: 2.5rem; margin-bottom: 16px; }
.welcome-hero p { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 32px; }
.welcome-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.welcome-info h2 { text-align: center; font-size: 1.75rem; margin-bottom: 40px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.info-card {
  background: var(--bg-alt);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  border: 1px solid var(--border);
}
.info-icon { font-size: 2rem; display: block; margin-bottom: 16px; }
.info-card h3 { margin-bottom: 8px; }
.info-card p { color: var(--text-muted); font-size: .9rem; }

/* SSO divider on login page */
.sso-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: .85rem;
}
.sso-divider::before,
.sso-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.sso-btn { margin-bottom: 4px; }
.sso-icon { font-size: 1rem; }

/* Error page */
.error-page { text-align: center; padding: 120px 24px; }
.error-code { font-size: 6rem; font-weight: 900; color: var(--primary); opacity: .15; line-height: 1; margin-bottom: 8px; }
.error-message { font-size: 1.5rem; margin-bottom: 32px; }

/* ── Profile pages ──────────────────────────────────────────────────────────── */
.profile-page {
  min-height: calc(100vh - 60px);
  background: var(--bg-alt);
  padding: 40px 16px;
}
.profile-container {
  max-width: 1000px;
  margin: 0 auto;
}
.profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.profile-title { font-size: 1.75rem; font-weight: 700; }
.profile-subtitle { color: var(--text-muted); margin-top: 4px; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 700px) {
  .profile-grid { grid-template-columns: 1fr; }
}

.profile-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 28px;
  box-shadow: var(--shadow);
}
.profile-sidebar { display: flex; flex-direction: column; }
.card-heading { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; }
.card-desc { font-size: .9rem; color: var(--text-muted); }
.form-section-title { font-size: .9rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: 3px; }
.input-disabled { background: var(--bg-alt) !important; color: var(--text-muted) !important; cursor: default; }
.profile-form { display: flex; flex-direction: column; gap: 14px; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-danger { background: #dc2626; color: #fff; border: none; }
.btn-danger:hover { background: #b91c1c; }

/* Active subscription card on profile page */
.sub-active-card { border-color: var(--primary); }
.sub-active-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sub-active-badge {
  display: inline-block;
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #86efac;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 8px;
}
.sub-active-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }

/* Current plan banner on subscriptions page */
.current-plan-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.current-plan-banner__info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.current-plan-banner__name { font-weight: 700; font-size: 1rem; }
.current-plan-banner__interval,
.current-plan-banner__renew { font-size: .85rem; color: #16a34a; }

/* Plan card current state */
.plan-card--current { border-color: var(--primary); position: relative; }
.plan-current-ribbon {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--primary);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 4px;
}
.plan-current-label {
  text-align: center;
  font-size: .85rem;
  font-weight: 600;
  color: #16a34a;
  padding: 10px 0;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  background: #f0fdf4;
}

/* Token badge in header */
.token-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  box-shadow: var(--shadow);
}
.token-badge__icon { font-size: 1.75rem; }
.token-badge__count { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.token-badge__label { font-size: .78rem; color: var(--text-muted); }

/* Transactions table */
.tx-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tx-table th { text-align: left; padding: 8px 12px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 2px solid var(--border); }
.tx-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tx-table tr:last-child td { border-bottom: none; }

/* Plans grid */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.plan-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.plan-image { width: 100%; height: 160px; object-fit: cover; }
.plan-card__body { padding: 24px; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.plan-name { font-size: 1.15rem; font-weight: 700; }
.plan-desc { font-size: .88rem; color: var(--text-muted); }
.plan-price-block { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-price__amount { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.plan-price__period { font-size: .9rem; color: var(--text-muted); }

/* Top-up */
.token-info-box { background: var(--bg-alt); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.token-info-row { display: flex; justify-content: space-between; font-size: .9rem; }
.amount-input-wrap { position: relative; }
.amount-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-weight: 600; color: var(--text-muted); }
.amount-input { padding-left: 30px !important; }
.token-preview { display: flex; align-items: center; gap: 16px; background: #f0fdf4; border: 1px solid #86efac; border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.token-preview__icon { font-size: 2rem; }
.token-preview__count { font-size: 1.5rem; font-weight: 800; color: #16a34a; }
.token-preview__label { font-size: .85rem; color: #16a34a; }

/* Invoice */
.invoice-card { padding: 40px; }
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.invoice-logo { font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.invoice-meta { text-align: right; font-size: .9rem; line-height: 1.8; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 32px; font-size: .9rem; line-height: 1.8; }
.invoice-parties h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 4px; }
.invoice-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.invoice-table th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.invoice-table td { padding: 12px 12px; border-bottom: 1px solid var(--border); }
.invoice-table tfoot td { border-bottom: none; padding-top: 16px; font-size: 1rem; }
.invoice-ref { margin-top: 24px; font-size: .8rem; color: var(--text-muted); }
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: .78rem; font-weight: 600; }
.status-badge--succeeded { background: #f0fdf4; color: #16a34a; }
.status-badge--pending   { background: #fefce8; color: #ca8a04; }
.status-badge--failed    { background: #fef2f2; color: #dc2626; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-muted); font-size: .95rem; }
