/*
 * Portal Bundle 1 — Authenticated portal CSS.
 * Shipped as a sibling stylesheet to auth-shell.css. Pages that include
 * <link rel="stylesheet" href="/styles/portal.css"> render the
 * authenticated chrome (sidebar + topbar + main).
 *
 * Class names match Jaspr component output. Semantic; not Tailwind.
 * Re-uses tokens.css variables where applicable.
 *
 * Slice: Portal Bundle 1 (Development Preview Mode)
 */

/* =====================================================================
   ROOT + RESET
   ===================================================================== */
.portal-shell {
  --portal-bg: #f9fafb;
  --portal-surface: #ffffff;
  --portal-border: #e5e7eb;
  --portal-border-soft: #f3f4f6;
  --portal-text: #111827;
  --portal-text-dim: #6b7280;
  --portal-text-muted: #9ca3af;
  --portal-text-faint: #d1d5db;
  --portal-accent: #111827;
  --portal-success: #16a34a;
  --portal-warn: #ca8a04;
  --portal-danger: #dc2626;
  --portal-violet: #693efe;
  --portal-violet-soft: rgba(105, 62, 254, 0.08);
  --portal-radius: 12px;
  --portal-radius-pill: 999px;
  --portal-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.04);

  font-family: 'Inter Tight', system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, sans-serif;
  color: var(--portal-text);
  background: var(--portal-bg);
  min-height: 100vh;
}

.portal-shell * {
  box-sizing: border-box;
}

.portal-shell a {
  color: inherit;
  text-decoration: none;
}

.portal-shell button {
  font-family: inherit;
  cursor: pointer;
}

/* =====================================================================
   SIDEBAR (fixed 240px on desktop, drawer on mobile)
   ===================================================================== */
.portal-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  padding: 12px;
  display: flex;
  flex-direction: column;
  background: var(--portal-bg);
  z-index: 40;
}

.portal-sidebar__logo {
  margin: 4px 10px 18px;
  display: block;
  height: 36px;
}

.portal-sidebar__logo-svg {
  height: 36px;
  width: auto;
  display: block;
}

.portal-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portal-sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--portal-text-dim);
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.portal-sidebar__nav-item:hover {
  background: #f3f4f6;
}

.portal-sidebar__nav-item.is-active {
  background: #e5e7eb;
  color: var(--portal-text);
  font-weight: 500;
}

.portal-sidebar__nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.portal-sidebar__group {
  margin-top: 16px;
}

.portal-sidebar__group-title {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--portal-text-muted);
}

.portal-sidebar__user-chip {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--portal-border);
}

.portal-sidebar__user-chip-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background 0.12s ease;
}

.portal-sidebar__user-chip-inner:hover {
  background: #f3f4f6;
}

.portal-sidebar__avatar {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.portal-sidebar__avatar-status {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--portal-success);
  border: 2px solid var(--portal-bg);
}

.portal-sidebar__user-meta {
  flex: 1;
  min-width: 0;
}

.portal-sidebar__user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--portal-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.portal-sidebar__user-status {
  font-size: 11px;
  color: var(--portal-text-muted);
  margin: 1px 0 0;
}

/* =====================================================================
   MAIN AREA (offset by sidebar width)
   ===================================================================== */
.portal-layout {
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  background: var(--portal-bg);
}

.portal-topbar__search-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--portal-text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.portal-topbar__search-btn:hover {
  background: var(--portal-surface);
  color: var(--portal-text);
}

.portal-topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-topbar__icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--portal-text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.portal-topbar__icon-btn:hover {
  background: var(--portal-surface);
  color: var(--portal-text);
}

.portal-topbar__bell-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--portal-violet);
  border: 2px solid var(--portal-bg);
}

.portal-main {
  flex: 1;
  padding: 0 24px 32px;
}

.portal-page {
  max-width: 1280px;
  margin: 0 auto;
}

/* =====================================================================
   GREETING + PAGE HEADER
   ===================================================================== */
.portal-greeting {
  /* Bottom margin owned by the universal page-rhythm rule
     (.portal-page > div > * + * { margin-top: 32px }). */
}

.portal-greeting__welcome {
  font-size: 13px;
  color: var(--portal-text-dim);
  margin: 0;
}

