@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

:root {
  --bg:     #ffffff;
  --bg2:    #f7f6f3;
  --bg3:    #eeece8;
  --line:   #e8e5df;
  --ink:    #111111;
  --ink2:   #444444;
  --ink3:   #888888;
  --accent: #c0392b;      /* warm red — distinct, not techy */
  --accent2: #f9ebe9;
  --text:   #111111;
}

html { font-size: 16px; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Loading screen ── */
.loading-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg); gap: 24px;
}
.loading-wordmark {
  font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink3);
}
.loading-bar {
  width: 120px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden;
}
.loading-fill {
  height: 100%; width: 40%; background: var(--accent); border-radius: 2px;
  animation: loadSlide 1s ease-in-out infinite;
}
@keyframes loadSlide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ── Quarter nav ── */
.quarter-nav { display: flex; align-items: center; gap: 6px; }
.qnav-btn {
  background: none; border: none; padding: 0 2px; cursor: pointer;
  font-size: 1.4em; line-height: 1; color: var(--ink2);
  transition: color .12s;
}
.qnav-btn:hover:not(:disabled) { color: var(--accent); }
.qnav-btn:disabled { color: var(--line); cursor: default; }


/* ── Hero ── */
.hero {
  padding: 28px 40px 0;
  border-bottom: 1px solid var(--line);
}
.hero-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
  margin-bottom: 12px;
}
.hero-title span { color: var(--accent); }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}
.hero-stat {
  padding: 18px 24px 18px 0;
}
.hero-stat-num {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  height: 1.85rem;
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  white-space: nowrap;
}
.hero-stat-num .prefix { font-size: .7em; margin-right: 0.5px; letter-spacing: 0; }
.hero-stat-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink3); }
.hero-stat-sub { font-size: .65rem; color: var(--ink3); margin-top: 2px; }

/* ── Layout ── */
.body-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: calc(100vh - 300px);
}

/* ── Left: lookup ── */
.lookup {
  padding: 40px 36px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.lookup-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}
.pos-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: .95rem;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color .15s;
}
.pos-input::placeholder { color: var(--ink3); }
.pos-input:focus { border-color: var(--accent); }

.pos-results { margin-top: 6px; display: flex; flex-direction: column; }
.pos-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  border-radius: 6px;
  cursor: pointer;
  gap: 8px;
  transition: background .1s;
}
.pos-row:hover { background: var(--bg2); }
.pos-row.active { background: var(--accent2); }
.pos-row-name { font-size: .88rem; font-weight: 600; color: var(--ink); flex: 1; }
.pos-row-count { font-size: .75rem; color: var(--ink3); white-space: nowrap; }
.pos-row-median { font-size: .88rem; font-weight: 800; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── Range card ── */
.range-card {
  background: var(--bg2);
  border-radius: 10px;
  padding: 24px 22px;
}
.range-card-title { font-size: 1.1rem; font-weight: 800; color: var(--ink); margin-bottom: 2px; }
.range-card-sub { font-size: .78rem; color: var(--ink3); margin-bottom: 22px; }

.range-bar-wrap { margin-bottom: 8px; }
.range-bar-track {
  height: 10px;
  border-radius: 5px;
  background: var(--bg3);
  position: relative;
}
.range-bar-fill {
  position: absolute;
  height: 100%;
  border-radius: 5px;
  background: var(--accent);
  opacity: .2;
}
.range-bar-needle {
  position: absolute;
  width: 3px;
  height: 20px;
  top: -5px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateX(-50%);
}
.range-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: .68rem;
  color: var(--ink3);
  margin-top: 5px;
}

.range-trio {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}
.range-trio-cell {
  background: var(--bg);
  padding: 16px 14px;
}
.range-trio-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.range-trio-key {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink3);
  margin-top: 4px;
}
.range-min-max {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: .75rem;
  color: var(--ink3);
}

.mini-trend-wrap { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.mini-trend-heading { font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); margin-bottom: 8px; }
.mini-ctrl-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.mini-pills { display: flex; gap: 2px; }
.mini-pill, .mini-q {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: .68rem;
  font-weight: 700;
  color: var(--ink3);
  cursor: pointer;
  transition: all .12s;
}
.mini-pill.active, .mini-q.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.mini-pill:not(.active):hover, .mini-q:not(.active):hover { border-color: var(--ink); color: var(--ink); }
.mini-chart-wrap { position: relative; height: 200px; }

