/* ==========================================================================
   NEURAL SMART LISTS - STYLES
   ========================================================================== */

:root {
  /* Color Palette - Premium Dark Charcoal */
  --bg-charcoal-deep: #050505;
  --bg-app: #0a0a0e;
  --surface-card: #121216;
  --surface-modal: #18181f;
  --surface-active: #1e1e27;
  
  /* Status Colors */
  --accent-present: #10b981;      /* Emerald Green */
  --accent-absent: #ef4444;       /* Rose/Red */
  --accent-late: #f59e0b;         /* Amber/Orange */
  
  /* Tier Colors */
  --tier-3: #8b5cf6;              /* Vivid Violet */
  --tier-2: #3b82f6;              /* Royal Blue */
  --tier-1: #64748b;              /* Slate Gray */

  /* Neutral Text */
  --text-main: #e2e8f0;
  --text-dim: #94a3b8;
  --text-inverse: #050505;
  
  /* Design Tokens */
  --accent-creation: #7a5cff;
  --accent-creation-glow: rgba(122, 92, 255, 0.25);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(122, 92, 255, 0.4);
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.8);
  
  /* Layout — trimmed from 260/320 to give the roster more room on laptops */
  --sidebar-width: 224px;
  --panel-width: 300px;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-charcoal-deep);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"),
    radial-gradient(circle at 10% 20%, rgba(122, 92, 255, 0.08), 18%, transparent 54%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05), 18%, transparent 54%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-ui);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
}

/* ── Layout Grid ── */
.app-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--panel-width);
  min-height: 100vh;
  position: relative;
}

/* ── Panels ── */
.sidebar {
  background: rgba(10, 10, 14, 0.95);
  border-right: 1px solid var(--border-light);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

.main-workspace {
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.action-panel {
  background: rgba(10, 10, 14, 0.95);
  border-left: 1px solid var(--border-light);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

/* ── Typography & Headers ── */
h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.app-title {
  font-size: 1.25rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Dashboard-matching app icon (replaces the old 🧠 emoji in the title). */
.app-title-icon {
  height: 26px;
  width: auto;
  flex-shrink: 0;
}

.app-title span.badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  background: var(--accent-creation);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.section-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

/* ── Buttons & Inputs ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  width: 100%;
  text-align: center;
}

.btn-primary {
  background: var(--accent-creation);
  color: #fff;
}
.btn-primary:hover {
  background: #8b73ff;
  box-shadow: 0 0 12px var(--accent-creation-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-light);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-absent);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: var(--accent-absent);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-icon:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.input-text {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-light);
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-main);
  width: 100%;
  transition: border-color var(--transition-fast);
}
.input-text:focus {
  outline: none;
  border-color: var(--accent-creation);
  box-shadow: 0 0 0 2px var(--accent-creation-glow);
}

/* Dropdown override to ensure high contrast in all modes */
select.input-text {
  background-color: #ffffff !important;
  color: #000000 !important;
  border: 1px solid rgba(0, 0, 0, 0.2) !important;
}
select.input-text option {
  background-color: #ffffff !important;
  color: #000000 !important;
}


/* ── Sidebar Elements ── */
.saved-lists-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.list-selector-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.saved-lists-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 2px;
}

.saved-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.8125rem;
  transition: all var(--transition-fast);
}
.saved-list-item:hover, .saved-list-item.active {
  background: rgba(122, 92, 255, 0.08);
  border-color: rgba(122, 92, 255, 0.2);
}
.saved-list-item.active {
  border-color: var(--accent-creation);
}
.saved-list-item .list-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  font-weight: 500;
}
.saved-list-item .list-meta {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-left: 0.5rem;
}
.saved-list-item .btn-delete-list {
  background: transparent;
  padding: 2px;
  border-radius: 4px;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity var(--transition-fast);
  cursor: pointer;
}
.saved-list-item:hover .btn-delete-list {
  opacity: 1;
}
.saved-list-item .btn-delete-list:hover {
  color: var(--accent-absent);
}

.sidebar-footer {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
  margin-top: auto;
}

/* ── Collapsible section accordions ──
   Applied to .import-section and .groups-section. The .section-header
   is a flex row that stays visible even when the section is collapsed
   — for Groups this lets the Generate controls remain reachable
   without expanding first. Inside it, .section-toggle is the actual
   button (icon + title + Expand/Collapse label). Other content inside
   the section is hidden when .is-collapsed is on the parent. */
.section-collapsible > .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
}
.section-collapsible .section-toggle {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-dim);
  text-align: left;
  font-family: inherit;
}
.section-collapsible .section-toggle:hover { color: var(--text-main); }
.section-collapsible .section-toggle > .section-title { margin: 0; }

