/* ==========================================================================
   Client portal - header and nav
   Deliberately distinct from both the marketing site's header and admin's
   dark navy one - a lighter, warmer treatment since this serves paying
   customers managing their own account, not internal staff. Same reuse of
   existing brand tokens as admin.css for consistency.
   ========================================================================== */

.portal-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
}

.portal-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.portal-wordmark {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-navy);
  text-decoration: none;
}

/* Sprint DD10. The checkbox that drives the pure-CSS mobile menu, and the
   hamburger button (a label for it). Both are hidden on desktop, where the
   nav is always a horizontal row. */
.portal-nav-toggle-checkbox {
  display: none;
}

.portal-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  cursor: pointer;
  border-radius: var(--radius-md);
}

.portal-nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-navy);
  border-radius: 2px;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.portal-nav-toggle:hover {
  background: var(--color-surface);
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1;
}

.portal-nav-link {
  color: var(--color-ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.portal-nav-link:hover {
  color: var(--color-primary-dark);
}

/* Logout is an action, not a nav destination - a subtle divider sets it
   apart from the link cluster on desktop. */
.portal-nav-logout-form {
  margin: 0;
  padding: 0 0 0 var(--space-3);
  border-left: 1px solid var(--color-border);
}

.portal-nav-logout {
  color: var(--color-primary-dark);
  font-weight: 600;
}

/* Sprint DD10. Mobile: below 720px the horizontal row is genuinely
   cramped (8 items), so it collapses behind the hamburger. The nav
   becomes a full-width stacked panel that the checkbox reveals, and the
   hamburger animates to an X when open. Desktop is untouched. */
@media (max-width: 720px) {
  .portal-header-inner {
    flex-wrap: nowrap;
  }

  .portal-nav-toggle {
    display: flex;
  }

  .portal-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    padding: var(--space-2) 0;
    /* Above the impersonation banner (z-index 100). When an admin impersonates
       a client, that gold banner sits directly below the header; without this
       the open mobile menu would be sliced across by it. */
    z-index: 200;
  }

  .portal-header {
    position: relative;
  }

  .portal-nav-toggle-checkbox:checked ~ .portal-nav {
    display: flex;
  }

  .portal-nav-toggle-checkbox:checked ~ .portal-nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .portal-nav-toggle-checkbox:checked ~ .portal-nav-toggle span:nth-child(2) {
    opacity: 0;
  }

  .portal-nav-toggle-checkbox:checked ~ .portal-nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .portal-nav-link {
    display: block;
    padding: var(--space-3) var(--space-4);
    font-size: 1rem;
    width: 100%;
    text-align: left;
  }

  .portal-nav-link:hover {
    background: var(--color-surface);
  }

  .portal-nav-logout-form {
    padding: var(--space-2) 0 0 0;
    margin-top: var(--space-2);
    border-left: none;
    border-top: 1px solid var(--color-border);
  }

  .portal-nav-logout {
    padding: var(--space-3) var(--space-4);
  }
}

/* Sprint PP1 (revised). Navigation information architecture. Primary links sit
   in a row after the wordmark; the Account menu is pinned to the right and is a
   native <details> disclosure, styled as a dropdown on desktop and an inline
   group on mobile, progressively enhanced by /js/portal-nav.js. All colours and
   spacing come from the token system. */
.portal-nav-primary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.portal-nav-primary .portal-nav-link {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.portal-nav-primary .portal-nav-link:hover {
  background: var(--color-surface);
}

/* Active primary link: emphasised and underlined with an inset box-shadow so
   nothing in the row shifts when it becomes active. */
.portal-nav-primary .portal-nav-link.is-active {
  color: var(--color-primary-dark);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--color-primary);
}

/* Account menu is pinned to the right edge of the nav. */
.portal-nav-account {
  position: relative;
  margin-left: auto;
}

/* The summary is a pill-shaped trigger: avatar glyph, label, caret. The native
   disclosure triangle is stripped. */
.portal-nav-account-summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-white);
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.portal-nav-account-summary::-webkit-details-marker {
  display: none;
}

