/* Functional additions only – the Django admin keeps its default look.
   Colours are tokens with light + dark values, because the admin follows the system dark mode
   (and its own theme toggle via html[data-theme]). Every text/background pair is >= 4.5:1. */
:root {
  --dz-weekend-row: #fff8e1;  --dz-weekend-fg: #5c4400;  --dz-weekend-bg: #ffe8a3;
  --dz-holiday-row: #fdecee;  --dz-holiday-fg: #7a1a24;  --dz-holiday-bg: #f9c9cf;
  --dz-open-fg: #1b5e20;      --dz-open-bg: #e3f2e5;
  --dz-closed-fg: #37474f;    --dz-closed-bg: #e6eaed;
  --dz-flag-fg: #8a1020;      --dz-flag-bg: #fbd5da;     --dz-flag-bar: #ba2121;
  --dz-edit-fg: #4a3a00;      --dz-edit-bg: #fff1b8;
  --dz-vac-fg: #0d47a1;       --dz-vac-bg: #dde9fb;
  --dz-bonus-fg: #8a4b00;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --dz-weekend-row: #2f2a1a;  --dz-weekend-fg: #ffe08a;  --dz-weekend-bg: #4a3f17;
    --dz-holiday-row: #33191d;  --dz-holiday-fg: #ffb3bd;  --dz-holiday-bg: #5a2029;
    --dz-open-fg: #a5d6a7;      --dz-open-bg: #1f3a22;
    --dz-closed-fg: #cfd8dc;    --dz-closed-bg: #37434a;
    --dz-flag-fg: #ffc2ca;      --dz-flag-bg: #6b1622;     --dz-flag-bar: #ff6b7d;
    --dz-edit-fg: #ffe9a0;      --dz-edit-bg: #4a3f17;
    --dz-vac-fg: #b9d3ff;       --dz-vac-bg: #1d3557;
    --dz-bonus-fg: #ffc27a;
  }
}
:root[data-theme="dark"] {
  --dz-weekend-row: #2f2a1a;  --dz-weekend-fg: #ffe08a;  --dz-weekend-bg: #4a3f17;
  --dz-holiday-row: #33191d;  --dz-holiday-fg: #ffb3bd;  --dz-holiday-bg: #5a2029;
  --dz-open-fg: #a5d6a7;      --dz-open-bg: #1f3a22;
  --dz-closed-fg: #cfd8dc;    --dz-closed-bg: #37434a;
  --dz-flag-fg: #ffc2ca;      --dz-flag-bg: #6b1622;     --dz-flag-bar: #ff6b7d;
  --dz-edit-fg: #ffe9a0;      --dz-edit-bg: #4a3f17;
  --dz-vac-fg: #b9d3ff;       --dz-vac-bg: #1d3557;
  --dz-bonus-fg: #ffc27a;
}

/* Shared pill shape for all state badges */
.day-badge, .open-badge, .closed-badge, .flag-badge, .edited-badge, .kind-badge {
  display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 600;
  line-height: 16px; white-space: nowrap; vertical-align: 1px; }

/* Weekend / holiday: badge + whole-row tint (via :has) */
.day-badge { margin-left: .5em; cursor: help; }
.day-weekend { background: var(--dz-weekend-bg); color: var(--dz-weekend-fg); }
.day-holiday { background: var(--dz-holiday-bg); color: var(--dz-holiday-fg); }
#result_list tr:has(.day-weekend) > td, #result_list tr:has(.day-weekend) > th { background: var(--dz-weekend-row); }
#result_list tr:has(.day-holiday) > td, #result_list tr:has(.day-holiday) > th { background: var(--dz-holiday-row); }
#result_list td.field-day, #result_list th.field-day, #result_list td.field-time, #result_list td.field-employee_col,
#result_list td.field-amount, #result_list td.field-hours { white-space: nowrap; }

