/* famjobs — one stylesheet, no framework. Mobile first; tokens on :root, dark mode via prefers-color-scheme. */
:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #f1ece3;
  --ink: #1d2126;
  --ink-2: #4d5560;
  --ink-3: #7a828c;
  --line: #e4ddd1;
  --accent: #b9472a;          /* terracotta */
  --accent-ink: #ffffff;
  --accent-soft: #f8e6df;
  --ok: #2f7d4f;    --ok-soft: #e1f2e7;
  --warn: #9a6a07;  --warn-soft: #fbf0d6;
  --info: #2b5f9e;  --info-soft: #e2ecf8;
  --bad: #b3261e;   --bad-soft: #fbe3e1;
  --muted-soft: #ecebe8;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(29, 33, 38, .06), 0 4px 16px rgba(29, 33, 38, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a; --surface: #1d2024; --surface-2: #24282d; --ink: #eceae6; --ink-2: #b9bcc1; --ink-3: #8b9097;
    --line: #2f343a; --accent: #e07253; --accent-ink: #1b0f0b; --accent-soft: #3a231c;
    --ok: #6fc08f; --ok-soft: #1f3327; --warn: #e3b54a; --warn-soft: #3a3020; --info: #7fb0ec; --info-soft: #1f2c3d;
    --bad: #f08a83; --bad-soft: #3d2221; --muted-soft: #2a2d31;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
@media (min-width: 900px) { body { padding-bottom: 0; } }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
small, .small { font-size: .875rem; }
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Layout ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar__inner { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand__mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: .95rem; }
.nav { display: none; gap: 4px; margin-left: 12px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.topbar__end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
@media (min-width: 900px) { .nav { display: flex; } }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink-3); text-decoration: none; font-size: .72rem; font-weight: 600; }
.tabbar a .icon { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
@media (min-width: 900px) { .tabbar { display: none; } }

.main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 48px; }
.main--narrow { max-width: 640px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid--2 { grid-template-columns: 1fr 1fr; } }
.split { display: grid; gap: 20px; }
@media (min-width: 980px) { .split { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } .split--wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }

/* ── Surfaces ───────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card--flat { box-shadow: none; }
.card--link { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.card--link:hover { border-color: var(--accent); }
.card h2, .card h3 { margin-top: 0; }
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card__head h2, .card__head h3 { margin: 0; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty .icon { width: 44px; height: 44px; color: var(--ink-3); margin-bottom: 8px; }
.hero { padding: 28px 22px; border-radius: var(--radius); background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border: 1px solid var(--line); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--danger { color: var(--bad); }
.btn--sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
form.inline { display: inline; }

/* ── Forms ──────────────────────────────────────────────── */
label, .label { display: block; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field .help, .form-help { color: var(--ink-3); font-size: .875rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=password], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); vertical-align: -4px; margin-right: 6px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; margin-bottom: 8px; }
.form-error, .form-errors li { color: var(--bad); font-size: .9rem; }
.form-errors { list-style: none; padding: 0; margin: 4px 0; }
.form-row { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } .form-row--3 { grid-template-columns: 1fr 1fr 1fr; } }
.choice-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 500; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin: 0; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; background: var(--surface); }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }

/* Tag input (keywords) */
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); min-height: 44px; }
.tags input { border: 0; flex: 1; min-width: 140px; min-height: 32px; padding: 4px; background: transparent; }
.tags input:focus-visible { outline: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .9rem; }
.tag button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 4px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.suggestion { border: 1px dashed var(--line); background: transparent; color: var(--ink-2); border-radius: 999px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: .9rem; }
.suggestion:hover { border-color: var(--accent); color: var(--accent); }

