/**
 * PSA Regional Portal (UK&I) — Master Specification Design System ('new' UI view)
 * Skinnable CSS Custom Properties initialized with PSA UK&I visual identity
 */

:root,
:root[data-ui-mode="new"] {
  /* Master Specification Color Tokens */
  --psa-primary: #0F172A;
  --psa-accent: #2563EB;
  --psa-bg-canvas: #F8FAFC;
  --psa-surface: #FFFFFF;
  --psa-success: #059669;
  --psa-warning: #D97706;
  --psa-danger: #DC2626;

  /* Derived Semantic Tokens */
  --psa-accent-hover: #1D4ED8;
  --psa-accent-soft: rgba(37, 99, 235, 0.08);
  --psa-border: #E2E8F0;
  --psa-border-strong: #CBD5E1;
  --psa-text-main: #0F172A;
  --psa-text-secondary: #334155;
  --psa-text-muted: #64748B;
  --psa-surface-subtle: #F1F5F9;

  /* Elevation & Multi-Layered Shadows */
  --psa-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --psa-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --psa-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --psa-shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.05);
  --psa-shadow-xl: 0 20px 32px -8px rgba(15, 23, 42, 0.16), 0 8px 16px -4px rgba(15, 23, 42, 0.08);

  /* Compatibility mappings for shared components & dialogs */
  --bg-main: var(--psa-bg-canvas);
  --bg-base: var(--psa-bg-canvas);
  --bg-surface: var(--psa-surface);
  --bg-surface-elevated: var(--psa-surface-subtle);
  --bg-surface-hover: #E2E8F0;
  --bg-glass: rgba(255, 255, 255, 0.94);
  --text-primary: var(--psa-text-main);
  --text-secondary: var(--psa-text-secondary);
  --text-muted: var(--psa-text-muted);
  --accent-gold: var(--psa-accent);
  --accent-gold-hover: var(--psa-accent-hover);
  --accent-gold-subtle: var(--psa-accent-soft);
  --border-subtle: var(--psa-border);
  --border-medium: var(--psa-border-strong);
  --border-focus: var(--psa-accent);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

body.new-ui-body {
  background: var(--psa-bg-canvas) !important;
  color: var(--psa-text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.new-ui-body .dialog-header {
  margin-bottom: 0;
}

body.new-ui-body .badge-synced {
  background: rgba(5, 150, 105, 0.14);
  color: var(--psa-success);
  border: 1px solid rgba(5, 150, 105, 0.3);
}

body.new-ui-body .badge-override {
  background: rgba(217, 119, 6, 0.14);
  color: var(--psa-warning);
  border: 1px solid rgba(217, 119, 6, 0.3);
}

/* ============================================================================
   A. GLOBAL HEADER & PERSISTENT MULTI-REGION SELECTOR
   ============================================================================ */
.new-ui-topbar {
  background: var(--psa-primary);
  color: #FFFFFF;
  border-top: 3px solid var(--psa-accent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.new-ui-topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.new-ui-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #FFFFFF;
}

.new-ui-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--psa-accent), #3B82F6);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: -0.03em;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.45);
  flex-shrink: 0;
}

.new-ui-brand-title {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  line-height: 1.2;
}

.new-ui-brand-subtitle {
  font-size: 0.72rem;
  color: #94A3B8;
  font-weight: 500;
  display: block;
}

/* Persistent Regional Switcher in Top Navigation Bar */
.psa-region-switcher-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 0.2rem 0.65rem;
  min-height: 44px;
}

.psa-region-switcher-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94A3B8;
  font-weight: 700;
  white-space: nowrap;
}

.psa-region-switcher-select {
  background: transparent;
  color: #FFFFFF;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.35rem 0.4rem;
  min-height: 38px;
  cursor: pointer;
  outline: none;
}

.psa-region-switcher-select option {
  background: var(--psa-primary);
  color: #FFFFFF;
}

