/* WorkPlan – stylesheet. Lyst tema med sidebjælke (pc) og foldemenu (telefon). */
:root {
  --bg: #f3f5f8;          /* sidebaggrund */
  --surface: #ffffff;     /* kort, tabeller, dialoger */
  --surface-alt: #f6f8fa; /* tabelhoveder, rolige felter */
  --field: #ffffff;
  --primary: #0f6cbd;
  --primary-dark: #0c5a9e;
  --primary-soft: #e6f0fa;
  --sel: #dbeaf7;         /* markeret linje */
  --green: #107c41;
  --yellow: #b45309;
  --red: #c42b1c;
  --text: #1b2430;
  --muted: #5f6b7a;
  --line: #dde3ea;
  --line-strong: #c5ced8;
  --side: #ffffff;
  --side-w: 232px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
h1, h2, h3 { color: var(--text); letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 650; margin: 0; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
button, input, select, textarea { font: inherit; }
button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 14px;
  color: #fff;
  background: var(--primary);
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s;
}
button:hover { background: var(--primary-dark); }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
button.secondary:hover { background: var(--surface-alt); border-color: #aab5c2; }
button.ok { background: var(--green); }
button.warn { background: #c05f00; }
button.danger { background: var(--red); }
button.danger:hover { background: #a42316; }
button.small { padding: 5px 10px; font-size: 12.5px; }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
label { display: block; margin: 10px 0 5px; color: var(--muted); font-size: 13px; font-weight: 500; }
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 75px; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.row > * { flex: 1; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.box, .card {
  margin-bottom: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.login .box { width: min(420px, 100%); padding: 32px; }
.login h1 { display: flex; align-items: center; gap: 10px; font-size: 24px; }
.brand-mark {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 16px;
}

/* ---------- Ramme: sidebjælke + indhold ---------- */
#app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 8;
  width: var(--side-w);
  display: flex; flex-direction: column;
  background: var(--side);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; font-weight: 700; font-size: 15px; }
.brand #appTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-title { margin: 14px 8px 4px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 38px; padding: 7px 10px; margin: 1px 0;
  color: var(--text); text-decoration: none; border-radius: 6px; font-weight: 500;
}
.nav-item:hover { background: var(--surface-alt); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 650; box-shadow: inset 3px 0 0 var(--primary); }
.ico { width: 18px; height: 18px; flex: 0 0 18px; }
.side-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.who { display: flex; flex-direction: column; line-height: 1.3; }
.who span { color: var(--muted); font-size: 12px; }
.side-meta { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.status { color: var(--green); font-size: 11.5px; }
.mainwrap { margin-left: var(--side-w); min-width: 0; }
.topbar { display: none; }
.scrim { display: none; }
main { max-width: 1680px; margin: 0 auto; padding: 22px 28px 40px; }

/* ---------- Sidehoveder ---------- */
.page-head { margin-bottom: 14px; }
.page-head p { margin: 6px 0 0; }
.head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.head h1, .head h2 { margin: 0; }
.head button { white-space: nowrap; }
.crumbs { margin-bottom: 6px; font-size: 13px; }
.detail-title { display: flex; align-items: center; gap: 10px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dot.big { width: 13px; height: 13px; margin: 0; }

/* ---------- Lister i Business Central-stil ---------- */
.list-card { padding: 0; overflow: hidden; }
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.tb-actions, .tb-right { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.tb-right { gap: 6px; }
button.tb {
  background: transparent; color: var(--text); border: 0; font-weight: 500;
  padding: 6px 10px; min-height: 34px; border-radius: 4px;
}
button.tb:hover:not(:disabled) { background: var(--surface-alt); }
button.tb.primary-text { color: var(--primary); font-weight: 650; }
button.tb.danger-text { color: var(--red); }
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
button.pill { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 3px 12px; min-height: 30px; font-weight: 500; }
button.pill.on { background: var(--primary-soft); color: var(--primary); border-color: #b9d3ee; font-weight: 600; }
input.search { width: 220px; min-height: 32px; padding: 5px 10px; }
.tbl.list { min-width: 980px; font-size: 13px; }
.tbl.list th { background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl.list th, .tbl.list td { padding: 8px 9px; }
.tbl.list td { vertical-align: middle; }
.tbl.list tbody tr { cursor: default; }
.tbl.list tbody tr:hover td { background: #f5f8fb; }
.tbl.list tbody tr.sel td { background: var(--sel); }
.tbl.list tr.muted td { opacity: 0.6; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
td.clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-foot { padding: 8px 12px; font-size: 12px; border-top: 1px solid var(--line); }
.neg { color: var(--red); font-weight: 650; }
.warnval { color: var(--yellow); font-weight: 650; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--surface-alt); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
select.mini { width: auto; min-height: 30px; padding: 3px 6px; font-size: 12.5px; }
ul.plain { padding-left: 18px; margin: 8px 0; }
ul.plain li { margin: 4px 0; }
.checks { display: flex; flex-direction: column; gap: 8px; }
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); font-weight: 400; cursor: pointer; }
label.check:has(input:checked) { border-color: #b9d3ee; background: var(--primary-soft); }
label.check input { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; flex: 0 0 auto; }
.rate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }

/* ---------- Planlægning ---------- */
.grid { display: grid; gap: 1px; overflow: auto; background: var(--line); border: 1px solid var(--line); border-radius: 8px; }
.cell { min-width: 95px; min-height: 90px; padding: 8px; background: var(--surface); }
.cell.header { min-height: 40px; background: var(--surface-alt); font-weight: 600; text-align: center; }
.cell.worker { min-width: 125px; background: var(--surface-alt); font-weight: 600; }
.drop-zone { transition: background 0.15s, box-shadow 0.15s; }
.drop-zone.drag-over { background: #dbeafe; box-shadow: inset 0 0 0 2px var(--primary); }
.chip { margin: 4px 0; padding: 7px; color: #fff; border-radius: 6px; font-size: 12px; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.chip:active, .pool-item:active { cursor: grabbing; }
.chip button { margin-left: 3px; padding: 1px 5px; background: #0003; border: 0; }
.pool { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.pool-item { padding: 8px 11px; color: #fff; border-radius: 6px; font-size: 13px; cursor: grab; user-select: none; touch-action: none; }
.cell.header.today { color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }
.drop-zone.today { background: #f0f6fd; }
.weeknav { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.weektitle { min-width: 220px; font-weight: 650; text-align: center; }
.daycard { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.daycard h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; padding: 9px 12px; background: var(--surface-alt); border-bottom: 1px solid var(--line); }
.daycard.today { border-color: var(--primary); }
.daycard.today h3 { color: var(--primary); }
.daybody { min-height: 60px; padding: 10px; }
.entry { margin-bottom: 8px; padding: 10px; background: var(--surface-alt); border-left: 4px solid var(--primary); border-radius: 6px; }

/* ---------- Tabeller ---------- */
.tablewrap { overflow: auto; }
.tbl { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { background: var(--surface-alt); color: var(--muted); font-size: 12px; font-weight: 600; }
.tbl tr.mainrow td { background: var(--surface-alt); }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.badge { display: inline-block; padding: 2px 9px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 20px; font-size: 11.5px; }
.badge.pending { background: #fff4e5; border-color: #f5d2a3; }
.badge.approved { background: #e8f5ee; border-color: #b5dcc5; }
.badge.rejected { background: #fdecea; border-color: #f2bdb6; }
.pending { color: var(--yellow); }
.approved { color: var(--green); }
.rejected { color: var(--red); }
a.link { color: var(--primary); text-decoration: none; }
a.link:hover { text-decoration: underline; }

/* ---------- Nøgletal og fakta ---------- */
.summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.metric { min-width: 140px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 12.5px; box-shadow: var(--shadow); }
.metric b { display: block; font-size: 20px; color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.metric b.pending { color: var(--yellow); }
.metric b.approved { color: var(--green); }
.metric b.rejected, .metric b.neg { color: var(--red); }
.metric b.warnval { color: var(--yellow); }
.metric.selected { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.facts > div { display: flex; flex-direction: column; gap: 2px; }
.facts .muted { font-size: 12px; }
pre.code { background: var(--surface-alt); border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow: auto; color: var(--text); }

/* ---------- Dialoger og beskeder ---------- */
.modal { position: fixed; inset: 0; z-index: 30; display: none; place-items: center; padding: 16px; background: rgba(15, 23, 42, 0.45); }
.modal.show { display: grid; }
.modalbox { width: min(620px, 100%); max-height: 90vh; overflow: auto; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); }
.modalbox h2 { margin-top: 0; }
.modalbox.wide { width: min(940px, 100%); }
.toast {
  /* Beskeder vises midt på skærmen og blokerer ikke for klik. */
  position: fixed; top: 50%; left: 50%; z-index: 40; display: none;
  max-width: min(420px, calc(100% - 32px)); padding: 16px 24px;
  color: #fff; background: #1f2937; border-radius: 10px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.35);
  font-size: 16px; font-weight: 600; text-align: center;
  transform: translate(-50%, -50%); pointer-events: none;
}
.toast.show { display: block; animation: toast-in 0.18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -50%) scale(0.94); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* ---------- Formularer, kunder, tilbud ---------- */
.segmented { display: flex; gap: 8px; margin: 6px 0 4px; }
.segmented label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 9px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text); font-size: 14px; cursor: pointer; }
.segmented label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.segmented input { width: auto; min-height: 0; margin: 0; }
.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f5f8fb; }
.tbl.quote-lines { min-width: 860px; }
.tbl.quote-lines td { vertical-align: middle; padding: 6px; }
.tbl.quote-lines input { min-height: 36px; padding: 6px 8px; }
.tbl.quote-lines button.small { min-height: 30px; padding: 4px 8px; margin-right: 2px; }
.quote-bottom { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: 14px; }
.totals { min-width: 280px; margin-left: auto; }
.totals div { display: flex; justify-content: space-between; gap: 20px; padding: 3px 0; }
.totals .grand { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; font-size: 16px; }
.tbl.inv { min-width: 640px; }
.tbl.inv td { vertical-align: middle; }
.tbl.inv input { min-height: 36px; padding: 6px 8px; }
tr.muted td { opacity: 0.55; }

/* ---------- Stempling ---------- */
button, .tab, select, input, textarea { min-height: 38px; }
button { touch-action: manipulation; }
button.big { min-height: 52px; font-size: 16px; }
.small-note { font-size: 12px; margin: 10px 0 0; }
.clock-head { margin-bottom: 14px; }
.clock-head h2 { margin: 0; font-size: 22px; }
.plan-card { display: flex; gap: 12px; align-items: center; padding: 12px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--primary); border-radius: 8px; }
.plan-time { font-weight: 750; min-width: 46px; }
.plan-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.plan-note { margin-top: 4px; color: #92400e; }
.plan-action button { white-space: nowrap; }
.running { border-width: 2px; border-color: var(--primary); text-align: center; }
.run-label { color: var(--muted); }
.run-timer { font-size: 56px; font-weight: 750; letter-spacing: 1px; font-variant-numeric: tabular-nums; margin: 4px 0; color: var(--text); }
.run-title { font-size: 18px; font-weight: 650; }
.run-task { font-size: 16px; }
.run-addr { margin-top: 6px; }
.type-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.type-row button { flex: 1 1 100px; }
button.type-on { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 0 0 3px #b5dcc5; }
.day-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.day-row span:nth-child(2) { flex: 1; color: var(--muted); }
.day-row.total { border-bottom: 0; font-weight: 700; }
.warn-card { border-color: #e7a14a; background: #fffaf2; }
.pick-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 55vh; overflow: auto; }
.pick-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--primary); padding: 12px; border-radius: 8px; font-weight: 400; }
button.pick-item:hover { background: var(--surface-alt); }
.pick-item b { font-weight: 650; }
.pick-tasks { display: flex; flex-direction: column; gap: 8px; }
.pick-tasks button .small-note { display: block; font-weight: 500; opacity: 0.85; margin-top: 2px; }
details.late { margin: 8px 0 12px; }
details.late summary { cursor: pointer; color: var(--primary); }
.work-type-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 12px; }
.work-type-choice { flex: 1 1 150px; min-height: 48px; padding: 12px 16px; border: 2px solid var(--line); border-radius: 8px; font-weight: 650; text-align: center; }
.work-type-choice.selected { color: #fff; background: var(--green); border-color: var(--green); }

/* ---------- Ugeseddel ---------- */
.tbl.ts { min-width: 980px; table-layout: fixed; }
.tbl.ts th { background: var(--surface); text-align: center; white-space: nowrap; }
.tbl.ts th:first-child { width: 170px; text-align: left; }
.tbl.ts th:last-child { width: 80px; }
.tbl.ts th.today { color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }
.tbl.ts td { vertical-align: top; padding: 6px; }
.ts-name button { margin-top: 6px; }
.ts-total { vertical-align: middle !important; font-size: 15px; }
.ts-cell { cursor: pointer; text-align: center; border-left: 1px solid var(--line); background: var(--surface); }
.ts-cell > b { display: block; font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
.ts-sub { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.ts-flags { display: flex; justify-content: center; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.ts-pill { font-size: 11px; padding: 0 6px; border-radius: 10px; border: 1px solid transparent; white-space: nowrap; }
.ts-pill.pending { background: #fff4e5; color: #9a4b00; border-color: #f5d2a3; }
.ts-pill.ok { background: #e8f5ee; color: var(--green); border-color: #b5dcc5; }
.ts-pill.open { background: var(--primary-soft); color: var(--primary); border-color: #b9d3ee; }
.ts-pill.bad { background: #fdecea; color: var(--red); border-color: #f2bdb6; }
.ts-cell.pending { box-shadow: inset 0 3px 0 #f0a64b; }
.ts-cell.ok { box-shadow: inset 0 3px 0 #4caf7a; }
.ts-cell.open { box-shadow: inset 0 3px 0 var(--primary); }
.ts-cell.bad { box-shadow: inset 0 3px 0 var(--red); background: #fff8f7; }
.ts-cell.today { background: #f7fbff; }
.ts-cell.empty { vertical-align: middle !important; }
.ts-cell:hover { background: #eef5fc; }
.ts-week { padding: 0 6px; white-space: nowrap; }
label.inline-check { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text); font-size: 13px; white-space: nowrap; cursor: pointer; }
label.inline-check input { width: 16px; height: 16px; min-height: 0; }
.tl { position: relative; height: 26px; margin: 10px 0 2px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.tl-presence { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, #fde8c8, #fde8c8 4px, #fff6e9 4px, #fff6e9 8px); }
.tl-seg { position: absolute; top: 3px; bottom: 3px; border-radius: 3px; opacity: 0.95; }
.tl-seg.pending { outline: 2px dashed #fff; outline-offset: -4px; }
.tl-seg.rejected { opacity: 0.25; }
.tl-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.ts-calc { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.ts-calc > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.ts-calc b { font-size: 18px; font-variant-numeric: tabular-nums; }
.ts-calc .net { border-color: var(--primary); background: var(--primary-soft); }
.ts-calc button { margin-top: 4px; align-self: flex-start; }
.ts-warn { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid #f5d2a3; background: #fffaf2; border-radius: 8px; font-size: 13px; }
.ts-warn .bad { color: var(--red); font-weight: 600; }
.ts-warn .warn { color: #9a4b00; }
.ts-warn .info { color: var(--muted); }

/* ---------- Telefon og tablet ---------- */
@media (max-width: 900px) {
  body { font-size: 14px; }
  .mainwrap { margin-left: 0; }
  main { padding: 14px 12px 32px; }
  input, select, textarea { font-size: 16px; }
  button { min-height: 42px; }
  button.small, button.tb, button.pill, select.mini { min-height: 36px; }
  .card, .box { padding: 14px; }
  .list-card { padding: 0; }
  .login .box { padding: 22px; }
  h1 { font-size: 20px; }
  .head { align-items: stretch; }
  .head > button { width: 100%; }
  .row > * { min-width: 0; }
  .summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-width: 0; padding: 10px 12px; }
  .metric b { font-size: 18px; }
  .toolbar { padding: 6px; }
  .tb-right { width: 100%; }
  input.search { flex: 1; width: auto; }
  .tablewrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .tbl { min-width: 680px; }
  .tbl th, .tbl td { padding: 8px; }
  .weeknav { gap: 6px; }
  .weeknav button { flex: 1 1 calc(50% - 6px); }
  .weektitle { flex: 1 0 100%; min-width: 100%; order: -1; }
  .modal { padding: 12px; }
  .modalbox { width: 100%; max-height: 88dvh; padding: 18px 16px; }
  .toast { width: calc(100% - 32px); }
  .run-timer { font-size: 48px; }
  .ts-calc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tbl.ts { min-width: 860px; }
  .tbl.ts th:first-child { width: 120px; }
  .plan-card { flex-wrap: wrap; }
  .plan-action, .plan-action button { width: 100%; }

  /* Ledere: topbjælke med menuknap; sidebjælken glider ind fra venstre. */
  .role-manager .topbar {
    position: sticky; top: 0; z-index: 6;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .iconbtn { background: transparent; color: var(--text); border: 1px solid var(--line-strong); min-width: 42px; padding: 6px 10px; font-size: 18px; line-height: 1; }
  .iconbtn:hover { background: var(--surface-alt); }
  .top-title { font-weight: 650; font-size: 16px; }
  .role-manager .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 0 40px rgba(15, 23, 42, 0.2); width: min(290px, 85vw); z-index: 25; }
  .role-manager.menu-open .sidebar { transform: none; }
  .role-manager.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 24; background: rgba(15, 23, 42, 0.35); }
  .role-manager .nav-item { min-height: 44px; }

  /* Medarbejdere: navn øverst og fanerne som en vandret række (som før). */
  .role-worker .sidebar { position: sticky; top: 0; width: auto; flex-direction: column; border-right: 0; border-bottom: 1px solid var(--line); z-index: 6; }
  .role-worker .brand { padding: 10px 12px 4px; }
  .role-worker .nav { display: flex; overflow-x: auto; padding: 0 6px; gap: 2px; scrollbar-width: thin; }
  .role-worker .nav-item { flex: 0 0 auto; min-height: 44px; border-radius: 0; box-shadow: none; border-bottom: 3px solid transparent; white-space: nowrap; font-size: 13px; }
  .role-worker .nav-item.active { background: transparent; border-bottom-color: var(--primary); box-shadow: none; }
  .role-worker .side-foot { position: absolute; top: 6px; right: 10px; padding: 0; border: 0; flex-direction: row; align-items: center; }
  .role-worker .side-foot .who, .role-worker .side-foot .side-meta { display: none; }
  .role-worker .side-foot button { min-height: 34px; }

  /* Ugeplanen kan swipes og holder navnekolonnen fast. */
  .grid.week { grid-template-columns: 105px repeat(7, minmax(112px, 1fr)) !important; overflow: auto; max-height: 72vh; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .grid.week .cell { min-width: 112px; min-height: 96px; padding: 6px; }
  .grid.week .cell.worker, .grid.week .cell.header:first-child { position: sticky; left: 0; z-index: 2; min-width: 105px; }
  .grid.week .cell.header { top: 0; position: sticky; z-index: 1; }
  .grid.week .cell.header:first-child { z-index: 3; }
  .chip { padding: 8px; line-height: 1.4; cursor: pointer; }
  .chip button { min-width: 36px; min-height: 34px; margin: 4px 2px 0 0; }
  .pool-item { display: flex; align-items: center; gap: 8px; }
  .pool-item button { min-height: 36px; }
}
@media (max-width: 380px) {
  main { padding: 10px 9px 28px; }
  .grid.week { grid-template-columns: 92px repeat(7, minmax(108px, 1fr)) !important; }
  .grid.week .cell { min-width: 108px; }
  .grid.week .cell.worker, .grid.week .cell.header:first-child { min-width: 92px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
