/* ── LOADING OVERLAY ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
#loading-overlay.visible {
  display: flex;
}
.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(91, 192, 91, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  min-width: 260px;
}
.loading-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}
.loading-msg {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 1.2em;
  transition: opacity 0.15s;
}
.loading-filename {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--green-light);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── MEMBERS SECTION ── */
#members-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg2);
}

#members-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

#search-input {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.82rem;
  padding: 5px 10px;
  border-radius: 3px;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}
#search-input:focus {
  border-color: var(--green);
}
#search-input::placeholder {
  color: var(--text-muted);
}

#search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
}

#filter-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  align-items: center;
}
.filter-tag {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--green-dark);
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  padding: 3px 8px 3px 10px;
  border-radius: 12px;
}
.filter-tag-remove {
  cursor: pointer;
  opacity: 0.7;
  font-size: 0.85rem;
  line-height: 1;
}
.filter-tag-remove:hover {
  opacity: 1;
}

#active-season-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg);
  border-bottom: 2px solid var(--green);
  padding: 5px 14px;
  flex-shrink: 0;
}
#active-season-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--green-light);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#upload-btn {
  background: var(--green);
  border: none;
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.15s;
}
#upload-btn:hover {
  background: var(--green-light);
}

#clear-btn {
  background: var(--red);
  border: none;
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.15s;
}

#table-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
}
#table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
#table-wrap::-webkit-scrollbar-track {
  background: var(--bg2);
}
#table-wrap::-webkit-scrollbar-thumb {
  background: var(--bg4);
  border-radius: 3px;
}

#members-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
#members-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
#members-table th {
  background: var(--bg3);
  color: var(--text-muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
#members-table th:hover {
  color: var(--text);
}
#members-table th.sort-asc::after {
  content: " ↑";
  color: var(--accent);
}
#members-table th.sort-desc::after {
  content: " ↓";
  color: var(--accent);
}

#members-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
#members-table tbody tr:hover {
  background: var(--bg3);
}

.cat-badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 0.85rem;
}
.no-data span {
  display: block;
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: 0.3;
}

/* ── STATS SECTION ── */
#stats-section {
  height: var(--stats-h);
  background: var(--bg);
  border-top: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
#stats-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}
#stats-header .toolbar-label {
  color: rgba(255, 255, 255, 0.7);
}

#season-tabs {
  display: none;
  gap: 4px;
}
.season-tab {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  padding: 4px 12px;
  border-radius: 3px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.15s;
  letter-spacing: 0.04em;
}
.season-tab:hover {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
}
.season-tab.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

#season-select {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

#stats-clear-btn {
  margin-left: auto;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.05em;
}
#stats-clear-btn:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
}

#stats-grid {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  flex: 1;
  align-items: flex-start;
}
#stats-grid::-webkit-scrollbar {
  height: 4px;
}
#stats-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 90px;
  flex-shrink: 0;
  user-select: none;
  position: relative;
}
.stat-card:hover {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.35);
}
.stat-card.selected {
  border-color: var(--green);
  background: rgba(58, 156, 58, 0.25);
}
.stat-card.selected::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.65rem;
  color: var(--accent);
}
.stat-cat-name {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}
.stat-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.6rem;
  font-weight: 600;
  color: #fff;
  line-height: 1;
}
.stat-years {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
  text-align: center;
}
.stat-card-uncat {
  border-color: rgba(255, 100, 100, 0.3);
}
.stat-card-uncat .stat-cat-name {
  color: rgba(255, 180, 180, 0.9);
}

.stat-main-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.stat-inactive {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.75;
}

.stat-gender-row {
  margin-top: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.stat-gender-row .male {
  color: var(--blue);
}

.stat-gender-row .female {
  color: var(--red);
}

.stat-gender-row .sep {
  color: var(--text-muted);
}

