/* ---------------------------------------------------------------------------
 * Bosswik Produktionsprioritering - stylesheet
 *
 * Served verbatim at /assets/app.css by render.styles().
 *
 * Two audiences:
 *   - shop floor: /ark/:id on wall-mounted screens and tablets, read several
 *     metres away. Base font 20px, tall rows, strong colour coding, no
 *     hover-only affordances (touch screens).
 *   - planners: /admin at a desk, denser.
 *
 * Light and dark are both first-class: every colour is a custom property and
 * the dark palette redefines the same names.
 * ------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --bg: #eef1f6;
  --bg-soft: #e3e8f0;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #101720;
  --text-muted: #5a6675;
  --border: #ccd5e0;
  --border-strong: #a9b6c6;
  --focus: #1668d6;
  --shadow: 0 1px 2px rgba(16, 23, 32, .08), 0 6px 20px rgba(16, 23, 32, .07);
  --shadow-pop: 0 10px 40px rgba(16, 23, 32, .28);

  --accent: #1668d6;
  --accent-text: #ffffff;
  --warn-bg: #fde3e3;
  --warn-border: #d32020;
  --ok-bg: #e2f6e9;
  --ok-border: #1f8a45;

  /* priority colours: --f-*-line is the rail/chip, --f-*-bg the row tint */
  --f-bla-line: #1668d6;
  --f-bla-bg: #e2ecfd;
  --f-rod-line: #d32020;
  --f-rod-bg: #fce0e0;
  --f-gul-line: #b98705;
  --f-gul-bg: #fdf1cf;
  --f-gron-line: #1f8a45;
  --f-molebo-line: #6b3fa0;
  --f-molebo-bg: rgba(107, 63, 160, 0.10);
  --f-gron-bg: #e0f5e8;
  --f-ikke-line: #6b7686;
  --f-ikke-bg: #eceff4;
  --f-skjult-line: #8a93a0;
  --f-skjult-bg: #e9ecf1;

  /* segments: who the work is FOR. Deliberately NOT the priority palette - a
   * segment is not a priority, and a brand table tinted in Blå/Rød/Grøn would
   * read as though somebody had prioritised the brands. Molebo keeps the purple
   * it already has, because that row IS Molebo. */
  --s-bosswik-line: #0f7b8a;
  --s-bosswik-bg: #dff2f6;
  --s-molebo-line: #6b3fa0;
  --s-molebo-bg: rgba(107, 63, 160, 0.10);
  --s-privat-line: #c2571a;
  --s-privat-bg: #fdeadd;
  --s-ukendt-line: #6b7686;
  --s-ukendt-bg: #eceff4;
  /* A brand promoted to its own segment. Green, because it is the one segment value
   * that is always a human decision - the heuristic can never produce it - and it must
   * not be mistakable for the orange of Private label, which is where those brands sat
   * before somebody moved them out. */
  --s-eget-line: #2f7d43;
  --s-eget-bg: #e4f4e8;

  /* Fallback only: grid.js measures the real header and overwrites this. With six
   * nav items the bar wraps, so 4.6rem used to hide the first table row on a
   * no-JavaScript screen. */
  --header-h: 5.6rem;
  --radius: 12px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1219;
    --bg-soft: #141a23;
    --surface: #171d27;
    --surface-2: #1d2531;
    --text: #e9eef5;
    --text-muted: #9dabbd;
    --border: #2b3543;
    --border-strong: #3d4a5c;
    --focus: #6aa8ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 20px rgba(0, 0, 0, .45);
    --shadow-pop: 0 10px 40px rgba(0, 0, 0, .7);

    --accent: #3f8ae8;
    --accent-text: #06101d;
    --warn-bg: #3a1717;
    --warn-border: #f05252;
    --ok-bg: #12301f;
    --ok-border: #34b467;

    --f-bla-line: #56a0ff;
    --f-bla-bg: #14263e;
    --f-rod-line: #ff6b6b;
    --f-rod-bg: #3b1618;
    --f-gul-line: #f0c132;
    --f-gul-bg: #35290b;
    --f-gron-line: #48c47c;
    --f-gron-bg: #123021;
    /* The dark palette never defined these two, so a Molebo chip fell back to the
     * light rgba() and all but vanished. It matters now: the totals strip shows
     * "Molebo (ikke valgt)" with 83 orders behind it. */
    --f-molebo-line: #b98cf0;
    --f-molebo-bg: #241a33;
    --f-ikke-line: #8695a8;
    --f-ikke-bg: #1b222d;
    --f-skjult-line: #7c8798;
    --f-skjult-bg: #1a212b;

    --s-bosswik-line: #46c3d4;
    --s-bosswik-bg: #0d2b31;
    --s-molebo-line: #b98cf0;
    --s-molebo-bg: #241a33;
    --s-privat-line: #f0904d;
    --s-privat-bg: #3a2210;
    --s-ukendt-line: #8695a8;
    --s-ukendt-bg: #1b222d;
    --s-eget-line: #5cc47a;
    --s-eget-bg: #142a1b;
  }
}

/* --- base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 20px; /* shop-floor baseline */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent); }
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1, h2, h3 { margin: 0; line-height: 1.15; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --- header -------------------------------------------------------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem 1.2rem;
  padding: .55rem 1.1rem;
  min-height: var(--header-h);
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  text-decoration: none;
  color: inherit;
}
.brand strong { font-size: 1.25rem; letter-spacing: -.01em; }
.brand span { color: var(--text-muted); font-size: .8rem; }

.app-nav { display: flex; gap: .45rem; flex-wrap: wrap; }
.app-nav a {
  display: inline-block;
  padding: .45rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
}
.app-nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.header-spacer { flex: 1 1 auto; }

/* Task navigation works with keyboard, touch and without JavaScript. */
.nav-group { position: relative; margin: 0; }
.nav-group > summary {
  cursor: pointer; padding: .45rem .65rem; min-height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: .9rem; font-weight: 600;
}
.nav-group[data-active] > summary { border-color: var(--accent); color: var(--accent); }
.nav-group[open] > summary { background: var(--bg-soft); }
.nav-links {
  position: absolute; z-index: 110; top: 100%; left: 0;
  display: flex; flex-direction: column; gap: .35rem;
  width: max-content; max-width: min(22rem, 90vw); padding: .6rem;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  border-radius: var(--radius-sm);
}
.nav-links a { white-space: normal; min-height: 44px; }
.explanation { margin: .65rem 0; }
.explanation > summary { cursor: pointer; font-weight: 600; min-height: 44px; padding: .45rem 0; }
.explanation-body { padding: .2rem 0 .4rem .8rem; border-left: 2px solid var(--border); }
main p, .fund-body { max-width: 78ch; }
.page-head p, .toolbar p { max-width: none; }
.status-ok { color: var(--ok-border); font-size: .85rem; margin: .5rem 0; }
.experimental-comparison th, .experimental-comparison td,
.experimental-reconciliation th, .experimental-reconciliation td { padding: .6rem .8rem; }
.tabel-removing input { opacity: .6; }
.tabel-removing { background: var(--warn-bg); }
@media (max-width: 640px) {
  .app-nav { position: relative; }
  .nav-group { position: static; }
  .nav-links { left: 0; right: 0; width: auto; max-width: 100%; }
}
@media print {
  .explanation > summary { min-height: 0; padding: .2rem 0; }
  .explanation::details-content { content-visibility: visible; }
  .explanation > :not(summary) { display: block; }
}

.statusbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem .9rem;
  font-size: .78rem;
  color: var(--text-muted);
}
.statusbar .dot {
  display: inline-block;
  width: .6rem; height: .6rem;
  border-radius: 50%;
  background: var(--ok-border);
  margin-right: .35rem;
  vertical-align: baseline;
}
.statusbar .dot.bad { background: var(--warn-border); }
/* Old data, but nothing has actually failed - amber, not red. The distinction is
   the point: red means the source answered badly, amber means nobody has asked. */
.statusbar .dot.stale { background: var(--f-gul-line); }
.statusbar .dot.idle { background: var(--f-ikke-line); }
.statusbar form { display: inline; }
.statusbar .linkbtn {
  border: 0; background: none; padding: 0;
  font: inherit; color: var(--accent); cursor: pointer;
  text-decoration: underline;
}