.portal-greeting__name {
  font-size: 22px;
  font-weight: 600;
  color: var(--portal-text);
  margin: 2px 0 0;
}

.portal-page__title {
  font-size: 24px;
  font-weight: 600;
  color: var(--portal-text);
  margin: 0 0 4px;
}

.portal-page__subtitle {
  font-size: 13px;
  color: var(--portal-text-dim);
  margin: 0;
  /* Bottom margin owned by the universal page-rhythm rule
     (.portal-page > div > * + * { margin-top: 32px }). */
}

/* =====================================================================
   CARDS
   ===================================================================== */
.portal-card {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border-soft);
  border-radius: var(--portal-radius);
  padding: 24px;
  box-shadow: var(--portal-shadow-soft);
}

.portal-card__title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--portal-text);
  margin: 0 0 4px;
}

.portal-card__eyebrow {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--portal-text-muted);
  margin: 0;
}

/* Summary card variant — for 4-up rows */
.portal-summary-card {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border-soft);
  border-radius: var(--portal-radius);
  padding: 20px 24px;
}

.portal-summary-card__label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--portal-text-muted);
  margin: 0;
}

.portal-summary-card__value {
  font-size: 22px;
  font-weight: 600;
  color: var(--portal-text);
  margin: 6px 0 0;
}

.portal-summary-card__note {
  font-size: 11.5px;
  color: var(--portal-text-muted);
  margin: 4px 0 0;
}

/* =====================================================================
   GRID
   ===================================================================== */
.portal-grid {
  display: grid;
  gap: 16px;
}

.portal-grid--2 {
  grid-template-columns: 1fr 1fr;
}

.portal-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.portal-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

.portal-grid--main {
  grid-template-columns: 2fr 1fr;
  align-items: start;
}

/* =====================================================================
   PAGE VERTICAL RHYTHM
   ─────────────────────────────────────────────────────────────────────
   Universal rule for spacing between top-level page sections.
   Every direct child of the page content wrapper, AFTER the first,
   gets 32px of breathing room from its previous sibling. This replaces
   the per-class .portal-grid + .portal-grid and .portal-section +
   .portal-section rules — they had inconsistent values (16px / 24px)
   that produced uneven rhythm depending on the markup order.
   Owner directive 2026-06: spacing review after blank-state retrofit.
   ===================================================================== */
.portal-shell .portal-page > div > * + * {
  margin-top: 32px;
}

@media (max-width: 720px) {
  .portal-shell .portal-page > div > * + * {
    margin-top: 24px;
  }
}

/* =====================================================================
   PROGRESS BAR
   ===================================================================== */
.portal-progress {
  margin-top: 12px;
}

.portal-progress__track {
  height: 8px;
  background: #e5e7eb;
  border-radius: var(--portal-radius-pill);
  overflow: hidden;
}

.portal-progress__fill {
  height: 100%;
  background: var(--portal-violet);
  border-radius: var(--portal-radius-pill);
  transition: width 0.5s ease;
}

.portal-progress__fill--success {
  background: var(--portal-success);
}

.portal-progress__fill--warn {
  background: var(--portal-warn);
}

/* =====================================================================
   PILL / BADGE
   ===================================================================== */
.portal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--portal-radius-pill);
  font-size: 11px;
  font-weight: 500;
}

.portal-pill--success {
  background: rgba(22, 163, 74, 0.1);
  color: var(--portal-success);
}

.portal-pill--warn {
  background: rgba(202, 138, 4, 0.1);
  color: var(--portal-warn);
}

.portal-pill--danger {
  background: rgba(220, 38, 38, 0.1);
  color: var(--portal-danger);
}

.portal-pill--neutral {
  background: var(--portal-border-soft);
  color: var(--portal-text-dim);
}

.portal-pill--info {
  background: rgba(105, 62, 254, 0.1);
  color: var(--portal-accent);
}

.portal-pill--muted {
  background: #f3f4f6;
  color: #9ca3af;
}

/* =====================================================================
   ROW LIST (timeline, transactions, notifications)
   ===================================================================== */
.portal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--portal-border-soft);
}

.portal-row:last-child {
  border-bottom: none;
}

.portal-row__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--portal-border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--portal-text-dim);
  flex-shrink: 0;
}

.portal-row__body {
  flex: 1;
  min-width: 0;
}

