:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1c2330;
  --muted: #5e6878;
  --border: #dde1e7;
  --accent: #2f6f5e;
  --accent-text: #ffffff;
  --accent-soft: #e2efeb;
  --high: #1f7a4d;
  --high-soft: #dcf2e5;
  --mid: #9a6a00;
  --mid-soft: #fbf0d4;
  --low: #8a3b3b;
  --low-soft: #f6e1e1;
  --none: #6b7380;
  --none-soft: #eceef1;
  --leder: #3654a5;
  --leder-soft: #e3e9f8;
  --underviser: #7a3f98;
  --underviser-soft: #f0e5f6;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 2px 8px rgba(20, 30, 50, .04);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2028;
    --surface-2: #222a34;
    --text: #e4e8ee;
    --muted: #98a2b1;
    --border: #2d3642;
    --accent: #5fb39a;
    --accent-text: #0d1a16;
    --accent-soft: #1f3530;
    --high: #6fd29e;
    --high-soft: #1c3528;
    --mid: #e7bd5a;
    --mid-soft: #3a3020;
    --low: #e59292;
    --low-soft: #3a2224;
    --none: #98a2b1;
    --none-soft: #262d37;
    --leder: #93aef0;
    --leder-soft: #222d47;
    --underviser: #cf9ee8;
    --underviser-soft: #33243d;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Top */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: .6rem 1rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.brand span { color: var(--accent); }
nav { display: flex; gap: .25rem; flex-wrap: wrap; }
nav a {
  color: var(--muted); padding: .3rem .65rem; border-radius: 6px; font-size: .93rem;
}
nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.runstate { margin-left: auto; font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--none); display: inline-block; }
.dot.on { background: var(--mid); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

main { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

.banner {
  background: var(--mid-soft); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .6rem .9rem; margin-bottom: 1rem; font-size: .92rem;
}
.banner.ok { background: var(--high-soft); }

/* Kort og gitter */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem;
}
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1rem; }
.stat { padding: .85rem 1rem; }
.stat .num { font-size: 1.7rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: .85rem; }
.stat a { color: inherit; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .5rem; }

/* Joblister */
.joblist { display: flex; flex-direction: column; gap: .6rem; }
.job {
  display: grid; grid-template-columns: auto 1fr auto; gap: .85rem; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .8rem .9rem; box-shadow: var(--shadow);
}
.card .job { box-shadow: none; background: var(--surface); }
.job.compact { padding: .6rem .7rem; grid-template-columns: auto 1fr; }
.job-title { font-weight: 600; color: var(--text); font-size: 1rem; }
.job-title:hover { color: var(--accent); }
.job-meta { color: var(--muted); font-size: .86rem; margin-top: .1rem; }
.job-reason { font-size: .88rem; margin-top: .35rem; color: var(--text); opacity: .9; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .4rem; }
.chip {
  font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; background: var(--none-soft);
  color: var(--muted); white-space: nowrap;
}
.chip.leder { background: var(--leder-soft); color: var(--leder); }
.chip.underviser { background: var(--underviser-soft); color: var(--underviser); }
.chip.begge { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--mid-soft); color: var(--mid); }
.chip.bad { background: var(--low-soft); color: var(--low); }
.chip.new { background: var(--accent); color: var(--accent-text); }

.score {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.score-high { background: var(--high-soft); color: var(--high); }
.score-mid { background: var(--mid-soft); color: var(--mid); }
.score-low { background: var(--low-soft); color: var(--low); }
.score-none { background: var(--none-soft); color: var(--none); }
.score.big { width: 64px; height: 64px; font-size: 1.35rem; }

/* Formularer */
select, input[type=text], input[type=number], input[type=url], input[type=password], textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; padding: .4rem .55rem; max-width: 100%;
}
textarea { width: 100%; min-height: 8rem; font-size: .9rem; line-height: 1.45; }
select.status { font-size: .85rem; padding: .25rem .4rem; }
label { font-size: .88rem; color: var(--muted); display: block; margin-bottom: .2rem; }
.btn {
  font: inherit; font-size: .9rem; cursor: pointer; border-radius: 7px; padding: .42rem .85rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; gap: .35rem;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--low); }
