/*
 * Compass interface styles. One file, same origin, no web fonts.
 * WCAG 2.2 AA: text contrast of at least 4.5:1, a focus outline that is always
 * visible, and every interactive target at least 24 by 24 CSS pixels (most are
 * 44). Status is never shown by colour alone: every state carries a word and
 * an icon as well.
 */

:root {
  --ink: #1b1f24;
  --ink-muted: #4a5360;
  --paper: #ffffff;
  --paper-alt: #f4f5f7;
  --rule: #6b7480;
  --rule-light: #d5d9df;
  --link: #1a4fb5;
  --focus: #0b3d91;
  --focus-halo: #ffdd00;
  --error: #b3261e;
  --ok: #1e6b3a;
  --warn: #8a4b00;
  --brand: #0f2a4a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 100%;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

body {
  margin: 0;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 0.15em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--focus-halo);
}

main:focus,
h1:focus,
h2:focus,
.error-summary:focus {
  outline: none;
  box-shadow: none;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  padding: 0.75rem 1rem;
  background: var(--paper);
  color: var(--link);
  z-index: 10;
}

.skip-link:focus {
  top: 0.5rem;
}

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 0.5rem 1.5rem;
  background: var(--brand);
  color: #ffffff;
}

.site-header a {
  color: #ffffff;
}

.site-header :focus-visible {
  outline-color: var(--focus-halo);
  box-shadow: none;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
}

.brand a {
  text-decoration: none;
  display: inline-block;
  padding: 0.5rem 0;
}

.site-nav ul {
  display: flex;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  min-height: 44px;
  padding: 0.6rem 0.25rem;
}

.site-nav a[aria-current='page'] {
  font-weight: 700;
  text-decoration-thickness: 0.2em;
}

.account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-header .button-secondary {
  background: transparent;
  color: #ffffff;
  border-color: #ffffff;
}

/* Layout */

main {
  display: block;
  padding: 1.5rem;
  max-width: 90rem;
  margin: 0 auto;
}

main.narrow {
  max-width: 34rem;
}

/* The cockpit uses the width of the screen. */
main.cockpit {
  max-width: none;
}

@media (max-width: 30rem) {
  main {
    padding: 1rem;
  }
}

h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.3;
  margin: 0 0 0.5rem;
}

h3 {
  font-size: 1.1rem;
  margin: 1rem 0 0.25rem;
}

.lede {
  color: var(--ink-muted);
  margin-top: 0;
}

.note {
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
}

.panel {
  border: 1px solid var(--rule-light);
  border-top: 4px solid var(--brand);
  padding: 1rem;
  background: var(--paper);
  margin-bottom: 1.5rem;
}

.cockpit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.cockpit-grid .panel {
  margin-bottom: 0;
}

@media (min-width: 48rem) {
  .cockpit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* The wide panels (obligations, the work queue) take two thirds. */
@media (min-width: 75rem) {
  .cockpit-grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }
}

/* Empty and error states: one calm look for "nothing here yet", and a
   clearly different one, with an icon and the word Error, for a failure. */

.empty-state {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--ink-muted);
  background: var(--paper-alt);
  border-left: 4px solid var(--rule-light);
  padding: 0.75rem 1rem;
  margin: 0;
}

.empty-state::before {
  content: '';
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid var(--rule);
  border-radius: 50%;
}

.error-state {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.4rem;
  color: var(--ink);
  background: #fdf1f0;
  border: 2px solid var(--error);
  border-left-width: 6px;
  padding: 0.75rem 1rem;
  margin: 0;
}

.error-state .status-icon,
.error-state strong {
  color: var(--error);
}

/* Stage board. Narrow screens: one stage per row, an empty stage as one
   compact line. Wide screens: seven columns, an empty stage compact and the
   stages with cases sharing the space (the script sets --board-tracks). */

.board {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}

.board-column,
.board-band {
  background: var(--paper-alt);
  border: 1px solid var(--rule-light);
  padding: 0.5rem 0.75rem;
  min-width: 0;
}

/* Cases before application: under columns 1 to 4 on a wide screen. */
.board-band {
  border: 2px dashed var(--rule);
}

.board-column h3,
.board-band h3 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.board-column:not(.is-empty) h3,
.board-band h3 {
  margin-bottom: 0.5rem;
}

.board-band .note {
  margin-bottom: 0.5rem;
}

.board-band.is-empty .note {
  margin-bottom: 0;
}

.stage-name {
  overflow-wrap: break-word;
  min-width: 0;
}

.count {
  flex: none;
  display: inline-block;
  min-width: 1.9em;
  padding: 0 0.45em;
  border-radius: 1em;
  background: var(--brand);
  color: #ffffff;
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: center;
}

.is-empty .count {
  background: var(--paper);
  color: var(--ink-muted);
  border: 1px solid var(--rule);
}

