/* StudentPay Parent portal — content/tokens for pages + auth.
   Phase 7: authenticated app chrome comes from Admin SaaS shell
   (/assets/shared/js/saas-shell.js + Admin Vuexy CSS). Family centered
   shell / bottom-nav rules below are inert for SaaS sessions. */

:root {
  --sp-navy: #202022;
  --sp-purple: #3090C2;
  --sp-cyan: #3EADE4;
  --sp-green: #15966A;
  --sp-orange: #D99020;
  --sp-red: #DC4C4C;
  --sp-canvas: #F1F4F8;
  --bg: var(--sp-canvas);
  --card: #ffffff;
  --ink: #202022;
  --muted: #5B6570;
  --brand: #3090C2;
  --brand-soft: #EEF6FB;
  --danger: var(--sp-red);
  --warn: #D99020;
  --ok: #15966A;
  --line: #E2E8F0;
  --shadow: 0 8px 24px rgba(11, 31, 53, 0.07);
  --radius: 18px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
  --shell-max: 920px;
  --space-1: 0.35rem;
  --space-2: 0.65rem;
  --space-3: 1rem;
  --space-4: 1.35rem;
}

html[dir="ltr"] { --font: "Plus Jakarta Sans", Inter, "Segoe UI", system-ui, sans-serif; }

* { box-sizing: border-box; }

/* .field and .btn set display, which otherwise overrides the hidden attribute
   and paints empty dropdowns and solid bars before content is ready. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

body:not(.sp-saas-portal) {
  background: linear-gradient(180deg, #eef2f7 0%, var(--bg) 42%);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Legacy family shell (Phase 6; not applied when SaaS shell mounts) ---- */
body.sp-parent.sp-family {
  background:
    radial-gradient(circle at top right, rgba(115, 103, 240, 0.14) 0, transparent 42%),
    radial-gradient(circle at 12% 0%, rgba(0, 207, 232, 0.12) 0, transparent 34%),
    linear-gradient(180deg, #eef4fb, var(--bg));
}

body.sp-parent.sp-family .shell,
body.sp-parent.sp-family .sp-family-shell {
  display: block !important;
  max-width: var(--shell-max) !important;
  margin: 0 auto !important;
  padding: 1rem 1rem 5.75rem !important;
  min-height: 100vh;
  grid-template-columns: none !important;
}

body.sp-parent.sp-family .sp-sidebar,
body.sp-parent.sp-family .sp-menu-btn {
  display: none !important;
}

body.sp-parent.sp-family .sp-main {
  display: contents;
}

body.sp-parent.sp-family .sp-header,
body.sp-parent.sp-family .sp-family-header {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.55rem 0.15rem;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
  flex-wrap: wrap;
}

body.sp-parent.sp-family .sp-family-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
}

body.sp-parent.sp-family .sp-family-brand:hover { text-decoration: none; }

body.sp-parent.sp-family .sp-mark {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--sp-navy);
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
}

body.sp-parent.sp-family .brand-text strong {
  display: block;
  color: var(--sp-navy);
  font-size: 1.02rem;
  line-height: 1.15;
}

body.sp-parent.sp-family .brand-text span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

body.sp-parent.sp-family .sp-content {
  width: 100% !important;
  padding: 0 !important;
}

body.sp-parent.sp-family .sp-page-head {
  margin-bottom: 0.85rem;
}

body.sp-parent.sp-family .sp-page-head.is-home {
  margin-bottom: 0.35rem;
}

body.sp-parent.sp-family .sp-page-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

body.sp-parent.sp-family .sp-footer {
  border-top: 0;
  padding: 1rem 0 0.25rem;
  text-align: center;
}

body.sp-parent.sp-family .nav {
  display: grid !important;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
  grid-template-columns: repeat(5, 1fr);
  gap: 0.25rem;
  padding: 0.45rem 0.4rem calc(0.45rem + env(safe-area-inset-bottom));
}