.portal-nav-account-summary:hover {
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.portal-nav-account[open] .portal-nav-account-summary {
  border-color: var(--color-primary);
}

/* Active (on an account subpage): the trigger is highlighted, but the menu is
   NOT auto-opened. */
.portal-nav-account-summary.is-active {
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
  font-weight: 700;
}

.portal-nav-account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-navy);
  color: var(--color-white);
}

.portal-nav-account-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.15s ease;
}

.portal-nav-account[open] .portal-nav-account-caret {
  transform: rotate(180deg);
}

/* Desktop dropdown: floats below the trigger, right-aligned. Shown or hidden by
   the browser off the open attribute; JS only adds outside-click / Escape
   closing on top of that. */
.portal-nav-account-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) 0;
  /* Above the impersonation banner (z-index 100), which sits directly below the
     header when an admin is viewing as a client; otherwise the banner paints
     across the top of this dropdown. */
  z-index: 200;
}

.portal-nav-account-menu .portal-nav-link {
  display: block;
  padding: var(--space-2) var(--space-4);
  width: 100%;
  text-align: left;
  border-radius: 0;
}

.portal-nav-account-menu .portal-nav-link:hover {
  background: var(--color-surface);
}

.portal-nav-account-menu .portal-nav-link.is-active {
  color: var(--color-primary-dark);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.portal-nav-account-menu .portal-nav-logout-form {
  padding: var(--space-2) 0 0 0;
  margin-top: var(--space-1);
  border-left: none;
  border-top: 1px solid var(--color-border);
}

.portal-nav-account-menu .portal-nav-logout {
  padding: var(--space-2) var(--space-4);
  color: var(--color-primary-dark);
  font-weight: 600;
}

/* Mobile: the whole nav collapses behind the hamburger into a stacked panel.
   Primary links become a vertical list; the Account group flows inline as an
   indented section rather than a floating dropdown. */
@media (max-width: 720px) {
  .portal-nav-primary {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }

  .portal-nav-primary .portal-nav-link {
    padding: var(--space-3) var(--space-4);
    border-radius: 0;
  }

  .portal-nav-account {
    width: 100%;
    margin-left: 0;
    border-top: 1px solid var(--color-border);
  }

  .portal-nav-account-summary {
    display: flex;
    justify-content: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: 1rem;
    border: none;
    border-radius: 0;
    background: transparent;
  }

  .portal-nav-account-summary .portal-nav-account-caret {
    margin-left: auto;
  }

  .portal-nav-account-menu {
    position: static;
    min-width: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background: var(--color-surface);
  }

  .portal-nav-account-menu .portal-nav-link {
    padding: var(--space-3) var(--space-4) var(--space-3) var(--space-6);
  }

  .portal-nav-primary .portal-nav-link.is-active {
    box-shadow: inset 3px 0 0 var(--color-primary);
    background: var(--color-surface);
  }
}

.portal-main {
  min-height: 60vh;
}

/* OTP entry - 6 individual digit boxes, JS-managed. See views/auth/verify.ejs
   for the fallback behavior when JavaScript is unavailable. */
.otp-boxes-wrapper {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.otp-box {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
}

.otp-box:focus {
  outline: none;
  border-color: var(--color-primary);
  border-width: 2px;
}

/* Fixes a real, confirmed overflow at this project's own 375px minimum
   test width (03-tech-stack.md): 6 boxes at 48px + 5 gaps at 8px need
   328px, but only 327px is available inside .container's padding at
   375px viewport width - a genuine 1px overflow on the site's single
   most critical auth flow, not a hypothetical concern. 44px is also the
   standard minimum recommended touch-target size, so this isn't just a
   shrink to make it fit - it's a deliberate, still-usable size. */
@media (max-width: 400px) {
  .otp-box {
    width: 44px;
    height: 52px;
    font-size: 1.25rem;
  }
  .otp-boxes-wrapper {
    gap: 6px;
  }
}

/* ==========================================================================
   Account summary card - tier badge and renewal context. .tier-badge
   (below) is deliberately kept separate from the shared .status-badge in
   app-tables.css (Sprint D3) - tier is a persistent plan classification,
   not a changing state the way an order or incident status is, and it
   carries deliberately larger/bolder sizing to stand out as the first
   thing shown in this card. Not scope creep to leave as-is; scope creep
   would have been forcing it into the status-badge shape to look "more
   consistent" without a real reason to.
   ========================================================================== */

.tier-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.tier-basic {
  background: var(--color-sky-tint);
  color: var(--color-primary-dark);
}
.tier-enhanced {
  background: var(--color-warning-tint);
  color: var(--color-warning);
}
/* Sprint DD14. A lead with no plan yet - a neutral, non-plan-coloured badge
   that reads as "pending a choice", not as a third product tier. */
.tier-none {
  background: var(--color-border);
  color: var(--color-ink);
}

.portal-pending-notice {
  background: var(--color-sky-tint);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-top: var(--space-3);
}

/* Sprint DD15. Service catalog card - the add-on name/price on the left,
   the order button on the right, stacking on narrow screens. */
.portal-service-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.portal-service-info {
  flex: 1 1 60%;
  min-width: 0;
}
.portal-service-price {
  font-weight: 700;
  color: var(--color-navy);
  font-size: 1.15rem;
}
.portal-service-order-form {
  margin: 0;
  flex: 0 0 auto;
}

/* Sprint FF1. Communication-preferences checkbox rows - a checkbox and its
   label on one comfortable line, stacked with a little breathing room. */
.portal-checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  cursor: pointer;
}
.portal-checkbox-row input {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

/* ==========================================================================
   Receipt - official-document treatment. Uses only real data already
   available (company name/phone/website via the site global, client
   billing info, order details) - deliberately no GST number or company
   address, since neither exists anywhere in this project and fabricating
   either would violate the no-fabrication policy held everywhere else.
   ========================================================================== */

.receipt-letterhead {
  border-bottom: 2px solid var(--color-navy);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
}

.receipt-company-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--color-navy);
  margin: 0;
}