.portal-row__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--portal-text);
  margin: 0;
}

.portal-row__sub {
  font-size: 12px;
  color: var(--portal-text-muted);
  margin: 2px 0 0;
}

.portal-row__meta {
  text-align: right;
  flex-shrink: 0;
}

.portal-row__amount {
  font-size: 13px;
  font-weight: 500;
  color: var(--portal-text);
  margin: 0;
}

.portal-row__time {
  font-size: 11px;
  color: var(--portal-text-faint);
  margin: 2px 0 0;
}

.portal-row.is-unread {
  position: relative;
}

.portal-row.is-unread::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--portal-violet);
}

/* =====================================================================
   KEY/VALUE LIST (this-month, profile fields)
   ===================================================================== */
.portal-kv {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-kv__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portal-kv__label {
  font-size: 13px;
  color: var(--portal-text-dim);
}

.portal-kv__value {
  font-size: 13px;
  font-weight: 500;
  color: var(--portal-text);
  text-align: right;
}

.portal-kv__divider {
  height: 1px;
  background: var(--portal-border-soft);
  margin: 4px 0;
}

/* =====================================================================
   ACTION LIST (quick actions buttons)
   ===================================================================== */
.portal-action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.portal-shell .portal-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--portal-radius-pill);
  font-size: 13px;
  font-weight: 500;
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  color: var(--portal-text-dim);
  transition:
    border-color 0.12s ease,
    background 0.12s ease;
}

.portal-shell .portal-action:hover {
  border-color: var(--portal-text-dim);
  background: #f9fafb;
}

.portal-shell .portal-action--primary {
  background: var(--portal-text);
  color: #ffffff;
  border-color: var(--portal-text);
}

.portal-shell .portal-action--primary:hover {
  background: #000000;
}

/* =====================================================================
   PROFILE FORM
   ===================================================================== */
.portal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.portal-field + .portal-field {
  margin-top: 16px;
}

.portal-field__label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--portal-text);
}

.portal-field__input,
.portal-field__readonly {
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--portal-border);
  background: var(--portal-surface);
  font-size: 14px;
  font-family: inherit;
  color: var(--portal-text);
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.portal-field__input:focus {
  outline: none;
  border-color: var(--portal-violet);
  box-shadow: 0 0 0 3px var(--portal-violet-soft);
}

.portal-field__readonly {
  background: var(--portal-border-soft);
  color: var(--portal-text-dim);
}

.portal-field__hint {
  font-size: 11.5px;
  color: var(--portal-text-muted);
}

/* =====================================================================
   MOBILE — hide sidebar, stack everything
   ===================================================================== */
@media (max-width: 960px) {
  .portal-sidebar {
    display: none;
  }
  .portal-layout {
    margin-left: 0;
  }
  .portal-topbar {
    padding: 0 16px;
  }
  .portal-main {
    padding: 0 16px 32px;
  }
  .portal-grid--2,
  .portal-grid--3,
  .portal-grid--4,
  .portal-grid--main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .portal-card,
  .portal-summary-card {
    padding: 18px;
  }
}

/* =====================================================================
   PORTAL BUNDLE 2 ADDITIONS
   ===================================================================== */

/* KPI tile — slimmer than .portal-summary-card. Used by My Money. */
.portal-shell .portal-tile {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border-soft);
  border-radius: var(--portal-radius);
  padding: 16px 18px;
}

.portal-shell .portal-tile__label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--portal-text-muted);
  margin: 0;
}

.portal-shell .portal-tile__value {
  font-size: 18px;
  font-weight: 600;
  color: var(--portal-text);
  margin: 6px 0 0;
}

.portal-shell .portal-tile__delta {
  font-size: 11.5px;
  color: var(--portal-text-muted);
  margin: 4px 0 0;
}

/* Capability card — large card with icon + title + summary + CTA arrow. */
.portal-shell .portal-capability {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--portal-surface);
  border: 1px solid var(--portal-border-soft);
  border-radius: var(--portal-radius);
  padding: 20px 24px;
  text-decoration: none;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    transform 0.12s ease;
}

.portal-shell .portal-capability:hover {
  border-color: var(--portal-text-dim);
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.06);
  transform: translateY(-1px);
}

