:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6a65;
  --line: #e3e1db;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --ok: #2f7d4f;
  --warn: #b7791f;
  --err: #b3261e;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --surface: #1f1f1d;
    --ink: #ecebe6;
    --muted: #a09e97;
    --line: #33322f;
    --accent: #7fb8a4;
    --accent-ink: #10201b;
    --ok: #6cc48f;
    --warn: #e0b25c;
    --err: #f08a80;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.top {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); letter-spacing: -0.01em; }
nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
nav a { text-decoration: none; color: var(--ink); }
nav a:hover { color: var(--accent); }
main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin: 16px 0;
}
.card.narrow { max-width: 440px; margin: 48px auto; }
.card.empty { border-style: dashed; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.grid .card { margin: 0; }
.grid + .card { margin-top: 16px; }
.muted { color: var(--muted); }
label { display: block; font-weight: 600; margin: 12px 0 6px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
input[type=email], input[type=password], input[type=text], input[type=search], input:not([type]),
textarea, select {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
input.code { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
textarea { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button {
  display: inline-block; margin-top: 12px; padding: 10px 16px; font: inherit; font-weight: 600;
  color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 8px;
  cursor: pointer; text-decoration: none;
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.danger { background: var(--err); color: #fff; }
button.link { background: none; color: var(--accent); padding: 0; margin: 0; font-weight: 400; }
button.link.danger { color: var(--err); margin-top: 8px; }
button[disabled] { opacity: .6; cursor: progress; }
form.inline { display: inline; }
.note { padding: 10px 12px; border-radius: 8px; background: var(--bg); border-left: 3px solid var(--line); }
.note.ok { border-color: var(--ok); }
.note.warn { border-color: var(--warn); }
.note.err, .err { border-color: var(--err); color: var(--err); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.row { display: flex; gap: 16px; align-items: center; }
.row button { margin-top: 12px; }
.row span { margin-top: 12px; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.files li:last-child { border-bottom: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
td button.link, td button.link.danger { margin: 0; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.danger-zone { border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }

/* Spend counter (decision 0009) */
.spend { flex-basis: 100%; margin: 0; font-size: .85rem; color: var(--muted); }
.spend a { color: inherit; }
.spend a:hover { color: var(--accent); }
.spend a.warn { color: var(--warn); font-weight: 600; }

/* Chat */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.chat-title { font-size: 1.2rem; overflow-wrap: anywhere; }
.thread { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.msg { padding: 12px 14px; border-radius: var(--radius); overflow-wrap: anywhere; }
/* The person's messages: a tinted bubble, deliberately unlike the solid buttons. */
.msg.user {
  align-self: flex-end; max-width: 88%; white-space: pre-wrap;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--surface));
  border-bottom-right-radius: 4px;
}
.msg.assistant { background: var(--surface); border: 1px solid var(--line); }
.msg .md > :first-child { margin-top: 0; }
.msg .md > :last-child { margin-bottom: 0; }
.msg .md table { border-collapse: collapse; display: block; overflow-x: auto; }
.msg .md th, .msg .md td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.msg .md pre { overflow-x: auto; background: var(--bg); padding: 10px; border-radius: 8px; }
.msg .progress, .msg .cost { font-size: .85rem; margin: 8px 0 0; }
.msg .note { margin: 8px 0 0; }
.cost { font-variant-numeric: tabular-nums; }
.spinner {
  display: inline-block; width: .8em; height: .8em; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.composer textarea { font-family: inherit; font-size: 16px; }
.chat-delete { margin-top: 8px; }

/* Setup and documents (decision 0010) */
ul.links { list-style: none; padding: 0; margin: 12px 0 0; display: flex; gap: 16px; flex-wrap: wrap; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.attach { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted);
  font-size: .9rem; min-width: 0; }
.attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.attach:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55vw; }
.attach.has-file { color: var(--ink); }
.file-chip { display: block; margin-bottom: 6px; color: inherit; font-size: .9rem; text-decoration: underline; }
.msg .md a { overflow-wrap: anywhere; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -4px; }
.choices form { margin: 0; width: auto; display: block; }
button.choice { background: var(--surface); color: var(--accent); border: 1px solid var(--accent);
  border-radius: 999px; padding: 8px 14px; font-weight: 500; }
button.choice:hover { background: var(--accent); color: var(--accent-ink); }
.choices.answered { display: none; }

/* Vacancies feed, cards, tracker (decision 0011) */
.small { font-size: .85rem; }
.search { display: flex; gap: 8px; margin: 16px 0 8px; }
.search input { flex: 1; min-width: 0; font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; align-items: center; }
.chips a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); font-size: .9rem; }
.chips a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips a.csv { border: 0; margin-left: auto; color: var(--accent); text-decoration: underline; }
.feed { display: flex; flex-direction: column; gap: 12px; }
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; }
.vcard.not_fit, .vcard.closed, .vcard.rejected { opacity: .7; }
.vcard-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.vcard-title { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
  flex: 1; min-width: 0; }
.vcard-title:hover { text-decoration: underline; }
.vcard-meta { margin: 4px 0 0; font-size: .9rem; }
.vcard-summary { margin-top: 8px; }
.vcard .progress { margin: 8px 0 0; }
.status-chip { font-size: .8rem; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.score { font-weight: 700; font-size: .85rem; border-radius: 6px; padding: 1px 6px;
  background: var(--line); color: var(--ink); white-space: nowrap; }
.score.s4, .score.s5 { background: var(--ok); color: var(--surface); }
.score.s1, .score.s2 { background: color-mix(in srgb, var(--err) 25%, var(--surface)); }
ul.docs { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 4px; }
ul.docs a::before { content: "📄 "; }
.vcard-actions { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin-top: 10px; }
.vcard-actions form { margin: 0; }
.pager { display: flex; justify-content: space-between; margin: 16px 0; }
.vacancy-head h1 { margin-bottom: 4px; }
.status-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-form select, .tstatus select { font-size: 16px; width: auto; padding: 8px 10px; }
.search input { width: auto; }
.paste textarea { font-family: inherit; font-size: 16px; }
details { margin-top: 12px; }
details summary { cursor: pointer; color: var(--accent); }
.tracker { display: flex; flex-direction: column; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); }
.trow { display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-top: 1px solid var(--line); }
.trow:first-child { border-top: 0; }
.tmain { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tmain a { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.tstatus { margin: 0; flex: 0 0 auto; }
.tracker-link { margin-left: 16px; }
ul.attachments li { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
ul.attachments form { margin: 0; }
button.link.on { color: var(--ok); font-weight: 600; }
.upload-form { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 14px; }
.check { display: inline-flex; gap: 6px; align-items: center; }
.package-link { font-weight: 600; }
