/* ==========================================================================
   Attendance: the month sheet, its cell editor, and the day view.

   The sheet is a spreadsheet, not a list: people down, days across, a
   30px cell each. It scrolls inside its own box in both directions, with
   the name column and the day row pinned, so a hundred people by thirty-one
   days stays readable at 1280 and 1366 (the tablet layout) as well as on a
   desktop. On a phone the page opens on the day view instead.

   Everything a cell says is said in letters (P, H, A, L, U, WO, HO, +1): the
   tints only repeat it, so a greyscale printout or a colour-blind reader
   loses nothing. Off days are hatched as well as tinted for the same reason.
   ========================================================================== */

.att-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-sm);
  color: var(--txt-2);
}
.att-legend b { font-family: var(--font-mono); font-weight: var(--fw-semibold); color: var(--txt); }

/* The sheet's own scroll box: both ways, at most most of a screen tall so the
   editor under it stays in view. */
.att-sheet {
  overflow: auto;
  max-height: min(68vh, 760px);
  overscroll-behavior: contain;
  /* The arrows scroll a cell into view with "nearest", which would leave it
     under the pinned name column or day row. The padding is the size of each,
     so a cell stops just clear of them. */
  scroll-padding-top: 40px;
  scroll-padding-left: 180px;
}

.att-grid {
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.att-grid th,
.att-grid td {
  padding: 0;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: center;
  white-space: nowrap;
}

/* The day row stays in view while the people scroll. A pinned cell carries
   its own background, or the rows show through it. */
.att-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 40px;
  min-width: 30px;
  background: var(--surface-2);
  color: var(--txt-3);
  font-weight: var(--fw-medium);
  box-shadow: inset 0 -1px 0 var(--line);
}

.att-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: 1.1;
  cursor: pointer;
}
.att-day:disabled { cursor: default; }
.att-day:hover:not(:disabled) { color: var(--primary); }
.att-day:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--primary-ring); }
.att-day__num { font-family: var(--font-mono); font-weight: var(--fw-semibold); color: var(--txt); }
.att-day__dow { font-size: var(--fs-2xs); }

.att-grid thead th.is-today { box-shadow: inset 0 -3px 0 var(--primary); }
.att-grid thead th.is-today .att-day__num { color: var(--primary); }

/* The name column stays in view while the days scroll. */
.att-grid .att-name {
  position: sticky;
  left: 0;
  z-index: 1;
  /* A fixed width, so the sheet's scroll padding can match it exactly. */
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  padding: 4px 10px;
  background: var(--surface);
  text-align: left;
  box-shadow: inset -1px 0 0 var(--line);
}
.att-grid thead .att-name { z-index: 3; background: var(--surface-2); text-align: left; padding-left: 10px; }
.att-name__name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: var(--fw-medium);
  color: var(--txt);
}
.att-name__meta { display: block; font-size: var(--fs-2xs); color: var(--txt-3); overflow: hidden; text-overflow: ellipsis; }

/* An off day down the whole column, tinted and hatched. A holiday is
   hatched more closely than the weekly off so the two differ in grey. */
.att-grid .is-weekly-off {
  background-color: var(--surface-2);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--line-soft) 6px 7px);
}
.att-grid .is-holiday {
  background-color: var(--surface-3);
  background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--line) 3px 4px);
}
.att-grid thead th.is-weekly-off,
.att-grid thead th.is-holiday { background-color: var(--surface-3); }

/* Before joining or after leaving: nothing may go here. */
.att-grid .is-outside { background: var(--surface-2); }

.att-cell {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--txt-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}
.att-cell:hover:not(:disabled) { background: var(--primary-soft); }
.att-cell:disabled { cursor: not-allowed; color: transparent; }

/* WO and HO sit on a tinted, hatched cell, so they take the darker of the
   muted text colours to stay readable on it (over 4.5:1 in both themes). */
