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

:root {
  --bg:           #0d1117;
  --bg-surface:   #161b22;
  --bg-chip:      #1c2230;
  --border:       rgba(255,255,255,0.07);
  --border-med:   rgba(255,255,255,0.12);

  --text-primary:   #e6edf3;
  --text-secondary: #7d8fa8;
  --text-muted:     #7d8fa8;

  --col-standard:   #378ADD;
  --col-highlight:  #EAF93C;   /* highlighted / selected employee dot */
  --col-accent:     #ef7a05;
  --col-fade-alpha: 0.08;

  --font-display: 'Utopia Std', serif;
  --font-mono:    'DM Mono', monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

html, body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-display);
  min-height: 100vh;
  min-height: 100dvh;
}
/* Respect hidden views */
[hidden] {
  display: none !important;
}

/* ─── Page wrapper ──────────────────────────────────────────── */
main {
  width: min(100%, 1400px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(12px, 2.3vw, 32px) clamp(10px, 1.5vw, 20px) clamp(10px, 1.7vw, 24px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.3vw, 16px);
}

/* ─── Header ────────────────────────────────────────────────── */
header {
  border-left: 3px solid var(--col-accent);
  padding-left: 20px;
  position: relative;
  overflow: hidden;
}

/* header::before {
  content: 'VA';
  position: absolute;
  top: -20px;
  right: 0;
  font-family: var(--font-display);
  font-size: clamp(80px, 14vw, 180px);
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,0.04);
  pointer-events: none;
  user-select: none;
  line-height: 1;
  letter-spacing: -4px;
} */

.header-inner { padding-bottom: clamp(10px, 1.8vw, 24px); }

.header-meta {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--col-standard);
  margin-bottom: 8px;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 3.5vw, 40px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

h1 .accent { color: var(--col-accent); }

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: min(480px, 100%);
  line-height: 1.6;
}

/* .header-rule {
  height: 1px;
  background: linear-gradient(90deg, var(--col-accent) 0%, var(--border-med) 60%, transparent 100%);
  margin-left: -20px;
} */

/* ═══════════════════════════════════════════════════════════════
   TABLE VIEW
═══════════════════════════════════════════════════════════════ */

/* ─── Controls ──────────────────────────────────────────────── */
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 20px;
  color: var(--text-muted);
  pointer-events: none;
  line-height: 1;
  top: 50%;
  transform: translateY(-50%);
}

#searchInput {
  width: 100%;
  appearance: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 13px;
  padding: 10px 44px 10px 44px;
  outline: none;
  transition: border-color 0.2s;
}

#searchInput::placeholder { color: var(--text-muted); }
#searchInput:hover { border-color: rgba(255,255,255,0.2); }
#searchInput:focus { border-color: var(--col-standard); }

.clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: none;
  transition: color 0.15s, background 0.15s;
}
.clear-btn:hover   { color: var(--text-primary); background: var(--border-med); }
.clear-btn.visible { display: block; }

.filter-row {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.table-hint.hidden {
  display: none;
} 

.select-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-wrap label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}

