*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080b0f;
  --surface: #0f1419;
  --surface-2: #111a22;
  --border: #1e2730;
  --text: #e8edf2;
  --muted: #6b7a8d;
  --accent: #21c7d9;
  --mono: "IBM Plex Mono", monospace;
  --sans: "Sora", sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

.local-dev-badge {
  position: fixed;
  bottom: 8px;
  right: 8px;
  z-index: 99999;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: rgba(33, 199, 217, 0.9);
  background: rgba(8, 11, 15, 0.94);
  border: 1px solid rgba(33, 199, 217, 0.35);
  padding: 4px 8px;
  border-radius: 4px;
}

#app {
  display: grid;
  grid-template-rows: auto auto auto auto auto auto auto auto;
  min-height: 100vh;
}

.live-ticker-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 20px;
  background: rgba(33, 199, 217, 0.07);
  border-bottom: 1px solid rgba(33, 199, 217, 0.2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.ticker-meth {
  color: var(--muted);
  font-size: 10px;
  text-decoration: none;
  white-space: nowrap;
}

.ticker-meth:hover {
  color: var(--accent);
}

.top-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
}

.lang-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.lang-switch-spinner {
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  animation: lang-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.lang-switch-spinner[hidden] {
  display: none !important;
}

@keyframes lang-spin {
  to {
    transform: rotate(360deg);
  }
}

.lang-control .lang-btn {
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: rgba(230, 237, 243, 0.92);
  opacity: 0.4;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 2px 4px 4px;
  border-radius: 0;
  cursor: pointer;
  transition: opacity 0.18s ease, color 0.18s ease, border-color 0.18s ease, text-shadow 0.18s ease;
}

.lang-control .lang-btn:hover {
  opacity: 1;
  color: #00d1ff;
  border-bottom-color: rgba(0, 209, 255, 0.35);
  text-shadow: 0 0 14px rgba(0, 209, 255, 0.22);
}

.lang-control .lang-btn.active {
  opacity: 1;
  color: #00d1ff;
  border-bottom-color: rgba(0, 209, 255, 0.65);
  text-shadow: 0 0 16px rgba(0, 209, 255, 0.28);
}

.drawer-footer-ts {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.drawer-footer-k {
  color: var(--accent);
  margin-right: 4px;
}

.brand-name { font-size: 21px; font-weight: 600; }
.brand-name span { color: var(--accent); }
.brand-sub {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 4px;
}

.header-metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.header-stats { display: flex; gap: 14px; align-items: flex-end; }
.header-provenance {
  font-family: var(--mono);
  font-size: 9px;
  color: rgba(107, 122, 141, 0.92);
  letter-spacing: 0.04em;
  max-width: min(420px, 92vw);
  text-align: right;
  line-height: 1.45;
}
.header-emp-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.04em;
  max-width: min(420px, 92vw);
  text-align: right;
  line-height: 1.4;
}
.stat { text-align: right; }
.stat-val { font-family: var(--mono); font-size: 16px; }
.stat-val.accent { color: var(--accent); }
.stat-label {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.executive {
  background: linear-gradient(180deg, rgba(13,20,27,.95), rgba(12,17,23,.95));
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
}

.exec-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.exec-sector-foot {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
}

.exec-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
}

.exec-label {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.exec-list {
  font-size: 12px;
  line-height: 1.45;
}

.exec-list span {
  display: block;
  margin-bottom: 3px;
}

#controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

#search,
#cat-select {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 10px;
}

#search { min-width: 220px; }

.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-label {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 8px;
  cursor: pointer;
  transition: all .18s ease;
}

.pill:hover { border-color: #3e5569; color: var(--text); }
.pill.active { border-color: var(--accent); color: var(--accent); background: rgba(0, 212, 160, 0.09); }
.hidden { display: none; }
.share-btn { margin-left: auto; }

.stress-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.stress-toggle input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

.exec-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.exec-tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 12px;
  cursor: pointer;
}

.exec-tab.active {
  border-color: var(--accent);
  color: var(--accent);
}

.wage-volatility-banner {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid rgba(244, 165, 130, 0.45);
  background: rgba(214, 96, 77, 0.12);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
}

.wage-volatility-banner strong {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f4a582;
  margin-right: 6px;
}

.exec-outlook {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.exec-outlook .outlook-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 12px;
}

.exec-outlook h4 {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  margin: 14px 0 6px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.exec-movers {
  list-style: decimal;
  padding-left: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.exec-movers li { margin-bottom: 4px; }

.low-friction-pill {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(33, 199, 217, 0.45);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

#canvas-wrap {
  position: relative;
  min-height: clamp(420px, 58vh, 760px);
  height: auto;
}

#canvas-wrap #treemap,
#canvas-wrap #treemap-overlay {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
}

#canvas-wrap #treemap-overlay {
  z-index: 4;
  pointer-events: none;
}

#canvas-wrap #treemap {
  z-index: 3;
}