.portal-shell .portal-capability__icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--portal-violet-soft);
  color: var(--portal-violet);
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-shell .portal-capability__body {
  flex: 1;
  min-width: 0;
}

.portal-shell .portal-capability__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--portal-text);
  margin: 0;
}

.portal-shell .portal-capability__sub {
  font-size: 12.5px;
  color: var(--portal-text-dim);
  margin: 3px 0 0;
}

.portal-shell .portal-capability__arrow {
  flex-shrink: 0;
  color: var(--portal-text-muted);
}

/* Toggle switch (Settings page) — pure CSS, no JS needed for the visual. */
.portal-shell .portal-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--portal-border-soft);
}

.portal-shell .portal-toggle:last-child {
  border-bottom: none;
}

.portal-shell .portal-toggle__meta {
  flex: 1;
  min-width: 0;
}

.portal-shell .portal-toggle__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--portal-text);
  margin: 0;
}

.portal-shell .portal-toggle__sub {
  font-size: 12px;
  color: var(--portal-text-muted);
  margin: 3px 0 0;
}

.portal-shell .portal-toggle__switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  background: #d1d5db;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.portal-shell .portal-toggle__switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  transition: transform 0.15s ease;
}

.portal-shell .portal-toggle__switch.is-on {
  background: var(--portal-violet);
}

.portal-shell .portal-toggle__switch.is-on::after {
  transform: translateX(16px);
}

/* FAQ accordion (Help page) — uses native <details>/<summary>. */
.portal-shell .portal-faq {
  border-top: 1px solid var(--portal-border-soft);
}

.portal-shell .portal-faq__item {
  border-bottom: 1px solid var(--portal-border-soft);
  padding: 14px 0;
}

.portal-shell .portal-faq__item[open] .portal-faq__chevron {
  transform: rotate(180deg);
}

.portal-shell .portal-faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--portal-text);
}

.portal-shell .portal-faq__q::-webkit-details-marker {
  display: none;
}

.portal-shell .portal-faq__chevron {
  flex-shrink: 0;
  color: var(--portal-text-muted);
  transition: transform 0.15s ease;
}

.portal-shell .portal-faq__a {
  font-size: 13px;
  color: var(--portal-text-dim);
  margin: 10px 0 4px;
  line-height: 1.55;
}

/* Status pill — full-tile variant (Help page system status). */
.portal-shell .portal-status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(22, 163, 74, 0.06);
  border: 1px solid rgba(22, 163, 74, 0.18);
  border-radius: var(--portal-radius);
  padding: 16px 20px;
}

.portal-shell .portal-status-card__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--portal-success);
  flex-shrink: 0;
}

.portal-shell .portal-status-card__title {
  font-size: 13.5px;
  font-weight: 500;
  color: #166534;
  margin: 0;
}

.portal-shell .portal-status-card__sub {
  font-size: 12px;
  color: #16a34a;
  margin: 2px 0 0;
}

/* =====================================================================
   PORTAL BUNDLE 3 ADDITIONS
   ===================================================================== */

/* Tabs — horizontal filter chips (Transactions page). */
.portal-shell .portal-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.portal-shell .portal-tab {
  padding: 6px 14px;
  border-radius: var(--portal-radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  color: var(--portal-text-dim);
  transition:
    border-color 0.12s ease,
    background 0.12s ease,
    color 0.12s ease;
}

.portal-shell .portal-tab.is-active {
  background: var(--portal-text);
  color: #ffffff;
  border-color: var(--portal-text);
}

/* Tier ladder — bronze / silver / gold for Credit Readiness. */
.portal-shell .portal-tier-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.portal-shell .portal-tier {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border-soft);
  border-radius: var(--portal-radius);
  padding: 14px 16px;
}

.portal-shell .portal-tier.is-current {
  background: var(--portal-violet-soft);
  border-color: var(--portal-violet);
}

.portal-shell .portal-tier__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--portal-text-muted);
  margin: 0;
}

.portal-shell .portal-tier.is-current .portal-tier__label {
  color: var(--portal-violet);
}

.portal-shell .portal-tier__sub {
  font-size: 12px;
  color: var(--portal-text-dim);
  margin: 6px 0 0;
}

@media (max-width: 720px) {
  .portal-shell .portal-tier-row {
    grid-template-columns: 1fr;
  }
}