/* Entry states */
.open-badge { background: var(--dz-open-bg); color: var(--dz-open-fg); }
a.closed-badge, a.closed-badge:link, a.closed-badge:visited { background: var(--dz-closed-bg); color: var(--dz-closed-fg); }
a.closed-badge:hover { text-decoration: underline; }
.flag-badge { background: var(--dz-flag-bg); color: var(--dz-flag-fg); }
.edited-badge { background: var(--dz-edit-bg); color: var(--dz-edit-fg); font-weight: 500; margin-left: 4px; }
.kind-badge { background: var(--dz-vac-bg); color: var(--dz-vac-fg); }
.bonus { color: var(--dz-bonus-fg); font-weight: 600; white-space: nowrap; }
#result_list tr:has(.flag-badge) > :first-child { box-shadow: inset 3px 0 0 var(--dz-flag-bar); }
.flag-note { color: var(--dz-flag-fg); font-size: 12px; margin-top: 3px; max-width: 18em; white-space: normal; }

/* Employee colour (identification only) */
.emp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0;
  box-shadow: 0 0 0 1.5px rgba(160, 160, 160, .55); }
.emp-swatch { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 4px; color: #fff; font-size: 11px; font-weight: 700; }

/* Closing: summary table + reopen button in object tools */
.closing-sum { border-collapse: collapse; min-width: 420px; }
.closing-sum td, .closing-sum th { padding: 6px 12px; border-bottom: 1px solid var(--hairline-color); text-align: right; }
.closing-sum td:first-child, .closing-sum th:first-child { text-align: left; }
.closing-sum tr.total td { border-top: 2px solid var(--body-quiet-color); font-weight: 600; }
.closing-sum td, .closing-sum th { white-space: nowrap; }
.closing-sum .bonus { color: var(--dz-bonus-fg); font-weight: 600; }
/* The form must lay out like Django's floated object-tool links, otherwise it sits on the text baseline (lower) */
.object-tools li form { display: block; float: left; margin: 0; }
.object-tools .reopen-btn { display: block; margin: 0; font-family: inherit;
  background: var(--delete-button-bg, #ba2121); color: #fff; border: 0; border-radius: 15px;
  padding: 3px 12px; font-size: 0.6875rem; font-weight: 400; text-transform: uppercase; letter-spacing: .5px;
  line-height: 20px; cursor: pointer; }
.object-tools .reopen-btn:hover { background: var(--delete-button-hover-bg, #a41515); }

/* Vacation fund */
.vac-over { color: var(--dz-flag-fg); background: var(--dz-flag-bg); padding: 0 4px; border-radius: 3px; }
.vac-none, .vac-used { color: var(--body-quiet-color); font-size: 12px; }
#vacation_funds-group td.original p { display: none; }
/* Employee list: keep the inline-editable number fields compact so the whole row fits */
#result_list td.field-hourly_rate input, #result_list td.field-vacation_day_hours input { width: 5.5em; }
#result_list td.field-vacation { white-space: nowrap; }

/* Version links in the header (same template as the owner pages) */
#user-tools .version-badge a { text-transform: none; }
#user-tools .version-badge .sha { font-family: ui-monospace, monospace; }
#user-tools .version-badge.dev { background: #fff1b8; color: #4a3a00; padding: 0 4px; border-radius: 3px; }

/* Employee colour: swatches instead of bare names (grid of radio choices) */
div#id_color { display: flex; flex-wrap: wrap; gap: 6px 10px; max-width: 760px; }
div#id_color > div { margin: 0; }
.color-option { display: inline-flex !important; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; cursor: pointer;
  border: 1px solid var(--hairline-color); border-radius: 6px; width: auto !important; font-weight: 400 !important; }
.color-option:has(input:checked) { border-color: var(--body-fg); box-shadow: 0 0 0 1px var(--body-fg); }
.color-option input { margin: 0; }
.color-chip { width: 22px; height: 22px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.color-chip.auto { background: repeating-linear-gradient(45deg, #ccc 0 4px, transparent 4px 8px); }
#user-tools .version-badge.dev a { color: #4a3a00; }
.closing-sum tfoot td { font-size: inherit; color: var(--body-fg); background: var(--darkened-bg); }
.field-actions_box a.button { text-decoration: none; margin: 0 4px 4px 0; display: inline-block; }
