:root {
  color-scheme: light;
  --ink: #1d2931;
  --muted: #64737d;
  --line: #d7e0e5;
  --surface: #ffffff;
  --wash: #f3f6f7;
  --blue: #153a52;
  --cyan: #31a8c4;
  --nav-blue: #1c6bb0;
  --nav-line-width: 2px;
  --danger: #a32626;
  font-family: "Segoe UI", Arial, sans-serif;
}

.overview-totals { display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 14px 18px; margin-bottom: 14px; font-size: .9rem; }
.overview-totals strong { margin-left: 5px; white-space: nowrap; }
.compact-overview { max-width: 100%; border: 1px solid var(--line); border-radius: 9px; background: white; }
.overview-table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.overview-table th, .overview-table td { padding: 6px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: right; height: 42px; }
.overview-table th:first-child, .overview-table td:nth-child(2) { text-align: left; }
.overview-table thead { background: #e7edf1; }
.statistics-switch { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.statistics-switch label { font-weight: 600; }
.statistics-switch input[type="range"] { width: 72px; min-height: 44px; accent-color: var(--blue); cursor: pointer; }
.statistics-section { margin: 16px 0 28px; }
.statistics-group { scroll-margin-top: 160px; }
.statistics-group > summary { font-size: 1.25rem; font-weight: 700; color: var(--blue); cursor: pointer; }
.statistics-subsection { margin-top: 18px; }
.statistics-subsection > summary { font-weight: 600; cursor: pointer; margin-bottom: 14px; }
.statistics-year-picker { margin-bottom: 16px; }
#overnight-review-table th:first-child, #overnight-review-table td:first-child { text-align: center; }
#overnight-review-table th[scope="row"] { text-align: left; }
.statistics-table { font-size: .82rem; }
.statistics-table th, .statistics-table td { padding: 10px; }
.statistics-table td:nth-child(2) { text-align: right; }
.statistics-table thead th { white-space: normal; min-width: 96px; }
.stat-value { display: block; margin-bottom: 5px; }
.stat-track { display: block; height: 5px; border-radius: 3px; background: #e7edf1; overflow: hidden; }
.stat-track > span { display: block; height: 100%; background: var(--stat-color); }
.stat-category-1 { --stat-color: #2867a1; }
.stat-category-2 { --stat-color: #7b8794; }
.stat-category-3 { --stat-color: #168675; }
.stat-category-4 { --stat-color: #458139; }
.stat-category-5 { --stat-color: #8a59a6; }
.stat-category-6 { --stat-color: #b4741d; }
.stat-category-7 { --stat-color: #4f5aa3; }
.stat-category-8 { --stat-color: #a64b68; }
.stat-category-9 { --stat-color: #9c623f; }
.stat-category-10 { --stat-color: #2b8694; }
#activity-statistics[data-unit="hours"] .stat-percent, #activity-statistics[data-unit="percent"] .stat-hours { display: none; }
.activities-table select[name$="-task"] { min-width: 145px; min-height: 36px; padding: 5px 7px; font-size: .88rem; }
.row-symbol { border: 0; background: transparent; box-shadow: none; color: var(--blue); font: inherit; font-size: 1.4rem; padding: 3px 6px; min-width: 28px; cursor: pointer; }
.row-symbol:hover, .row-symbol:focus-visible { color: var(--cyan); }
.row-symbol:disabled { opacity: .35; cursor: default; }
.activities-table input.km-suppressed { display: none; }
.activities-table .delete-input { display: none; }
.fuel-odometer:not([hidden]) { display: inline-block; min-width: 100px; font-size: .82rem; font-weight: 600; color: var(--blue); }
.activities-table input[name$="-time_from"], .activities-table input[name$="-time_to"] { width: 82px; min-width: 70px; }
.location-marker-label { display: none; }
.location-marker .location-marker-label { display: inline-block; margin-left: 5px; padding: 2px 4px; border-radius: 3px; background: #e7edf1; font-size: .7rem; color: var(--muted); }
.activities-table .location-marker { background: #f6f8fa; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.tracker-clock { display: block; margin: 18px 0; font-size: clamp(2.5rem, 8vw, 4.5rem); font-variant-numeric: tabular-nums; color: var(--blue); font-weight: 700; }
.dashboard-tracker-clock { display: block; margin: 12px 0; color: var(--nav-blue); font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tracker-pending + .tracker-pending { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.tracker-pending form { margin-top: 12px; }
#tracker-next { width: min(650px, calc(100% - 24px)); max-height: 90vh; overflow-y: auto; padding: 24px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
#tracker-next::backdrop { background: #153a5280; }
.dashboard-tile { position: relative; display: block; padding: 28px; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.dashboard-tile:hover, .dashboard-tile:focus-visible { border-color: var(--cyan); box-shadow: 0 5px 18px #153a5218; }
.dashboard-tile h2 { margin: 18px 0 8px; color: var(--nav-blue); }
.tracker-start-editor { margin: 18px 0; }
.tracker-receipts { margin: 16px 0; }
.tracker-start-editor form { margin-top: 14px; }
.vacation-balance { display: block; font-size: clamp(2.5rem, 6vw, 4rem); line-height: 1.2; color: var(--blue); font-variant-numeric: tabular-nums; margin: 12px 0; }
.vacation-balance.negative { color: var(--danger); }
.vacation-current { display: flex; align-items: center; gap: 22px; }
.vacation-table th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; min-width: 185px; white-space: normal; }
.vacation-table thead th:first-child { background: #e7edf1; }
.vacation-table td, .vacation-table thead th:not(:first-child) { text-align: right; min-width: 90px; }
.vacation-table td:nth-child(2) { text-align: right; }
.vacation-table .vacation-current-year { background: #eaf4fc; }
.vacation-table .vacation-total { font-weight: 700; }
.overview-table.vacation-periods { table-layout: fixed; }
.overview-table.vacation-periods th, .overview-table.vacation-periods td { text-align: left; }
.overview-table.vacation-periods th:last-child, .overview-table.vacation-periods td:last-child { text-align: right; }
.overview-table.vacation-periods tfoot th { text-align: left; white-space: normal; }
.dashboard-tile p { color: var(--muted); margin: 0 0 22px; line-height: 1.5; }
.tile-icon { display: inline-block; width: 36px; height: 36px; flex: none; color: var(--nav-blue); vertical-align: middle; }
.tile-arrow { display: block; text-align: right; color: var(--nav-blue); font-size: 1.4rem; }
@media (max-width: 760px) { .dashboard-grid { grid-template-columns: 1fr; gap: 14px; } }
.overall-table .months-column { width: 1%; }
.overall-table .comparison-values { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: right; }
.overall-table thead th { vertical-align: bottom; }
.overview-table tfoot { background: #e7edf1; font-weight: 700; }
.overview-table tfoot td, .overview-table tfoot th { border-top: 2px solid var(--blue); }
.contract-note { font-size: .82rem; line-height: 1.5; }
.overview-table .day-status-form { display: block; margin: 0; }
.overview-table .day-status-form select { width: 100%; max-width: 240px; min-height: 28px; padding: 3px 7px; font-size: .85rem; background: transparent; }
.day-weekend { background: #edf0f3; }
.day-holiday { background: #e6edf9; }
.day-free { background: #eef0e7; }
.day-vacation { background: #def1e2; }
.day-sick { background: #f9e5e5; }
.day-legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: .8rem; }
.day-legend span { padding: 3px 9px; border-radius: 4px; }
.day-toggle { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 5px; background: transparent; color: var(--blue); width: 32px; height: 30px; cursor: pointer; }
.day-toggle:hover, .day-toggle:focus-visible { background: #d6e4ee; }
.day-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.day-editor-row[hidden] { display: none; }
.overview-table .day-editor-row > td { padding: 0; white-space: normal; text-align: left; }
.day-editor-row iframe { width: 100%; height: 700px; display: block; border: 0; background: var(--wash); }
.embedded .page { width: 100%; max-width: none; margin: 0; padding: 12px; }
.embedded .page-heading { margin-bottom: 12px; }
.embedded h1 { font-size: 1.3rem; }
.embedded .sticky-actions { position: static; }
.embedded .summary-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.embedded .summary-grid .panel { padding: 10px; }
#month-feedback:not(:empty) { padding: 10px 0; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
}

a { color: var(--blue); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 6px max(20px, calc((100vw - 1120px) / 2)) 0;
  background: var(--surface);
  color: var(--ink);
  border-bottom: var(--nav-line-width) solid var(--nav-blue);
}

.site-nav {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}

.site-nav form { margin: 0 0 5px auto; }
.site-nav .nav-tab { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 15px; border: var(--nav-line-width) solid var(--nav-blue); border-radius: 9px 9px 0 0; background: var(--nav-blue); font-weight: 600; white-space: nowrap; }
.site-nav .nav-tab:hover { background: #15558e; border-color: #15558e; }
.site-nav .nav-tab[aria-current="page"] { color: var(--nav-blue); background: var(--surface); border-color: var(--nav-blue); border-bottom-color: transparent; }
.site-nav .nav-tab:focus-visible, .nav-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.site-nav .nav-button { padding: 10px; min-height: 40px; color: var(--nav-blue); }

.site-nav a, .nav-button {
  color: white;
  font: inherit;
  text-decoration: none;
}

.nav-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 30px auto 64px;
}

.page-heading, .section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.page-heading { margin-bottom: 22px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.7rem, 3vw, 2.4rem); }
h2 { margin-bottom: 5px; font-size: 1.25rem; }
.eyebrow { margin-bottom: 7px; color: var(--cyan); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted, small { color: var(--muted); }

.panel, .day-card, .activity-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgb(22 48 62 / 4%);
}

.panel { margin-bottom: 18px; padding: 22px; }
.section-heading { margin-bottom: 18px; }
.section-heading p { margin-bottom: 0; }

.month-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.month-tools { flex-wrap: wrap; }
.month-picker { display: flex; align-items: center; gap: 8px; }
.month-picker input { min-width: 150px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.month-nav, .export-actions, .form-actions, .sticky-actions { display: flex; align-items: center; gap: 10px; }
.month-nav span { min-width: 150px; text-align: center; font-weight: 700; }

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 15px;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.button.primary { background: var(--blue); color: white; }
.button.secondary { border-color: var(--line); background: white; color: var(--blue); }
.button:hover { filter: brightness(.96); }

.day-list { display: grid; gap: 10px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.summary-grid .panel { display: grid; gap: 8px; padding: 16px; }
.summary-grid strong { font-size: 1.3rem; }
.status-badge { color: var(--blue); font-weight: 700; }
.day-navigation { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.source-table { overflow-x: auto; max-height: 400px; margin-top: 16px; }
.source-table table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.source-table th, .source-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; }
summary { cursor: pointer; font-weight: 650; }
.day-card {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(180px, 1.4fr) auto;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
}
.day-date { display: flex; align-items: center; gap: 12px; }
.day-date span:last-child { display: grid; gap: 3px; }
.day-number { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 9px; background: #e6f4f7; color: var(--blue); font-size: 1.1rem; font-weight: 750; }
.day-summary { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: .92rem; }
.day-edit { min-width: 94px; grid-column: 3; grid-row: 1; }
.day-status-form { grid-column: 2 / 4; grid-row: 2; display: flex; gap: 8px; justify-content: flex-end; }
.day-status-form select { width: auto; max-width: 220px; }
.table-scroll { overflow-x: auto; position: relative; }
.activities-table { width: 100%; min-width: 980px; border-collapse: collapse; }
.activities-table th { text-align: left; font-size: .82rem; color: var(--muted); }
.activities-table td, .activities-table th { padding: 5px; border-bottom: 1px solid var(--line); }
.activities-table th:nth-child(2) { width: 25%; }
.activities-table th:nth-child(3) { width: 17%; }
.activities-table th:nth-child(4) { width: 17%; }
.activities-table input { min-height: 36px; padding: 5px 7px; font-size: .88rem; }
.activities-table input[type="time"] { min-width: 92px; }
.activities-table input[type="number"] { width: 70px; }
.row-number { width: 28px; color: var(--muted); }
.row-actions { white-space: nowrap; }
.row-actions .button { min-height: 30px; padding: 3px 10px; }
.row-actions .delete-field { margin-left: 5px; vertical-align: middle; }
#deleted-activities { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.original-data { margin-top: 20px; }
.history-caption { display: block; margin-top: 4px; }
.history-activities td, .history-activities th { white-space: nowrap; }
.history-table { width: 100%; min-width: 1080px; border-collapse: collapse; font-size: .86rem; }
.history-table td, .history-table th { padding: 9px 7px; border-bottom: 1px solid var(--line); text-align: left; }
.history-table th { white-space: nowrap; }
.history-pdf { width: 100%; height: 75vh; min-height: 400px; border: 0; margin-top: 16px; }
.original-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; }

.back-link { display: inline-block; margin-bottom: 12px; text-decoration: none; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field label { font-size: .9rem; font-weight: 650; }
.form-control, input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #b9c7ce;
  border-radius: 6px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
  font: inherit;
}
input[type="checkbox"] { width: 19px; min-height: 19px; accent-color: var(--blue); }
.field-invalid input, .field-invalid select { border-color: var(--danger); }
.field-error, .form-errors { color: var(--danger); }
.form-errors { margin: 0 0 16px; padding: 12px; border: 1px solid #e3bcbc; border-radius: 7px; background: #fff6f6; }
.check-grid { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 20px 0 0; border: 0; padding: 0; }
.check-grid legend { margin-bottom: 10px; font-weight: 700; }
.check-field { display: inline-flex; align-items: center; gap: 8px; }

.activity-card { margin-bottom: 12px; padding: 16px; }
.activity-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.delete-field { display: inline-flex; align-items: center; gap: 7px; color: var(--danger); font-size: .9rem; }
.activity-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.empty-state { padding: 22px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }
.sticky-actions { position: sticky; bottom: 0; justify-content: flex-end; margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgb(243 246 247 / 95%); backdrop-filter: blur(8px); }
.form-actions { justify-content: flex-end; margin-top: 22px; }
.login-panel { max-width: 440px; margin: 8vh auto; }
.login-panel form { display: grid; gap: 12px; }
.full-width { width: 100%; margin-top: 8px; }
.error-panel { border-left: 5px solid var(--danger); }
.messages { margin-bottom: 16px; }
.message { padding: 12px; border-radius: 7px; background: #e8f4eb; color: #155d2d; }
.message.error { background: #fff6f6; color: var(--danger); }

@media (max-width: 760px) {
  .site-header { padding: 6px 10px 0; }
  .site-nav { width: 100%; justify-content: flex-start; gap: 4px; }
  .site-nav .nav-tab { padding: 8px 10px; font-size: .9rem; }
  .page { width: min(100% - 20px, 640px); margin-top: 18px; }
  .page-heading, .section-heading { align-items: flex-start; flex-direction: column; }
  .page-heading > .button, .section-heading > .button { width: 100%; }
  .panel { padding: 16px; }
  .month-tools { align-items: stretch; flex-direction: column; }
  .export-actions > .button { flex: 1; }
  .day-card { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .day-summary { grid-column: 1 / -1; grid-row: 2; padding-left: 54px; }
  .day-status-form { grid-column: 1 / -1; grid-row: 3; flex-wrap: wrap; }
  .day-edit { grid-column: 2; grid-row: 1; }
  .form-grid, .activity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .check-grid { gap: 12px 18px; }
}

@media (max-width: 420px) {
  .form-grid, .activity-grid { grid-template-columns: 1fr; }
  .export-actions { flex-direction: column; }
  .export-actions > .button { width: 100%; }
  .sticky-actions .button { flex: 1; }
}
/* Private receipt capture, usable with touch and keyboard. */
.receipt-preview { display: block; width: 100%; height: 75vh; min-height: 420px; border: 1px solid #b9c7ce; margin-top: 18px; background: #f1f4f6; }
.receipt-preview[hidden], #receipt-crop[hidden], [data-receipt-field][hidden], #receipt-camera-input[hidden] { display: none; }
.receipt-crop-board { position: relative; width: min(100% - 28px, 700px); margin: 24px auto; }
#receipt-canvas { display: block; width: 100%; height: auto; }
#receipt-corners { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#receipt-corners polygon { fill: #1c6bb025; stroke: #1c6bb0; stroke-width: .6; vector-effect: non-scaling-stroke; }
.receipt-handle { position: absolute; transform: translate(-50%, -50%); width: 34px; height: 34px; padding: 0; border: 2px solid white; border-radius: 50%; background: #1c6bb0; color: white; font-weight: bold; touch-action: none; cursor: grab; }
.receipt-corner-inputs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.receipt-corner-inputs label { display: block; font-size: .85rem; }
.receipt-list { padding-left: 20px; }
.receipt-list li { margin: 8px 0; }
.receipt-link { display: inline-flex; align-items: center; color: var(--blue); vertical-align: middle; }
.receipt-link svg { width: 18px; height: 18px; }
@media (max-width: 640px) { .receipt-corner-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
