/* Sky over neutrals: one blue does the work, everything structural is a cool
   grey. The verdict colours stay a deliberate green-amber-orange-slate scale so
   a glance down the column reads as best-to-worst. Every foreground/background
   pair used for text clears WCAG AA in both themes. */
:root {
  --bg: #f6f8fa;          /* cool neutral */
  --bg-tint: #e9eef3;
  --surface: #ffffff;
  --border: #e1e6ec;
  --text: #16202b;
  --muted: #61707f;
  --accent: #1f6f8b;      /* deep sky - the one constant */
  --accent-soft: #e4eef2;
  --accent-2: #0f766e;    /* teal, picks up the blue without going warm */

  --strong: #15803d;      /* green */
  --possible: #b07d06;    /* amber */
  --stretch: #c24a18;     /* orange */
  --no: #64748b;          /* slate */
  --danger: #c02a1e;

  --c1: #1f6f8b;  /* stat accents: sky, teal, green, amber, slate */
  --c2: #0f766e;
  --c3: #15803d;
  --c4: #b07d06;
  --c5: #64748b;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(22, 32, 43, .05), 0 4px 14px rgba(22, 32, 43, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171c;
    --bg-tint: #1a232b;
    --surface: #1a2027;
    --border: #2d3742;
    --text: #e8edf2;
    --muted: #9aa8b5;
    --accent: #7cc0d8;
    --accent-soft: #223039;
    --accent-2: #5eccc0;

    --strong: #52c17a;
    --possible: #d9b04a;
    --stretch: #e68a5c;
    --no: #94a3b8;
    --danger: #ef8578;

    --c1: #7cc0d8; --c2: #5eccc0; --c3: #52c17a; --c4: #d9b04a; --c5: #94a3b8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 16px rgba(0, 0, 0, .28);
  }
}
:root[data-theme="dark"] {
  --bg: #12171c; --bg-tint: #1a232b; --surface: #1a2027; --border: #2d3742;
  --text: #e8edf2; --muted: #9aa8b5; --accent: #7cc0d8; --accent-soft: #223039;
  --accent-2: #5eccc0; --strong: #52c17a; --possible: #d9b04a; --stretch: #e68a5c;
  --no: #94a3b8; --danger: #ef8578;
  --c1: #7cc0d8; --c2: #5eccc0; --c3: #52c17a; --c4: #d9b04a; --c5: #94a3b8;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* A cool wash settling from the top; everything below stays neutral. */
  background-image:
    linear-gradient(to bottom, var(--bg-tint) 0%, transparent 300px),
    radial-gradient(820px 300px at 88% 0%, var(--accent-soft) 0%, transparent 72%);
  background-repeat: no-repeat;
}
main { max-width: 1060px; margin: 0 auto; padding: 24px 16px 80px; }
a { color: var(--accent); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; letter-spacing: -.015em; }
h2 { font-size: 1.18rem; letter-spacing: -.01em; color: var(--accent); }
h3 { font-size: 1.03rem; }
h4 { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em;
  background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.error, .error-text { color: var(--danger); }
.warn-text { color: var(--stretch); }
.notice, .error {
  border-radius: var(--radius); padding: 11px 15px; margin: 0 0 16px;
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
}
.notice { border-left: 4px solid var(--strong); }
.error  { border-left: 4px solid var(--danger); }

/* ---------------------------------------------------------------- chrome */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 13px 18px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  font-weight: 750; font-size: 1.12rem; letter-spacing: -.015em; color: var(--accent);
}
.topbar .brand:hover { text-decoration: none; color: var(--accent-2); }
.topbar nav { display: flex; gap: 6px; }
.topbar nav a { padding: 5px 12px; border-radius: 8px; color: var(--muted); }
.topbar nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.topbar .spacer { flex: 1; }
.topbar .who {
  color: var(--accent); font-size: .85em; font-weight: 600;
  background: var(--accent-soft); padding: 4px 12px; border-radius: 8px;
}