body.sp-parent.sp-family .nav a {
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 0.4rem 0.15rem;
  border-radius: 10px;
  text-decoration: none;
}

body.sp-parent.sp-family .nav a.active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 700;
}

/* ---- Shared components ---- */
.shell { max-width: var(--shell-max); margin: 0 auto; padding: 1rem 1rem 5.75rem; }

.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.8rem;
  background: var(--brand-soft); color: var(--brand); font-weight: 600;
}
.pill.warn { background: rgba(255, 159, 67, 0.16); color: var(--warn); }
.pill.danger { background: rgba(234, 84, 85, 0.14); color: var(--danger); }
.pill.ok { background: rgba(40, 199, 111, 0.14); color: var(--ok); }

.card, .hero.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin-bottom: 0.85rem;
}

.hero h1 { margin: 0 0 0.35rem; font-size: 1.45rem; color: var(--sp-navy); letter-spacing: -0.02em; }
.hero p { margin: 0; color: var(--muted); }

.sp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.65rem;
  margin: 0.85rem 0 0.55rem;
}

.sp-kpi-grid.is-secondary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 0;
  margin-bottom: 0.85rem;
}

.sp-kpi, .kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.85rem;
  box-shadow: var(--shadow);
}

.sp-kpi span, .kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.sp-kpi strong, .kpi strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.05rem;
  color: var(--sp-navy);
  overflow-wrap: anywhere;
}

.sp-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem;
  margin-bottom: 0.85rem;
}

.sp-section h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  color: var(--sp-navy);
}

.sp-lead {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.sp-grid-2 {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 0.85rem;
}

.sp-child-grid {
  display: grid;
  gap: 0.7rem;
}

.sp-child {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 0.9rem;
  background: linear-gradient(180deg, #fff, #fbfcff);
}

.sp-child .child {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sp-navy); color: #fff;
  font-weight: 700; letter-spacing: 0.04em;
}

.sp-child h3 { margin: 0; font-size: 1rem; color: var(--sp-navy); }
.sp-child p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.85rem; }

.sp-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.7rem;
  margin: 0.7rem 0;
  font-size: 0.82rem;
}
.sp-metrics b { display: block; color: var(--sp-navy); }

.sp-quick { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: var(--sp-navy);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field { display: grid; gap: 0.35rem; margin-bottom: 0.85rem; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  font: inherit;
  background: #fff;
}

.lang { display: inline-flex; gap: 0.25rem; }
.lang button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font: inherit;
  cursor: pointer;
  color: var(--muted);
}
.lang button.active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.note { color: var(--muted); font-size: 0.88rem; margin: 0.55rem 0; }
.err { color: var(--danger); font-size: 0.9rem; margin: 0.5rem 0; }
.muted { color: var(--muted); font-size: 0.85rem; }

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }

.check { display: grid; place-items: center; }
.card.is-unread { border-inline-start: 3px solid var(--brand); }
.card.is-read { opacity: 0.9; }

.loading-banner {
  display: none;
  margin: 0.35rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}
body[aria-busy="true"] .loading-banner { display: block; }