/* ── Main trend quarter filter ── */
.trend-q-row { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.trend-q-label { font-size: .72rem; font-weight: 700; color: var(--ink3); margin-right: 2px; }
.trend-q {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: transparent;
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink3);
  cursor: pointer;
  transition: all .12s;
}
.trend-q.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.trend-q:not(.active):hover { border-color: var(--ink); color: var(--ink); }
.trend-q-note { font-size: .75rem; color: #92400e; background: #fef3c7; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; line-height: 1.5; }
.q4-notice { font-size: .78rem; color: #92400e; background: #fef3c7; padding: 10px 40px; line-height: 1.5; border-top: 1px solid #fde68a; }

.range-staff-list { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.range-staff-heading { font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); margin-bottom: 8px; }
.range-staff-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .78rem; }
.range-staff-row:last-of-type { border-bottom: none; }
.range-staff-name { font-weight: 700; color: var(--ink); }
.range-staff-office { color: var(--ink3); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.range-staff-amt { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; white-space: nowrap; }
.range-staff-more { font-size: .72rem; color: var(--ink3); padding-top: 8px; }

.lookup-hint {
  font-size: .85rem;
  color: var(--ink3);
  line-height: 1.7;
}

/* ── Right: tabs ── */
.right-panel { display: flex; flex-direction: column; }

.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 36px;
}
.tab-btn {
  padding: 16px 0;
  margin-right: 32px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink3);
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--ink); }

.tab-pane { display: none; padding: 36px 36px; }
.tab-pane.active { display: block; }

.pane-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink3);
  margin-bottom: 16px;
}

.chart-wrap { position: relative; height: 270px; }
.chart-wrap.tall { height: 320px; }
.chart-svg-wrap { width: 100%; height: 100%; }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Office type bars ── */
.type-bars { display: flex; flex-direction: column; gap: 22px; }
.type-row { display: flex; align-items: center; gap: 14px; }
.type-label {
  width: 100px;
  flex-shrink: 0;
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink);
}
.type-label-sub { font-size: .7rem; font-weight: 400; color: var(--ink3); }
.type-track-wrap { flex: 1; position: relative; height: 36px; display: flex; align-items: center; }
.type-track { position: absolute; border-radius: 4px; }
.type-bg { height: 6px; background: var(--bg3); left: 0; right: 0; }
.type-iqr { height: 6px; background: var(--accent); opacity: .2; }
.type-needle { width: 2px; height: 18px; background: var(--accent); transform: translateX(-50%); }
.type-val { font-size: .85rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; width: 52px; text-align: right; }

/* ── Trend mode switcher ── */
.trend-mode-row { display: flex; gap: 2px; margin-bottom: 16px; background: var(--bg3); border-radius: 8px; padding: 3px; width: fit-content; }
.trend-mode {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink3);
  cursor: pointer;
  transition: all .15s;
}
.trend-mode.active { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.trend-mode:not(.active):hover { color: var(--ink); }

/* ── Trend pills ── */
.trend-pills { display: flex; gap: 6px; margin-bottom: 18px; }
.pill {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: transparent;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink3);
  cursor: pointer;
  transition: all .15s;
}
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill:not(.active):hover { border-color: var(--ink); color: var(--ink); }

/* ── Table ── */
.table-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.t-input, .t-select {
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  font-size: .82rem;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color .15s;
}
.t-input { flex: 1; min-width: 150px; }
.t-input::placeholder { color: var(--ink3); }
.t-input:focus, .t-select:focus { border-color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: .82rem; }
thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink3);
  border-bottom: 2px solid var(--ink);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