.psa-mobile-region-btn {
  display: none;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  min-height: 44px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.new-ui-nav-links {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.new-ui-nav-link {
  color: #CBD5E1;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  transition: background 150ms ease, color 150ms ease;
}

.new-ui-nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.new-ui-nav-link.active {
  background: var(--psa-accent);
  color: #FFFFFF;
}

.new-ui-mode-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.new-ui-mode-pill a {
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: #CBD5E1;
  transition: all 140ms ease;
}

.new-ui-mode-pill a.active {
  background: var(--psa-accent);
  color: #FFFFFF;
}

.psa-session-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.25rem 0.65rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  min-height: 44px;
}

.psa-session-user {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.psa-session-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #FFFFFF;
}

.psa-session-role {
  font-size: 0.7rem;
  color: #93C5FD;
  font-weight: 600;
}

/* ============================================================================
   B. FRONT PAGE HUB & PROGRESSIVE DISCLOSURE TOOLBAR
   ============================================================================ */
.new-ui-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  /* Tightened from 1.5rem ... 3rem */
}

.new-ui-hero {
  background: var(--psa-surface);
  border: 1px solid var(--psa-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  /* Tightened from 1.25rem 1.5rem */
  box-shadow: var(--psa-shadow-sm);
  margin-bottom: 0.85rem;
  /* Tightened from 1.25rem */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.new-ui-hero-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--psa-primary);
  letter-spacing: -0.025em;
  margin: 0;
}

.new-ui-hero-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
  font-size: 0.84rem;
  color: var(--psa-text-muted);
}

.psa-venue-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--psa-surface-subtle);
  border: 1px solid var(--psa-border);
  color: var(--psa-text-secondary);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* KPI Summary Strip */
.new-ui-kpi-row {
  display: flex;
  align-items: stretch;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.new-ui-kpi {
  background: var(--psa-bg-canvas);
  border: 1px solid var(--psa-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  min-width: 128px;
}

.new-ui-kpi-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--psa-text-muted);
}

.new-ui-kpi-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--psa-primary);
  line-height: 1.2;
  margin-top: 0.15rem;
}

/* ============================================================================
   2. THE REGION OVERVIEW CARD (TOP OF DASHBOARD)
   ============================================================================ */
.psa-region-overview-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: auto;
  min-height: 0;
  gap: 0.85rem;
}

.psa-overview-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Fix the metrics grid so rows don't stretch to fill vertical space */
.psa-overview-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  align-content: start;
  align-items: start;
}

/* Ensure individual metric cards don't force minimum vertical height */
.psa-overview-metric-card {
  background: var(--psa-bg-canvas);
  border: 1px solid var(--psa-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  height: auto;
  align-self: start;
  /* Prevents the card from stretching in a grid container */
}

.psa-overview-metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--psa-text-muted);
}

.psa-overview-metric-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--psa-primary);
  line-height: 1.2;
}

.psa-overview-metric-sub {
  font-size: 0.74rem;
  color: var(--psa-text-muted);
}

/* Fix the logistics bar container to hug its content tightly */
.psa-overview-logistics-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  height: auto;
  align-items: start;
  padding-top: 0.85rem;
  border-top: 1px solid var(--psa-border);
}

.psa-logistics-item {
  background: var(--psa-surface-subtle);
  border: 1px solid var(--psa-border);
  border-radius: 10px;
  padding: 0.75rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: auto;
  /* Ensures the logistics containers shrink-wrap their contents */
}

.psa-logistics-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--psa-text-muted);
}

.psa-logistics-value {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--psa-primary);
  word-break: break-word;
}

.psa-logistics-note {
  font-size: 0.72rem;
  color: var(--psa-text-muted);
}

/* ============================================================================
   4. REGIONAL DASHBOARD WIDGETS (THE PRESIDENT'S COMMAND CENTER)
   ============================================================================ */
.psa-command-center-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  align-items: start;
  /* Prevents empty widget rows from stretching */
}

.psa-widget-card {
  background: var(--psa-surface);
  border: 1px solid var(--psa-border);
  border-radius: var(--radius-md);
  box-shadow: var(--psa-shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 235px;
}

.psa-widget-header {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--psa-border);
  background: var(--psa-bg-canvas);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.psa-widget-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--psa-primary);
  margin: 0;
}

.psa-widget-subtitle {
  font-size: 0.74rem;
  color: var(--psa-text-muted);
  margin: 0.15rem 0 0 0;
}

.psa-widget-body {
  padding: 0.75rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 250px;
  overflow-y: auto;
}

.psa-widget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--psa-border);
  border-radius: 8px;
  background: var(--psa-surface);
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease;
}

.psa-widget-row:hover {
  border-color: var(--psa-accent);
  background: var(--psa-bg-canvas);
}

