:root {
  --ink: #161d2b;
  --ink-2: #2b3547;
  --muted: #6b7688;
  --line: #e5e8ee;
  --surface: #f4f5f8;
  --card: #ffffff;
  --accent: #4c5fd5;
  --accent-ink: #3446c0;

  --ferie: #e8a33d;
  --ferie-soft: #fbeecf;
  --fri: #2fa98c;
  --fri-soft: #d6f0e8;
  --sygdom: #e5654b;
  --sygdom-soft: #fbdcd4;

  --ok: #2fa98c;
  --warn: #e5654b;
  --pending: #b0851f;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(22, 29, 43, .04), 0 8px 28px -12px rgba(22, 29, 43, .18);
  --shadow-lg: 0 24px 70px -28px rgba(22, 29, 43, .45);

  --ff-display: "Bricolage Grotesque", system-ui, sans-serif;
  --ff-body: "Inter", system-ui, sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ff-body);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--accent); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .12s ease, box-shadow .18s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #0d1420; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--ink-2); background: #fff; }
.btn-ok { background: var(--fri); color: #fff; }
.btn-ok:hover { filter: brightness(.95); }
.btn-danger { background: #fff; border-color: var(--sygdom); color: var(--sygdom); }
.btn-danger:hover { background: var(--sygdom); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

/* =========================================================
   LOGIN
   ========================================================= */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--ink);
}
.login-hero {
  position: relative;
  overflow: hidden;
  padding: 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
}
.login-hero-mark {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -.02em;
  display: flex;
  align-items: center;
  gap: 11px;
  position: relative;
  z-index: 2;
}
.login-hero-mark .dot {
  width: 13px; height: 13px; border-radius: 4px;
  background: var(--ferie);
  box-shadow: 18px 0 0 var(--fri), 36px 0 0 var(--sygdom);
  margin-right: 40px;
}
.login-hero h1 {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(38px, 4.6vw, 62px);
  line-height: .98;
  letter-spacing: -.035em;
  margin: 0 0 20px;
  position: relative; z-index: 2;
}
.login-hero h1 em { font-style: normal; color: var(--ferie); }
.login-hero p {
  color: #aeb8ca; max-width: 30ch; font-size: 16px; line-height: 1.5;
  position: relative; z-index: 2; margin: 0;
}
.login-legend { display: flex; gap: 18px; position: relative; z-index: 2; margin-top: 26px; flex-wrap: wrap; }
.login-legend span { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #c8d0de; }
.login-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ambient planner ribbon in hero background */
.hero-ribbon {
  position: absolute; inset: auto -10% -8% -10%;
  height: 62%;
  opacity: .5;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: rotate(-8deg);
  pointer-events: none;
}
.hero-ribbon .rrow { display: flex; gap: 10px; }
.hero-ribbon .rseg { height: 26px; border-radius: 7px; background: rgba(255,255,255,.06); }

.login-panel {
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
}
.login-card {
  width: 100%;
  max-width: 380px;
}
.login-card h2 {
  font-family: var(--ff-display);
  font-weight: 700; font-size: 27px; letter-spacing: -.02em;
  margin: 0 0 4px;
}
.login-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.field { margin-bottom: 15px; }
.field label {
  display: block; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 7px;
}
.field input {
  width: 100%; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 15px; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(76, 95, 213, .14);
}
.login-card .btn-primary { width: 100%; justify-content: center; padding: 14px; margin-top: 6px; }
.login-error {
  background: var(--sygdom-soft); color: #a23a26; border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 14px; margin-bottom: 16px; font-weight: 500;
}
.login-2fa-hint {
  background: #eef0fb; color: var(--accent-ink); border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 13.5px; margin-bottom: 16px;
}
.login-foot { margin-top: 22px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* =========================================================
   APP SHELL
   ========================================================= */
.shell { max-width: 1120px; margin: 0 auto; padding: 0 22px 80px; }
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 20px 0 18px;
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(var(--surface) 74%, rgba(244,245,248,0));
}
.brand {
  font-family: var(--ff-display); font-weight: 800; font-size: 20px; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 10px; color: var(--ink);
}
.brand .dot {
  width: 12px; height: 12px; border-radius: 4px; background: var(--ferie);
  box-shadow: 16px 0 0 var(--fri), 32px 0 0 var(--sygdom); margin-right: 36px;
}
.topbar-spacer { flex: 1; }
.userchip {
  display: flex; align-items: center; gap: 11px; padding: 6px 6px 6px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
}
.userchip .u-meta { text-align: right; line-height: 1.15; }
.userchip .u-name { font-weight: 600; font-size: 13.5px; }
.userchip .u-role { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; font-family: var(--ff-display);
}

.tabs { display: flex; gap: 6px; margin: 6px 0 22px; border-bottom: 1px solid var(--line); }
.tab {
  border: none; background: none; padding: 12px 4px; margin-right: 22px;
  font-size: 15px; font-weight: 600; color: var(--muted); position: relative;
  transition: color .15s ease;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); }
.tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2.5px;
  background: var(--ink); border-radius: 2px;
}
.tab .badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--sygdom); color: #fff; font-size: 11px; font-weight: 700;
  margin-left: 7px; font-family: var(--ff-mono);
}