/* =====================================================================
   EMPTY STATE — platform rule 2026-06 (no fabricated financial data).
   Used wherever a list, KPI block, or section has no real data yet.
   See docs/phase-07/platform-rule-no-fabricated-financial-data.md.
   ===================================================================== */
.portal-shell .portal-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 36px 24px;
  text-align: center;
}

.portal-shell .portal-empty__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--portal-text);
  margin: 0;
}

.portal-shell .portal-empty__sub {
  font-size: 12.5px;
  color: var(--portal-text-muted);
  margin: 4px 0 0;
  max-width: 360px;
}

.portal-shell .portal-empty--small {
  padding: 18px 16px;
}

/* =====================================================================
   STEPPER (Bundle 4 — Registration Progress)
   ===================================================================== */
.portal-shell .portal-stepper {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.portal-shell .portal-step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  position: relative;
}

.portal-shell .portal-step + .portal-step::before {
  content: '';
  position: absolute;
  left: 17px;
  top: -8px;
  bottom: calc(100% - 24px);
  width: 1px;
  background: var(--portal-border);
}

.portal-shell .portal-step__marker {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--portal-border-soft);
  border: 1px solid var(--portal-border);
  color: var(--portal-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.portal-shell .portal-step.is-done .portal-step__marker {
  background: var(--portal-success);
  border-color: var(--portal-success);
  color: #ffffff;
}

.portal-shell .portal-step.is-current .portal-step__marker {
  background: var(--portal-violet);
  border-color: var(--portal-violet);
  color: #ffffff;
}

.portal-shell .portal-step__body {
  flex: 1;
  min-width: 0;
  padding-top: 6px;
}

.portal-shell .portal-step__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--portal-text);
  margin: 0;
}

.portal-shell .portal-step__sub {
  font-size: 12.5px;
  color: var(--portal-text-muted);
  margin: 3px 0 0;
}

.portal-shell .portal-step.is-current .portal-step__title {
  color: var(--portal-violet);
}

.portal-shell .portal-step__action {
  margin-top: 10px;
  display: inline-flex;
}

/* Upload drop zone (Bundle 4 — Document Upload) */
.portal-shell .portal-upload {
  border: 2px dashed var(--portal-border);
  border-radius: var(--portal-radius);
  padding: 40px 24px;
  text-align: center;
  background: var(--portal-bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.portal-shell .portal-upload:hover {
  border-color: var(--portal-violet);
  background: var(--portal-violet-soft);
}

.portal-shell .portal-upload__icon {
  color: var(--portal-text-muted);
  margin: 0 auto 12px;
  display: block;
}

.portal-shell .portal-upload__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--portal-text);
  margin: 0;
}

.portal-shell .portal-upload__sub {
  font-size: 12.5px;
  color: var(--portal-text-muted);
  margin: 6px 0 0;
}

/* =====================================================================
   RECEIPT (Bundle 5 — Contribution Receipt printable layout)
   ===================================================================== */
.portal-shell .portal-receipt {
  max-width: 640px;
  margin: 0 auto;
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius);
  padding: 36px 40px;
}

.portal-shell .portal-receipt__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--portal-border-soft);
}

.portal-shell .portal-receipt__brand {
  font-family: 'Inter Tight', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--portal-text);
}

.portal-shell .portal-receipt__meta {
  text-align: right;
  font-size: 11.5px;
  color: var(--portal-text-muted);
  line-height: 1.6;
}

.portal-shell .portal-receipt__title {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--portal-text-muted);
  margin: 24px 0 8px;
}

.portal-shell .portal-receipt__amount {
  font-size: 28px;
  font-weight: 600;
  color: var(--portal-text);
  margin: 0;
}

.portal-shell .portal-receipt__line {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--portal-border-soft);
  font-size: 13px;
}

.portal-shell .portal-receipt__line:last-child {
  border-bottom: none;
  font-weight: 600;
}

.portal-shell .portal-receipt__line-label {
  color: var(--portal-text-dim);
}

.portal-shell .portal-receipt__line-value {
  color: var(--portal-text);
  font-variant-numeric: tabular-nums;
}

.portal-shell .portal-receipt__footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--portal-border-soft);
  font-size: 11px;
  color: var(--portal-text-muted);
  text-align: center;
  line-height: 1.5;
}