.btn.small { font-size: .8rem; padding: .25rem .55rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters .field { display: flex; flex-direction: column; }
.inline { display: inline; }

/* Tabeller */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ok-yes { color: var(--high); font-weight: 600; }
.ok-no { color: var(--low); font-weight: 600; }

/* Detalje */
.detail-head { display: flex; gap: 1rem; align-items: flex-start; }
.block-company { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.inline-field { display: flex; gap: .4rem; }
.inline-field input { flex: 1; min-width: 0; }

/* AI-vurdering */
.ai-conclusion { font-size: 1.05rem; font-weight: 600; margin: 0 0 .35rem; }
.ai-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1.5rem; margin-top: 1rem; }
.ai-grid h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 .5rem; }
.ai-grid ul + h3 { margin-top: 1rem; }
.criteria { display: flex; flex-direction: column; gap: .8rem; }
.criterion-head { display: flex; justify-content: space-between; font-weight: 600; font-size: .92rem; }
.criterion-head .num { font-variant-numeric: tabular-nums; }
.bar { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: .25rem 0 .3rem; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.ai-list { margin: 0; padding-left: 1.2rem; font-size: .93rem; }
.ai-list li { margin: .25rem 0; }
.ai-list.pro li::marker { content: "+  "; color: var(--high); font-weight: 700; }
.ai-list.con li::marker { content: "–  "; color: var(--low); font-weight: 700; }
.req-list { list-style: none; margin: 0; padding: 0; font-size: .93rem; }
.req-list li { display: flex; gap: .5rem; margin: .25rem 0; }
.req-icon { width: 1.3rem; height: 1.3rem; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.req-opfyldt .req-icon { background: var(--high-soft); color: var(--high); }
.req-delvist .req-icon { background: var(--mid-soft); color: var(--mid); }
.req-mangler .req-icon { background: var(--low-soft); color: var(--low); }
.ai-pitch { background: var(--accent-soft); border-radius: 8px; padding: .65rem .85rem; margin: 1.1rem 0 .6rem; font-size: .93rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 760px) { .ai-grid { grid-template-columns: 1fr; } }

/* Annoncetekst */
.ad {
  max-width: 72ch; font-size: .97rem; line-height: 1.65; color: var(--text);
  position: relative; overflow-wrap: anywhere;
}
.ad.collapsed { max-height: 34rem; overflow: hidden; }
.ad.collapsed.long::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5rem;
  background: linear-gradient(to bottom, transparent, var(--surface));
}
.ad h4 { font-size: 1.02rem; margin: 1.3rem 0 .35rem; color: var(--text); }
.ad h4:first-child { margin-top: 0; }
.ad p { margin: 0 0 .7rem; }
.ad ul { margin: 0 0 .9rem; padding-left: 1.25rem; }
.ad li { margin: .2rem 0; }
.ad li::marker { color: var(--accent); }
.ad a { word-break: break-all; }
.ad-toggle { margin-top: .5rem; }
.desc { white-space: pre-wrap; font-size: .92rem; max-height: 32rem; overflow: auto; background: var(--surface-2); padding: .8rem; border-radius: 8px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.status-buttons { display: flex; gap: .35rem; flex-wrap: wrap; }
.status-buttons .btn.current { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.column { background: var(--surface-2); border-radius: var(--radius); padding: .6rem; min-height: 8rem; }
.column h3 { display: flex; justify-content: space-between; font-size: .9rem; }
.column .job { grid-template-columns: 1fr; margin-bottom: .5rem; }

.pager { display: flex; gap: .4rem; align-items: center; justify-content: center; margin-top: 1rem; }
.empty { color: var(--muted); padding: 1rem 0; font-size: .92rem; }

/* Login */
.login-box { max-width: 340px; margin: 12vh auto; text-align: center; }
.login-box input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; width: 100%; padding: .5rem; margin: .75rem 0; }

@media (max-width: 640px) {
  .job { grid-template-columns: auto 1fr; }
  .job .job-actions { grid-column: 1 / -1; }
  .runstate { margin-left: 0; }
  .detail-head { flex-direction: column; }
  .grid-2 { grid-template-columns: 1fr; }
}
