/* Rivet theme. Colours come from the Rivet logo; see Docs/Style.md.
   Use these variables everywhere; never type a colour code directly in a view. */
:root {
  /* Brand blues, darkest to brightest (sampled from Docs/Brand/dpms-logo.png) */
  --brand-ink: #0a0f14;        /* near-black logo background: header */
  --brand-navy: #08476f;       /* logo frame and lettering: toolbar, headings */
  --brand-deep: #085e9c;       /* left bar: buttons, links, selected rows */
  --brand-blue: #008cec;       /* middle bar: hover, active states */
  --brand-bright: #009dff;     /* right bar / glow: accents only, never text on white */
  --brand-tint: #e6f2fb;       /* pale blue: page title strip, footer */
  --brand-tint-strong: #cfe6f8;

  --page-bg: #eef3f7;          /* light grey-blue behind the login card (from the V1 design) */
  --surface: #fff;             /* cards, boxes and panels sitting on the page */
  --on-brand: #fff;            /* text on the brand blues */
  --danger-on-dark: #ff8a8a;   /* red that reads on the dark wallboard */

  --text: #1d2730;
  --text-muted: #5b6b78;
  --border: #dde3e8;
  --field-border: #b9c6d1;     /* boxes on record pages: darker than a divider, so they're easy to see */
  --this-week: #fff3c4;        /* soft amber: the current week on the scheduler */
  /* Shift colours on the rota (ShiftColour on each shift type): pale fills so the code stays readable */
  --shift-blue: #dbeafe;
  --shift-green: #dcfce7;
  --shift-purple: #ede9fe;
  --shift-orange: #ffedd5;
  --shift-teal: #ccfbf1;
  --shift-grey: #e5e7eb;
  --absence: #fee2e2;          /* pale red: sickness, training and other absences on the rota */
  --holiday: #d9f99d;          /* lime: holiday on the rota, so it stands out from sickness and every shift colour */
  --holiday-text: #365314;
  --tour-dim: rgb(8 71 111 / .55);  /* the tutorial: brand navy over everything except the spotlight */
  --tour-right: #198754;       /* the tutorial: a right quiz answer and a finished chapter (Bootstrap green) */
  --tour-wrong: #b02a37;       /* the tutorial: a wrong quiz answer (Bootstrap red, darkened to read on white) */
  /* The tutorial's type sizes, by job. Words to read (bubble text, hints, quiz feedback) are the app's ordinary 1rem. */
  --tour-type-label: .857rem;  /* 12px: chapter name and step count, a chapter's details */
  --tour-type-title: 1.25rem;  /* 17.5px: a bubble's title, as a pop-up's title */
  --tour-type-heading: 1.15rem; /* 16px: the headings on Getting started */

  /* Shadows, tinted with the brand navy rather than black. Pick by what the thing is, not how strong it looks:
     resting = a section sitting on the page; raised = a card lifted off the page (sign-in, the website's form cards);
     showcase = something meant to stand out (website screenshots, the featured price plan). */
  --shadow-resting: 0 1px 3px rgb(8 71 111 / .08);
  --shadow-raised: 0 .5rem 1.5rem rgb(8 71 111 / .12);
  --shadow-showcase: 0 1rem 2.5rem rgb(8 71 111 / .18);

  --bs-primary: var(--brand-deep);
  --bs-primary-rgb: 8, 94, 156;
  --bs-link-color: var(--brand-deep);
  --bs-link-color-rgb: 8, 94, 156;
  --bs-link-hover-color: var(--brand-navy);
  --bs-link-hover-color-rgb: 8, 71, 111;
}

html { font-size: 14px; }

body {
  color: var(--text);
  background: var(--surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.btn-primary {
  --bs-btn-bg: var(--brand-deep);
  --bs-btn-border-color: var(--brand-deep);
  --bs-btn-hover-bg: var(--brand-navy);
  --bs-btn-hover-border-color: var(--brand-navy);
  --bs-btn-active-bg: var(--brand-navy);
  --bs-btn-active-border-color: var(--brand-navy);
  --bs-btn-disabled-bg: var(--brand-deep);
  --bs-btn-disabled-border-color: var(--brand-deep);
}

.form-control:focus, .form-select:focus, .form-check-input:focus, .btn:focus-visible {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 .2rem rgba(0, 157, 255, .3);
}
.form-check-input:checked {
  background-color: var(--brand-deep);
  border-color: var(--brand-deep);
}

/* Header: dark brand row with a blue glow, then the navy toolbar */
/* Light brand bar with the light logo, like the V1 login card; the navy toolbar sits underneath. */
.app-header { background: var(--surface); }

/* Skip link: hidden until a keyboard user tabs to it, so they can jump past the toolbar */
.skip-link {
  position: absolute; left: .5rem; top: -4rem; z-index: 2000;
  padding: .5rem 1rem; background: var(--brand-navy); color: var(--brand-tint); border-radius: .25rem;
  text-decoration: none;
}
.skip-link:focus { top: .5rem; color: var(--brand-tint); }
.app-main:focus { outline: none; }
.app-brand {
  padding: .4rem 1rem;
  border-bottom: 1px solid var(--border);
}
.app-brand a { display: inline-block; }
.app-logo {
  height: 44px;
  width: auto;
}

.app-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  background: var(--brand-navy);
  border-bottom: 3px solid var(--brand-bright);
  padding: 0 .5rem;
}
.app-toolbar a {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--on-brand);
  text-decoration: none;
  padding: .55rem .75rem;
  font-size: .95rem;
}
.app-toolbar a .bi { font-size: 1.3rem; }
.app-toolbar a:hover { background: var(--brand-deep); }
.app-toolbar a.active { background: var(--brand-blue); }
.app-toolbar-spacer { flex: 1; }

.app-main { flex: 1; }

.app-footer {
  background: var(--brand-tint);
  font-size: .8rem;
  padding: .4rem 1rem;
  color: var(--text-muted);
}

/* Page title strip */
.page-header {
  background: var(--brand-tint);
  border-bottom: 1px solid var(--brand-tint-strong);
  padding: .4rem 1rem;
}
.page-header h1 {
  font-size: 1.25rem;
  margin: 0;
  color: var(--brand-navy);
}
.page-body { padding: 1rem; }

/* Screens with a left-hand list (e.g. Lookups) */
.with-side-nav {
  display: grid;
  /* minmax(0, ...): a wide screen inside (the planning board) scrolls in its own box instead of pushing the page off the right edge */
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100%;
}
.side-nav {
  border-right: 1px solid var(--border);
  padding: .5rem 0;
}
.side-nav a {
  display: block;
  padding: .3rem 1rem;
  color: var(--text);
  text-decoration: none;
}
.side-nav a:hover { background: var(--brand-tint); }
.side-nav a.active { background: var(--brand-deep); color: var(--on-brand); }
.side-nav-heading { padding: .3rem 1rem; font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.side-nav a + .side-nav-heading { margin-top: .75rem; }

/* Reports: each report's name with its one-line description. */
.report-list { max-width: 64rem; border-top: 1px solid var(--border); }
.report-link {
  display: grid;
  grid-template-columns: minmax(12rem, 18rem) 1fr;
  gap: 1rem;
  padding: .45rem .5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.report-link:hover { background: var(--brand-tint); }
.report-title { color: var(--brand-deep); font-weight: 600; }
.report-description { color: var(--text-muted); }
@media (max-width: 700px) { .report-link { grid-template-columns: 1fr; gap: 0; } }

@media (max-width: 700px) {
  .with-side-nav { grid-template-columns: 1fr; }
  .side-nav { border-right: none; border-bottom: 1px solid var(--border); }
}

/* List screens: buttons above the grid */
.page-toolbar, .grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  margin-bottom: .5rem;
}
.grid-toolbar .btn-light {
  border: 1px solid var(--border);
  color: var(--brand-navy);
}
.grid-count {
  margin-left: auto;
  font-size: .85rem;
  color: var(--text-muted);
}
.grid-column-menu { max-height: 60vh; overflow-y: auto; }
.grid-column-menu .dropdown-item { cursor: pointer; }

/* The shared data grid (AG Grid), themed with the brand colours */
.grid-host {
  height: calc(100vh - 260px);
  min-height: 320px;
}
.ag-theme-quartz {
  --ag-font-family: inherit;
  --ag-font-size: 13px;
  --ag-foreground-color: var(--text);
  --ag-header-foreground-color: var(--brand-navy);
  --ag-header-background-color: var(--brand-tint);
  --ag-border-color: var(--border);
  --ag-row-hover-color: var(--brand-tint);
  --ag-selected-row-background-color: var(--brand-tint-strong);
  --ag-value-change-value-highlight-background-color: var(--brand-tint-strong);
  --ag-active-color: var(--brand-deep);
  --ag-checkbox-checked-color: var(--brand-deep);
  --ag-input-focus-border-color: var(--brand-blue);
  --ag-wrapper-border-radius: 4px;
}

.ag-theme-quartz .row-inactive .ag-cell {
  color: var(--text-muted);
  font-style: italic;
}

/* Record pages (a company, a person): title strip with buttons, tabs, fields on the left, photo on the right */
.record-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
.record-actions {
  margin-left: auto;
  display: flex;
  gap: .4rem;
}
.record-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.5rem;
  max-width: 1100px;
}
@media (max-width: 900px) {
  .record-grid { grid-template-columns: 1fr; }
}
.narrow-form { max-width: 640px; }