.section-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(122, 92, 255, 0.15);
  border: 1px solid rgba(122, 92, 255, 0.4);
  color: var(--accent-creation);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.2s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.section-collapsible .section-toggle:hover .section-toggle-icon {
  background: rgba(122, 92, 255, 0.28);
  border-color: rgba(122, 92, 255, 0.7);
  box-shadow: 0 0 10px var(--accent-creation-glow);
}
.section-collapsible.is-collapsed .section-toggle-icon { transform: rotate(-90deg); }

.section-toggle-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  flex-shrink: 0;
}
.section-collapsible .section-toggle:hover .section-toggle-label { color: var(--text-main); }

/* Anything inside the section that's NOT the always-visible header
   gets hidden when the section is collapsed. */
.section-collapsible.is-collapsed > *:not(.section-header) { display: none !important; }

body.light-mode .section-toggle-icon {
  background: rgba(122, 92, 255, 0.08);
  border-color: rgba(122, 92, 255, 0.35);
}

/* ── Workspace: Omni-Paste Import Engine ── */
.import-section {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.import-textarea {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.8125rem;
  color: var(--text-main);
  resize: vertical;
  min-height: 100px;
  width: 100%;
}
.import-textarea:focus {
  outline: none;
  border-color: var(--accent-creation);
  box-shadow: 0 0 0 2px var(--accent-creation-glow);
}

.import-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.import-buttons-group {
  display: flex;
  gap: 0.5rem;
}

.import-stats {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.csv-import-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.csv-import-help {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.csv-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-csv-commit {
  width: auto;
  padding: 0.25rem 0.55rem;
  font-size: 0.7rem;
}

/* Staging Pills Grid */
.staging-pills-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.staging-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.staging-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 0.5rem;
  align-items: center; /* Prevents pill height stretching when text wraps */
}

.staging-pill {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(122, 92, 255, 0.12);
  border: 1px solid rgba(122, 92, 255, 0.25);
  color: var(--text-main);
  padding: 0.35rem 0.6rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  height: fit-content; /* Ensure wrap doesn't force uniform stretch */
}
.staging-pill:hover {
  border-color: rgba(122, 92, 255, 0.5);
  background: rgba(122, 92, 255, 0.2);
}
.staging-pill-remove {
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  margin-left: 0.35rem;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.staging-pill-remove:hover {
  color: var(--accent-absent);
}


/* ── Workspace: Active Roster ── */
.roster-section {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.roster-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  max-width: 250px;
  width: 100%;
}

.search-input-wrapper input {
  padding-left: 2rem;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  font-size: 0.875rem;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-items: start;   /* each card keeps its natural height — an expanded
                           card no longer stretches its row-mates (whitespace) */
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Desktop: show 5 across × ~2 rows by default, with a native drag handle in
   the bottom-right corner (resize: vertical) so users can expand the roster
   to any height they like. Mobile keeps the stacked auto-fill layout above. */
@media (min-width: 768px) {
  .roster-grid {
    /* Adaptive instead of a hard 5-across: wider, readable cards (names were
       getting cramped on laptops). Fits ~3–4 on a 16" screen, more if wider. */
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    align-content: start;         /* keep rows at natural height — no stretch on expand */
    height: 240px;                /* collapsed default — 2 full rows (name + summary) */
    min-height: 140px;
    max-height: 80vh;             /* upper bound when dragged open */
    resize: vertical;             /* drag-to-expand handle, bottom-right */
    overflow: auto;
  }
}

.member-card {
  background: var(--surface-modal);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.member-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.member-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.member-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 0.5rem;
}

.member-name {
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
  /* Name owns the flexible space and shrinks with an ellipsis — it must never
     be pushed out by a long value badge sitting in the icon cluster. */
  flex: 1 1 auto;
  min-width: 0;
}

.member-card-header-icons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.member-note-indicator {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--accent-late);
  display: inline-flex;
  align-items: center;
}

.member-card-controls {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.member-card-controls.no-tiers {
  grid-template-columns: 1fr;
}

/* ── Inline details drawer (collapsed-by-default card) ── */
.member-expand-toggle {
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.member-card.expanded .member-expand-toggle {
  transform: rotate(180deg);
}

.member-card-details[hidden] {
  display: none;
}

.member-card-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}

/* Tier selector + action buttons share one row in the drawer (tier left,
   actions pushed right); wraps gracefully on very narrow cards. */
.member-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.member-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

/* Value + status sit on their own compact row BELOW the name, so the name
   always gets the full card width (never crushed by a long status label). */
.member-card-summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.member-card-summary .status-chip {
  width: auto;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  padding: 0.26rem 0.5rem;
  font-size: 0.64rem;
}

/* Read-only value chip in the member card header. Click opens Details to edit. */
.member-value-badge {
  flex-shrink: 0;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  /* Stay a compact chip even for big numbers — long values ellipsize (full
     amount in the title tooltip) rather than crowding out the name. */
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-value-badge.value-settled {
  color: var(--accent-present);
  border-color: var(--accent-present);
  background: color-mix(in srgb, var(--accent-present) 14%, transparent);
}

.member-value-badge.value-partial {
  color: var(--accent-late);
  border-color: var(--accent-late);
  background: color-mix(in srgb, var(--accent-late) 14%, transparent);
}

.member-value-badge.value-none {
  color: var(--accent-absent);
  border-color: var(--accent-absent);
  background: color-mix(in srgb, var(--accent-absent) 14%, transparent);
}

/* Pulse Check launch button — grayed for non-educators (educator-only
   feature). Still clickable so the disclaimer toast can fire. */
.btn.pulse-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Empty-state "add value" chip — subtle dashed affordance at rest. */
.member-value-badge.value-add {
  color: var(--text-dim);
  border-style: dashed;
  background: transparent;
  opacity: 0.6;
  padding: 0.2rem 0.34rem;
}

.member-value-badge:hover,
.member-value-badge:focus-visible {
  border-color: var(--accent-creation);
  color: var(--accent-creation);
  opacity: 1;
  outline: none;
}

/* In-place editor that replaces the chip on click. */
.member-value-edit {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border: 1px solid var(--accent-creation);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-creation) 22%, transparent);
}

.member-value-edit-unit {
  color: var(--text-dim);
  font-size: 0.64rem;
  padding: 0 0.3rem;
  white-space: nowrap;
}

.member-value-edit-input {
  width: 52px;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.32rem;
  outline: none;
  -moz-appearance: textfield;
}

.member-value-edit-input::-webkit-outer-spin-button,
.member-value-edit-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Inline letter-grade dropdown (grade mode) — compact, matches the editor look. */
.member-value-edit-grade {
  flex-shrink: 0;
  padding: 0.22rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--accent-creation);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-creation) 22%, transparent);
  outline: none;
  cursor: pointer;
}

