/* Joblog */
:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --surface-2: #efeeea;
  --border: #deddd7;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #76756f;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --grid: #e6e5e0;
  --danger: #c33232;
  --warn-bg: #fff4d6;
  --warn-ink: #7a4f00;
  --st-kigger: #e6eefb;   --st-kigger-ink: #1d4f8f;
  --st-soegt: #dbe9fb;    --st-soegt-ink: #1a4f93;
  --st-samtale: #e9e5fb;  --st-samtale-ink: #3d2f96;
  --st-tilbud: #fdefd0;   --st-tilbud-ink: #7a4f00;
  --st-ansat: #d8f0d8;    --st-ansat-ink: #125f12;
  --st-afslag: #fbe1e1;   --st-afslag-ink: #9c2626;
  --st-intet: #ebebe8;    --st-intet-ink: #52514e;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #242422;
    --border: #34332f;
    --text: #f3f2ee;
    --text-2: #c3c2b7;
    --muted: #97968d;
    --accent: #3987e5;
    --grid: #2c2b28;
    --danger: #ec7a7a;
    --warn-bg: #3a2e10;
    --warn-ink: #f2c55c;
    --st-kigger: #1d2a3d;   --st-kigger-ink: #9cc0f2;
    --st-soegt: #1b2d47;    --st-soegt-ink: #8fbaf5;
    --st-samtale: #2a2550;  --st-samtale-ink: #b9b0f5;
    --st-tilbud: #3a2e10;   --st-tilbud-ink: #f2c55c;
    --st-ansat: #163316;    --st-ansat-ink: #86d886;
    --st-afslag: #3d1c1c;   --st-afslag-ink: #f09a9a;
    --st-intet: #2a2a28;    --st-intet-ink: #b5b4ac;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #242422; --border: #34332f;
  --text: #f3f2ee; --text-2: #c3c2b7; --muted: #97968d; --accent: #3987e5; --grid: #2c2b28;
  --danger: #ec7a7a; --warn-bg: #3a2e10; --warn-ink: #f2c55c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 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.5rem; margin: .2rem 0 .3rem; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
.mt { margin-top: 1.5rem; }
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.strike { text-decoration: line-through; }
.right { margin-left: auto; }