/* Record pages with class "record-body": white cards on a tinted page, so the sections stand apart.
   Each tab is one card unless it's marked "tab-sections", where it holds several "form-section" cards. */
.app-main:has(.record-body) { background: var(--page-bg); }
.record-body .nav-tabs { --bs-nav-tabs-border-color: var(--brand-deep); border-bottom-width: 2px; }
.record-body .nav-tabs .nav-link:hover { background: var(--brand-tint-strong); border-color: transparent; }
.record-body .nav-tabs .nav-link.active { background: var(--brand-deep); border-color: var(--brand-deep); color: var(--on-brand); }
.record-body .tab-content > .tab-pane:not(.tab-sections), .form-section, .record-facts {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .375rem;
  box-shadow: var(--shadow-resting);
}
.record-body .tab-content > .tab-pane:not(.tab-sections) { padding: 1rem; }
.form-section { padding: 0 1rem; margin-bottom: 1rem; }
.form-section > h2 {
  margin: 0 -1rem 1rem;
  padding: .5rem 1rem;
  background: var(--brand-tint);
  border-bottom: 1px solid var(--brand-tint-strong);
  border-radius: .375rem .375rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand-navy);
}
.form-section > h2 .bi { color: var(--brand-deep); margin-right: .25rem; }
.section-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1rem;
  align-items: start;
  max-width: 1600px;
}
@media (max-width: 1100px) { .section-columns { grid-template-columns: minmax(0, 1fr); } }
/* A card that spans both columns, e.g. a shift pattern's cycle */
.section-wide { grid-column: 1 / -1; }
/* The card already draws the box round a photo */
.form-section .photo-card { border: 0; padding: 0; }
/* Labels stand out from what's typed in the boxes */
.record-body .form-label { font-weight: 600; color: var(--brand-navy); margin-bottom: .2rem; }
.record-body .form-control, .record-body .form-select { border-color: var(--field-border); }
.record-body .input-group-text { background: var(--brand-tint); border-color: var(--field-border); color: var(--brand-navy); }
/* Read-only facts across the top of a record, e.g. who raised a work order */
.record-facts { display: flex; flex-wrap: wrap; gap: .5rem 2.5rem; max-width: 1600px; padding: .6rem 1rem; margin-bottom: 1rem; background: var(--brand-tint); border: 1px solid var(--brand-tint-strong); border-radius: .375rem; }
.record-facts dt { font-size: .8rem; font-weight: 400; color: var(--text-muted); }
.record-facts dd { margin: 0; font-weight: 600; }

fieldset:disabled .form-control, fieldset:disabled .form-select { background-color: var(--surface); }

.photo-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .75rem;
  margin-bottom: 1rem;
}
.photo-card img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  margin-bottom: .5rem;
}
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 160px;
  background: var(--brand-tint);
  color: var(--text-muted);
  border-radius: 4px;
  margin-bottom: .5rem;
}
.photo-placeholder .bi { font-size: 2.5rem; }
.contact-types legend { margin-bottom: .25rem; }

.grid-host.grid-short, .grid-short .grid-host { height: 360px; min-height: 0; }

/* The validation summary takes no space until there are errors to show */
.validation-summary-valid { display: none; }

/* Locations screen: tree on the left, selected location on the right */
.locations-page {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  min-height: 100%;
}
.location-tree-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 140px);
}
.location-tree-tools { padding: .6rem .75rem .4rem; border-bottom: 1px solid var(--border); }
.location-tree {
  flex: 1;
  overflow: auto;
  max-height: calc(100vh - 290px);
  padding: .3rem 0;
}
@media (max-width: 800px) {
  .locations-page { grid-template-columns: 1fr; }
  .location-tree-panel { border-right: none; border-bottom: 1px solid var(--border); min-height: 0; }
  .location-tree { max-height: 50vh; }
}

/* The same tree beside a list, as a filter: narrower, so the list keeps the room */
@media (min-width: 801px) {
  .tree-filter-page { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
}

.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { padding-left: 1.1rem; }
.tree-row {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .15rem .5rem;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.tree-row:hover { background: var(--brand-tint); }
.tree-row.selected { background: var(--brand-deep); color: var(--on-brand); }
.tree-row.selected .tree-code, .tree-row.selected .tree-icon { color: var(--on-brand); }
.tree-row.inactive .tree-label { color: var(--text-muted); font-style: italic; }
.tree-row.selected.inactive .tree-label { color: var(--on-brand); }
.tree-toggle {
  border: 0;
  background: none;
  width: 1.2rem;
  padding: 0;
  color: inherit;
  font-size: .75rem;
}
.tree-toggle:disabled { visibility: hidden; }
.tree-icon { color: var(--brand-deep); }
.tree-code { color: var(--text-muted); font-size: .8rem; }

.location-detail-header h1 { display: flex; align-items: center; gap: .5rem; }
.location-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 4rem 1rem;
}
.location-empty .bi { font-size: 3rem; color: var(--brand-tint-strong); }
/* "What the icons mean", folded under the tree */
.location-icons { border-top: 1px solid var(--border); padding: .4rem .75rem; font-size: .85rem; color: var(--text-muted); }
.location-icons summary { cursor: pointer; }
.location-icons ul { columns: 2; list-style: none; padding: 0; margin: .4rem 0; color: var(--bs-body-color); }
.location-icons li { padding: .1rem 0; break-inside: avoid; }
.location-icons .bi { color: var(--brand-deep); width: 1.4rem; display: inline-block; }

.detail-list {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: .35rem 1rem;
  max-width: 800px;
}
.detail-list dt { font-weight: 400; color: var(--text-muted); }
.detail-list dd { margin: 0; }
.text-pre-wrap { white-space: pre-wrap; }

.icon-picker { display: flex; flex-wrap: wrap; gap: .25rem; }
.icon-picker .btn { width: 2.2rem; border: 1px solid var(--border); color: var(--brand-deep); }

/* Job title form: permissions in groups, laid out in columns */
.permission-groups {
  columns: 2;
  column-gap: 1.5rem;
}
.permission-group {
  break-inside: avoid;
  margin-bottom: .9rem;
}
.permission-group legend {
  font-size: .9rem;
  font-weight: 600;
  color: var(--brand-navy);
  margin-bottom: .2rem;
}
.permission-group-links {
  font-weight: 400;
  font-size: .8rem;
  color: var(--text-muted);
  margin-left: .4rem;
}
.permission-group-links .btn-link { font-size: .8rem; vertical-align: baseline; }
@media (max-width: 700px) {
  .permission-groups { columns: 1; }
}

/* Tick boxes laid out in columns (e.g. fault causes) */
.check-columns {
  columns: 2;
  column-gap: 1rem;
}
@media (max-width: 500px) {
  .check-columns { columns: 1; }
}

/* Tables */
.data-table thead th {
  font-size: .85rem;
  color: var(--brand-navy);
  border-bottom: 2px solid var(--brand-blue);
}
.data-table tbody td { color: var(--text); }
.data-table tbody tr:hover > td { background: var(--brand-tint); }
.data-table tbody tr.selected > td { background: var(--brand-deep); color: var(--on-brand); }

/* Login and error pages: copied from the V1 login (Reference material/V1/Untitled.jpg) */
.plain-body {
  background: var(--page-bg);
  align-items: center;
  justify-content: center;
  padding: 2.5rem 0;
}
.plain-card {
  background: var(--surface);
  width: min(440px, calc(100% - 32px));
  padding: 2.5rem 2.25rem 2.25rem;
  border-top: 4px solid var(--brand-deep);
  border-radius: 4px;
  box-shadow: var(--shadow-raised);
}
.plain-logo {
  display: block;
  height: 64px;
  width: auto;
  margin: 0 auto 1.5rem;
}
.plain-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 300;
  color: var(--brand-deep);
  margin-bottom: 1.5rem;
}
.plain-card .form-label {
  color: var(--text-muted);
  margin-bottom: .25rem;
}
.plain-card .form-control {
  border-radius: 2px;
  border-color: var(--border);
  border-bottom: 2px solid var(--text-muted);
  padding: .5rem .6rem;
}
.plain-card .form-control:focus {
  border-bottom-color: var(--brand-deep);
}
.plain-version {
  margin-top: 1.25rem;
  font-size: .85rem;
  color: var(--text-muted);
}