.receipt-company-meta {
  font-size: 0.85rem;
  color: var(--color-ink);
  margin: 4px 0 0;
}

.receipt-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.receipt-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-navy);
}

.receipt-number {
  font-size: 0.85rem;
  color: var(--color-ink);
  margin: 0 0 var(--space-4);
}

.receipt-columns {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.receipt-columns > div {
  flex: 1;
  min-width: 180px;
}

.receipt-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink);
  margin: 0 0 4px;
}

.receipt-value {
  margin: 0 0 2px;
  font-weight: 500;
}

.receipt-line-items {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-4);
}

.receipt-line-items th {
  text-align: left;
  font-size: 0.8rem;
  color: var(--color-ink);
  border-bottom: 1px solid var(--color-border);
  padding: 8px 0;
}

.receipt-line-items td {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.receipt-line-items tfoot td {
  border-bottom: none;
  border-top: 2px solid var(--color-navy);
  font-weight: 700;
  padding-top: 12px;
}

.receipt-thanks {
  font-size: 0.9rem;
  color: var(--color-ink);
  text-align: center;
  margin-top: var(--space-4);
}

/* ==========================================================================
   Sprint S1 - portal page header. Replaces the marketing site's
   .pricing-hero/.eyebrow/.hero-sub pattern every portal page borrowed
   directly, the exact same coupling Sprint O3 already fixed for the
   admin panel - never addressed here until now. Deliberately not a
   copy of admin-page-header's own left-aligned, dense layout - parity
   of quality, not identical design. A client checking their account
   isn't scanning a worklist; centered, generous, unhurried fits what
   this page actually is, the same "lighter, warmer treatment" this
   file's own header comment already established for .portal-header
   above, extended here to the page content below it.
   ========================================================================== */
.portal-page-header {
  text-align: center;
  padding: var(--space-6) var(--space-4) var(--space-4);
}
.portal-page-header-back {
  display: inline-block;
  margin-bottom: var(--space-3);
  font-size: 0.9rem;
  color: var(--color-ink);
}
.portal-page-header-subtitle {
  margin: var(--space-2) auto 0;
  max-width: 480px;
  color: var(--color-ink);
}

/* ==========================================================================
   Sprint S1 - portal utility classes, the same "named class for a
   repeated pattern" discipline Sprint O4 already established for the
   admin panel's own inline-style extraction, under a portal- prefix
   deliberately - Sprint O5 already established that admin and portal
   utility classes stay in their own separate namespaces rather than
   sharing one, since the two surfaces can evolve independently without
   a change to one silently affecting the other.
   ========================================================================== */
.portal-section-flush {
  padding-top: 0;
}
.portal-container-w720 {
  max-width: 720px;
}
.portal-container-w620 {
  max-width: 620px;
}
.portal-container-w420 {
  max-width: 420px;
}
.portal-table-w550 {
  min-width: 550px;
}
.portal-mb-4 {
  margin-bottom: var(--space-4);
}
.portal-mt-2 {
  margin-top: var(--space-2);
}
.portal-mt-3 {
  margin-top: var(--space-3);
}
.portal-mt-4 {
  margin-top: var(--space-4);
}
.portal-m-0 {
  margin: 0;
}
.portal-text-meta {
  font-size: 0.9rem;
  color: var(--color-ink);
}
.portal-text-danger {
  font-size: 0.9rem;
  color: var(--color-danger);
  font-weight: 600;
}
/* Sprint PP4. Coupon code entry reads as an uppercase code. This replaces an
   inline style="text-transform:uppercase" on the input so the dashboard markup
   carries no inline styling. */
.portal-coupon-input {
  text-transform: uppercase;
}
.portal-text-success {
  font-size: 0.9rem;
  color: var(--color-success);
  font-weight: 600;
}
.portal-table-numeric {
  text-align: right;
}
.portal-action-row {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

/* Referral stats row - a distinct, named component (stat value/label
   pair), not a generic font-size utility standing in for one, the same
   "a semantically distinct thing gets a real class, not a borrowed
   utility" discipline Sprint O4 already held for the admin panel. */
.portal-stats-row {
  display: flex;
  gap: var(--space-5);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}
.portal-stat-value {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-navy);
}
.portal-stat-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-ink);
}

