/* ==========================================================================
   Global Wealth Portal — responsive, self-contained design system
   --------------------------------------------------------------------------
   Isolation strategy:
   1. Every rule is nested under the #gw-portal-app ID. Native CSS nesting
      (`&`) implicitly prefixes every selector with `#gw-portal-app `, which
      out-specifies almost any theme rule written as bare tags/classes
      without an ID (e.g. `svg{}`, `.entry-content h1{}`, `input[type=file]{}`).
   2. A low-specificity `:where()` reset neutralizes common theme styling
      (headings, lists, links, form controls, svg) before our own,
      more-specific component rules re-apply the intended look.
   3. Every icon-bearing element gets an EXPLICIT width/height (with
      `!important` as a last line of defense against theme `!important`
      rules), so nothing can render at an unconstrained intrinsic size.
   4. The native file input is visually hidden and replaced with a custom
      trigger button, so theme-wide button/input styling can never reach it.
   ========================================================================== */

:root {
  --gw-gold: #caa55e;
  --gw-gold-light: #e8d5a8;
  --gw-gold-dark: #a88b4a;
  --gw-navy: #0a192f;
  --gw-dark: #0f172a;
  --gw-slate: #475569;
  --gw-muted: #64748b;
  --gw-border: #e2e8f0;
  --gw-bg: #f8fafc;
  --gw-bg-alt: #f1f5f9;
  --gw-white: #ffffff;
  --gw-gold-100: #f7f0e3;
  --gw-green: #059669;
  --gw-green-50: #ecfdf5;
  --gw-radius-lg: 14px;
  --gw-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --gw-radius: 10px;
  --gw-radius-sm: 8px;
  --gw-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --gw-shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.1);
  --gw-header-h: auto;
  --gw-font: "Inter", system-ui, -apple-system, sans-serif;
  --gw-serif: "Playfair Display", Georgia, serif;
  --gw-transition: 0.2s ease;
  --gw-icon-xs: 0.9rem;
  --gw-icon-sm: 1rem;
  --gw-icon-md: 1.125rem;
  --gw-icon-lg: 1.5rem;
}

@keyframes gw-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ==========================================================================
   Everything below is scoped inside #gw-portal-app via native CSS nesting.
   ========================================================================== */

#gw-portal-app {
  font-family: var(--gw-font);
  color: var(--gw-slate);
  background: var(--gw-bg-alt);
  line-height: 1.5;
  min-height: 100vh;
  isolation: isolate;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  display: flex;
  flex-direction: column;

  &,
  & *,
  & *::before,
  & *::after {
    box-sizing: border-box;
  }

  /* ── Defensive reset (zero-specificity, always overridable by our own rules) ── */

  & :where(h1, h2, h3, h4, h5, h6, p, ul, ol, li, figure, blockquote) {
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-weight: inherit;
    font-size: inherit;
    line-height: inherit;
    list-style: none;
  }

  & :where(a) {
    color: inherit;
    text-decoration: none;
    background: none;
  }

  & :where(button, input, select, textarea, label) {
    font-family: inherit;
    font-size: 1rem;
    color: inherit;
    background: none;
    border: none;
    border-radius: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    line-height: normal;
  }

  & :where(button) {
    cursor: pointer;
  }

  & :where(img) {
    max-width: 100%;
    display: block;
  }

  & svg {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    overflow: visible;
  }
}

/* ── App body shell ── */