.att-cell.is-off { color: var(--txt-2); }
.att-cell:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--primary); }
.att-cell.is-selected { box-shadow: 0 0 0 2px var(--primary); }

/* The mark's colour repeats its letter. */
.att-cell.mark-p { color: var(--ok-fg); background: var(--ok-bg); }
.att-cell.mark-h { color: var(--warn-fg); background: var(--warn-bg); }
.att-cell.mark-a { color: var(--bad-fg); background: var(--bad-bg); }
.att-cell.mark-l { color: var(--info-fg); background: var(--info-bg); }
.att-cell.mark-u { color: var(--mute-fg); background: var(--mute-bg); }

/* A working day gone by with nothing marked: a thin ring in the muted text
   colour (over 3:1 against the cell, in both themes), so the gaps stand out
   in grey as well as in colour. */
.att-cell.is-unmarked { box-shadow: inset 0 0 0 1px var(--txt-3); }
.att-cell.is-unmarked:focus-visible,
.att-cell.is-unmarked.is-selected { box-shadow: 0 0 0 2px var(--primary); }

/* Hours: "10.5h" is five letters, which the 30px cell holds only in a
   smaller face (3 Nov 2026). */
.att-cell.is-long { font-size: 9px; letter-spacing: -0.4px; }

/* An hours badge ("+1.5h", "+10.5") is wider than "+1": a smaller face, and
   held to the cell's own edge rather than 3px past it, so it never meets the
   next day's badge. The register's "+10.5h" (six letters) goes smaller still. */
.att-cell__extra.att-cell__extra--hours { right: 0; padding: 0 1px; font-size: 8px; letter-spacing: -0.3px; }
.att-cell__extra.att-cell__extra--long { font-size: 7px; letter-spacing: -0.4px; }

/* A mark an approved leave wrote: underlined, so it can be told from one
   made by hand. */
.att-cell.is-leave { text-decoration: underline; text-underline-offset: 2px; }

.att-cell__extra {
  position: absolute;
  top: -2px;
  right: -3px;
  padding: 0 2px;
  border-radius: var(--r-sm);
  background: var(--primary);
  color: var(--txt-inv);
  font-size: 9px;
  line-height: 12px;
}

/* A mark with a note (3 Nov 2026): a small triangle in the bottom left
   corner, drawn inside the 30px box so a note never widens a day, and in the
   mark's own colour (currentColor), which already reads on the mark's tint in
   both themes. Not the top: the extra-work badge runs along it, and an hours
   badge ("+2.5h") reaches from the right edge to 5px of the left, which hid a
   top-left corner. The letters (and a leave's underline) end above it. Shared
   by the sheet's buttons and the register's boxes, both position: relative. */
.att-cell__noted {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-bottom: 7px solid currentColor;
  border-right: 7px solid transparent;
  border-bottom-left-radius: var(--r-sm);
  pointer-events: none;
}

/* The row's figures, after the days. */
.att-grid .att-total {
  min-width: 34px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--txt-2);
}
.att-grid thead .att-total { font-family: var(--font-sans); }
.att-grid .att-total--first { border-left: 2px solid var(--line); }
.att-grid .att-total.is-warn { color: var(--bad-fg); font-weight: var(--fw-semibold); }

/* --------------------------------------------------------------------------
   The cell editor, under the sheet: who and which day, the marks, extra work.
   -------------------------------------------------------------------------- */

.att-editor {
  display: grid;
  gap: var(--sp-3);
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.att-editor__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-3); }
.att-editor__who { font-weight: var(--fw-semibold); color: var(--txt); }
.att-editor__what { font-size: var(--fs-sm); color: var(--txt-3); }
.att-editor__hint { font-size: var(--fs-sm); color: var(--txt-3); margin: 0; }
/* A note on a day that cannot be changed, read only: it wraps, however long a word. */
.att-editor__note { margin: 0; font-size: var(--fs-sm); color: var(--txt-2); overflow-wrap: anywhere; }