.psa-widget-member-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--psa-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psa-widget-member-meta {
  font-size: 0.72rem;
  color: var(--psa-text-muted);
}

.psa-widget-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--psa-border);
  background: var(--psa-bg-canvas);
  text-decoration: none;
  font-size: 0.8rem;
}

.psa-widget-mini-btn:hover {
  border-color: var(--psa-accent);
  background: var(--psa-accent-soft);
}

.psa-widget-empty {
  padding: 1.5rem 0.75rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--psa-text-muted);
  margin: auto 0;
}

.psa-trend-bars {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  align-items: end;
  height: 128px;
  padding: 0.35rem 0.25rem 0;
}

.psa-trend-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  height: 100%;
  justify-content: flex-end;
}

.psa-trend-val {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--psa-primary);
}

.psa-trend-bar-track {
  width: 100%;
  max-width: 30px;
  height: 82px;
  background: var(--psa-surface-subtle);
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border: 1px solid var(--psa-border);
}

.psa-trend-bar-fill {
  width: 100%;
  background: #93C5FD;
  border-radius: 4px 4px 0 0;
  transition: height 220ms ease;
}

.psa-trend-bar-fill.current {
  background: var(--psa-accent);
}

.psa-trend-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--psa-text-muted);
  white-space: nowrap;
}

.psa-trend-footer {
  font-size: 0.76rem;
  color: var(--psa-text-muted);
  text-align: center;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--psa-border);
}

/* C. Secondary Regional Tools — Quick Actions Toolbar (Progressive Disclosure) */
.psa-quick-actions-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 0.85rem;
}

.psa-action-card {
  background: var(--psa-surface);
  border: 1px solid var(--psa-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  box-shadow: var(--psa-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  min-height: 76px;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.psa-action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--psa-shadow-md);
  border-color: var(--psa-accent);
}

.psa-action-card-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.psa-action-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--psa-accent-soft);
  color: var(--psa-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.psa-action-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--psa-primary);
  margin: 0 0 0.2rem 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.psa-action-card-desc {
  font-size: 0.81rem;
  line-height: 1.4;
  color: var(--psa-text-muted);
  margin: 0;
}

.psa-action-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--psa-accent);
  background: var(--psa-accent-soft);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  min-height: 40px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Search & Filter Command Bar */
