:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #5f6b7a;
  --border: #dde2e8;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --sidebar: #eef1f5;
  --error: #b42318;
  --ok-bg: #e7f6ec;
  --ok-text: #1e6b3a;
  --warn-bg: #fff4e0;
  --warn-text: #8a5300;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --surface: #1c2026;
    --text: #e6e9ed;
    --muted: #98a2b0;
    --border: #2e343c;
    --accent: #7c9cf0;
    --accent-text: #0e1116;
    --sidebar: #181b20;
    --error: #f2786d;
    --ok-bg: #173323;
    --ok-text: #8fd9a8;
    --warn-bg: #3a2c10;
    --warn-text: #f2c477;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
}
.brand { font-weight: 600; margin-bottom: 1.25rem; padding: 0 .5rem; }
nav a {
  display: block;
  padding: .45rem .5rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}
nav a:hover { background: var(--border); }
nav a.active { background: var(--surface); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.logout { margin-top: auto; padding: 0 .5rem; }
main { flex: 1; padding: 2rem; max-width: 760px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.form, .login { display: flex; flex-direction: column; max-width: 380px; }
label { font-weight: 500; margin: .75rem 0 .3rem; }
input[type=password] {
  font: inherit;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  font: inherit;
  margin-top: 1.1rem;
  padding: .6rem 1rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
}
button.link {
  background: none;
  color: var(--muted);
  padding: 0;
  margin: 0;
  font-weight: 400;
  text-decoration: underline;
}
.hint { color: var(--muted); font-size: .88rem; margin: .6rem 0 0; }
.error { color: var(--error); margin: .6rem 0 0; }
.notice { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.notice.ok { background: var(--ok-bg); color: var(--ok-text); }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }
.notice a { color: inherit; font-weight: 600; }
dl { margin: 0; }
dt { color: var(--muted); font-size: .88rem; }
dd { margin: 0 0 .5rem; }

body.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login { width: 100%; max-width: 340px; }
.login h1 { font-size: 1.2rem; margin-bottom: .25rem; }

@media (max-width: 640px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 1rem 16px; }
  nav { display: flex; gap: .25rem; flex-wrap: wrap; }
  .logout { margin-top: .75rem; }
  main { padding: 1.25rem 16px; }
}

.nav-heading { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; margin: 1.25rem .5rem .35rem; }
.ext { color: var(--muted); font-size: .85em; }
.muted { color: var(--muted); }
.sites { list-style: none; margin: 0; padding: 0; }
.sites li { padding: .3rem 0; }
@media (max-width: 640px) { .nav-heading { width: 100%; margin: .75rem 0 .25rem; } }

/* ---------------------------------------------------------------- vacancies */
main.wide { max-width: 1040px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.head-row h1 { margin: 0; }
.hint.top { margin: -.25rem 0 1rem; }
.muted { color: var(--muted); font-weight: 400; }
.nowrap { white-space: nowrap; }
a.button, button.small, a.button.small {
  display: inline-block; font: inherit; font-weight: 600; padding: .5rem .9rem; border-radius: 6px;
  background: var(--accent); color: var(--accent-text); text-decoration: none; border: 0; cursor: pointer;
}
button.small, a.button.small { margin: 0; padding: .28rem .65rem; font-size: .85rem; }
a.button.secondary, button.secondary, a.button.small.secondary { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
button.danger { background: var(--error); color: #fff; }
button[disabled] { opacity: .45; cursor: default; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: .9rem; }
.tabs a { padding: .45rem .8rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-color: var(--accent); font-weight: 600; }
.count { font-size: .8rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.clear { font-size: .85rem; color: var(--muted); }
.relfilter { font-size: .85rem; color: var(--muted); display: flex; gap: .2rem; align-items: center; }
.relfilter a { padding: .15rem .45rem; border-radius: 5px; text-decoration: none; color: var(--muted); }
.relfilter a.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); font-weight: 600; }

/* Search colours: --c is the tag colour, readable on both themes. */
.c-blue { --c: #2f5bd3; } .c-green { --c: #2e8540; } .c-red { --c: #c62828; } .c-orange { --c: #d9690b; }
.c-purple { --c: #7b3fbf; } .c-teal { --c: #00838f; } .c-pink { --c: #c2185b; } .c-yellow { --c: #a87f00; }
.c-brown { --c: #795548; } .c-grey { --c: #5f6b7a; }
@media (prefers-color-scheme: dark) {
  .c-blue { --c: #7c9cf0; } .c-green { --c: #6cc68a; } .c-red { --c: #f2786d; } .c-orange { --c: #f5a25b; }
  .c-purple { --c: #b896ec; } .c-teal { --c: #4fc3cf; } .c-pink { --c: #f07aa9; } .c-yellow { --c: #e3c048; }
  .c-brown { --c: #c4a08f; } .c-grey { --c: #a3adba; }
}
.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .6rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; text-decoration: none; color: var(--c);
  background: color-mix(in srgb, var(--c) 13%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent);
}
.chip::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--c); }
.chip.on { background: var(--c); color: var(--surface); }
.chip.on::before { background: var(--surface); }
.chip.dim { opacity: .5; }
.chip.small { font-size: .75rem; padding: .08rem .5rem; }

.vacancies { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.vacancy {
  display: grid; grid-template-columns: 6.2rem 1fr auto; gap: .9rem; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1rem;
}
.closes { display: flex; flex-direction: column; font-size: .85rem; line-height: 1.3; color: var(--muted); }
.closes strong { color: var(--text); font-size: .92rem; }
.closes.urgent strong, .closes.urgent span { color: var(--error); }
.title-row { display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.vtitle { font-weight: 600; text-decoration: none; }
.vtitle:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: .88rem; }
.summary { margin: .3rem 0 0; font-size: .9rem; }
.foot { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .4rem; }
.note { font-size: .78rem; color: var(--muted); }
.note.warn { color: var(--warn-text); }
.actions { display: flex; flex-direction: column; gap: .3rem; }
.actions button { width: 100%; }
.rel { display: inline-flex; gap: 2px; cursor: help; }
.rel i { width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--muted); }
.rel i.f { background: var(--text); box-shadow: none; }
.rel-4 i.f { background: var(--ok-text); }
.badge { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .1rem .4rem; border-radius: 4px; background: var(--border); color: var(--muted); }
.badge.new { background: var(--ok-bg); color: var(--ok-text); }

.search.paused { opacity: .75; }
.search-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.search-actions { margin-left: auto; display: flex; gap: .35rem; align-items: center; }
.prompt { margin: .6rem 0; white-space: pre-wrap; }
dl.inline { display: grid; grid-template-columns: max-content 1fr; gap: .15rem .9rem; font-size: .9rem; }
dl.inline dd { margin: 0; }
.st { font-weight: 600; text-transform: capitalize; }
.st-success { color: var(--ok-text); } .st-failed { color: var(--error); }
.st-running, .st-pending { color: var(--accent); } .st-retry_wait { color: var(--warn-text); }
.runlog { margin-top: .7rem; font-size: .88rem; }
.runlog summary { cursor: pointer; color: var(--muted); }
.runlog table { width: 100%; border-collapse: collapse; margin-top: .4rem; }
.runlog td { padding: .3rem .4rem; border-top: 1px solid var(--border); vertical-align: top; }
.runlog tr.detail td { border-top: 0; padding-top: 0; }
.runlog pre { white-space: pre-wrap; font: .82rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; max-height: 18rem; overflow: auto; background: var(--bg); padding: .5rem .7rem; border-radius: 6px; }
.runlog .error { margin: 0 0 .3rem; }

.form.wide-form { max-width: 640px; }
input[type=text], input[type=email], textarea, select {
  font: inherit; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text);
}
textarea { resize: vertical; }
label.check { font-weight: 400; display: inline-flex; gap: .35rem; align-items: center; margin: .5rem 0 0; }
.days { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.days label.check { margin: 0; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row button, .row .button { margin-top: 1.1rem; }
.row-form .row button { margin-top: 0; }
.row-form > button { align-self: flex-start; }
.swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch { margin: 0; font-weight: 400; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span {
  display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .82rem; color: var(--c);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); text-transform: capitalize;
}
.swatch input:checked + span { background: var(--c); color: var(--surface); font-weight: 600; }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
details.danger summary { cursor: pointer; color: var(--error); }

@media (max-width: 640px) {
  .vacancy { grid-template-columns: 1fr; gap: .4rem; }
  .closes { flex-direction: row; gap: .5rem; }
  .actions { flex-direction: row; }
  .actions button { width: auto; }
  .search-actions { margin-left: 0; width: 100%; }
}