.att-keys { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.att-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--txt);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
}
.att-key:hover:not(:disabled) { border-color: var(--primary); }
.att-key:disabled { opacity: 0.5; cursor: not-allowed; }
.att-key:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.att-key b { font-family: var(--font-mono); }

/* The chosen mark is the loudest thing in the row, in both themes. */
.att-key.is-chosen { border-color: var(--primary); background: var(--primary); color: var(--txt-inv); }

.att-extra { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-3); }
.att-extra .field { margin-bottom: 0; }
.att-extra__kind { width: 180px; }
.att-extra__hours { width: 120px; }
.att-extra__note { flex: 1 1 220px; min-width: 0; }

/* Some hours of the day: the box, its button on the same line, and the
   range under them (3 Nov 2026). */
.att-hours { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-3); }
.att-hours .field { margin-bottom: 0; }
.att-hours__field { width: 120px; }
.att-hours__note { flex: 1 1 100%; margin: 0; font-size: var(--fs-sm); color: var(--txt-3); }
/* The key beside the box stands as tall as the box, so the two share a line. */
.att-hours .att-key { height: 38px; }

/* --------------------------------------------------------------------------
   The day view: one row a person, a mark and extra work each.
   -------------------------------------------------------------------------- */

.att-daybar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
/* Sized in ems, so "September, 2026" still fits at the 16px a touch screen
   draws inputs at. */
.att-daybar .input { width: auto; min-width: 13em; }

.att-dayrow__state { font-size: var(--fs-sm); color: var(--txt-3); }
.att-dayrow__note { min-width: 160px; }

/* A save refused in the day view, under the person's name: it stays until
   that row is saved again, whatever other rows do meanwhile. */
.att-dayrow__error { display: block; margin-top: 4px; font-size: var(--fs-sm); color: var(--bad-fg); overflow-wrap: anywhere; }

/* The note on the mark, in the Mark cell: a line of its own under the
   dropdown (and the hours box), the cell's full width. Outside the row of
   boxes, so it adds nothing to the width the table gives the column and the
   extra-work dropdown keeps its room at tablet widths. Read only, it is a
   line under the mark's words and wraps, however long a word it holds. */
.att-dayrow__mark { width: 100%; min-width: 0; }
.att-dayrow .att-dayrow__marknote { display: block; width: 100%; min-width: 0; margin-top: var(--sp-2); }
.att-dayrow__marknote-text { display: block; margin-top: 2px; overflow-wrap: anywhere; }

/* The month editor's line under its note box. */
.att-notecount { display: block; margin-top: 2px; font-size: var(--fs-2xs); color: var(--txt-3); }

/* The month editor's note: the box takes the line, its button beside it. */
.att-marknote { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-3); }
.att-marknote .field { margin-bottom: 0; flex: 1 1 260px; min-width: 0; }
.att-marknote .att-notecount { flex: 1 1 100%; margin-top: 0; }
.att-dayrow .select-wrap,
.att-dayrow .input { width: 100%; }

/* A dropdown and, when it says Hours, the hours beside it. */
/* The pair fills its cell as the dropdown alone did, so the dropdowns of the
   rows start and end together and "Hours extra" clears the chevron. */
.att-dayrow__pair { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; width: 100%; min-width: 0; }
/* At least room for "Hours extra" clear of the chevron; narrower than that,
   the hours box goes under the dropdown rather than squeezing it. */
.att-dayrow__pair .select-wrap { flex: 1 1 140px; width: auto; min-width: 0; }
.att-dayrow__pair .select { width: 100%; }
.att-dayrow .att-dayrow__hours { flex: 0 0 88px; width: 88px; }

/* On a phone each person is a card: the two choices side by side, the note
   under them. */