/* "*" after the label of a required field (add class "required" to the label) */
.form-label.required::after {
  content: " *";
  color: var(--brand-deep);
  font-weight: 600;
}

/* ---- Scheduler (Views/Scheduler, wwwroot/js/scheduler.js) ---- */
.scheduler-grid { height: calc(100vh - 250px); min-height: 360px; }
.scheduler-grid .ag-cell.sched-week { padding: 0; border-left: 1px solid var(--border); }
.scheduler-grid .sched-week-header { padding: 0 2px; }
.scheduler-grid .sched-week-header .ag-header-cell-label { justify-content: center; }
.scheduler-grid .sched-month .ag-header-group-cell-label { justify-content: center; }
.sched-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 1.6rem;
  font-weight: 600;
}
.sched-cell[draggable="true"] { cursor: grab; }
.sched-cell .bi { font-size: .85rem; line-height: 1; }
/* Marks (drawn from MARKS in scheduler.js): a dot for due, the count when several are due, a dash for suppressed */
.sched-x { color: var(--brand-blue); }
.sched-x .bi { font-size: .5rem; }
.sched-m { color: var(--brand-navy); font-size: 11px; }
.scheduler-grid .sched-m { margin: 5px 6px; height: auto; border-radius: 999px; background-color: var(--brand-tint); }
.sched-s { color: var(--text-muted); font-weight: 400; }
/* Work order marks: open, on hold, signed off, not done */
.sched-w { color: var(--bs-success); }
.sched-h { color: var(--brand-blue); }
.sched-c { color: var(--text-muted); }
.sched-n { color: var(--bs-danger-text-emphasis); }
.sched-has-wo { cursor: pointer; }
.sched-now { background-color: var(--this-week); }
.sched-drop { outline: 2px dashed var(--brand-blue); outline-offset: -2px; }
.sched-usage-tag { color: var(--brand-deep); margin-left: .3rem; }
.ag-row-pinned .sched-cell { color: var(--brand-navy); font-weight: 600; font-size: 12px; }
.ag-row-pinned { background-color: var(--brand-tint); }
.scheduler-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; width: 100%; }
.scheduler-filters .form-select { width: auto; max-width: 18rem; }
.scheduler-legend { min-width: 20rem; font-size: .875rem; }
.scheduler-legend > div { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.scheduler-legend .sched-cell { display: inline-flex; width: 1.6rem; height: 1.4rem; border: 1px solid var(--border); }

/* ---- Rota (Views/Rota, wwwroot/js/rota.js) ---- */
.rota-grid { height: calc(100vh - 260px); min-height: 360px; }
.rota-grid .ag-cell.rota-day { padding: 0; border-left: 1px solid var(--border); }
.rota-grid .rota-day-header { padding: 0 2px; }
.rota-grid .rota-day-header .ag-header-cell-label { justify-content: center; }
.rota-grid .rota-weekend { background-color: var(--brand-tint); }
.rota-grid .rota-today { background-color: var(--this-week); }
.rota-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
}
.rota-editable { cursor: pointer; }
.rota-editable:hover { outline: 2px solid var(--brand-blue); outline-offset: -2px; }
.shift-blue { background-color: var(--shift-blue); }
.shift-green { background-color: var(--shift-green); }
.shift-purple { background-color: var(--shift-purple); }
.shift-orange { background-color: var(--shift-orange); }
.shift-teal { background-color: var(--shift-teal); }
.shift-grey { background-color: var(--shift-grey); }
.rota-absent { background-color: var(--absence); color: var(--bs-danger-text-emphasis); font-size: 10px; font-weight: 400; }
.rota-holiday { background-color: var(--holiday); color: var(--holiday-text); }
/* A small corner mark where the day differs from the pattern */
.rota-changed::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-top: 7px solid var(--brand-deep);
  border-left: 7px solid transparent;
}
.rota-warning { background-color: var(--absence); color: var(--bs-danger-text-emphasis); }
.rota-grid .ag-row-pinned { background-color: var(--brand-tint); }

/* ---- Shift pattern cycle builder (Views/ShiftPatterns/Edit) ---- */
.pattern-cycle {
  display: grid;
  grid-template-columns: repeat(7, minmax(8.5rem, 1fr));
  gap: .5rem;
  max-width: 75rem;
}
.pattern-day { border: 1px solid var(--border); border-radius: 4px; padding: .35rem; background: var(--bs-body-bg); }
.pattern-day-label { font-size: 12px; margin-bottom: .2rem; }

/* ---- Work orders (Views/WorkOrders) ---- */
.wo-list { display: flex; gap: 1rem; align-items: flex-start; }
.wo-list-main { flex: 1; min-width: 0; }
.wo-summary { width: 14rem; flex-shrink: 0; }
.wo-summary .list-group-item { padding: .3rem .6rem; }
.wo-summary .list-group-item.active { background-color: var(--brand-deep); border-color: var(--brand-deep); }
.wo-legend { list-style: none; padding: 0; }
.wo-legend li { margin-bottom: .2rem; }
/* Row colours, matching the legend: worst first */
.ag-row.wo-request-critical .ag-cell, .wo-legend .wo-request-critical { color: var(--bs-danger-text-emphasis); font-weight: 600; font-style: italic; }
.ag-row.wo-request .ag-cell, .wo-legend .wo-request { color: var(--brand-blue); font-style: italic; }
.ag-row.wo-late .ag-cell, .wo-legend .wo-late { color: var(--bs-danger-text-emphasis); font-weight: 600; }
.ag-row.wo-overdue .ag-cell, .wo-legend .wo-overdue { color: var(--bs-danger-text-emphasis); }
.ag-row.wo-pending .ag-cell, .wo-legend .wo-pending { color: var(--bs-warning-text-emphasis); }
.ag-row.wo-due .ag-cell, .wo-legend .wo-due { color: var(--bs-success-text-emphasis); }
.ag-row.wo-onhold .ag-cell, .wo-legend .wo-onhold { color: var(--brand-blue); }
.ag-row.wo-new .ag-cell, .wo-legend .wo-new { color: var(--brand-deep); font-weight: 600; }
.ag-row.wo-closed .ag-cell, .wo-legend .wo-closed { color: var(--text-muted); }
@media (max-width: 992px) { .wo-list { flex-direction: column; } .wo-summary { width: 100%; } }

/* ---- Pop-ups (wwwroot/js/modal.js) ---- */
/* Bootstrap only scrolls a pop-up's body when it sits straight inside .modal-content, but ours are wrapped in a form. Without this
   the bottom of a tall form is cut off with no scrollbar. The form takes on the same layout, so the heading and buttons stay put. */
.modal-dialog-scrollable .modal-content > form { display: flex; flex-direction: column; min-height: 0; }

/* ---- Work order checklist pop-up (Views/WorkOrders/_Checklist) ---- */
.checklist-form { max-height: 70vh; overflow-y: auto; }
.checklist-step { border-bottom: 1px solid var(--border); padding: .6rem 0; }
.checklist-step:last-child { border-bottom: 0; }
.checklist-result { white-space: nowrap; font-weight: 600; font-size: .875rem; }
.progress { --bs-progress-bar-bg: var(--brand-deep); }

/* Meter routes: one row per meter with its place in the reading order. */
.route-stops { max-height: 22rem; overflow-y: auto; border: 1px solid var(--bs-border-color); border-radius: .375rem; padding: .5rem; }
.route-stop { display: flex; align-items: center; gap: .75rem; padding: .25rem 0; }
.route-stop input { width: 5rem; }

