.paygo-portal-page {
  --pg-bg: #f0f4f8;
  --pg-surface: #ffffff;
  --pg-border: #e2e8f0;
  --pg-text: #0f172a;
  --pg-muted: #64748b;
  --pg-accent: #40aed6;
  --pg-gold: #f9bd3c;
  --pg-dark: #1f1f24;
  --pg-green: #16a34a;
  font-family: "Inter", var(--default-font), sans-serif;
  overflow-x: hidden;
}

.paygo-portal-page .header {
  background: #fff;
  border-bottom: 1px solid var(--pg-border);
}

.portal-main { background: var(--pg-bg); }

.portal-hero {
  margin-top: 74px;
  padding: 48px 0 56px;
  background: linear-gradient(135deg, #1f1f24 0%, #2d3a4f 50%, #1a4a5e 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.portal-hero::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--pg-bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.hero-content {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
  background: rgba(64, 174, 214, 0.25);
  color: #a8e0f4;
}

.hero-text h1 {
  font-size: 40px;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.hero-text p {
  margin: 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.92);
  max-width: 480px;
}

.hero-stats { display: flex; gap: 24px; }

.hero-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.hero-stats i { font-size: 22px; color: var(--pg-gold); }

.portal-wrap {
  max-width: 1080px;
  padding: 0 15px 64px;
  padding-bottom: max(64px, env(safe-area-inset-bottom));
  margin-top: -20px;
  position: relative;
  z-index: 2;
  width: 100%;
}

.flow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  padding: 16px 24px;
  background: var(--pg-surface);
  border-radius: 14px;
  border: 1px solid var(--pg-border);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pg-muted);
}

.flow-step span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--pg-border);
  color: var(--pg-muted);
}

.flow-step.active { color: var(--pg-text); }
.flow-step.active span { background: var(--pg-accent); color: #fff; }
.flow-step.done span { background: var(--pg-green); color: #fff; }

.flow-line {
  width: 32px;
  height: 2px;
  margin: 0 8px;
  background: var(--pg-border);
}

.portal-card {
  background: var(--pg-surface);
  border-radius: 16px;
  border: 1px solid var(--pg-border);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.lookup-card { max-width: 640px; margin: 0 auto 24px; }

.lookup-body,
#paygo-payment-form,
.confirm-body { padding: 24px 28px 28px; }

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--pg-border);
  background: linear-gradient(to right, #fafbfc, #fff);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  color: var(--pg-accent);
  background: color-mix(in srgb, var(--pg-accent), transparent 88%);
}

.card-icon.gold {
  color: #b8860b;
  background: color-mix(in srgb, var(--pg-gold), transparent 80%);
}

.card-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--pg-text);
}

.card-header p { margin: 0; font-size: 13px; color: var(--pg-muted); }

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 16px;
  background: var(--pg-surface);
  border: 1px solid var(--pg-border);
  border-radius: 12px;
}

.account-bar-info { display: flex; align-items: center; gap: 12px; }
.account-bar-info > i { font-size: 32px; color: var(--pg-accent); }
.account-bar-info strong { display: block; font-size: 15px; color: var(--pg-text); }
.account-bar-info span { font-size: 13px; color: var(--pg-muted); }

.btn-link {
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--pg-accent);
  cursor: pointer;
}

.btn-link:hover { text-decoration: underline; }

.portal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  background: var(--pg-surface);
  border: 1px solid var(--pg-border);
  border-radius: 12px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--pg-muted);
  background: transparent;
  cursor: pointer;
}

.tab-btn.active {
  color: #fff;
  background: var(--pg-accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px 28px;
}

.info-card {
  padding: 18px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--pg-border);
}

.info-card span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--pg-muted);
  margin-bottom: 6px;
}

.info-card strong { font-size: 15px; color: var(--pg-text); word-break: break-all; }

.tab-action { padding: 0 28px 24px; }

.field { margin-bottom: 20px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--pg-muted);
  margin-bottom: 8px;
}

.input-icon-wrap { position: relative; }

.input-icon-wrap i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pg-muted);
  font-size: 16px;
}

.input-icon-wrap input,
.field input[type="tel"],
.field input[type="number"] {
  width: 100%;
  height: 50px;
  padding: 0 14px 0 42px;
  border: 1.5px solid var(--pg-border);
  border-radius: 10px;
  font-size: 15px;
  background: #f8fafc;
}

.input-icon-wrap input:focus,
.amount-wrap input:focus {
  outline: none;
  border-color: var(--pg-accent);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pg-accent), transparent 85%);
}

.lookup-row { display: flex; gap: 10px; }
.lookup-row .input-icon-wrap { flex: 1; }