/* Edit + delete buttons live next to the name in the header, so they
   need a compact size that doesn't crowd the name's truncation budget. */
.member-card-header .btn-icon {
  width: 26px;
  height: 26px;
  font-size: 0.85rem;
}

/* Inline-editable name. Double-click swaps the span for this input. */
.member-name { cursor: text; }
.member-name-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--accent-creation);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.4rem;
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  width: 100%;
  min-width: 0;
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-creation-glow);
}
body.light-mode .member-name-input {
  background: #ffffff;
  color: #0f172a;
}

/* Status Chip */
.status-chip {
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
  text-align: center;
  width: 100%;
  min-width: 75px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-card-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.status-present {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-present);
}
.status-present:hover {
  background: rgba(16, 185, 129, 0.22);
}

.status-late {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-late);
}
.status-late:hover {
  background: rgba(245, 158, 11, 0.22);
}

.status-absent {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-absent);
}
.status-absent:hover {
  background: rgba(239, 68, 68, 0.22);
}

/* Tier Selector Segmented Controls */
.tier-segmented {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.tier-option {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
  cursor: pointer;
  color: var(--text-dim);
  transition: all var(--transition-fast);
}
.tier-option:hover {
  color: #fff;
}
.tier-option.active[data-tier="3"] {
  background: var(--tier-3);
  color: #fff;
}
.tier-option.active[data-tier="2"] {
  background: var(--tier-2);
  color: #fff;
}
.tier-option.active[data-tier="1"] {
  background: var(--tier-1);
  color: #fff;
}

/* ── Workspace: Generated Groups ── */
.groups-section {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.groups-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.group-generator-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.group-count-input {
  width: 60px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  text-align: center;
  font-weight: 600;
}
.group-count-input:focus {
  outline: none;
  border-color: var(--accent-creation);
}
.group-count-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.group-container {
  background: var(--surface-modal);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 180px;
  transition: border-color var(--transition-normal), background var(--transition-normal);
}
.group-container.drag-over {
  border-color: var(--accent-creation);
  background: rgba(122, 92, 255, 0.05);
}

.group-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}

.group-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.group-count-badge {
  font-size: 0.7rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.group-members-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.group-member-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  user-select: none;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.group-member-card:active {
  cursor: grabbing;
}
.group-member-card.dragging {
  opacity: 0.4;
  border-color: var(--accent-creation);
  background: rgba(122, 92, 255, 0.1);
}

.group-member-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
}

.group-member-name {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-member-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.group-member-card .btn-lock {
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0.3;
  transition: opacity var(--transition-fast), color var(--transition-fast);
  background: transparent;
  padding: 2px;
}
.group-member-card:hover .btn-lock, .group-member-card .btn-lock.locked {
  opacity: 1;
}
.group-member-card .btn-lock.locked {
  color: var(--accent-creation);
}

.group-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-light);
  padding-top: 0.5rem;
  margin-top: auto;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.group-stats-tier-pill {
  display: flex;
  gap: 4px;
}

.group-stats-tier-tag {
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #fff;
}
.group-stats-tier-tag[data-tier="3"] { background: var(--tier-3); }
.group-stats-tier-tag[data-tier="2"] { background: var(--tier-2); }
.group-stats-tier-tag[data-tier="1"] { background: var(--tier-1); }

.group-stats-badge {
  background: rgba(255,255,255,0.05);
  padding: 1px 4px;
  border-radius: 2px;
}

.group-stats-badge.has-late {
  color: var(--accent-late);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.group-stats-badge.has-notes {
  color: var(--accent-creation);
  border: 1px solid rgba(122, 92, 255, 0.2);
}

/* ── Action Panel Elements ── */
.balance-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.balance-score-wrapper {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.balance-score-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.balance-score-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.balance-score-label.very-balanced { color: var(--accent-present); }
.balance-score-label.balanced { color: var(--tier-2); }
.balance-score-label.unbalanced { color: var(--accent-late); }
.balance-score-label.poor { color: var(--accent-absent); }

.balance-warnings {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-light);
  padding-top: 0.5rem;
}

.balance-warning-item {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}
.balance-warning-item::before {
  content: "⚠️";
  font-size: 0.7rem;
}

.action-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.totals-content,
.mind-print-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.totals-row {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-main);
}

/* Primary summary line (Value · Avg · entries) — more prominent. */
.totals-row-primary {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.totals-row-muted {
  color: var(--text-dim);
}

.mind-print-locked,
.mind-print-attached {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mind-print-locked p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.75rem;
  line-height: 1.4;
}

.mind-print-empty {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mind-print-hint {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.72rem;
  line-height: 1.45;
}

.mind-print-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.mind-print-open-link {
  text-align: center;
  text-decoration: none;
}

.mind-print-picker-modal {
  max-width: 460px;
}

.mind-print-picker-list {
  gap: 0.5rem;
}

.mind-print-picker-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  padding: 0.7rem;
  cursor: pointer;
  font-family: inherit;
}

.mind-print-picker-item:hover {
  border-color: var(--accent-creation);
}

.mind-print-picker-empty {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.export-textarea {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-main);
  resize: vertical;
  min-height: 80px;
  width: 100%;
}

.share-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

/* Download is the primary action — full-width on its own row above Copy/Share. */
.share-buttons-row #btn-download-export {
  grid-column: 1 / -1;
}

/* ── Modals / Drawers ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface-modal);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}
.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.value-config-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
}

.value-config-grid {
  display: grid;
  grid-template-columns: 1fr 0.7fr;
  gap: 0.5rem;
}

.value-config-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.value-config-target {
  grid-column: 1 / -1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--surface-modal);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px);
  animation: toast-in var(--transition-normal) forwards, toast-out var(--transition-normal) 2.7s forwards;
}

.toast-success {
  border-left: 3px solid var(--accent-present);
}
.toast-error {
  border-left: 3px solid var(--accent-absent);
}
.toast-warning {
  border-left: 3px solid var(--accent-late);
}
.toast-info {
  border-left: 3px solid var(--accent-creation);
}

@keyframes toast-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ── Empty States ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  gap: 0.5rem;
}

.empty-state-icon {
  font-size: 2rem;
  opacity: 0.6;
}

.empty-state-text {
  font-size: 0.8125rem;
  font-weight: 500;
}

/* ── Screen Readers (Accessibility) ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ── Responsive Stacking ── */
@media (max-width: 1100px) {
  .app-container {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
  .action-panel {
    grid-column: 1 / -1;
    border-left: none;
    border-top: 1px solid var(--border-light);
  }
}

@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  .sidebar {
    grid-column: 1;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }
  .main-workspace {
    padding: 1rem;
  }

  /* ── Roster density on mobile ──
     The desktop max-height: 400px capped the visible roster at ~4
     cards on mobile, forcing a tiny inner scroll that fought the
     page scroll. On mobile we drop the inner cap and let the page
     scroll naturally — combined with the compacted card metrics
     below, ~10 members fit before any scroll on a typical phone. */
  .roster-grid {
    max-height: none;
    gap: 0.4rem;
  }
  .member-card {
    padding: 0.45rem 0.65rem;
    gap: 0.5rem;
  }
  .member-card-content { gap: 0.25rem; }
  .member-name { font-size: 0.8rem; }
  .member-card-header-icons { gap: 0.2rem; }
  .member-card-header .btn-icon {
    width: 24px;
    height: 24px;
    font-size: 0.78rem;
  }
  .member-card-controls { gap: 0.35rem; }
  .status-chip {
    padding: 0.25rem 0.4rem;
    font-size: 0.65rem;
    min-width: 60px;
  }
  .tier-segmented { padding: 1px; }
  .tier-option {
    font-size: 0.6rem;
    padding: 1px 4px;
  }
  .member-select-checkbox { width: 14px; height: 14px; }
}

/* ── Light Mode Overrides ── */
body.light-mode {
  --bg-charcoal-deep: #f8fafc;
  --bg-app: #f1f5f9;
  --surface-card: #ffffff;
  --surface-modal: #ffffff;
  --surface-active: #e2e8f0;
  --text-main: #0f172a;
  --text-dim: #64748b;
  --border-light: rgba(0, 0, 0, 0.08);
  --border-focus: var(--accent-creation);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"),
    radial-gradient(circle at 10% 20%, rgba(122, 92, 255, 0.04), 18%, transparent 54%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.03), 18%, transparent 54%);
}

