:root {
  --ink: #1f2d48; --muted: #6b7588; --line: #dfe4ec; --bg: #f5f7fb; --card: #fff;
  --primary: #2f6fde; --danger: #c0392b; --ok: #2e8b57; --warn: #c27c0e;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--primary); }
.topbar { background: #e30613; padding: 10px 20px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; }
main { max-width: 1400px; margin: 0 auto; padding: 16px 20px 40px; }
h1 { font-size: 24px; margin: 8px 0 16px; }
.muted { color: var(--muted); }

.btn { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--card);
  color: var(--ink); text-decoration: none; font: inherit; cursor: pointer; }
.btn:hover { border-color: #b8c2d3; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.icon { display: inline-flex; align-items: center; justify-content: center; padding: 6px 8px; }
.btn.small { padding: 3px 8px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: wait; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; background: #e6f4ea; border: 1px solid #b7dfc3; }
.flash-error { background: #fdecea; border-color: #f3b8b1; }
.flash ul { margin: 0; padding-left: 18px; }

.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .btn, .filter select { height: 34px; line-height: 20px; }
.yearnav { display: flex; gap: 10px; align-items: center; }
.yearnav strong { font-size: 22px; min-width: 3ch; text-align: center; }
.filter { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.filter label { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.field-label { color: var(--muted); font-size: 14px; }
.filter select { min-width: 160px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); font: inherit; }
.filter select:hover { border-color: #b8c2d3; }
.spacer { flex: 1; }
.export { display: flex; gap: 8px; align-items: center; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; }
.btn-group .btn:hover { position: relative; }
.export span { color: var(--muted); font-size: 14px; }

.layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; } }
/* Begivenhedslisten skjult: hjulet fylder hele bredden, begrænset af vinduets højde */
.list-hidden main { max-width: none; }
.list-hidden .layout { grid-template-columns: 1fr; }
.list-hidden #event-list { display: none; }
.list-hidden .wheel { position: static; }
.list-hidden .wheel svg { width: min(100%, max(480px, calc(100vh - 190px))); margin: 0 auto; }
.wheel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; position: sticky; top: 12px; }
.wheel svg { width: 100%; height: auto; display: block; }
.wheel a path:first-of-type { cursor: pointer; }
.wheel a:hover > g { filter: brightness(1.1); }
.legend { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin: 8px 0 0; flex-wrap: wrap; }
.lg { display: inline-block; width: 18px; height: 10px; border-radius: 2px; margin-left: 8px; }
.lg.done { background: var(--primary); opacity: .45; }
.lg.blocked { background: repeating-linear-gradient(45deg, var(--primary) 0 3px, #cfdcf6 3px 6px); }
.lg.today { background: #d64545; width: 3px; }
.lg.overdue { background: var(--primary); box-shadow: inset 0 0 0 2px #d64545; }
.lg.note { width: 10px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink); }

.list { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 16px 16px; }
.month { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line);
  padding-bottom: 4px; margin: 18px 0 6px; }
.occ { display: flex; gap: 10px; padding: 8px 0 8px 10px; border-left: 4px solid var(--c); margin: 6px 0; }
.occ.is-done .occ-title { text-decoration: line-through; color: var(--muted); }
.occ.is-blocked:not(.is-done) { background: repeating-linear-gradient(45deg, transparent 0 8px, #f6f7fa 8px 16px); }
.occ.is-overdue { background: #fdf1f0; }
.check input { width: 18px; height: 18px; margin-top: 2px; cursor: pointer; }
.check input:disabled { cursor: not-allowed; }
.occ-title { font-weight: 600; text-decoration: none; color: var(--ink); }
.occ-title:hover { text-decoration: underline; }
.occ-desc { margin-top: 4px; font-size: 14px; white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.occ-desc.is-open { display: block; }
.occ-more { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-size: 13px; cursor: pointer; }
.occ-more:hover { text-decoration: underline; }
.occ-cat { margin-left: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.occ-cat::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 5px; vertical-align: 1px; }
.occ-meta { font-size: 13px; color: var(--muted); }
.occ-overdue, .modal-status.overdue { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 600;
  color: #fff; background: #d64545; white-space: nowrap; }
.occ-overdue { margin-left: 6px; vertical-align: 1px; }
.modal-status[hidden] { display: none; }
.occ-note { margin-top: 4px; padding: 3px 8px; font-size: 14px; white-space: pre-line; overflow-wrap: anywhere;
  background: #fff8e1; border-left: 3px solid #e0b400; border-radius: 0 4px 4px 0; }
.occ-note::before { content: "Note: "; font-weight: 600; }
.occ-attach { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; font-size: 13px; }
.occ-attach a { text-decoration: none; overflow-wrap: anywhere; }
.occ-attach a:hover { text-decoration: underline; }
.chips { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; background: #eef2f9; border-radius: 10px; padding: 1px 8px; }
.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 10px;
  color: var(--ink); background: var(--card); box-shadow: 0 12px 40px rgba(20, 30, 50, .25); }
.modal::backdrop { background: rgba(20, 30, 50, .45); }
.modal-body { padding: 18px 20px 20px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.modal-close { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 2px; }
.modal-close:hover { color: var(--ink); }
.modal-check { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; }
.modal-check label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.modal-check input { margin-top: 0; }
.modal-status { font-size: 14px; }
.modal-status.wait { color: var(--warn); }
.modal-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; }
.modal-facts dt { color: var(--muted); font-size: 14px; }
.modal-facts dd { margin: 0; }
.modal-facts [hidden] { display: none; }
.modal-facts .chips, .modal-facts .prereq:first-child { margin-top: 0; }
.modal-facts .prereq { overflow-wrap: anywhere; }
.modal-cat::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c);
  margin-right: 7px; vertical-align: -1px; }
.modal-desc { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); white-space: pre-line; overflow-wrap: anywhere; }
.modal-desc[hidden] { display: none; }
.modal .actions { margin-top: 18px; }
.modal { overflow: auto; }
.modal-occ { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.modal-occ h3 { margin: 0 0 4px; font-size: 15px; }
.modal-occ .field-label { margin-top: 10px; }
.modal-occ ul.plain { margin: 2px 0; }
.modal-occ > .btn.primary { margin-top: 4px; }
.prereq { font-size: 13px; margin-top: 3px; }
.prereq.ok { color: var(--ok); }
.prereq.wait { color: var(--warn); }

.event-form { max-width: 860px; }
fieldset { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
label { display: block; margin: 8px 0; font-size: 14px; }
label.inline { display: inline; margin-left: 10px; }
input:not([type=checkbox]):not([type=color]), select, textarea { display: block; width: 100%; margin-top: 3px; padding: 7px 8px;
  border: 1px solid #c9d1de; border-radius: 6px; font: inherit; background: #fff; }
input[type=color] { display: block; margin-top: 3px; width: 56px; height: 36px; padding: 2px; border: 1px solid #c9d1de; border-radius: 6px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > label { flex: 0 0 auto; }
.row > label.grow { flex: 1 1 220px; }
.row .hint { color: var(--muted); font-size: 13px; padding-bottom: 16px; flex: 1 1 200px; }
[hidden] { display: none !important; }
.link-row .btn { margin-bottom: 9px; }
.deps { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 12px; }
.dep { margin: 3px 0; }
.category select { width: 220px; }
.category-pick { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.category-pick select { margin-top: 0; }
.swatch { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; border: 1px solid #c9d1de; background: #fff; }
.category-row .usage { font-size: 13px; padding-bottom: 16px; min-width: 100px; }
.category-row .delete { padding-bottom: 14px; }
.field { margin: 8px 0; }
.field-label { margin: 0; }
.tokens { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 3px; padding: 5px 8px;
  border: 1px solid #c9d1de; border-radius: 6px; background: #fff; cursor: text; }
.tokens:focus-within { border-color: var(--primary); outline: 2px solid rgba(47, 111, 222, .2); }
.token { display: inline-flex; align-items: center; white-space: nowrap; }
.token::after { content: ","; }
.token-x { border: 0; background: none; padding: 0 2px; margin-left: 2px; font: inherit; font-size: 14px; line-height: 1;
  color: var(--muted); cursor: pointer; border-radius: 3px; }
.token-x:hover { color: var(--danger); background: #fdecea; }
.tokens input.token-input { display: inline-block; flex: 1 1 120px; width: auto; min-width: 120px; margin: 0; padding: 2px 0;
  border: 0; outline: 0; }
.token-suggest { position: absolute; z-index: 10; left: -1px; right: -1px; top: 100%; margin: 2px 0 0; padding: 4px 0;
  list-style: none; background: #fff; border: 1px solid #c9d1de; border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
  max-height: 240px; overflow-y: auto; }
.token-suggest li { padding: 5px 10px; cursor: pointer; }
.token-suggest li.active, .token-suggest li[data-id]:hover { background: #eef2f9; }
.token-suggest li.none { color: var(--muted); cursor: default; font-size: 14px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 6px 0 4px; }
ul.plain { list-style: none; padding: 0; margin: 8px 0; }
ul.plain li { padding: 3px 0; }
.actions { display: flex; gap: 8px; }
.delete-form { margin-top: 24px; max-width: 860px; text-align: right; }

@media print {
  .topbar, .toolbar, .check, .legend { display: none; }
  .layout { display: block; }
  .wheel { position: static; border: 0; page-break-after: always; }
  .list { border: 0; }
}