/* top */
.top {
  display: flex; align-items: center; gap: 1.2rem;
  padding: .7rem max(16px, calc((100vw - 1200px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.top nav { display: flex; gap: .3rem; flex-wrap: wrap; }
.top nav a { color: var(--text-2); padding: .3rem .65rem; border-radius: 6px; }
.top nav a.on, .top nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.logout { margin-left: auto; color: var(--muted); font-size: .9rem; }
main { max-width: 1200px; margin: 0 auto; padding: 1.2rem 16px 3rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.flash { background: var(--st-soegt); color: var(--st-soegt-ink); padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.error { background: var(--st-afslag); color: var(--st-afslag-ink); }
.empty { color: var(--muted); padding: .5rem 0; margin: 0; }
.count { font-weight: 500; color: var(--muted); font-size: .85rem; margin-left: .3rem; }

/* nøgletal */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }
.stat .num { display: block; font-size: 1.7rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--text-2); font-size: .85rem; }

/* kræver opmærksomhed */
.attention { border-left: 4px solid #eda100; }
.attention ul { list-style: none; margin: 0; padding: 0; }
.attention li { display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; padding: .35rem 0; border-top: 1px solid var(--grid); }
.attention li:first-child { border-top: 0; }
.att-when { min-width: 7.5em; font-weight: 600; font-size: .85rem; color: var(--text-2); }
.att-actions { margin-left: auto; display: inline-flex; gap: .3rem; }
.att-actions button { padding: .15rem .5rem; }
.att-samtale .att-when { color: var(--st-samtale-ink); }
.att-frist .att-when, .att-opfoelg .att-when { color: var(--warn-ink); }

/* formularer */
input, select, textarea, button {
  font: inherit; color: inherit;
}
input:not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }
label { display: block; font-size: .85rem; color: var(--text-2); }
label > input, label > select, label > textarea { margin-top: .2rem; color: var(--text); font-size: .95rem; }
label.check { display: flex; gap: .5rem; align-items: center; font-size: .95rem; color: var(--text); align-self: end; padding-bottom: .5rem; }
button {
  padding: .45rem .9rem; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.link { background: none; border: 0; padding: 0 .2rem; color: var(--accent); }
button.danger, .danger { color: var(--danger); }
form.inline { display: inline; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem 1rem; }
.grid .wide { grid-column: span 2; }
.actions { display: flex; gap: .8rem; align-items: center; margin-top: .4rem; }
.row { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }
.row label { flex: 0 1 180px; }
fieldset { border: 0; padding: 0; margin: 0 0 1.3rem; }
legend { font-weight: 650; font-size: .95rem; margin-bottom: .6rem; padding: 0; }

.quickadd summary { cursor: pointer; font-weight: 650; }
.quickadd[open] summary { margin-bottom: .8rem; }

/* filtre */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .8rem; }
.filters input[type=search] { max-width: 280px; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 99px;
  border: 1px solid var(--border); cursor: pointer; font-size: .85rem; color: var(--text-2); user-select: none;
}
.chip input { margin: 0; }
.chip:has(input:checked), .chip.on { border-color: var(--accent); color: var(--text); background: var(--surface-2); }

/* tabeller */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table.jobs th, table.jobs td { padding: .5rem .5rem; text-align: left; vertical-align: top; border-top: 1px solid var(--grid); }
table.jobs thead th { border-top: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
table.jobs thead th a { color: inherit; }
table.jobs th.center, table.jobs td.center { text-align: center; }
tr.week th { background: var(--surface-2); font-size: .85rem; padding: .35rem .5rem; font-weight: 650; }
tr.closed td { color: var(--muted); }
tr:target td { background: color-mix(in srgb, var(--accent) 12%, transparent) !important; }
table.jobs tr { scroll-margin-top: 80px; }
tr.closed td strong { font-weight: 500; }
tbody tr:not(.week):hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
table.plain th, table.plain td { padding: .35rem .4rem; text-align: left; border-top: 1px solid var(--grid); }
table.plain thead th { border-top: 0; font-size: .8rem; color: var(--muted); font-weight: 600; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.barcell { width: 50%; }
.hbar { display: block; height: 10px; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }

.badge { display: inline-block; padding: .08rem .55rem; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.st-kigger  { --b: var(--st-kigger);  --i: var(--st-kigger-ink); }
.st-soegt   { --b: var(--st-soegt);   --i: var(--st-soegt-ink); }
.st-samtale { --b: var(--st-samtale); --i: var(--st-samtale-ink); }
.st-tilbud  { --b: var(--st-tilbud);  --i: var(--st-tilbud-ink); }
.st-ansat   { --b: var(--st-ansat);   --i: var(--st-ansat-ink); }
.st-afslag  { --b: var(--st-afslag);  --i: var(--st-afslag-ink); }
.st-intet_svar, .st-droppet { --b: var(--st-intet); --i: var(--st-intet-ink); }
.badge { background: var(--b); color: var(--i); }

.next { font-size: .85rem; color: var(--text-2); white-space: nowrap; }
.next.samtale { color: var(--st-samtale-ink); font-weight: 600; }
.next.due, .due { color: var(--warn-ink); font-weight: 600; }
.jobnet { width: 2rem; padding: .1rem 0; font-weight: 700; }
.jobnet.yes { background: var(--st-ansat); color: var(--st-ansat-ink); border-color: transparent; }
.jobnet.no { color: var(--muted); }

/* jobside */
.job-head .meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; color: var(--text-2); margin: 0 0 1rem; }
.job-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }
.event-form { display: grid; gap: .5rem; margin-bottom: 1rem; }
.event-form .row select { flex: 0 0 110px; width: auto; }
.event-form .row input { flex: 1; }
.event-form button { justify-self: start; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .5rem 0 .5rem .8rem; border-left: 2px solid var(--border); margin-left: .3rem; }
.timeline li.ev-status { border-left-color: var(--accent); }
.timeline li.ev-samtale { border-left-color: #4a3aa7; }
.ev-head { display: flex; gap: .5rem; align-items: baseline; font-size: .8rem; color: var(--muted); }
.ev-type { font-weight: 650; color: var(--text-2); }
.ev-head form { margin-left: auto; }
.ev-text { font-size: .92rem; margin-top: .1rem; overflow-wrap: anywhere; }
.files { list-style: none; margin: 0 0 1rem; padding: 0; }
.files li { display: flex; gap: .45rem; align-items: baseline; flex-wrap: wrap; padding: .35rem 0; border-top: 1px solid var(--grid); }
.files li:first-child { border-top: 0; }
.files li > a:first-of-type { overflow-wrap: anywhere; }
.tag { font-size: .72rem; background: var(--surface-2); padding: .05rem .45rem; border-radius: 4px; color: var(--text-2); }
.upload { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.upload select { width: auto; }
.upload input[type=file] { flex: 1; min-width: 0; font-size: .85rem; }
.delete-job { text-align: right; }

/* diagram */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--muted); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .val { fill: var(--text-2); font-size: 11px; font-weight: 600; }
.chart .fill { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart .bar { outline: none; cursor: default; }
.chart .bar:hover .hit, .chart .bar:focus .hit { fill: var(--surface-2); }
.tooltip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--surface);
  padding: .3rem .55rem; border-radius: 6px; font-size: .8rem; white-space: nowrap; transform: translate(-50%, -110%);
}

/* jobopslag */
.nav-badge { background: var(--accent); color: var(--accent-ink); border-radius: 99px; font-size: .72rem; font-weight: 700; padding: .05rem .45rem; margin-left: .15rem; }
.leads-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.leads-head p { margin: .2rem 0 .8rem; max-width: 60ch; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs a { padding: .45rem .8rem; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }
h2.day { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.2rem 0 .5rem; }
.lead { padding: .8rem 1rem; margin-bottom: .6rem; transition: opacity .25s; }
.lead.gone { opacity: 0; }
.lead-top { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.lead-title { font-weight: 650; font-size: 1.02rem; }
.lead-meta { color: var(--text-2); font-size: .9rem; margin-top: .15rem; }
.lead-cats { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.lead-desc { margin-top: .4rem; font-size: .9rem; }
.lead-desc summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.lead-desc p { margin: .4rem 0 0; color: var(--text-2); max-width: 80ch; }
.lead-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .6rem; }
.lead-actions form { display: inline; }
.rel { font-size: .75rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; white-space: nowrap; cursor: help; }
.rel-hoej { background: var(--st-ansat); color: var(--st-ansat-ink); }
.rel-mellem { background: var(--st-tilbud); color: var(--st-tilbud-ink); }
.rel-lav, .rel-udelukket { background: var(--st-intet); color: var(--st-intet-ink); }
.new-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent); }
.att-opslag .att-when { color: var(--accent); }
.profile-grid { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 1rem; align-items: start; }
.profile textarea.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }

/* login */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: 100%; max-width: 340px; display: grid; gap: .9rem; }
.login h1 { margin: 0; }

@media (max-width: 900px) {
  .job-layout, .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .hide-sm { display: none; }
  .grid .wide { grid-column: auto; }
  .top { gap: .6rem; }
  .filters input[type=search] { max-width: none; }
  .right { margin-left: 0; }
  table.jobs th, table.jobs td { padding: .45rem .3rem; }
}
