/* JobHunt web page. Theme tokens first; dark mode follows the system. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2330;
  --muted: #667085;
  --line: #e3e6ec;
  --accent: #2f6fde;
  --accent-text: #ffffff;
  --good: #1f9d55;
  --warn: #c27c0e;
  --bad: #d64545;
  --bar: #dbe6fb;
  --add: #e6f6ec;
  --del: #fdeaea;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --panel: #1b2029;
    --text: #e6e9ef;
    --muted: #98a1b3;
    --line: #2c3340;
    --accent: #5b8ef0;
    --bar: #253a63;
    --add: #17321f;
    --del: #3a1d1d;
  }
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }
h1 { font-size: 18px; margin: 0; }
h1 a { color: inherit; text-decoration: none; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Layout ── */

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
#search-form { flex: 1; max-width: 420px; }
#search { width: 100%; }

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

#nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
#nav a { color: var(--text); text-decoration: none; padding: 5px 10px; border-radius: 6px; }
#nav a:hover { background: var(--bg); }
#nav a.active { background: var(--bar); font-weight: 500; }
#nav .group { margin: 14px 10px 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

main { max-width: 1100px; width: 100%; padding: 16px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.toolbar h2 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cards .panel { margin-bottom: 0; }
.card .value { font-size: 24px; font-weight: 600; }
.card .label { color: var(--muted); font-size: 13px; }

/* ── Controls ── */

button {
  font: inherit;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.small { padding: 1px 8px; font-size: 12px; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  max-width: 100%;
}
textarea { width: 100%; min-height: 60px; resize: vertical; }
.mono, textarea.editor { font: 13px/1.5 var(--mono); }
.title-input { width: 100%; font-size: 18px; font-weight: 600; }

.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form label.wide { grid-column: 1 / -1; }
.form label.check, label.inline { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.form .status { grid-column: 1 / -1; margin: 0; }

.error { color: var(--bad); min-height: 1em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
td.ok { color: var(--good); }
.status:empty { display: none; }

/* ── Tables & tags ── */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.selected { background: var(--bg); }
td.num, th.num { text-align: right; }

.tag {
  display: inline-block;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}
a.tag:hover { border-color: var(--accent); }
.tag.rejected, .tag.ghosted, .tag.withdrawn, .tag.declined, .tag.bad, .tag.fail, .tag.hard { color: var(--bad); border-color: var(--bad); }
.tag.offer, .tag.accepted, .tag.good, .tag.ok, .tag.easy { color: var(--good); border-color: var(--good); }
.tag.gap, .tag.partial, .tag.medium { color: var(--warn); border-color: var(--warn); }

/* ── Bars & timeline ── */

.bar-row, .funnel-row { display: grid; grid-template-columns: 160px 1fr 70px; gap: 8px; align-items: center; margin: 4px 0; }
.bar, .funnel-bar { background: var(--bar); height: 18px; border-radius: 4px; min-width: 2px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; }
pre.letter { white-space: pre-wrap; font: inherit; background: var(--bg); padding: 12px; border-radius: 6px; }
.hits mark { background: var(--bar); color: inherit; border-radius: 2px; }

/* ── Knowledge base ── */

.crumbs { font-size: 13px; color: var(--muted); }
.tree-row.kb-topic a { font-weight: 600; }
.tree-row.kb-topic.empty a { color: var(--muted); font-weight: 400; }
.tree-row.article { border-bottom: none; }
.md a.wikilink.missing { color: var(--warn); text-decoration: underline dashed; }
.sources { margin: 0; padding-left: 24px; }
.source-row { display: grid; grid-template-columns: 2fr 3fr 2fr auto auto auto; gap: 6px; margin-bottom: 6px; }
@media (max-width: 700px) { .source-row { grid-template-columns: 1fr auto auto auto; } .source-row input { grid-column: 1 / -1; } }
.uncovered { margin-bottom: 8px; }
.uncovered code { font-size: 12px; }
.tree-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.prep-topic { padding: 8px 0; border-bottom: 1px solid var(--line); }
.prep-topic ul { margin: 4px 0 0 28px; }

/* ── Interview review ── */

.interview-q { padding: 12px 0; border-top: 1px solid var(--line); scroll-margin-top: 8px; }
.interview-q .toolbar { margin-bottom: 6px; }
.interview-q .fix { background: var(--bg); border-left: 3px solid var(--warn); padding: 6px 10px; border-radius: 0 6px 6px 0; }
.panel[hidden] { display: none; }

/* ── Markdown ── */

.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1 { font-size: 20px; margin: 16px 0 8px; }
.md h2 { font-size: 17px; margin: 16px 0 8px; }
.md h3 { text-transform: none; letter-spacing: 0; color: var(--text); }
.md pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow-x: auto; }
.md pre code.hljs { background: transparent; padding: 0; }
.md code { font: 13px/1.5 var(--mono); }
.md :not(pre) > code { background: var(--bg); padding: 1px 4px; border-radius: 4px; }
.md table { width: auto; }
.md th { text-transform: none; font-size: 13px; }
.md blockquote { margin: 12px 0; padding: 4px 12px; border-left: 3px solid var(--line); color: var(--muted); }

.md .callout { color: var(--text); background: var(--bg); border-radius: 0 6px 6px 0; padding: 8px 12px; }
.md .callout::before { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.md .callout.note { border-color: var(--accent); }
.md .callout.note::before { content: "My note"; color: var(--accent); }
.md .callout.key { border-color: var(--good); }
.md .callout.key::before { content: "Key point"; color: var(--good); }
.md .callout.warn { border-color: var(--warn); }
.md .callout.warn::before { content: "Gotcha"; color: var(--warn); }

/* ── Editor ── */

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
textarea.editor { min-height: 360px; height: 100%; }
.preview { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow: auto; max-height: 70vh; }

/* ── Cards & review ── */

.card-list { display: grid; gap: 8px; margin-bottom: 8px; }
.card-item { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.card-front { font-weight: 600; margin-bottom: 6px; }
.card-back { padding-top: 6px; border-top: 1px dashed var(--line); margin-bottom: 6px; }

.review { max-width: 720px; margin: 0 auto; }
.review .card-front { font-size: 18px; margin: 16px 0; }
.review .card-back { font-size: 16px; padding: 12px 0; }
button.grade.fail { background: var(--bad); border-color: var(--bad); }
button.grade.partial { background: var(--warn); border-color: var(--warn); }
button.grade.ok { background: var(--good); border-color: var(--good); }

.block-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.block-chips button.active { border-color: var(--accent); color: var(--accent); }
.assessment .options { display: grid; gap: 6px; margin-bottom: 12px; }
.assessment .option { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.assessment .option:has(input:checked) { border-color: var(--accent); }
.assessment textarea { margin-bottom: 12px; }

/* ── Diary & diff ── */

.entry { padding: 10px 0; border-bottom: 1px solid var(--line); }
.entry .toolbar { margin-bottom: 4px; }

pre.diff { font: 13px/1.5 var(--mono); border: 1px solid var(--line); border-radius: 6px; padding: 8px 0; overflow-x: auto; }
pre.diff div { padding: 0 12px; white-space: pre-wrap; }
pre.diff .add { background: var(--add); }
pre.diff .del { background: var(--del); }

/* ── Roadmap ── */

.rm-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rm-tabs a { text-decoration: none; }
.rm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rm-key { padding: 1px 8px; border-radius: 4px; border: 1px solid var(--line); font-size: 13px; }
.rm-scroll { overflow: auto; max-height: calc(100vh - 220px); padding: 12px; }
.rm-canvas { position: relative; }
.rm-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.rm-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.rm-line.dashed { stroke-dasharray: 1 7; }
.rm-section { fill: none; stroke: var(--line); stroke-width: 1.5; }
.rm-node {
  position: absolute; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 2px 8px; border: 2px solid var(--text); border-radius: 6px; font-size: 14px; line-height: 1.15;
  color: var(--text); text-decoration: none; overflow: hidden; background: var(--panel);
}
.rm-node.rm-topic { font-weight: 600; }
.rm-node.rm-subtopic { border-width: 1.5px; }
a.rm-node:hover { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 2; }
.rm-node.rm-missing { border-style: dashed; border-color: var(--line); color: var(--muted); }
.rm-node.rm-button { border-color: var(--accent); color: var(--accent); }
.lvl-0 { background: var(--panel); }
.lvl-1 { background: color-mix(in srgb, var(--warn) 25%, var(--panel)); }
.lvl-2 { background: color-mix(in srgb, var(--accent) 25%, var(--panel)); }
.lvl-3 { background: color-mix(in srgb, var(--good) 30%, var(--panel)); }
.rm-node.weak, .rm-key.weak { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.rm-diff { position: absolute; top: 1px; right: 3px; font-size: 10px; font-weight: 700; color: var(--muted); }
.rm-diff.senior { color: var(--bad); }
.rm-text { position: absolute; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--text); }
.rm-text.rm-title { font-size: 26px; font-weight: 700; }
.rm-text.rm-label { font-size: 15px; justify-content: flex-start; text-align: left; }
.rm-text.rm-paragraph { font-size: 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 6px; }

/* ── Topic: dataset blocks ── */

.resources li { margin: 3px 0; }
.tree-toggle { width: 22px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.tree-toggle.leaf { visibility: hidden; }

/* ── Dialog ── */

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .4); }
dialog form { display: flex; flex-direction: column; gap: 8px; min-width: min(320px, 80vw); }

/* ── Phone ── */

@media (max-width: 760px) {
  header { flex-wrap: wrap; }
  #search-form { order: 3; flex-basis: 100%; max-width: none; }
  .layout { grid-template-columns: 1fr; }
  #nav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  #nav .group { display: none; }
  .editor-grid { grid-template-columns: 1fr; }
  .bar-row, .funnel-row { grid-template-columns: 90px 1fr 60px; }
}
