:root {
  --bg: #fbfbfa;
  --panel: #ffffff;
  --ink: #1a1a19;
  --muted: #6b6b66;
  --line: #e4e4e0;
  --accent: #2f6f4f;
  --danger: #9c3b2e;
  --chip: #f0f0ec;
  color-scheme: light dark;
}

/* Dark values are declared twice on purpose. The media query covers the OS
 * setting; the [data-theme] scope covers the dashboard's own toggle, and must
 * win in both directions -- the :not() guard lets an explicit light choice beat
 * OS dark, and :where() keeps the media block's specificity below the toggle's.
 * The chart SVGs use exactly the same pattern, so page and charts switch
 * together rather than one lagging the other. */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --bg: #16161a;
    --panel: #1e1e23;
    --ink: #ecece8;
    --muted: #9a9a94;
    --line: #2e2e35;
    --accent: #6fbf8f;
    --danger: #e08376;
    --chip: #26262d;
  }
}

:root[data-theme="dark"] {
  --bg: #16161a;
  --panel: #1e1e23;
  --ink: #ecece8;
  --muted: #9a9a94;
  --line: #2e2e35;
  --accent: #6fbf8f;
  --danger: #e08376;
  --chip: #26262d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
}

.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}

.bar h1 { font-size: 1rem; margin: 0; font-weight: 620; letter-spacing: -0.01em; }
.stats { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats b { color: var(--ink); font-weight: 600; }

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 0;
  min-height: calc(100vh - 108px);
}

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .queue { max-height: 40vh; }
}

.queue {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--panel);
}

.queue-head {
  display: flex;
  justify-content: space-between;
  padding: .55rem .9rem;
  font-size: .75rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
}

.queue-list { list-style: none; margin: 0; padding: 0; }

.queue-list li {
  padding: .5rem .9rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: baseline;
}

.queue-list li:hover { background: var(--chip); }
.queue-list li[aria-selected="true"] {
  background: var(--chip);
  box-shadow: inset 3px 0 0 var(--accent);
}

.queue-list .term { font-weight: 550; }
.queue-list .freq {
  font-size: .74rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.detail { padding: 1.4rem 1.6rem; overflow-y: auto; }
.detail .empty { color: var(--muted); }
.detail h2 { margin: 0 0 .2rem; font-size: 1.5rem; letter-spacing: -0.02em; }

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .6rem 0 1.1rem;
}

.metric {
  background: var(--chip);
  border-radius: 999px;
  padding: .2rem .6rem;
  font-size: .76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.metric b { color: var(--ink); font-weight: 600; }

.contexts { margin: 0 0 1.3rem; }
.contexts h3, .form h3 {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin: 0 0 .5rem;
}

.snippet {
  border-left: 2px solid var(--line);
  padding: .1rem 0 .1rem .75rem;
  margin-bottom: .7rem;
  font-size: .88rem;
}
.snippet .src { display: block; color: var(--muted); font-size: .74rem; margin-bottom: .15rem; }
.snippet mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 2px; }

.form { border-top: 1px solid var(--line); padding-top: 1rem; max-width: 44rem; }
.field { margin-bottom: .7rem; }
.field label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .2rem; }