.field-hint { margin: 10px 0 0; font-size: 13px; color: var(--pg-muted); }
.field-hint.ok { color: var(--pg-green); font-weight: 500; }
.field-hint.fail { color: #dc2626; font-weight: 500; }

.payment-details {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px dashed var(--pg-border);
}

.provider-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.prov input { position: absolute; opacity: 0; pointer-events: none; }

.prov-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 14px 16px;
  border-radius: 12px;
  border: 2px solid var(--pg-border);
  background: #fff;
  cursor: pointer;
  min-height: 118px;
}

.prov-logo {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prov-logo img { max-width: 100%; max-height: 48px; object-fit: contain; }
.prov-card.tnm .prov-logo img { max-height: 52px; }

.prov-name { font-size: 12px; font-weight: 600; color: var(--pg-muted); }

.prov-check {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 18px;
  opacity: 0;
}

.prov input:checked + .prov-card { box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08); }
.prov input:checked + .prov-card .prov-check { opacity: 1; }
.prov input:checked + .prov-card .prov-name { color: var(--pg-text); font-weight: 700; }
.prov input:checked + .prov-card.airtel { border-color: #e31b23; }
.prov input:checked + .prov-card.airtel .prov-check { color: #e31b23; }
.prov input:checked + .prov-card.tnm { border-color: #2d8a3e; }
.prov input:checked + .prov-card.tnm .prov-check { color: #2d8a3e; }

.amount-wrap {
  display: flex;
  align-items: center;
  height: 50px;
  border: 1.5px solid var(--pg-border);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}

.amount-wrap span {
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--pg-accent);
  background: color-mix(in srgb, var(--pg-accent), transparent 92%);
  border-right: 1.5px solid var(--pg-border);
}

.amount-wrap input {
  flex: 1;
  border: 0;
  height: 100%;
  padding: 0 16px;
  font-size: 20px;
  font-weight: 600;
  background: transparent;
}

.btn-primary {
  border: 0;
  min-height: 50px;
  height: auto;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--pg-accent), #2d8eb0);
  cursor: pointer;
  line-height: 1.35;
  white-space: normal;
  text-align: center;
}

.btn-primary.btn-pay {
  width: 100%;
  margin-top: 4px;
  font-size: 15px;
  padding: 14px 20px;
}

.btn-primary.btn-pay i { margin-left: 6px; }

.btn-secondary {
  min-height: 44px;
  height: auto;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  color: var(--pg-text);
  border: 1.5px solid var(--pg-border);
  cursor: pointer;
  line-height: 1.35;
  white-space: normal;
  text-align: center;
}

.confirm-group { margin-bottom: 24px; }

.confirm-group h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--pg-muted);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--pg-border);
}

.confirm-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--pg-border);
}

.confirm-row:last-child { border-bottom: 0; }
.confirm-row span { color: var(--pg-muted); }
.confirm-row strong {
  text-align: right;
  color: var(--pg-text);
  word-break: break-word;
  max-width: 58%;
}
.confirm-row.highlight strong { font-size: 22px; color: var(--pg-accent); }

.confirm-actions { display: flex; gap: 12px; margin-top: 8px; }
.confirm-actions .btn-primary,
.confirm-actions .btn-secondary { flex: 1; }

.initiating-card { text-align: center; }

.initiating-body {
  padding: 56px 28px 64px;
}

.initiating-body h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--pg-text);
}

.initiating-body p {
  font-size: 14px;
  color: var(--pg-muted);
  max-width: 420px;
  margin: 0 auto 12px;
  line-height: 1.6;
}

.initiating-note {
  font-size: 13px;
  margin-top: 20px !important;
  color: var(--pg-text);
}

.panel-state { text-align: center; padding: 48px 28px; }
.panel-state h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.panel-state p { color: var(--pg-muted); margin-bottom: 20px; font-size: 14px; }

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 20px;
  border: 3px solid var(--pg-border);
  border-top-color: var(--pg-accent);
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.state-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}

