/* TSSG Component Library
   All rules reference tokens from tokens.css.
   Load order: tokens.css → components.css → page-specific styles.
*/

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   APP SHELL
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--color-content-bg);
}

/* ── Sidebar ─────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  border-right: 1px solid var(--color-sidebar-border);
  overflow: hidden;
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--color-sidebar-border);
  flex-shrink: 0;
  gap: var(--space-3);
}

/* Logo: context-aware (see CLAUDE.md).
   Use logo-group.png for admin/group context (yellow on dark reads well).
   Use logo-rover-white.png for Rover-specific contexts.
   SVG preferred over PNG when available. */
.sidebar-logo-img {
  height: 28px;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
}

.sidebar-logo-text {
  font-size: var(--text-sm);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-logo-text span {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-sidebar-text-muted);
  letter-spacing: 0;
}

/* ── Nav ─────────────────────────────────────────────────────────── */

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: var(--radius-pill); }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-sidebar-text-muted);
  padding: var(--space-4) var(--space-3) var(--space-2);
  margin-top: var(--space-2);
}

.nav-section-label:first-child { margin-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-sidebar-text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
  line-height: 1.4;
}

.nav-item:hover:not(.active) {
  background: var(--color-sidebar-hover-bg);
  color: #ffffff;
}

.nav-item.active {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-active-text);
}

.nav-item.active .nav-icon svg,
.nav-item.active svg {
  color: var(--color-sidebar-active-text);
}

.nav-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--color-sidebar-text-muted);
  transition: color var(--transition-fast);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  color: inherit;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
}

/* ── Sidebar footer (user block) ─────────────────────────────────── */

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--color-sidebar-border);
  flex-shrink: 0;
}