/* Personal experiments use a mode marker, never the production priority palette. */
.experimental-switch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem .6rem;
  margin: 0;
  font-size: .8rem;
}
.experimental-switch button {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 44px;
  padding: .35rem .55rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.experimental-switch-track {
  width: 1.6rem;
  height: .9rem;
  padding: .1rem;
  border: 1px solid var(--border-strong);
  border-radius: 1rem;
  background: var(--bg-soft);
}
.experimental-switch-track::before {
  content: '';
  display: block;
  width: .6rem;
  height: .6rem;
  border-radius: 50%;
  background: var(--text-muted);
}
.experimental-switch [aria-checked="true"] { border-color: var(--accent); }
.experimental-switch [aria-checked="true"] .experimental-switch-track::before {
  margin-left: auto;
  background: var(--accent);
}
.experimental-switch > a { display: inline-flex; align-items: center; min-height: 44px; }
.experimental-active {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .75rem;
  padding: .6rem .8rem;
  margin: 0 0 1rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: .85rem;
}
.experimental-active > strong { white-space: nowrap; }
.experimental-active > span { flex: 1 1 25rem; }
.experimental-feature {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  max-width: 60rem;
  padding: .65rem;
  margin: .6rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.experimental-feature input { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; margin: .12rem 0 0; }
.experimental-feature > span { min-width: 0; }
.experimental-feature > span > span { display: block; font-size: .85rem; margin-top: .2rem; }
.experimental-settings button { white-space: normal; min-height: 44px; }
.experimental-page #process-confirmations { scroll-margin-top: 10rem; }
.experimental-simulation-summary { border-left: 3px solid var(--accent); background: var(--surface-2); padding: .8rem 1rem; margin: 1rem 0; }
.experimental-simulation-summary h3 { margin-top: 0; }
.experimental-comparison-wrap { overflow-x: auto; }
.experimental-comparison { width: 100%; border-collapse: collapse; font-size: .88rem; }
.experimental-comparison caption { text-align: left; padding: .5rem .7rem; color: var(--text-muted); }
.experimental-comparison th, .experimental-comparison td {
  padding: .6rem .7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: right;
}
.experimental-comparison th:first-child { text-align: left; }
.experimental-comparison thead { background: var(--surface-2); }
.experimental-evidence { padding: .8rem 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.experimental-evidence h3 { font-size: 1rem; }
.experimental-facts { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; margin: .5rem 0; }
.experimental-facts dt { color: var(--text-muted); font-size: .76rem; }
.experimental-facts dd { margin: .1rem 0 0; font-size: .88rem; }
.experimental-simulation-summary dd b { font-size: 1.2rem; }
.experimental-proposals summary, .experimental-abstentions summary { min-height: 44px; padding: .5rem 0; cursor: pointer; }
.followup-views { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.followup-views [aria-current="page"] { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.followup-view-heading { margin: 1rem 0 .6rem; font-size: 1.2rem; }
.followup-reason { color: var(--text-muted); margin: .4rem 0 0; }
.experimental-rule-overview { margin: 1rem 0; }
.experimental-rule-overview > h2 { font-size: 1.25rem; }
.rule-card.has-experimental-effect { border: 2px solid var(--accent); opacity: 1; }
.experimental-rule-effect { padding: .7rem 0; }
.experimental-rule-effect h3 { font-size: .92rem; margin-bottom: .5rem; }
.experimental-rule-counts { overflow-x: auto; box-shadow: none; }
.experimental-rule-counts table { width: 100%; border-collapse: collapse; font-size: .75rem; }
.experimental-rule-counts caption { text-align: left; color: var(--text-muted); padding: .4rem; }
.experimental-rule-counts th, .experimental-rule-counts td { padding: .45rem .35rem; border-bottom: 1px solid var(--border); text-align: right; }
.experimental-rule-counts th:first-child { text-align: left; }
.experimental-rule-conditions { list-style: none; padding: 0; margin: .5rem 0 0; }
.experimental-rule-conditions li { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.experimental-rule-conditions p { margin: .35rem 0 0; font-size: .83rem; }
.experimental-rule-path { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font-size: .85rem; }
.experimental-rule-path strong { padding: .25rem .4rem; border: 1px solid var(--accent); border-radius: var(--radius-sm); }
.experimental-saved-rule, .experimental-saved-flow, .experimental-unchanged-rules { margin: .7rem 0; }
.experimental-saved-rule > summary, .experimental-saved-flow > summary, .experimental-unchanged-rules > summary { min-height: 44px; padding: .5rem 0; cursor: pointer; font-weight: 600; }
.experimental-saved-flow { padding: .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.experimental-rule-detail .experimental-rule-effect { padding-bottom: 0; }
@media screen {
  body[data-experimental="1"] #fuld-bjaelke::before {
    content: 'Experimental · Til';
    flex: 0 0 auto;
    padding: .15rem .35rem;
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .8rem;
    font-weight: 700;
  }
}
@media (max-width: 720px) {
  .experimental-comparison { font-size: .76rem; }
  .experimental-comparison th, .experimental-comparison td { padding: .45rem .3rem; }
}
@media print {
  .experimental-active {
    display: block !important;
    color: #000 !important;
    background: #fff !important;
    border: 2pt solid #000;
    padding: 2mm;
    font-size: 9pt;
    break-inside: avoid;
  }
  .experimental-active a { color: #000 !important; }
  .experimental-switch, .experimental-settings form { display: none !important; }
}

/* --- page frame ---------------------------------------------------------- */

main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 1.1rem 1.1rem 4rem;
}
main.wide { max-width: none; padding-left: .7rem; padding-right: .7rem; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem 1rem;
  margin-bottom: 1rem;
}
.page-head h1 { font-size: 1.6rem; }
.page-head .sub { color: var(--text-muted); font-size: .85rem; }

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  min-height: 2.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--bg-soft); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-sm { padding: .3rem .6rem; min-height: 2rem; font-size: .78rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: default; }

input[type="text"], input[type="search"], input[type="password"], select {
  padding: .5rem .7rem;
  min-height: 2.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
}

/* --- banner (Ikke prioriteret) ------------------------------------------- */

.banner {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.3rem;
  border-radius: var(--radius);
  border: 3px solid var(--warn-border);
  background: var(--warn-bg);
  box-shadow: var(--shadow);
}
.banner.ok { border-color: var(--ok-border); background: var(--ok-bg); }
.banner .big {
  font-size: 4.4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
}
.banner .banner-text { flex: 1 1 16rem; }
.banner .banner-text strong { display: block; font-size: 1.35rem; }
.banner .banner-text span { color: var(--text-muted); font-size: .9rem; }

/* --- totals strip -------------------------------------------------------- */

.totals {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1.2rem;
}
.totals .total-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .8rem;
  font-size: .85rem;
}
.totals .total-item b { font-size: 1.1rem; }

/* --- colour chips -------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}
.chip .n { font-variant-numeric: tabular-nums; }
/* --- /ordre/:prod --------------------------------------------------------- */
.ordre-head { margin-bottom: 1rem; }
.ordre-head h1 { margin-bottom: .4rem; }
.ordre-blok { margin-bottom: 1rem; }
.ordre-blok h2 { margin-bottom: .4rem; }
.ordre-fakta { display: flex; flex-wrap: wrap; gap: .3rem 1.6rem; margin: 0; }
.ordre-fakta div { min-width: 7rem; }
.ordre-fakta dt { font-size: .78rem; color: var(--text-muted); margin: 0; }
.ordre-fakta dd { margin: 0; font-weight: 600; }
.ordre-ark, .ordre-venter, .ordre-historik { list-style: none; margin: 0; padding: 0; }
.ordre-ark li, .ordre-venter li { padding: .2rem 0; }
.ordre-venter li .sub { margin-left: .4rem; }
.ordre-intet { font-weight: 600; }
.ordre-timer { border-collapse: collapse; }
.ordre-timer th, .ordre-timer td { border-bottom: 1px solid var(--border); padding: .2rem .8rem .2rem 0; text-align: left; }
.ordre-timer .num { text-align: right; font-variant-numeric: tabular-nums; }
.ordre-hvornaar { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ordre-pil { color: var(--text-muted); }
.ordre-farve { display: flex; align-items: center; gap: .4rem; margin: 0 0 .3rem; }
.ordre-note, .ordre-hnote { font-style: italic; }
/* The name is the answer on this page, so it gets the size the colour chip gets
 * next door - not the muted treatment it has on an ark, where it is a footnote to
 * a work list. */
.ordre-sidst { margin: 0 0 .3rem; font-size: 1.15rem; }

/* /kompetencer: the free-text name beside its select, and the add row.
 * The text box is narrow and quiet - it is the exception, not the field most rows
 * use - and it sits on its own line so it never squeezes the select on a laptop. */
.komp-andet { display: block; margin-top: .25rem; width: 100%; max-width: 15rem; font-size: .9rem; }
.komp-tilfoej input[type="text"] { width: 100%; max-width: 12rem; }
.komp-tilfoej { border-top: 2px solid var(--line); }
/* Nothing measured about this person, so the row reads quieter than the rest and
 * says why in the cell rather than only in a tooltip. */
.komp-maerke { font-size: .75rem; white-space: nowrap; }
.ordre-historik li { padding: .2rem 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.ordre-bekraeftet { display: inline-flex; align-items: center; gap: .25rem; }

/* A chip that is a link to /admin?farve=. Nothing about the colour needs restating:
   .chip's own `color` beats the bare `a` rule on specificity, and the focus ring
   comes from a:focus-visible. @media print already flattens both .chip and a[href],
   so an anchor chip prints byte-identically with the span it replaced - do NOT add
   no-print here, that would take the whole colour strip off the paper. */
.chip-link { text-decoration: none; cursor: pointer; }
.chip-link:hover { text-decoration: underline; }
.chip.farve-bla { border-color: var(--f-bla-line); background: var(--f-bla-bg); }
.chip.farve-rod { border-color: var(--f-rod-line); background: var(--f-rod-bg); }
.chip.farve-gul { border-color: var(--f-gul-line); background: var(--f-gul-bg); }
.chip.farve-gron { border-color: var(--f-gron-line); background: var(--f-gron-bg); }
.chip.farve-ikke { border-color: var(--f-ikke-line); background: var(--f-ikke-bg); border-style: dashed; }
.chip.farve-skjult { border-color: var(--f-skjult-line); background: var(--f-skjult-bg); }

.badge {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: var(--radius-sm);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
}
.badge.explicit { border-color: var(--accent); color: var(--accent); }

/* --- overview cards ------------------------------------------------------ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .9rem;
}

.sheet-card {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: .85rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: .5rem solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  min-height: 9.5rem;
}
.sheet-card:hover { border-color: var(--accent); }
.sheet-card.has-unprioritised { border-left-color: var(--f-ikke-line); }
.sheet-card.empty { opacity: .62; }
.sheet-card .card-top {
  display: flex;
  align-items: baseline;
  gap: .6rem;
}
.sheet-card .ark-no {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
}
.sheet-card .ark-count {
  margin-left: auto;
  font-size: 1.05rem;
  font-weight: 700;
}
.sheet-card .ark-count small { font-weight: 500; color: var(--text-muted); font-size: .7rem; }
.sheet-card .ark-title {
  font-size: .92rem;
  font-weight: 600;
  min-height: 2.4em;
}
/* Timer i arkets EGEN operation - arbejdet på denne plads. Under titlen og over
   farvechipsene, fordi det er en egenskab ved arket og ikke en advarsel. */
.sheet-card .ark-timer-linje {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: .35rem;
}
.sheet-card .ark-timer-linje small { font-weight: 500; font-size: .72rem; }
.sheet-card .chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: auto; }
.sheet-card .warn-line {
  font-size: .8rem;
  font-weight: 700;
  color: var(--warn-border);
}

/* --- egne tabeller ------------------------------------------------------- */

/* Kortet er et ark-kort med ét bytte: nummeret er skiftet ud med et NAVN, og et
   navn kan ikke bære 2rem/800. Alt andet - rammen, hover, chips, kø-badgen -
   arves, så en tabel og et ark ser ud som det, de er: samme slags ting. */
.sheet-card.tabel-kort { border-left-color: var(--accent); }
.sheet-card .tabel-kort-navn {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
}

/* Kontakten mellem de to læsninger. Et panel og ikke en advarsel: at siden viser
   hele køen er et VALG, ikke en fejl - og teksten om `Skjult` inde i den er den
   ene sætning, der forhindrer, at køen læses som en arbejdsliste. */
.tabel-kontakt {
  margin: .6rem 0;
  padding: .55rem .75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: .35rem solid var(--accent);
  border-radius: var(--radius);
  font-size: .9rem;
}
.tabel-kontakt a { font-weight: 700; }

.tabel-spande { margin: .3rem 0 .6rem; }
.tabel-note { margin: .2rem 0; font-style: italic; }
.tabel-ark { margin: .2rem 0 .5rem; }
.tabel-ark-link {
  display: inline-block;
  padding: .05rem .4rem;
  margin-right: .15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.tabel-ark-link:hover { border-color: var(--accent); }

/* Editoren. Felterne fylder deres celle, så en lang ark-liste ikke bliver et
   kighul - `22, 23, 24, 25, 26, 27, 28, 29, 30, 31` er 42 tegn. */
.tabel-liste input[type="text"] {
  width: 100%;
  min-width: 4rem;
  font: inherit;
  padding: .2rem .35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
}
.tabel-liste input.tabel-navn { min-width: 10rem; }
.tabel-liste input.tabel-ark-felt { min-width: 20rem; font-variant-numeric: tabular-nums; }
.tabel-liste input.tabel-sort { max-width: 4rem; min-width: 3rem; text-align: right; }
.tabel-liste .tabel-ny { background: var(--surface-2); }
.tabel-liste .tabel-ny td { border-top: 2px solid var(--border-strong); }

/* --- tavlen: én søjle pr. ark -------------------------------------------- */

/* Skiftet mellem de to visninger. Den aktive er et <span> og ikke et deaktiveret
   link, så der aldrig er en knap, der ser klikbar ud og ikke er det. */
.vis-skift { display: inline-flex; gap: .25rem; }
.vis-skift .btn-valgt {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  cursor: default;
}

/* BREDDEN LIGGER I INDPAKNINGEN, IKKE PÅ SIDEN - samme mønster som .kd-wrap og
   .fd-wrap, husets to eksisterende svar på "indhold bredere end siden, som ikke er
   en tabel". Ti søjler à 15rem er ~2400 px og altså bredere end enhver skærm her;
   uden det her ville hele siden scrolle sidelæns, og så forsvinder den første søjle
   ud til venstre netop mens man læser den sidste. */
.tavle-wrap {
  overflow-x: auto;
  max-width: 100%;
  padding: .2rem 0 .5rem;
}
.tavle {
  display: flex;
  align-items: flex-start;   /* SØJLER AF FORSKELLIG HØJDE - hele pointen i tegningen.
                                stretch ville gøre dem lige høje og udslette formen. */
  gap: .6rem;
  min-width: min-content;
}
.tavle-soejle {
  flex: 0 0 15rem;           /* Samme bredde som .card-grid har valgt for et kort. */
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: .35rem solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .5rem .5rem .6rem;
}
/* En tom søjle TEGNES, den skjules ikke - se tavleFra. Den tones ned, så den ikke
   stjæler blikket, men den er der, så man kan se at arket blev spurgt. */
.tavle-soejle.er-tom { opacity: .55; border-top-color: var(--border-strong); }

.tavle-hoved { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .45rem; margin-bottom: .45rem; }
.tavle-nr {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  text-decoration: none;
  color: inherit;
}
.tavle-nr:hover { color: var(--accent); }
.tavle-titel {
  flex: 1 1 100%;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tavle-tal-linje { flex: 1 1 100%; font-size: .78rem; font-weight: 700; color: var(--text-muted); }

.tavle-kort-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.tavle-kort {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .3rem .4rem;
  background: var(--surface-2);
  font-size: .82rem;
}
.tavle-kort-top { display: flex; align-items: baseline; gap: .4rem; }
.tavle-prod { font-weight: 800; font-variant-numeric: tabular-nums; text-decoration: none; color: inherit; }
.tavle-prod:hover { color: var(--accent); }
.tavle-kort-top .chip { margin-left: auto; font-size: .68rem; }
/* Vare er median 22 tegn og p90 32. Den klippes med vilje og bærer hele strengen i
   title - en søjle på 15rem kan ikke bære 32 tegn uden at blive to søjler. */
.tavle-vare { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Mærket er median 6 tegn og højst 20 - én linje holder det. Det klippes alligevel som
   Vare, så en lang supplerende tekst aldrig gør kortet højere. */
.tavle-maerke { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .74rem; font-weight: 700; color: var(--text-muted); }
.tavle-tal { font-size: .74rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tavle-intet { margin: .2rem 0; font-size: .8rem; color: var(--text-muted); }
.auto-recommendation { display: block; margin-top: .15rem; max-width: 22rem;
  white-space: normal; font-size: .74rem; line-height: 1.35; font-weight: 400; color: var(--text-muted); }
@media screen {
  table.grid .auto-recommendation { min-width: 16rem; }
}
/* Explicit H.MM totals contain words. Let them wrap so the footer cannot
   squeeze the colour/recommendation column into a tall strip. */
table.grid tr.grid-sum > td.num { white-space: normal !important; max-width: 14rem; }
.date-priority-note { margin: .7rem 0; padding: .6rem .8rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2); font-size: .85rem; }
.date-priority-note p { margin: .25rem 0; }

/* KØEN ER FOLDET SAMMEN. Målt værste tilfælde er ejerens egen Montering-gruppe: én
   søjle med 98 kort og seks tomme ved siden af. Åbne bånd ville gøre tavlen til en
   søjle, man scroller i, og blikket er hele grunden til at den findes. */
.tavle-koe { margin-top: .4rem; border-top: 1px dashed var(--border); padding-top: .35rem; }
.tavle-koe > summary {
  cursor: pointer;
  font-size: .76rem;
  font-weight: 700;
  color: var(--text-muted);
  list-style-position: inside;
}
.tavle-koe[open] > summary { margin-bottom: .3rem; }
.tavle-koe .tavle-kort { opacity: .72; background: none; border-style: dashed; }

.tavle-tal-note { margin: .3rem 0 .6rem; }

@media (max-width: 720px) {
  .tavle-soejle { flex-basis: 12.5rem; }
}

/* Nothing scrolls on paper. Søjlerne brydes i stedet om, og køen foldes ud, så en
   udskrift ikke tavst mangler det, skærmen havde klappet sammen. */
@media print {
  .tavle-wrap { overflow: visible !important; }
  .tavle { flex-wrap: wrap; min-width: 0; }
  .tavle-soejle { break-inside: avoid; box-shadow: none; }
  .tavle-koe > summary { list-style: none; }
  .tavle-koe > *:not(summary) { display: block !important; }
  .vis-skift { display: none !important; }
}

/* --- sheet toolbar ------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem .8rem;
  margin-bottom: .8rem;
}
.toolbar form.search { display: flex; gap: .4rem; }
.toolbar input[type="search"] { min-width: 14rem; }

.active-filters { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.active-filters .pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .25rem .5rem .25rem .65rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--surface);
  font-size: .78rem;
  font-weight: 600;
}
.active-filters .pill a {
  text-decoration: none;
  font-weight: 800;
  color: var(--text-muted);
  padding: 0 .15rem;
}

/* --- data table ---------------------------------------------------------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table.grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 1.02rem;
}

table.grid thead th {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-strong);
  padding: .35rem .5rem;
  text-align: left;
  vertical-align: bottom;
  font-size: .82rem;
  /* Header labels wrap rather than force the table wider than the screen; the
   * operation column name is long ("Spænde udpakning"). */
  white-space: normal;
  max-width: 11rem;
}
table.grid thead th .th-inner {
  display: flex;
  align-items: center;
  gap: .3rem;
  justify-content: space-between;
}
table.grid thead th .sort-link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .3rem .2rem;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}
table.grid thead th .sort-link:hover { color: var(--accent); }
table.grid thead th .sort-ind { color: var(--accent); font-size: .9rem; }
/* The operation number. Off-screen by default - the words identify a column fine
 * when there are seven of them - and turned on by the all-columns print, where a
 * column is a 3 mm strip and the number is the only label that always fits. */
table.grid thead th .th-nr { display: none; }
table.grid thead th.sorted { background: var(--bg-soft); }
table.grid thead th.num .th-inner { flex-direction: row-reverse; }

table.grid tbody td {
  padding: .55rem .5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.grid tbody tr:last-child td { border-bottom: 0; }

/* The ark's tail - what the rows are sorted by, and the rule that routed them here.
 * It is the LAST ROW of the table rather than a block after it, because thead is the
 * only thing that repeats across printed pages: outside the table it could land on a
 * sheet of its own with no ark number and no date on it. It is a footnote, not data,
 * so it drops the cell borders and the colour rail every other row carries. */
table.grid tbody tr.ark-hale > td {
  border: 0;
  padding: .85rem .5rem .3rem 1rem;
  color: var(--text-muted);
  font-size: .85rem;
}
table.grid tbody tr.ark-hale > td p.sub { margin: 0; }
table.grid tbody tr.ark-hale > td details.sub { margin-top: .5rem; }

table.grid td.num, table.grid th.num { text-align: right; }
table.grid td.rank {
  color: var(--text-muted);
  font-size: .8rem;
  text-align: right;
  width: 2.5rem;
}
table.grid td.prod { font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
table.grid td.vare { min-width: 12rem; }
table.grid td.dato { white-space: nowrap; font-weight: 600; }

/* `Sidst rørt`: on the order's line, out of the way. Muted and one step down in
 * size because it is not what the bench acts on - it is what they read only when
 * the order is not where the rest of the row says it should be.
 *
 * THE CELL GREW when it started carrying all four parts (name, operation, date,
 * clock time) on 2026-08-26: measured over the 148 live orders with history it
 * went from median 11 / max 20 characters to MEDIAN 28 / MAX 37. `nowrap` still
 * holds `Katarzyna · op. 40 · 26-08 10:25` on one line ON SCREEN, where the table
 * scrolls sideways inside .table-wrap.
 *
 * ON PAPER IT WRAPS, and that is intended: the print block sets
 * `white-space: normal !important` on every .grid cell, and the ark table is
 * `table-layout: fixed`, so a nowrap cell 37 characters wide would run off the
 * right edge of an A4 portrait sheet instead of taking a second line. Do not add
 * a print-only nowrap here. */
table.grid td.sidst {
  color: var(--text-muted);
  font-size: .85rem;
  white-space: nowrap;
}
/* Measured from Probiz's own clock rather than reasoned from the flow: a step
 * back towards the body colour, because it is a stronger claim. */
table.grid td.sidst-praecis { color: var(--text); }
/* STILL RUNNING - somebody has this belt in their hands. The strongest state the
 * column can show, so it is the only one that gets weight, and the ● in the text
 * carries it on a mono printer where the colour does not. */
table.grid td.sidst-aaben { color: var(--text); font-weight: 700; }
.sidst-prik { color: #2e8b2e; }

/* Colour-coded rows: tint + a fat left rail so the priority reads from across
 * the workshop. These selectors are scoped through `table.grid tbody` so they
 * outrank the plain-row background below them. */
table.grid tbody tr { background: var(--surface); }
table.grid tbody tr td:first-child { border-left: .55rem solid transparent; }
table.grid tbody tr.farve-bla { background: var(--f-bla-bg); }
table.grid tbody tr.farve-bla td:first-child { border-left-color: var(--f-bla-line); }
table.grid tbody tr.farve-rod { background: var(--f-rod-bg); }
table.grid tbody tr.farve-rod td:first-child { border-left-color: var(--f-rod-line); }
table.grid tbody tr.farve-gul { background: var(--f-gul-bg); }
table.grid tbody tr.farve-gul td:first-child { border-left-color: var(--f-gul-line); }
table.grid tbody tr.farve-gron { background: var(--f-gron-bg); }
table.grid tbody tr.farve-gron td:first-child { border-left-color: var(--f-gron-line); }

/* Molebo - Bosswik's own private label. A real bucket, ranked after Grøn. */
.chip.farve-molebo { border-color: var(--f-molebo-line); background: var(--f-molebo-bg); }
table.grid tbody tr.farve-molebo { background: var(--f-molebo-bg); }
table.grid tbody tr.farve-molebo td:first-child { border-left-color: var(--f-molebo-line); }

/* The planner's hand sort inside a colour, shown next to the chip. */
.under {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.32rem;
  border-radius: 0.35rem;
  background: var(--under-bg, rgba(120, 120, 130, 0.16));
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.86em;
}
.under::before { content: "#"; opacity: 0.6; }
table.grid tbody tr.farve-ikke {
  background: repeating-linear-gradient(
    135deg,
    var(--f-ikke-bg),
    var(--f-ikke-bg) 14px,
    var(--surface) 14px,
    var(--surface) 28px
  );
}
table.grid tbody tr.farve-ikke td:first-child { border-left-color: var(--f-ikke-line); }
table.grid tbody tr.farve-ikke td.prod { text-decoration: underline dashed var(--f-ikke-line); }

/* Blå-kø: Rød that deserves Blå and waits under the Blå-loft. Stripes of the two colours
 * and a dashed blue rail; the ↑n and "venter på Blå" carry it without colour. */
table.grid tbody tr.farve-rod.blaa-koe {
  background: repeating-linear-gradient(135deg, var(--f-rod-bg), var(--f-rod-bg) 14px, var(--f-bla-bg) 14px, var(--f-bla-bg) 22px);
}
table.grid tbody tr.farve-rod.blaa-koe td:first-child { border-left-color: var(--f-bla-line); border-left-style: dashed; }
table.grid.sticky-cols tbody tr.farve-rod.blaa-koe td.sticky-col { background: var(--f-rod-bg); }
.blaa-koe-mark { display: inline-block; margin-left: .3rem; padding: 0 .35rem; border-radius: .3rem;
  background: var(--surface); color: var(--f-bla-line); font-weight: 800; font-size: .78rem; }
.blaa-koe-tekst { margin-left: .35rem; font-size: .75rem; font-weight: 700; color: var(--f-bla-line); }
/* A pinned rank column is 2.6rem and clips what does not fit (ellipsis), and a mark beside the
 * number does not fit: there the mark stands UNDER the number, right-aligned like it. */
table.grid.sticky-cols td.rank .blaa-koe-mark { display: block; width: max-content; margin: .15rem 0 0 auto; padding: 0 .25rem; }
/* The cap line: a row of its own, one cell wide as the whole table. No left rail - it is not an order. */
table.grid tbody tr.blaa-loft-linje > td { border-top: 3px solid var(--f-bla-line); border-left: 0;
  background: var(--surface); color: var(--f-bla-line); font-weight: 800; letter-spacing: .05em; text-align: center; padding: .35rem; }
.blaa-loft-sub { font-weight: 400; letter-spacing: 0; color: var(--text-muted); }
.blaa-loft-status { background: var(--surface); border: 1px solid var(--border); border-radius: .5rem; padding: .6rem 1rem; margin: .5rem 0; }
.blaa-loft-status p { margin: .2rem 0; }
.blaa-loft-bar { vertical-align: middle; width: 12rem; margin-left: .5rem; }
/* The preview banner: the same yellow in both themes, so its text is set dark and does not follow
   --text (light in the dark theme). It stays on the printed page - a printed preview must say so. */
.forhaandsvisning { background: #fff0c2; border: 2px solid #b58900; color: #1f1700; padding: .5rem 1rem; margin: .5rem 0; border-radius: .4rem; }
.forhaandsvisning a { color: inherit; text-decoration: underline; }
table.grid tbody tr.farve-skjult { background: var(--f-skjult-bg); }
table.grid tbody tr.farve-skjult td:first-child { border-left-color: var(--f-skjult-line); }

/* Molebo (ikke valgt) - parked, never printed, and the BIGGEST bucket on
 * /komplet: 83 of 271 rows. It was the only colour with no tbody rule at all,
 * while line 809 tinted its two frozen columns - so the largest bucket on the
 * page read as a purple wash under Prod. and Vare that stopped dead at the
 * third column, with 54 white ones to the right and no left rail. Dashed, like
 * its chip: dashed means "never reaches an ark". */
table.grid tbody tr.farve-molebo-parkeret { background: var(--f-molebo-bg); }
table.grid tbody tr.farve-molebo-parkeret td:first-child {
  border-left-color: var(--f-molebo-line);
  border-left-style: dashed;
}

.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* --- filter dropdown ----------------------------------------------------- */

details.filter { position: relative; }
details.filter > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: .8rem;
  user-select: none;
}
details.filter > summary::-webkit-details-marker { display: none; }
details.filter > summary:hover { border-color: var(--accent); }
details.filter.active > summary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.filter-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + .3rem);
  right: 0;
  width: 20rem;
  max-width: 80vw;
  padding: .6rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  font-size: .82rem;
  font-weight: 400;
  white-space: normal;
  text-align: left;
}
.filter-panel h3 { font-size: .82rem; margin-bottom: .4rem; }
.filter-panel .panel-search { width: 100%; margin-bottom: .4rem; }
.filter-panel .panel-actions {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-bottom: .45rem;
}
/* A COLUMN, so the Anvend row can never be pushed off the bottom.
 *
 * The panel used to be a plain block: the option list took a max-height, the actions
 * sat after it, and when the header the panel hangs from was low on the page the
 * whole thing simply ran past the bottom of the window. Measured 2026-08-24 at
 * 720 px tall: the panel ended at y=882 and the Anvend button lived at 834-870 -
 * entirely below the fold on every one of the seven filters. The owner's words were
 * "i can choose the filters but they wont activate": they could tick values and
 * there was no reachable way to apply them.
 *
 * Now the panel is height-bounded by positionPanel, the OPTIONS take the slack and
 * scroll, and the search, the actions and Anvend are flex-fixed at either end. The
 * apply button is inside the box whatever the list is doing. */
/* An open filter's own column header outranks the frozen ones. See setHost in
 * grid.js: without this the sticky Prod./Vare headers - their own stacking contexts
 * at z-index 35 - sit ON TOP of a panel whose z-index says 60, and the Anvend button
 * is visible but unclickable on every filter whose panel overlaps them. */
table.grid thead th.filter-open,
.data-page table.grid thead th.filter-open,
table.grid.sticky-cols thead th.sticky-col.filter-open { z-index: 80; }

.filter-panel { display: flex; flex-direction: column; }
.filter-panel { overflow-y: auto; }
.filter-panel h3,
.filter-panel .panel-search,
.filter-panel .panel-actions,
.filter-panel .panel-apply,
.filter-panel .nojs-hint { flex: 0 0 auto; }
.filter-options {
  max-height: 18rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex: 1 1 auto;
  /* Without this a flex child refuses to shrink below its content, and the list
     pushes the actions out again - the exact bug this block exists to fix. */
  min-height: 0;
}
.filter-option {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .5rem;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.filter-option:last-child { border-bottom: 0; }
.filter-option:hover { background: var(--bg-soft); }
.filter-option .box {
  flex: 0 0 auto;
  width: 1.1rem; height: 1.1rem;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  line-height: 1;
  color: var(--accent-text);
}
.filter-option[data-selected="1"] .box { background: var(--accent); border-color: var(--accent); }
.filter-option .label { flex: 1 1 auto; overflow-wrap: anywhere; }
.filter-option .count { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.filter-option.hidden-by-search { display: none; }
.filter-panel .panel-apply { display: none; margin-top: .5rem; }
html.js .filter-panel .panel-apply { display: flex; flex-wrap: wrap; gap: .35rem; }
html.js .filter-panel .nojs-hint { display: none; }
.filter-panel .nojs-hint { color: var(--text-muted); font-size: .72rem; margin-top: .45rem; }

/* --- admin ---------------------------------------------------------------
 * /admin ships its own stylesheet (public/admin.css, inlined by renderAdmin);
 * only the shared shell, tokens and .badge below come from this file.
 * ------------------------------------------------------------------------- */

/* --- login / error ------------------------------------------------------- */

.panel {
  max-width: 26rem;
  margin: 3rem auto;
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel h1 { font-size: 1.35rem; margin-bottom: .3rem; }
.panel p { color: var(--text-muted); font-size: .85rem; }
.panel form { display: flex; flex-direction: column; gap: .6rem; margin-top: 1rem; }
.panel label { font-size: .85rem; font-weight: 600; }
.form-error {
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--warn-border);
  background: var(--warn-bg);
  font-size: .85rem;
  font-weight: 600;
}
.error-code { font-size: 3.4rem; font-weight: 800; line-height: 1; }

/* --- panels shared by the new public pages ------------------------------- */

.panel-wide {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin-bottom: 1.1rem;
}
.panel-wide h2 { font-size: 1.15rem; margin-bottom: .5rem; }
.panel-wide h2 .sub { color: var(--text-muted); font-size: .8rem; font-weight: 600; }
.panel-wide p { margin: .35rem 0 .6rem; font-size: .9rem; }
.panel-wide .sub, .panel-wide p.sub { color: var(--text-muted); font-size: .82rem; }
.panel-wide code {
  display: block;
  margin-top: .3rem;
  padding: .4rem .5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
  font-size: .78rem;
}
.section-head { font-size: 1.15rem; margin: 1.3rem 0 .7rem; }

/* The totals strip is split in two rows: the arithmetic, then one chip per
 * colour. The sum line underneath is what proves nothing was lost. */
.totals-colours { margin-top: -.7rem; }
.totals-sum { margin: -.5rem 0 1.2rem; color: var(--text-muted); font-size: .8rem; }

/* 'Molebo (ikke valgt)' is a SEPARATE bucket from 'Molebo' - indeks 98, parked,
 * never on an ark. Dashed, like the other never-printed state. */
.chip.farve-molebo-parkeret {
  border-color: var(--f-molebo-line);
  background: var(--f-molebo-bg);
  border-style: dashed;
}

/* --- the hidden 'Ikke prioriteret' rows ---------------------------------- */

.hide-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: .1rem 0 .8rem;
  padding: .5rem .8rem;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--f-ikke-line);
  background: var(--f-ikke-bg);
  font-size: .85rem;
  font-weight: 600;
}
.hide-note.is-shown { border-style: solid; }

/* --- Fokus: «vis kun Blå med # op til N» ---------------------------------- */
/* Solid and in Blå's own colours: this line is the only thing on a wall screen
   saying that most of the ark is being held back, and it prints with the ark. */
.fokus-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: .1rem 0 .8rem;
  padding: .55rem .8rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--f-bla-line);
  border-left-width: .5rem;
  background: var(--f-bla-bg);
  font-size: .95rem;
}
.fokus-note a { margin-left: auto; font-size: .85rem; }
.hide-note.is-forced { border-color: var(--accent); background: var(--surface-2); }
.hide-toggle {
  padding: .2rem .6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  font-weight: 800;
  text-decoration: none;
}

/* --- the queue behind an ark (koeLaengde / koeVenterPaa) ----------------- */

/* Ark 26 and ark 31 print blank paper while 14 orders each wait one operation
 * away. This is context, not an alarm: muted, one line, never louder than the
 * rows it stands next to. It DOES print - a blank sheet with no reason on it is
 * what sent someone looking for a fault that was not there. */
.koe-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: .1rem 0 .8rem;
  padding: .35rem .7rem;
  border-left: 3px solid var(--border-strong);
  color: var(--text-muted);
  font-size: .85rem;
}
.koe-link {
  padding: .1rem .5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font-weight: 700;
  text-decoration: none;
}

/* On an EMPTY ark the queue is the whole message, so it gets its own line inside
 * the empty state rather than trailing off the end of the sentence above it. */
.empty-state .koe-extra {
  display: block;
  margin-top: .6rem;
  font-weight: 600;
  color: var(--text);
}

.sheet-card .koe-badge {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* --- the queue block: the last rows of an ark's own table ----------------- */
/*                                                                           */
/* It is INSIDE the table on purpose (see koeBlok in render.js: only thead    */
/* repeats across printed pages), so these rules have to beat the grid's own  */
/* row rules without an !important war. Same shape as tr.ark-hale above:      */
/* table.grid tbody tr.<class> > td, three classes deep, so source order      */
/* cannot decide the outcome.                                                 */
/*                                                                           */
/* The queue rows carry NO colour band - gridBody drops tr.farve-* for them - */
/* because a bench reads top to bottom and a red band under a red band says   */
/* "make this next" about an order that cannot be started. The colour is still */
/* on the row, as the chip's word in the Farve cell.                          */

table.grid tbody tr.koe-hoved > td {
  border: 0 !important;
  border-top: 2px solid var(--border-strong) !important;
  background: var(--surface-2);
  padding: .7rem .55rem .45rem;
}
.koe-hoved-titel {
  display: inline-block;
  font-weight: 800;
  font-size: .95rem;
  margin-right: .55rem;
}
.koe-hoved-sub {
  color: var(--text-muted);
  font-size: .82rem;
}
.koe-toggle {
  margin-left: .5rem;
  padding: .1rem .5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

table.grid tbody tr.koe-gate > td {
  border: 0 !important;
  border-top: 1px solid var(--border) !important;
  background: var(--surface-2);
  padding: .3rem .55rem;
  font-size: .82rem;
  font-weight: 700;
}
.koe-gate-tal {
  margin-left: .4rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* Muted, italic, no band: everything about the row says "not yet". */
table.grid tbody tr.koe-raekke > td {
  background: transparent;
  color: var(--text-muted);
  font-style: italic;
}
table.grid tbody tr.koe-raekke > td:first-child { border-left-color: var(--border) !important; }
table.grid tbody tr.koe-raekke > td.prod { font-style: normal; }
table.grid tbody tr.koe-raekke .chip { font-style: normal; }

/* Timerne på arkets egen operation, ved siden af ordreoptællingen i sidehovedet.
   Samme vægt som .ark-count på kortet: det er tallet, en plads bemandes efter. */
.page-head .ark-timer {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- a sorted ark is not a prioritised ark ------------------------------- */

/* Lives inside .page-head, the block @media print keeps. flex-basis 100% drops
 * it onto its own line under the title without disturbing the buttons beside it. */
.sort-warning {
  flex: 1 0 100%;
  display: flex;
  /* A tablet at 375 px is a shop-floor screen too, and .btn does not shrink: without
     the wrap the banner grew wider than the page and took the body with it. */
  flex-wrap: wrap;
  align-items: center;
  gap: .9rem;
  padding: .7rem 1rem;
  border-radius: var(--radius);
  border: 3px solid var(--warn-border);
  background: var(--warn-bg);
}
.sort-warning .sort-warning-flag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 2px solid var(--warn-border);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
}
.sort-warning .sort-warning-text { flex: 1 1 18rem; min-width: 0; }
.sort-warning .sort-warning-text strong {
  display: block;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.sort-warning .sort-warning-text span { font-size: .88rem; }
.sort-warning .sort-warning-back { flex: 0 1 auto; }

/* The print-only half of a message whose other half is a button. */
.print-only { display: none; }

/* The warning repeated as a thead row so it comes out on every printed page.
 * Hidden on screen - the banner above the table already says it once. */
tr.print-sort-warning { display: none; }

/* The ark's number, its title and how old its numbers are, repeated as a thead row
 * so every printed page carries them. Hidden on screen: the <h1> says the first two
 * and the status bar says the third, and nothing here may change what a bench sees
 * on the wall screen. */
tr.print-ident { display: none; }

/* --- wide data pages: /komplet, /prioritet, /valgt ----------------------- */

/* 54 columns. The sideways scroll is confined to the wrapper so the page body
 * never moves, and the wrapper gets a height so the header row and the pinned
 * columns have something to stick to - Excel's frozen pane, which this table
 * replaces and the workbook never had here. */
.data-page .table-wrap.scroll-x {
  overflow: auto;
  max-height: calc(100vh - var(--header-h) - 12rem);
  min-height: 14rem;
}
.data-page table.grid thead th { top: 0; z-index: 30; }
table.grid.data-grid { font-size: .92rem; }
table.grid.data-grid thead th .th-nr { display: inline; color: var(--text-muted); }
/* Group names do not set the operation width: a long saved table name is clipped
   on one compact line, with its complete value available in the title. */
table.grid.data-grid thead th .th-group {
  display: block;
  contain: inline-size;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .65rem;
  line-height: 1.3;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0 .2rem .2rem;
}
table.grid.data-grid thead th.op-group-start { border-left: 2px solid var(--border-strong, var(--border)); }
table.grid.data-grid tbody td { white-space: nowrap; }
table.grid.data-grid td.vare { min-width: 0; max-width: 20rem; overflow: hidden; text-overflow: ellipsis; }

table.grid.sticky-cols {
  --sticky-w-0: 2.6rem;
  --sticky-w-1: 6.6rem;
  --sticky-w-2: 13rem;
  --sticky-w-3: 8rem;
}
table.grid.sticky-cols th.sticky-col,
table.grid.sticky-cols td.sticky-col {
  position: sticky;
  z-index: 10;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
table.grid.sticky-cols thead th.sticky-col { z-index: 35; background: var(--surface-2); }
/* A pinned column is offset by a CONSTANT, so its real width has to equal that
 * constant or the next pinned column leaves a sliver of scrolling content showing
 * through. Chrome's auto table layout ignores a plain width here - it resolved
 * Prod. to 107px against a declared 118.8px - so min-width and max-width pin it for
 * real. Measured flush at 1280px: 0..47, 47..166, 166..400. Every selector below
 * names both the th and the td on purpose: that is what outranks the .vare and
 * .rank rules further up, which would otherwise widen the column back out. */
table.grid.sticky-cols th.sticky-0, table.grid.sticky-cols td.sticky-0 {
  left: 0;
  width: var(--sticky-w-0); min-width: var(--sticky-w-0); max-width: var(--sticky-w-0);
}
table.grid.sticky-cols th.sticky-1, table.grid.sticky-cols td.sticky-1 {
  left: var(--sticky-w-0);
  width: var(--sticky-w-1); min-width: var(--sticky-w-1); max-width: var(--sticky-w-1);
}
table.grid.sticky-cols th.sticky-2, table.grid.sticky-cols td.sticky-2 {
  left: calc(var(--sticky-w-0) + var(--sticky-w-1));
  width: var(--sticky-w-2); min-width: var(--sticky-w-2); max-width: var(--sticky-w-2);
}
table.grid.sticky-cols th.sticky-3, table.grid.sticky-cols td.sticky-3 {
  left: calc(var(--sticky-w-0) + var(--sticky-w-1) + var(--sticky-w-2));
  width: var(--sticky-w-3); min-width: var(--sticky-w-3); max-width: var(--sticky-w-3);
}
/* Clamped to a fixed width, so a long Vare has to be cut rather than push the
 * column - and the whole value is still in the title-free cell text of the CSV. */
table.grid.sticky-cols td.sticky-col { overflow: hidden; text-overflow: ellipsis; }
/* A pinned cell floats over the rows it scrolls past, so it must repeat the row
 * tint - a transparent one would smear the colour coding. */
table.grid.sticky-cols tbody tr.farve-bla td.sticky-col { background: var(--f-bla-bg); }
table.grid.sticky-cols tbody tr.farve-rod td.sticky-col { background: var(--f-rod-bg); }
table.grid.sticky-cols tbody tr.farve-gul td.sticky-col { background: var(--f-gul-bg); }
table.grid.sticky-cols tbody tr.farve-gron td.sticky-col { background: var(--f-gron-bg); }
table.grid.sticky-cols tbody tr.farve-molebo td.sticky-col,
table.grid.sticky-cols tbody tr.farve-molebo-parkeret td.sticky-col { background: var(--f-molebo-bg); }
table.grid.sticky-cols tbody tr.farve-ikke td.sticky-col { background: var(--f-ikke-bg); }
table.grid.sticky-cols tbody tr.farve-skjult td.sticky-col { background: var(--f-skjult-bg); }

.print-note, .sticky-note { margin: .1rem 0 .6rem; }
.print-note { font-weight: 600; }

/* --- the gate graph ------------------------------------------------------ */

.chain-wrap { overflow-x: auto; }
svg.chain {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  margin: 0 auto .9rem;
}
svg.chain text { font-family: inherit; font-size: 13px; fill: var(--text); }
svg.chain .chain-box rect { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.2; }
svg.chain .chain-ark rect { fill: var(--f-bla-bg); stroke: var(--f-bla-line); stroke-width: 1.6; }
svg.chain .chain-orphan rect {
  fill: var(--warn-bg);
  stroke: var(--warn-border);
  stroke-width: 1.8;
  stroke-dasharray: 5 3;
}
svg.chain .chain-op { font-weight: 800; }
svg.chain .chain-name { fill: var(--text-muted); font-size: 12px; }
svg.chain .chain-owner { fill: var(--text-muted); font-size: 11px; }
svg.chain .chain-orphan .chain-owner { fill: var(--warn-border); font-weight: 800; }
svg.chain .chain-title {
  font-size: 12px;
  font-weight: 800;
  fill: var(--text-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}
svg.chain .chain-edge { fill: none; stroke: var(--border-strong); stroke-width: 1.6; }
svg.chain .chain-edge-back { stroke: var(--f-rod-line); stroke-width: 2.2; stroke-dasharray: 7 4; }
svg.chain .chain-arrowhead { fill: var(--border-strong); }
svg.chain .chain-arrowhead-back { fill: var(--f-rod-line); }
svg.chain .chain-legend text { font-size: 11px; fill: var(--text-muted); }

.chain-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: .7rem;
  margin: .6rem 0 0;
}
.chain-item {
  padding: .5rem .7rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.chain-item dt { font-weight: 800; font-size: .95rem; margin-bottom: .2rem; }
.chain-item dd { margin: 0; font-size: .8rem; color: var(--text-muted); }
.chain-item ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.chain-item li { margin: .12rem 0; color: var(--text); font-size: .8rem; }
.chain-flag {
  color: var(--f-rod-line);
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.chain-flag-orphan { color: var(--warn-border); }
.chain-owner-note { color: var(--text-muted); font-size: .75rem; }
.rule-warn {
  border-left: .35rem solid var(--warn-border);
  padding-left: .6rem;
  font-weight: 600;
}

/* --- routing rule cards -------------------------------------------------- */

.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(23rem, 1fr));
  gap: .8rem;
}
.rule-card {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .75rem .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: .4rem solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.rule-card.is-custom { border-left-color: var(--f-gul-line); }
.rule-card.is-quiet { opacity: .72; }
.rule-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.rule-no { font-size: 1.15rem; font-weight: 800; color: inherit; text-decoration: none; }
.rule-no:hover { color: var(--accent); }
.rule-count { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.rule-count b { font-size: 1rem; color: var(--text); }
.rule-count.is-queued b { color: var(--f-gul-line); }
/* "N vist på arket" - shown only when it differs from what the rule matches. */
.rule-count.is-held b { color: var(--f-ikke-line); }
.rule-title { font-size: .86rem; font-weight: 700; color: var(--text-muted); }
.rule-danish { margin: 0; font-size: .88rem; }
.rule-danish.is-big { font-size: 1.1rem; font-weight: 600; }
.rule-facts { display: flex; flex-wrap: wrap; gap: .6rem; }
.rule-fact {
  flex: 1 1 12rem;
  padding: .4rem .55rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.rule-fact-label {
  display: block;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.rule-fact ul { margin: .25rem 0 0; padding-left: 1rem; font-size: .82rem; }
.rule-fact-empty { font-size: .8rem; font-style: italic; color: var(--text-muted); }
.rule-foot { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: auto; }
.rule-stamp { font-size: .72rem; color: var(--text-muted); }
.badge-custom { border-color: var(--f-gul-line); color: var(--f-gul-line); }
.rule-original { margin: .4rem 0; }
.rule-original summary { cursor: pointer; font-size: .82rem; color: var(--text-muted); }

/* --- the rule editor ----------------------------------------------------- */

.op-grid-wrap {
  max-height: 26rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
table.op-grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .85rem; }
table.op-grid thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: .4rem .5rem;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-strong);
  text-align: left;
  font-size: .78rem;
}
table.op-grid td { padding: .3rem .5rem; border-bottom: 1px solid var(--border); }
table.op-grid tr.is-own td { background: var(--f-bla-bg); }
table.op-grid .op-col { width: 9rem; text-align: center; }
table.op-grid .op-col label { display: block; padding: .3rem; cursor: pointer; }
table.op-grid input[type="checkbox"] { width: 1.25rem; height: 1.25rem; }
.op-name b { font-variant-numeric: tabular-nums; }
/* The explanatory line under the three headings, and the krydset-af switch column. */
table.op-grid .op-grid-sub td { padding: .25rem .5rem; border-bottom: 1px solid var(--border); background: var(--surface); }
table.op-grid .op-switch input[disabled] { opacity: .35; cursor: not-allowed; }
.rule-free-rows { margin: .8rem 0; padding: .5rem .7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.rule-free-rows h3 { font-size: .9rem; margin: 0 0 .3rem; }
.rule-free-rows ul { margin: 0 0 .3rem; padding-left: 1.1rem; font-size: .85rem; }
/* /ruteregler: «Krydset af ⇒ regnes som færdig». */
.ks-table td { vertical-align: top; }
.ks-table tr.ks-fra td { color: var(--text-muted); }
.ks-table tr.is-valgt td { background: var(--f-gul-bg); }
.ks-table b.ks-til { color: var(--ok-border); }
.ks-table b.ks-fra { color: var(--warn-border); }
.ks-ring { color: var(--warn-border); font-weight: 700; }
.ks-handling, .ks-gem { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.ks-gem { margin-top: .5rem; }
.ks-tilfoej fieldset { margin: .8rem 0; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ks-tilfoej select { max-width: 16rem; }
/* What a rule change does on the other arks. */
.rule-preview-tvaers { margin-top: .6rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.tvaers-ark { margin: .4rem 0; }
.tvaers-ark h5 { font-size: .82rem; margin: 0 0 .15rem; }

.rule-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .8rem 0; }
.rule-reset {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding-top: .7rem;
  border-top: 1px solid var(--border);
}
.btn[disabled] { cursor: not-allowed; }

.rule-preview {
  margin: .8rem 0;
  padding: .7rem .8rem;
  background: var(--surface-2);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.rule-preview.is-ok { border-style: solid; border-color: var(--ok-border); background: var(--ok-bg); }
.rule-preview.is-bad { border-style: solid; border-color: var(--warn-border); background: var(--warn-bg); }
.rule-preview h3 { font-size: 1rem; margin-bottom: .3rem; }
.rule-preview h4 { font-size: .8rem; margin: .4rem 0 .2rem; }
.rule-preview-sum { font-size: 1rem; }
.rule-preview-sum .up { color: var(--ok-border); }
.rule-preview-sum .down { color: var(--warn-border); }
/* The second sentence of the consequence panel: what the ark will PRINT, which
 * is not what the rule matches. Quieter than the headline, but not a footnote -
 * it is the number a planner is actually deciding on. */
.rule-preview-print { font-size: .88rem; color: var(--text-muted); margin-top: .25rem; }
.rule-preview-print b { color: var(--text); }
.prod-list li .chip { margin-left: .3rem; font-size: .74rem; padding: 0 .3rem; }
.rule-preview-lists { display: flex; gap: 1rem; flex-wrap: wrap; }
.rule-preview-lists > div { flex: 1 1 14rem; }
.prod-list { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.prod-list li {
  padding: .1rem .4rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: .35rem;
  font-size: .78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.prod-list.is-added li { border-color: var(--ok-border); }
.prod-list.is-removed li { border-color: var(--warn-border); text-decoration: line-through; }
.rule-errors {
  margin: .4rem 0;
  padding-left: 1.1rem;
  color: var(--warn-border);
  font-size: .85rem;
  font-weight: 600;
}

/* --- rule history and the queue table ------------------------------------ */

.rule-audit { margin: .3rem 0 0; padding-left: 1.2rem; font-size: .82rem; }
.rule-audit li { margin: .3rem 0; }
.rule-when { color: var(--text-muted); margin-right: .4rem; }
.rule-arrow { color: var(--text-muted); }
.rule-audit-diff { display: block; color: var(--text-muted); font-size: .76rem; }
.gate-chip {
  display: inline-block;
  padding: .05rem .4rem;
  background: var(--f-gul-bg);
  border: 1px solid var(--f-gul-line);
  border-radius: .35rem;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}
table.grid td.waiting { white-space: normal; }
.op-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .1rem .9rem;
  margin: .4rem 0 0;
  padding: 0;
  list-style: none;
  font-size: .82rem;
}
.op-list li { padding: .18rem 0; border-bottom: 1px solid var(--border); }
.adm-rule-link { font-size: .8rem; }

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 1400px) {
  html { font-size: 18px; }
  :root { --header-h: 6.6rem; } /* measured 93px at 1200px */
  .banner .big { font-size: 3.2rem; }
  table.grid { font-size: .95rem; }
  table.grid tbody td { padding: .45rem .35rem; }
  table.grid td.vare { min-width: 8rem; }
}

@media (max-width: 1100px) {
  :root { --header-h: 7.8rem; } /* measured 135px at 960px */
  /* Too narrow for eight columns: the table scrolls sideways inside its own box
   * instead of dragging the whole page (and the sticky page header) with it.
   * The wrapper is then the sticky containing block, so `top` MUST be 0 here -
   * any other value shoves the header row down over the first rows. */
  .table-wrap { overflow-x: auto; }
  table.grid thead th { top: 0; }
}

@media (max-width: 720px) {
  html { font-size: 17px; }
  /* The page header stops being sticky here, so the table header sticks to the
   * top of the viewport instead of underneath it. */
  .app-header { position: static; }
  table.grid thead th { top: 0; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
  main { padding: .7rem .7rem 3rem; }
}

/* --- statistik ----------------------------------------------------------- */
/* A summary table, deliberately NOT table.grid: the ark print rules give .grid */
/* table-layout:fixed and six percentage widths tuned for a printed ark, which  */
/* squash a summary table into slivers. Same look on screen, own print rules.   */

table.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
table.stat-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: .5rem .6rem;
  background: var(--bg-soft);
  border-bottom: 2px solid var(--border-strong);
  font-size: .78rem;
  white-space: nowrap;
}
table.stat-table tbody td, table.stat-table tbody th {
  padding: .4rem .6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 500;
}
table.stat-table tbody tr:last-child td, table.stat-table tbody tr:last-child th { border-bottom: 0; }
table.stat-table td.num, table.stat-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.stat-table td.rank { width: 2.5rem; text-align: right; color: var(--text-muted); font-size: .78rem; }
table.stat-table td.prod { font-weight: 800; white-space: nowrap; }
table.stat-table td.vare { min-width: 10rem; }
table.stat-table td.dato { white-space: nowrap; font-weight: 600; }
table.stat-table td.farve { white-space: nowrap; }
table.stat-table tfoot th, table.stat-table tfoot td {
  padding: .5rem .6rem;
  border-top: 2px solid var(--border-strong);
  text-align: left;
  font-weight: 800;
  background: var(--bg-soft);
}
table.stat-table tfoot td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* The colour bands, same tokens as the ark grid so a row reads the same way on */
/* both pages. The fat left rail is what carries the colour when the background */
/* is too pale to see.                                                          */
table.stat-table tbody tr td:first-child, table.stat-table tbody tr th:first-child { border-left: .45rem solid transparent; }
table.stat-table tbody tr.farve-bla { background: var(--f-bla-bg); }
table.stat-table tbody tr.farve-bla td:first-child { border-left-color: var(--f-bla-line); }
table.stat-table tbody tr.farve-rod { background: var(--f-rod-bg); }
table.stat-table tbody tr.farve-rod td:first-child { border-left-color: var(--f-rod-line); }
table.stat-table tbody tr.farve-gul { background: var(--f-gul-bg); }
table.stat-table tbody tr.farve-gul td:first-child { border-left-color: var(--f-gul-line); }
table.stat-table tbody tr.farve-gron { background: var(--f-gron-bg); }
table.stat-table tbody tr.farve-gron td:first-child { border-left-color: var(--f-gron-line); }
table.stat-table tbody tr.farve-molebo, table.stat-table tbody tr.farve-molebo-parkeret { background: var(--f-molebo-bg); }
table.stat-table tbody tr.farve-molebo td:first-child { border-left-color: var(--f-molebo-line); }
table.stat-table tbody tr.farve-molebo-parkeret td:first-child { border-left-color: var(--f-molebo-line); border-left-style: dashed; }
table.stat-table tbody tr.farve-ikke { background: var(--f-ikke-bg); }
table.stat-table tbody tr.farve-ikke td:first-child { border-left-color: var(--f-ikke-line); border-left-style: dotted; }
table.stat-table tbody tr.farve-skjult { background: var(--f-skjult-bg); }
table.stat-table tbody tr.farve-skjult td:first-child { border-left-color: var(--f-skjult-line); border-left-style: dashed; }

/* Row states that are not a priority colour. */
table.stat-table tbody tr.er-forsinket { background: var(--warn-bg); }
table.stat-table tbody tr.er-forsinket td:first-child { border-left-color: var(--warn-border); }
table.stat-table tbody tr.er-forsinket td:last-child { color: var(--warn-border); font-weight: 800; }
table.stat-table tbody tr.er-forfalden { background: var(--warn-bg); }
table.stat-table tbody tr.er-forfalden th:first-child { border-left-color: var(--warn-border); }
table.stat-table tbody tr.er-ukendt th:first-child { border-left-color: var(--f-ikke-line); border-left-style: dotted; }
table.stat-table tbody tr.er-tom { opacity: .62; }
table.stat-table tbody tr.er-uden-ark th, table.stat-table tbody tr.er-uden-ark td { color: var(--text-muted); }

/* A table too wide for a narrow screen scrolls INSIDE its wrapper; the page body
   must never scroll sideways. Not applied to every .table-wrap on purpose: a
   scroll container is also a containing block for position:sticky, and the sticky
   header on the 48-row operations table would quietly stop following the viewport. */
.table-wrap.scroll-bred { overflow-x: auto; }
table.stat-table-burn { min-width: 56rem; }
table.bem-table { min-width: 54rem; }

.is-warn { color: var(--warn-border); }
.totals .total-item.is-warn { border-color: var(--warn-border); background: var(--warn-bg); }
.badge.badge-uden-ark { border-style: dashed; color: var(--text-muted); }

/* --- analyse (the rule engine findings) ---------------------------------- */

.fund-tals { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .8rem; }
.fund-tal {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  padding: .3rem .7rem;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}
.fund-tal b { font-size: 1rem; }

.fund-liste { display: grid; gap: .6rem; }
.fund {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: .5rem .8rem;
  padding: .75rem .9rem;
  border: 2px solid var(--border-strong);
  border-left-width: .5rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.fund-body { flex: 1 1 22rem; }
.fund-body h3 { font-size: 1rem; margin: 0 0 .2rem; }
.fund-body p { margin: 0; font-size: .85rem; color: var(--text); }
.fund-alvor {
  flex: 0 0 auto;
  align-self: center;
  padding: .2rem .55rem;
  border-radius: var(--radius-sm);
  border: 1px solid currentColor;
  font-size: .7rem;
  font-weight: 800;
  white-space: nowrap;
}
.fund.fund-kritisk { border-color: var(--warn-border); background: var(--warn-bg); }
.fund.fund-kritisk .fund-alvor { color: var(--warn-border); }
.fund.fund-advarsel { border-color: var(--f-gul-line); background: var(--f-gul-bg); }
.fund.fund-advarsel .fund-alvor { color: var(--text); }
.fund.fund-info { border-color: var(--border-strong); background: var(--surface-2); }
.fund.fund-info .fund-alvor { color: var(--text-muted); }
.fund-tal.fund-kritisk { border-color: var(--warn-border); background: var(--warn-bg); }
.fund-tal.fund-advarsel { border-color: var(--f-gul-line); background: var(--f-gul-bg); }
.fund-tal.fund-info { border-color: var(--border-strong); background: var(--surface-2); }

/* The headline pills on /datakvalitet are LINKS to the section each one counts, and a
   pill that inherits the page link colour and underline stops reading as a pill. */
a.fund-tal { color: inherit; text-decoration: none; }
a.fund-tal:hover { border-color: var(--accent); }

/* --- /kompetencer -------------------------------------------------------- */

/* One person's share of an operation. The initials, the hours and the percentage
   travel together - a bare percentage invites 98 % of two hours to be read as
   98 % of nine hundred. */
.komp-chip {
  display: inline-flex;
  align-items: baseline;
  gap: .3rem;
  padding: .15rem .45rem;
  margin: .1rem .15rem .1rem 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: .78rem;
  white-space: nowrap;
}
.komp-chip b { font-weight: 800; }

/* A row nobody has confirmed yet. Dimmed, never hidden: the unanswered rows are
   the ones the page is asking for. */
table.grid tbody tr.komp-uafklaret > td { background: var(--surface-2); }
.komp-forslag { font-size: .8rem; max-width: 34rem; }

/* The checks that could NOT run. A page with few findings must never read as a */
/* clean bill of health, so this block is never hidden and never collapsed.     */
.analyse-daekning {
  margin-top: .9rem;
  padding: .7rem .9rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.analyse-daekning h3 { font-size: .9rem; margin: 0 0 .35rem; }
.analyse-daekning ul { margin: 0; padding-left: 1.1rem; }
.analyse-daekning li { font-size: .82rem; color: var(--text-muted); margin-bottom: .2rem; }
.analyse-daekning-ok { margin-top: .9rem; }

/* --- bemanding ----------------------------------------------------------- */

.bem-vaelg, .bem-kopi, .bem-slet, .bem-actions, .bem-felter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .8rem;
  margin-bottom: .8rem;
}
.bem-vaelg label { font-weight: 700; font-size: .85rem; }
.bem-uge-input { max-width: 11rem; }
.bem-uger { margin: -.4rem 0 .9rem; }
.bem-uger a { margin-right: .1rem; }
.bem-uge-tal { color: var(--text-muted); font-size: .75rem; }
.bem-handlinger { display: flex; flex-wrap: wrap; gap: .6rem; }
.bem-handlinger .bem-kopi { margin-bottom: 0; }

.bem-input {
  min-height: 2.4rem;
  padding: .35rem .5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .85rem;
  width: 100%;
}
.bem-input.is-bad { border-color: var(--warn-border); background: var(--warn-bg); }
.bem-dag { text-align: right; max-width: 4.2rem; font-variant-numeric: tabular-nums; }
.bem-navn { min-width: 8rem; }
.bem-ark { min-width: 6rem; }
.bem-effektivitet { max-width: 6rem; }

table.bem-table td { vertical-align: middle; }
table.bem-table .bem-dag-celle { padding: .25rem .25rem; }
table.bem-table .bem-navn-celle, table.bem-table .bem-ark-celle { padding: .25rem .35rem; }
table.bem-table .bem-total, table.bem-table .bem-dag-sum, table.bem-table .bem-uge-sum {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
table.bem-table .bem-dag-kort { display: none; }
.bem-fjern {
  min-height: 2rem;
  min-width: 2rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}
.bem-fjern:hover { border-color: var(--warn-border); color: var(--warn-border); }
/* Two buttons share this cell now - the standard week and the row remover - and
   they must stay side by side rather than stacking into a two-line row. */
table.bem-table .bem-fjern-celle { white-space: nowrap; }

.bem-felt { display: flex; flex-direction: column; gap: .2rem; }
.bem-felt > span { font-weight: 700; font-size: .8rem; }
.bem-felt-bred { flex: 1 1 18rem; }
.bem-hjaelp { margin: .7rem 0; }
.bem-ark-hjaelp { margin-bottom: .9rem; }
.bem-indsaet { margin: .9rem 0; }
.bem-indsaet textarea {
  width: 100%;
  min-height: 6rem;
  padding: .5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .8rem;
}
.bem-indsaet-knapper { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.bem-slet { margin-top: 1.4rem; }

/* The 45 minutes that are NOT working time.                                     */
/*                                                                               */
/* Above the table, loud, and deliberately not .no-print: it has to be read       */
/* BEFORE anything is typed. 8,75 is a legal day, kapacitet.parseTimer accepts    */
/* it, nothing throws - and every capacity figure on the site then reads 9 % high */
/* in the direction that flatters the plan. A roster pinned to a noticeboard      */
/* should carry the rule it was filled in under, so this prints too.              */
.bem-pause {
  margin: 0 0 .9rem;
  padding: .7rem .9rem;
  border: 2px solid var(--f-gul-line);
  border-left-width: .5rem;
  border-radius: var(--radius-sm);
  background: var(--f-gul-bg);
  color: var(--text);
  font-size: .85rem;
  line-height: 1.5;
}
.bem-pause b { font-weight: 800; }

/* The per-row standard-week button, sharing a cell with the row remover. Sized  */
/* to read as a sibling of the x, not as a second primary action.               */
.bem-std-row {
  min-height: 2rem;
  padding: 0 .4rem;
  margin-right: .25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  font: inherit;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.bem-std-row:hover { border-color: var(--accent); color: var(--accent); }

/* The offer from twenty months of clock-ins - roadmap #25. Same shape as the standard
   week button beside it, because it does the same thing: it fills the fields and saves
   nothing. Marked with the accent so the two are not pressed by mistake. */
.bem-hist-row {
  min-height: 2rem;
  padding: 0 .4rem;
  margin-right: .25rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--accent);
  font: inherit;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.bem-hist-row:hover { background: var(--accent); color: var(--surface); }

/* Controls that do nothing without a script. Same html.js hook the filter panel */
/* uses: the server never renders a button that cannot work. The standard-week   */
/* row button needs no entry of its own - it lives inside .bem-fjern-celle and   */
/* is gated with it.                                                            */
.bem-tilfoej, .bem-standard, .bem-fjern-celle, .bem-indsaet { display: none; }
html.js .bem-tilfoej, html.js .bem-standard { display: inline-flex; }
html.js td.bem-fjern-celle, html.js th.bem-fjern-celle { display: table-cell; }
html.js .bem-indsaet { display: block; }

@media (max-width: 900px) {
  table.bem-table .bem-dag-lang { display: none; }
  table.bem-table .bem-dag-kort { display: inline; }
  .bem-dag { max-width: 3.2rem; }
}

/* --- segments ------------------------------------------------------------ */

.chip.seg-bosswik { border-color: var(--s-bosswik-line); background: var(--s-bosswik-bg); }
.chip.seg-molebo { border-color: var(--s-molebo-line); background: var(--s-molebo-bg); }
.chip.seg-privat { border-color: var(--s-privat-line); background: var(--s-privat-bg); }
.chip.seg-ukendt { border-color: var(--s-ukendt-line); background: var(--s-ukendt-bg); border-style: dashed; }
.chip.seg-eget { border-color: var(--s-eget-line); background: var(--s-eget-bg); }

table.stat-table tbody tr.seg-bosswik { background: var(--s-bosswik-bg); }
table.stat-table tbody tr.seg-bosswik th:first-child { border-left-color: var(--s-bosswik-line); }
table.stat-table tbody tr.seg-molebo { background: var(--s-molebo-bg); }
table.stat-table tbody tr.seg-molebo th:first-child { border-left-color: var(--s-molebo-line); }
table.stat-table tbody tr.seg-privat { background: var(--s-privat-bg); }
table.stat-table tbody tr.seg-privat th:first-child { border-left-color: var(--s-privat-line); }
table.stat-table tbody tr.seg-ukendt { background: var(--s-ukendt-bg); }
table.stat-table tbody tr.seg-ukendt th:first-child { border-left-color: var(--s-ukendt-line); border-left-style: dashed; }
table.stat-table tbody tr.seg-eget { background: var(--s-eget-bg); }
table.stat-table tbody tr.seg-eget th:first-child { border-left-color: var(--s-eget-line); }

/* A GUESS MUST NOT LOOK LIKE A DECISION, and on a table of 26 rows the only way
   to see the difference at a glance is for the two to look different. A row
   nobody has confirmed carries a dotted rail and the pale amber of every other
   unresolved thing on this site; a confirmed row is plain, because a decision is
   the ordinary state and needs no decoration. Never the other way round: making
   the confirmed rows the loud ones would leave the guesses looking settled. */
table.stat-table tbody tr.er-foreslaaet { background: var(--f-gul-bg); }
table.stat-table tbody tr.er-foreslaaet th:first-child,
table.stat-table tbody tr.er-foreslaaet td:first-child {
  border-left-color: var(--f-gul-line);
  border-left-style: dotted;
}
table.stat-table tbody tr.er-bekraeftet th:first-child,
table.stat-table tbody tr.er-bekraeftet td:first-child { border-left-color: var(--ok-border); }
/* Moved but not saved. Set by public/segmenter.js only - the server never renders
   it, because on the server there is no such state. */
table.stat-table tbody tr.er-aendret { background: var(--f-bla-bg); }
table.stat-table tbody tr.er-aendret th:first-child { border-left-color: var(--f-bla-line); }

.badge.badge-foreslaaet { border-color: var(--f-gul-line); color: var(--f-gul-line); border-style: dashed; }
.badge.badge-bekraeftet { border-color: var(--ok-border); color: var(--ok-border); }
.badge.badge-fast { border-color: var(--border-strong); color: var(--text-muted); text-transform: none; letter-spacing: 0; }

.seg-intro { max-width: 70ch; }
.seg-maerke .seg-visning { font-weight: 800; }
.seg-maerke .seg-stavemaader, .seg-maerke .badge { display: block; margin-top: .15rem; }
.seg-stavemaader { font-size: .72rem; }
.seg-valg-celle { min-width: 12rem; }
.seg-valg {
  min-height: 2.2rem;
  padding: .3rem .4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .82rem;
  width: 100%;
  max-width: 12rem;
}
.seg-grund, .seg-stempel { display: block; margin-top: .2rem; font-size: .72rem; }
.seg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin-top: .9rem; }
.seg-status-linje { font-variant-numeric: tabular-nums; }
.seg-filter { display: flex; align-items: center; gap: .45rem; margin-bottom: .7rem; font-size: .82rem; }

/* Private label is 48 % of every open hour in the house and had never stood
   anywhere as one number. It gets the weight of a finding, not of a caption. */
.seg-privat-note {
  margin: 0 0 .8rem;
  padding: .7rem .9rem;
  border: 2px solid var(--s-privat-line);
  border-left-width: .5rem;
  border-radius: var(--radius-sm);
  background: var(--s-privat-bg);
  font-size: .88rem;
  line-height: 1.5;
}

/* --- the demand switches on /statistik ----------------------------------- */

/* The number and the sentence that qualifies it, in ONE box. "2,4 ugers arbejde"
   with its assumptions in a footnote is a figure that travels without them. */
.ef-svar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem 1.2rem;
  padding: .8rem 1rem;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  margin-bottom: .8rem;
}
.ef-tal { margin: 0; flex: 0 0 auto; font-size: .95rem; }
.ef-tal b { font-size: 2rem; font-variant-numeric: tabular-nums; line-height: 1; }
.ef-vilkaar { margin: 0; flex: 1 1 22rem; font-size: .85rem; line-height: 1.5; }

.ef-valg { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.ef-boks {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  padding: .6rem .75rem;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
a.ef-boks:hover { border-color: var(--accent); }
.ef-boks.er-med { border-style: solid; border-color: var(--ok-border); background: var(--ok-bg); }
.ef-boks.er-fast { opacity: .95; }
/* A drawn box, not an <input type="checkbox">. The control IS a link - a disabled
   checkbox would be skipped by a screen reader and greyed on screen, and an
   enabled one inside a link would be two controls claiming one job. */
.ef-mark {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: .1rem;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  font-size: .8rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
.ef-boks.er-med .ef-mark { border-color: var(--ok-border); color: var(--ok-border); }
.ef-krop { display: flex; flex-direction: column; gap: .1rem; }
.ef-navn { font-weight: 800; font-size: .88rem; }
.ef-tal2 { font-size: .78rem; font-variant-numeric: tabular-nums; }
.ef-forklaring { font-size: .76rem; color: var(--text-muted); }
.ef-handling { font-size: .74rem; font-weight: 700; color: var(--accent); }
.ef-boks.er-fast .ef-handling { color: var(--text-muted); }
.ef-sum { margin-top: .7rem; }

/* ------------------------------------------------------------------ */
/* /udskriv - all 48 ark in one document                               */
/*                                                                     */
/* Screen half only. The control strip is .no-print, so the paper       */
/* starts on ark 01 and holds nothing but ark; the page break between   */
/* the blocks lives in the print section further down.                  */
/* ------------------------------------------------------------------ */
.udskriv-styring { margin-bottom: 1.4rem; }
.udskriv-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
.udskriv-head h1 { margin: 0; font-size: 1.35rem; }
.udskriv-head .sub { flex: 1 1 20rem; }
.udskriv-hjaelp { margin: .5rem 0 0; max-width: 60rem; }
.udskriv-valg { margin: .5rem 0 0; padding-left: 1.1rem; }
.udskriv-valg li { margin-top: .2rem; }

/* The one thing on this page that is NOT .no-print. It states which ark are missing */
/* from the stack, and it exists because the choice is made here and the consequence */
/* is met at a bench that gets no paper at all. See skippedNotice in render.js.      */
.udskriv-mangler {
  margin: 0 0 1rem;
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-left: .35rem solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text);
}

/* A button that calls window.print() does nothing without a script, and the server */
/* never renders a control that cannot work - same html.js hook the filter panel    */
/* and the bemanding buttons use. Without JS the Ctrl+P line stands in its place.   */
.udskriv-knap { display: none; }
html.js .udskriv-knap { display: inline-flex; }
html.js .udskriv-nojs { display: none; }

/* On screen the stack needs a visible seam, or 48 ark read as one endless table. */
/* It is a screen rule only: print gives each block its own sheet of paper, which  */
/* is a stronger separator than any line, and the border is reset there.           */
.ark-blok + .ark-blok {
  margin-top: 2.2rem;
  padding-top: 1.6rem;
  border-top: 2px dashed var(--border);
}

/* ------------------------------------------------------------------ */
/* PRINT - "Udskrivning Priotering"                                    */
/*                                                                     */
/* Mirrors what the Excel workbook produced: A4 portrait, fitted to the */
/* width, header row repeated on every page (Excel's Print_Titles).     */
/* The colour is the instruction on the shop floor, so it must survive  */
/* a mono printer: every row carries a printed TEXT label and a solid   */
/* left rule, never colour alone.                                       */
/* ------------------------------------------------------------------ */
@page { size: A4 portrait; margin: 10mm 8mm 12mm 8mm; }

@media print {
  /* Browsers drop backgrounds by default; the colour bands are the point. */
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body { background: #fff !important; color: #000 !important; font-size: 9pt; margin: 0; padding: 0; }

  /* Screen furniture that means nothing on paper. */
  .app-header, .toolbar, details.filter, .app-footer,
  .status-bar, .btn, .pill a, .no-print { display: none !important; }

  /* Kept: the sheet title and the filters actually in force, so a printout
     is self-describing once it is off the screen and lying on a bench. */
  .page-head { display: block !important; margin: 0 0 2mm; }
  .page-head h1 { font-size: 13pt; margin: 0 0 1mm; }
  .page-head .sub { font-size: 8pt; color: #333; }
  .active-filters { display: block !important; margin: 0 0 2mm; font-size: 8pt; color: #333; }
  /* Same trap as the colour bands: the pill's own background is var(--surface-2),
     which is #171d27 in dark mode, so "Sortering: Antal" printed #333 on near-black
     at 1.3:1. On an empty ark that pill is the ONLY thing on the paper saying a sort
     is in force, because there are no rows for the banner to warn about. */
  .active-filters .pill {
    border: 0.4pt solid #999; padding: 0.3mm 1mm; margin-right: 1.5mm;
    background: #fff !important; color: #333 !important;
  }

  /* ---- 48 ark in one document: /udskriv ---- */

  /* Deliberately outside .no-print, like .print-note and .bem-pause: a cut that
     leaves no trace on the paper is read as full coverage. Black on white with a
     hairline box, because it has to survive a dark-mode PC the same way the colour
     bands and .empty-state do - print-color-adjust: exact sends var(--surface) to
     the paper as #171d27 otherwise. */
  .udskriv-mangler {
    display: block !important;
    margin: 0 0 3mm;
    padding: 1mm 2mm !important;
    border: 0.4pt solid #000 !important;
    border-left: 1.2mm solid #000 !important;
    border-radius: 0 !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 8.5pt;
    font-weight: 600;
  }

  /* Every ark starts on its own sheet of paper. The break is on the SECOND and later
     blocks, never on all of them: one before the FIRST opens the stack with a blank
     page, and one after the LAST closes it with a blank page - several engines emit
     exactly that, and there is no :last-child exception anywhere in this file to
     copy from. An adjacent-sibling break has neither end to get wrong. Legacy
     spelling first, the way tr does it a few rules down.
     Each block may still run to two or three sheets on its own; nothing here says
     break-inside: avoid, because a 46-order ark has always been two sheets of A4 and
     the identity strip in its thead repeats on every one of them. That holds only
     while everything an ark prints is INSIDE its table - see tr.ark-hale. The sort
     line and the rule used to stand after </table>, and a table ending flush with the
     page foot then put them on a sheet of their own that the strip never reached:
     measured, page 11 of 26, between ark 13 and ark 14. */
  .ark-blok + .ark-blok { page-break-before: always; break-before: page; }
  /* The dashed seam is the SCREEN's separator. On paper the page break is the
     separator, and a printed rule at the top of every sheet is just ink. */
  .ark-blok { margin: 0 !important; padding: 0 !important; border: 0 !important; }

  main, .app-main, .table-wrap {
    /* background too: .table-wrap is painted var(--surface), which is #171d27 on a
       dark-mode PC, and print-color-adjust: exact below sends it to the paper. */
    background: #fff !important;
    box-shadow: none !important; border: 0 !important;
    margin: 0 !important; padding: 0 !important;
    overflow: visible !important; max-height: none !important;
  }

  table.grid { width: 100% !important; border-collapse: collapse !important; table-layout: fixed; }

  /* Excel's Print_Titles: repeat the header on every page. */
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; break-inside: avoid; }

  .grid th, .grid td {
    border: 0.4pt solid #999 !important;
    padding: 1.2mm 1.5mm !important;
    font-size: 9pt; line-height: 1.25;
    overflow-wrap: anywhere; white-space: normal !important;
  }
  .grid th { background: #e8e8e8 !important; color: #000 !important; font-weight: 700; text-align: left; }
  /* The little sort arrow beside a clicked header. var(--accent) is a light blue in
     dark mode - 2.85:1 on the grey header band - and it is the printed proof that a
     column was sorted, so it is stated in black like everything else here. */
  table.grid thead th .sort-ind { color: #000 !important; }

  /* Widths tuned for A4 portrait; Vare gets the slack. */
  /* Same trap one row down: td.rank takes var(--text-muted), which is a light
     grey in dark mode. A fixed grey keeps the printed look it already had in
     light mode and stops the row numbers fading out on a dark-mode PC. */
  .grid .rank  { width: 6%; text-align: right; color: #555 !important; }
  .grid .prod  { width: 10%; }
  .grid .vare  { width: 30%; }
  .grid .dato  { width: 11%; }
  .grid .num   { width: 8%; text-align: right; }
  .grid .farve { width: 14%; font-weight: 700; }

  /* Colour bands. The left rule and the printed word carry the meaning in mono. */
  .grid tbody tr > td:first-child { border-left-width: 2.2mm !important; border-left-style: solid !important; }
  tr.farve-bla    > td:first-child { border-left-color: #1b4fa0 !important; }
  tr.farve-rod    > td:first-child { border-left-color: #a01b1b !important; }
  tr.farve-gul    > td:first-child { border-left-color: #b58900 !important; }
  tr.farve-gron   > td:first-child { border-left-color: #1f7a34 !important; }
  tr.farve-molebo > td:first-child { border-left-color: #6b3fa0 !important; }
  tr.farve-ikke   > td:first-child { border-left-style: dotted !important; border-left-color: #000 !important; }
  /* Parked and hidden rows would otherwise inherit the solid 2.2 mm black rail
     above, which on paper reads exactly like a real priority. Dashed and grey
     says what they are: not on this ark, not in this run. */
  tr.farve-molebo-parkeret > td:first-child { border-left-style: dashed !important; border-left-color: #6b3fa0 !important; }
  tr.farve-skjult > td:first-child { border-left-style: dashed !important; border-left-color: #777 !important; }
  /* The Blå-kø: dashed blue says "belongs to Blå, waits for room"; the ↑n and the words say it
     in mono. The rail selector below is spelled out from the table down because the 2.2 mm
     rail rule above (.grid tbody tr > td:first-child) is one element more specific than the
     tr.farve-* rails, so a bare tr.blaa-koe selector would lose to it and print a solid rail. */
  table.grid tbody tr.blaa-koe > td:first-child { border-left-style: dashed !important; border-left-color: #1b4fa0 !important; }
  table.grid tbody tr.farve-rod.blaa-koe { background: #fce0e0 !important; }
  .blaa-koe-mark, .blaa-koe-tekst { color: #000 !important; background: none !important; font-weight: 700; }
  .blaa-koe-tekst { text-transform: uppercase; }
  /* var(--text-muted) is near-white in dark mode: the cap line's second half states its own grey. */
  .blaa-loft-sub { color: #444 !important; }
  /* The cap line is a plain black band on paper, and - being a row of one cell - it must not
     inherit the 2.2 mm order rail either. */
  table.grid tbody tr.blaa-loft-linje > td { border-top: 2pt solid #000 !important; border-bottom: 2pt solid #000 !important;
    border-left: 0 !important; color: #000 !important; background: none !important; }

  /* The bands themselves, in LITERAL light-mode colours.
     The rules above restate the left RULE's colour; the row BACKGROUND was left to
     table.grid tbody tr.farve-* { background: var(--f-*-bg) }, and those tokens
     invert under prefers-color-scheme: dark - #123021 for Grøn, #3b1618 for Rød.
     print-color-adjust: exact at the top of this block is what makes the bands
     reach the paper at all, so on a dark-mode PC it faithfully printed all 277
     rows as black text on a dark band, 1.3:1. Same trap as .empty-state, one
     property across. Same specificity as the screen rules (table.grid tbody tr…),
     so the order of the two blocks cannot decide the outcome. */
  table.grid tbody tr { background: #fff !important; }
  table.grid tbody tr.farve-bla { background: #e2ecfd !important; }
  table.grid tbody tr.farve-rod { background: #fce0e0 !important; }
  table.grid tbody tr.farve-gul { background: #fdf1cf !important; }
  table.grid tbody tr.farve-gron { background: #e0f5e8 !important; }
  /* rgba(107,63,160,.10) over white, resolved: the parked rows keep their tint. */
  table.grid tbody tr.farve-molebo,
  table.grid tbody tr.farve-molebo-parkeret { background: #f1ebf9 !important; }
  table.grid tbody tr.farve-skjult { background: #e9ecf1 !important; }

  /* An order nobody has prioritised must be unmistakable on paper too. */
  table.grid tbody tr.farve-ikke { background: #f2f2f2 !important; }
  tr.farve-ikke td { font-style: italic; }

  /* The ark's tail is the last ROW of the table (see the screen block), and on paper
     it must not read as one more order: every td:first-child gets a 2.2 mm left rail
     above, in the #999 the cell border shorthand set, which prints exactly like the
     dashed grey band a hidden row carries. Two classes and four elements deep, so
     the source order of these rules cannot decide the outcome. */
  table.grid tbody tr.ark-hale > td {
    border: 0 !important;
    background: #fff !important;
    padding: 1.6mm 0 0 !important;
    font-size: 8pt;
    color: #333 !important;
  }

  /* ---- THE QUEUE PRINTS ---- */
  /*                                                                           */
  /* This is the point of the whole block: the bench gets the work AND what is  */
  /* standing behind the gate on one sheet. Nothing here is display:none, and   */
  /* nothing here is inside .no-print - only the two links are, because paper   */
  /* has nothing to click.                                                     */
  /*                                                                           */
  /* LITERAL HEX, never var(--…), for the reason .empty-state and the colour    */
  /* bands both document: print-color-adjust: exact sends whatever the browser  */
  /* resolved to the printer, and on a dark-mode PC var(--surface-2) is #171d27 */
  /* - black text on a near-black band. Same specificity as the screen rules    */
  /* (table.grid tbody tr…), so the order of the two blocks cannot decide it.   */
  /*                                                                           */
  /* A 2 pt rule and 4 mm of air above the header, because this is the one cut  */
  /* on the sheet that must not be missed: above it is work, below it is not.   */
  table.grid tbody tr.koe-hoved > td {
    border: 0 !important;
    border-top: 2pt solid #000 !important;
    background: #fff !important;
    color: #000 !important;
    padding: 3mm 0 1mm !important;
  }
  .koe-hoved-titel { font-size: 10pt; font-weight: 800; }
  .koe-hoved-sub { font-size: 8pt; color: #333 !important; }

  table.grid tbody tr.koe-gate > td {
    border: 0 !important;
    border-top: 0.4pt solid #666 !important;
    background: #ececec !important;
    color: #000 !important;
    padding: 1mm 1.5mm !important;
    font-size: 8pt;
    font-weight: 700;
  }
  .koe-gate-tal { color: #333 !important; font-weight: 400; }

  /* A grey wash and italics, so the difference between "work" and "waiting" is  */
  /* still there on a mono printer where every colour band came out the same     */
  /* grey. The left rail is dashed, exactly as a Skjult row's is: the shape the   */
  /* rest of this stylesheet already uses for "on the paper, not in this run".    */
  table.grid tbody tr.koe-raekke { background: #f7f7f7 !important; }
  table.grid tbody tr.koe-raekke > td { color: #333 !important; font-style: italic; }
  table.grid tbody tr.koe-raekke > td:first-child {
    border-left-style: dashed !important;
    border-left-color: #777 !important;
  }
  table.grid tbody tr.koe-raekke > td.prod { font-style: normal; font-weight: 700; }
  table.grid tbody tr.koe-raekke .chip { font-style: normal; }

  /* The chip loses its screen colour but keeps the word. */
  .chip { background: none !important; color: #000 !important; border: 0 !important; padding: 0 !important; font-weight: 700; }
  .under { font-weight: 700; }
  .under::before { content: "#"; }

  /* /ordre/:prod on paper. LITERAL hex, never var(--…): the custom properties
     follow the SCREEN's colour scheme, so a page printed from a dark-mode PC came
     out white on white. Nothing here is display:none - the whole page is the point
     when a planner prints one order to carry to a bench. */
  .ordre-blok { break-inside: avoid; border: 0 !important; background: #fff !important; padding: 0 !important; }
  .ordre-blok h2 { color: #000 !important; font-size: 10pt; }
  .ordre-head h1 { color: #000 !important; }
  .ordre-fakta dt, .ordre-note, .ordre-hnote, .ordre-intet { color: #000 !important; }
  .ordre-timer th, .ordre-timer td { border-color: #333 !important; color: #000 !important; }
  /* .sub, .ordre-hvornaar and .ordre-pil are var(--text-muted) on screen, and that
     variable follows the READER's colour scheme - printed from a dark-mode PC the
     muted grey came out at 2,33:1 against white paper. Nine lines on this page use it. */
  .ordre-blok .sub, .ordre-head .sub, .ordre-hvornaar, .ordre-pil { color: #333 !important; }

  a { color: #000 !important; text-decoration: none !important; }
  a[href]::after { content: ""; }
}

/* ------------------------------------------------------------------ */
/* PRINT - the wide data pages                                         */
/*                                                                     */
/* /komplet carries 56 columns. Nothing makes 56 columns readable on A4 */
/* portrait, so those pages switch to landscape AND drop every column   */
/* past the print budget. renderDataPage marks the dropped ones with    */
/* .print-drop and says on screen how many did not make it, with the    */
/* CSV as the way to get all of them - a printout that silently loses   */
/* half the data is worse than one that admits it.                     */
/* ------------------------------------------------------------------ */
@page wide { size: A4 landscape; margin: 8mm 8mm 10mm 8mm; }

@media print {
  .data-page { page: wide; }
  .print-drop { display: none !important; }

  /* Og RÆKKERNE, af nøjagtig samme grund som kolonnerne. En række uden ét eneste tal i
     de valgte kolonner er en stribe blankt papir: på /valgt med ni operationskolonner
     var 58 af 101 rækker sådan, altså over halvdelen af to A3-ark. Panelet skriver
     tallet på skærmen, så en kort udskrift ikke læses som «der er kun 43 ordrer». */
  tr.print-drop-row { display: none !important; }

  /* The frozen pane is a screen affordance; on paper it would just overlap. */
  table.grid.sticky-cols th.sticky-col,
  table.grid.sticky-cols td.sticky-col {
    position: static !important;
    width: auto !important;
    background: transparent !important;
  }
  table.grid.data-grid tbody td { white-space: normal !important; }
  table.grid.data-grid td.vare { max-width: none !important; overflow: visible !important; }

  /* Why rows are missing must survive onto the paper; the link cannot. */
  .hide-note {
    display: block !important;
    padding: 1mm 2mm !important;
    border: 0.4pt solid #666 !important;
    background: #f6f6f6 !important;
    font-size: 8pt;
  }
  .hide-toggle { display: none !important; }

  /* An ark that is empty because its orders are still queued behind a gate. The
     bench used to get blank paper and no reason; the sentence is the whole point
     of the sheet now, so it prints left-aligned and readable, not as grey
     centred filler. The link inside it is .no-print - paper has nothing to click. */
  .empty-state {
    padding: 4mm 3mm !important;
    color: #000 !important;
    font-size: 10pt;
    text-align: left;
  }
  /* colour has to be restated here, not inherited. The screen rule sets
     .empty-state .koe-extra from var(--text), which is near-white under
     prefers-color-scheme: dark, and it outranks .empty-state's #000. On a
     dark-mode PC ark 26 therefore printed "Ingen ordrer paa arket lige nu."
     and then white-on-white nothing - blank paper with no reason, which is
     the exact failure this sentence exists to prevent. */
  .empty-state .koe-extra { display: block !important; margin-top: 2mm; font-weight: 700; color: #000 !important; }

  .koe-note {
    display: block !important;
    margin: 0 0 2mm;
    padding: 1mm 2mm !important;
    border: 0.4pt solid #666 !important;
    border-left: 1.2mm solid #666 !important;
    background: #f6f6f6 !important;
    color: #000 !important;
    font-size: 8pt;
  }

  /* ---- a sorted ark is not a prioritised ark ---- */

  /* The whole promise of a printed ark is that the top row is what you make
     first. A user sort breaks that, and the printer flattens Bla and Rod into
     the same grey, so colour cannot carry the warning either. .page-head is kept
     by print, so the banner rides along - restated here in black and white,
     because the amber background and the border colour both vanish in mono.
     .sort-warning-back is a .btn and is already hidden: nothing to click. */
  .page-head .sort-warning {
    display: flex !important;
    align-items: flex-start;
    gap: 2mm;
    margin: 1mm 0 0;
    padding: 1.4mm 2mm !important;
    border: 1pt solid #000 !important;
    border-left: 2.2mm solid #000 !important;
    border-radius: 0 !important;
    background: #fff !important;
    color: #000 !important;
  }
  .sort-warning .sort-warning-flag {
    width: auto !important;
    height: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    font-size: 12pt;
  }
  .sort-warning .sort-warning-text strong { font-size: 11pt; letter-spacing: .03em; }
  .sort-warning .sort-warning-text span { font-size: 8pt; color: #000 !important; }
  .print-only { display: inline !important; }

  /* .page-head prints once, on page one. A 46-order ark is two sheets of A4, and
     page two would otherwise land on the bench with nothing on it to say the rows
     are out of priority order. thead is already table-header-group for Excel
     Print_Titles, so this row repeats on every page. Solid black: the one thing a
     mono printer renders exactly as intended. */
  tr.print-sort-warning { display: table-row !important; }
  tr.print-sort-warning th {
    background: #000 !important;
    color: #fff !important;
    border: 0.4pt solid #000 !important;
    padding: 1mm 1.5mm !important;
    font-size: 9pt;
    font-weight: 800;
    text-align: left;
    letter-spacing: .02em;
    /* table.grid thead th caps every header at 11rem and outranks this selector
       on specificity; a colspan warning bar must have the whole table width. */
    max-width: none !important;
  }
  tr.print-sort-warning th b { color: #fff !important; }

  /* Same mechanism, one row further down: which ark this is, and how old its
     numbers are. .page-head prints once on page one, and "Opdateret kl. ..." lives
     in .app-header, which print hides - so 48 sheets on 48 benches carried neither
     a sheet number past page one nor a date anywhere. Data is fetched every five
     minutes; a sheet from last Tuesday looked exactly like a sheet from this
     morning, and a sheet printed while Probiz was down looked exactly like a
     working day. One 8pt line, grey band, so it costs a single row of height.
     Literal hex, not var(): print-color-adjust: exact sends whatever the browser
     resolved to the paper, and the tokens invert on a dark-mode PC. */
  tr.print-ident { display: table-row !important; }
  tr.print-ident th {
    background: #efefef !important;
    color: #000 !important;
    border: 0.4pt solid #999 !important;
    padding: 0.7mm 1.5mm !important;
    /* table.grid thead th (0,1,3) sets .82rem and outranks this selector, so the
       strip would print at header size and cost twice the height it needs. */
    font-size: 8pt !important;
    font-weight: 600;
    text-align: left;
    vertical-align: middle !important;
    /* table.grid thead th caps every header at 11rem and outranks this selector on
       specificity; a colspan strip must have the whole table width. */
    max-width: none !important;
  }
  tr.print-ident .print-ident-ark { font-weight: 800; }
  /* Timerne står MELLEM arknavnet og datoen og bærer deres eget skilletegn, af samme
     grund som .print-ident-data gør: strimlen er én linje, og tre felter uden skilletegn
     løber sammen til én sætning, ingen kan læse på tværs af et rum. */
  tr.print-ident .print-ident-timer { font-weight: 700; }
  tr.print-ident .print-ident-timer::before { content: " \00b7  "; font-weight: 400; }
  tr.print-ident .print-ident-data::before { content: " \00b7  "; font-weight: 400; }

  /* ---- the routing rule pages ---- */
  .panel-wide {
    padding: 2mm !important;
    border: 0.4pt solid #999 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .rule-grid, .chain-list, .op-list { display: block !important; }
  .rule-card, .chain-item {
    margin: 0 0 2mm;
    border: 0.4pt solid #999 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .op-list li { border-bottom: 0.4pt solid #ccc !important; }

  svg.chain { max-width: 100% !important; }
  svg.chain text { fill: #000 !important; }
  svg.chain .chain-box rect { fill: #fff !important; stroke: #333 !important; }
  svg.chain .chain-ark rect { fill: #eee !important; stroke: #000 !important; }
  svg.chain .chain-orphan rect { fill: #fff !important; stroke: #000 !important; stroke-dasharray: 4 2 !important; }
  svg.chain .chain-edge { stroke: #666 !important; }
  svg.chain .chain-edge-back { stroke: #000 !important; stroke-width: 2 !important; }
  svg.chain .chain-arrowhead { fill: #666 !important; }
  svg.chain .chain-arrowhead-back { fill: #000 !important; }

  /* The editor is a control surface, not a document. */
  #rule-editor-panel { display: none !important; }
  .gate-chip { border: 0.4pt solid #333 !important; background: none !important; }
  .prod-list li { border: 0.4pt solid #333 !important; background: none !important; }
}

/* ------------------------------------------------------------------ */
/* PRINT - /statistik and /bemanding                                    */
/*                                                                     */
/* Scoped to main.stat-page and main.bemanding-page, so not one rule    */
/* here can reach the 48 ark. Neither page sets pageClass "data-page",  */
/* so both keep the default A4 PORTRAIT @page - a statistics page for   */
/* a meeting and a week roster for a noticeboard, not a bench sheet.    */
/*                                                                     */
/* Every colour is restated as literal light-mode hex. print-color-     */
/* adjust:exact sends whatever the browser resolved to the printer, and */
/* on a dark-mode PC that is the dark palette: black text on a near-    */
/* black band. The ark grid restates its bands for exactly this reason. */
/* ------------------------------------------------------------------ */
@media print {
  main.stat-page .table-wrap, main.bemanding-page .table-wrap { overflow: visible !important; }

  /* THE DATA PAGES TOO, and leaving them out cost half of every sheet.
     `.data-page .table-wrap.scroll-x` is a scroll box on screen - Excel's frozen pane -
     with `max-height: calc(100vh - var(--header-h) - 12rem)`. In print `100vh` is the
     PAGE, so the box was capped at roughly half a sheet and the table printed inside
     it: rows stopped partway down, the rest of the paper was blank, and the run took
     twice the sheets it needed. The owner photographed it: "it dosent fill out the ark
     when it has space."
     Nothing may scroll on paper. There is nowhere to scroll to. */
  .data-page .table-wrap,
  .data-page .table-wrap.scroll-x {
    overflow: visible !important;
    max-height: none !important;
    min-height: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: none !important;
  }

  /* The totals strip has no print rule of its own anywhere in this file, so */
  /* without these three lines it prints var(--surface) - #171d27 in dark    */
  /* mode - behind #000 text.                                                */
  main.stat-page .totals .total-item, main.bemanding-page .totals .total-item {
    background: #fff !important;
    color: #000 !important;
    border: 0.6pt solid #333 !important;
    padding: .1rem .4rem !important;
  }
  main.stat-page .totals .total-item.is-warn { border: 1pt solid #000 !important; font-weight: 700 !important; }
  main.stat-page .totals-sum, main.bemanding-page .totals-sum { color: #333 !important; font-size: 8pt !important; }

  /* A chip loses its pill in the ark print block, which runs Bla Rod Gul     */
  /* together as bold words. Here it is a legend in a table cell, so it keeps */
  /* a hairline box and its padding.                                          */
  main.stat-page .chip {
    border: 0.6pt solid #333 !important;
    padding: 0 .25rem !important;
    background: #fff !important;
    color: #000 !important;
  }

  /* The three demand switches are controls and mean nothing on paper - but the
     SENTENCE they produced does, so .ef-svar stays and only the switches go. A
     printout of "2,4 ugers arbejde" without "ekskl. Skjult (1 910,7 t)" is the
     exact failure this block was written to avoid. */
  main.stat-page .ef-valg, main.stat-page .seg-actions, main.stat-page .seg-filter { display: none !important; }
  main.stat-page .ef-svar, main.stat-page .seg-privat-note {
    background: #fff !important;
    color: #000 !important;
    border: 0.6pt solid #333 !important;
    border-left: 2pt solid #000 !important;
    padding: .3rem .4rem !important;
  }
  main.stat-page .ef-tal b { font-size: 14pt !important; }

  main.stat-page table.stat-table, main.bemanding-page table.stat-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 7.5pt !important;
  }
  main.stat-page table.stat-table thead th, main.bemanding-page table.stat-table thead th {
    position: static !important;
    background: #eee !important;
    color: #000 !important;
    border-bottom: 1pt solid #000 !important;
    font-size: 7pt !important;
  }
  main.stat-page table.stat-table tbody td, main.stat-page table.stat-table tbody th,
  main.bemanding-page table.stat-table tbody td, main.bemanding-page table.stat-table tbody th {
    border-bottom: 0.4pt solid #999 !important;
    color: #000 !important;
    padding: .12rem .3rem !important;
  }
  main.stat-page table.stat-table tfoot th, main.stat-page table.stat-table tfoot td,
  main.bemanding-page table.stat-table tfoot th, main.bemanding-page table.stat-table tfoot td {
    border-top: 1pt solid #000 !important;
    background: #eee !important;
    color: #000 !important;
  }
  /* Excel's Print_Titles: the header row repeats on every page. */
  main.stat-page table.stat-table thead, main.bemanding-page table.stat-table thead { display: table-header-group; }
  main.stat-page table.stat-table tr, main.bemanding-page table.stat-table tr { page-break-inside: avoid; }

  /* The eight colour bands, in literal light-mode hex. */
  main.stat-page table.stat-table tbody tr.farve-bla { background: #dbeafe !important; }
  main.stat-page table.stat-table tbody tr.farve-rod { background: #fde3e3 !important; }
  main.stat-page table.stat-table tbody tr.farve-gul { background: #fdf3d0 !important; }
  main.stat-page table.stat-table tbody tr.farve-gron { background: #dcf5e5 !important; }
  main.stat-page table.stat-table tbody tr.farve-molebo,
  main.stat-page table.stat-table tbody tr.farve-molebo-parkeret { background: #eee6dc !important; }
  main.stat-page table.stat-table tbody tr.farve-ikke { background: #f2f4f7 !important; }
  main.stat-page table.stat-table tbody tr.farve-skjult { background: #eceff3 !important; }
  main.stat-page table.stat-table tbody tr.er-forsinket,
  main.stat-page table.stat-table tbody tr.er-forfalden { background: #fde3e3 !important; }
  main.stat-page table.stat-table tbody tr.er-forsinket td:last-child { color: #000 !important; font-weight: 800 !important; }
  main.stat-page table.stat-table tbody tr.er-tom { opacity: 1 !important; color: #666 !important; }

  /* The findings are the reason the page is being printed. */
  main.stat-page .fund {
    border: 0.8pt solid #000 !important;
    border-left-width: 2mm !important;
    background: #fff !important;
    color: #000 !important;
    page-break-inside: avoid;
    padding: .3rem .4rem !important;
  }
  main.stat-page .fund.fund-kritisk { background: #fde3e3 !important; }
  main.stat-page .fund.fund-advarsel { background: #fdf3d0 !important; }
  main.stat-page .fund.fund-info { background: #fff !important; }
  main.stat-page .fund-alvor { border: 0.6pt solid #000 !important; color: #000 !important; }
  main.stat-page .fund-body h3 { font-size: 9pt !important; }
  main.stat-page .fund-body p { font-size: 8pt !important; color: #000 !important; }
  main.stat-page .fund-tal { border: 0.6pt solid #000 !important; background: #fff !important; color: #000 !important; }
  main.stat-page .analyse-daekning {
    border: 0.6pt dashed #000 !important;
    background: #fff !important;
    page-break-inside: avoid;
  }
  main.stat-page .analyse-daekning li { color: #000 !important; font-size: 8pt !important; }

  main.stat-page .panel-wide, main.bemanding-page .panel-wide {
    border: 0 !important;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 0 6mm !important;
    box-shadow: none !important;
  }
  main.stat-page .panel-wide h2, main.bemanding-page .panel-wide h2 {
    font-size: 11pt !important;
    border-bottom: 0.8pt solid #000 !important;
    page-break-after: avoid;
  }
  main.stat-page .sub, main.bemanding-page .sub { color: #333 !important; font-size: 8pt !important; }
  main.stat-page .is-warn, main.bemanding-page .is-warn { color: #000 !important; font-weight: 700 !important; }

  /* "Faerdig dato" repeats what the week column already says, and dropping it */
  /* is what lets eleven columns fit an A4 portrait page.                      */
  main.stat-page table.stat-table-burn tr > *:nth-child(9) { display: none !important; }

  /* The roster prints as a week plan: no inputs, just the numbers in them. */
  main.bemanding-page .bem-input {
    border: 0 !important;
    background: none !important;
    color: #000 !important;
    padding: 0 !important;
    min-height: 0 !important;
    font-size: 7.5pt !important;
    width: auto !important;
  }
  main.bemanding-page .bem-dag { text-align: right !important; }
  main.bemanding-page .bem-vaelg, main.bemanding-page .bem-actions,
  /* The one coloured block on this page that is meant to survive the printer:  */
  /* the rule the roster was filled in under. Restated as literal light-mode    */
  /* hex for the same reason as everything else here - on a dark-mode PC the    */
  /* resolved --f-gul-bg is a near-black band behind #000 text.                 */
  main.bemanding-page .bem-pause {
    background: #fff !important;
    color: #000 !important;
    border: 0.6pt solid #333 !important;
    border-left: 2pt solid #000 !important;
    font-size: 8pt !important;
    padding: .3rem .4rem !important;
  }

  main.bemanding-page .bem-felter, main.bemanding-page .bem-hjaelp,
  main.bemanding-page .bem-handlinger, main.bemanding-page .bem-uger { display: none !important; }
  main.bemanding-page table.bem-table .bem-dag-lang { display: inline !important; }
  main.bemanding-page table.bem-table .bem-dag-kort { display: none !important; }
}

/* --------------------------------------------------------------------------
   /grupper - procesgrupper. Everything structural is borrowed (.stat-table,
   .panel, .fund, .sub, .num); only the few things that carry MEANING get their
   own rule: a shortfall, a surplus, the buffer row and the guess panel.
   -------------------------------------------------------------------------- */
.gr-uge { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 0 1rem; }
.gr-ops { font-variant-numeric: tabular-nums; }
.gr-kort { color: var(--c-rod, #b3261e); }
.gr-ok   { color: var(--c-groen, #1e6b3a); }
.gr-mangler { color: var(--c-rod, #b3261e); }
/* The buffer is not a group and must never read as one. */
.gr-buffer td { border-top: 2px solid currentColor; opacity: .95; }
.gr-sum td { font-weight: 600; }
/* A guess has to look like a guess. */
.gr-forslag { border-left: 4px solid var(--c-gul, #b8860b); }
.gr-fod { max-width: 78ch; margin-top: 1.5rem; }

/* --------------------------------------------------------------------------
   /raekkefoelge - operationernes rækkefølge. Same borrowing rule as /grupper:
   everything structural is .stat-table, .panel, .fund, .sub and .num, and only
   the things that carry MEANING get a rule of their own - the step chain, the
   buffer rows that can never hold a step, and the fields a planner types in.
   -------------------------------------------------------------------------- */
.rk-table td, .rk-table th { vertical-align: top; }
.rk-trin-felt { width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.rk-note input { width: 100%; min-width: 12rem; }
.rk-delbar { min-width: 7rem; }
/* A row with live hours on it is the one whose missing step actually costs
   something. Nothing louder than a weight - it is not a warning, it is a hint
   about where to start. */
.rk-levende th[scope="row"] { font-weight: 700; }
/* The buffer is not a step and must never read as one. Same rule as .gr-buffer. */
.rk-buffer td, .rk-buffer th { opacity: .75; }
.rk-kaede { display: flex; flex-wrap: wrap; gap: .35rem; align-items: baseline; margin: .5rem 0; }
.rk-trin { display: inline-block; padding: .15rem .5rem; border: 1px solid var(--c-kant, #ccc);
  border-radius: .35rem; font-variant-numeric: tabular-nums; }
.rk-pil { opacity: .6; }

/* --- kravdiagrammet: kasser og pile ------------------------------------- */

/* Tegningen kan blive bredere end siden, når kæden er lang. Den ruller i sin egen
   kasse, så sidens krop aldrig flytter sig - samme regel som .table-wrap. */
.kd-wrap {
  overflow-x: auto;
  padding: .4rem 0 .2rem;
  max-width: 100%;
}
.kd { display: block; min-width: min-content; }

.kd .kd-pil {
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.6;
  opacity: .75;
}
.kd marker path { fill: var(--text-muted); }

.kd .kd-kasse rect {
  fill: var(--surface, #fff);
  stroke: var(--border, #cfd4dc);
  stroke-width: 1.4;
}
/* En kasse uden pile ind i sig kan sættes i gang med det samme. Det er den eneste
   forskel tegningen selv kan se, og den vigtigste at kunne se på afstand. */
.kd .kd-start rect { stroke: var(--ok, #2e7d32); stroke-width: 2.2; }
.kd .kd-nr { font-size: 13px; font-weight: 800; fill: var(--text, #111); }
.kd .kd-navn { font-size: 12px; fill: var(--text-muted); }

/* Kravfeltet i tabellen: smalt, for det holder "2,3,4" og ikke en sætning. */
.rk-krav-felt {
  width: 8.5rem;
  font-variant-numeric: tabular-nums;
}

@media print {
  /* Tegningen er det, en bænk skal kunne se på væggen, så den skal med på papiret -
     og den må ikke brækkes midt over af et sideskift. */
  .kd-wrap { overflow: visible !important; break-inside: avoid; }
  .kd .kd-pil { stroke: #000 !important; opacity: 1 !important; }
  .kd marker path { fill: #000 !important; }
  .kd .kd-kasse rect { fill: #fff !important; stroke: #000 !important; }
  .kd .kd-start rect { stroke-width: 2.4 !important; }
  .kd .kd-nr, .kd .kd-navn { fill: #000 !important; }
}

/* --- flowtegningen på /ruteregler ---------------------------------------- */

.fd-wrap { overflow-x: auto; padding: .5rem 0 .3rem; max-width: 100%; }
.fd { display: block; min-width: min-content; }

.fd .fd-pil { fill: none; stroke: var(--text-muted); stroke-width: 1.7; opacity: .7; }
.fd marker path { fill: var(--text-muted); }

.fd .fd-kasse rect {
  fill: var(--surface, #fff);
  stroke: var(--border, #cfd4dc);
  stroke-width: 1.4;
}
/* Ingen pile ind i sig: kan gå i gang med det samme. */
.fd .fd-start rect { stroke: var(--ok, #2e7d32); stroke-width: 2.2; }
/* Noget står og venter bag denne. Det er den, det kan betale sig at åbne. */
.fd .fd-har-koe rect { stroke: var(--warn, #b26a00); stroke-width: 2.2; }
/* En port, ingen udskrift nævner. routing.js kalder selv disse kanter de højeste. */
.fd .fd-uden-ark rect { stroke-dasharray: 5 3; stroke: var(--danger, #b3261e); }

.fd .fd-nr { font-size: 14px; font-weight: 800; fill: var(--text, #111); }
.fd .fd-navn { font-size: 12px; fill: var(--text, #111); }
.fd .fd-tal { font-size: 11px; fill: var(--text-muted); }

/* Kassen er et link til arkets regel - den skal opføre sig som et. */
.fd a { cursor: pointer; }
.fd a:hover rect { fill: var(--surface-2, #f2f5f9); }
.fd a:focus-visible rect { stroke: var(--accent, #1668d6); stroke-width: 3; }

@media print {
  .fd-wrap { overflow: visible !important; break-inside: avoid; }
  .fd .fd-pil { stroke: #000 !important; opacity: 1 !important; }
  .fd marker path { fill: #000 !important; }
  .fd .fd-kasse rect { fill: #fff !important; stroke: #000 !important; }
  .fd .fd-nr, .fd .fd-navn, .fd .fd-tal { fill: #000 !important; }
}

/* --- "hvad kan sættes i gang nu"-boardet på /grupper --------------------- */
.gr-flytte { margin: .3rem 0 0; padding-left: 1.1rem; }
.gr-flytte li { font-size: .9rem; margin-bottom: .15rem; }
#klar-nu tfoot td { border-top: 2px solid var(--border, #cfd4dc); }

/* ==========================================================================
   Udskriftsopsætning - the print setup panel (udskriftPanel in render.js)
   ==========================================================================
   A plain GET form: every control is a real input, the whole panel works with
   JavaScript off, and every setting lands in the URL. no-print, obviously - it is
   the thing that decides the paper, not part of it. */

.udskrift-opsaetning {
  margin: .8rem 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.udskrift-opsaetning > summary {
  cursor: pointer;
  padding: .6rem .8rem;
  font-size: .92rem;
}
.ud-form { padding: 0 .8rem .8rem; display: flex; flex-direction: column; gap: .7rem; }
.ud-raekke { display: flex; flex-wrap: wrap; gap: .8rem; }
.ud-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .35rem .55rem .5rem;
  margin: 0;
}
.ud-form legend { font-size: .74rem; color: var(--text-muted); padding: 0 .25rem; }
.ud-valg { display: inline-flex; align-items: center; gap: .3rem; margin-right: .5rem; font-size: .84rem; }
.ud-valg.er-valgt { font-weight: 700; }
.ud-kolonner .sub { margin: .2rem 0 .45rem; }
.ud-kryds-raekke { display: flex; flex-wrap: wrap; gap: .15rem .7rem; }
.ud-kryds { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; }
/* A column the setup cannot put on the paper anyway - it holds nothing on the rows
   being shown - is dimmed rather than removed, so the grid of numbers keeps its
   shape and a planner can see WHY a number is missing. */
.ud-kryds.er-fra { color: var(--text-muted); }
.ud-numre .ud-kryds { min-width: 3.1rem; font-variant-numeric: tabular-nums; }
.ud-advarsel {
  margin: 0;
  padding: .45rem .6rem;
  border-left: 3px solid var(--f-gul-line, #d9a400);
  background: var(--f-gul-bg, #fff8e1);
  border-radius: var(--radius-sm);
  font-size: .86rem;
}
.ud-svar { margin: 0; font-size: .88rem; }
.ud-svar .sub { display: block; }
.ud-knapper { display: flex; gap: .5rem; align-items: center; }

/* ==========================================================================
   The totals bar under a grid (gridFoot in render.js)
   ==========================================================================
   One row, one Sigma per addable column, over exactly the rows above it. It is
   deliberately heavier than a data row and deliberately NOT coloured by farve: it
   is not an order, and a total wearing a colour rail reads as one more row of work. */

table.grid tr.grid-sum > td,
table.grid tr.grid-sum > th,
table.grid tr.colour-sum > td,
table.grid tr.colour-sum > th {
  background: var(--surface-2, #eef1f5);
  border-top: 2px solid var(--border);
  border-bottom: 0;
  font-weight: 700;
  padding: .5rem;
  white-space: nowrap;
}
table.grid tr.grid-sum > td:first-child,
table.grid tr.colour-sum > td:first-child {
  /* No colour rail. Every data row paints one here; a total is not an order. */
  border-left: .55rem solid transparent;
  font-weight: 400;
  color: var(--text-muted);
}
table.grid tr.grid-sum > th.sum-label,
table.grid tr.colour-sum > th.sum-label {
  text-align: left;
  font-weight: 700;
  color: var(--text);
}
/* The queue's own total, on the ark. Lighter than the work total right above it,
   because the queue is not work yet and the page must not let the two read alike. */
table.grid tr.grid-sum.koe-sum > td,
table.grid tr.grid-sum.koe-sum > th {
  background: transparent;
  font-weight: 600;
  border-top: 1px dashed var(--border);
}

table.grid tfoot tr.grid-sum > td,
table.grid tfoot tr.grid-sum > th { border-bottom: 0; }

/* The share row, under the totals. Lighter than the sum it divides - it is a reading
   of that row, not a second measurement - and it never carries the sigma's top rule. */
table.grid tr.grid-pct > td,
table.grid tr.grid-pct > th,
table.grid tr.colour-pct > td,
table.grid tr.colour-pct > th {
  background: var(--surface-2, #eef1f5);
  border-top: 0;
  border-bottom: 0;
  font-weight: 400;
  color: var(--text-muted);
  padding: .1rem .5rem .45rem;
  white-space: nowrap;
  font-size: .82rem;
}
table.grid tr.grid-pct > td:first-child,
table.grid tr.colour-pct > td:first-child { border-left: .55rem solid transparent; }

/* The order count, last of the three. Same weight as the share row - both are
   readings of the sum above them, not measurements of their own. */
table.grid tr.grid-antal > td,
table.grid tr.grid-antal > th,
table.grid tr.colour-antal > td,
table.grid tr.colour-antal > th {
  background: var(--surface-2, #eef1f5);
  border-top: 0;
  border-bottom: 0;
  font-weight: 400;
  color: var(--text-muted);
  padding: .1rem .5rem .55rem;
  white-space: nowrap;
  font-size: .82rem;
}
table.grid tr.grid-antal > td:first-child,
table.grid tr.colour-antal > td:first-child { border-left: .55rem solid transparent; }
table.grid tr.grid-antal > th.sum-label,
table.grid tr.colour-antal > th.sum-label { text-align: left; }
table.grid tr.grid-antal.koe-raekke > td,
table.grid tr.grid-antal.koe-raekke > th { background: transparent; }
table.grid tr.grid-pct > th.sum-label,
table.grid tr.colour-pct > th.sum-label { text-align: left; }
table.grid tr.grid-pct.koe-raekke > td,
table.grid tr.grid-pct.koe-raekke > th { background: transparent; }

p.sum-note { margin: .5rem 0 0; }

/* Keep a colour's statistical block together and visually separate it from the
   next group. Its text chip identifies the colour on monochrome paper too. */
table.grid tr.colour-sum,
table.grid tr.colour-pct { break-after: avoid; }
table.grid tr.colour-antal > td,
table.grid tr.colour-antal > th { border-bottom: 2px solid var(--border); }
/* The #-bar under a colour's numbered orders: the colour goes on below it, so it ends on
   a dashed rule instead of the solid one that closes the whole colour. */
table.grid tr.colour-antal.underindeks-bar > td,
table.grid tr.colour-antal.underindeks-bar > th { border-bottom: 1px dashed var(--border); }
table.grid tr.colour-sum .chip { font-size: inherit; padding: 0 .3rem; }
table.grid tr.colour-sum > th.sum-label,
table.grid tr.colour-pct > th.sum-label,
table.grid tr.colour-antal > th.sum-label { white-space: normal; line-height: 1.25; }

@media print {
  /* The totals bar prints. It is the one line somebody at a bench reads off the
     paper, and a tfoot repeats on every printed page in most browsers. */
  table.grid tr.grid-sum > td,
  table.grid tr.grid-sum > th,
  table.grid tr.grid-pct > td,
  table.grid tr.grid-pct > th,
  table.grid tr.grid-antal > td,
  table.grid tr.grid-antal > th,
  table.grid tr.colour-sum > td,
  table.grid tr.colour-sum > th,
  table.grid tr.colour-pct > td,
  table.grid tr.colour-pct > th,
  table.grid tr.colour-antal > td,
  table.grid tr.colour-antal > th {
    background: #eef1f5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  table.grid tr.grid-pct > td,
  table.grid tr.grid-pct > th,
  table.grid tr.grid-antal > td,
  table.grid tr.grid-antal > th,
  table.grid tr.colour-pct > td,
  table.grid tr.colour-pct > th,
  table.grid tr.colour-antal > td,
  table.grid tr.colour-antal > th { color: #444 !important; }
  p.sum-note { font-size: .72rem; color: #444; }

  /* ?kolonner=alle: all 56 columns on one sheet. Nothing here can make 56 columns
     comfortable - the point is to make them FIT, so the browser's own scaling has
     something to work with. Pair it with landscape A3 in the print dialog. */
  /* ?kolonner=alle - every column on one sheet, and the four rules that decide the
     page count. Measured in a browser at A3-landscape width before and after:
     129 sheets -> 4.

     !important throughout, and it is earned: the screen rules this fights are
     .sticky-col (width pinned to a CSS variable), td.prod / td.vare (their own font
     sizes) and .chip (a pill with its own padding). Every one of them is correct on a
     screen and wrong on paper, and they all out-specify a plain print selector. */
  /* border-collapse, so the cells add up to the table. Separate borders left 57 px of
     an A3 page in the gaps between 57 columns - a column's worth of paper, spent on
     nothing. */
  table.grid.print-alle { font-size: 7px !important; table-layout: fixed; width: 100%; border-collapse: collapse; }
  table.grid.print-alle th,
  table.grid.print-alle td {
    padding: 1px 2px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 7px !important;
    line-height: 1.15 !important;
    /* 1. RELEASE THE STICKY WIDTHS. Pinned at 119 px and 234 px they took a third of
          an A3 for two columns and squeezed the other 54 into 21 px each. */
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }
  /* 2. ONE LINE PER ROW. `word-break: break-word` in a 27-px column turned
        '6292-35/LB10036 Black/brown' into eight stacked lines - 305 rows of that is
        the owner's 128 sheets. The numbers never needed to wrap. */
  /* !important, and it is the difference between 4 sheets and 129.
     TWO existing print rules force wrapping with !important of their own -
     `.grid th, .grid td { white-space: normal !important }` and
     `table.grid.data-grid tbody td { white-space: normal !important }` - and a plain
     declaration loses to both however specific its selector is. I measured this rule
     "working" against an injected subset of the stylesheet that did not include
     them, and reported 4 pages while the real print was still wrapping. Measure
     against every print rule at once, or do not report a number. */
  table.grid.print-alle tbody td,
  table.grid.print-alle tfoot td,
  table.grid.print-alle tfoot th { white-space: nowrap !important; }
  table.grid.print-alle tbody tr { page-break-inside: avoid; }
  /* 3. THE COLOUR PILL BECOMES TEXT. Measured: the .chip span is 27 px tall on its
        own and dragged every row from 11 px to 29,6 px - one cell setting the height
        of all 57. On paper the colour is a word, and the row rail still shows it. */
  table.grid.print-alle .chip,
  table.grid.print-alle .under {
    display: inline !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    box-shadow: none !important;
    min-width: 0 !important;
    font-size: inherit !important;
    line-height: inherit !important;
  }
  /* 4. THE HEAD STANDS UP. Horizontal, the names broke one letter per line and the
        header alone was 278 px - a quarter of every sheet, repeated on all of them.
        Turned sideways it is a fixed 84 px and the full name still reads. */
  /* :not([colspan]) - THE COLUMN HEADERS ONLY.
     thead also carries the full-width banner rows: the black "IKKE I KILDENS
     RÆKKEFØLGE" strip a sorted print puts on every page, and the ark identity strip.
     Turned sideways, that banner's `background: #000` collapsed into a solid black
     bar across the top of every sheet - and being a colspan cell in a fixed layout it
     dragged the column widths with it, so the rows below started wrapping again.
     The owner printed a filtered, sorted view and got exactly that. */
  table.grid.print-alle thead th:not([colspan]) {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap !important;
    /* Height is the TEXT length in vertical-rl, not the box depth, so this is how
       long a name may be before it clips. 150 px at 6,5 px fits every operation
       name in the snapshot - the longest is 'Påsyning af spænde + brænde skruedel'.
       It costs 66 px more per sheet than 84 did and buys back a header nobody has
       to decode. Wrapping is NOT the answer here: a second line in vertical-rl runs
       sideways and widens the column, which is the one thing there is none of. */
    height: 150px;
    max-height: 150px;
    vertical-align: bottom;
    text-align: left;
    font-size: 6.5px !important;
    line-height: 1.05 !important;
    padding: 2px 1px !important;
  }
  /* The number, in front of the name and bold, so a column is identifiable even
     where the name does clip. 'Ark 08' and 'op. 08' are the same 08 everywhere else
     in this app. */
  table.grid.print-alle thead th .th-nr {
    display: inline !important;
    font-weight: 800;
  }
  table.grid.print-alle thead th .th-nr::after { content: " "; }
  /* The banners stay flat, and stay readable: they are the sentence that says the
     paper is not in production order. */
  table.grid.print-alle thead th[colspan] {
    writing-mode: horizontal-tb !important;
    white-space: normal !important;
    height: auto !important;
    max-height: none !important;
    text-align: left;
    font-size: 6.5px !important;
    line-height: 1.25 !important;
  }
  /* 5. COLUMN WIDTHS, or the text columns bleed into their neighbours.
        `table-layout: fixed` shares the width EQUALLY, so 'Vare' got the same 27 px
        as a column holding "0,38" - and td.vare carries `overflow: visible` from the
        screen rules, so instead of clipping it printed straight across the columns
        beside it. Measured: 'Vare' needed 111 px and had 27.

        Fixed layout takes its widths from the FIRST row, which is thead - so naming
        them on the header is enough, and the columns left unnamed share what is over.
        Budget at A3 landscape (~1550 px): 406 px to the ten identity columns, ~24 px
        each to the 47 operation columns, which holds "0,38" at 7 px with room. Checked
        against all 305 rows x 57 columns: 0 cells overflow their box. */
  table.grid.print-alle th,
  table.grid.print-alle td { overflow: hidden !important; }
  /* THE WIDTHS LIVE ON <col>, not on the header cells - see gridCols in render.js.
     `table-layout: fixed` reads the first ROW of the table, and on a sorted print that
     row is the full-width banner: one colspan cell, whose width it then divides equally
     across all 57 columns. Widths set on the header row were ignored and 'Vare' printed
     across its neighbours - 818 of 17 385 cells overflowing. <col> is the one thing
     fixed layout consults before the first row.

     PER CENT, NOT PIXELS. Pixel widths are a guess at one paper size: they summed to
     1 538 px of a 1 542 px A3 page - 4 px short there, and badly wrong on A4 or at any
     printer scale. A percentage is right on every sheet by construction. The identity
     columns are named; the operation columns are left unspecified on purpose, so fixed
     layout gives them an equal share of whatever is left - which is what makes this
     adapt when a filter empties half of them.

     !important because the generic print-alle cell rule sets `width: auto !important`
     to release the sticky pinning, and it would otherwise win here too. */
  table.grid.print-alle col.rank { width: 1.2% !important; }
  table.grid.print-alle col.col-prod- { width: 2.4% !important; }
  table.grid.print-alle col.col-vare { width: 9% !important; }
  table.grid.print-alle col.col-antal { width: 1.6% !important; }
  table.grid.print-alle col.col-supp-varetekst { width: 5.4% !important; }
  table.grid.print-alle col.col-levering { width: 2.9% !important; }
  table.grid.print-alle col.col-sum { width: 1.9% !important; }
  table.grid.print-alle col.col-indeks { width: 1.2% !important; }
  table.grid.print-alle col.col-farve { width: 2.2% !important; }
  table.grid.print-alle col.col-underindeks { width: 1.3% !important; }

  /* Density and header style, from the setup panel. The numbers are the ones
     TAETHED_MAAL in render.js estimates the sheet count from - keep the two in step,
     or the panel promises a page count the paper does not deliver. */
  table.grid.print-alle.ud-t-kompakt { font-size: 6px !important; }
  table.grid.print-alle.ud-t-kompakt th,
  table.grid.print-alle.ud-t-kompakt td { font-size: 6px !important; padding: 0 2px !important; }
  table.grid.print-alle.ud-t-kompakt thead th:not([colspan]) { height: 130px; max-height: 130px; font-size: 5.5px !important; }

  table.grid.print-alle.ud-t-luftig { font-size: 9px !important; }
  table.grid.print-alle.ud-t-luftig th,
  table.grid.print-alle.ud-t-luftig td { font-size: 9px !important; padding: 2px 3px !important; }
  table.grid.print-alle.ud-t-luftig thead th:not([colspan]) { height: 170px; max-height: 170px; font-size: 8px !important; }

  /* Flat headers: the names lie down again and the row is capped so a long one
     wraps to two lines instead of making the header a quarter of the sheet. */
  table.grid.print-alle.ud-h-vandret thead th:not([colspan]) {
    writing-mode: horizontal-tb !important;
    white-space: normal !important;
    height: auto !important;
    max-height: 34px !important;
    overflow: hidden;
    vertical-align: bottom;
  }
  /* Numbers only: the shortest header there is, and the one the floor already uses -
     ark 08 IS operation 08. The name is dropped, not shrunk. */
  table.grid.print-alle.ud-h-numre thead th:not([colspan]) {
    writing-mode: horizontal-tb !important;
    white-space: nowrap !important;
    height: auto !important;
    max-height: 34px !important;
    text-align: center;
  }
  table.grid.print-alle.ud-h-numre thead th .sort-link span:not(.th-nr):not(.sort-ind) { display: none !important; }
  table.grid.print-alle.ud-h-numre thead th .th-nr { display: inline !important; font-weight: 800; }
  table.grid.print-alle.ud-h-numre thead th .th-group { display: none !important; }

  /* The rows that span the table are prose, not data - they keep wrapping. */
  table.grid.print-alle tbody tr.ark-hale > td,
  table.grid.print-alle tbody tr.koe-hoved > td,
  table.grid.print-alle tbody tr.koe-gate > td { white-space: normal; }

  /* ONLY THE TABLE. The owner, 2026-08-24: "i only need the table content not the
     text outside it when printing."
     Right, and safe for one reason: everything the page prose was carrying that a
     bench actually needs - which page this is, how many orders, which filter and
     sort are in force, how old the data is - now rides in the thead identity strip,
     which repeats on EVERY sheet. The prose only ever appeared on sheet one. The
     sort banner stays too; it is a thead row, not page furniture. */
  .data-page .page-head,
  .data-page .toolbar,
  .data-page .active-filters,
  .data-page .csv-note,
  .data-page .print-note,
  .data-page .sticky-note,
  .data-page .sum-note,
  .data-page .blaa-loft-status,
  .data-page > main > p.sub,
  main.data-page > p.sub,
  .data-page .kol-blok > h2,
  .data-page .sort-warning { display: none !important; }

  /* Column chunking: each chunk is its own table and starts a fresh sheet, so the
     identity columns repeat at the top of every one. Excel's "2 pages wide". */
  .kol-blok { break-before: page; page-break-before: always; }
  .kol-blok:first-of-type { break-before: auto; page-break-before: auto; }
  .kol-blok > h2 { font-size: .8rem; margin: 0 0 .2rem; }
}

/* ------------------------------------------------------------------ */
/* FULD SKÆRM - one table filling the WINDOW, never the monitor        */
/*                                                                     */
/* The browser's own fullscreen (F11, requestFullscreen) takes the      */
/* whole MONITOR, and a monitor has room for exactly one of them. The   */
/* owner asked for the opposite: two ark open beside each other on one  */
/* screen, BOTH in full screen. So this is a viewport overlay -         */
/* position: fixed is relative to the window, not the display - and two,*/
/* three or four tiled windows can each be in fuld skærm at the same    */
/* time, each showing its own ark at full height.                       */
/*                                                                      */
/* The state lives in ?fuld=<nøgle>, like every other view state on this */
/* site and for the same reason: a wall screen reloads itself every 60 s */
/* and has to come back into the same table, and a window tiled into a   */
/* corner can be bookmarked exactly as it stands. Nothing is kept in     */
/* memory or in a cookie.                                               */
/*                                                                      */
/* Both controls are built by grid.js, so a browser with JavaScript off  */
/* is never shown a button that cannot do anything - the same rule       */
/* .udskriv-knap follows.                                               */
/* ------------------------------------------------------------------ */

.fuld-bar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 .25rem;
}

.fuld-knap {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font: inherit;
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
}
.fuld-knap:hover { background: var(--bg-soft); color: var(--text); }

/* The strip along the top of the overlay. It carries the table's own name on
   purpose: with two ark tiled side by side, both filling their window, the page
   header that used to say which ark this is has been covered by the table. */
@media screen {
#fuld-bjaelke {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 310;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .8rem;
  height: auto;
  min-height: 2.2rem;
  max-height: 50vh;
  overflow: auto;
  padding: .2rem .6rem;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-strong);
  box-shadow: var(--shadow);
}
#fuld-bjaelke .fuld-navn {
  flex: 1 1 8rem;
  min-width: 0;
  order: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .85rem;
  font-weight: 700;
}
#fuld-bjaelke .fuld-luk {
  flex: 0 0 auto;
  order: 1;
  max-width: 100%;
  white-space: normal;
}

/* The form's own action block, moved in from under the table while it is maximised.
   Its page styling is a stacked panel with margins. The buttons can wrap onto an
   extra line in a tiled window; grid.js measures the resulting toolbar height.
   The hint can be clipped, while every action remains reachable. */
#fuld-bjaelke .fuld-handlinger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  flex: 0 1 auto;
  order: 2;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}
#fuld-bjaelke .fuld-handlinger > .sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .74rem;
}
#fuld-bjaelke .fuld-handlinger .btn {
  min-height: 1.8rem;
  max-width: 100%;
  padding: .2rem .6rem;
  font-size: .78rem;
  white-space: normal;
}
}

/* The overlay itself. Every selector here is written to out-specify the rule it
   replaces: .data-page .table-wrap.scroll-x pins a max-height off 100vh, and
   admin.css is INLINED INTO THE PAGE after app.css, so a bare .tabel-fuld would
   lose the tie to .adm-tablewrap on overflow, border and radius. */
.tabel-fuld,
.table-wrap.tabel-fuld,
.data-page .table-wrap.scroll-x.tabel-fuld,
.adm-tablewrap.tabel-fuld,
.op-grid-wrap.tabel-fuld {
  position: fixed;
  top: var(--fuld-bar-h, 2.2rem);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  max-height: none;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

/* The sticky header row measures itself against the page header on a normal page.
   Inside the overlay the page header is not there - the scrollport starts at the
   top of this box - so a th left at top: var(--header-h) would float a header's
   height down the table and hide the first four rows behind itself. */
.tabel-fuld table.grid thead th,
.tabel-fuld table.stat-table thead th,
.tabel-fuld table.adm-table thead th,
.tabel-fuld table.op-grid thead th { top: 0; }

/* The page behind must not scroll while the overlay is the scroller, and the
   page header must not flash into view: the inline script in <head> sets this
   class from ?fuld= before the first paint, several hundred ms before grid.js
   has found the table it belongs to. */
html.fuld-skaerm, html.fuld-skaerm body { overflow: hidden; }
html.fuld-skaerm .app-header { display: none; }
html.fuld-skaerm .fuld-bar { display: none; }

@media print {
  /* PAPER HAS NO VIEWPORT. A table left position: fixed prints its first screenful
     and nothing else - the same failure that cost half of every sheet when the ark
     were printed inside .table-wrap.scroll-x, six rounds ago. Anyone may hit Ctrl+P
     while a table is in fuld skærm, so the overlay is undone here in full. */
  .tabel-fuld,
  .table-wrap.tabel-fuld,
  .data-page .table-wrap.scroll-x.tabel-fuld,
  .adm-tablewrap.tabel-fuld,
  .op-grid-wrap.tabel-fuld {
    position: static;
    top: auto; left: auto; right: auto; bottom: auto;
    z-index: auto;
    max-height: none;
    overflow: visible;
  }
  html.fuld-skaerm, html.fuld-skaerm body { overflow: visible; }
  #fuld-bjaelke, .fuld-bar, .fuld-knap { display: none !important; }
}

/* ------------------------------------------------------------------ */
/* OPERATIONSTILSTAND - Probiz' eget ikon ved siden af timerne         */
/*                                                                     */
/* Farverne er Probiz' egne, aflæst på det levende gitter 24-08-2026,  */
/* så de to skærme ikke kan komme til at betyde noget forskelligt ved  */
/* at se forskellige ud. Tegnet bærer betydningen alene - en bænk får  */
/* arket på papir, og en sort/hvid printer har ingen farver at læse.   */
/* ------------------------------------------------------------------ */

.op-stat {
  display: inline-block;
  margin-right: .25rem;
  font-weight: 800;
  line-height: 1;
  vertical-align: baseline;
}
.op-faerdig     { color: #2e8b2e; }
.op-ikke-begyndt { color: #be4240; }
.op-pause       { color: #d96a00; }
.op-udraab      { color: #a67c00; }

/* Færdig er den eneste tilstand uden et tal ved siden af sig - 757 ud af 757 på
   det levende gitter - så fluebenet står alene i cellen og må ikke klemmes ud
   mod venstre af en margen, der skulle give plads til et tal, der ikke kommer. */
td.num .op-stat:only-child { margin-right: 0; }

@media print {
  /* Tegnet skal med på papiret; farven behøver ikke, og en mono-printer giver den
     alligevel ikke. Sort er læsbart på alle fire. */
  .op-stat { color: #000 !important; font-weight: 700; }

  /* UNDTAGEN på ?kolonner=alle. Det print presser 56 kolonner ned på ét ark ved
     7 px og fik antallet af ark fra 129 til 4; et ekstra tegn plus en margen i
     hver eneste operationscelle er 48 kolonner bredere, og bredden var hele
     kampen. Arkene selv viser én operationskolonne og beholder mærket. */
  table.grid.print-alle .op-stat { display: none; }
}

/* --- /idag: one person, one operation, one order ------------------------- */

/* A LIST, NOT A TABLE. Each person's day is a handful of rows of wildly different
   length - "op. 21 montering skruedele - 3 borde, ordre 15007, 5,3 t" next to
   "op. 12 sløjfer, 0,1 t" - and a table forces every one of them into the widest
   column. The list wraps and stays readable on a tablet held sideways, which is what
   a planner actually has in their hand on the floor. */
.idag-person { margin: 0 0 1.4rem; }
.idag-person h3 { margin: 0 0 0.35rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; }
.idag-person h3 .sub { font-weight: 400; }
.idag-person-grupper { margin-left: auto; }

/* A GRID ON THE LIST, NOT ON THE ROW. Two mistakes were made here in order, and the
   second is the interesting one:
     1. flex, so the trailing pieces - "+0,3 t i morgen", the group, a "på pause" badge -
        pushed the order number somewhere different on every row;
     2. grid on the <li>, which makes each ROW its own grid, so a `1fr` column sized
        itself per row and the order numbers STILL landed on three different x positions.
   Measured in a browser both times: 1 085, 1 101 and 1 012 px for what should be one
   column. The grid has to live on the container the rows share, with the rows as
   `display: contents`, and render.js emits every cell even when empty so the count
   never varies. */
.idag-liste {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 4.2rem minmax(9rem, 1fr) 4.5rem 4.5rem 7.5rem auto auto;
  align-items: baseline;
  gap: 0.15rem 0.6rem;
}
.idag-opgave { display: contents; }
.idag-op { font-variant-numeric: tabular-nums; color: var(--muted); }
.idag-navn { min-width: 0; overflow-wrap: anywhere; }
.idag-prod { font-variant-numeric: tabular-nums; text-align: right; }
/* The hours are what a bench reads first, so they are the one thing set in bold. */
.idag-timer { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.idag-rest { white-space: nowrap; }
.idag-gruppe { white-space: nowrap; }
.idag-maerke { white-space: nowrap; }

/* On a phone the seven columns become three lines - and the WHOLE GRID has to go with
   them, not just the template.
   Measured at 375 px with getBoundingClientRect: leaving the shared grid in place and
   only narrowing it to four columns put seven cells into a four-column flow, so every
   row started three columns further on than the last. The group label of one task then
   sat on the same visual line as the operation number of the NEXT one, and a planner
   reading it on the floor could attach the hours to the wrong operation. Seven does not
   divide by four, and the rows are `display: contents`, so they cannot break the flow.
   Below the breakpoint each task is therefore its OWN grid with explicit rows, and a
   rule above it draws the boundary the columns used to imply. */
@media (max-width: 720px) {
  .idag-liste { display: block; }
  .idag-opgave {
    display: grid;
    grid-template-columns: 4.2rem 1fr auto;
    align-items: baseline;
    gap: 0.1rem 0.6rem;
    padding: 0.35rem 0;
    border-top: 1px solid var(--line);
  }
  .idag-opgave:first-child { border-top: 0; }
  .idag-op { grid-column: 1; grid-row: 1 / span 3; }
  .idag-navn { grid-column: 2 / -1; grid-row: 1; }
  .idag-prod { grid-column: 2; grid-row: 2; text-align: left; }
  .idag-timer { grid-column: 3; grid-row: 2; }
  .idag-rest { grid-column: 2 / -1; grid-row: 3; }
  .idag-gruppe { grid-column: 2; grid-row: 4; }
  .idag-maerke { grid-column: 3; grid-row: 4; }
  /* An empty carry-over cell must not leave a blank line between the order and the
     group - the row collapses to nothing when its only child is gone. */
  .idag-rest:empty { display: none; }
}

@media print {
  /* The picker and the "back to today" button mean nothing on paper, and the page IS
     printable on purpose: it is the one sheet a planner would carry to the floor. */
  .idag-person { break-inside: avoid; }
}

/* --- /hjaelp: hvad kan begyndes lige nu, og hvem kan tage den -------------- */
.hj-tal { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0 0 1rem; }
.hj-tal div { display: flex; flex-direction: column; }
.hj-tal b { font-size: 1.35rem; line-height: 1.1; }
.hj-tal span { font-size: 0.8rem; color: #555; }
.hj-filter { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.75rem; }
.hj-filter label { font-weight: 600; }
.hj-table td { vertical-align: top; }
.hj-op { white-space: nowrap; }
.hj-prod { white-space: nowrap; }
.hj-kilde { display: block; font-size: 0.7rem; font-style: normal; color: #777; }
.hj-person { display: inline-block; border: 1px solid #ccc; border-radius: 10px;
  padding: 0 0.4rem; margin: 0 0.2rem 0.2rem 0; font-size: 0.8rem; white-space: nowrap; }
.hj-person i { font-style: normal; color: #777; margin-left: 0.3rem; }
/* Erfaring RANGERER, den udelukker aldrig - se domain/hjaelp.js. Den, der har prøvet det,
   står først og markeret; den, der ikke har, står stadig der. */
.hj-proevet { border-color: #1a7f37; background: #eaf6ec; }
.hj-proevet i { color: #1a7f37; }
.hj-ingen { color: #a00; font-size: 0.8rem; }
.hj-optagede { font-size: 0.75rem; color: #777; margin-top: 0.15rem; }
/* De, som porten siger er væk. VIST, men uden for chip-listen: at skjule navnene ville
   lade en kort liste ligne et hul i ejerens matrice, og det er to forskellige ting. */
.hj-vaek { font-size: 0.75rem; color: #8a6d00; margin-top: 0.15rem; }
.hj-vaek i { font-style: normal; color: #a08a3c; }
.hj-sidst { font-size: 0.8rem; font-style: italic; color: #555; white-space: nowrap; }
.hj-hvorfor td { border-top: 0; padding-top: 0; padding-bottom: 0.6rem;
  font-size: 0.8rem; color: #555; }
.hj-fod { margin-top: 1rem; }

/* --- /grupper: passer matricen med det, iPad'erne bogfører? ---------------- */
.gf-panel h3 { margin: 1.5rem 0 0.25rem; }
.gf-hoved { font-size: 1.05rem; margin: 0 0 0.5rem; }
.gf-hoved .gf-note { display: block; font-size: 0.8rem; color: #555; font-weight: 400; }
.gf-table td { vertical-align: top; }
.gf-init { font-style: normal; font-size: 0.75rem; color: #777; }
.gf-tynd { color: #999; }
.gf-dom { font-size: 0.8rem; border-radius: 10px; padding: 0 0.4rem;
  border: 1px solid #ccc; white-space: nowrap; }
.gf-passer-ikke .gf-dom { border-color: #a00; background: #fdecea; color: #a00; }
.gf-ipad-skifte .gf-dom { border-color: #8a6d00; background: #fdf6e3; color: #8a6d00; }
.gf-driver-ud .gf-dom { border-color: #8a6d00; background: #fdf6e3; color: #8a6d00; }
.gf-hvorfor td { border-top: 0; padding-top: 0; padding-bottom: 0.6rem;
  font-size: 0.8rem; color: #555; }
.gf-udenfor { font-size: 0.85rem; background: #f6f6f6; border-left: 3px solid #ccc;
  padding: 0.5rem 0.75rem; }
.gf-ops { font-size: 0.85rem; }

/* --- /ruteregler: holder portene mod historikken? ------------------------- */
.rm-panel h3 { margin: 1.5rem 0 0.25rem; }
.rm-hoved { font-size: 1.05rem; margin: 0 0 0.75rem; }
.rm-hoved .rm-note { display: block; font-size: 0.8rem; color: #555; font-weight: 400;
  margin-top: 0.35rem; }
.rm-table td, .rm-table th { font-size: 0.85rem; }
.rm-pos { line-height: 2; }
.rm-pos span { display: inline-block; border: 1px solid #ccc; border-radius: 10px;
  padding: 0 0.4rem; margin: 0 0.2rem 0.2rem 0; font-size: 0.8rem; white-space: nowrap; }
.rm-pos i { font-style: normal; color: #777; margin-left: 0.25rem; }
.rm-fod { margin-top: 1rem; }

/* ------------------------------------------------------------------ */
/* Maskiner: den grå række på /hjaelp, og maskintabellen              */
/* ------------------------------------------------------------------ */

/* En række, hvis maskine er optaget lige nu. GRÅ ER ALDRIG DET ENESTE SIGNAL -
   `.hj-maskine` står ved siden af, fordi en lav-opacitet-række på en vægskærm på
   afstand læses som *væk*, og *væk* er den fejl, siden findes for at forhindre. */
.hj-venter td { opacity: .62; background: var(--surface-2, #f6f6f4); }

.hj-maskine {
  display: inline-block;
  margin-left: .5em;
  padding: .05em .45em;
  border: 1px solid var(--roed, #b3261e);
  border-radius: 3px;
  color: var(--roed, #b3261e);
  font-size: .82em;
  white-space: nowrap;
}

/* Hvem der står ved maskinen, og på hvilken ordre. EGEN LINJE inde i mærket, så
   kolonnen ikke bliver bredere - `nowrap` på mærket gælder stadig hver linje for sig. */
.hj-maskine-hvem { display: block; font-size: .92em; }
.hj-maskine a { color: inherit; text-decoration: underline; }

.maskin-tabel .maskin-usagt td { background: var(--surface-2, #f6f6f4); }
.maskin-tabel .maskin-over td { background: #fdf0ef; }
.maskin-tabel .maskin-inaktiv td { opacity: .7; }
.maskin-tabel .maskin-tilfoej td { background: var(--surface-2, #f6f6f4); }
.maskin-tabel input[type="text"] { width: 100%; box-sizing: border-box; }
.maskin-tabel .mk-antal { width: 6em; }

@media print {
  /* Mærket bærer mening og skal med på papiret; opaciteten gør ikke. */
  .hj-venter td { opacity: 1; background: none; }
  .hj-maskine { border: 1px solid #000; color: #000; }
  /* Uden den her arver linket sin egen blå og bliver næsten usynligt på papir. */
  .hj-maskine a { color: #000; }
}

/* The browser window may be a whole display, a tiled window or a side panel.
   grid.js measures each table's own space and assigns these presentation modes.
   Screen-only rules keep measured sizes and compact cells out of print layouts. */
@media screen {
  .data-page .table-wrap.scroll-x:not(.tabel-fuld) {
    max-height: var(--table-available-h, calc(100vh - var(--header-h) - 12rem));
    min-height: min(14rem, 65vh, var(--table-available-h, 100vh));
  }

  /* Density changes whitespace, never the reader's font size or browser zoom. */
  [data-table-density="compact"] table.grid thead th {
    padding: .3rem .35rem;
  }
  [data-table-density="compact"] table.grid tbody tr > td,
  [data-table-density="compact"] table.grid tbody tr > th,
  [data-table-density="compact"] table.grid tfoot tr > td,
  [data-table-density="compact"] table.grid tfoot tr > th {
    padding: .3rem .35rem;
  }
  [data-table-density="comfortable"] table.grid thead th {
    padding: .35rem .5rem;
  }
  [data-table-density="comfortable"] table.grid tbody tr > td,
  [data-table-density="comfortable"] table.grid tbody tr > th,
  [data-table-density="comfortable"] table.grid tfoot tr > td,
  [data-table-density="comfortable"] table.grid tfoot tr > th {
    padding: .55rem .5rem;
  }

  [data-table-pins="reduced"] table.grid.sticky-cols {
    --sticky-w-0: 2.4rem;
    --sticky-w-1: 6.2rem;
    --sticky-w-2: 9rem;
    --sticky-w-3: 6.8rem;
  }
  [data-table-pins="minimal"] table.grid.sticky-cols {
    --sticky-w-0: 2.3rem;
    --sticky-w-1: 6.2rem;
  }
  /* Keep rank and production number visible, while the description joins the
     scrollable columns. Its full text remains available by scrolling sideways. */
  [data-table-pins="minimal"] table.grid.sticky-cols :is(th, td):is(.sticky-2, .sticky-3) {
    position: static;
    left: auto;
    z-index: auto;
    width: auto;
    min-width: 10rem;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
  }
  [data-table-pins="minimal"] table.grid.sticky-cols thead th:is(.sticky-2, .sticky-3) {
    position: sticky;
    top: 0;
    z-index: 30;
  }
  [data-table-pins="minimal"] table.grid.sticky-cols thead th.filter-open { z-index: 80; }
}

/* An immediately usable narrow layout before JavaScript has measured the table,
   and when scripting is unavailable. A measured mode always takes precedence. */
@media screen and (max-width: 720px) {
  .table-wrap:not([data-table-pins]) table.grid.sticky-cols {
    --sticky-w-0: 2.3rem;
    --sticky-w-1: 6.2rem;
  }
  .table-wrap:not([data-table-pins]) table.grid.sticky-cols :is(th, td):is(.sticky-2, .sticky-3) {
    position: static;
    left: auto;
    z-index: auto;
    width: auto;
    min-width: 10rem;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
  }
  .table-wrap:not([data-table-pins]) table.grid.sticky-cols thead th:is(.sticky-2, .sticky-3) {
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .table-wrap:not([data-table-pins]) table.grid.sticky-cols thead th.filter-open { z-index: 80; }
}

/* A visible simulation label also survives tablets, printing and absent hover. */
.op-simuleret { font-size: .7em; font-weight: 600; margin-left: .15em; }
/* Workflow guidance stays distinct from the order's priority colour. */
.planning-guidance { margin: .45rem 0; padding: .55rem .65rem; border: 2px solid #986300; border-radius: .4rem; background: #fff5cf; color: #402b00; font-size: .82rem; font-weight: 400; white-space: normal; text-align: left; line-height: 1.4; min-width: 13rem; max-width: 32rem; }
.planning-guidance-label, .planning-guidance-action { display: block; margin-bottom: .25rem; }
.planning-guidance-action { font-weight: 600; }
.planning-guidance ul { padding-left: 1.1rem; margin: .3rem 0; }
.planning-guidance a { color: #493300; text-decoration: underline; }
.planning-guidance details { margin: .35rem 0; }
.planning-guidance summary { cursor: pointer; text-decoration: underline; }
.planning-guidance :focus-visible { outline: 3px solid #005bc2; outline-offset: 3px; }
.planning-guidance-link { display: inline-block; padding: .25rem 0; }
.planning-review { margin: 1rem 0; padding: .8rem; border: 2px solid #986300; border-radius: .5rem; background: #fffaf0; }
.planning-review article { display: inline-block; vertical-align: top; max-width: 33rem; margin: .35rem 1rem .35rem 0; }
.planning-review h2, .planning-review h3 { margin: .2rem 0; }
.op-planlagt { display: inline-block; white-space: normal; border: 1px solid #986300; background: #fff5cf; color: #402b00; border-radius: .25rem; padding: .2rem; font-size: .75rem; max-width: 11rem; }
.tavle-kort.has-planning-guidance { outline: 2px solid #986300; outline-offset: -2px; }
@media print {
  .planning-guidance, .planning-review, .op-planlagt { color: #000; background: #fff; border-color: #000; break-inside: avoid; }
  .planning-guidance { min-width: 0; font-size: 8pt; }
  .planning-guidance details > * { display: block !important; }
  .planning-guidance-link { display: none; }
}
.grid .planning-guidance { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }

/* Cause labels and border patterns remain readable without colour and in print. */
#flow-suggestions { scroll-margin-top: 7rem; }
.anomaly-legend { margin: 1rem 0; padding: 1rem; background: #fff; border: 1px solid #c5cbd3; border-radius: .5rem; }
.anomaly-legend h2 { font-size: 1.05rem; margin: 0; }
.anomaly-legend ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: .65rem 1.5rem; }
.anomaly-badge { display: inline-block; padding: .2rem .45rem; margin: 0 .45rem .35rem 0; border: 1px solid currentColor; border-radius: .25rem; font-size: .78rem; font-weight: 700; line-height: 1.4; }
.anomaly-evidence { padding: .8rem; margin: .7rem 0; border-radius: .4rem; }
.anomaly-c5, .op-excluded { color: #572070; background: #f7edff; border: 3px double #78379a; }
.anomaly-variant { color: #164c75; background: #edf6ff; border: 2px dashed #28709f; }
.anomaly-completion { color: #374452; background: #f1f3f6; border: 2px solid #5b6978; }
.anomaly-office { color: #654e00; background: #fff5cb; border: 2px dotted #947000; }
.anomaly-unknown { color: #4d4d4d; background: #f6f6f6; border: 2px dashed #777; }
.anomaly-followup, .planning-guidance--anomalies .planning-followup { color: #402b00; background: #fff5cf; border: 2px solid #986300; }
.planning-guidance--anomalies { border: 0; background: transparent; padding: 0; }
.planning-guidance--anomalies .planning-followup { padding: .55rem .65rem; border-radius: .4rem; }
.planning-review--c5 { background: #fbf7fe; border: 3px double #78379a; }
.anomaly-evidence a { color: inherit; text-decoration: underline; }
@media print {
  .anomaly-evidence, .anomaly-badge, .anomaly-legend, .planning-review--c5, .op-excluded { color: #000; background: #fff; border-color: #000; break-inside: avoid; }
}

/* Planner worker overview: separate current registration from today's history. */
.worker-activity { max-width: 1500px; }
.worker-heading { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1.2rem; }
.worker-heading h1 { margin:.1rem 0 .4rem; }
.worker-heading p { margin:.2rem 0; }
.worker-eyebrow { color:#536276; font-size:.8rem; text-transform:uppercase; letter-spacing:.06em; }
.worker-totals { display:flex; flex-wrap:wrap; gap:.7rem; margin:1rem 0; }
.worker-totals > span { background:#fff; border:1px solid #d9e0e8; border-radius:.45rem; padding:.6rem .85rem; }
.worker-totals b { color:#173b69; margin-right:.25rem; }
.worker-freshness, .worker-note { color:#536276; font-size:.85rem; line-height:1.55; }
.worker-warning { padding:.8rem 1rem; border:1px solid #be861f; border-radius:.4rem; background:#fff7df; color:#654508; }
.worker-list { display:grid; gap:.65rem; margin:1rem 0; }
.worker-card { background:#fff; border:1px solid #d9e0e8; border-radius:.5rem; overflow:hidden; }
.worker-card > summary { display:grid; grid-template-columns:minmax(8rem,1fr) minmax(9rem,1fr) minmax(14rem,2fr) auto; align-items:center; gap:1rem; padding:1rem; cursor:pointer; list-style:none; }
.worker-card > summary::-webkit-details-marker { display:none; }
.worker-card > summary:hover { background:#f7f9fc; }
.worker-card > summary:focus-visible { outline:3px solid #1668d6; outline-offset:-3px; }
.worker-person, .worker-current, .worker-current-item { display:grid; gap:.2rem; }
.worker-person small, .worker-current-item > span, .worker-current-label { color:#536276; font-size:.78rem; }
.worker-current, .worker-person { overflow-wrap:anywhere; min-width:0; }
.worker-status { justify-self:start; padding:.3rem .6rem; border-radius:2rem; font-size:.78rem; font-weight:600; background:#eef1f5; color:#40516a; }
.worker-status-working { background:#e2f4e9; color:#185e35; }
.worker-status-conflict, .worker-status-unknown { background:#fff0ca; color:#704c08; }
.worker-expand { color:#1e589b; white-space:nowrap; font-size:.8rem; }
.worker-expand b { display:inline-block; border-radius:1rem; padding:.05rem .45rem; background:#eaf1fb; }
.worker-card[open] .worker-expand > span { display:inline-block; transform:rotate(180deg); }
.worker-history { border-top:1px solid #d9e0e8; padding:1rem; background:#fbfcfe; }
.worker-history-scroll { overflow-x:auto; }
.worker-history table { width:100%; border-collapse:collapse; font-size:.83rem; }
.worker-history caption { text-align:left; font-weight:600; margin-bottom:.7rem; color:#40516a; }
.worker-history th, .worker-history td { padding:.6rem .7rem; text-align:left; border-bottom:1px solid #e3e8ef; vertical-align:top; }
.worker-history th { color:#40516a; }
.worker-history td:first-child { white-space:nowrap; }
@media (max-width:850px) {
  .worker-card > summary { grid-template-columns:1fr 1fr; gap:.75rem; }
  .worker-current { grid-column:1 / -1; }
  .worker-expand { grid-column:1 / -1; }
  .worker-status { justify-self:end; }
}
@media (max-width:500px) {
  .worker-heading { align-items:flex-start; flex-direction:column; }
  .worker-card > summary { padding:.8rem; }
  .worker-totals { font-size:.8rem; }
}

/* /faerdige - Færdige ordrer */
.faerdige-knapper { display:flex; flex-wrap:wrap; gap:.4rem; margin:.8rem 0 .5rem; }
.faerdige-vaelg { display:inline-flex; flex-wrap:wrap; align-items:center; gap:.5rem; margin:.3rem 1.2rem .3rem 0; }
.faerdige-vaelg input[type=number] { width:5rem; }
.faerdige-prdag { margin:.6rem 0 1rem; }
.faerdige-prdag summary { cursor:pointer; color:#173b69; }