/* =====================================================================
   RESULT VARIANTS (Bundle 5 — Payment Result icon badges)
   ===================================================================== */
.portal-shell .portal-result-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.portal-shell .portal-result-icon--success {
  background: rgba(22, 163, 74, 0.12);
  color: var(--portal-success);
}

.portal-shell .portal-result-icon--danger {
  background: rgba(220, 38, 38, 0.12);
  color: var(--portal-danger);
}

.portal-shell .portal-result-icon--warn {
  background: rgba(202, 138, 4, 0.12);
  color: var(--portal-warn);
}

/* =====================================================================
   OBLIGATION CARD (Bundle 6 — Obligation summary block)
   ===================================================================== */
.portal-shell .portal-obligation-card {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius);
  padding: 24px 26px;
}

.portal-shell .portal-obligation-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.portal-shell .portal-obligation-card__kind {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 4px;
}

.portal-shell .portal-obligation-card__amount {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  letter-spacing: -0.01em;
}

.portal-shell .portal-obligation-card__sub {
  font-size: 13px;
  color: #6b7280;
  margin: 6px 0 0;
}

/* Progress bar (Bundle 6) */
.portal-shell .portal-progress-bar {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0 8px;
}

.portal-shell .portal-progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--portal-accent), #8b5cf6);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.portal-shell .portal-progress-bar__label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

/* Deadline countdown (Bundle 6 — Capital 6mo) */
.portal-shell .portal-deadline-countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.08);
  color: var(--portal-success);
}

.portal-shell .portal-deadline-countdown--warn {
  background: rgba(202, 138, 4, 0.08);
  color: var(--portal-warn);
}

.portal-shell .portal-deadline-countdown--danger {
  background: rgba(220, 38, 38, 0.08);
  color: var(--portal-danger);
}

/* =====================================================================
   CADENCE GRID (Bundle 6 — payment-plan cadence picker)
   ===================================================================== */
.portal-shell .portal-cadence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.portal-shell .portal-cadence-tile {
  border: 1.5px solid var(--portal-border);
  border-radius: 12px;
  padding: 16px 18px;
  background: var(--portal-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.portal-shell .portal-cadence-tile:hover {
  border-color: var(--portal-accent);
  background: #faf5ff;
}

.portal-shell .portal-cadence-tile.is-selected {
  border-color: var(--portal-accent);
  background: linear-gradient(180deg, #faf5ff 0%, #f3eaff 100%);
  box-shadow: 0 0 0 3px rgba(105, 62, 254, 0.08);
}

.portal-shell .portal-cadence-tile__label {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.portal-shell .portal-cadence-tile__installment {
  font-size: 16px;
  font-weight: 700;
  color: var(--portal-accent);
  margin: 0;
  letter-spacing: -0.01em;
}

.portal-shell .portal-cadence-tile__meta {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
}

.portal-shell .portal-cadence-tile__check {
  position: absolute;
  top: 12px;
  right: 12px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.portal-shell .portal-cadence-tile.is-selected .portal-cadence-tile__check {
  opacity: 1;
}

/* =====================================================================
   PLAN SWITCH COMPARE (Bundle 6 — cadence switch confirmation)
   ===================================================================== */
.portal-shell .portal-plan-compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: stretch;
  margin-top: 14px;
}

.portal-shell .portal-plan-compare__arrow {
  align-self: center;
  color: #9ca3af;
  font-size: 22px;
}

.portal-shell .portal-plan-compare__card {
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--portal-surface);
}

.portal-shell .portal-plan-compare__card--new {
  border-color: var(--portal-accent);
  background: #faf5ff;
}

.portal-shell .portal-plan-compare__role {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.5px;
  margin: 0 0 6px;
}

.portal-shell .portal-plan-compare__cadence {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px;
}

.portal-shell .portal-plan-compare__installment {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

@media (max-width: 720px) {
  .portal-shell .portal-plan-compare {
    grid-template-columns: 1fr;
  }
  .portal-shell .portal-plan-compare__arrow {
    transform: rotate(90deg);
    justify-self: center;
  }
  .portal-shell .portal-obligation-card__amount { font-size: 24px; }
  .portal-shell .portal-cadence-grid { grid-template-columns: 1fr; }
}