.user-block {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-block:hover { background: var(--color-sidebar-hover-bg); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.user-role {
  font-size: 11px;
  color: var(--color-sidebar-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-block-icon {
  color: var(--color-sidebar-text-muted);
  flex-shrink: 0;
}

.user-block-icon svg { width: 15px; height: 15px; }

/* ── Main area ───────────────────────────────────────────────────── */

.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Top bar ─────────────────────────────────────────────────────── */

.topbar {
  height: var(--topbar-height);
  background: var(--color-card-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: var(--space-4); }

.page-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.topbar-right { display: flex; align-items: center; gap: var(--space-3); }

/* ── Content ─────────────────────────────────────────────────────── */

.content {
  flex: 1;
  padding: var(--space-8);
  overflow-y: auto;
}

.content-header {
  margin-bottom: var(--space-6);
}

.content-header h1 {
  font-size: var(--type-h1-size);
  font-weight: var(--type-h1-weight);
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  line-height: 1.2;
}

.content-header p {
  margin-top: var(--space-1);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CARD
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.card {
  background: var(--color-card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
  transition: box-shadow var(--transition-base);
}

.card:hover { box-shadow: var(--shadow-hover); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: 2px;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   METRIC CARD
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.metric-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-5) var(--space-6);
  transition: box-shadow var(--transition-base);
}

.metric-card:hover { box-shadow: var(--shadow-hover); }

.metric-card .metric-label {
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  letter-spacing: var(--type-label-spacing);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.metric-value-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.metric-card .metric-number {
  font-size: var(--type-metric-size);
  font-weight: var(--type-metric-weight);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--color-text-primary);
}

.metric-delta {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.metric-delta.positive {
  background: var(--color-status-active-soft);
  color: var(--color-status-active);
}

.metric-delta.negative {
  background: var(--color-status-removed-soft);
  color: var(--color-status-removed);
}

.metric-delta.neutral {
  background: var(--color-divider);
  color: var(--color-text-muted);
}

.metric-footer {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Metrics grid layout */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   BUTTONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  height: 38px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Primary — yellow fill, near-black text */
.btn-primary {
  background: var(--color-accent);
  color: var(--color-accent-fg);
}
.btn-primary:hover:not(:disabled) {
  background: #e8ba14;
  box-shadow: 0 2px 8px rgba(245,197,24,0.3);
}

/* Secondary — light grey fill */
.btn-secondary {
  background: var(--color-divider);
  color: var(--color-text-primary);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--color-border);
}

/* Ghost — outline only */
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-divider);
  color: var(--color-text-primary);
  border-color: var(--color-text-muted);
}

/* Danger — solid red, white text (clearly destructive, never yellow) */
.btn-danger {
  background: var(--color-status-removed);
  color: #ffffff;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  box-shadow: 0 2px 8px rgba(220,38,38,0.25);
}

/* Primary disabled — grey instead of faded yellow */
.btn-primary:disabled {
  background: var(--color-border);
  color: var(--color-text-muted);
  opacity: 1;
  box-shadow: none;
}

/* Size modifiers */
.btn-sm {
  height: 30px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  height: 46px;
  padding: 0 var(--space-6);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* Pill variant */
.btn-pill { border-radius: var(--radius-pill); }

/* Full width */
.btn-block { width: 100%; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SEGMENTED CONTROL / PILL TOGGLE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.seg-control {
  display: inline-flex;
  background: var(--color-divider);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
}

.seg-btn:hover:not(.active) {
  color: var(--color-text-primary);
  background: rgba(0,0,0,0.04);
}

.seg-btn.active {
  background: var(--color-card-bg);
  color: var(--color-text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   BADGES / STATUS TAGS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.5;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}

/* Status badges */
.badge-active   { background: var(--color-status-active-soft);   color: var(--color-status-active);   }
.badge-pending  { background: var(--color-status-pending-soft);  color: var(--color-status-pending);  }
.badge-paused   { background: var(--color-status-paused-soft);   color: var(--color-status-paused);   }
.badge-inactive { background: var(--color-status-inactive-soft); color: var(--color-status-inactive); }
.badge-removed  { background: var(--color-status-removed-soft);  color: var(--color-status-removed);  }

/* Section badges */
.badge-cubs    { background: var(--color-section-cubs-soft);    color: var(--color-section-cubs);    }
.badge-scouts  { background: var(--color-section-scouts-soft);  color: var(--color-section-scouts);  }
.badge-rovers  { background: var(--color-section-rovers-soft);  color: var(--color-section-rovers);  }
.badge-leaders { background: var(--color-section-leaders-soft); color: var(--color-section-leaders); }

/* No dot variant */
.badge-plain::before { display: none; }

/* Event category badges — no dot */
.badge-cat-community-service,
.badge-cat-external-service,
.badge-cat-training,
.badge-cat-outing,
.badge-cat-meeting,
.badge-cat-national-event,
.badge-cat-fundraising,
.badge-cat-competition,
.badge-cat-other { font-size: 11px; font-weight: 600; padding: 2px 8px; }
.badge-cat-community-service::before,
.badge-cat-external-service::before,
.badge-cat-training::before,
.badge-cat-outing::before,
.badge-cat-meeting::before,
.badge-cat-national-event::before,
.badge-cat-fundraising::before,
.badge-cat-competition::before,
.badge-cat-other::before { display: none; }

.badge-cat-community-service { background: #dcfce7; color: #16a34a; }
.badge-cat-external-service  { background: #ccfbf1; color: #0d9488; }
.badge-cat-training          { background: #dbeafe; color: #2563eb; }
.badge-cat-outing            { background: #fef3c7; color: #d97706; }
.badge-cat-meeting           { background: #f3e8ff; color: #7c3aed; }
.badge-cat-national-event    { background: #fef9c3; color: #b45309; }
.badge-cat-fundraising       { background: #ffe4e6; color: #e11d48; }
.badge-cat-competition       { background: #ffedd5; color: #ea580c; }
.badge-cat-other             { background: #f3f4f6; color: #6b7280; }

/* Attendance table row highlight */
.attendance-row.is-present { background: rgba(245,197,24,0.04); }
.attendance-row.is-present > td:first-child { border-left: 3px solid var(--color-accent); padding-left: calc(var(--space-4) - 3px); }
.attendance-row > td:first-child { border-left: 3px solid transparent; }
.attendance-check {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-accent);
  flex-shrink: 0;
}

/* Payment & receipt status badges — no dot */
.badge-pay-unpaid,
.badge-pay-pending-verification,
.badge-pay-paid,
.badge-pay-waived,
.badge-receipt-pending,
.badge-receipt-verified,
.badge-receipt-rejected { font-size: 11px; font-weight: 600; padding: 2px 8px; }
.badge-pay-unpaid::before,
.badge-pay-pending-verification::before,
.badge-pay-paid::before,
.badge-pay-waived::before,
.badge-receipt-pending::before,
.badge-receipt-verified::before,
.badge-receipt-rejected::before { display: none; }

.badge-pay-unpaid               { background: #f3f4f6; color: #6b7280; }
.badge-pay-pending-verification  { background: #fef9c3; color: #b45309; }
.badge-pay-paid                 { background: #dcfce7; color: #16a34a; }
.badge-pay-waived               { background: #f3e8ff; color: #7c3aed; }
.badge-receipt-pending          { background: #fef9c3; color: #b45309; }
.badge-receipt-verified         { background: #dcfce7; color: #16a34a; }
.badge-receipt-rejected         { background: #ffe4e6; color: #e11d48; }

/* Progress bar (collection payment summary) */
.progress-bar-wrap {
  height: 6px;
  background: var(--color-divider);
  border-radius: var(--radius-pill);
  overflow: hidden;
  width: 100%;
  min-width: 80px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   DATA TABLE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-card-bg);
  font-size: var(--text-sm);
}

.data-table thead {
  background: var(--color-card-bg);
  border-bottom: 2px solid var(--color-border);
}

.data-table th {
  padding: var(--space-3) var(--space-5);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-3) var(--space-5);
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
  line-height: 1.4;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: #fafafa;
}

/* Table member name cell */
.cell-name {
  font-weight: 500;
  color: var(--color-text-primary);
}

.cell-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 1px;
}

/* Table action links */
.table-action {
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
  font-family: var(--font-sans);
}
.table-action:hover {
  background: var(--color-divider);
  color: var(--color-text-primary);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   FORM INPUTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-primary);
}

.field-label.required::after {
  content: ' *';
  color: var(--color-status-removed);
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  padding: 9px var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  background: var(--color-card-bg);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  line-height: 1.5;
  -webkit-appearance: none;
  appearance: none;
}

.field-input::placeholder,
.field-textarea::placeholder {
  color: var(--color-text-muted);
}

.field-input:hover,
.field-select:hover,
.field-textarea:hover {
  border-color: var(--color-text-muted);
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(245,197,24,0.15);
}

.field-input.error,
.field-select.error {
  border-color: var(--color-status-removed);
}
.field-input.error:focus,
.field-select.error:focus {
  box-shadow: 0 0 0 3px rgba(220,38,38,0.15);
}

/* Select arrow */
.field-select-wrap { position: relative; }
.field-select-wrap::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--color-text-muted);
  pointer-events: none;
}
.field-select-wrap .field-select { padding-right: var(--space-8); cursor: pointer; }

.field-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.field-error-msg {
  font-size: var(--text-xs);
  color: var(--color-status-removed);
  font-weight: 500;
}

/* Input group (prefix/suffix) */
.input-group {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-group:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(245,197,24,0.15);
}
.input-group-addon {
  padding: 9px var(--space-3);
  background: var(--color-divider);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.input-group .field-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
}
.input-group .field-input:focus { box-shadow: none; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CHART CARD
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.chart-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

.chart-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.chart-card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.chart-card-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-wrap-tall { height: 280px; }
.chart-wrap-sm   { height: 160px; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   EMPTY STATE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--color-divider);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
}

.empty-icon svg { width: 22px; height: 22px; }

.empty-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.empty-body {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  max-width: 300px;
  margin-bottom: var(--space-5);
  line-height: 1.6;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   LOADING SKELETON
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.skeleton {
  background: var(--color-divider);
  border-radius: var(--radius-sm);
  animation: skeleton-pulse 1.6s ease-in-out infinite;
}

.skeleton-text {
  height: 14px;
  border-radius: var(--radius-pill);
}

.skeleton-text.sm  { height: 11px; }
.skeleton-text.lg  { height: 18px; }
.skeleton-text.xl  { height: 36px; }

.skeleton-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-5) var(--space-6);
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
}
.skeleton-row:last-child { border-bottom: none; }

.skeleton-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   LOGIN PAGE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-content-bg);
  padding: var(--space-6);
}

.login-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  padding: var(--space-8);
  width: 100%;
  max-width: 380px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.login-logo img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.login-logo-text h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  line-height: 1.2;
}

.login-logo-text p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 1px;
}

.login-divider {
  width: 1px;
  height: 32px;
  background: var(--color-border);
}

.login-alert {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-top: var(--space-4);
}
.login-alert.error {
  background: var(--color-status-removed-soft);
  color: var(--color-status-removed);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   LAYOUT UTILITIES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.section-gap  { margin-bottom: var(--space-8); }
.row          { display: flex; align-items: center; gap: var(--space-3); }
.row-between  { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.col          { display: flex; flex-direction: column; gap: var(--space-3); }
.grid-2       { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-3       { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }
.grid-4       { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.text-muted    { color: var(--color-text-muted); }
.text-secondary{ color: var(--color-text-secondary); }
.text-sm       { font-size: var(--text-sm); }
.text-xs       { font-size: var(--text-xs); }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   MODAL
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.modal-backdrop[hidden] { display: none; }
.empty-state[hidden]    { display: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.modal-backdrop.open { opacity: 1; }

.modal {
  background: var(--color-card-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.22s ease;
}

.modal-backdrop.open .modal { transform: none; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
  font-family: var(--font-sans);
}

.modal-close:hover {
  background: var(--color-divider);
  color: var(--color-text-primary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-pill); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-error {
  background: var(--color-status-removed-soft);
  color: var(--color-status-removed);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

/* Form sections inside modals */
.form-section { margin-bottom: var(--space-6); }

.form-section:last-child { margin-bottom: 0; }

.form-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-grid .field-full { grid-column: 1 / -1; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   FILTER BAR
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.filter-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  width: 260px;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px var(--space-3) 8px 34px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  background: var(--color-card-bg);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input::placeholder { color: var(--color-text-muted); }
.search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(245,197,24,0.15);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   MEMBER DETAIL PROFILE CARD
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5) var(--space-8);
}

.info-field {}

.info-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.info-value {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  font-weight: 500;
}

/* Import result */
.import-result-ok {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: var(--color-status-active-soft);
  color: var(--color-status-active);
  font-weight: 500;
}

.import-result-error {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: var(--color-status-removed-soft);
  color: var(--color-status-removed);
  font-weight: 500;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   FUND & FINANCE BADGES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.badge-dir-income,
.badge-dir-expense,
.badge-budget-draft,
.badge-budget-approved,
.badge-budget-closed { font-size: 11px; font-weight: 600; padding: 2px 8px; }

.badge-dir-income::before,
.badge-dir-expense::before,
.badge-budget-draft::before,
.badge-budget-approved::before,
.badge-budget-closed::before { display: none; }

.badge-dir-income    { background: #dcfce7; color: #16a34a; }
.badge-dir-expense   { background: #ffe4e6; color: #e11d48; }
.badge-budget-draft  { background: #f3f4f6; color: #6b7280; }
.badge-budget-approved { background: #dcfce7; color: #16a34a; }
.badge-budget-closed { background: #dbeafe; color: #1d4ed8; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ROVER FEE STATUS BADGES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.badge-fee-paid-up,
.badge-fee-in-arrears,
.badge-fee-paused { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap; }

.badge-fee-paid-up    { background: #dcfce7; color: #16a34a; }
.badge-fee-in-arrears { background: #ffe4e6; color: #e11d48; }
.badge-fee-paused     { background: #f3f4f6; color: #6b7280; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ROVER FEES — B1.1 VISUALISATIONS
   Arrears ageing · Payment heatmap · At-risk table
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Arrears ageing buckets */
.ageing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

.ageing-bucket {
  background: var(--color-content-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
}

.ageing-bucket-worst {
  border-color: #fca5a5;
  background: #fff8f8;
}

.ageing-bucket-label {
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.ageing-bucket-worst .ageing-bucket-label { color: #e11d48; }

.ageing-bucket-count {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.ageing-bucket-worst .ageing-bucket-count { color: #e11d48; }

.ageing-bucket-amount {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Payment heatmap */
.heatmap-scroll {
  overflow-x: auto;
  padding-bottom: var(--space-2);
}

.heatmap-table {
  border-collapse: separate;
  border-spacing: 3px;
  white-space: nowrap;
}

.hm-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-primary);
  padding-right: var(--space-5);
  min-width: 140px;
  vertical-align: middle;
}

.hm-period-hdr {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-align: center;
  padding: 0 1px var(--space-2);
  min-width: 36px;
  vertical-align: bottom;
  line-height: 1.3;
}

.hm-hdr-future { color: var(--color-border); }

.hm-cell {
  width: 36px;
  height: 28px;
  border-radius: 3px;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  vertical-align: middle;
  cursor: default;
  user-select: none;
}

.hm-cell-paid    { background: #ecfdf5; color: #15803d; }
.hm-cell-partial { background: #fefce8; color: #a16207; }
.hm-cell-due     { background: #fff1f2; color: #e11d48; }
.hm-cell-paused  { background: #f3f4f6; color: #9ca3af; }
.hm-cell-waived  { background: #f5f3ff; color: #7c3aed; }
.hm-cell-future  { background: transparent; border: 1px dashed var(--color-border); color: transparent; }
.hm-cell-none    { background: transparent; }

.hm-legend {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

.hm-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 11px;
  color: var(--color-text-muted);
}

.hm-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* At-risk risk level badges (no dot) */
.badge-risk-fine,
.badge-risk-at,
.badge-risk-watch { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap; }

.badge-risk-fine  { background: #ffe4e6; color: #e11d48; }
.badge-risk-at    { background: #fef9c3; color: #b45309; }
.badge-risk-watch { background: #f3f4f6; color: #6b7280; }

/* Fine policy callout */
.policy-callout {
  background: var(--color-content-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-5);
  line-height: 1.6;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   MEETING MINUTES — B3 BADGES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.badge-meeting-draft,
.badge-meeting-published,
.badge-action-open,
.badge-action-done,
.badge-scope-group-wide,
.badge-meeting-exco {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge-meeting-draft,
.badge-meeting-published,
.badge-action-open,
.badge-action-done,
.badge-scope-group-wide,
.badge-meeting-exco { }

.badge-meeting-draft::before,
.badge-meeting-published::before,
.badge-action-open::before,
.badge-action-done::before,
.badge-scope-group-wide::before,
.badge-meeting-exco::before { display: none; }

.badge-meeting-draft      { background: #f3f4f6; color: #6b7280; }
.badge-meeting-published  { background: #dcfce7; color: #16a34a; }
.badge-action-open        { background: #fef9c3; color: #b45309; }
.badge-action-done        { background: #dcfce7; color: #16a34a; }
.badge-scope-group-wide   { background: #dbeafe; color: #1d4ed8; }
.badge-meeting-exco       { background: #f3e8ff; color: #7c3aed; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ADVANCEMENT MODULE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Award status badges (member_award_status.status enum values) */
.badge-adv-in-progress,
.badge-adv-submitted,
.badge-adv-awarded,
.badge-adv-not-started { font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: var(--radius-pill); display: inline-block; white-space: nowrap; }

.badge-adv-in-progress::before,
.badge-adv-submitted::before,
.badge-adv-awarded::before,
.badge-adv-not-started::before { display: none; }

.badge-adv-in-progress { background: #fef9c3; color: #b45309; }
.badge-adv-submitted   { background: #dbeafe; color: #1d4ed8; }
.badge-adv-awarded     { background: #dcfce7; color: #16a34a; }
.badge-adv-not-started { background: #f3f4f6; color: #6b7280; }

/* Award category badges (award_category enum) */
.badge-adv-ladder,
.badge-adv-proficiency,
.badge-adv-higher,
.badge-adv-component { font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: var(--radius-pill); display: inline-block; white-space: nowrap; }

.badge-adv-ladder::before,
.badge-adv-proficiency::before,
.badge-adv-higher::before,
.badge-adv-component::before { display: none; }

.badge-adv-ladder      { background: #fef3c7; color: #d97706; }
.badge-adv-proficiency { background: #dbeafe; color: #1d4ed8; }
.badge-adv-higher      { background: #f3e8ff; color: #7c3aed; }
.badge-adv-component   { background: #f0fdf4; color: #16a34a; }

/* Awarding authority badges (awarding_authority enum) */
.badge-adv-internal,
.badge-adv-sam { font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: var(--radius-pill); display: inline-block; white-space: nowrap; }

.badge-adv-internal::before,
.badge-adv-sam::before { display: none; }

.badge-adv-internal { background: #f3f4f6; color: #6b7280; }
.badge-adv-sam      { background: #ffe4e6; color: #e11d48; }

/* ── Award cards (member progress view) ─────────────────────────── */

.adv-award-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.adv-award-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.adv-award-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  flex: 1;
  min-width: 0;
}

.adv-award-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.adv-award-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.adv-award-body {
  padding: var(--space-4) var(--space-5);
}

.adv-prereq-notice {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: #fef9c3;
  border-bottom: 1px solid #fde68a;
  font-size: var(--text-sm);
  color: #92400e;
}

.adv-prereq-notice svg { flex-shrink: 0; color: #d97706; }

/* ── Component sub-cards (nested inside parent award) ────────────── */

.adv-components-section {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
}

.adv-components-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.adv-component-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-3);
  background: var(--color-card-bg);
}

.adv-component-card:last-child { margin-bottom: 0; }

.adv-component-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-content-bg);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
}

.adv-component-header:hover { background: #f9fafb; }

.adv-component-toggle {
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.adv-component-header.open .adv-component-toggle {
  transform: rotate(90deg);
}

.adv-component-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  flex: 1;
}

.adv-component-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.adv-component-body { display: none; }
.adv-component-body.open { display: block; }

/* ── Requirement tree ─────────────────────────────────────────────── */

.adv-req-list {
  display: flex;
  flex-direction: column;
}

.adv-req-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-card-bg);
  min-height: 44px;
}

.adv-req-row:last-child { border-bottom: none; }
.adv-req-row.adv-req-signed-off { background: #f0fdf4; }
.adv-req-row.adv-req-claimed    { background: #fefce8; }

.adv-req-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.adv-req-label {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  line-height: 1.5;
  padding-top: 1px;
}

.adv-req-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* choose_group header row */
.adv-req-group-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--color-content-bg);
  border-bottom: 1px solid var(--color-border);
}

.adv-req-group-label {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* children indented inside choose_group */
.adv-req-children .adv-req-row {
  padding-left: calc(var(--space-4) + var(--space-6));
  background: #fafafa;
}

.adv-req-children .adv-req-row.adv-req-signed-off { background: #f0fdf4; }
.adv-req-children .adv-req-row.adv-req-claimed    { background: #fefce8; }

/* award_pointer row */
.adv-req-pointer-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: #fafafa;
}

.adv-req-pointer-row:last-child { border-bottom: none; }

.adv-req-pointer-label {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-style: italic;
}

/* ── Catalogue scheme cards ───────────────────────────────────────── */

.adv-scheme-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.adv-scheme-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-content-bg);
}

.adv-scheme-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text-primary);
}

.adv-catalogue-award {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.adv-catalogue-award:last-child { border-bottom: none; }

.adv-catalogue-award-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
}

.adv-catalogue-award-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.adv-catalogue-award-tags {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-top: var(--space-1);
}

.adv-catalogue-component {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-3) calc(var(--space-5) + var(--space-6));
  border-bottom: 1px solid var(--color-border);
  background: #fafafa;
}

.adv-catalogue-component:last-child { border-bottom: none; }

/* Req count pill */
.adv-req-count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: #f3f4f6;
  color: #6b7280;
  white-space: nowrap;
}


/* ══════════════════════════════════════════════════════════════════
   MEMBER AREA SHELL — me-app / me-sidebar / me-content
   Lighter and warmer than the /admin dashboard. No dark sidebar.
   ══════════════════════════════════════════════════════════════════ */

.me-app {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg-page);
}

/* ── Sidebar ─────────────────────────────────────────────────────── */

.me-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.me-sbar-brand {
  padding: var(--space-5) var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.me-brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  margin-bottom: 0;
}

.me-brand-logo img { width: 28px; height: 28px; object-fit: contain; }

.me-brand-text {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.15;
}

.me-brand-text span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-muted);
}

.me-sbar-identity {
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.me-identity-avatar { width: 64px; height: 64px; }

.me-identity-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-primary);
}

.me-identity-section {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── Nav links ───────────────────────────────────────────────────── */

.me-sbar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.me-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: background 0.12s, color 0.12s;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.me-nav-link:hover {
  background: #f9f8f5;
  color: var(--color-text-primary);
}

.me-nav-link.active {
  background: #fefce8;
  color: #713f12;
  font-weight: 600;
}

.me-nav-link.active .me-nav-icon { color: #ca8a04; }

.me-nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

/* ── Sidebar footer ──────────────────────────────────────────────── */

.me-sbar-foot {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* ── Content area ────────────────────────────────────────────────── */

.me-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-6) var(--space-6);
  max-width: 720px;
}

/* ── Dashboard tiles ─────────────────────────────────────────────── */

.me-dash-greeting {
  margin-bottom: var(--space-6);
}

.me-dash-greeting-name {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.me-dash-greeting-sub {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.me-dash-avatar-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.me-dash-avatar { width: 72px; height: 72px; }

.me-dash-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.me-tile {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  cursor: pointer;
}

.me-tile:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.me-tile-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: #fef9c3;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-1);
  color: #ca8a04;
}

.me-tile-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.me-tile-value {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.2;
}

.me-tile-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.me-tile-value.green { color: #16a34a; }
.me-tile-value.red   { color: #dc2626; }
.me-tile-value.muted { color: var(--color-text-muted); font-weight: 500; }

/* ── Mobile ──────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .me-app { flex-direction: column; }

  .me-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .me-sbar-identity {
    flex-direction: row;
    text-align: left;
    padding: var(--space-3) var(--space-4);
  }

  .me-identity-avatar { width: 40px; height: 40px; }

  .me-sbar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--color-border);
    gap: var(--space-1);
  }

  .me-nav-link { white-space: nowrap; flex-shrink: 0; }

  .me-sbar-foot { display: none; }

  .me-content { padding: var(--space-4); }

  .me-dash-tiles { grid-template-columns: 1fr; }
}