@media (min-width: 75rem) {
  .board {
    display: grid;
    grid-template-columns: var(--board-tracks, repeat(7, minmax(0, 1fr)));
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0 0 0.5rem;
  }

  .board-column {
    grid-row: 1;
  }

  .board-column:not(.is-empty) {
    min-height: 8rem;
  }

  .board-column.is-empty h3 {
    flex-direction: column;
    align-items: flex-start;
  }

  .board-band {
    grid-row: 2;
    grid-column: 1 / span 4;
  }
}

.placement-rules {
  margin-top: 1rem;
  border-top: 1px solid var(--rule-light);
  padding-top: 0.5rem;
}

.placement-rules summary {
  min-height: 44px;
  padding: 0.6rem 0;
  font-weight: 700;
  cursor: pointer;
}

.placement-rules dl {
  margin: 0 0 0.75rem;
}

.placement-rules dt {
  font-weight: 700;
  margin-top: 0.5rem;
}

.placement-rules dd {
  margin: 0;
}

.board-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
  gap: 0.5rem;
}

@media (min-width: 75rem) {
  .board-column .board-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

.case-card {
  display: block;
  width: 100%;
  min-height: 44px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--rule);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.case-card:hover {
  border-color: var(--brand);
  background: #eaf0f8;
}

.case-card:hover .ref {
  text-decoration: underline;
}

.case-card:focus-visible {
  border-color: var(--brand);
}

.case-card[aria-pressed='true'] {
  border-width: 3px;
  border-left-width: 6px;
  border-color: var(--brand);
}

.case-card .ref {
  font-weight: 700;
  display: block;
  color: var(--link);
}

.case-card .meta {
  display: block;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

/* Lists and tables */

.plain-list {
  margin: 0;
  padding-left: 1.25rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0 1rem;
}

/* A table wider than its panel scrolls inside its own labelled region, which
   takes keyboard focus; the page never scrolls sideways. */
.table-scroll {
  overflow-x: auto;
  margin: 0.5rem 0 1rem;
}

.table-scroll table {
  margin: 0;
}

th.case-name,
td.case-name {
  min-width: 14rem;
}

caption {
  text-align: left;
  font-weight: 700;
  padding: 0.25rem 0;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--rule-light);
}

td.number,
th.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Status: word plus icon, never colour alone */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
}

.status-icon {
  display: inline-block;
  min-width: 1.4em;
  text-align: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  line-height: 1.2;
  font-size: 0.85rem;
}

.status-healthy {
  color: var(--ok);
}

.status-degraded,
.status-untested,
.status-unknown {
  color: var(--warn);
}

.status-failing {
  color: var(--error);
}

.status-not_configured,
.status-not_connected {
  color: var(--ink-muted);
}

/* Integrations */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
  gap: 1rem;
}

.card {
  border: 1px solid var(--rule-light);
  border-top: 4px solid var(--brand);
  padding: 1rem;
  height: 100%;
}

.card h2 {
  font-size: 1.15rem;
}

.card dl {
  margin: 0.5rem 0;
}

.card dt {
  font-weight: 700;
  margin-top: 0.5rem;
}

.card dd {
  margin: 0;
}

.restriction {
  font-weight: 700;
  border-left: 4px solid var(--brand);
  padding-left: 0.5rem;
}

/* Forms */

.field {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.hint {
  color: var(--ink-muted);
  margin: 0 0 0.25rem;
}

input[type='email'],
input[type='password'],
input[type='text'] {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem;
  font: inherit;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
}

input.code-input {
  max-width: 10rem;
  letter-spacing: 0.2em;
}

input[aria-invalid='true'] {
  border-color: var(--error);
  border-width: 3px;
}

.field-error {
  color: var(--error);
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.field-error::before {
  content: 'Error: ';
}

.error-summary {
  border: 4px solid var(--error);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.error-summary h2 {
  font-size: 1.2rem;
}

.error-summary ul {
  margin: 0;
  padding-left: 1.25rem;
}

.error-summary a {
  color: var(--error);
  font-weight: 700;
}

.confirmation {
  border: 4px solid var(--ok);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.button {
  display: inline-block;
  min-height: 44px;
  min-width: 44px;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: var(--brand);
  border: 2px solid var(--brand);
  cursor: pointer;
}

.button-secondary {
  color: var(--brand);
  background: var(--paper);
}

.button[disabled] {
  cursor: not-allowed;
  color: var(--ink-muted);
  background: var(--paper-alt);
  border-color: var(--rule);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Card colour (mail sender): always with a word and an icon beside it */

.card-green {
  border-left: 6px solid var(--ok);
}

.card-red {
  border-left: 6px solid var(--error);
}

.card-amber {
  border-left: 6px solid var(--warn);
}

.colour-green {
  color: var(--ok);
}

.colour-red {
  color: var(--error);
}

.colour-amber {
  color: var(--warn);
}