/* Signature box on the sign-off form (site.js setUpSignatures). touch-action stops the page scrolling while signing. */
.signature-pad { display: block; width: 100%; height: 120px; border: 1px dashed var(--border); border-radius: .375rem;
  background: var(--surface); touch-action: none; cursor: crosshair; }

/* LOTO screen: summary counts above the tabs. Red for what is isolated now (Bootstrap danger: a safety state, not a brand colour). */
.loto-summary { display: flex; flex-wrap: wrap; gap: .5rem; }
.loto-chip { border: 1px solid var(--border); border-radius: 999px; padding: .2rem .75rem; font-size: .875rem; background: var(--surface); }
.loto-chip strong { font-size: 1rem; margin-right: .15rem; }
.loto-applied, .loto-inuse { border-color: var(--bs-danger-border-subtle); background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.loto-lost, .loto-exception { border-color: var(--bs-warning-border-subtle); background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.loto-free { color: var(--text-muted); }

/* My shifts and holiday: balance cards; holiday requests waiting for a decision stand out. */
.holiday-balances { display: flex; flex-wrap: wrap; gap: 1rem; }
.holiday-balance { border: 1px solid var(--border); border-radius: .375rem; padding: .6rem 1rem; min-width: 16rem; background: var(--surface); }
.holiday-balance-title { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.holiday-balance-left strong { font-size: 1.6rem; color: var(--brand-navy); }
.ag-row.holiday-waiting .ag-cell { font-weight: 600; }
.rota-grid-mine { height: 180px; }
.checklist-subject { font-size: .95rem; font-weight: 600; color: var(--brand-navy); background: var(--brand-tint); padding: .35rem .5rem; margin: .75rem 0 0; border-radius: .25rem; }

/* ---- Planning board (wwwroot/js/planning-board.js) ---- */
.plan-layout { display: flex; gap: 1rem; align-items: flex-start; }
.plan-board { flex: 1; min-width: 0; overflow-x: auto; border: 1px solid var(--border); border-radius: .375rem; background: var(--surface); }
.plan-unplanned { width: 300px; flex-shrink: 0; max-height: calc(100vh - 230px); overflow-y: auto; border: 1px solid var(--border); border-radius: .375rem; padding: .6rem; background: var(--brand-tint); }
.plan-unplanned.plan-drop { outline: 2px dashed var(--brand-blue); }
@media (max-width: 992px) { .plan-layout { flex-direction: column; } .plan-unplanned { width: 100%; max-height: none; } }

/* Day: a 24-hour lane per person */
.plan-day { min-width: 900px; }
.plan-row { display: flex; border-bottom: 1px solid var(--border); min-height: 48px; }
.plan-head { min-height: 26px; background: var(--brand-tint); position: sticky; top: 0; z-index: 2; }
.plan-name { width: 180px; flex-shrink: 0; padding: .3rem .5rem; border-right: 1px solid var(--border); font-size: .85rem; }
.plan-line { position: relative; flex: 1; background-image: repeating-linear-gradient(to right, var(--border) 0 1px, transparent 1px calc(100% / 24)); }
.plan-line.plan-drop, td.plan-drop { outline: 2px dashed var(--brand-blue); outline-offset: -2px; }
.plan-tick { position: absolute; top: 4px; font-size: .7rem; color: var(--text-muted); padding-left: 3px; }
.plan-shift { position: absolute; top: 4px; height: 16px; font-size: .7rem; line-height: 16px; padding: 0 4px; border-radius: 3px; overflow: hidden; white-space: nowrap; color: var(--text); }
.plan-absence { position: absolute; inset: 2px 0; background: var(--absence); color: var(--bs-danger-text-emphasis); font-size: .8rem; padding: 0 .5rem; display: flex; align-items: center; opacity: .9; }
.plan-work { position: absolute; top: 22px; height: 22px; background: var(--brand-deep); color: var(--on-brand); font-size: .75rem; line-height: 22px; padding: 0 4px; border-radius: 3px; overflow: hidden; white-space: nowrap; cursor: grab; z-index: 1; }
.plan-work:hover, .plan-chip:hover, .plan-card:hover { outline: 2px solid var(--brand-bright); }

/* Week: people by days */
.plan-week-wrap { overflow-x: auto; }
.plan-week { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 900px; }
.plan-week th, .plan-week td { border: 1px solid var(--border); padding: .3rem; vertical-align: top; }
.plan-week thead th { background: var(--brand-tint); text-align: center; cursor: pointer; white-space: nowrap; }
.plan-week th.plan-name { width: 160px; background: var(--surface); text-align: left; }
.plan-cell-head { font-weight: 600; }
.plan-rest { color: var(--text-muted); }
.plan-absent-cell { background: var(--absence); color: var(--bs-danger-text-emphasis); }
/* Holiday on the planning board: after .plan-absence so its colours win. */
.plan-holiday { background: var(--holiday); color: var(--holiday-text); }
.plan-total th, .plan-total td { background: var(--brand-tint); font-weight: 600; text-align: center; }
.plan-chip { background: var(--brand-deep); color: var(--on-brand); border-radius: 3px; padding: 1px 4px; margin-top: 2px; font-size: .75rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: grab; max-width: 150px; }
.plan-today { background: var(--this-week) !important; }
.plan-bank { box-shadow: inset 0 -3px 0 var(--bs-danger); }

/* Year: a small calendar per month, days shaded by how many are on shift */
.plan-year { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; padding: .75rem; }
.plan-month-name { font-weight: 600; color: var(--brand-navy); margin-bottom: .25rem; }
.plan-month-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.plan-yday { --on: 0; aspect-ratio: 1; border: 0; border-radius: 3px; font-size: .7rem; padding: 0;
  background: color-mix(in srgb, var(--brand-blue) calc(var(--on) * 85%), #f4f7fa); color: var(--text); }
.plan-yday:hover { outline: 2px solid var(--brand-navy); }
.plan-yday-blank { background: transparent; }

/* To plan */
.plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: .25rem; padding: .35rem .5rem; margin-bottom: .4rem; font-size: .85rem; cursor: grab; }
/* Suggest: the best people for one "To plan" card, under it */
.plan-suggest-btn { padding: 0 .4rem; font-size: .8rem; margin-top: .25rem; }
.plan-suggest { border-top: 1px solid var(--border); margin-top: .35rem; padding-top: .35rem; cursor: default; }
.plan-suggest-person { display: flex; gap: .4rem; align-items: flex-start; padding: .25rem 0; }
.plan-suggest-person + .plan-suggest-person { border-top: 1px dashed var(--border); }
.plan-suggest-person > div { flex: 1; min-width: 0; }

/* ---- Dashboard (Views/Home/Index): tiles, two charts, my work. Status colours as on the work order list. ---- */
.dash-tiles { display: flex; flex-wrap: wrap; gap: .75rem; }
.dash-tile { display: block; min-width: 9.5rem; padding: .6rem .9rem; border-radius: .375rem; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; }
.dash-tile:hover { outline: 2px solid var(--brand-blue); color: var(--text); }
.dash-tile-count { font-size: 1.8rem; font-weight: 600; line-height: 1.1; color: var(--brand-navy); }
.dash-tile-label { font-size: .85rem; color: var(--text-muted); }
.dash-late, .dash-overdue, .dash-isolated { border-color: var(--bs-danger-border-subtle); background: var(--bs-danger-bg-subtle); }
.dash-late .dash-tile-count, .dash-overdue .dash-tile-count, .dash-isolated .dash-tile-count { color: var(--bs-danger-text-emphasis); }
.dash-pending, .dash-holiday { border-color: var(--bs-warning-border-subtle); background: var(--bs-warning-bg-subtle); }
.dash-due { border-color: var(--bs-success-border-subtle); background: var(--bs-success-bg-subtle); }
.dash-zero .dash-tile-count { color: var(--text-muted); }
/* Nothing to act on: back to a plain tile, so the coloured ones are the ones that need attention. */
.dash-tile.dash-zero { background: var(--surface); border-color: var(--border); }
.dash-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; }
.dash-charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.dash-card { border: 1px solid var(--border); border-radius: .375rem; background: var(--surface); padding: .6rem; }
.dash-card-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.dash-chart { position: relative; height: 300px; }
@media (max-width: 1200px) { .dash-layout, .dash-charts { grid-template-columns: minmax(0, 1fr); } }

/* Stock takes: the count form (one row per bin and part) and differences on the review. */
.count-lines { max-height: 60vh; overflow-y: auto; }
.count-line { display: flex; align-items: center; gap: .75rem; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.count-bin { width: 5.5rem; font-weight: 600; color: var(--brand-navy); }
.count-part { flex: 1; min-width: 0; }
.count-box { width: 9rem; }
.ag-row.take-variance .ag-cell { color: var(--bs-warning-text-emphasis); font-weight: 600; }
/* Expired batches on a perishable part's Expiry dates tab. */
.ag-row.row-expired .ag-cell { color: var(--bs-danger-text-emphasis); }
/* Serial numbers to tick on stock forms: a scrolling list, as there can be hundreds. */
.serial-ticks { max-height: 14rem; overflow-y: auto; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); padding: .4rem .75rem; columns: 2; }
/* Boxes filled in for you (e.g. a quantity set by the serial numbers ticked) look different from ones to type in. */
.form-control[readonly] { background-color: var(--bs-secondary-bg); }

/* ---- Wallboard: full-screen TV display (Views/Wallboards/Show.cshtml), dark so it reads from across a room ---- */
body.wallboard {
  background: var(--brand-ink);
  color: var(--on-brand);
  min-height: 100vh;
  padding: 1.25rem 1.5rem;
  font-size: 1.15rem;
}
.wallboard-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 3px solid var(--brand-blue);
  padding-bottom: .75rem;
}
.wallboard-header h1 { margin: 0; font-size: 2.2rem; font-weight: 700; }
.wallboard-logo { height: 3.5rem; }
.wallboard-subtitle { color: var(--brand-tint-strong); font-size: 1rem; }
.wallboard-clock { margin-left: auto; text-align: right; font-size: 1.6rem; font-weight: 600; }
.wallboard-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.wallboard-count {
  background: var(--brand-navy);
  border-left: .5rem solid var(--brand-blue);
  border-radius: .5rem;
  padding: .75rem 1rem;
}
.wallboard-count.tone-danger { border-left-color: var(--bs-danger); }
.wallboard-count.tone-danger .wallboard-count-value { color: var(--danger-on-dark); }
.wallboard-count.tone-warning { border-left-color: var(--bs-warning); }
.wallboard-count.tone-success { border-left-color: var(--bs-success); }
.wallboard-count-value { font-size: 3.2rem; font-weight: 700; line-height: 1.1; }
.wallboard-count-title { color: var(--brand-tint-strong); font-size: 1.05rem; }
.wallboard-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(32rem, 1fr));
  gap: 1rem;
}
.wallboard-panel {
  background: var(--brand-navy);
  border-radius: .5rem;
  padding: .75rem 1rem;
  overflow: hidden;
}
.wallboard-panel h2 { font-size: 1.3rem; font-weight: 700; color: var(--brand-bright); margin-bottom: .5rem; }
.wallboard-table { width: 100%; border-collapse: collapse; }
.wallboard-table th { color: var(--brand-tint-strong); font-weight: 600; font-size: .95rem; padding: .25rem .4rem; text-align: left; }
.wallboard-table td { padding: .35rem .4rem; border-top: 1px solid rgba(255, 255, 255, .1); }
.wallboard-empty { color: var(--brand-tint-strong); padding: 1rem 0; }
.wallboard-chart { position: relative; height: 18rem; }
@media (max-width: 700px) { .wallboard-panels { grid-template-columns: 1fr; } }