#gw-portal-app {
  & .gw-portal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  /* Top bar */
  & .gw-portal-topbar {
    background: var(--gw-white);
    border-bottom: 1px solid var(--gw-border);
    padding: 0 clamp(1rem, 3vw, 1.5rem);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 200;
  }

  & .gw-portal-topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
  }

  & .gw-portal-logo {
    height: 32px !important;
    width: auto !important;
    max-width: 120px !important;
    object-fit: contain;
    flex-shrink: 0;
  }

  & .gw-portal-topbar-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gw-muted);
    padding-left: 0.875rem;
    border-left: 1px solid var(--gw-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  & .gw-portal-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
  }

  & .gw-portal-topbar-exit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius-sm);
    background: var(--gw-white);
    transition: background var(--gw-transition), border-color var(--gw-transition);
  }

  & .gw-portal-topbar-exit svg {
    width: 1rem !important;
    height: 1rem !important;
  }

  & .gw-portal-topbar-exit:hover {
    background: var(--gw-bg-alt);
    border-color: #cbd5e1;
  }

  /* Trust strip */
  & .gw-portal-trust {
    background: var(--gw-navy);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.75rem;
    padding: 0.5rem clamp(1rem, 3vw, 1.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
  }

  & .gw-portal-trust span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
  }

  & .gw-portal-trust svg {
    width: 14px !important;
    height: 14px !important;
    color: var(--gw-gold);
  }

  /* Layout: sidebar + content */
  & .gw-portal-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
  }

  /* Sidebar stepper */
  & .gw-portal-sidebar {
    background: var(--gw-white);
    border-right: 1px solid var(--gw-border);
    padding: 1.75rem 0;
    position: sticky;
    top: 64px;
    align-self: start;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }

  & .gw-portal-sidebar-progress {
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid var(--gw-bg);
    margin-bottom: 1rem;
  }

  & .gw-portal-sidebar-progress-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 0.5rem;
  }

  & .gw-portal-sidebar-progress-track {
    height: 4px;
    background: var(--gw-bg);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.35rem;
  }

  & .gw-portal-sidebar-progress-fill {
    height: 100%;
    width: 8%;
    background: linear-gradient(90deg, var(--gw-gold), var(--gw-gold-light));
    border-radius: 999px;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  & .gw-portal-sidebar-progress-text {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--gw-navy);
  }

  & .gw-portal-phase-group {
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
  }

  & .gw-portal-phase-label {
    font-size: 0.625rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
    padding: 0.5rem 0.75rem 0.35rem;
  }

  & .gw-portal-sidebar-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--gw-radius-sm);
    font-size: 0.8125rem;
    color: #94a3b8;
    line-height: 1.35;
  }

  & .gw-portal-sidebar-step.done {
    color: var(--gw-muted);
  }

  & .gw-portal-sidebar-step.active {
    background: var(--gw-gold-100);
    color: var(--gw-navy);
    font-weight: 600;
  }

  & .gw-portal-step-dot {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 999px;
    border: 2px solid var(--gw-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 800;
    margin-top: 1px;
    line-height: 1;
  }

  & .gw-portal-sidebar-step.done .gw-portal-step-dot {
    background: var(--gw-green-50);
    border-color: var(--gw-green);
    color: var(--gw-green);
  }

  & .gw-portal-sidebar-step.active .gw-portal-step-dot {
    background: var(--gw-navy);
    border-color: var(--gw-navy);
    color: var(--gw-white);
  }

  & .gw-portal-sidebar-help {
    margin: 1.5rem 1.25rem 0;
    padding: 1rem;
    background: var(--gw-bg);
    border-radius: var(--gw-radius);
    border: 1px solid var(--gw-border);
  }

  & .gw-portal-sidebar-help p {
    font-size: 0.75rem;
    color: var(--gw-muted);
    line-height: 1.5;
    margin: 0 0 0.5rem;
  }

  & .gw-portal-sidebar-help a {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gw-navy);
    text-decoration: none;
  }

  & .gw-portal-sidebar-help a:hover {
    text-decoration: underline;
  }

  & .gw-portal-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
  }

  /* ── Main content ── */

  & .gw-portal-main {
    flex: 1;
    width: 100%;
    max-width: none;
    padding: 2rem clamp(1.25rem, 3vw, 2.5rem) 2rem;
  }

  & .gw-portal-step {
    animation: gw-fade-in 0.35s ease;
  }

  /* Step header (replaces hero box) */
  & .gw-portal-step-header {
    margin-bottom: 2rem;
  }

  & .gw-portal-step-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gw-gold);
    background: var(--gw-gold-100);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.875rem;
  }

  & .gw-portal-step-title {
    font-family: var(--gw-serif);
    font-size: clamp(1.75rem, 3vw, 2.125rem);
    font-weight: 700;
    color: var(--gw-navy);
    line-height: 1.2;
    margin: 0 0 0.5rem;
  }

  & .gw-portal-step-subtitle {
    color: var(--gw-gold);
    font-weight: 600;
    font-size: clamp(0.9rem, 2vw, 1rem);
    margin: 0 0 0.35rem;
  }

  & .gw-portal-step-desc {
    font-size: 0.9375rem;
    color: var(--gw-muted);
    max-width: 36rem;
    line-height: 1.65;
    margin: 0;
  }

  /* ── Cards ── */

  & .gw-portal-card-grid {
    display: grid;
    gap: clamp(0.875rem, 2vw, 1.25rem);
    grid-template-columns: 1fr;
    margin: 0 0 0.5rem;
  }

  @media (min-width: 540px) {
    & .gw-portal-card-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (min-width: 900px) {
    & .gw-portal-card-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  & .gw-portal-card {
    background: var(--gw-white);
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius);
    padding: clamp(1rem, 2.5vw, 1.35rem);
    transition: transform var(--gw-transition), box-shadow var(--gw-transition), border-color var(--gw-transition);
    position: relative;
    overflow: hidden;
  }

  & .gw-portal-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gw-gold);
    opacity: 0;
    transition: opacity var(--gw-transition);
  }

  & .gw-portal-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--gw-shadow);
    border-color: var(--gw-gold-light);
  }

  & .gw-portal-card:hover::before {
    opacity: 1;
  }

  & .gw-portal-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
  }

  & .gw-portal-icon {
    width: 2.25rem !important;
    height: 2.25rem !important;
    min-width: 2.25rem;
    border-radius: var(--gw-radius-sm);
    background: #fffbeb;
    color: var(--gw-gold-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
  }

  & .gw-portal-icon svg {
    width: var(--gw-icon-md) !important;
    height: var(--gw-icon-md) !important;
  }

  & .gw-portal-card h4 {
    margin: 0;
    color: var(--gw-dark);
    font-size: clamp(0.875rem, 2vw, 0.975rem);
    font-weight: 700;
    line-height: 1.35;
  }

  & .gw-portal-card p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--gw-muted);
    line-height: 1.6;
  }

  /* ── Doc matrix (step 2) ── */

  & .gw-portal-doc-grid {
    display: grid;
    grid-template-columns: 1fr;
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius);
    overflow: hidden;
    background: var(--gw-white);
    box-shadow: var(--gw-shadow);
  }

  @media (min-width: 768px) {
    & .gw-portal-doc-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  & .gw-portal-doc-item {
    display: flex;
    gap: 0.875rem;
    padding: clamp(1rem, 2.5vw, 1.35rem);
    border-bottom: 1px solid #f1f5f9;
  }

  @media (min-width: 768px) {
    & .gw-portal-doc-item {
      border-right: 1px solid #f1f5f9;
    }
    & .gw-portal-doc-item:nth-child(2n) {
      border-right: none;
    }
    & .gw-portal-doc-grid .gw-portal-doc-item:last-child,
    & .gw-portal-doc-grid .gw-portal-doc-item:nth-last-child(2):nth-child(odd) {
      border-bottom: none;
    }
  }

  & .gw-portal-doc-item.span-2 {
    grid-column: 1 / -1;
    border-right: none;
  }

  & .gw-portal-doc-item h5 {
    margin: 0 0 0.35rem;
    font-size: 0.925rem;
    color: var(--gw-dark);
    font-weight: 700;
  }

  & .gw-portal-doc-item p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--gw-muted);
  }

  /* ── Review steps ── */

  & .gw-portal-step-list {
    display: grid;
    gap: 0.75rem;
  }

  & .gw-portal-step-item {
    display: flex;
    gap: 1rem;
    padding: clamp(1rem, 2.5vw, 1.25rem);
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius);
    background: var(--gw-white);
    transition: box-shadow var(--gw-transition);
  }

  & .gw-portal-step-item:hover {
    box-shadow: var(--gw-shadow);
  }

  & .gw-portal-step-num {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: var(--gw-navy);
    color: var(--gw-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    flex-shrink: 0;
  }

  & .gw-portal-step-item h4 {
    margin: 0 0 0.35rem;
    color: var(--gw-dark);
    font-size: 1rem;
    font-weight: 700;
  }

  & .gw-portal-step-item p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--gw-muted);
  }

  /* ── Forms ── */

  & .gw-portal-form-panel {
    background: var(--gw-white);
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius-lg);
    padding: clamp(1.25rem, 3vw, 1.75rem);
    box-shadow: var(--gw-shadow-sm);
  }

  & .gw-portal-field {
    margin-bottom: 1.25rem;
  }

  & .gw-portal-field label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gw-dark);
    text-transform: none;
    letter-spacing: normal;
  }

  & .gw-portal-field label .req {
    color: #dc2626;
  }

  & .gw-portal-field input,
  & .gw-portal-field select,
  & .gw-portal-field textarea {
    width: 100% !important;
    padding: 0.875rem 1rem !important;
    border: 1.5px solid var(--gw-border) !important;
    border-radius: var(--gw-radius-sm) !important;
    font-size: 1rem !important;
    font-family: inherit !important;
    color: var(--gw-dark) !important;
    background: var(--gw-white) !important;
    transition: border-color var(--gw-transition), box-shadow var(--gw-transition);
    display: block;
    line-height: normal;
  }

  & .gw-portal-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.9rem center !important;
    background-size: 1rem !important;
    padding-right: 2.5rem !important;
  }

  & .gw-portal-field input::placeholder,
  & .gw-portal-field textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
  }

  & .gw-portal-field input:focus,
  & .gw-portal-field select:focus,
  & .gw-portal-field textarea:focus {
    outline: none !important;
    border-color: var(--gw-gold) !important;
    box-shadow: 0 0 0 3px rgba(202, 165, 94, 0.18) !important;
  }

  & .gw-portal-field textarea {
    min-height: 120px;
    resize: vertical;
  }

  & .gw-portal-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
  }

  & .gw-portal-phone-row,
  & .gw-portal-amount-row {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: minmax(7.5rem, 9.5rem) 1fr;
    align-items: stretch;
  }

  & .gw-portal-phone-row select,
  & .gw-portal-amount-row select {
    width: 100% !important;
    padding: 0.75rem 0.625rem !important;
    border: 1.5px solid var(--gw-border) !important;
    border-radius: var(--gw-radius-sm) !important;
    font-size: 0.875rem !important;
    font-family: inherit !important;
    color: var(--gw-dark) !important;
    background: var(--gw-white) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.5rem center !important;
    background-size: 0.875rem !important;
    padding-right: 1.75rem !important;
  }

  & .gw-portal-phone-row input,
  & .gw-portal-amount-row input {
    width: 100% !important;
    padding: 0.75rem 0.875rem !important;
    border: 1.5px solid var(--gw-border) !important;
    border-radius: var(--gw-radius-sm) !important;
    font-size: 0.9375rem !important;
    font-family: inherit !important;
    color: var(--gw-dark) !important;
    background: var(--gw-white) !important;
  }

  & .gw-portal-phone-row select:focus,
  & .gw-portal-amount-row select:focus,
  & .gw-portal-phone-row input:focus,
  & .gw-portal-amount-row input:focus {
    outline: none !important;
    border-color: var(--gw-gold) !important;
    box-shadow: 0 0 0 3px rgba(202, 165, 94, 0.18) !important;
  }

  & .gw-portal-field-hint {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0.35rem 0 0;
    line-height: 1.45;
  }

  @media (min-width: 640px) {
    & .gw-portal-row {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (max-width: 480px) {
    & .gw-portal-phone-row,
    & .gw-portal-amount-row {
      grid-template-columns: 1fr;
    }
  }

  /* ── Upload zones ── */

  & .gw-portal-upload-field {
    margin-bottom: 1.25rem;
  }

  & .gw-portal-upload {
    border: 2px dashed var(--gw-border);
    border-radius: var(--gw-radius);
    padding: clamp(1rem, 2.5vw, 1.35rem);
    background: var(--gw-bg);
    transition: border-color var(--gw-transition), background var(--gw-transition);
  }

  & .gw-portal-upload.is-dragover {
    border-color: var(--gw-gold);
    background: #fffdf8;
  }

  & .gw-portal-upload-top {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin-bottom: 0.9rem;
  }

  & .gw-portal-upload-icon {
    width: 2.5rem !important;
    height: 2.5rem !important;
    min-width: 2.5rem;
    border-radius: var(--gw-radius-sm);
    background: var(--gw-white);
    border: 1px solid var(--gw-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gw-gold-dark);
    flex-shrink: 0;
    overflow: hidden;
  }

  & .gw-portal-upload-icon svg {
    width: var(--gw-icon-lg) !important;
    height: var(--gw-icon-lg) !important;
  }

  & .gw-portal-upload-copy {
    min-width: 0;
  }

  & .gw-portal-upload-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gw-dark);
    margin: 0 0 0.2rem;
  }

  & .gw-portal-upload-hint {
    font-size: 0.78rem;
    color: var(--gw-muted);
    margin: 0;
  }

  /* Native file input — visually hidden but keyboard/screen-reader accessible.
     The visible control is the label styled as `.gw-portal-upload-trigger`. */
  & .gw-portal-upload-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  & .gw-portal-upload-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem !important;
    border-radius: var(--gw-radius-sm) !important;
    border: 1.5px solid var(--gw-border) !important;
    background: var(--gw-white) !important;
    color: var(--gw-dark) !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    line-height: normal !important;
    cursor: pointer !important;
    transition: border-color var(--gw-transition), background var(--gw-transition), color var(--gw-transition);
  }

  & .gw-portal-upload-trigger:hover {
    border-color: var(--gw-gold);
    background: #fffdf8;
  }

  & .gw-portal-upload-trigger svg {
    width: var(--gw-icon-sm) !important;
    height: var(--gw-icon-sm) !important;
    color: var(--gw-gold-dark);
  }

  & .gw-portal-upload-input:focus-visible + .gw-portal-upload-trigger {
    outline: 2px solid var(--gw-gold);
    outline-offset: 2px;
  }

  & .gw-portal-file-list {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  & .gw-portal-file-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--gw-white);
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius-sm);
    font-size: 0.8rem;
    color: var(--gw-dark);
    max-width: 100%;
  }

  & .gw-portal-file-chip svg {
    width: var(--gw-icon-xs) !important;
    height: var(--gw-icon-xs) !important;
    color: var(--gw-gold-dark);
  }

  & .gw-portal-file-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
  }

  & .gw-portal-file-chip .gw-portal-file-remove {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 1.25rem !important;
    height: 1.25rem !important;
    border-radius: 999px !important;
    background: var(--gw-bg-alt) !important;
    color: var(--gw-muted) !important;
    border: none !important;
    cursor: pointer !important;
    flex-shrink: 0;
    padding: 0 !important;
  }

  & .gw-portal-file-chip .gw-portal-file-remove svg {
    width: 0.65rem !important;
    height: 0.65rem !important;
  }

  & .gw-portal-file-chip .gw-portal-file-remove:hover {
    background: #fee2e2 !important;
    color: #dc2626 !important;
  }

  & .gw-portal-file-chip-server {
    background: var(--gw-gold-50, #fef9ec);
    border-color: var(--gw-gold-100, #f5e6c8);
  }

  & .gw-portal-file-chip-server::before {
    content: 'Saved';
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gw-gold-dark);
    flex-shrink: 0;
  }

  & .gw-portal-upload-error {
    color: #dc2626;
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 0.6rem;
    display: none;
  }

  /* ── Notes & NDA ── */

  & .gw-portal-note {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    padding: clamp(0.875rem, 2vw, 1.1rem);
    border-radius: var(--gw-radius-sm);
    margin: 1.25rem 0 0;
    font-size: 0.9rem;
  }

  & .gw-portal-note-blue {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-left-color: #3b82f6;
  }

  & .gw-portal-note svg {
    width: var(--gw-icon-md) !important;
    height: var(--gw-icon-md) !important;
    min-width: var(--gw-icon-md);
    flex-shrink: 0;
    margin-top: 0.1rem;
    color: #f59e0b;
  }

  & .gw-portal-note-blue svg {
    color: #3b82f6;
  }

  & .gw-portal-note strong {
    font-weight: 700;
    color: var(--gw-dark);
  }

  & .gw-portal-note-dark {
    background: linear-gradient(145deg, var(--gw-navy), #132f4c);
    color: #cbd5e1;
    border-radius: var(--gw-radius);
    padding: clamp(1.5rem, 3vw, 2rem);
    text-align: center;
    box-shadow: var(--gw-shadow-lg);
  }

  & .gw-portal-note-dark h3 {
    color: var(--gw-white);
    font-family: var(--gw-serif);
    margin: 0 0 0.75rem;
    font-size: clamp(1.15rem, 2.5vw, 1.4rem);
    font-weight: 700;
  }

  & .gw-portal-note-dark p {
    margin: 0 0 0.75rem;
    font-size: 0.925rem;
    line-height: 1.7;
  }

  & .gw-portal-nda-box {
    background: var(--gw-white);
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius);
    padding: clamp(1rem, 2.5vw, 1.5rem);
    max-height: min(360px, 50vh);
    overflow-y: auto;
    font-size: 0.9rem;
    margin: 1rem 0 0;
    box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.04);
    line-height: 1.7;
  }

  & .gw-portal-nda-box p {
    margin: 0 0 0.85rem;
  }

  & .gw-portal-nda-box strong {
    font-weight: 700;
    color: var(--gw-dark);
  }

  /* ── Signature ── */

  & .gw-portal-checkbox {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    margin: 0 0 1.5rem;
    padding: 1rem;
    background: var(--gw-bg);
    border-radius: var(--gw-radius-sm);
    border: 1px solid var(--gw-border);
    font-size: 0.9rem;
    line-height: 1.6;
    cursor: pointer;
  }

  & .gw-portal-checkbox input {
    width: 1.125rem !important;
    height: 1.125rem !important;
    min-width: 1.125rem;
    margin: 0.2rem 0 0 !important;
    accent-color: var(--gw-gold);
    flex-shrink: 0;
    -webkit-appearance: checkbox !important;
    appearance: checkbox !important;
  }

  & .gw-portal-signature-wrap {
    border: 1.5px solid var(--gw-border);
    border-radius: var(--gw-radius);
    background: var(--gw-bg);
    padding: 0.875rem;
  }

  & .gw-portal-signature-wrap canvas {
    width: 100% !important;
    height: clamp(140px, 28vw, 180px) !important;
    display: block;
    background: var(--gw-white);
    border-radius: var(--gw-radius-sm);
    cursor: crosshair;
    touch-action: none;
  }

  & .gw-portal-signature-label {
    font-size: 0.75rem;
    color: var(--gw-muted);
    margin-top: 0.5rem;
    text-align: center;
  }

  & .gw-portal-signature-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
  }

  /* ── Inline step navigation (avoids theme fixed bottom bars) ── */

  & .gw-portal-nav-bar {
    margin-top: 1.75rem;
    padding-top: 0;
    position: static;
    z-index: auto;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  & .gw-portal-nav-inner {
    max-width: none;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--gw-white);
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius-lg);
    box-shadow: var(--gw-shadow-sm);
    flex-wrap: wrap;
  }

  & .gw-portal-nav-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  & .gw-portal-save-status {
    font-size: 0.75rem;
    color: var(--gw-muted);
    margin-top: 0.35rem;
    min-height: 1.1em;
  }

  & .gw-portal-save-status.is-saving {
    color: var(--gw-gold-dark);
  }

  & .gw-portal-save-status.is-saved {
    color: #059669;
    font-weight: 600;
  }

  & .gw-portal-save-status.is-error {
    color: #dc2626;
    font-weight: 600;
  }

  & .gw-portal-banner {
    margin: 0 clamp(1.25rem, 3vw, 2.5rem) 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--gw-radius-sm);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  & .gw-portal-banner-draft {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
  }

  & .gw-portal-banner-erasure {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
  }

  & .gw-portal-gdpr-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gw-border);
    max-width: 28rem;
  }

  & .gw-portal-gdpr-footer p {
    font-size: 0.75rem;
    margin: 0 0 0.5rem;
  }

  & .gw-portal-gdpr-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
  }

  & .gw-portal-gdpr-form input {
    flex: 1;
    min-width: 10rem;
    padding: 0.5rem 0.75rem !important;
    border: 1px solid var(--gw-border) !important;
    border-radius: var(--gw-radius-sm) !important;
    font-size: 0.8125rem !important;
    background: var(--gw-white) !important;
  }

  & .gw-portal-gdpr-msg {
    font-size: 0.75rem;
    color: var(--gw-muted);
  }

  & .gw-portal-checkbox a {
    color: var(--gw-navy);
    text-decoration: underline;
  }

  & .gw-portal-nav-meta {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-align: center;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
  }

  & .gw-portal-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem !important;
    border-radius: var(--gw-radius-sm) !important;
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer !important;
    border: none;
    text-decoration: none;
    line-height: normal !important;
    transition: background var(--gw-transition), transform var(--gw-transition), box-shadow var(--gw-transition);
    white-space: nowrap;
  }

  & .gw-portal-btn svg {
    width: var(--gw-icon-sm) !important;
    height: var(--gw-icon-sm) !important;
  }

  & .gw-portal-btn-primary {
    background: var(--gw-navy) !important;
    color: var(--gw-white) !important;
    box-shadow: var(--gw-shadow);
  }

  & .gw-portal-btn-primary:hover:not(:disabled) {
    background: #122640 !important;
    transform: translateY(-1px);
  }

  & .gw-portal-btn-secondary {
    background: transparent !important;
    color: #334155 !important;
    border: 1px solid var(--gw-border) !important;
  }

  & .gw-portal-btn-secondary:hover:not(:disabled) {
    border-color: #cbd5e1 !important;
    background: var(--gw-bg-alt) !important;
  }

  & .gw-portal-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed !important;
    transform: none !important;
  }

  /* ── Footer ── */

  & .gw-portal-footer {
    padding: 1.5rem clamp(1.25rem, 3vw, 2.5rem) 2.5rem;
    text-align: left;
    background: transparent;
    color: #94a3b8;
  }

  & .gw-portal-footer h3 {
    margin: 0 0 0.25rem;
    font-family: var(--gw-serif);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--gw-navy);
  }

  & .gw-portal-footer p {
    margin: 0;
    color: #94a3b8;
    font-size: 0.75rem;
  }

  /* ── Loader ── */

  & .gw-portal-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }

  & .gw-portal-loader[hidden] {
    display: none !important;
  }

  & .gw-portal-loader-card {
    background: var(--gw-white);
    border-radius: var(--gw-radius);
    padding: 1.75rem 1.5rem 1.5rem;
    text-align: left;
    box-shadow: var(--gw-shadow-lg);
    border: 1px solid var(--gw-border);
    max-width: 420px;
    width: 100%;
  }

  & .gw-portal-loader-progress-wrap {
    margin-bottom: 1.25rem;
  }

  & .gw-portal-loader-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-family: var(--gw-font);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gw-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  & #gw-portal-loader-pct {
    color: var(--gw-gold-dark);
    font-size: 0.875rem;
    font-weight: 800;
    letter-spacing: 0.04em;
  }

  & .gw-portal-loader-progress-track {
    height: 8px;
    background: var(--gw-bg-alt);
    border-radius: 999px;
    overflow: hidden;
  }

  & .gw-portal-loader-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gw-gold-dark), var(--gw-gold));
    border-radius: 999px;
    transition: width 0.65s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
  }

  & .gw-portal-loader-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.35) 50%,
      transparent 100%
    );
    animation: gw-loader-shimmer 1.4s ease-in-out infinite;
  }

  @keyframes gw-loader-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
  }

  & .gw-portal-loader-text {
    font-weight: 800;
    color: var(--gw-dark);
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-family: var(--gw-font);
    text-align: center;
  }

  & .gw-portal-loader-sub {
    margin: 0 0 1.25rem;
    font-size: 0.8125rem;
    color: var(--gw-muted);
    font-family: var(--gw-font);
    text-align: center;
    line-height: 1.5;
  }

  & .gw-portal-loader-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  & .gw-portal-loader-steps li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-family: var(--gw-font);
    font-size: 0.8125rem;
    color: var(--gw-muted);
    transition: color 0.3s ease;
  }

  & .gw-portal-loader-step-icon {
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    border-radius: 999px;
    border: 2px solid var(--gw-border);
    background: var(--gw-white);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: border-color 0.3s ease, background 0.3s ease;
  }

  & .gw-portal-loader-steps li.active {
    color: var(--gw-dark);
    font-weight: 600;
  }

  & .gw-portal-loader-steps li.active .gw-portal-loader-step-icon {
    border-color: var(--gw-gold);
    background: #fffbeb;
  }

  & .gw-portal-loader-steps li.active .gw-portal-loader-step-icon::after {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--gw-gold);
    animation: gw-loader-pulse 1s ease-in-out infinite;
  }

  @keyframes gw-loader-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.85); }
  }

  & .gw-portal-loader-steps li.done {
    color: var(--gw-slate);
  }

  & .gw-portal-loader-steps li.done .gw-portal-loader-step-icon {
    border-color: #059669;
    background: #ecfdf5;
  }

  & .gw-portal-loader-steps li.done .gw-portal-loader-step-icon::after {
    content: "";
    width: 0.35rem;
    height: 0.6rem;
    border-right: 2px solid #059669;
    border-bottom: 2px solid #059669;
    transform: rotate(45deg) translate(-1px, -1px);
    border-radius: 0;
    animation: none;
  }

  & .gw-portal-loader.is-complete .gw-portal-loader-progress-fill::after {
    animation: none;
  }

  /* ── Success ── */

  & .gw-portal-success {
    max-width: 520px;
    margin: clamp(2rem, 5vw, 4rem) auto;
    padding: 0 clamp(1rem, 3vw, 1.75rem);
  }

  & .gw-portal-success[hidden] {
    display: none !important;
  }

  & .gw-portal-success-card {
    background: var(--gw-white);
    border-radius: var(--gw-radius);
    padding: clamp(2rem, 4vw, 2.75rem);
    text-align: center;
    box-shadow: var(--gw-shadow-lg);
    border: 1px solid var(--gw-border);
  }

  & .gw-portal-success-icon {
    width: 4rem !important;
    height: 4rem !important;
    min-width: 4rem;
    border-radius: 999px;
    background: #ecfdf5;
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    overflow: hidden;
  }

  & .gw-portal-success-icon svg {
    width: 1.75rem !important;
    height: 1.75rem !important;
  }

  & .gw-portal-success h2 {
    color: var(--gw-dark);
    font-family: var(--gw-serif);
    margin: 0 0 0.75rem;
    font-size: clamp(1.5rem, 3vw, 1.85rem);
    font-weight: 700;
  }

  & .gw-portal-success p {
    color: var(--gw-muted);
    margin: 0 0 0.75rem;
  }

  & .gw-portal-recording {
    font-family: ui-monospace, "SF Mono", monospace;
    color: var(--gw-gold-dark);
    font-weight: 700;
    font-size: 0.875rem;
    background: #fffbeb;
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 1.5rem !important;
  }

  /* ── Errors ── */

  & .gw-portal-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem 1.1rem;
    border-radius: var(--gw-radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
  }

  & .gw-portal-errors strong {
    font-weight: 800;
  }

  & .gw-portal-errors ul {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
    list-style: disc;
  }

  & .gw-portal-errors li {
    display: list-item;
  }

  /* ── Responsive layout ── */

  @media (max-width: 900px) {
    & .gw-portal-layout {
      grid-template-columns: 1fr;
    }

    & .gw-portal-sidebar {
      position: static;
      max-height: none;
      border-right: none;
      border-bottom: 1px solid var(--gw-border);
      padding: 1rem 0;
    }

    & .gw-portal-phase-group {
      display: none;
    }

    & .gw-portal-sidebar-help {
      display: none;
    }

    & .gw-portal-main {
      padding: 1.5rem 1.25rem 2rem;
    }

    & .gw-portal-topbar-title {
      display: none;
    }

    & .gw-portal-topbar-exit span {
      display: none;
    }

    & .gw-portal-nav-inner {
      flex-wrap: wrap;
    }

    & .gw-portal-nav-meta {
      order: -1;
      flex: 0 0 100%;
      padding-bottom: 0.25rem;
    }

    & .gw-portal-nav-inner .gw-portal-btn {
      flex: 1;
      min-width: 0;
    }
  }

  @media (min-width: 768px) {
    & .gw-portal-logo {
      height: 36px !important;
      max-width: 140px !important;
    }
  }

  @media (max-width: 480px) {
    & .gw-portal-trust {
      gap: 0.75rem;
      font-size: 0.6875rem;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    & .gw-portal-step,
    & .gw-portal-sidebar-progress-fill,
    & .gw-portal-card,
    & .gw-portal-btn,
    & .gw-portal-loader-progress-fill,
    & .gw-portal-loader-progress-fill::after,
    & .gw-portal-loader-steps li.active .gw-portal-loader-step-icon::after {
      animation: none !important;
      transition: none !important;
    }
  }
}