.field input {
  width: 100%;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.actions { display: flex; gap: .5rem; margin-top: .9rem; flex-wrap: wrap; }

button {
  font: inherit;
  font-size: .88rem;
  padding: .45rem .9rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
button:hover { background: var(--chip); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.reject { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
button.ghost { display: block; width: calc(100% - 1.8rem); margin: .7rem .9rem; }

.keys {
  border-top: 1px solid var(--line);
  padding: .5rem 1.25rem;
  font-size: .76rem;
  color: var(--muted);
  background: var(--panel);
  display: flex;
  gap: .9rem;
  flex-wrap: wrap;
}

kbd {
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .05rem .3rem;
  font: inherit;
  font-size: .72rem;
}

.toast {
  position: fixed;
  bottom: 3.2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: .45rem .9rem;
  border-radius: 6px;
  font-size: .85rem;
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* --- Dashboard ------------------------------------------------------- */

.bar-right { display: flex; align-items: center; gap: .9rem; }
.linkish { color: var(--muted); text-decoration: none; font-size: .82rem; white-space: nowrap; }
.linkish:hover { color: var(--ink); }
button.icon { font-size: .78rem; padding: .25rem .6rem; }

/* The header's three groups do not fit side by side on a phone; let them wrap
   and drop the stats onto their own line rather than overflowing the viewport. */
@media (max-width: 620px) {
  .bar { flex-wrap: wrap; row-gap: .35rem; padding: .7rem 1rem; }
  .bar-right { flex-wrap: wrap; gap: .6rem; }
  .stats { flex-basis: 100%; order: 3; }
}

.dash { padding: 1.4rem 1.6rem 3rem; max-width: 1180px; margin: 0 auto; }
@media (max-width: 620px) { .dash { padding: 1.1rem 1rem 2rem; } }

.lede { color: var(--muted); font-size: .92rem; max-width: 62ch; margin: 0 0 1.1rem; }
.lede b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.jump { display: flex; gap: 1rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.jump a {
  font-size: .8rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: .1rem;
}
.jump a:hover { color: var(--ink); border-bottom-color: var(--accent); }

.band { margin-bottom: 2.6rem; scroll-margin-top: 4rem; }
.band-head { margin-bottom: .9rem; }
.band-head h2 { font-size: 1.05rem; margin: 0 0 .2rem; letter-spacing: -0.01em; }

.note { color: var(--muted); font-size: .82rem; margin: 0; max-width: 70ch; }
.note.warn { border-left: 2px solid var(--accent); padding-left: .7rem; }

/* Charts carry their own width; one per row past a comfortable reading width
   keeps the 20-bar charts legible instead of squeezing them into a column. */
/* align-items: start, not the default stretch. Charts differ a lot in height
   -- a 20-bar chart beside a 4-bar one -- and stretching every card to its
   row's tallest leaves hundreds of pixels of empty card below the short ones. */
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
  align-items: start;
}
@media (max-width: 700px) { .grid { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  /* Matches the surface the SVG paints for itself, so the chart does not sit
     on a visibly different rectangle from its own background. */
  background: light-dark(#fcfcfb, #1a1a19);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  /* Contains the absolutely-positioned sr-only heading; without a positioned
     ancestor it escapes to the viewport and adds a stray pixel of overflow. */
  position: relative;
}
.card-head h3 { font-size: .82rem; margin: 0; font-weight: 600; }
/* The card header collapses to just its tools once the heading is hidden. */
.card-head:has(> .sr-only) { justify-content: flex-end; }
.card-tools { display: flex; align-items: center; gap: .45rem; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.badge {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .1rem .4rem;
  border-radius: 4px;
  background: var(--chip);
  color: var(--muted);
  white-space: nowrap;
}
.badge.gated { color: var(--danger); }

button.mini { font-size: .72rem; padding: .18rem .45rem; }

.card figure { margin: 0; }
.card svg { display: block; width: 100%; height: auto; }

.tablewrap { display: none; max-height: 22rem; overflow: auto; background: var(--panel); }
.tablewrap.show { display: block; }
.tablewrap table { border-collapse: collapse; width: 100%; font-size: .78rem; }
.tablewrap th, .tablewrap td {
  text-align: left;
  padding: .3rem .6rem;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.tablewrap th { position: sticky; top: 0; background: var(--panel); color: var(--muted); font-weight: 600; }
.tablewrap td.num { text-align: right; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; }
.chip {
  font-size: .78rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.chip:hover { background: var(--chip); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.foot {
  border-top: 1px solid var(--line);
  padding: .7rem 1.6rem;
  font-size: .76rem;
  color: var(--muted);
  background: var(--panel);
}

.loading { padding: 2rem; text-align: center; color: var(--muted); font-size: .85rem; }

/* --- Job listings ----------------------------------------------------- */

.joblist { margin-top: .9rem; }

.joblist ol { list-style: none; margin: 0; padding: 0; }

.joblist li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  margin-bottom: .4rem;
}

.job {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .9rem;
  padding: .55rem .75rem;
  text-decoration: none;
  color: inherit;
}
.job:hover { background: var(--chip); }
.job:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* min-width:0 lets a flex child shrink below its content width; without it the
   row refuses to narrow and pushes the page into horizontal scroll. */
.job-main { min-width: 0; flex: 1; }
.job-title { font-weight: 550; font-size: .88rem; }
/* Long ATS titles are common ("Software Engineer 1 - User Systems, Platform").
   These must be block-level: text-overflow does nothing on an inline element,
   so as spans they silently grew the row instead of truncating. */
.job-title, .job-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-meta { font-size: .76rem; color: var(--muted); margin-top: .1rem; }
.job-side { font-size: .74rem; color: var(--muted); white-space: nowrap; text-align: right; }
.job-side .spon { color: var(--accent); }

.joblist .more {
  font-size: .78rem;
  color: var(--muted);
  padding: .3rem 0;
}

/* The skill chart sits outside the card grid, so nothing bounds it and the SVG
   scales to the full page width -- roughly double the size it was drawn at.
   Cap it near its natural width; the job list below is a list and reads fine
   at full width. */
#skill-focus { max-width: 780px; }