/* Referral link field - its own named class, not a one-off inline
   style, since it's a genuinely distinct input treatment (monospace,
   full-width, read-only) not shared with any other field in this
   codebase. */
.portal-referral-link-field {
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-top: var(--space-3);
  font-family: monospace;
  font-size: 0.85rem;
}

/* The OTP page's noscript fallback input - its own class rather than an
   inline style, matching every other extraction in this file, even
   though it only ever renders when JavaScript is unavailable. */
.portal-otp-fallback-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  margin-top: var(--space-3);
}

/* ==========================================================================
   Sprint S3 - the client communication timeline. Visually mirrors the
   connected-line-and-marker structure Sprint Q2's own incident activity
   feed already proved out, itself mirroring .order-timeline from Sprint
   I1 before it - the third real use of this same proven pattern in this
   codebase, not a new one invented for a client-facing context. Under
   its own portal- prefixed class names regardless, matching this
   surface's own established namespace discipline.
   ========================================================================== */
.portal-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.portal-timeline-item {
  position: relative;
  padding-left: 32px;
  padding-bottom: var(--space-4);
}
.portal-timeline-item:last-child {
  padding-bottom: 0;
}
.portal-timeline-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--color-border);
  background: var(--color-white);
}
.portal-timeline-item::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}
.portal-timeline-item:last-child::after {
  display: none;
}
/* Payments and delivery get the primary brand color - the two kinds of
   entry a client is most likely looking for at a glance. Refunds get
   the same red already established for "needs attention" elsewhere in
   this project, not a color invented for this one context. */
.portal-timeline-item.is-payment::before,
.portal-timeline-item.is-delivered::before {
  border-color: var(--color-primary);
  background: var(--color-primary);
}
.portal-timeline-item.is-refunded::before {
  border-color: var(--color-danger);
  background: var(--color-danger);
}
.portal-timeline-date {
  font-size: 0.8rem;
  color: var(--color-ink);
  margin: 0 0 2px;
}
.portal-timeline-body {
  margin: 0;
}
.portal-timeline-receipt-link {
  font-size: 0.85rem;
  margin-top: 2px;
}

/* Sprint CC1. Deliberately the one, real color in this app's own
   design system reserved for "you are in a real, different mode right
   now" (--color-gold, already used nowhere else as a background) -
   not the same navy/blue every ordinary portal page already uses, so
   this state can never blend into looking like a normal visit. Sticky,
   not just top-of-page, so it stays visible through real scrolling on
   a genuinely long page (the timeline, for instance) - this sprint's
   own "persistent" requirement, made real, not just textual. */