.new-ui-toolbar {
  background: var(--psa-surface);
  border: 1px solid var(--psa-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  /* Tightened from 0.85rem 1.15rem */
  box-shadow: var(--psa-shadow-sm);
  margin-bottom: 0.75rem;
  /* Tightened from 1rem */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.psa-search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
}

.psa-search-input {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.9rem 0.55rem 2.4rem;
  border: 1px solid var(--psa-border-strong);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--psa-primary);
  background: var(--psa-bg-canvas);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.psa-search-input:focus {
  outline: none;
  background: var(--psa-surface);
  border-color: var(--psa-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.psa-search-icon {
  position: absolute;
  left: 0.8rem;
  color: var(--psa-text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

/* Touch-Friendly Buttons (44x44px minimum target) */
.psa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 140ms ease;
  white-space: nowrap;
}

.psa-btn-primary {
  background: var(--psa-accent);
  color: #FFFFFF;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}

.psa-btn-primary:hover {
  background: var(--psa-accent-hover);
}

.psa-btn-secondary {
  background: var(--psa-surface);
  color: var(--psa-primary);
  border-color: var(--psa-border-strong);
}

.psa-btn-secondary:hover {
  background: var(--psa-surface-subtle);
  border-color: #94A3B8;
}

.psa-btn-emerald {
  background: var(--psa-success);
  color: #FFFFFF;
}

.psa-btn-emerald:hover {
  background: #047857;
}

.psa-btn-danger-outline {
  background: rgba(220, 38, 38, 0.06);
  color: var(--psa-danger);
  border-color: rgba(220, 38, 38, 0.3);
}

.psa-btn-danger-outline:hover {
  background: rgba(220, 38, 38, 0.12);
}

/* ============================================================================
   CORE MEMBER DIRECTORY TABLE & MOBILE VERTICAL CARD STACK (< 768px)
   ============================================================================ */
.new-ui-panel {
  background: var(--psa-surface);
  border: 1px solid var(--psa-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--psa-shadow-sm);
  overflow: hidden;
}

.new-ui-panel-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--psa-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--psa-surface);
}

.new-ui-panel-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--psa-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.new-ui-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.new-ui-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.new-ui-table thead th {
  background: var(--psa-surface-subtle);
  color: var(--psa-text-muted);
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--psa-border);
  white-space: nowrap;
}

.new-ui-table tbody tr {
  border-bottom: 1px solid var(--psa-border);
  transition: background 120ms ease;
  cursor: pointer;
}

.new-ui-table tbody tr:last-child {
  border-bottom: none;
}

.new-ui-table tbody tr:hover {
  background: #F8FAFC;
}

.new-ui-table td {
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: var(--psa-text-main);
  vertical-align: middle;
}

/* Status & Relationship Pills */
.new-ui-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  line-height: 1.3;
}

.new-ui-pill-green {
  background: rgba(5, 150, 105, 0.1);
  color: var(--psa-success);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.new-ui-pill-amber {
  background: rgba(217, 119, 6, 0.1);
  color: var(--psa-warning);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.new-ui-pill-red {
  background: rgba(220, 38, 38, 0.1);
  color: var(--psa-danger);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.new-ui-pill-blue {
  background: rgba(37, 99, 235, 0.1);
  color: var(--psa-accent);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.new-ui-pill-slate {
  background: var(--psa-surface-subtle);
  color: var(--psa-text-secondary);
  border: 1px solid var(--psa-border);
}

.new-ui-pill-purple {
  background: rgba(124, 58, 237, 0.1);
  color: #6D28D9;
  border: 1px solid rgba(124, 58, 237, 0.25);
}

/* ============================================================================
   SLIDE-OUT ADVANCED FILTER DRAWER (#advancedFilterDrawer)
   ============================================================================ */
.psa-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.psa-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.psa-slide-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 94vw);
  background: var(--psa-surface);
  box-shadow: var(--psa-shadow-xl);
  z-index: 100;
  transform: translateX(102%);
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.psa-slide-drawer.open {
  transform: translateX(0);
}

.psa-drawer-header {
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--psa-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--psa-primary);
  color: #FFFFFF;
}

.psa-drawer-body {
  padding: 1.25rem 1.35rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.psa-drawer-footer {
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--psa-border);
  background: var(--psa-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ============================================================================
   CLAIM MEMBERS MODAL — PINNED FIRST COLUMN ("Claim" Button)
   ============================================================================ */
.psa-claim-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--psa-border);
  border-radius: var(--radius-md);
  background: var(--psa-surface);
}

.psa-claim-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.psa-claim-table th,
.psa-claim-table td {
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--psa-border);
  font-size: 0.86rem;
  vertical-align: middle;
}

.psa-claim-table thead th {
  background: var(--psa-surface-subtle);
  color: var(--psa-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Permanently pin the "Claim" action column to column 1 */
.psa-claim-table th.psa-sticky-claim-col,
.psa-claim-table td.psa-sticky-claim-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--psa-surface);
  border-right: 2px solid var(--psa-border);
  min-width: 124px;
  box-shadow: 2px 0 6px rgba(15, 23, 42, 0.04);
}

.psa-claim-table thead th.psa-sticky-claim-col {
  background: var(--psa-surface-subtle);
  z-index: 4;
}

/* ============================================================================
   FIND A FELLOW — MULTI-RECORD COMPARISON TRAY
   ============================================================================ */
.psa-comparison-tray {
  background: var(--psa-bg-canvas);
  border: 1px solid var(--psa-accent);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.psa-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.psa-comparison-card {
  background: var(--psa-surface);
  border: 1px solid var(--psa-border);
  border-radius: 10px;
  padding: 0.85rem;
  box-shadow: var(--psa-shadow-xs);
}

/* ============================================================================
   TOAST NOTIFICATION CONTAINER
   ============================================================================ */
.psa-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 380px;
  pointer-events: none;
}

.psa-toast {
  pointer-events: auto;
  background: var(--psa-primary);
  color: #FFFFFF;
  padding: 0.85rem 1.15rem;
  border-radius: 12px;
  box-shadow: var(--psa-shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.86rem;
  font-weight: 600;
  border-left: 4px solid var(--psa-success);
  animation: psaToastSlideIn 200ms ease forwards;
}

.psa-toast.psa-toast-warning {
  border-left-color: var(--psa-warning);
}

.psa-toast.psa-toast-danger {
  border-left-color: var(--psa-danger);
}

@keyframes psaToastSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   AMBIENT SYSTEM FOOTER
   ============================================================================ */
.new-ui-footer {
  border-top: 1px solid var(--psa-border);
  background: var(--psa-surface);
  padding: 1.1rem 1.25rem;
  color: var(--psa-text-muted);
  font-size: 0.78rem;
}

.new-ui-footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ============================================================================
   SHARED NEW-UI ADMIN & AUTH UTILITIES (.n-*)
   ============================================================================ */
.n-page-header,
.n-panel,
.n-kpi-grid {
  max-width: 1440px;
  margin: 1.25rem auto;
}

.n-page-header {
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.n-page-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--psa-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.n-page-subtitle {
  font-size: 0.86rem;
  color: var(--psa-text-muted);
  margin: 0.25rem 0 0;
}

.n-panel {
  background: var(--psa-surface);
  border: 1px solid var(--psa-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--psa-shadow-sm);
  overflow: hidden;
  margin-left: 1.25rem;
  margin-right: 1.25rem;
}

.n-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--psa-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.n-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--psa-primary);
  margin: 0;
}

.n-panel-body {
  padding: 1.25rem;
}

.n-kpi-grid {
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.n-kpi-card {
  background: var(--psa-surface);
  border: 1px solid var(--psa-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--psa-shadow-xs);
}

.n-kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--psa-text-muted);
}

.n-kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--psa-primary);
  margin-top: 0.2rem;
}