body.light-mode .sidebar {
  background: rgba(248, 250, 252, 0.98);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}
/* The "Smart Lists" app title is hardcoded white — invisible once the sidebar
   turns light in Crystal White mode. */
body.light-mode .app-title { color: #0f172a; }

body.light-mode .action-panel {
  background: rgba(248, 250, 252, 0.98);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-mode .saved-lists-list,
body.light-mode .staging-grid,
body.light-mode .roster-grid,
body.light-mode .groups-grid {
  background: rgba(0, 0, 0, 0.02);
}

body.light-mode .saved-list-item {
  background: rgba(0, 0, 0, 0.02);
}
body.light-mode .saved-list-item:hover,
body.light-mode .saved-list-item.active {
  background: rgba(122, 92, 255, 0.06);
}
body.light-mode .saved-list-item.active {
  border-color: var(--accent-creation);
}

body.light-mode .import-textarea,
body.light-mode .input-text,
body.light-mode .export-textarea,
body.light-mode .group-count-input {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
body.light-mode .import-textarea:focus,
body.light-mode .input-text:focus,
body.light-mode .export-textarea:focus,
body.light-mode .group-count-input:focus {
  border-color: var(--accent-creation);
  box-shadow: 0 0 0 2px var(--accent-creation-glow);
}

body.light-mode .member-card,
body.light-mode .group-container {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

body.light-mode .group-member-card {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
body.light-mode .group-member-card:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.light-mode .tier-segmented {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
body.light-mode .tier-option {
  color: #475569;
}
body.light-mode .tier-option:hover {
  color: #0f172a;
}
body.light-mode .tier-option.active {
  color: #ffffff;
}

body.light-mode .balance-score-value {
  color: #0f172a;
}

body.light-mode .modal-content {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body.light-mode .btn-secondary {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #0f172a;
}
body.light-mode .btn-secondary:hover {
  background: #f1f5f9;
}

/* ── Custom Status Configuration Layouts ── */
.status-edit-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}
body.light-mode .status-edit-row {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.status-color-input {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  padding: 0;
}
body.light-mode .status-color-input {
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* ── Smart Views Chips ── */
.smart-views-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border-light);
}
.smart-view-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  border-radius: 50px;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-dim);
  transition: all var(--transition-fast);
}
.smart-view-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}
.smart-view-chip.active {
  background: var(--accent-creation);
  border-color: var(--accent-creation);
  color: #ffffff;
}
body.light-mode .smart-view-chip {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #475569;
}
body.light-mode .smart-view-chip:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #0f172a;
}
body.light-mode .smart-view-chip.active {
  background: var(--accent-creation);
  border-color: var(--accent-creation);
  color: #ffffff;
}

/* ── Bulk Action Bar ── */
.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(122, 92, 255, 0.08);
  border: 1px solid var(--accent-creation);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
  animation: slide-down var(--transition-normal) ease;
}
@keyframes slide-down {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.bulk-selected-count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
}
.bulk-buttons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.bulk-btn {
  width: auto !important;
  padding: 0.25rem 0.5rem !important;
  font-size: 0.72rem !important;
  height: 32px;
}
.bulk-more-select {
  height: 32px !important;
  padding: 0.25rem 0.5rem !important;
  font-size: 0.72rem !important;
  background-color: #ffffff !important;
  color: #000000 !important;
}
body.light-mode .bulk-action-bar {
  background: rgba(122, 92, 255, 0.05);
  border-color: var(--accent-creation);
}

/* ── Checkbox Selection State ── */
.member-select-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent-creation);
}
.member-card.selected {
  border-color: var(--accent-creation) !important;
  background: rgba(122, 92, 255, 0.04) !important;
}
body.light-mode .member-card.selected {
  background: rgba(122, 92, 255, 0.03) !important;
}