.portal-impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-gold);
  color: var(--color-navy);
  padding: var(--space-3) var(--space-4);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}
.portal-impersonation-banner-form {
  display: inline;
}
.portal-impersonation-banner-exit {
  background: var(--color-navy);
  color: var(--color-white);
  border: none;
  border-radius: 4px;
  padding: 2px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.portal-impersonation-banner-exit:hover {
  background: var(--color-primary-dark);
}

/* Sprint HH2 - client-facing proposals. */
.portal-text-right {
  text-align: right;
}
.portal-proposal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}
.portal-proposal-title {
  font-weight: var(--font-weight-semibold);
}
.portal-proposal-amount {
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}
.portal-proposal-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
}
.portal-proposal-prompt {
  border-left: 3px solid var(--color-primary);
}

/* Sprint HH3 - shopping cart. */
.cart-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}
.cart-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}
.cart-line-name {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
}
.cart-line-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.cart-qty-input {
  width: 64px;
}
.cart-line-total {
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  min-width: 72px;
  text-align: right;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-3);
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-lg);
}
.btn-text-danger {
  background: none;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  padding: 0;
}

/* Sprint HH3 - visually-hidden label for the cart quantity field. */
.portal-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sprint II1 - client project progress view. */
.project-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-2);
}
.project-progress-label {
  font-weight: var(--font-weight-semibold);
}
.project-progress-figure {
  color: var(--color-text-meta);
  font-size: 0.9em;
}
.project-progress-track {
  width: 100%;
  height: 10px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.project-progress-fill {
  height: 100%;
  background: var(--color-success);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.project-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.project-task {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}
.project-task:last-child {
  border-bottom: none;
}
.project-task-marker {
  flex: 0 0 auto;
  width: 24px;
  text-align: center;
  font-weight: var(--font-weight-bold);
}
.project-task-done .project-task-marker {
  color: var(--color-success);
}
.project-task-title {
  flex: 1 1 auto;
}
.project-task-status {
  flex: 0 0 auto;
  font-size: 0.85em;
  color: var(--color-text-meta);
}
.project-task-done .project-task-title {
  color: var(--color-text-meta);
}

/* Sprint II2 - content collection form. */
.content-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-2);
}
.content-progress-label {
  font-weight: var(--font-weight-semibold);
}
.content-progress-figure {
  color: var(--color-text-meta);
  font-size: 0.9em;
}
.content-progress-track {
  width: 100%;
  height: 10px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.content-progress-fill {
  height: 100%;
  background: var(--color-success);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.content-section-title {
  font-size: var(--text-lg);
  margin-bottom: var(--space-3);
}
.content-required {
  color: var(--color-danger);
}
.content-file-list {
  margin: var(--space-2) 0 var(--space-3);
  padding-left: var(--space-4);
}
.content-form-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Sprint II3 - proof & approval. */
.proof-card {
  border-left: 3px solid var(--color-primary);
}
.proof-actions {
  margin-bottom: var(--space-3);
}
.proof-revisions summary {
  cursor: pointer;
  color: var(--color-text-meta);
  font-size: 0.95em;
}
.proof-history {
  list-style: none;
  margin: 0;
  padding: 0;
}
.proof-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}
.proof-history-item:last-child {
  border-bottom: none;
}
.proof-history-status {
  font-size: 0.85em;
  color: var(--color-text-meta);
}
.proof-status-approved {
  color: var(--color-success);
}

/* Sprint II4 - project files. */
.asset-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.asset-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}
.asset-item:last-child {
  border-bottom: none;
}
.asset-name {
  flex: 1 1 auto;
  word-break: break-word;
}
.asset-meta {
  flex: 0 0 auto;
  font-size: 0.85em;
  color: var(--color-text-meta);
}
.asset-download {
  flex: 0 0 auto;
  font-size: 0.9em;
}
.asset-upload-form {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
}