@container content (max-width: 560px) {
  .att-extra__kind { width: 100%; }
  .att-extra__hours,
  .att-hours__field { flex: 1 1 120px; width: auto; }
  .att-daybar { width: 100%; }
  .att-daybar .input { flex: 1 1 auto; width: auto; min-width: 0; }

  /* A phone gives the days the room: the name column narrows to the name
     and the code, and the sheet's scroll padding narrows with it. */
  .att-sheet { scroll-padding-left: 116px; }
  .att-grid .att-name { width: 116px; min-width: 116px; max-width: 116px; padding: 4px 8px; }
  .att-name__more { display: none; }
}

/* Under a finger every control is 42px. The cells stay 30 wide (a month
   has to fit across) but grow to 42 tall, which is the part a thumb misses. */
@media (pointer: coarse) {
  .att-cell { height: 42px; }
  .att-key { height: 42px; }
  .att-hours .att-key { height: 42px; }
  .btn.att-touch { height: 42px; min-height: 42px; }
  .att-day { height: 46px; }
  .att-grid thead th { height: 46px; }
  .att-sheet { scroll-padding-top: 46px; }
}

/* A leave's status and who decided it, stacked, the badge its own width. */
.leave-status { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }

/* --------------------------------------------------------------------------
   Salary (payroll phase 3)

   The month's sheet, a row's drawer, and the payslips. Kept in the staff
   stylesheet so no new file has to be linked in App.razor and in the print
   pages' stylesheet list.
   -------------------------------------------------------------------------- */

/* The month's status beside the month picker: a badge, and who did it. */
.sal-status { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.sal-status__who { font-size: var(--fs-sm); color: var(--txt-3); }

/* A sentence under the toolbar about the month as a whole. Inside the flush
   card, so it is a band rather than a floating alert. */
.sal-note {
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-md);
}
.sal-note--info { background: var(--info-bg); color: var(--info-fg); }
.sal-note--warn { background: var(--warn-bg); color: var(--warn-fg); }
/* The link in a notice takes the notice's own colour, underlined, rather than
   the link blue, which on the dark theme's amber band fell under 4.5:1. */
.sal-note__link { color: inherit; font-weight: var(--fw-semibold); text-decoration: underline; }

.drawer__body .sal-note { margin-bottom: var(--sp-4); border: 1px solid var(--warn); border-radius: var(--r-md); }

.sal-stats { padding: 14px 16px 0; }
.sal-stats .stat-row { margin-bottom: 0; }

/* Money columns stay on one line; the name column gives way first. */
.sal-table .cell-amount { white-space: nowrap; }
.sal-table .col-party { min-width: 140px; }
.sal-days { color: var(--txt-2); }

/* The name column carries the days under the name, which must not be cut
   short: it may wrap, and the column takes a little more than a master
   list's identity column does. */
.sal-table .col-party { max-width: 320px; }

/* Only while it is a table: a share of the width on a stacked card would
   make the card's first line a third of the screen. */