thead th:hover { color: var(--ink); }
thead th.sorted { color: var(--accent); }
.sort-icon { margin-left: 3px; opacity: .45; }
thead th.sorted .sort-icon { opacity: 1; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg2); }
.td-name { font-weight: 700; color: var(--ink); }
.td-office { font-size: .75rem; color: var(--ink3); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-title { font-size: .78rem; color: var(--ink2); }
.td-amt { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.td-amt-q { font-variant-numeric: tabular-nums; color: var(--ink3); }

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.badge-member         { background: #dbeafe; color: #1e40af; }
.badge-committee      { background: #d1fae5; color: #065f46; }
.badge-leadership     { background: #fef3c7; color: #92400e; }
.badge-administrative { background: #f3f4f6; color: #4b5563; }
.badge-intern         { background: #fce7f3; color: #9d174d; }
.badge-shared         { background: #f3f4f6; color: #6b7280; }

.table-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: .78rem; color: var(--ink3); }
.pagination { display: flex; gap: 3px; }
.page-btn {
  padding: 4px 9px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  font-size: .78rem;
  color: var(--ink3);
  transition: all .15s;
}
.page-btn:hover, .page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* ── Office list ── */
.office-toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.office-list { display: flex; flex-direction: column; }
.office-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .1s;
  border-radius: 4px;
}
.office-row:hover { background: var(--bg2); padding-left: 6px; padding-right: 6px; margin: 0 -6px; }
.office-row:last-child { border-bottom: none; }
.office-name { font-size: .88rem; font-weight: 700; color: var(--ink); }
.office-count { font-size: .75rem; color: var(--ink3); white-space: nowrap; }
.office-range { font-size: .88rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.office-range-sep { color: var(--ink3); font-weight: 400; margin: 0 2px; }
.office-chevron { font-size: 1rem; color: var(--ink3); transition: transform .15s; flex-shrink: 0; }

.office-detail { background: var(--bg2); border-radius: 8px; margin: 4px 0 10px; padding: 16px 18px; }
.office-detail-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 0; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--line); }
.office-detail-stat { background: var(--bg); padding: 12px 14px; }
.office-detail-val { font-size: 1.1rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.office-detail-key { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink3); margin-top: 3px; }
.office-staff-list { display: flex; flex-direction: column; gap: 0; }
.office-staff-row { display: grid; grid-template-columns: 1fr 1fr 90px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .82rem; }
.office-staff-row:last-of-type { border-bottom: none; }
.office-staff-name { font-weight: 700; color: var(--ink); }
.office-staff-title { color: var(--ink3); font-size: .78rem; }
.office-staff-amt { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; white-space: nowrap; }
.office-staff-more { font-size: .75rem; color: var(--ink3); padding-top: 8px; }
.office-detail-empty { font-size: .82rem; color: var(--ink3); }

/* ── Person links ── */
.person-link { cursor: pointer; color: inherit; text-decoration: none; }
.person-link:hover { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }

/* ── Person modal ── */
.person-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
  animation: fadeIn 150ms ease-out;
}
.person-modal {
  background: var(--bg); border-radius: 14px; box-shadow: 0 8px 40px rgba(0,0,0,.18);
  width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto;
  padding: 32px 36px 28px; position: relative;
  animation: modalSlide 200ms ease-out;
}
@keyframes modalSlide { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.person-modal-close {
  position: absolute; top: 16px; right: 18px;
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; line-height: 1; color: var(--ink3); padding: 4px 6px;
}
.person-modal-close:hover { color: var(--ink); }
.person-modal-name { font-size: 1.4rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.person-modal-meta { font-size: .8rem; color: var(--ink3); margin-top: 3px; }
.person-modal-salary { font-size: 2rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.03em; margin: 16px 0 2px; }
.person-modal-salary-sub { font-size: .75rem; color: var(--ink3); margin-bottom: 16px; }
.person-modal-yoy { font-size: .85rem; margin: 4px 0 18px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.person-modal-yoy-label { font-size: .75rem; color: var(--ink3); }
.person-modal-section { font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); margin: 20px 0 10px; }
.person-modal-chart { height: 220px; margin-bottom: 4px; }
.person-modal-comp-row { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--ink2); }
.person-modal-comp-row:last-child { border-bottom: none; }
.person-modal-comp-you { font-weight: 800; color: var(--ink); background: var(--accent2); margin: 0 -8px; padding: 6px 8px; border-radius: 4px; }
.person-modal-comp-label { font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); margin-bottom: 8px; }
.person-comp-title-link { color: var(--ink2); cursor: pointer; border-bottom: 1px dashed var(--ink3); }
.person-comp-title-link:hover { color: var(--ink); border-color: var(--ink); }

/* ── Office total payroll ── */
.office-total-payroll { font-size: .75rem; color: var(--ink3); margin: 10px 0 4px; }
.office-total-payroll strong { color: var(--ink); }

/* ── Salary cap warning ── */
.cap-warn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .68rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Footer ── */
.site-footer { border-top: 1px solid var(--line); padding: 20px 40px; }
.site-footer-primary {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 0;
  font-size: .72rem; color: var(--ink3);
}
.site-footer-brand { font-weight: 700; color: var(--ink2); }
.site-footer-sep { margin: 0 8px; }
.site-footer-copy { color: var(--ink3); }
.site-footer-link { color: var(--ink3); text-decoration: none; }
.site-footer-link:hover { color: var(--ink); }
.site-footer-secondary {
  margin-top: 8px; font-size: .68rem; color: var(--ink3); line-height: 1.5;
}
.site-footer-secondary a { color: var(--ink3); text-decoration: underline; text-underline-offset: 2px; }

/* ── Error ── */
.error-msg { padding: 40px; color: var(--accent); font-size: .9rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
  nav { padding: 16px 20px; }
  .hero { padding: 20px 20px 0; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .body-grid { grid-template-columns: 1fr; }
  .lookup { border-right: none; border-bottom: 1px solid var(--line); padding: 28px 20px; }
  .tab-pane { padding: 24px 20px; }
  .tab-nav { padding: 0 20px; }
  footer { padding: 16px 20px; }
}