#loading-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: rgba(8, 11, 15, 0.86);
  z-index: 20;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.loading-job-hint {
  display: block;
  max-width: 90%;
  text-align: center;
  margin-top: 6px;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.toast-root {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 220;
  pointer-events: none;
}

.toast-root.toast-root--center {
  top: 50%;
  transform: translate(-50%, -50%);
}

.toast-msg {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(15, 20, 25, 0.96);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.exec-interests-card {
  margin-top: 10px;
}

.exec-interests-list span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#treemap {
  width: 100%;
  height: 100%;
  min-height: 420px;
  display: block;
}

#mobile-list {
  display: none;
  height: 100%;
  overflow: auto;
  padding: 10px;
}

.mobile-category {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.mobile-category-header {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
}

.mobile-category-header:focus-visible,
.pill:focus-visible,
#search:focus-visible,
#cat-select:focus-visible,
.copy-link-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mobile-category-body {
  display: none;
  padding: 6px;
  background: var(--surface);
}

.mobile-category.open .mobile-category-body { display: block; }

.mobile-occ {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px;
  margin-bottom: 6px;
  cursor: pointer;
}

.mobile-occ-name { font-size: 13px; font-weight: 600; }
.mobile-occ-meta {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  display: flex;
  justify-content: space-between;
}

#legend {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

#legend a {
  color: var(--accent);
  text-decoration: none;
}

.disclaimer {
  border-top: 1px solid var(--border);
  padding: 8px 20px 12px;
  color: #8395ab;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
}

.concierge-results {
  border-bottom: 1px solid var(--border);
  background: #0d131a;
  padding: 8px 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.concierge-card {
  border: 1px solid var(--border);
  background: #101820;
  border-radius: 8px;
  padding: 8px;
}

.concierge-title { font-size: 12px; font-weight: 600; }
.concierge-meta {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

#tooltip {
  position: fixed;
  z-index: 80;
  display: none;
  width: 320px;
  pointer-events: none;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(8, 11, 15, .96);
  padding: 12px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, .55);
}

.tt-score {
  font-family: var(--mono);
  font-size: 32px;
  line-height: 1;
}

.tt-name {
  margin-top: 4px;
  font-weight: 600;
  font-size: 14px;
}

.tt-cat {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.tt-meta {
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.tt-radar {
  margin-top: 8px;
  width: 100%;
  height: 130px;
}

#drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, .45);
}

#drawer {
  position: fixed;
  top: 0;
  right: -500px;
  width: min(500px, 92vw);
  height: 100vh;
  z-index: 100;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 14px;
  overflow: auto;
  transition: right .24s ease;
}

#drawer.open { right: 0; }

.drawer-close {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  border-radius: 4px;
  padding: 4px 8px;
  float: right;
  cursor: pointer;
}

.drawer-title { margin-top: 26px; font-size: 20px; font-weight: 600; }
.drawer-score { margin-top: 6px; font-family: var(--mono); font-size: 34px; }
.drawer-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.drawer-item-label {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.drawer-item-val { font-family: var(--mono); margin-top: 4px; font-size: 12px; }
.drawer-item-val.ok { color: #0fa76f; }
.drawer-item-val.warning { color: #f4a582; }
.drawer-item-val.danger { color: #d6604d; }
.drawer-reason { margin-top: 12px; color: var(--muted); line-height: 1.6; font-size: 13px; }

.insight-panel {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.insight-title {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 10px;
  color: #cfd8e3;
  margin-bottom: 8px;
}

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

.insight-item {
  border: 1px solid var(--border);
  background: #11161d;
  padding: 8px;
}

.insight-item .k {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
}

.insight-item .v {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12px;
}

.copy-link-btn {
  margin-top: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 4px;
  padding: 6px 9px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .top-header { flex-direction: column; }
  .header-stats { justify-content: space-between; width: 100%; }
  .lang-control {
    margin-left: auto;
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .exec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  #treemap { display: none; }
  #treemap-overlay { display: none; }
  #mobile-list {
    display: block;
    min-height: 420px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  #legend { display: none; }
  #search { width: 100%; min-width: 0; }
  .share-btn { margin-left: 0; }
  .exec-grid { grid-template-columns: 1fr; }
  .concierge-results { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  #controls {
    position: sticky;
    top: 0;
    z-index: 35;
    background: rgba(15, 20, 25, 0.94);
    backdrop-filter: blur(6px);
    padding: 10px 12px;
    row-gap: 8px;
  }
  .filter-group {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 2px;
  }
  .pill {
    min-height: 34px;
    padding: 7px 10px;
  }
  #search {
    min-height: 36px;
    font-size: 13px;
  }
  #canvas-wrap #treemap,
  #canvas-wrap #treemap-overlay {
    display: none;
  }
  #mobile-list {
    display: block;
    padding: 10px 12px;
  }
  .mob-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    padding: 10px 11px;
    margin-bottom: 8px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "score name wage"
      "score cat cat";
    gap: 4px 8px;
    align-items: center;
    cursor: pointer;
  }
  .mob-score {
    grid-area: score;
    font-family: var(--mono);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    min-width: 34px;
    text-align: center;
  }
  .mob-name {
    grid-area: name;
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mob-wage {
    grid-area: wage;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    justify-self: end;
  }
  .mob-cat {
    grid-area: cat;
    font-family: var(--mono);
    font-size: 10px;
    color: #8ea1b5;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }
  #drawer {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
  }
  .drawer-grid {
    grid-template-columns: 1fr;
  }
}