.sp-bar-row {
  display: grid;
  grid-template-columns: minmax(4.5rem, 7rem) minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  margin: 0.4rem 0;
  font-size: 0.82rem;
}
.sp-bar-track { height: 0.55rem; background: #eef1f8; border-radius: 999px; overflow: hidden; }
.sp-bar-fill { height: 100%; background: linear-gradient(90deg, #7367f0, #3d4db7); border-radius: inherit; }
.sp-bar-fill.ok { background: #28c76f; }
.sp-bar-fill.warn { background: #ff9f43; }
.sp-bar-fill.danger { background: #ea5455; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  font-size: 0.75rem;
  color: #667085;
  font-weight: 700;
}
table.data th, table.data td {
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid #eef1f6;
  text-align: start;
  vertical-align: middle;
}
table.data tbody tr:hover { background: #f8f7ff; }

.receipt-brand {
  display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1rem;
  padding-bottom: 0.75rem; border-bottom: 1px solid var(--line);
}
.receipt-brand strong { display: block; color: var(--sp-navy); }
.receipt-brand span { color: var(--muted); font-size: 0.85rem; }

.sp-empty {
  text-align: center;
  padding: 1.25rem 0.75rem;
  color: var(--muted);
}

@media (max-width: 860px) {
  body.sp-parent.sp-family .sp-grid-2,
  .sp-grid-2 { grid-template-columns: 1fr; }
  .sp-kpi-grid { grid-template-columns: 1fr; }
  .sp-kpi-grid.is-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .sp-kpi-grid,
  .sp-kpi-grid.is-secondary { grid-template-columns: 1fr; }
  .sp-bar-row { grid-template-columns: 1fr; }
  table.data thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data tr {
    display: block;
    border: 1px solid #eef1f6;
    border-radius: 14px;
    margin-bottom: 0.65rem;
    padding: 0.35rem 0.6rem;
    background: #fff;
  }
  table.data td {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    border: 0;
    padding: 0.35rem 0;
  }
  table.data td::before {
    content: attr(data-label);
    color: #667085;
    font-weight: 700;
    font-size: 0.75rem;
  }
}

/* ---- Batch 5 deep redesign (family IA; SaaS shell owns chrome) ---- */
.sp-portal-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}
.sp-portal-header > div:first-child { flex: 1 1 16rem; min-width: 0; }
.sp-portal-header h1 {
  margin: 0 0 0.3rem;
  font-size: 1.45rem;
  color: var(--sp-navy);
  letter-spacing: -0.02em;
}
.sp-portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.sp-portal-actions .btn.sp-cta-pay {
  min-width: 8.5rem;
  box-shadow: 0 10px 24px rgba(7, 26, 43, 0.18);
}
.sp-payable-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin: 0.65rem 0 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sp-payable-strip .sp-money-lg,
.sp-money-lg {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--sp-navy);
}
.sp-child-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.55rem;
}
.sp-child-actions .btn { padding: 0.55rem 0.85rem; font-size: 0.88rem; }
.sp-child.is-selected {
  border-color: rgba(91, 77, 199, 0.45);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.sp-sticky-pay {
  position: sticky;
  bottom: 0.75rem;
  z-index: 12;
  margin-top: 0.75rem;
}
.sp-school-card h3 { margin: 0 0 0.35rem; color: var(--sp-navy); }
.sp-school-card .sp-metrics { margin-top: 0.55rem; }
.sp-wallet-hero {
  margin-bottom: 0.85rem;
}
.sp-wallet-ledger .list-row {
  padding: 0.75rem 0.15rem;
}
.sp-wallet-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.sp-wallet-form {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem 0;
}
.sp-wallet-form h3 { margin: 0; font-size: 1rem; }
.sp-wallet-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 650;
}
.sp-wallet-form input {
  width: 100%;
  min-height: 2.6rem;
  border: 1px solid var(--line, #d7dee8);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font: inherit;
}
.sp-wallet-link-panel {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line, #e4e7ec);
  display: grid;
  gap: 0.65rem;
}
.sp-wallet-link-panel h3 { margin: 0; font-size: 1rem; }
@media (max-width: 720px) {
  .sp-wallet-actions { grid-template-columns: 1fr; }
}
.sp-notif-item {
  margin-bottom: 0.65rem;
}
.sp-notif-item .btn { margin-top: 0.55rem; }
.sp-share-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  word-break: break-all;
  padding: 0.75rem 0.85rem;
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.sp-receipt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.1rem;
  margin-top: 0.85rem;
}
.sp-receipt-grid > div span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  margin-bottom: 0.2rem;
}
.sp-receipt-grid .sp-money-lg { font-size: 1.25rem; }

.sp-receipt-card {
  display: grid;
  gap: 1rem;
}
.sp-receipt-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.sp-receipt-ref {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--sp-navy);
  word-break: break-word;
}
.sp-receipt-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.sp-receipt-meta-item {
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #eef1f6;
}
.sp-receipt-meta-item span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  margin-bottom: 0.2rem;
}
.sp-receipt-items {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.sp-receipt-items-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.sp-receipt-items-head h3 {
  margin: 0;
  font-size: 0.95rem;
}
.sp-receipt-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sp-receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.sp-receipt-line:last-child { border-bottom: 0; }
.sp-receipt-line-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.sp-receipt-total {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--line);
}
.sp-receipt-total .sp-money-lg { margin: 0; }
.sp-method-row.is-unavailable { opacity: 0.78; }
.sp-method-available { background: rgba(40, 199, 111, 0.14); color: var(--ok); }
.sp-method-unavailable { background: rgba(100, 116, 139, 0.14); color: #475569; }
.sp-onboard-progress {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
}
.sp-onboard-progress span {
  flex: 1;
  height: 0.35rem;
  border-radius: 999px;
  background: #e4e7ec;
}
.sp-onboard-progress span.is-active { background: var(--sp-navy); }
.sp-profile-block + .sp-profile-block { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--line); }
.sp-confirm-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  max-width: 26rem;
  box-shadow: var(--shadow);
}
.sp-confirm-dialog::backdrop {
  background: rgba(7, 26, 43, 0.45);
}
.sp-confirm-dialog h2 {
  margin: 0 0 0.55rem;
  font-size: 1.1rem;
  color: var(--sp-navy);
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.tabular-nums, .sp-money-lg, .sp-kpi strong, .kpi strong, table.data td:nth-child(n) {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .sp-receipt-grid,
  .sp-receipt-meta { grid-template-columns: 1fr; }
  .sp-sticky-pay { bottom: 0.35rem; }
}

@media print {
  .nav, .sp-header, .sp-footer, .btn, .sp-portal-actions, .sp-pay-actions, .sp-sticky-pay { display: none !important; }
  body { background: #fff; }
  .shell { max-width: none; padding: 0; }
  .sp-finance-hero, .card { box-shadow: none; border-color: #ddd; }
}

/* —— Batch 5 deep redesign —— */
.sp-portal-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  align-items: flex-start;
  margin-block-end: 1rem;
}
.sp-portal-header h1 {
  margin: 0;
  font-size: clamp(1.35rem, 1.15rem + 0.7vw, 1.75rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--sp-navy, #071a2b);
}
.sp-portal-header .sp-lead {
  margin: 0.35rem 0 0;
  max-width: 42rem;
  color: var(--muted, #6b7280);
  font-size: 0.95rem;
}
.sp-portal-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sp-note-warn {
  color: #9a5b00;
  background: rgba(255, 159, 67, 0.12);
  border-inline-start: 3px solid #ff9f43;
  padding: 0.55rem 0.75rem;
  border-radius: 0.4rem;
  margin-block: 0.5rem 0.85rem;
}
.sp-finance-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.sp-finance-ref {
  margin: 0.15rem 0 0.5rem;
  font-size: clamp(1.2rem, 1.05rem + 0.55vw, 1.6rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  word-break: break-word;
}
.sp-money-lg {
  margin: 0.15rem 0;
  font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.9rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.sp-finance-hero-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.75rem;
  margin: 0;
}
.sp-finance-hero-meta dt { color: var(--muted, #6b7280); font-size: 0.75rem; font-weight: 650; }
.sp-finance-hero-meta dd { margin: 0; font-weight: 650; font-size: 0.875rem; }
.sp-pay-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
}
.sp-pay-summary article {
  border: 1px solid var(--line, #e6eaf2);
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  background: #fff;
}
.sp-pay-summary span { display: block; color: var(--muted, #6b7280); font-size: 0.75rem; font-weight: 650; }
.sp-pay-summary strong { display: block; margin-top: 0.3rem; font-variant-numeric: tabular-nums; }
.sp-receipt {
  max-width: 36rem;
  margin-inline: auto;
}
.sp-receipt .sp-money-lg { text-align: start; }
.sp-section-block {
  background: #fff;
  border: 1px solid var(--line, #e6eaf2);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 2px rgba(7, 26, 43, 0.04);
}
.sp-section-block > h2 { margin: 0 0 0.5rem; font-size: 1.05rem; color: var(--sp-navy, #071a2b); }
body.sp-saas-portal #bottom-nav,
body.sp-saas-portal .nav { display: none !important; }
@media (max-width: 991.98px) {
  .sp-finance-hero { grid-template-columns: 1fr; }
}

/* —— Pay checkout polish —— */
.sp-pay-shell { padding-bottom: 7.5rem; }
.sp-pay-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  padding: 0;
}
.sp-pay-steps li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}
.sp-pay-steps li span {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #eef2f7;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}
.sp-pay-steps li.is-active {
  border-color: rgba(91, 77, 199, 0.35);
  background: var(--brand-soft);
  color: var(--sp-navy);
}
.sp-pay-steps li.is-active span,
.sp-pay-steps li.is-done span {
  background: var(--sp-navy);
  color: #fff;
}
.sp-pay-steps li.is-done { color: var(--sp-navy); }
.sp-pay-steps em { font-style: normal; }

.sp-fee-groups { display: grid; gap: 0.85rem; }
.sp-fee-group {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fbfcff;
}
.sp-fee-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.sp-fee-group-head h3 {
  margin: 0;
  font-size: 0.98rem;
  color: var(--sp-navy);
}
.sp-linkish {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.sp-fee-lines { display: grid; }
.sp-fee-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.sp-fee-line:last-child { border-bottom: 0; }
.sp-fee-line input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--sp-navy);
}
.sp-fee-line-body {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.sp-fee-line-body strong {
  color: var(--sp-navy);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}
.sp-fee-line-amount {
  font-weight: 750;
  color: var(--sp-navy);
  white-space: nowrap;
}
.sp-fee-line.is-selected {
  background: rgba(91, 77, 199, 0.06);
  box-shadow: inset 3px 0 0 var(--brand);
}
html[dir="rtl"] .sp-fee-line.is-selected {
  box-shadow: inset -3px 0 0 var(--brand);
}
.sp-fee-line.is-disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.sp-method-picker {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}
.sp-method-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}
.sp-method-card input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--sp-navy);
}
.sp-method-card-copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.sp-method-card-copy strong {
  color: var(--sp-navy);
  font-size: 0.95rem;
}
.sp-method-card.is-selected {
  border-color: rgba(91, 77, 199, 0.45);
  background: rgba(91, 77, 199, 0.06);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.sp-method-more {
  margin: 0.35rem 0 0.55rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 0.35rem 0.65rem 0.55rem;
  background: #f8fafc;
}
.sp-method-more summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
  padding: 0.35rem 0;
}
.sp-method-unavailable-list .sp-method-row {
  padding: 0.55rem 0.15rem;
}

.sp-pay-checkout {
  position: sticky;
  bottom: 0.75rem;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(7, 26, 43, 0.14);
  backdrop-filter: blur(8px);
}
.sp-pay-checkout-meta {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.sp-pay-checkout-meta .sp-money-lg {
  margin: 0;
  font-size: 1.25rem;
}
.sp-pay-checkout .btn {
  min-width: 12rem;
  box-shadow: 0 10px 24px rgba(7, 26, 43, 0.18);
}
body.sp-saas-portal .sp-pay-checkout { bottom: 1rem; }

@media (max-width: 560px) {
  .sp-pay-steps { grid-template-columns: 1fr; }
  .sp-pay-checkout {
    bottom: 0.35rem;
    flex-direction: column;
    align-items: stretch;
  }
  .sp-pay-checkout .btn { width: 100%; min-width: 0; }
  .sp-fee-line {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "check body"
      "check amount";
  }
  .sp-fee-line input { grid-area: check; }
  .sp-fee-line-body { grid-area: body; }
  .sp-fee-line-amount { grid-area: amount; justify-self: start; }
}
