/* ---------- HR: leave calendar and its forms ---------- */

.form-grid .checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  align-self: center;
}

/* Without this the box inherits the full-width sizing every other field in a
   form-grid gets, and a half-day tick renders as a 40px square. */
.form-grid .checkbox-label input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  min-height: 0;
  margin: 0;
}

.inline-decide {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.inline-decide input {
  min-width: 9rem;
}

.leave-calendar {
  table-layout: fixed;
}

.leave-calendar td {
  vertical-align: top;
  height: 5.5rem;
  padding: 0.35rem;
}

.leave-calendar .day-number {
  display: block;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.leave-calendar td.is-outside {
  background: var(--ground);
}

.leave-calendar td.is-outside .day-number {
  opacity: 0.45;
}

.leave-calendar td.is-holiday {
  background: var(--amber-bg);
}

.leave-calendar td.is-today {
  outline: 2px solid var(--incident);
  outline-offset: -2px;
}

.leave-chip {
  display: block;
  margin-top: 0.2rem;
  padding: 0.14rem 0.35rem;
  border-radius: 5px;
  background: var(--info-bg);
  border: 1px solid var(--info);
  color: var(--info);
  font-size: 0.7rem;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leave-chip small {
  display: block;
  opacity: 0.75;
  font-size: 0.62rem;
}

/* A request nobody has decided yet is shown, and shown to be provisional: a manager
   planning around it needs to know it is not agreed. */
.leave-chip.is-pending {
  background: transparent;
  border-style: dashed;
}

.leave-chip.is-mine {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: var(--ok);
}

/* A birthday is not an absence. Same chip so the day reads as one list, warm rather
   than informational so nobody scanning for who is away trips over one. */
.leave-chip.is-birthday {
  background: var(--amber-bg);
  border-color: var(--amber);
  color: var(--amber);
}

/* FB-0070: a work anniversary. Not an absence either. Indigo, because amber is a
   birthday and green is your own leave. 4.7:1 on its tint. */
.leave-chip.is-anniversary {
  background: color-mix(in srgb, var(--legal) 10%, #fff);
  border-color: var(--legal);
  color: var(--legal);
}

/* FB-0029: a weekday somebody on a part week does not work. Not an absence and not
   leave, so it is the quietest chip on the day: grey and dashed. */
.leave-chip.is-off {
  background: transparent;
  border-color: var(--ink-soft);
  border-style: dashed;
  color: var(--ink-soft);
}

/* FB-0028: the name and team filters above the shared calendar. */
.calendar-search {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.9rem;
  margin: 0.4rem 0 0.8rem;
}

.calendar-search label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.work-pattern-list {
  display: grid;
  gap: 0.3rem;
  list-style: none;
  margin: 0 0 0.6rem;
  padding: 0;
}

.work-pattern-list b {
  margin-right: 0.4rem;
}

/* The day ticks on a person's General tab. */
.work-days {
  border: 0;
  margin: 0;
  padding: 0;
}

.work-days label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-right: 0.9rem;
}

/* The heading of a group that is already late, on the compliance page. Overdue and
   due look different because one is a failure and the other is a diary entry. */
h3.is-overdue {
  color: var(--red);
}

/* Four chips in four colours need saying out loud. Asked for on 9 September 2026,
   the same day birthdays landed and read as leave on a stale stylesheet. */
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  list-style: none;
  margin: 0.7rem 0 0.4rem;
  padding: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.calendar-legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  display: inline-block;
  width: 1.6rem;
  height: 0.85rem;
  margin: 0;
  padding: 0;
  flex: none;
}

/* A message under the field it is about, on the subcontractor form. The panel at
   the top says nothing was saved; this says which box to look at. */
/* `.form-grid label` stacks its children, which puts a tick box above its own words.
   `.checkbox-row` is used elsewhere outside a grid, where that never showed. */
.form-grid .checkbox-row {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.55rem;
}

.form-grid .checkbox-row input[type="checkbox"] {
  margin-top: 0.15rem;
  flex: none;
}

.field-error {
  color: var(--red);
  font-weight: 600;
  font-size: 0.74rem;
}

.legend-holiday {
  border-radius: 5px;
  background: var(--ground);
  border: 1px solid var(--line-strong);
}

.holiday-list {
  list-style: none;
  margin: 0.4rem 0 0.8rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.holiday-list li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--amber);
  background: var(--amber-bg);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}

.holiday-bulk {
  margin-top: 0.9rem;
}

.holiday-bulk summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.holiday-bulk textarea {
  width: 100%;
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------------- person record

   The label/value list on a person's profile and access tabs. A dl with no styling
   renders as two stacked lines per field with the value indented, which reads as a
   broken layout rather than as a pair. Two columns on a wide screen, stacked on a
   narrow one, and the label stays the quiet half either way. */
.detail-list {
  margin: 0;
  display: grid;
  gap: 0.1rem 1.5rem;
}

.detail-list > div {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.detail-list > div:last-child {
  border-bottom: 0;
}

.detail-list dt {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  color: var(--ink);
}

@media (max-width: 640px) {
  .detail-list > div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

/* The search box in a panel head. Kept on one line with its button so it does not
   leave a hole across the width of the panel. */
.inline-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.inline-search input[type="search"] {
  min-width: 15rem;
}

/* Help text under a field. Deliberately persistent rather than a placeholder: the
   rule it states, that colleagues never see the year of birth, matters most while
   somebody is typing the date. */
.field-help {
  display: block;
  margin-top: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* Visible to a screen reader, not on screen. For labels the layout already implies. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ filter bar

   One line above every register: search, pills, count, and "More filters" folded
   away. See templates/_filters.html. It replaces four different arrangements that
   did the same job on four screens. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
  margin: 0 0 0.9rem;
}

.filter-search {
  flex: 1 1 16rem;
  min-width: 12rem;
  max-width: 26rem;
}

.filter-search input[type="search"] {
  width: 100%;
}

.filter-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-pill {
  display: inline-block;
  padding: 0.32rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.filter-pill:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
}

.filter-pill.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.filter-pill:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

.filter-count {
  color: var(--ink-soft);
  font-size: 0.82rem;
  white-space: nowrap;
}

.filter-clear {
  color: var(--ink-soft);
  font-size: 0.82rem;
  text-decoration: underline;
}

.filter-more {
  flex-basis: 100%;
}

.filter-more > summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  list-style: none;
  user-select: none;
}

.filter-more > summary::-webkit-details-marker {
  display: none;
}

.filter-more > summary::before {
  content: "▸ ";
  font-size: 0.7em;
}

.filter-more[open] > summary::before {
  content: "▾ ";
}

.filter-more-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.6rem 1rem;
  padding: 0.7rem 0 0.2rem;
}

.filter-more-body label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .filter-pill {
    transition: none;
  }
}

/* ---------------------------------------------------------------- form dialogs

   Create forms behind a button, see templates/_modal.html. Native <dialog>, so focus,
   Esc and the backdrop come from the browser rather than from us. */
.form-dialog {
  width: min(44rem, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  overflow: auto;
}

.form-dialog.is-wide {
  width: min(64rem, calc(100vw - 2rem));
}

.form-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.form-dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.form-dialog-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.form-dialog-close {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.form-dialog-close:hover {
  background: #f1f4f5;
  color: var(--ink);
}

.form-dialog-close:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

.form-dialog-body {
  padding: 1.1rem 1.25rem 1.3rem;
}

.form-dialog-body .filter-panel,
.form-dialog-body .card,
.form-dialog-body .panel {
  margin: 0;
  border: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}

@media (prefers-reduced-motion: no-preference) {
  .form-dialog[open] {
    animation: form-dialog-in 180ms ease-out;
  }
}

@keyframes form-dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------- files explorer

   The library one level at a time, see templates/safety_library.html. Folders are
   tiles you open; the breadcrumb is the way back up. */
.library-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.library-crumbs a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
}

.library-crumbs a:hover {
  color: var(--ink);
  background: #eef1f2;
}

.library-crumbs a[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
}

.library-crumbs span {
  color: var(--line);
}

.library-folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

.library-folder-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.library-folder-tile:hover {
  border-color: var(--ink-soft);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.library-folder-tile:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

.library-folder-tile svg {
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.9rem;
  fill: #f4c152;
  stroke: #c9962a;
  stroke-width: 1;
}

.library-folder-tile span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.library-folder-tile strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-folder-tile small {
  color: var(--ink-soft);
}

.library-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  border-bottom: 1px solid var(--line);
}

.library-result .document-row {
  border-bottom: 0;
  flex: 1 1 18rem;
}

.library-result-folder {
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .library-folder-tile {
    transition: none;
  }
}

/* ------------------------------------------------------------------- how to

   The guide inside the portal, see app/help.py. A contents list, then one card per
   task, in the same voice as the PDF guides in docs/. */
.help-contents {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
}

.help-contents a {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.help-contents a:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
}

.help-sections {
  display: grid;
  gap: 0.9rem;
}

.help-task h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.help-when {
  margin: 0 0 0.6rem;
  color: var(--ink-soft);
}

.help-paths {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
}

.help-path {
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: #f1f4f5;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

.help-steps {
  margin: 0;
  padding-left: 1.4rem;
  line-height: 1.55;
}

.help-steps li + li {
  margin-top: 0.35rem;
}

.help-note {
  margin: 0.8rem 0 0;
  padding: 0.6rem 0.8rem;
  border-left: 3px solid var(--accent, var(--env-yellow));
  background: #fffbea;
  color: var(--ink);
  font-size: 0.9rem;
}

.help-foot {
  margin-top: 1.25rem;
}

.help-task:target {
  outline: 2px solid var(--accent, var(--env-yellow));
  outline-offset: 2px;
}

/* ------------------------------------------------------------ pick several people

   Tick boxes with a find box, see checklist_complete.html. Big enough rows to hit with
   a thumb: this is filled in on site, on a phone. */
.staff-pick {
  display: grid;
  gap: 0.45rem;
}

.staff-pick-list {
  max-height: 16rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.staff-pick-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-weight: 500;
}

.staff-pick-item:last-child {
  border-bottom: 0;
}

.staff-pick-item:hover {
  background: #f6f8f9;
}

.staff-pick-item input {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
}

.staff-pick-item:has(input:checked) {
  background: #fff8e1;
}

.staff-pick-count {
  color: var(--ink-soft);
}

/* What was chosen in a file picker, said back. Quiet, because it is a confirmation
   and not an instruction, and it only appears once there is something to confirm. */
.file-chosen {
  display: block;
  margin-top: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

/* The working week: seven days, each a tick and an hours box. A row per day on a
   phone, because a week squeezed into 320px is seven columns nobody can hit. */
.work-week {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 0.6rem;
}
.work-week-day {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.6rem;
}
.work-week-tick {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}
.work-week-hours {
  display: block;
  margin-top: 0.4rem;
}
.work-week-hours input {
  width: 100%;
}

/* Comments on a record. A conversation reads as blocks of text, not as table rows. */
.comment-list {
  display: grid;
  gap: 0.75rem;
}
.comment {
  border-left: 3px solid var(--line-strong);
  padding: 0.1rem 0 0.1rem 0.75rem;
}
.comment-head {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin: 0 0 0.2rem;
}
.comment-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.comment-form {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}
.comment-form textarea,
.comment-form select {
  width: 100%;
}
.comment-form button {
  justify-self: start;
}

/* A filter panel inside a dialog is a form, not a toolbar across the top of a page.
   The four column grid it was built for needs 691px and a dialog gives it 662px, so
   the last field sat off the right edge behind a horizontal scrollbar: on the Edit
   dialog that was the certificate number, which is the one thing Libby opened it to
   type. Found driving it in Chromium on 24 September 2026, and it was already true of
   Record a course before this. */
.form-dialog .filter-panel {
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