/* Risk assessment builder: one card per hazard */
.risk-builder { max-width: 1000px; }
/* The assessment page lays itself out in cards, so only the work order's copy is held narrow */
fieldset.risk-builder { max-width: none; }
.risk-builder:disabled .form-label.required::after { content: none; }
.risk-hazard { border: 1px solid var(--border); border-radius: .375rem; padding: .75rem; margin-bottom: .75rem; }
.risk-hazard-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.risk-hazard-heading h3 { font-size: .95rem; font-weight: 600; color: var(--brand-navy); margin: 0; }
.risk-hazard-tools { display: flex; gap: .25rem; }
.risk-score-row { display: flex; align-items: center; gap: .4rem; }
.risk-score-row .form-select { min-width: 0; }
.risk-on-task { max-width: 800px; }
.risk-document { margin-bottom: 1.5rem; }
.risk-document-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; background: var(--brand-tint); padding: .4rem .6rem; border-radius: .25rem; margin-bottom: .5rem; }
.risk-pick-list { max-height: 22rem; overflow-y: auto; }

/* Help (Views/Help, Docs/Help-Plan.md): menu and search on the left, the article, and "On this page" on the right. */
.modal-help { padding: 0 .4rem; margin-left: auto; color: var(--brand-deep); font-size: 1.15rem; line-height: 1; }
.modal-help + .btn-close { margin-left: .25rem; }
.help-nav { position: relative; }
.help-search { position: relative; padding: 0 .75rem .5rem; }
.help-suggestions { position: absolute; left: .75rem; right: -18rem; top: 100%; z-index: 20; box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .12); }
.help-suggestion-title { color: var(--brand-deep); font-weight: 600; }
.help-breadcrumb { color: var(--text-muted); font-weight: normal; }
.help-body { max-width: 78rem; }
.help-lead { font-size: 1.1rem; color: var(--text-muted); }
.help-layout { display: grid; grid-template-columns: minmax(0, 52rem) 14rem; gap: 2rem; align-items: start; }
.help-article { line-height: 1.6; min-width: 0; }
.help-article h2 { font-size: 1.3rem; color: var(--brand-navy); margin-top: 1.75rem; padding-bottom: .25rem; border-bottom: 1px solid var(--border); scroll-margin-top: 1rem; }
.help-article h3 { font-size: 1.1rem; color: var(--brand-navy); margin-top: 1.25rem; scroll-margin-top: 1rem; }
.help-article img { max-width: 100%; border: 1px solid var(--border); border-radius: .25rem; margin: .5rem 0; }
.help-article table { width: 100%; margin: .75rem 0; border-collapse: collapse; }
.help-article th { background: var(--brand-tint); color: var(--brand-navy); }
.help-article th, .help-article td { border: 1px solid var(--border); padding: .35rem .55rem; vertical-align: top; }
.help-article kbd { background: var(--brand-navy); }
.help-article :target { background: var(--brand-tint); }
.help-who { display: flex; gap: .6rem; background: var(--brand-tint); border: 1px solid var(--brand-tint-strong); border-radius: .25rem; padding: .5rem .75rem; margin-bottom: 1rem; }
.help-who > .bi { color: var(--brand-deep); font-size: 1.2rem; }
.help-who ul { margin: .25rem 0; }
/* Boxes written in an article as "::: tip", "::: note" or "::: warning" ... ":::" */
.help-article .tip, .help-article .note, .help-article .warning { border: 1px solid; padding: .5rem .75rem; margin: .75rem 0; border-radius: .25rem; }
.help-article .tip { border-color: var(--bs-success-border-subtle); background: var(--bs-success-bg-subtle); }
.help-article .note { border-color: var(--brand-tint-strong); background: var(--brand-tint); }
.help-article .warning { border-color: var(--bs-warning-border-subtle); background: var(--bs-warning-bg-subtle); }
.help-article .tip > :last-child, .help-article .note > :last-child, .help-article .warning > :last-child { margin-bottom: 0; }
.help-toc { position: sticky; top: 1rem; border-left: 1px solid var(--border); }
.help-toc a { display: block; padding: .2rem 1rem; color: var(--text); text-decoration: none; font-size: .9rem; }
.help-toc a:hover { background: var(--brand-tint); }
.help-prev-next { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.help-contents { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: 1rem 2rem; }
.help-contents h2 { font-size: 1.1rem; color: var(--brand-navy); border-bottom: 1px solid var(--border); padding-bottom: .25rem; }
.help-contents ul { padding-left: 1.1rem; }
.help-results { max-width: 52rem; border-top: 1px solid var(--border); }
.help-result { display: block; padding: .5rem; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.help-result:hover { background: var(--brand-tint); }
.help-result-title { display: block; color: var(--brand-deep); font-weight: 600; }
.help-result-section { display: block; font-size: .8rem; color: var(--text-muted); }
.help-result-snippet { display: block; font-size: .9rem; }
@media (max-width: 1000px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-toc { display: none; }
  .help-suggestions { right: .75rem; }
}
/* ---- Motion: quick colour fades so hover and active states feel connected; nothing moves or slides. ---- */
.app-toolbar a, .side-nav a, .tree-row, .dash-tile, .dropdown-item {
  transition: background-color .12s ease-out, color .12s ease-out, outline-color .12s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .app-toolbar a, .side-nav a, .tree-row, .dash-tile, .dropdown-item { transition: none; }
}

/* ---- Adapting to tablets and phones (desktop mouse use is unchanged) ---- */

/* Tablet widths: the toolbar's 12+ buttons wrap to two rows, so tighten them to keep it to about two. */
@media (max-width: 1100px) {
  .app-toolbar a { padding: .5rem .55rem; font-size: .9rem; }
}

/* Phone widths: icons only in the toolbar (the words stay for screen readers and as tooltips), a smaller logo, less padding. */
@media (max-width: 700px) {
  .app-toolbar a > span {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .app-toolbar a { padding: .6rem .7rem; }
  .app-toolbar-spacer { display: none; }
  .app-logo { height: 36px; }
  .page-body { padding: .75rem .5rem; }
  .app-toolbar .dropdown-menu { max-width: calc(100vw - 1rem); }
}

/* Touch screens (any width): finger-sized targets (44px) and 16px inputs, so iOS doesn't zoom in when a box is tapped. */
@media (pointer: coarse) {
  .app-toolbar a, .app-toolbar .dropdown > a { min-height: 44px; min-width: 44px; justify-content: center; }
  .btn, .btn-sm { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
  .btn-sm { padding-left: .75rem; padding-right: .75rem; }
  .form-control, .form-select { min-height: 44px; font-size: 1rem; }
  .form-check-input { width: 1.4em; height: 1.4em; }
  .dropdown-item, .side-nav a { padding-top: .6rem; padding-bottom: .6rem; }
  .tree-row { padding-top: .45rem; padding-bottom: .45rem; }
  .ag-theme-quartz { --ag-row-height: 44px; --ag-header-height: 44px; }
}

@media print {
  .skip-link, .app-header, .app-footer, .help-nav, .help-toc, .help-prev-next, .record-actions { display: none !important; }
  .with-side-nav.help-page { display: block; }
  .help-layout { display: block; }
}

/* ---- Platform admin (hosted service, Areas/Admin) ---- */
/* A label beside the logo, so the service's own screens are never mistaken for a company's. */
.app-brand:has(.platform-badge) { display: flex; align-items: center; gap: .9rem; }
.platform-badge {
  padding: .2rem .6rem; border-radius: 999px; background: var(--brand-navy); color: var(--on-brand);
  font-size: .8rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
}
.platform-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; color: var(--text-muted); font-size: .9rem; }
/* Go-live checks: one line per check, its icon on the left. */
.golive-list { list-style: none; margin: 0; padding: 0; }
.golive-list li { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem 0; border-top: 1px solid var(--border); }
.golive-list li:first-child { border-top: 0; }
.golive-list > li > .bi { font-size: 1.1rem; line-height: 1.3; flex: none; }
/* The authenticator QR code needs a white background and a quiet border to scan, whatever the page colour. */
.platform-qr { display: inline-block; width: 200px; padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: .375rem; }
.platform-qr svg { display: block; width: 100%; height: auto; }
.platform-secret { font-family: var(--bs-font-monospace); font-size: 1rem; letter-spacing: .05em; user-select: all; }

/* ---- The company's account on the hosted service (Settings > Subscription, and the banner under the header) ---- */
.account-banner { margin: 0; border-radius: 0; border-left: 0; border-right: 0; padding: .5rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.account-banner .btn { margin-left: auto; }
.subscription-facts { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.25rem; margin-bottom: 1rem; }
.subscription-facts dt { font-weight: 600; color: var(--text-muted); }
.subscription-facts dd { margin: 0; }
.subscription-meter { height: .5rem; max-width: 18rem; margin-top: .3rem; }
.plan-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .75rem; }
.plan-option {
  display: flex; flex-direction: column; gap: .15rem; padding: .75rem 1rem .75rem 2.4rem; position: relative; cursor: pointer;
  border: 1px solid var(--field-border); border-radius: .5rem; background: var(--surface);
}
.plan-option input { position: absolute; left: .9rem; top: 1rem; }
.plan-option:has(input:checked) { border: 2px solid var(--brand-deep); background: var(--brand-tint); padding-left: calc(2.4rem - 1px); }
.plan-option-name { font-weight: 700; color: var(--brand-navy); }
.plan-option-price { font-size: 1.1rem; }
.plan-option-detail { font-size: .85rem; color: var(--text-muted); }
@media (max-width: 575.98px) {
  .subscription-facts { grid-template-columns: 1fr; gap: .15rem; }
  .subscription-facts dd { margin-bottom: .5rem; }
}

/* ---- Notifications: the bell in the toolbar (wwwroot/js/notifications.js) and the list ---- */
.app-toolbar .bell-toggle { position: relative; }
.bell-count {
  position: absolute; top: .25rem; left: 1.55rem; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 1rem;
  background: var(--bs-danger); color: var(--on-brand); font-size: .7rem; font-weight: 700; line-height: 1.15rem; text-align: center;
}
.bell-menu { width: 22rem; padding: 0; overflow: hidden; }
.bell-head, .bell-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem .75rem; }
.bell-head { border-bottom: 1px solid var(--border); color: var(--brand-navy); }
.bell-foot { border-top: 1px solid var(--border); background: var(--brand-tint); }
.bell-items { max-height: 22rem; overflow-y: auto; }
.app-toolbar .bell-menu a { color: var(--brand-deep); padding: 0; display: inline; }
.app-toolbar .bell-menu a:hover { background: none; text-decoration: underline; }
.app-toolbar .bell-menu .bell-item {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: .1rem; padding: .5rem .75rem; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.app-toolbar .bell-menu .bell-item:hover { background: var(--brand-tint); text-decoration: none; }
.bell-item.unread { border-left: 3px solid var(--brand-deep); padding-left: calc(.75rem - 3px); }
.bell-item.unread .bell-title { font-weight: 600; }
.bell-title { font-size: .9rem; }
.bell-when { font-size: .78rem; color: var(--text-muted); }
.bell-empty { padding: 1rem .75rem; color: var(--text-muted); font-size: .9rem; }
.row-unread { font-weight: 600; }
.notification-choices th { color: var(--brand-navy); white-space: nowrap; }
.notification-choices td:nth-child(2), .notification-choices td:nth-child(3) { width: 8rem; }
@media (max-width: 700px) {
  .bell-count { left: 1.4rem; }
  .bell-menu { width: calc(100vw - 1rem); }
}

/* ---- Photos on a record (wwwroot/js/photos.js): thumbnails above the documents list ---- */
.photo-strip { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.photo-strip a { display: block; width: 7.5rem; height: 7.5rem; border: 1px solid var(--field-border); border-radius: .375rem; overflow: hidden; background: var(--page-bg); }
.photo-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-strip a:hover, .photo-strip a:focus-visible { border-color: var(--brand-deep); outline: 2px solid var(--brand-bright); outline-offset: 1px; }
label.btn.disabled { pointer-events: none; opacity: .65; }
@media (max-width: 700px) {
  .photo-strip a { width: calc(33.333% - .34rem); height: auto; aspect-ratio: 1; }
}

/* ---- My jobs: a technician's work on a phone (Views/MyJobs). Big targets, one column, nothing to scroll sideways. ---- */
.job-page { max-width: 44rem; }
.job-heading { font-size: 1.1rem; color: var(--brand-navy); margin-bottom: .6rem; }
.job-cards { display: flex; flex-direction: column; gap: .6rem; }
.job-card {
  display: flex; flex-direction: column; gap: .25rem; padding: .75rem .9rem; background: var(--surface); color: var(--text);
  border: 1px solid var(--field-border); border-left: 4px solid var(--field-border); border-radius: .5rem; text-decoration: none;
  box-shadow: var(--shadow-resting);
}
.job-card:hover, .job-card:focus-visible { border-color: var(--brand-deep); background: var(--brand-tint); color: var(--text); }
.job-card.started { border-left-color: var(--brand-deep); }
.job-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; color: var(--brand-navy); }
.job-priority { margin-left: auto; font-size: .85rem; color: var(--text-muted); }
.job-card-what { font-size: 1.05rem; font-weight: 600; }
.job-card-where, .job-card-when { font-size: .9rem; color: var(--text-muted); }
.job-summary { background: var(--surface); border: 1px solid var(--field-border); border-radius: .5rem; padding: .9rem 1rem; margin-bottom: .75rem; }
.job-what { font-size: 1.15rem; font-weight: 600; margin-bottom: .6rem; }
.job-facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.job-facts dt { font-weight: 400; color: var(--text-muted); }
.job-facts dd { margin: 0; }
.job-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.job-buttons .btn { min-height: 3rem; display: flex; align-items: center; justify-content: center; gap: .4rem; font-size: 1rem; }
.job-instructions { background: var(--surface); border: 1px solid var(--field-border); border-radius: .5rem; padding: .6rem .9rem; }
.job-instructions summary { color: var(--brand-navy); font-weight: 600; cursor: pointer; }
.pre-wrap { white-space: pre-wrap; margin-top: .5rem; }
@media (max-width: 575.98px) {
  .job-buttons { grid-template-columns: 1fr 1fr; }
}

/* ---- Two-factor sign-in (Views/Account/TwoFactor): the recovery codes, in two columns, easy to copy ---- */
.recovery-codes { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem 1rem; padding: .75rem 1rem; list-style: none; background: var(--page-bg);
  border: 1px solid var(--border); border-radius: .375rem; font-family: var(--bs-font-monospace); user-select: all; }

/* ---- Reports > Performance (Views/Performance): figure cards, two charts, the worst assets ---- */
/* Performance: the period, location and category boxes in the header wrap on a narrow screen. */
.perf-filters { flex-wrap: wrap; align-items: center; }
.perf-filter { width: auto; max-width: 16rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .75rem; }
.kpi-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: .75rem; margin-top: .75rem; }
.kpi { background: var(--surface); border: 1px solid var(--field-border); border-radius: .5rem; padding: .75rem 1rem; box-shadow: var(--shadow-resting); }
.kpi h2 { font-size: .95rem; color: var(--brand-navy); margin-bottom: .35rem; }
.kpi-figure { font-size: 2.2rem; font-weight: 600; line-height: 1.15; color: var(--brand-deep); }
.kpi-detail { font-size: .88rem; color: var(--text); }
.kpi-chart { position: relative; height: 15rem; }
.kpi-bars { margin-top: .5rem; display: flex; flex-direction: column; gap: .25rem; }
.kpi-bar-row { display: grid; grid-template-columns: 8.5rem 1fr 2.5rem; align-items: center; gap: .5rem; font-size: .82rem; }
.kpi-bar-row strong { text-align: right; }
.kpi-bar { height: .55rem; background: var(--brand-tint); border-radius: 1rem; overflow: hidden; }
.kpi-bar > span { display: block; height: 100%; background: var(--brand-deep); }
@media (max-width: 575.98px) {
  .kpi-charts { grid-template-columns: 1fr; }
}

/* ---- Tutorial (Docs/Tutorial-Plan.md, wwwroot/js/tutorial.js) ---- */
.tour-layer { position: fixed; inset: 0; z-index: 1090; pointer-events: none; }
.tour-block { position: fixed; background: var(--tour-dim); pointer-events: auto; }
.tour-block-all { inset: 0; }
/* The spotlight: a navy outline round the thing explained (navy, as it has to stand out against the dimmed page too). It blocks
   clicks unless the step wants them. */
.tour-hole { position: fixed; border-radius: .4rem; box-shadow: 0 0 0 3px var(--brand-navy); pointer-events: auto; }
.tour-hole-open { pointer-events: none; }
.tour-bubble {
  position: fixed; width: min(24rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto;
  background: var(--surface); color: var(--text); border-top: 4px solid var(--brand-deep); border-radius: .5rem;
  box-shadow: var(--shadow-raised); padding: .9rem 1rem .75rem; pointer-events: auto;
  overflow-wrap: anywhere; /* a long word or address in a tour (or a long chapter name) wraps rather than spilling out */
}
.tour-centre { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: min(28rem, calc(100vw - 2rem)); }
.tour-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100%; border-radius: .75rem .75rem 0 0; max-height: 50vh; }
.tour-sheet.tour-sheet-top { top: 0 !important; bottom: auto; border-radius: 0 0 .75rem .75rem; border-top: 0; border-bottom: 4px solid var(--brand-deep); }
.tour-bubble-head { display: flex; justify-content: space-between; gap: .5rem; font-size: var(--tour-type-label); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tour-bubble-chapter { font-weight: 600; color: var(--brand-deep); }
.tour-progress { height: .3rem; background: var(--brand-tint); border-radius: 1rem; overflow: hidden; margin: .35rem 0 .6rem; }
.tour-progress > span { display: block; height: 100%; background: var(--brand-blue); }
.tour-bubble-title { font-size: var(--tour-type-title); font-weight: 600; line-height: 1.25; color: var(--brand-navy); margin: 0 0 .4rem; outline: none; text-wrap: balance; }
.tour-bubble-text, .tour-quiz-said, .tour-learnt { text-wrap: pretty; }
/* The title takes the keyboard only when there's no button to start on: show where it is to keyboard users. */
.tour-bubble-title:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; border-radius: .2rem; }
.tour-bubble-text p { margin-bottom: .5rem; }
.tour-bubble-text p:last-child { margin-bottom: 0; }
.tour-hint:not(:empty) { margin-top: .5rem; padding: .4rem .6rem; background: var(--brand-tint); border-radius: .3rem; }
.tour-hint p { margin: 0; }
/* The quiet links left, the step's buttons right; each group stays together, and the buttons wrap under the links as a unit. */
.tour-bubble-foot { display: flex; align-items: center; justify-content: space-between; gap: .35rem .75rem; margin-top: .3rem; flex-wrap: wrap; } /* + .5rem padding (below) */
.tour-foot-quiet { display: flex; align-items: center; gap: .75rem; }
.tour-foot-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.tour-spacer { flex: 1; }
.tour-bubble .btn, .tour-pill .btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; }
.tour-quiet { color: var(--text-muted); padding-left: 0; padding-right: 0; }
.tour-done-tick { color: var(--tour-right); margin-left: .35rem; font-size: .95em; }
.tour-quiz { margin-top: .6rem; }
.tour-quiz-question { font-weight: 600; margin-bottom: .4rem; }
.tour-quiz-question p { margin: 0; }
.tour-quiz-answers { display: grid; gap: .35rem; }
.tour-answer {
  display: flex; gap: .5rem; align-items: baseline; text-align: left;
  border: 1px solid var(--field-border); background: var(--surface); color: var(--text); border-radius: .35rem; padding: .4rem .6rem;
}
.tour-answer p { margin: 0; }
.tour-answer:hover:not(:disabled) { border-color: var(--brand-blue); background: var(--brand-tint); }
/* Right or wrong is said by an icon and words as well as colour. */
.tour-answer > .bi { flex: none; }
.tour-answer-right { border-color: var(--tour-right); color: var(--tour-right); font-weight: 600; }
.tour-answer-wrong { border-color: var(--tour-wrong); color: var(--text-muted); }
.tour-answer-wrong > .bi { color: var(--tour-wrong); }
.tour-quiz-said { margin-top: .5rem; }
.tour-quiz-said p { margin: 0; }
.tour-said-right { color: var(--tour-right); font-weight: 600; }
/* The end of a chapter. */
.tour-celebrate { text-align: center; }
.tour-tick {
  width: 3.5rem; height: 3.5rem; margin: .25rem auto .6rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--tour-right); color: var(--on-brand); font-size: 2rem;
}
.tour-celebrate-lead { color: var(--text-muted); margin-bottom: .5rem; }
.tour-learnt { list-style: none; padding: 0; margin: 0 auto .6rem; text-align: left; max-width: 20rem; }
.tour-learnt li { padding: .15rem 0; display: flex; gap: .4rem; align-items: baseline; } /* a wrapped line lines up with the words, not the tick */
.tour-learnt .bi { color: var(--tour-right); }
.tour-more { font-size: .9rem; }
/* Paused, or waiting on another screen. */
.tour-pill {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 1085; display: flex; align-items: center; gap: .5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: .5rem;
  padding: .4rem .5rem .4rem .75rem; box-shadow: var(--shadow-raised); max-width: calc(100vw - 2rem); font-size: .9rem;
}
.tour-pill > .bi { color: var(--brand-deep); }
.tour-pill-text { min-width: 0; overflow-wrap: anywhere; } /* a long chapter name wraps; the buttons stay on screen */
.tour-pill > .btn { flex: none; }
.tour-pill-close { color: var(--text-muted); }
/* Getting started (the quest log) and the dashboard card. */
.tour-summary { display: flex; gap: 1.25rem; align-items: center; padding: 1rem 1.25rem; }
/* A readable line on a wide screen (about 75 letters), set on the words' box so the small line under them shares its width. */
.tour-summary > div:last-child { max-width: 65ch; text-wrap: pretty; }
.tour-summary-title { font-size: var(--tour-type-heading); font-weight: 600; color: var(--brand-navy); }
.tour-ring {
  --done: 0; flex: none; width: 5.5rem; height: 5.5rem; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--brand-deep) calc(var(--done) * 1%), var(--brand-tint) 0);
}
.tour-ring > span {
  width: 76%; height: 76%; border-radius: 50%; background: var(--surface); font-size: 1.4rem; font-weight: 700; color: var(--brand-navy);
  /* "3/5" on one line: the line centred in the ring, the two numbers on the same baseline. */
  display: flex; flex-wrap: wrap; align-content: center; align-items: baseline; justify-content: center;
}
.tour-ring small { font-size: .7em; font-weight: 400; color: var(--text-muted); }
.tour-ring-small { width: 3.25rem; height: 3.25rem; }
.tour-ring-small > span { font-size: .95rem; }
.tour-badge-ready { display: inline-flex; gap: .35rem; align-items: center; background: var(--brand-deep); color: var(--on-brand); border-radius: 2rem; padding: .15rem .75rem; font-size: 1rem; }
/* A section heading is bigger than the chapter titles under it, with more space above than below, so it reads as a new part. */
.tour-list-heading { font-size: var(--tour-type-heading); font-weight: 600; color: var(--brand-navy); margin: 1.75rem 0 .25rem; }
.tour-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.tour-chapter {
  display: flex; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: .5rem;
  padding: .75rem 1rem; box-shadow: var(--shadow-resting);
}
.tour-list-heading + p, .tour-chapter-body p { text-wrap: pretty; }
.tour-chapter h3 { font-size: 1rem; font-weight: 600; margin: 0 0 .15rem; color: var(--brand-navy); }
.tour-chapter-body { flex: 1; min-width: 0; }
.tour-chapter-facts { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: var(--tour-type-label); color: var(--text-muted); align-items: center; font-variant-numeric: tabular-nums; }
.tour-chapter-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; }
.tour-chapter .tour-progress { max-width: 16rem; margin-bottom: 0; }
.tour-chapter-skipped { opacity: .75; }
.tour-badge {
  position: relative; flex: none; width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.35rem;
  background: var(--brand-tint); color: var(--brand-deep); border: 2px dashed var(--field-border);
}
.tour-chapter-done .tour-badge { background: var(--brand-deep); color: var(--on-brand); border: 2px solid var(--brand-deep); }
.tour-badge-tick {
  position: absolute; right: -.3rem; bottom: -.3rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--tour-right); color: var(--on-brand); font-size: .8rem; border: 2px solid var(--surface);
}
.tour-chip { background: var(--brand-tint); color: var(--brand-navy); border-radius: 1rem; padding: 0 .55rem; }
.tour-chip-done { background: transparent; color: var(--tour-right); padding: 0; }
.tour-chip-required { background: var(--brand-deep); color: var(--on-brand); }
.tour-card { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.tour-card-body { flex: 1; min-width: 12rem; }
.tour-card-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.tour-welcome { border-top: 4px solid var(--brand-deep); }
.tour-welcome-logo { height: 56px; margin: .5rem 0 .75rem; }
.tour-welcome-title { font-size: 1.4rem; color: var(--brand-deep); font-weight: 300; text-wrap: balance; }
.tour-welcome p { text-wrap: pretty; }
@media (max-width: 575.98px) {
  /* The ring stays beside the title, smaller, rather than on a row of its own. */
  .tour-summary { align-items: flex-start; gap: .9rem; padding: .9rem 1rem; }
  .tour-summary .tour-ring { width: 3.5rem; height: 3.5rem; }
  .tour-summary .tour-ring > span { font-size: 1rem; }
  .tour-chapter { flex-wrap: wrap; }
  .tour-chapter-actions { flex-direction: row; align-items: center; width: 100%; }
  .tour-pill { left: .5rem; right: .5rem; bottom: .5rem; }
}
/* Movement only for people who haven't asked their device for less. Without it, things simply appear. */
@media (prefers-reduced-motion: no-preference) {
  .tour-bubble:not(.tour-centre):not(.tour-sheet) { animation: tour-in .2s ease-out; }
  .tour-centre { animation: tour-in-centre .25s ease-out; }
  /* One pulse as the step appears draws the eye; after that it keeps still, so reading the bubble isn't a distraction. */
  .tour-hole { transition: left .2s, top .2s, width .2s, height .2s; animation: tour-glow .9s cubic-bezier(.16, 1, .3, 1); }
  .tour-tick { animation: tour-pop .5s cubic-bezier(.16, 1, .3, 1); }
  .tour-nudge { animation: tour-shake .35s; }
  .tour-pill { animation: tour-in .25s ease-out; }
}
@keyframes tour-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes tour-in-centre { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes tour-glow { from { box-shadow: 0 0 0 3px var(--brand-navy), 0 0 0 12px var(--brand-tint-strong); } }
@keyframes tour-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes tour-shake { 25% { translate: -6px 0; } 75% { translate: 6px 0; } }
/* While a pop-up is open on a "do it now" step, the tour stands aside: nothing dimmed, the bubble in a corner. */
.tour-standby .tour-block, .tour-standby .tour-hole { display: none; }
.tour-standby .tour-bubble { left: 1rem !important; top: auto !important; right: auto; bottom: 1rem; transform: none; width: min(20rem, calc(100vw - 2rem)); }
.tour-standby .tour-bubble-foot, .tour-standby .tour-progress { display: none; }
/* On a phone the pop-up fills the screen: the bubble keeps out of its way, and its words sit at the top of the pop-up instead
   (tutorial.js, noteInModal). */
.tour-standby-phone .tour-bubble { display: none; }
.tour-modal-note {
  display: flex; gap: .5rem; align-items: baseline; margin-bottom: .75rem; padding: .55rem .75rem;
  background: var(--brand-tint); border-radius: .4rem; color: var(--text);
}
.tour-modal-note > .bi { flex: none; color: var(--brand-deep); }
.tour-modal-note p { margin: 0; }
/* Phones: the bubble's height allows for the browser's own bars (dvh), and quiz answers are finger-sized. */
@supports (height: 1dvh) {
  .tour-bubble { max-height: calc(100dvh - 2rem); }
  .tour-sheet { max-height: 50dvh; }
}
@media (pointer: coarse) {
  .tour-answer { min-height: 44px; align-items: center; }
  /* Buttons are already 44px tall on touch screens (the rule for every .btn); these two aren't plain buttons or are too narrow. */
  .tour-more { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .5rem; }
  .tour-pill-close { min-width: 44px; }
}
/* If a bubble has to scroll (a phone on its side, a long chapter), its buttons stay in sight at the bottom of it. */
/* bottom is minus the bubble's bottom padding: a sticky edge is measured inside the padding, and this foot covers it. */
.tour-bubble-foot { position: sticky; bottom: -.75rem; margin-inline: -1rem; padding: .5rem 1rem .75rem; margin-bottom: -.75rem; background: var(--surface); }
/* The paused reminder sits over the bottom of the page: room underneath, so the last things on it can be scrolled clear. */
body:has(> .tour-pill) { padding-bottom: 4.5rem; }
/* Getting started says how to pause in the words for the device: Esc with a keyboard and mouse, the Pause button on a touch screen. */
.tour-if-touch { display: none; }
@media (pointer: coarse) {
  .tour-if-touch { display: inline; }
  .tour-if-keyboard { display: none; }
}

/* Send feedback: one card, kept to a comfortable reading width */
.feedback-form { max-width: 48rem; padding-bottom: 1rem; }
.feedback-form .form-check-label .bi { color: var(--brand-deep); }
/* The platform admin's Feedback pop-up: what they wrote, line breaks kept, long words wrapped */
.feedback-details { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--page-bg); border-radius: var(--bs-border-radius); padding: .75rem; max-height: 22rem; overflow-y: auto; }