.state-badge.ok { color: var(--pg-green); background: color-mix(in srgb, var(--pg-green), transparent 88%); }
.state-badge.fail { color: #dc2626; background: color-mix(in srgb, #dc2626, transparent 88%); }

.tag-paid {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  color: var(--pg-green);
  background: color-mix(in srgb, var(--pg-green), transparent 88%);
}

.mono { font-family: "Roboto Mono", monospace; letter-spacing: 0.5px; }

.pg-toast {
  position: fixed;
  top: 90px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: #1f1f24;
  border-left: 4px solid #f9bd3c;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s, transform 0.3s;
}

.pg-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.pg-toast i {
  font-size: 18px;
  color: #f9bd3c;
  flex-shrink: 0;
}

.portal-footer { margin-top: 0; }
.portal-footer .copyright p { margin: 0; font-size: 13px; opacity: 0.7; }

@media (max-width: 1199px) {
  .portal-wrap {
    max-width: 100%;
    padding-left: 20px;
    padding-right: 20px;
  }
}

@media (max-width: 991px) {
  .portal-hero {
    padding: 36px 0 48px;
  }

  .hero-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }

  .hero-stats {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .hero-stats div {
    flex: 1;
    min-width: 0;
  }

  .flow-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 14px 12px;
  }

  .flow-line { display: none; }

  .flow-step {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 6px;
    font-size: 11px;
    line-height: 1.2;
  }

  .info-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
  .portal-hero {
    margin-top: 64px;
    padding: 28px 0 40px;
  }

  .portal-hero::after {
    height: 28px;
  }

  .portal-wrap {
    margin-top: -12px;
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 48px;
  }

  .hero-text h1 {
    font-size: 28px;
  }

  .hero-text p {
    font-size: 14px;
  }

  .hero-badge {
    font-size: 11px;
    padding: 5px 12px;
  }

  .flow-steps {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 20px;
  }

  .flow-step {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    font-size: 11px;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--pg-border);
  }

  .flow-step span {
    width: 26px;
    height: 26px;
    font-size: 11px;
    flex-shrink: 0;
  }

  .card-header {
    padding: 18px 20px;
    gap: 12px;
  }

  .card-icon {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }

  .card-header h2 {
    font-size: 16px;
    line-height: 1.3;
  }

  .card-header p {
    font-size: 12px;
    line-height: 1.45;
  }

  .lookup-body,
  #paygo-payment-form,
  .confirm-body {
    padding: 18px 20px 22px;
  }

  .lookup-card {
    margin-bottom: 16px;
  }

  .lookup-row {
    flex-direction: column;
  }

  .lookup-row .btn-primary {
    width: 100%;
  }

  .account-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }

  .btn-link {
    align-self: flex-start;
    padding: 4px 0;
  }

  .portal-tabs {
    padding: 5px;
    gap: 6px;
  }

  .tab-btn {
    padding: 11px 10px;
    font-size: 13px;
    gap: 6px;
  }

  .info-grid {
    grid-template-columns: 1fr;
    padding: 18px 20px;
    gap: 12px;
  }

  .tab-action {
    padding: 0 20px 20px;
  }

  .tab-action .btn-primary {
    width: 100%;
  }

  .provider-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .prov-card {
    min-height: 100px;
    padding: 14px 10px 12px;
  }

  .prov-name {
    font-size: 11px;
  }

  .confirm-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 0;
  }

  .confirm-row strong {
    text-align: left;
    max-width: 100%;
    font-size: 15px;
  }

  .confirm-row.highlight strong {
    font-size: 20px;
  }

  .confirm-actions {
    flex-direction: column;
    gap: 10px;
  }

  .confirm-actions .btn-primary,
  .confirm-actions .btn-secondary {
    width: 100%;
  }

  .initiating-body {
    padding: 40px 20px 48px;
  }

  .initiating-body h3 {
    font-size: 20px;
  }

  .panel-state {
    padding: 36px 20px;
  }

  .pg-toast {
    top: auto;
    bottom: max(20px, env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .hero-stats {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .hero-stats div {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
  }

  .hero-stats i {
    font-size: 18px;
  }

  .flow-step {
    font-size: 10px;
    padding: 8px;
  }

  .flow-step span {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .provider-row {
    grid-template-columns: 1fr;
  }

  .prov-card {
    flex-direction: row;
    min-height: auto;
    padding: 12px 14px;
    gap: 12px;
    text-align: left;
  }

  .prov-logo {
    width: auto;
    height: 40px;
    flex: 0 0 72px;
  }

  .prov-logo img {
    max-height: 36px;
  }

  .prov-name {
    flex: 1;
    text-align: left;
    font-size: 13px;
  }

  .amount-wrap input {
    font-size: 18px;
  }

  .input-icon-wrap input,
  .field input[type="tel"],
  .field input[type="number"] {
    font-size: 16px;
  }

  .card-header,
  .lookup-body,
  #paygo-payment-form,
  .confirm-body,
  .info-grid {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (min-width: 1200px) {
  .portal-card {
    margin-left: auto;
    margin-right: auto;
  }

  .lookup-card,
  #view-dashboard .portal-card,
  .confirm-card,
  .initiating-card {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
}