@container content (width > 760px) {
  .sal-table .col-party { width: 30%; }
}
.sal-table .col-party .person__meta,
.sal-table .col-party .person__name { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.sal-net { font-weight: var(--fw-semibold); }

/* A draft row the attendance has moved on from: marked on its edge, not by
   colour alone; the banner above says what it means. */
.sal-row--stale td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

.sal-total th,
.sal-total td {
  padding-top: 10px;
  padding-bottom: 10px;
  border-top: 1px solid var(--line-strong);
  font-weight: var(--fw-semibold);
  text-align: left;
}
.sal-total td.cell-amount { text-align: right; }

/* What stops the month being finalised: a person, the problem, and a way to
   the screen that fixes it. */
.sal-blockers,
.sal-history { padding: 14px 16px 16px; border-top: 1px solid var(--line-soft); }
.sal-blockers__title { margin: 0 0 var(--sp-2); font-size: var(--fs-md); font-weight: var(--fw-semibold); }

/* "See the list" jumps here; the sticky top bar (64px, two rows on a narrow
   phone) must not sit over the heading it lands on. */
#salBlockersTitle { scroll-margin-top: 76px; }
@media (max-width: 480px) {
  #salBlockersTitle { scroll-margin-top: 128px; }
}
.sal-blockers__list { margin: 0; padding: 0; list-style: none; }
.sal-blockers__item {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.sal-blockers__item:last-child { border-bottom: 0; }
.sal-blockers__who { font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.sal-blockers__what { color: var(--txt-2); font-size: var(--fs-md); }
.sal-history .sal-blockers__item { grid-template-columns: minmax(140px, 220px) 1fr; }

@container content (max-width: 560px) {
  .sal-blockers__item { grid-template-columns: 1fr; gap: 4px; }
  .sal-blockers__go { justify-self: start; }
  .sal-history .sal-blockers__item { grid-template-columns: 1fr; }
}

/* Stacked on a phone the table shows each figure on its own line, and the
   month's totals are the stat cards above, so the foot row goes. */
@container content (max-width: 760px) {
  .sal-table tfoot { display: none; }
  .sal-table .col-party { min-width: 0; }
}

/* ---- the row's drawer ---------------------------------------------------- */

.sal-panel__title {
  margin: var(--sp-4) 0 var(--sp-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--txt-3);
}
.sal-panel__title:first-child { margin-top: 0; }

.sal-panel__note { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); color: var(--txt-3); }

/* A rule the row breaks, said inside the working where it applies. */
.stat-list__row.sal-warn .stat-list__label { color: var(--bad-fg); font-weight: var(--fw-semibold); }

/* The reopen reason takes the dialog's width on every screen: the dialog
   centres its children, which left the box two thirds wide on a phone. */
.reason-dialog__field { align-self: stretch; width: 100%; }
.reason-dialog__text { width: 100%; }

.sal-problems {
  margin: 0 0 var(--sp-4);
  padding: 10px 12px 10px 28px;
  border: 1px solid var(--bad);
  border-radius: var(--r-md);
  background: var(--bad-bg);
  color: var(--bad-fg);
  font-size: var(--fs-md);
}

/* Kind and amount side by side, the note under them across the width. */
.sal-line-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.sal-line-form__note { grid-column: 1 / -1; }
.sal-amount { text-align: right; font-variant-numeric: tabular-nums; }
.sal-line-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); margin-bottom: var(--sp-3); }

.sal-lines { margin: 0 0 var(--sp-3); padding: 0; list-style: none; }
.sal-lines__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
}
.sal-lines__text { display: flex; flex: 1; min-width: 0; flex-direction: column; overflow-wrap: anywhere; }

.sal-counts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px 12px;
  margin: 0 0 var(--sp-4);
}
.sal-counts div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line-soft); padding: 3px 0; }
.sal-counts dt { color: var(--txt-3); font-size: var(--fs-sm); }
.sal-counts dd { margin: 0; font-variant-numeric: tabular-nums; }