.n-kpi-meta {
  font-size: 0.78rem;
  color: var(--psa-text-muted);
  margin-top: 0.15rem;
}

.n-toolbar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.n-input,
.n-select {
  min-height: 44px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--psa-border-strong);
  border-radius: 8px;
  background: var(--psa-surface);
  color: var(--psa-primary);
  font-size: 0.86rem;
}

.n-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--psa-border-strong);
  background: var(--psa-surface);
  color: var(--psa-primary);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.n-btn-primary {
  background: var(--psa-accent);
  color: #FFFFFF;
  border-color: var(--psa-accent);
}

.n-btn-success {
  background: var(--psa-success);
  color: #FFFFFF;
  border-color: var(--psa-success);
}

.n-btn-danger {
  background: rgba(220, 38, 38, 0.08);
  color: var(--psa-danger);
  border-color: rgba(220, 38, 38, 0.3);
}

.n-btn-sm {
  min-height: 36px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
}

.n-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--psa-surface-subtle);
  color: var(--psa-text-secondary);
}

.n-badge-primary {
  background: var(--psa-accent-soft);
  color: var(--psa-accent);
}

.n-badge-success {
  background: rgba(5, 150, 105, 0.12);
  color: var(--psa-success);
}

.n-badge-warning {
  background: rgba(217, 119, 6, 0.12);
  color: var(--psa-warning);
}

.n-badge-purple {
  background: rgba(124, 58, 237, 0.12);
  color: #6D28D9;
}

.n-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.n-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.n-table th,
.n-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--psa-border);
  font-size: 0.86rem;
}

.n-table thead th {
  background: var(--psa-surface-subtle);
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--psa-text-muted);
}

/* ============================================================================
   MOBILE ADAPTATION (< 768px): VERTICAL CARD STACK & BOTTOM-SHEET PICKER
   ============================================================================ */
@media (max-width: 767px) {
  .psa-region-switcher-wrap {
    display: none;
  }

  .psa-mobile-region-btn {
    display: inline-flex;
  }

  .new-ui-table thead {
    display: none;
  }

  .new-ui-table,
  .new-ui-table tbody,
  .new-ui-table tr,
  .new-ui-table td {
    display: block;
    width: 100%;
  }

  .new-ui-table tbody tr {
    background: var(--psa-surface);
    border: 1px solid var(--psa-border);
    border-radius: var(--radius-md);
    margin-bottom: 0.85rem;
    padding: 0.85rem 1rem;
    box-shadow: var(--psa-shadow-xs);
  }

  .new-ui-table td {
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--psa-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    text-align: right;
  }

  .new-ui-table td:last-child {
    border-bottom: none;
    padding-top: 0.65rem;
  }

  .new-ui-table td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--psa-text-muted);
    text-align: left;
  }
}