/* ── Group Generator Mode Toggle ── */
.group-mode-segmented {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.group-mode-option {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
  cursor: pointer;
  color: var(--text-dim);
  transition: all var(--transition-fast);
}
.group-mode-option:hover {
  color: #fff;
}
.group-mode-option.active {
  background: var(--accent-creation);
  color: #fff;
}
body.light-mode .group-mode-segmented {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
body.light-mode .group-mode-option {
  color: #475569;
}
body.light-mode .group-mode-option:hover {
  color: #0f172a;
}
body.light-mode .group-mode-option.active {
  color: #fff;
}

/* ── Advanced Rules Drawer ── */
.advanced-rules-container {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 1rem;
}
.btn-toggle-rules {
  background: transparent;
  color: var(--text-main);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
}
.btn-toggle-rules:hover {
  color: var(--accent-creation);
}
.rules-drawer {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px solid var(--border-light);
  padding-top: 0.75rem;
}
.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.rules-column {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.rule-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  user-select: none;
  cursor: pointer;
}
.rule-checkbox-label input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent-creation);
}
.rule-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.rules-pair-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  border-top: 1px solid var(--border-light);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}
.pair-rules-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pair-inputs {
  display: flex;
  gap: 0.25rem;
}
.pair-select {
  flex: 1;
  padding: 0.25rem 0.5rem !important;
  font-size: 0.72rem !important;
  height: 28px !important;
  background-color: #ffffff !important;
  color: #000000 !important;
}
.btn-small-rule {
  width: auto !important;
  padding: 0.25rem 0.5rem !important;
  font-size: 0.72rem !important;
  height: 28px !important;
}
.rules-list-items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 100px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.25rem;
}
.rule-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.02);
  padding: 0.2rem 0.4rem;
  border-radius: 2px;
  font-size: 0.7rem;
}
.btn-delete-rule {
  background: transparent;
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  padding: 0;
}
.btn-delete-rule:hover {
  color: var(--accent-absent);
}
body.light-mode .advanced-rules-container {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .rules-drawer {
  border-top-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .rules-pair-section {
  border-top-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .rules-list-items {
  background: rgba(0, 0, 0, 0.04);
}
body.light-mode .rule-item-row {
  background: #ffffff;
}

/* ── Roster Tag Badges ── */
.member-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}
.tag-badge {
  background: rgba(122, 92, 255, 0.1);
  border: 1px solid rgba(122, 92, 255, 0.2);
  color: var(--accent-creation);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 0.65rem;
  font-weight: 600;
}
body.light-mode .tag-badge {
  background: rgba(122, 92, 255, 0.06);
}

/* ── Random Picker Result ── */
.picker-result-container {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  text-align: center;
  animation: pop-in var(--transition-normal) ease;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.picker-result-name {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 0.2rem;
}
body.light-mode .picker-result-container {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

/* Mind Print card — email action row */
.mp-email-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light, rgba(255,255,255,0.08));
}

.mp-email-count {
  font-size: 0.75rem;
  color: var(--text-dim, rgba(255,255,255,0.4));
  margin-left: auto;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .mp-email-row { flex-direction: column; align-items: stretch; }
  .mp-email-count { margin-left: 0; text-align: right; }
}

/* ── Pulse history (written by Pulse Check, shown in the member drawer) ── */
.member-pulse-history {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.72rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.pulse-hist-label {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-dim);
}
.pulse-hist-dots {
  display: inline-flex;
  gap: 1px;
  letter-spacing: 1px;
}
.pulse-hist-chip { cursor: default; line-height: 1; }
.pulse-hist-latest {
  color: var(--text-main, #e2e8f0);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}