.sal-daytable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.sal-daytable th {
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--txt-3);
}
.sal-daytable td { padding: 5px 4px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.sal-daytable thead th.sal-daytable__num,
.sal-daytable__num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sal-daytable__date { white-space: nowrap; color: var(--txt-2); }
.sal-daytable tr.is-off td { color: var(--txt-3); }
.sal-daytable tr.is-problem td { background: var(--bad-bg); color: var(--bad-fg); }

/* Under a finger the line form's buttons and the toolbar's are 42, as
   everywhere else. */
@media (pointer: coarse) {
  .sal-line-actions .btn,
  .sal-blockers__go,
  .sal-actions .btn { min-height: 42px; }
}

/* ---- payslips ------------------------------------------------------------
   Two to an A4 sheet in the invoice's greys. Each slip is at least 128mm
   tall, so two and the 8mm cut gutter (264mm) sit inside the 281mm the 8mm
   top and bottom margins leave, with room for a slip that runs a few lines
   longer. Measured 1 Nov 2026 on 99 real rows: 115 to 130mm. A slip longer
   than the half page keeps itself whole and moves to the next sheet. */

.slip {
  display: flex;
  flex-direction: column;
  min-height: 128mm;
  break-inside: avoid;
}
.slip + .slip {
  position: relative;
  margin-top: 8mm;
}
.slip + .slip::before {
  content: "";
  position: absolute;
  top: -4mm;
  left: 0;
  right: 0;
  border-top: .8pt dashed var(--rule-2);
}

.slip__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8mm;
  padding-bottom: 2.5mm;
  border-bottom: 1.4pt solid var(--ink);
}
.slip__company { margin: 0; font-size: 12pt; font-weight: 700; color: var(--ink); }
.slip__addr { margin: 1mm 0 0; color: var(--ink-2); font-size: 8pt; }
.slip__doc { flex: none; text-align: right; }
.slip__title { margin: 0; font-size: 13pt; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink); }
.slip__month { margin: .5mm 0 0; font-size: 10pt; color: var(--ink); }
.slip__draft {
  display: inline-block;
  margin: 1mm 0 0;
  padding: .4mm 2mm;
  border: .8pt solid var(--ink);
  font-size: 7.5pt;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.slip__facts,
.slip__days {
  display: grid;
  gap: 1mm 6mm;
  margin: 1.5mm 0 0;
}
.slip__facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.slip__days {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 1.5mm 2mm;
  border: .5pt solid var(--rule);
  background: var(--band-2);
}
.slip__facts div,
.slip__days div { display: flex; flex-direction: column; min-width: 0; }
.slip__facts dt,
.slip__days dt { color: var(--ink-3); font-size: 7pt; letter-spacing: .05em; text-transform: uppercase; }
.slip__facts dd,
.slip__days dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.slip__strong { font-weight: 700; }

.slip__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; margin-top: 2mm; }
.slip__table { width: 100%; border-collapse: collapse; }
.slip__table th,
.slip__table td { padding: 1mm 1.2mm; text-align: left; vertical-align: top; }
.slip__table thead th {
  border-top: .9pt solid var(--ink);
  border-bottom: .9pt solid var(--ink);
  background: var(--band);
  color: var(--ink);
  font-size: 7.5pt;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.slip__table tbody td { border-bottom: .4pt solid var(--rule); color: var(--ink); }
.slip__table tfoot th,
.slip__table tfoot td { border-top: .9pt solid var(--ink); color: var(--ink); font-weight: 700; }
/* Named with the table's own cell rules, which set every cell left, so the
   amounts stand right in the body as well as in the head and foot. */
.slip__table thead th.slip__num,
.slip__table tbody td.slip__num,
.slip__table tfoot td.slip__num,
.slip__num { width: 26mm; text-align: right; white-space: nowrap; }
.slip__sub { display: block; color: var(--ink-3); font-size: 7.5pt; }
.slip__none { color: var(--ink-3); }

/* A draft slip the attendance has moved on from says so above everything. */
.slip__stale {
  margin: 0 0 2mm;
  padding: 1mm 2mm;
  border: 1pt solid var(--ink);
  color: var(--ink);
  font-size: 8pt;
  font-weight: 700;
}

.slip__net { margin-top: 2mm; padding: 2mm 3mm; border: 1pt solid var(--ink); }
.slip__net-line { display: flex; justify-content: space-between; align-items: baseline; margin: 0; }
.slip__net-cap { color: var(--ink); font-size: 9pt; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.slip__net-value { color: var(--ink); font-size: 13pt; font-weight: 700; }
.slip__rounding { margin: .5mm 0 0; color: var(--ink-3); font-size: 7.5pt; text-align: right; }
.slip__words { margin: 1mm 0 0; color: var(--ink-2); font-size: 8.5pt; }

/* The signatures sit at the foot of the half page, as the invoice's do. */
.slip__sign {
  display: flex;
  justify-content: space-between;
  gap: 10mm;
  margin-top: auto;
  padding-top: 6mm;
}
.slip__sign-line {
  flex: 1;
  margin: 0;
  padding-top: 1.2mm;
  border-top: .6pt solid var(--ink-2);
  color: var(--ink-3);
  font-size: 7.5pt;
}
.slip__sign-line:last-child { text-align: right; }

/* The printed salary sheet: the employee column takes what the twelve
   columns leave, and the figures never wrap. */
.sal-print .inv-lines__num { white-space: nowrap; }
/* The code is one word: "Absence deduction" is a longer heading than the
   "Unpaid amount" it replaced, and the code column gave way first, printing
   "EMP-" over "0011". */
.sal-print tbody tr:not(.rep-group):not(.rep-total) > td:first-child { white-space: nowrap; }
.sal-print__note { margin-top: 4mm; }

/* --------------------------------------------------------------------------
   Paying salaries (payroll phase 4)

   The Pay button on a finalised sheet, the pay form in the row's drawer, the
   Salary payments list, an employee's statement and the payment slip. Kept
   here with the rest of the staff screens, so no stylesheet has to be linked.
   -------------------------------------------------------------------------- */

/* What is due on a row: the figure, with what was paid under it. Right
   aligned as a column of figures, inside the cell's own flex box. */
.sal-due { align-items: flex-end; }
.sal-table .table__actions { gap: var(--sp-2); }
.sal-pay { white-space: nowrap; }

/* A finalised month carries a ninth column, Due. While it is a table the
   cells give up some of their side padding and the headings may take two
   lines, so the nine fit a 1024 or 1280 laptop without a sideways scroll
   (measured: 980px wanted in an 887px card before, 887 after). Scoped to the
   finalised sheet so a draft keeps the spacing it was measured with. */
@container content (width > 760px) {
  .table.sal-table--due thead th,
  .table.sal-table--due tbody td,
  .table.sal-table--due tfoot th,
  .table.sal-table--due tfoot td { padding-left: 8px; padding-right: 8px; }
  .table.sal-table--due thead th { white-space: normal; }

  /* A draft's headings may take two lines as well: "Absence deduction"
     (once "Unpaid") held its column at 155px and pushed the draft sheet
     25px past its card at 1024. */
  .table.sal-table thead th { white-space: normal; }
}

/* Stacked, the row's action sits in its top right corner; Pay is wider than
   the chevron the name keeps room for. */
@container content (max-width: 760px) {
  .sal-table--pay tbody td:first-child { padding-right: 64px; }
}

/* The drawer's pay form: the amount and the date side by side, the account
   across the width, then the reference and the remarks. */
.sal-pay-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.sal-pay-form__wide,
.sal-pay-form .field:nth-child(n + 4) { grid-column: 1 / -1; }
/* On a phone the date box needs the whole width to show its year. */
@media (max-width: 480px) {
  .sal-pay-form { grid-template-columns: minmax(0, 1fr); }
}
.sal-panel__note .tag { margin-right: 4px; }
.sal-panel__note a { font-weight: var(--fw-semibold); }

/* ---- Salary payments ----------------------------------------------------- */

.spay-chips { padding-top: 0; }
.spay-table .col-party { min-width: 160px; }
.spay-table .cell-amount { white-space: nowrap; }
/* Two-word headings may take two lines: at a 1024 laptop width the
   headings, not the figures, were what pushed the table past its card. */
.spay-table thead th { white-space: normal; }
.spay-table .person__meta .tag { margin-left: 4px; }
/* What the employee owes the company: said in words, never by colour alone. */
.spay-owes { color: var(--bad-fg); font-weight: var(--fw-semibold); }
.spay-due { font-weight: var(--fw-semibold); }

@container content (width > 760px) {
  .spay-table .col-party { width: 32%; }
}

/* ---- the statement ------------------------------------------------------- */

.stm-section { margin-top: var(--sp-4); }
.stm-section__title {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}
.stm-table .cell-amount { white-space: nowrap; }
.stm-due { font-weight: var(--fw-semibold); }
.stm-remarks { overflow-wrap: anywhere; }

.stm-how {
  margin: 0 0 var(--sp-2);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--fs-md);
  color: var(--txt-2);
}
.stm-how summary { cursor: pointer; font-weight: var(--fw-semibold); color: var(--txt); }
.stm-how p { margin: 8px 0 0; }

/* Stacked, the figures above carry the totals. */
@container content (max-width: 760px) {
  .stm-table tfoot { display: none; }
}

/* Under a finger the chips and the row's Pay button are 42, as every other
   control is. */
@media (pointer: coarse) {
  .spay-chips .rep-chip,
  .sal-pay,
  .stm-how summary { min-height: 42px; }
  /* "Pay all" in the two pay drawers is a .btn--sm, which the shared touch
     rule holds at 38. Named by its own class so no other small button moves. */
  .btn.spay-payall { height: 42px; min-height: 42px; }
  .stm-how summary { display: flex; align-items: center; }
  .sal-table--pay tbody td:first-child { padding-right: 72px; }
}

/* ---- the payment slip ---------------------------------------------------- */

/* One slip at the top of the sheet: half a page, as a payslip is. */
.pay-slip .slip__facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pay-slip__months { margin-top: 3mm; }
.pay-slip__note { margin: 1mm 0 0; }
.pay-slip__remarks { margin: 2mm 0 0; color: var(--ink); font-size: 9pt; }
.pay-slip__after {
  display: flex;
  justify-content: space-between;
  gap: 6mm;
  margin: 2mm 0 0;
  padding: 1.2mm 3mm;
  border: .5pt solid var(--rule);
  background: var(--band-2);
  color: var(--ink);
  font-size: 9pt;
}

/* ---- Settings, Staff: the optional limits ---------------------------------
   A percentage or a day is two or three digits: a box as wide as the card
   reads as asking for a sentence. Under a finger each checkbox's label is the
   target and is held to 42, as every other control is. */
.staff-limits__percent { max-width: 200px; }
.staff-limits .checkbox { display: flex; }
@media (pointer: coarse) {
  .staff-limits .checkbox { min-height: 42px; align-items: center; }
  .staff-limits .checkbox input { margin-top: 0; }
}

/* ---- Weekly off days (employee form, Settings, Staff) ----------------------
   Seven chips, Monday first, each a real checkbox inside its label. They wrap
   to a second row in a narrow drawer. The ticked state is filled and bold in
   both themes, so it is the loudest thing in the group. */
.wo-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wo-day {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--txt-2);
  font-size: var(--fs-sm);
  cursor: pointer;
  user-select: none;
}
.wo-day.is-on {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
  font-weight: var(--fw-semibold);
}
.wo-day__check {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}
.wo-day:has(.wo-day__check:focus-visible) { box-shadow: 0 0 0 3px var(--primary-ring); }
.wo-day.is-disabled { cursor: default; opacity: 0.75; }

/* Under a finger a box is 42. */
@media (pointer: coarse) {
  .wo-day { min-height: 42px; }
}

/* The weekly off history on the employee form: one line per entry. */
.wo-history {
  margin: var(--sp-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--txt-2);
}
.wo-history li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 6px 0;
  border-top: 1px solid var(--line-soft);
}
.wo-history li:first-child { border-top: 0; }
.wo-history__when { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wo-history__days { color: var(--txt); font-weight: var(--fw-medium); }
/* A planned change's buttons take their own line under it, right-aligned. */
.wo-history__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: 1 0 100%; }
.wo-history li.is-removed .wo-history__days { text-decoration: line-through; color: var(--txt-3); }

@media (pointer: coarse) {
  .wo-history__actions .btn { height: 42px; }
}