select {
  appearance: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 13px;
  padding: 8px 36px 8px 14px;
  cursor: pointer;
  min-width: min(200px, 100%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237d8fa8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s;
  outline: none;
}

select:hover { border-color: rgba(255,255,255,0.2); }
select:focus { border-color: var(--col-standard); }

.result-count {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Table hint ────────────────────────────────────────────── */
.table-hint {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--col-standard);
  letter-spacing: 0.06em;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint-icon { font-size: 13px; }

/* ─── Table container ───────────────────────────────────────── */
.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr { border-bottom: 1px solid var(--border-med); }

th:nth-child(1), td:nth-child(1) { width: 28%; }
th:nth-child(2), td:nth-child(2) { width: 22%; }
th:nth-child(3), td:nth-child(3) { width: 32%; }
th:nth-child(4), td:nth-child(4) { width: 18%; }

th {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: clamp(7px, 0.9vw, 12px) clamp(7px, 1.15vw, 16px);
  text-align: left;
  white-space: nowrap;
  user-select: none;
  background: var(--bg-chip);
}

th:first-child { border-radius: var(--radius-lg) 0 0 0; }
th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }

th.sortable { cursor: pointer; transition: color 0.15s; }
th.sortable:hover { color: var(--text-secondary); }
th.sort-asc,
th.sort-desc { color: var(--col-standard); }

.sort-arrow { font-size: 10px; margin-left: 4px; opacity: 0.3; }
th.sort-asc  .sort-arrow::after { content: '↑'; opacity: 1; color: var(--col-standard); }
th.sort-desc .sort-arrow::after { content: '↓'; opacity: 1; color: var(--col-standard); }

.num-col { text-align: right; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover      { background: var(--bg-chip); }

/* Clickable name rows */
tbody tr.has-click { cursor: pointer; }

tbody tr.has-click:hover td.name-cell {
  color: var(--col-standard);
  text-decoration: underline;
  text-underline-offset: 3px;
}

td {
  padding: clamp(7px, 0.85vw, 11px) clamp(7px, 1.15vw, 16px);
  color: var(--text-primary);
  vertical-align: middle;
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.agency-cell {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

td.name-cell {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  transition: color 0.15s;
}

td.position-cell {
  font-size: 12px;
  color: var(--text-secondary);
}

td.salary-cell {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--col-standard);
}

mark {
  background: rgba(55, 138, 221, 0.2);
  color: var(--col-standard);
  border-radius: 2px;
  padding: 0 1px;
}

/* ─── Empty state ───────────────────────────────────────────── */
.empty-state {
  padding: 60px 24px;
  text-align: center;
}

.empty-icon {
  display: block;
  font-size: 32px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.empty-state p { font-size: 14px; color: var(--text-secondary); }

/* ─── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 4px;
}

.pagination button {
  background: var(--bg-surface);
  border: 1px solid var(--border-med);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  min-width: 36px;
}

.pagination button:hover {
  border-color: rgba(255,255,255,0.25);
  color: var(--text-primary);
}

.pagination button.active {
  background: var(--col-standard);
  border-color: var(--col-standard);
  color: #0d1117;
  font-weight: 600;
}

.pagination button:disabled { opacity: 0.25; cursor: not-allowed; }

.page-info {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   BEESWARM VIEW
═══════════════════════════════════════════════════════════════ */

#beeswarm-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── Beeswarm header row ───────────────────────────────────── */
.bees-header {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.back-btn {
  appearance: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 12px;
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.back-btn:hover {
  border-color: rgba(255,255,255,0.25);
  color: var(--text-primary);
}

.bees-title-block { flex: 1; min-width: 0; }

.bees-eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--col-standard);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bees-title {
  font-family: var(--font-display);
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* ─── Legend ────────────────────────────────────────────────── */
.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-standard    { background: var(--col-standard);  opacity: 0.65; }
.dot-highlighted { background: var(--col-highlight);  opacity: 0.95; }

.legend-label {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: 12px;
}

/* ─── Stats bar ─────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-chip {
  background: var(--bg-chip);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 130px;
  min-width: 0;
}

.stat-chip--highlight {
  border-color: rgba(239, 159, 39, 0.35);
  background: rgba(239, 159, 39, 0.07);
}

.stat-label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.stat-value--highlight { color: var(--col-highlight); }

/* ─── Chart area ────────────────────────────────────────────── */
.chart-area {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#chart-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

#chart-container svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 260px);
  max-height: calc(100dvh - 260px);
}

/* ─── Beeswarm circles ──────────────────────────────────────── */
.beeswarm-circle {
  cursor: pointer;
  transition: opacity 0.15s;
}

.beeswarm-circle.faded { opacity: 0.06 !important; }

/* ─── Tooltip ───────────────────────────────────────────────── */
.tooltip {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  background: #1c2230;
  border: 1px solid var(--border-med);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  max-width: min(260px, calc(100vw - 32px));
  line-height: 1.6;
  z-index: 20;
  transition: opacity 0.12s;
}

.tooltip .tt-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.tooltip .tt-position {
  font-size: 12px;
  color: var(--text-secondary);
}

.tooltip .tt-agency {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-display);
  margin-bottom: 6px;
}

.tooltip .tt-salary {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--col-standard);
}

.tooltip .tt-salary.is-highlighted { color: var(--col-highlight); }

.tooltip .tt-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ─── Sample note ───────────────────────────────────────────── */
.sample-note {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-muted);
  min-height: 16px;
}

/* ─── SVG axes ──────────────────────────────────────────────── */
.x-axis .domain { stroke: rgba(255,255,255,0.15); }
.x-axis .tick line { stroke: rgba(255,255,255,0.15); }
.x-axis .tick text {
  fill: #7d8fa8;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
}

.x-axis-label {
  fill: #4a5568;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.grid-line {
  stroke: rgba(255,255,255,0.04);
  stroke-dasharray: 3 4;
}

/* ─── Footer ────────────────────────────────────────────────── */
/* ─── Footer Layout ───────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

/* Left side (stacked text) */
.footer-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-muted);
}

/* Right side (logo) */
.footer-right {
  flex-shrink: 0;
}

.vcij-logo {
  width: clamp(86px, 8vw, 110px);
  opacity: 0.85;
}

/* ─── Mobile behavior ─────────────────────────────────────── */
@media (max-width: 700px) {
  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .footer-right {
    align-items: center;
  }
  .vcij-logo {
    width: 100px;
  }
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 700px) {
  main { gap: 10px; }

  header::before { display: none; }

  .filter-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .select-wrap { width: 100%; }
  select { min-width: unset; width: 100%; }
  .result-count { margin-left: 0; }

  h1 { font-size: clamp(24px, 8.5vw, 40px); }
  .subtitle { font-size: 12px; line-height: 1.45; }

  #searchInput {
    font-size: 12px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  th {
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  td,
  td.name-cell,
  td.salary-cell {
    font-size: 10px;
  }

  td.agency-cell,
  td.position-cell {
    font-size: 9px;
  }

  th:nth-child(1), td:nth-child(1) { width: 26%; }
  th:nth-child(2), td:nth-child(2) { width: 24%; }
  th:nth-child(3), td:nth-child(3) { width: 28%; }
  th:nth-child(4), td:nth-child(4) { width: 22%; }

  .pagination {
    gap: 4px;
  }

  .pagination button {
    font-size: 10px;
    padding: 5px 8px;
    min-width: 30px;
  }

  .page-info {
    font-size: 10px;
    margin-left: 4px;
  }

  .bees-header {
    gap: 8px;
  }

  .back-btn {
    width: 100%;
    text-align: center;
  }

  .legend {
    width: 100%;
    gap: 7px;
  }

  .legend-label {
    font-size: 10px;
    margin-right: 6px;
  }

  .stats-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-chip {
    padding: 8px 10px;
  }

  .stat-label {
    font-size: 8px;
    letter-spacing: 0.06em;
  }

  .stat-value {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chart-area {
    overflow: hidden;
  }

  #chart-container {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
  }

  #chart-container svg {
    width: 100%;
    height: auto;
    max-height: calc(100dvh - 330px);
  }

  .x-axis .tick text,
  .x-axis-label {
    font-size: 10px;
  }

  .tooltip {
    font-size: 11px;
    padding: 9px 11px;
  }
}

@media (max-width: 430px) {
  main {
    padding: 8px;
  }

  header {
    padding-left: 12px;
  }

  .header-inner {
    padding-bottom: 8px;
  }

  .controls {
    gap: 8px;
  }

  .table-hint {
    font-size: 10px;
  }

  th {
    padding: 6px 4px;
  }

  td {
    padding: 6px 4px;
  }

  .stats-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-left {
    font-size: 9px;
  }
}