/* Sprint JJ1 - client ticket thread. */
.ticket-thread {
  margin-top: var(--space-3);
}
.ticket-message {
  padding: var(--space-3);
  border-radius: var(--radius-sm, 6px);
  margin-bottom: var(--space-3);
  background: var(--color-surface-alt);
}
.ticket-message-admin {
  background: var(--color-primary-subtle);
}
.ticket-message-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-1);
}
.ticket-message-body {
  white-space: pre-wrap;
}

/* Sprint JJ2 - CSAT rating prompt. */
.csat-prompt {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface-alt);
}
.csat-stars {
  display: flex;
  gap: var(--space-2);
}
.csat-star {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
}
.csat-star input {
  margin: 0;
}

/* Sprint JJ1b - ticket attachments. */
.ticket-attachments {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ticket-attachment {
  font-size: 0.9em;
}

/* Sprint OO1 - next-best-action hero. A single prioritized prompt at the top of
   the portal home, accented so it reads as the thing to look at first, with any
   secondary prompts as a compact list beneath it. */
.portal-nba-hero {
  background: var(--color-sky-tint);
  border-left: 4px solid var(--color-primary);
}
.portal-nba-heading {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}
.portal-nba-primary {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  color: var(--color-navy);
}
.portal-nba-secondary {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
}
.portal-nba-secondary li {
  margin: 0.25rem 0;
  color: var(--color-ink);
}

/* Sprint OO3 - unread-reply signals. A small count badge on the Support nav link,
   and a "New reply" badge on a ticket in the support list, both drawing the eye
   without shouting. */
.portal-nav-badge {
  display: inline-block;
  min-width: 1.2rem;
  padding: 0 0.35rem;
  margin-left: 0.15rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 0.75rem;
  font-weight: var(--font-weight-bold);
  text-align: center;
  line-height: 1.2rem;
}
.portal-unread-badge {
  background: var(--color-primary);
  color: var(--color-white);
}

/* ==========================================================================
   Sprint PP4. Dashboard hub layout.
   The Overview page was a single ~720px column of equal-weight cards stacked
   into a very long scroll, with no visual difference between an urgent money
   action and a calm informational panel. This gives the dashboard its own
   wider container so the informational cards can share a two-column grid, and
   a clear hierarchy from the hero down: what-to-do-next, then anything urgent,
   then account plus referral side by side, then history, then support.
   Presentation only; every conditional block is unchanged from before.
   ========================================================================== */
.portal-dashboard {
  max-width: 960px;
}

/* Urgent, time or money sensitive actions (a renewal to pay) carry a warm
   accent so they are visually distinct from the calm informational cards and
   cannot be missed in the scan. */
.portal-urgent-card {
  border-left: 4px solid var(--color-cta);
}
.portal-urgent-card > h3:first-child {
  margin-top: 0;
}

/* Two-column card grid on desktop; one column on narrow screens. align-items
   start so a taller card does not stretch its neighbour, and the grid gap owns
   the spacing so the cards inside drop their own bottom margin. */
.portal-dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: start;
  margin-bottom: var(--space-4);
}
.portal-dash-grid > .card {
  margin-bottom: 0;
  height: 100%;
}
@media (max-width: 720px) {
  .portal-dash-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Sprint PP5. Portal empty-state primitive (partials/portal-empty-state.ejs).
   The portal counterpart of the admin empty state: one consistent treatment
   for every "no X yet" list, so pages are consistent by construction instead
   of each hand-writing its own sentence and spacing. Portal-namespaced and
   token-only.
   ========================================================================== */
.portal-empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--color-ink);
}
.portal-empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-sky-tint);
  color: var(--color-primary-dark);
  margin-bottom: var(--space-3);
}
.portal-empty-state-icon svg {
  width: 24px;
  height: 24px;
}
.portal-empty-state-message {
  margin: 0 0 var(--space-4);
  font-size: 0.95rem;
}
/* When there is no action button, the message is the last child and should not
   carry a trailing margin. */
.portal-empty-state-message:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Sprint PP7. Portal table scroll wrapper. The portal's data tables carry a
   550px min-width, so on a narrow screen they overflow the page. Every portal
   table now sits in a card wrapped by this element, which scrolls the table
   horizontally within the card instead of pushing the whole layout sideways.
   This also retires the marketing-site .compare-wrap that the sessions page had
   borrowed, so the portal has one consistent table treatment.
   ========================================================================== */
.portal-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
