/* ENV Solutions Flow unified interface. */
:root {
  --charcoal-950: #171c1f;
  --charcoal-900: #202629;
  --charcoal-800: #2b3337;
  --charcoal-700: #3d474d;
  --env-yellow: #f4a900;
  /* #a86f00 was 4.25:1 on white; #8a5b00 is 6.0:1 (audit, 3 November 2026). */
  --env-yellow-dark: #8a5b00;
  --brand-950: var(--charcoal-950);
  --brand-900: var(--charcoal-900);
  --brand-700: #245e7b;
  --brand-600: #32789b;
  --brand-100: #e8f0f5;
  --ink: #182127;
  /* #63717c was 4.6:1 on --ground, the floor exactly; #5b6873 is 5.2:1. */
  --ink-soft: #5b6873;
  --ground: #f3f5f7;
  --ground-warm: #f7f6f2;
  --panel: #ffffff;
  --line: #dfe4e7;
  --line-strong: #ccd3d8;
  /* 3.88:1 on --amber-bg as #a86f00; 5.3:1 as #8a5b00. */
  --amber: #8a5b00;
  --amber-bg: #fff4d8;
  --red: #a83d32;
  --red-bg: #fbe9e6;
  --ok: #2d7049;
  --ok-bg: #e7f3eb;
  --info: #285a78;
  --info-bg: #e8f1f7;
  /* #ed9715 until 2 November 2026: a white icon on it was 2.32:1, under the 3:1 a
     graphic needs. Same orange, one step darker: 3.14:1. */
  --incident: #cb8112;
  --hazard: #8f50a7;
  --checklist: #2da36f;
  --actions: #3b88c9;
  --dashboard: #56636d;
  --subcontractors: #8a6a3d;
  /* The vehicle register and the training matrix, given tiles on 11 September 2026.
     Both had a link in the bar and nothing on the home. Kept clear of the six above:
     eight cards only read at a glance while no two of them are the same colour. */
  --vehicle: #c05a4a;
  --training: #4a6fa5;
  /* The October registers. Each its own colour, like the eight tiles before them:
     until 23 October 2026 these three had no colour at all, so the tiles rendered
     with a white icon on white and no edge, which Zak read as unfinished. */
  --sds: #1f8a8a;
  --maintenance: #b7791f;
  --legal: #5b5fc7;
  --rules: #6b7a99;
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(21, 29, 34, 0.05);
  --shadow: 0 10px 26px rgba(21, 29, 34, 0.08);
  --mono: Consolas, "Cascadia Mono", ui-monospace, monospace;
  --page-wide: 1240px;
  --page-safety: 930px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  margin: 0;
  color: #121a1f;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
}

h2 {
  margin: 0 0 0.65rem;
  color: #172127;
  font-size: 1.05rem;
  line-height: 1.3;
}

h3 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}

a {
  color: var(--brand-700);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid rgba(244, 169, 0, 0.62);
  outline-offset: 2px;
}

.mono {
  font-family: var(--mono);
  font-size: 0.85em;
}

.muted {
  color: var(--ink-soft);
}

.small {
  font-size: 0.8rem;
}

.note {
  margin-top: 0.6rem;
  font-size: 0.82rem;
}

.empty {
  margin: 0;
  padding: 1.25rem;
  color: var(--ink-soft);
  text-align: center;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.28rem;
  color: var(--env-yellow-dark);
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.35;
  text-transform: uppercase;
}

.page-intro {
  max-width: 680px;
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

/* Application header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  flex: none;
  background: var(--charcoal-900);
  border-top: 2px solid #324048;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.app-header-inner {
  width: min(100%, 1480px);
  min-height: 62px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(220px, auto) 1fr minmax(220px, auto);
  align-items: center;
  gap: 20px;
}

/* Skip link (WCAG 2.4.1): off screen until a keyboard user tabs to it, then the
   first thing on the page. Added 2 November 2026 with id="main" in base.html. */
.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--env-yellow);
  color: var(--charcoal-950);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* A header label never breaks over two lines: at about 930px "My work", "New
   feedback" and "How to" each wrapped onto a second line (audit, 30 October 2026).
   The band below tightens the bar instead, until the phone layout takes over. */
.app-header-inner a,
.app-header-inner button {
  white-space: nowrap;
}

@media (min-width: 861px) and (max-width: 1140px) {
  .app-header-inner {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding: 0 16px;
  }

  .app-header-inner .product-name {
    display: none;
  }

  .workspace-switcher a {
    padding: 0.45rem 0.6rem;
  }

  .account-actions {
    gap: 0.6rem;
  }
}

.product-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #ffffff;
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.product-env {
  font-size: 1.18rem;
  font-weight: 850;
  letter-spacing: 0.015em;
}

.product-arrows {
  width: 39px;
  height: 20px;
  display: inline-grid;
  place-items: center;
}

