:root {
  --page: #f4f5ef;
  --paper: #fffefa;
  --ink: #192e28;
  --muted: #4f635a;
  --line: #dce3d7;
  --accent: #175844;
  --accent-bright: #8cdbad;
  --soft: #dcefe2;
  --off: #faedce;
  --travel: #daf0f2;
  --error: #9a362a;
  --check: #943f14;
  --check-background: #fff1df;
  font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(24px, 4vw, 34px); font-weight: 700; letter-spacing: -.035em; }
h2 { font-size: 18px; letter-spacing: -.025em; }
h3 { font-size: 14px; }
button, select, input {
  font: inherit; color: inherit; border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 10px; background: var(--paper); min-width: 0;
}
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
button:hover:not(:disabled) { border-color: var(--accent); }
:focus-visible { outline: 2px solid #256e57; outline-offset: 2px; }
.top { background: #17362e; color: #fcfdf8; }
.top-inner, main, .site-footer-inner { max-width: 1370px; margin: auto; padding-inline: clamp(12px, 3%, 38px); }
.top-inner {
  display: flex; justify-content: space-between; align-items: end;
  flex-wrap: wrap; gap: 12px; padding-block: 19px 21px;
}
.context { margin-bottom: 3px; color: #c4e4d2; }
.subtitle { max-width: 65ch; margin-top: 5px; color: #e0efe6; }
.year-control { display: grid; gap: 4px; }
.year-control > div { display: flex; gap: 6px; }
.year-control :is(input, button) { color: var(--ink); }
#planning-year { width: 88px; font-size: 16px; font-variant-numeric: tabular-nums; }
#calendar-status {
  margin-bottom: 11px; padding: 8px 10px; border-inline-start: 3px solid var(--check);
  border-radius: 7px; background: var(--check-background);
}
.actions, .heading, #quarters, #trip-fields, .legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
main { padding-top: 22px; }
#feedback:not(:empty) { margin-bottom: 11px; font-size: 12px; }
.workspace { display: grid; grid-template-columns: minmax(310px, .92fr) minmax(0, 2.25fr); gap: 14px; align-items: start; }
.panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.heading { justify-content: space-between; margin-bottom: 8px; gap: 6px 10px; }
.person #employee { width: 100%; }
.identity { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 10px 0; }
.identity label, #trip-fields label { display: grid; gap: 3px; color: var(--muted); font-size: 12px; min-width: 0; }
#choose-kind { margin-bottom: 6px; font-size: 13px; font-weight: 600; }
#entitlement-hint {
  padding: 6px 8px; border-inline-start: 3px solid #77a58d; border-radius: 4px;
  background: #edf5ee; font-size: 12px;
}
#balance-hint { margin-top: 6px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 6px 4px; }
thead { color: var(--muted); }
.balances { table-layout: fixed; }
.balances th { font-size: 11px; overflow-wrap: anywhere; hyphens: auto; }
.balances thead th:nth-child(2) { width: 18%; }
.balances thead th:nth-child(3) { width: 24%; }
.balances thead th:nth-child(4) { width: 15%; }
.balances td { text-align: center; }
.balances td:last-child { font-weight: 700; }
.balances td[data-negative="true"] { color: var(--error); }
.balances input { width: 52px; max-width: 100%; padding: 4px; text-align: center; }
.category {
  display: flex; align-items: center; gap: 5px; width: 100%; min-height: 34px;
  text-align: left; padding: 4px 5px; border-color: #8ba698; color: var(--accent);
  font-size: 12px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; hyphens: auto;
}
.category::before {
  content: ""; flex: 0 0 12px; height: 12px; border: 1px solid currentColor; border-radius: 50%;
}
[aria-pressed="true"] { background: var(--soft); border-color: #77a58d; color: #144d3a; }
.category[aria-pressed="true"] { border-color: var(--accent); font-weight: 700; }
.category[aria-pressed="true"]::before { background: currentColor; box-shadow: inset 0 0 0 2px var(--soft); }
.leave-help { margin-top: 4px; font-size: 12px; }
.leave-help summary { cursor: pointer; color: var(--accent); padding-block: 6px; width: fit-content; }
.leave-help p { padding: 6px 8px; background: var(--page); border-radius: 4px; }
.period-heading { margin-top: 12px; }
.quiet { font-size: 11px; color: var(--muted); }
#periods, .warnings { padding: 0; margin: 0; list-style: none; }
#periods { display: grid; gap: 4px; }
#periods button { width: 100%; text-align: left; font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; }
.calendar-kind {
  margin-bottom: 5px; padding: 6px 8px; border-inline-start: 3px solid var(--accent);
  border-radius: 4px; background: var(--soft); color: var(--accent);
}
#months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 9px 0; }
.month { border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.month h3 { text-align: center; margin: 1px 0 4px; }
.day-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.weekday { color: var(--muted); font-size: 12px; }
.day { padding: 3px 0; border-radius: 4px; border: 1px solid transparent; line-height: 1.35; user-select: none; }
.day[data-off] { background: var(--off); color: #70521b; }
.day[data-booked] { background: var(--soft); color: var(--ink); }
.day[data-travel], .swatch.travel { background: var(--travel); border-color: #54868a; border-style: dashed; }
.day[data-range] { border-color: #73a58b; background: #a8deba; color: #16382a; }
.day[data-free], .swatch.free { background: repeating-linear-gradient(135deg, #dcefe2 0 4px, #a8cfb5 4px 5px); color: #193c2e; }
.day[data-boundary] { border-color: #175844; font-weight: 700; }
.legend { gap: 5px 12px; color: var(--muted); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 4px; }
.swatch { display: inline-block; flex-shrink: 0; width: 13px; height: 12px; border: 1px solid transparent; border-radius: 3px; }
.swatch.leave { background: var(--soft); }
.swatch.off { background: var(--off); }
.selection { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 8px; }
#range:not(:empty), #absence:not(:empty) { margin-top: 3px; }
#range-counts {
  display: grid; grid-template-columns: minmax(0, auto) max-content;
  justify-content: start; gap: 2px 12px; margin: 5px 0;
}
#range-counts dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
#days-off-rule { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 8px; }
#days-off-rule p { margin-top: 3px; }
.trip-toggle { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; }
#trip-fields { margin-top: 5px; }
#trip-fields input { width: 85px; }
.warnings { color: var(--error); padding-block: 4px; font-size: 12px; }
.actions { margin-top: 5px; }
.primary { color: white; background: var(--accent); border-color: var(--accent); }
.checks, .overview, .hr, .schedule-files { margin-top: 13px; }
.checks h2 { margin-bottom: 4px; }
.check-toggle { display: flex; align-items: center; gap: 6px; width: fit-content; min-height: 36px; cursor: pointer; }
.check-settings, .check-preview { padding: 8px 10px; border-radius: 7px; }
.check-settings { background: var(--page); }
.pair-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; gap: 6px; align-items: end; max-width: 680px; }
.pair-editor label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.pair-editor select { width: 100%; text-overflow: ellipsis; }
.check-settings :is(select, button, input[type="number"]) { min-height: 36px; }
.limit-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#absence-limit { width: 68px; }
#absence-limit[aria-invalid="true"] { border-color: var(--error); }
.check-list { margin: 0; padding-inline-start: 20px; overflow-wrap: anywhere; }
.check-list:not(:empty) { margin-top: 4px; }
.check-list li + li { margin-top: 4px; }
#check-pairs { padding: 0; list-style: none; }
#check-pairs li { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 680px; }
#check-pairs button { flex-shrink: 0; }
#check-results { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
#check-results h3 { margin-bottom: 3px; }
#more-checks { margin-top: 4px; }
#more-checks summary { cursor: pointer; color: var(--accent); width: fit-content; }
.check-preview { background: var(--check-background); border-inline-start: 3px solid var(--check); font-size: 12px; }
#check-preview-summary { color: var(--check); font-weight: 700; }
.check-preview a { display: inline-block; color: var(--accent); margin-top: 4px; }
.schedule-files { display: grid; gap: 14px; margin-bottom: 24px; }
.schedule-files h3 { margin-bottom: 4px; }
.file-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.file-actions > div { display: flex; flex-direction: column; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 10px; }
.file-actions button { margin-top: 8px; }
.schedule-files button, .import-dialog button { min-height: 44px; }
.draft-reset { border-top: 1px solid var(--line); padding-top: 14px; }
#reset { color: var(--error); }
#reset:hover:not(:disabled) { border-color: currentColor; }
#storage:not(:empty), #file-feedback:not(:empty) { margin-top: 6px; }
#storage, #file-feedback[data-error] { color: var(--error); }
.import-dialog, .date-warning-dialog { width: min(420px, calc(100% - 24px)); padding: 20px; color: var(--ink); }
:is(.import-dialog, .date-warning-dialog)::backdrop { background: rgb(25 46 40 / 48%); }
.import-dialog p { margin: 8px 0 12px; }
.import-dialog .actions { justify-content: flex-end; }
.date-warning-dialog { width: min(540px, calc(100% - 24px)); max-height: calc(100% - 24px); }
#date-warning-list { max-height: 55vh; overflow-y: auto; }
#close-date-warning { min-height: 44px; }
#overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quarter { border: 1px solid var(--line); border-radius: 8px; padding: 7px; min-width: 0; }
.quarter h3 { margin-bottom: 3px; }
.timeline-row { display: grid; grid-template-columns: minmax(72px, 22%) 1fr; gap: 5px; align-items: center; min-height: 23px; }
.timeline-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.track { position: relative; height: 16px; background: #f0f2ed; border-radius: 3px; }
.tick { position: absolute; inset-block: 0; border-left: 1px solid #cbd6cc; padding-left: 3px; font-size: 10px; color: var(--muted); }
.bar { position: absolute; z-index: 1; inset-block: 2px; border-radius: 3px; min-width: 1px; }
.bar, .swatch.overview-main { background: #418872; }
.bar.extra, .swatch.overview-extra { background: #8b73a4; }
.bar.road, .swatch.overview-road { background: #b7dbdf; border: 1px dashed #54868a; }
.swatch.overview-warning { background: var(--check); height: 5px; }
.date-warnings { width: 100%; padding: 0; text-align: left; border: 0; min-height: 30px; font-size: 11px; color: var(--check); }
.check-track { display: block; height: 20px; background: var(--check-background); overflow: hidden; }
.warning-marker { position: absolute; inset-block: 5px; background: var(--check); min-width: 1px; }
.overview .legend, #hr-person { margin-bottom: 6px; }
.hr td, #hr-person { overflow-wrap: anywhere; }
.hr-cell-label { display: none; }
#hr-legend { margin-top: 6px; }
#copy-status:empty { display: none; }
#copy-status { margin-top: 5px; font-size: 12px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.site-footer-inner { display: grid; gap: 2px; padding-block: 12px 16px; }
.site-footer-title { font-weight: 700; }
.site-footer-note { margin-top: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .identity label { max-width: 360px; }
}
@media (max-width: 580px) {
  #months, #overview, .file-actions { grid-template-columns: 1fr; }
  .panel { padding: 10px; }
  .top-inner { padding-block: 14px; }
  .day { padding: 6px 0; }
  .pair-editor { grid-template-columns: minmax(0, 1fr); }
  #add-pair { justify-self: start; }
  .hr :is(table, tbody, tr, td) { display: block; }
  .hr thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .hr tbody tr { padding-block: 5px; border-bottom: 1px solid var(--line); }
  .hr td { padding: 3px 0; border: 0; }
  .hr-cell-label { display: block; color: var(--muted); font-size: 12px; }
}
@media (pointer: coarse) {
  .year-control :is(input, button) { min-height: 44px; }
  .category, .leave-help summary { min-height: 44px; }
  .leave-help summary { align-content: center; }
  .check-toggle, .check-settings :is(select, button, input[type="number"]), .date-warnings { min-height: 44px; }
}