/* ── Badges, chips, score ───────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--muted-soft); color: var(--ink-2); white-space: nowrap; }
.badge--neutral { background: var(--muted-soft); color: var(--ink-2); }
.badge--waiting { background: var(--warn-soft); color: var(--warn); }
.badge--progress { background: var(--info-soft); color: var(--info); }
.badge--success, .badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--danger, .badge--error { background: var(--bad-soft); color: var(--bad); }
.badge--muted, .badge--off, .badge--unknown { background: var(--muted-soft); color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: .85rem; }
.score {
  --c: var(--ink-3); width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 1.15rem; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 2px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.score--high { --c: var(--ok); } .score--mid { --c: var(--warn); } .score--low { --c: var(--ink-3); }
.score--lg { width: 64px; height: 64px; font-size: 1.5rem; }

/* ── Match cards ────────────────────────────────────────── */
.match { display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.match__title { font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.match__title:hover { color: var(--accent); }
.match__meta { color: var(--ink-2); font-size: .92rem; display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 2px 0 8px; }
.match__meta span { display: inline-flex; gap: 4px; align-items: center; }
.match__why { color: var(--ink-2); margin-bottom: 10px; }
.match__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pros, .cons { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 4px; }
.pros li::before { content: "✓ "; color: var(--ok); font-weight: 800; }
.cons li::before { content: "! "; color: var(--warn); font-weight: 800; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters select, .filters input { width: auto; min-height: 40px; }
.pill-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.pill-nav a { padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; font-size: .92rem; }
.pill-nav a[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ── Flash ──────────────────────────────────────────────── */
.flash { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.flash--success { background: var(--ok-soft); color: var(--ok); }
.flash--error { background: var(--bad-soft); color: var(--bad); }
.flash--info { background: var(--info-soft); color: var(--info); }
.flash--warning { background: var(--warn-soft); color: var(--warn); }

/* ── Steps (onboarding) ─────────────────────────────────── */
.steps { display: flex; gap: 8px; margin-bottom: 20px; }
.steps li { flex: 1; list-style: none; height: 6px; border-radius: 999px; background: var(--line); }
.steps li.is-done, .steps li.is-current { background: var(--accent); }
.steps { padding: 0; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table a.rowlink { color: var(--ink); font-weight: 600; text-decoration: none; }
.table a.rowlink:hover { color: var(--accent); }
@media (max-width: 759px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 8px 4px; background: var(--surface); }
  .table--cards td { border: 0; padding: 4px 12px; }
  .table--cards td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); font-size: .85rem; }
}
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat__value { font-size: 1.6rem; font-weight: 800; }
.stat__label { color: var(--ink-3); font-size: .85rem; }

/* ── Timeline ───────────────────────────────────────────── */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 18px 44px; }
.timeline__dot { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); display: grid; place-items: center; color: var(--ink-2); }
.timeline__dot .icon { width: 16px; height: 16px; }
.timeline__when { color: var(--ink-3); font-size: .85rem; }
.timeline__what { font-weight: 600; }

/* ── Job ad text ────────────────────────────────────────── */
.jobtext { white-space: pre-line; color: var(--ink-2); max-height: 70vh; overflow: auto; font-size: .95rem; }
.attribution { font-size: .8rem; color: var(--ink-3); }

/* ── Documents (CV / letter editor) ─────────────────────── */
.doc-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.doc-paper { background: #fff; color: #1d2126; border-radius: 6px; box-shadow: var(--shadow); padding: 36px 40px; max-width: 820px; margin: 0 auto; }
@media (max-width: 640px) { .doc-paper { padding: 20px 16px; } }
.doc-block { position: relative; border-radius: 6px; padding: 2px 4px; margin: 0 -4px; }
.doc-block.is-editable:hover { background: #fbf3ef; outline: 1px dashed #e0b8aa; }
.doc-block__tools { position: absolute; right: 4px; top: 2px; display: none; gap: 4px; }
.doc-block.is-editable:hover .doc-block__tools, .doc-block:focus-within .doc-block__tools { display: flex; }
.doc-block__tools .btn { min-height: 30px; padding: 3px 8px; font-size: .8rem; background: #fff; color: #1d2126; }
.doc-warn { border-left: 4px solid var(--warn); background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
.versions { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.versions a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.versions a:hover { background: var(--surface-2); }
.versions a[aria-current="true"] { background: var(--accent-soft); }
.copyfield { display: flex; gap: 6px; align-items: flex-start; }
.copyfield textarea, .copyfield input { flex: 1; }

/* ── Misc ───────────────────────────────────────────────── */
details.disclosure > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); list-style: none; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "▸ "; }
details.disclosure[open] > summary::before { content: "▾ "; }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.working { display: flex; gap: 10px; align-items: center; color: var(--ink-2); padding: 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.kbd { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 420px; }
.footer { max-width: 1120px; margin: 0 auto; padding: 0 16px 24px; color: var(--ink-3); font-size: .85rem; display: flex; gap: 14px; flex-wrap: wrap; }
.footer a { color: var(--ink-3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; color: var(--ink-2); text-decoration: none; border: 1px solid var(--line); }
@media print { .topbar, .tabbar, .footer, .no-print { display: none !important; } body { background: #fff; padding: 0; } }