.product-arrows svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--env-yellow);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.product-name {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.product-brand-dark,
.product-brand-dark .product-env,
.product-brand-dark .product-name {
  color: var(--ink);
}

.workspace-switcher {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
}

.workspace-switcher a {
  min-height: 36px;
  padding: 0.5rem 0.9rem;
  display: inline-flex;
  align-items: center;
  border-radius: 7px;
  color: #dbe2e6;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.workspace-switcher a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.workspace-switcher a.on {
  background: var(--env-yellow);
  color: var(--charcoal-950);
}

.account-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.account-actions > a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: #e2e7ea;
  font-size: 0.82rem;
  font-weight: 650;
  text-decoration: none;
}

.account-actions > a:hover {
  color: var(--env-yellow);
}

.user-chip {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #f2f5f6;
  font-size: 0.8rem;
}

.user-avatar {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: #364148;
  color: var(--env-yellow);
  font-size: 0.78rem;
  font-weight: 800;
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-nav {
  position: sticky;
  top: 64px;
  z-index: 40;
  flex: none;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.context-nav-inner {
  width: min(100%, var(--page-wide));
  min-height: 46px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: stretch;
  gap: 0.15rem;
}

.context-nav a {
  position: relative;
  min-height: 46px;
  padding: 0 0.82rem;
  display: inline-flex;
  align-items: center;
  color: #53626c;
  font-size: 0.81rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.context-nav a:hover {
  color: var(--ink);
  background: #f7f8f9;
}

.context-nav a.on {
  color: var(--ink);
}

.context-nav a.on::after {
  position: absolute;
  right: 0.78rem;
  bottom: -1px;
  left: 0.78rem;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--env-yellow);
  content: "";
}

/* One bar item that opens a short list: the registers, which Zak wanted in the tabs
   as well as on the tiles (23 October 2026) without the bar going back to nine flat
   links. The summary reads exactly like its neighbours, and the list borrows the
   top bar's menu. */
.context-nav .context-menu {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.context-nav .context-menu > summary {
  position: relative;
  min-height: 46px;
  padding: 0 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #53626c;
  font-size: 0.81rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}

.context-nav .context-menu > summary::-webkit-details-marker {
  display: none;
}

.context-nav .context-menu > summary::after {
  content: "";
  width: 0;
  height: 0;
  border-top: 4px solid currentColor;
  border-right: 3.5px solid transparent;
  border-left: 3.5px solid transparent;
  opacity: 0.75;
}

.context-nav .context-menu > summary:hover,
.context-nav .context-menu.on > summary {
  color: var(--ink);
}

.context-nav .context-menu.on > summary::before {
  position: absolute;
  right: 0.78rem;
  bottom: -1px;
  left: 0.78rem;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--env-yellow);
  content: "";
}

.context-nav .context-menu > .topbar-menu-items {
  right: auto;
  left: 0.4rem;
  margin-top: 0;
}

.context-nav .context-menu > .topbar-menu-items a {
  min-height: 0;
  padding: 0.42rem 0.6rem;
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
}

.environment-banner,
.test-banner {
  flex: none;
  margin: 0;
  padding: 0.5rem 1rem;
  border: 0;
  border-bottom: 1px solid #eedaa9;
  border-radius: 0;
  background: #fff8e8;
  color: #785a16;
  font-size: 0.76rem;
  font-weight: 600;
  text-align: center;
}

.page-container > .test-banner {
  display: none;
}

.page-container {
  width: min(100%, var(--page-wide));
  margin: 0 auto;
  padding: 30px 24px 64px;
  flex: 1 0 auto;
}

.site-footer {
  min-height: 58px;
  padding: 1rem 24px 1.25rem;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.38rem;
  color: var(--ink-soft); /* #71808a was 4.07:1 on white */
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  text-align: center;
}

/* Legacy shell contracts retained for older templates. */
.shell {
  min-height: 100vh;
  display: flex;
}

.brand-mark {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: #ffffff;
  color: var(--brand-900);
  font-size: 0.95rem;
  font-weight: 800;
}

.brand-text {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
}

.brand-sub {
  display: block;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  opacity: 0.7;
  text-transform: uppercase;
}

.logout {
  color: #c8d3d9;
  font-size: 0.8rem;
}

.content {
  width: 100%;
  max-width: var(--page-wide);
  padding: 1.75rem 2rem 4rem;
  flex: 1;
}

/* Page headings and actions */
.page-head {
  margin-bottom: 1.4rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}

.job-head {
  align-items: flex-start;
}

.crumbs {
  margin-bottom: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.head-meta {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.head-actions,
.cal-nav,
.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.kpi-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.kpi-big {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* Panels, cards and stats */
.panel,
.card {
  margin: 0 0 1.25rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.card {
  color: inherit;
}

a.card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

a.card:hover {
  border-color: #bdc8ce;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.panel-attention {
  border-left: 4px solid var(--amber);
}

.panel-head {
  margin-bottom: 0.6rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-head h2 {
  margin-bottom: 0;
}

.panel-head > a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.stat-row,
.stats {
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
}

.stat {
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.stat b,
.stat strong {
  display: block;
  overflow: hidden;
  color: #254d63;
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  text-overflow: ellipsis;
}

.stat span {
  display: block;
  margin-top: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.stat-warn b,
.stat-alert b {
  color: var(--red);
}

.stat-alert {
  border-color: #e7b7b0;
  background: #fffafa;
}

.stat-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.stat-link:hover {
  border-color: #9dafb9;
  box-shadow: 0 8px 18px rgba(21, 29, 34, 0.07);
  transform: translateY(-1px);
}

/* Tables */
.table-wrap {
  /* The containing block for anything absolutely placed inside a table (a
     visually-hidden header), so it cannot widen the page past the scroll box. */
  position: relative;
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  padding: 0.5rem 0.62rem;
  border-bottom: 2px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.065em;
  text-align: left;
  text-transform: uppercase;
}

/* Sortable column headings, shared by every register. See templates/_table.html.

   The heading is a link and inherits its own colour and size, so a sorted table looks
   like the same table rather than like a row of buttons. The arrow is reserved at all
   times and only revealed on the sorted column, or the header row would shift
   sideways every time somebody clicks it. */
.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-decoration: none;
  text-transform: inherit;
  cursor: pointer;
  border-radius: 3px;
  transition: color 160ms ease;
}

.sort-link:hover {
  color: var(--ink);
}

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

.sort-link.is-sorted {
  color: var(--ink);
}

.sort-arrow {
  font-size: 0.62em;
  line-height: 1;
  /* Held open whether or not it is showing, so the row does not jump on a click. */
  opacity: 0;
}

.sort-link.is-sorted .sort-arrow,
.sort-link:hover .sort-arrow {
  opacity: 1;
}

.sort-link:hover .sort-arrow {
  opacity: 0.45;
}

.sort-link.is-sorted .sort-arrow {
  opacity: 1;
}

.sort-static {
  display: inline-block;
}

.col-right {
  text-align: right;
}

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

td {
  padding: 0.6rem 0.62rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom-color: transparent;
}

tbody tr[data-href] {
  cursor: pointer;
}

tbody tr[data-href]:hover {
  background: var(--brand-100);
}

.addr {
  max-width: 240px;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Pills, status chips and flags */
.pill {
  max-width: 100%;
  padding: 0.18rem 0.58rem;
  display: inline-block;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f3;
  color: #51606a;
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1.45;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.pill-danger {
  background: var(--red-bg);
  color: var(--red);
}

/* Investigation worklist stages. "Not started" carries the warning colour because it is
   the only stage where nobody has picked the record up yet. */
.pill-stage-not-started {
  background: var(--amber-bg);
  color: var(--amber);
}

.pill-stage-in-progress {
  background: var(--info-bg);
  color: var(--info);
}

.pill-stage-complete {
  background: var(--ok-bg);
  color: var(--ok);
}

.waiting-long {
  color: var(--red);
  font-weight: 800;
}

.register-table .row-action {
  text-align: right;
  white-space: nowrap;
}

.st-new {
  background: var(--amber-bg);
  color: var(--amber);
}

.st-accepted,
.st-endata_entered,
.st-synergy_created,
.st-scheduled {
  background: var(--info-bg);
  color: var(--info);
}

.st-visited {
  background: var(--brand-100);
  color: var(--brand-700);
}

.st-report_review {
  background: var(--amber-bg);
  color: var(--amber);
}

.st-report_uploaded,
.st-invoiced,
.st-complete {
  background: var(--ok-bg);
  color: var(--ok);
}

.st-cancelled {
  background: #ebedef;
  color: #6e7680;
}

.kpi-chip {
  margin: 0 0.15rem 0.15rem 0;
  padding: 0.1rem 0.5rem;
  display: inline-block;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 750;
  white-space: nowrap;
}

.k-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.k-at_risk {
  background: var(--amber-bg);
  color: var(--amber);
}

.k-breached {
  background: var(--red-bg);
  color: var(--red);
}

.k-met {
  background: #ebedef;
  color: #6e7680;
}

.k-pending {
  background: #f2f4f6;
  color: #8a959e;
}

.flags {
  white-space: nowrap;
}

.flag-mini {
  width: 1.35rem;
  margin-right: 0.15rem;
  padding: 0.1rem 0;
  display: inline-block;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.f-yes {
  background: var(--ok-bg);
  color: var(--ok);
}

.f-no {
  background: #f2f4f6;
  color: #a7b0b7;
}

.flag {
  margin: 0.5rem 0;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.flag-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.flag-warn {
  background: var(--amber-bg);
  color: var(--amber);
}

.flag-info {
  background: var(--info-bg);
  color: var(--info);
}