/* ---------- Section head ---------- */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--ff-display); font-weight: 700; font-size: 24px; letter-spacing: -.02em; margin: 0;
}
.section-head .eyebrow {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
  color: var(--accent); margin: 0 0 4px;
}

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 18px 18px 16px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.stat.ferie::before { background: var(--ferie); }
.stat.fri::before { background: var(--fri); }
.stat.sygdom::before { background: var(--sygdom); }
.stat .s-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.stat .s-val {
  font-family: var(--ff-display); font-weight: 700; font-size: 40px; letter-spacing: -.03em; line-height: 1;
  margin: 8px 0 2px;
}
.stat .s-unit { font-size: 13px; color: var(--muted); }
.stat .s-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* =========================================================
   YEAR TIMELINE (signature)
   ========================================================= */
.planner {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 14px; margin-bottom: 26px; overflow: hidden;
}
.planner-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.planner-top h3 {
  font-family: var(--ff-display); font-weight: 700; font-size: 16px; margin: 0; letter-spacing: -.01em;
}
.year-nav { display: flex; align-items: center; gap: 4px; }
.year-nav button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--ink-2); font-size: 16px; display: grid; place-items: center; line-height: 1;
}
.year-nav button:hover { border-color: var(--ink-2); }
.year-nav .y {
  font-family: var(--ff-mono); font-weight: 700; font-size: 15px; padding: 0 6px; min-width: 54px; text-align: center;
}
.planner-legend { display: flex; gap: 15px; margin-left: auto; flex-wrap: wrap; }
.planner-legend span { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.planner-legend i { width: 11px; height: 11px; border-radius: 3px; }

.tl-scroll { overflow-x: auto; padding-bottom: 4px; }
.tl-grid { min-width: 720px; }
.tl-months {
  display: grid; grid-template-columns: var(--rowlabel, 132px) repeat(12, 1fr);
  border-bottom: 1px solid var(--line);
}
.tl-months .corner {}
.tl-months .m {
  font-family: var(--ff-mono); font-size: 11px; font-weight: 500; color: var(--muted);
  text-align: center; padding: 0 0 8px; text-transform: uppercase; letter-spacing: .04em;
  border-left: 1px solid var(--line);
}
.tl-row {
  display: grid; grid-template-columns: var(--rowlabel, 132px) 1fr;
  align-items: center; min-height: 40px;
}
.tl-row + .tl-row { border-top: 1px solid #f0f1f5; }
.tl-row .rlabel {
  font-size: 13px; font-weight: 500; color: var(--ink-2); padding-right: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-row .rlabel .dept { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.tl-track {
  position: relative; height: 26px; border-radius: 7px;
  background:
    linear-gradient(90deg, #f2f3f7 0 1px, transparent 1px) 0 0 / calc(100%/12) 100%,
    #f7f8fb;
  overflow: hidden;
}
.tl-bar {
  position: absolute; top: 3px; bottom: 3px; border-radius: 5px;
  display: flex; align-items: center; padding: 0 6px;
  font-size: 11px; font-weight: 600; color: #fff; overflow: hidden; white-space: nowrap;
  cursor: pointer; transition: filter .12s ease, transform .12s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.tl-bar:hover { filter: brightness(1.05); transform: translateY(-1px); z-index: 4; }
.tl-bar.ferie { background: var(--ferie); }
.tl-bar.fri { background: var(--fri); }
.tl-bar.sygdom { background: var(--sygdom); }
.tl-bar.is-pending { opacity: .95; background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 5px, transparent 5px 10px); }
.tl-bar.is-rejected { opacity: .34; text-decoration: line-through; }
.tl-today {
  position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--accent); z-index: 5;
}
.tl-today::after {
  content: ""; position: absolute; top: -4px; left: -3px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}
.tl-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 22px; }

/* =========================================================
   YEAR CALENDAR (front page)
   ========================================================= */
.ycal {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 16px 8px; margin-bottom: 26px; overflow: hidden;
}
.ycal-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ycal-top h3 { font-family: var(--ff-display); font-weight: 700; font-size: 16px; margin: 0; letter-spacing: -.01em; }
.ycal-scroll { overflow-x: auto; padding-bottom: 6px; }
.ycal-grid {
  display: grid; grid-template-columns: repeat(12, minmax(78px, 1fr));
  min-width: 936px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.ycal-col { border-right: 1px solid var(--line); min-width: 0; }
.ycal-col:last-child { border-right: none; }
.ycal-col.is-current { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 8px; }

.ycal-mhead {
  text-align: center; padding: 9px 6px 8px; border-bottom: 1px solid var(--line);
  background: #fafbfc;
}
.ycal-mhead .m-name {
  font-family: var(--ff-display); font-weight: 700; font-size: 14px; color: var(--ink); letter-spacing: -.01em;
}
.ycal-mhead .m-bal {
  font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.3;
}
.ycal-mhead .m-bal .b-num { font-family: var(--ff-mono); font-weight: 700; color: var(--ink-2); }
.ycal-mhead .m-bal.is-neg { color: var(--sygdom); }
.ycal-mhead .m-bal.is-neg .b-num { color: var(--sygdom); }
.ycal-col.is-current .m-name { color: var(--accent-ink); }

/* Restferie chip (placeholder — beregning defineres senere) */
.ycal-restferie {
  display: inline-flex; align-items: baseline; gap: 6px;
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 12px;
}
.ycal-restferie .rf-val { font-family: var(--ff-mono); font-weight: 700; font-size: 15px; color: var(--ink); }
.ycal-restferie .rf-lbl { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.ycal-restferie .rf-info { font-size: 11px; color: var(--muted); }

.ycal-days { display: flex; flex-direction: column; }
.ycal-day {
  position: relative; display: flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 7px; font-size: 11px; border-bottom: 1px solid #f4f5f8;
  cursor: pointer; transition: background .1s ease;
}
.ycal-day:last-child { border-bottom: none; }
.ycal-day:hover { background: #eef1fb; }
.ycal-day .d-num {
  font-family: var(--ff-mono); font-size: 11px; font-weight: 500; color: #59647a;
  min-width: 15px; text-align: right; flex: none;
}
.ycal-day.weekend { background: #f1f3f7; }
.ycal-day.weekend:hover { background: #e8ebf3; }
.ycal-day.weekend .d-num { color: #9aa3b4; }
.ycal-day.holiday { background: #fbe7e2; }
.ycal-day.holiday:hover { background: #f8dbd3; }
.ycal-day.holiday .d-num { color: var(--sygdom); font-weight: 700; }
.ycal-day .d-holiday {
  font-size: 9.5px; font-weight: 600; color: #b0402a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ycal-day.today { box-shadow: inset 2px 0 0 var(--accent); }
.ycal-day.today .d-num { color: var(--accent-ink); font-weight: 700; }

.ycal-day .d-week {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  font-family: var(--ff-mono); font-size: 9.5px; color: #c2c8d4; pointer-events: none;
}
.ycal-day .d-label {
  font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* absence-filled days */
.ycal-day.abs .d-num { color: rgba(255,255,255,.85); }
.ycal-day.abs .d-label { color: #fff; }
.ycal-day.abs .d-week { color: rgba(255,255,255,.55); }
.ycal-day.abs.ferie  { background: var(--ferie); }
.ycal-day.abs.fri    { background: var(--fri); }
.ycal-day.abs.sygdom { background: var(--sygdom); }
.ycal-day.abs:hover  { filter: brightness(1.04); }
.ycal-day.abs.pending {
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.30) 0 5px, transparent 5px 10px);
}
.ycal-day.abs.half.ferie  { background: var(--ferie-soft); }
.ycal-day.abs.half.fri    { background: var(--fri-soft); }
.ycal-day.abs.half.sygdom { background: var(--sygdom-soft); }
.ycal-day.abs.half .d-num { color: #59647a; }
.ycal-day.abs.half .d-label { color: var(--ink-2); }
.ycal-day.abs.half .d-label::after { content: ' ½'; }

/* =========================================================
   LISTS / CARDS
   ========================================================= */
.list { display: flex; flex-direction: column; gap: 10px; }
.rec {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 15px 17px; display: flex; align-items: center; gap: 15px;
}
.rec .tag {
  flex: none; width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center;
  font-family: var(--ff-display); font-weight: 700; font-size: 11px; letter-spacing: .02em; text-align: center;
}
.rec .tag.ferie { background: var(--ferie-soft); color: #9a6a12; }
.rec .tag.fri { background: var(--fri-soft); color: #1c7a63; }
.rec .tag.sygdom { background: var(--sygdom-soft); color: #b0402a; }
.rec .rec-main { flex: 1; min-width: 0; }
.rec .rec-title { font-weight: 600; font-size: 15px; }
.rec .rec-dates { font-family: var(--ff-mono); font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.rec .rec-note { font-size: 13px; color: var(--ink-2); margin-top: 5px; }
.rec .rec-note .rv { color: var(--muted); }
.rec .rec-who { font-weight: 600; font-size: 14px; }
.rec .rec-who .dep { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.rec .rec-side { display: flex; align-items: center; gap: 10px; flex: none; }
.rec .rec-days { font-family: var(--ff-mono); font-size: 12px; color: var(--muted); text-align: right; }
.rec .rec-days b { display: block; font-size: 17px; color: var(--ink); }

.pill {
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.pill.PENDING { background: #fbf1d6; color: var(--pending); }
.pill.APPROVED { background: var(--fri-soft); color: #1c7a63; }
.pill.REJECTED { background: var(--sygdom-soft); color: #b0402a; }

.actions-inline { display: flex; gap: 8px; }

.empty {
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 40px 24px; text-align: center; color: var(--muted);
}
.empty h4 { font-family: var(--ff-display); color: var(--ink); font-size: 18px; margin: 0 0 6px; }
.empty p { margin: 0 0 16px; font-size: 14px; }

/* =========================================================
   ADMIN
   ========================================================= */
.adm-search {
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px;
  background: #fff; color: var(--ink); min-width: 240px;
}
.adm-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(76,95,213,.14); }
.adm-hint { color: var(--muted); font-size: 13.5px; margin: -6px 0 16px; max-width: 70ch; }
.adm-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* admin sub-navigation */
.adm-subnav { display: inline-flex; gap: 4px; padding: 4px; background: #eceef3; border-radius: 999px; margin: 6px 0 20px; }
.adm-subnav .subtab {
  border: none; background: transparent; padding: 8px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--muted); transition: all .14s ease;
}
.adm-subnav .subtab:hover { color: var(--ink-2); }
.adm-subnav .subtab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.adm-group-tag {
  font-family: var(--ff-body); font-weight: 600; font-size: 11.5px; padding: 2px 9px;
  border-radius: 999px; background: #e6e9fb; color: var(--accent-ink);
}
.adm-group-tag.none { background: #f0f1f4; color: var(--muted); font-weight: 500; }
.avatar.group { background: var(--accent); border-radius: 12px; }
.add-group-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

/* Løn admin */
.lon-sub { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.lon-picker { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.lon-select {
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px;
  background: #fff; color: var(--ink); font-weight: 600; max-width: 320px;
}
.lon-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(76,95,213,.14); }

.count-badge {
  display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 9px;
  border-radius: 999px; background: #eef0f4; color: var(--ink-2);
  font-family: var(--ff-mono); font-size: 15px; font-weight: 700; vertical-align: middle;
}

/* selection + bulk bar */
.bulk-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  padding: 10px 14px; background: var(--ink); border-radius: 12px; box-shadow: var(--shadow);
  position: sticky; top: 66px; z-index: 15;
}
.bulk-bar .bulk-count { color: #fff; font-weight: 600; font-size: 14px; }
.bulk-bar .btn-ghost { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.bulk-bar .btn-ghost:hover { background: rgba(255,255,255,.2); }
.adm-selectall {
  display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted);
  padding: 2px 4px 8px; cursor: pointer;
}
.adm-selectall input, .adm-check { width: 18px; height: 18px; accent-color: var(--accent); flex: none; cursor: pointer; }
.adm-row.selected { box-shadow: var(--shadow), inset 0 0 0 2px var(--accent); }

/* role picker as horizontal row (add modal) */
.role-picker-row { flex-direction: row; }
.role-picker-row .role-opt { flex: 1; flex-direction: row; align-items: center; gap: 8px; justify-content: center; padding: 11px 8px; }
.role-opt .role-check {
  width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--line);
  display: inline-grid; place-items: center; font-size: 11px; color: #fff; flex: none;
}
.role-opt.on .role-check { background: var(--accent); border-color: var(--accent); }
.field-label {
  display: block; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin: 4px 0 7px;
}

/* Opret-ny-medarbejder picker */
.modal-lg { max-width: 540px; }
.pick-list { margin: 4px 0 16px; max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
.pick-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.pick-row.added { opacity: .55; }
.pick-row .avatar { width: 38px; height: 38px; font-size: 13px; flex: none; }
.pick-main { flex: 1; min-width: 0; }
.pick-name { font-weight: 600; font-size: 14px; }
.pick-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.adm-row { gap: 14px; }
.adm-row .avatar { width: 42px; height: 42px; font-size: 14px; flex: none; }
.adm-main { flex: 1; min-width: 0; }
.adm-name { font-weight: 600; font-size: 15px; }
.adm-name .dep { font-weight: 400; color: var(--muted); font-size: 13px; }
.adm-facts { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.adm-facts b { color: var(--ink); font-family: var(--ff-mono); }
.adm-facts .adm-period { font-family: var(--ff-mono); font-size: 12px; }

.role-pill {
  font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.role-pill.admin { background: var(--ink); color: #fff; }
.role-pill.godkender { background: var(--fri-soft); color: #1c7a63; }
.role-pill.medarbejder { background: #eef0f4; color: var(--ink-2); }
.admin-check { align-items: flex-start; }
.admin-check .ac-desc { color: var(--muted); font-weight: 400; }

/* role picker in modal */
.role-picker { display: flex; flex-direction: column; gap: 8px; }
.role-opt {
  border: 1.5px solid var(--line); border-radius: 11px; padding: 11px 14px; background: #fff;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  transition: border-color .14s ease, background .14s ease;
}
.role-opt:hover { border-color: var(--ink-2); }
.role-opt.on { border-color: var(--accent); background: #f3f5fe; }
.role-opt-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.role-opt-desc { font-size: 12px; color: var(--muted); }

.modal-sub { color: var(--muted); font-size: 13.5px; margin: -12px 0 16px; }

/* Eksisterende registrering på valgt dag (med slet-knap) */
.existing-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 13px; margin-bottom: 16px; }
.existing-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 9px; }
.existing-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.existing-row + .existing-row { border-top: 1px solid var(--line); }
.existing-row .tag-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.existing-row .tag-dot.ferie { background: var(--ferie); }
.existing-row .tag-dot.fri { background: var(--fri); }
.existing-row .tag-dot.sygdom { background: var(--sygdom); }
.existing-main { flex: 1; min-width: 0; }
.existing-title { font-weight: 600; font-size: 14px; }
.existing-dates { font-family: var(--ff-mono); font-size: 12px; color: var(--muted); }
.period-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.period-lbl { font-size: 13px; color: var(--muted); }
.mini-select {
  padding: 9px 8px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px;
  background: #fff; color: var(--ink); min-width: 56px;
}
.mini-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76,95,213,.14); }

/* =========================================================
   MODAL
   ========================================================= */
.modal-back {
  position: fixed; inset: 0; background: rgba(22,29,43,.42); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px; z-index: 60;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; padding: 24px; animation: pop .2s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal h3 { font-family: var(--ff-display); font-weight: 700; font-size: 22px; margin: 0 0 18px; letter-spacing: -.02em; }
.type-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 18px; }
.type-opt {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 8px; background: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 7px; transition: all .14s ease;
}
.type-opt i { width: 15px; height: 15px; border-radius: 5px; }
.type-opt span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.type-opt .type-saldo { font-family: var(--ff-mono); font-size: 10.5px; font-weight: 500; color: var(--muted); text-align: center; line-height: 1.2; }
.type-opt.ferie.on .type-saldo { color: #9a6a12; }
.type-opt.fri.on .type-saldo { color: #1c7a63; }
.type-opt.ferie.on { border-color: var(--ferie); background: var(--ferie-soft); }
.type-opt.fri.on { border-color: var(--fri); background: var(--fri-soft); }
.type-opt.sygdom.on { border-color: var(--sygdom); background: var(--sygdom-soft); }
.type-opt:hover { border-color: var(--ink-2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.single { grid-template-columns: 1fr; }
.field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; resize: vertical; min-height: 62px; color: var(--ink);
}
.field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(76,95,213,.14); }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-2); margin: 2px 0 4px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.modal-note {
  font-size: 13px; color: var(--muted); background: var(--surface); border-radius: var(--radius-sm);
  padding: 10px 13px; margin: 4px 0 18px;
}
.modal-days { font-family: var(--ff-mono); color: var(--ink); font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal-err { background: var(--sygdom-soft); color: #a23a26; border-radius: var(--radius-sm); padding: 10px 13px; font-size: 13.5px; margin-bottom: 14px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toast-in .25s cubic-bezier(.2,.9,.3,1.2); display: flex; align-items: center; gap: 9px;
}
.toast.ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--fri); }
.toast.err { background: #a23a26; }
@keyframes toast-in { from { transform: translateY(14px); opacity: 0; } }

/* ---------- Loading ---------- */
.center-load { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px;
  font-weight: 500; color: var(--ink-2);
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { min-height: 240px; padding: 32px; }
  .login-hero h1 { font-size: 34px; }
  .stats { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .shell { padding: 0 14px 70px; }
  .userchip .u-meta { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .rec { flex-wrap: wrap; }
  .rec .rec-side { width: 100%; justify-content: space-between; }
  .section-head h2 { font-size: 20px; }
}

/* =========================================================
   TEAM WEEK SCHEDULER
   ========================================================= */
.tw { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tw-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tw-search-wrap { display: flex; align-items: center; gap: 6px; }
.tw-search { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; min-width: 200px; background: #fff; color: var(--ink); }
.tw-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76,95,213,.14); }
.tw-clear { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-size: 13px; color: var(--ink-2); }
.tw-groupby { display: flex; align-items: center; gap: 8px; }
.tw-groupby-lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.tw-nav { display: flex; align-items: center; gap: 6px; margin: 0 auto; }
.tw-navbtn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 16px; line-height: 1; display: grid; place-items: center; }
.tw-navbtn:hover { border-color: var(--ink-2); }
.tw-period { font-family: var(--ff-mono); font-weight: 700; font-size: 14px; min-width: 160px; text-align: center; }
.tw-today { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tw-today:hover { border-color: var(--ink-2); }
.tw-modes { display: inline-flex; gap: 3px; padding: 3px; background: #eceef3; border-radius: 999px; }
.tw-mode { border: none; background: transparent; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tw-mode.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.tw-scroll { overflow: auto; max-height: 74vh; position: relative; }
.tw-inner { position: relative; }

.tw-header { display: grid; position: sticky; top: 0; z-index: 20; background: #fafbfc; border-bottom: 1px solid var(--line); }
.tw-corner { position: sticky; left: 0; z-index: 30; background: #fafbfc; border-right: 1px solid var(--line); display: flex; align-items: flex-end; padding: 8px 14px; }
.tw-corner-lbl { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tw-head-track { display: flex; }
.tw-head-track.tw-head-stack { flex-direction: column; }
.tw-dayhead { flex: none; border-right: 1px solid #d3d8e2; box-sizing: border-box; }
.tw-dayhead.weekend { background: #eef0f4; }
.dh-top { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink); padding: 7px 2px 4px; white-space: nowrap; overflow: hidden; }
.dh-ticks { display: flex; }
.dh-ticks span { flex: 1; text-align: center; font-family: var(--ff-mono); font-size: 10px; color: var(--muted); padding-bottom: 4px; }
.dh-ticks span.mid { border-left: 1px solid var(--line); }
.dh-wd { text-align: center; font-size: 10px; color: var(--muted); padding-top: 6px; }
.dh-num { text-align: center; font-family: var(--ff-mono); font-size: 12px; font-weight: 600; padding-bottom: 6px; }
/* 3-måneders header: måneder øverst, uger nedenunder */
.tw-months { display: flex; border-bottom: 1px solid #c2c8d4; }
.tw-month { flex: none; box-sizing: border-box; text-align: center; font-family: var(--ff-display); font-weight: 700; font-size: 13px; color: var(--ink); padding: 8px 4px; border-right: 2px solid #b7bfcc; white-space: nowrap; overflow: hidden; }
.tw-month:last-child { border-right: none; }
.tw-weeks { display: flex; background: #fbfbfd; }
.tw-week { flex: none; box-sizing: border-box; text-align: center; font-family: var(--ff-mono); font-weight: 500; font-size: 10.5px; color: var(--ink-2); padding: 6px 2px; min-height: 26px; border-right: 1px solid #c8cdd8; white-space: nowrap; overflow: hidden; }

/* tydeligere dag-adskillelse i dag/uge */
.tw-hard .tw-dayhead { border-right: 1px solid #aeb6c4; }
.tw-hard .tw-bgcell { border-right: 1px solid #aeb6c4; }
/* 3-måneders visning: lade uge-streger dominere frem for dag-streger */
.tw-weekly .tw-bgcell { border-right-color: #eef0f4; }
.tw-weekly .tw-bgcell.weekstart { border-left: 1px solid #b7bfcc; }

.tw-body { position: relative; }
.tw-bg { position: absolute; top: 0; bottom: 0; z-index: 0; pointer-events: none; }
.tw-bgcell { position: absolute; top: 0; bottom: 0; border-right: 1px solid #d3d8e2; box-sizing: border-box; }
.tw-bgcell.weekend { background: #f4f5f9; }
.tw-bgcell.monthstart { border-left: 2px solid #c3c9d6; }
.tw-bgcell.half::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #eaecf1; }
.tw-bgcell.holiday { background: #fbe7e2; }
.tw-bgcell.today { background: #e3e7f2; }
.tw-dayhead.holiday { background: #fbe1db; }
.tw-dayhead.holiday .dh-top { color: #b0402a; }
.tw-dayhead.holiday .dh-num, .tw-dayhead.holiday .dh-wd { color: #b0402a; font-weight: 700; }
.dh-holiday { text-align: center; font-size: 9.5px; font-weight: 700; color: #b0402a; padding-bottom: 4px; white-space: nowrap; overflow: hidden; }
.tw-dayhead.today { background: #dfe4f2; }
.tw-dayhead.today .dh-top { color: var(--accent-ink); }
.tw-dayhead.today .dh-num, .tw-dayhead.today .dh-wd { color: var(--accent-ink); font-weight: 700; }

.tw-grouprow { display: grid; position: relative; z-index: 1; background: #f3f4f7; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }
.tw-glabel { position: sticky; left: 0; z-index: 12; background: #f3f4f7; display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; border-right: 1px solid var(--line); }
.tw-caret { color: var(--muted); font-size: 11px; width: 12px; }
.tw-gname { font-weight: 700; font-size: 13.5px; }
.tw-gcount { font-family: var(--ff-mono); font-size: 11px; color: #fff; background: var(--ink-2); border-radius: 999px; padding: 1px 7px; }

.tw-row { display: grid; position: relative; z-index: 1; border-bottom: 1px solid #f0f1f5; min-height: 40px; }
.tw-row.me .tw-label { background: #fbf6df; }
.tw-row.me .tw-nm { font-weight: 700; }
.tw-label { position: sticky; left: 0; z-index: 10; background: #fff; display: flex; align-items: center; gap: 9px; padding: 0 14px; border-right: 1px solid var(--line); }
.tw-dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; }
.tw-nm { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-track { position: relative; }
.tw-bar { position: absolute; top: 7px; bottom: 7px; border-radius: 5px; display: flex; align-items: center; padding: 0 7px; font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.tw-bar.ferie { background: var(--ferie); }
.tw-bar.fri { background: var(--fri); }
.tw-bar.sygdom { background: var(--sygdom); }
.tw-bar.is-pending { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.3) 0 5px, transparent 5px 10px); }