button, input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 9px; padding: 8px 11px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { width: 100%; resize: vertical; font-family: inherit; }
button { cursor: pointer; font-weight: 500; }
button.primary, .primary-link {
  background: var(--accent); border: 1.5px solid var(--accent); color: #fff; font-weight: 600;
}
button.primary:hover, .primary-link:hover { background: #1a5e77; border-color: #1a5e77; }
.primary-link { padding: 9px 15px; border-radius: 9px; display: inline-block; }
.primary-link:hover { text-decoration: none; }
button.link {
  background: none; border: none; color: var(--accent); padding: 0 4px; font-size: .9em;
}
button.link.danger { color: var(--danger); }

/* ----------------------------------------------------------------- login */
.login { max-width: 380px; margin: 11vh auto; }
.login h1 { color: var(--accent); }
.login form {
  display: grid; gap: 14px; margin-top: 20px; background: var(--surface);
  padding: 22px; border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.login label { display: grid; gap: 5px; font-size: .87em; font-weight: 600; color: var(--muted); }

/* ----------------------------------------------------------------- stats */
.stats { display: flex; gap: 11px; flex-wrap: wrap; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 18px; min-width: 96px;
  box-shadow: var(--shadow); border-top: 3px solid var(--c1);
}
.stat:nth-child(2) { border-top-color: var(--c2); }
.stat:nth-child(3) { border-top-color: var(--c3); }
.stat:nth-child(4) { border-top-color: var(--c4); }
.stat:nth-child(5) { border-top-color: var(--c5); }
.stat b { display: block; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .72em; text-transform: uppercase;
  letter-spacing: .07em; font-weight: 600; }

/* --------------------------------------------------------------- filters */
.filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.filters input[name="q"] { flex: 1 1 220px; min-width: 160px; }
.filters .inline { display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: .87em; font-weight: 500; }
.count { margin: 0 0 12px; font-weight: 500; }

/* ------------------------------------------------------------------ list */
.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.job {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 15px; align-items: start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.job:hover { transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(43,38,32,.07), 0 10px 22px rgba(43,38,32,.10); }
.job.is-closed { opacity: .5; }
.job .body { min-width: 0; }
.job h3 { margin: 0 0 3px; font-weight: 650; display: flex; gap: 8px;
  flex-wrap: wrap; align-items: baseline; }
.job h3 a { color: var(--text); }
.job h3 a:hover { color: var(--accent); }
.job .company { color: var(--accent-2); font-weight: 600; font-size: .86em; }
.headline { margin: 3px 0 7px; }
.meta { display: flex; gap: 7px; flex-wrap: wrap; align-items: center;
  margin: 0; color: var(--muted); font-size: .83em; }
.tag {
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px;
  font-size: .95em; font-weight: 500; background: var(--bg);
}
.tag.pay  { color: var(--strong);  border-color: var(--strong);  background: transparent; }
.tag.warn { color: var(--stretch); border-color: var(--stretch); background: transparent; }
.tag.src  { font-family: ui-monospace, Menlo, monospace; font-size: .82em; }

.score, .score-big {
  display: grid; place-content: center; font-weight: 750;
  border-radius: 10px; color: #fff; letter-spacing: -.02em;
}
.score { width: 50px; height: 46px; font-size: 1.15rem; }
.score:hover { text-decoration: none; filter: brightness(1.08); }
.score-big { width: 92px; height: 92px; font-size: 2.1rem; }
.score-big small { display: block; font-size: .28em; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; text-align: center; opacity: .95; }
.verdict-strong   { background: var(--strong); }
.verdict-possible { background: var(--possible); }
.verdict-stretch  { background: var(--stretch); }
.verdict-no       { background: var(--no); }
.verdict-none     { background: var(--bg-tint); color: var(--muted); }

.statusform select { font-size: .84em; padding: 5px 8px; border-radius: 999px; }
.empty { background: var(--surface); border: 2px dashed var(--border);
  border-radius: var(--radius); padding: 34px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center;
  margin-top: 22px; }

/* ---------------------------------------------------------------- detail */
.back { display: inline-block; margin-bottom: 14px; font-size: .9em; }
.detail > section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 13px;
  box-shadow: var(--shadow);
}
.detail > header { display: flex; gap: 22px; align-items: flex-start;
  flex-wrap: wrap; margin-bottom: 18px; }
.company-line { margin: 0 0 6px; color: var(--accent-2); font-weight: 600; }
.links { margin-top: 12px; display: flex; gap: 14px; align-items: center; }
.assessment { border-left: 4px solid var(--accent); }
.assessment .headline { font-size: 1.08rem; margin: 0 0 15px; font-weight: 500; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.cols ul { margin: 7px 0 0; padding-left: 18px; }
.cols li { margin-bottom: 5px; }
.status-panel form { display: flex; gap: 8px; flex-wrap: wrap; }
.status-panel input[name="note"] { flex: 1 1 260px; }
.note { margin: 11px 0 0; padding: 9px 13px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.note-inline { color: var(--muted); }
.description pre {
  white-space: pre-wrap; word-wrap: break-word; margin: 0;
  font: inherit; max-height: 60vh; overflow-y: auto;
}
.events ul, .dupes ul { list-style: none; margin: 8px 0 0; padding: 0; }
.events li, .dupes li { padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: .9em; display: flex; gap: 8px; flex-wrap: wrap; }

/* -------------------------------------------------------------- settings */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel form { margin-top: 10px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .92em; }
th { text-align: left; font-size: .74em; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); font-weight: 700; }
th, td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr.disabled { opacity: .5; }
tr.bad td { color: var(--danger); }
td.actions { display: flex; gap: 4px; white-space: nowrap; }
td.actions form { margin: 0; display: inline; }
details summary { cursor: pointer; color: var(--accent); font-size: .88em;
  margin-top: 12px; font-weight: 500; }

@media (max-width: 680px) {
  .job { grid-template-columns: 46px 1fr; }
  .job .statusform { grid-column: 2; }
  .cols { grid-template-columns: 1fr; }
  main { padding: 16px; }
}

.histrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 6px 0; border-bottom: 1px solid var(--border); }
.histpeek { flex: 1 1 260px; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-size: .82em; }
.histrow form { margin: 0; }

.refreshing {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: var(--radius);
  padding: 11px 15px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.spinner {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-top-color: var(--border);
             background: var(--accent); }
}
