/* Colours follow the mock-up's tokens. */
:root {
  color-scheme: light dark;
  --surface: #ffffff;
  --sunken: #f1f5f9;
  --fg: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --control: #64748b;
  --primary: #1d4ed8;
  --on-primary: #ffffff;
  --primary-subtle: #eff6ff;
  --success: #15803d;
  --success-subtle: #f0fdf4;
  --warning: #b45309;
  --warning-subtle: #fffbeb;
  --danger: #b91c1c;
  --on-danger: #ffffff;
  --danger-subtle: #fef2f2;
  --focus: #2563eb;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0f172a;
    --sunken: #0b1220;
    --fg: #f1f5f9;
    --muted: #94a3b8;
    --line: #334155;
    --control: #94a3b8;
    --primary: #60a5fa;
    --on-primary: #0f172a;
    --primary-subtle: #172554;
    --success: #4ade80;
    --success-subtle: #052e16;
    --warning: #fbbf24;
    --warning-subtle: #451a03;
    --danger: #f87171;
    --on-danger: #0f172a;
    --danger-subtle: #450a0a;
    --focus: #93c5fd;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--sunken);
  color: var(--fg);
  font:
    0.9375rem/1.5 Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;
}
h1,
h2,
p,
ul,
dialog {
  margin: 0;
  padding: 0;
}
ul {
  list-style: none;
}
h1 {
  font-size: 1.5rem;
  line-height: 2rem;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
h1:focus {
  outline: none;
}
h2 {
  font-size: 1rem;
  overflow-wrap: anywhere;
}
h3 {
  margin: 0;
  font-size: 0.9375rem;
}
code {
  font-family: var(--mono);
  font-size: 0.875em;
}
h2.section {
  margin-top: 0.5rem;
}
a {
  color: var(--primary);
  text-underline-offset: 2px;
}
.muted,
.help {
  color: var(--muted);
}
.help {
  font-size: 0.8125rem;
}
.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.code {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  /* A story's code is read whole: SF-11, never SF- on one line and 11 on the next. */
  white-space: nowrap;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 0.5rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}
nav {
  display: flex;
  flex-wrap: wrap;
  flex: 1;
  gap: 0.25rem;
}
nav a {
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  color: var(--muted);
  text-decoration: none;
}
nav a:hover {
  background: var(--sunken);
  color: var(--fg);
}
nav a[aria-current] {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 500;
}
nav a {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 40rem) {
  header {
    justify-content: space-between;
  }
  nav {
    order: 3;
    flex-basis: 100%;
    margin-left: -0.75rem;
  }
}
main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}
main.middle {
  max-width: 30rem;
  margin-top: 15vh;
  justify-items: start;
}
#said {
  max-width: 57rem;
  margin: 1rem auto -0.5rem;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
}
/* Kept on the page while empty, so that a screen reader hears what is put in it. */
#said:empty {
  margin: 0;
  padding: 0;
}
#said.good {
  background: var(--success-subtle);
  color: var(--success);
}
#said.bad {
  background: var(--danger-subtle);
  color: var(--danger);
}
.note {
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  background: var(--warning-subtle);
  color: var(--warning);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}
.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
}
.card {
  position: relative;
  display: grid;
  gap: 0.25rem;
  align-content: start;
}
.card h2 a::after {
  content: '';
  position: absolute;
  inset: 0;
}
.card:hover {
  border-color: var(--control);
}
.panel {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
}
.panel > * {
  max-width: 100%;
}
.lines {
  width: 100%;
}
.line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
.line:last-child {
  border-bottom: 0;
}
.empty {
  color: var(--muted);
}
.crumb {
  margin-bottom: -0.75rem;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.row.between {
  justify-content: space-between;
}
.row.end {
  justify-content: flex-end;
  width: 100%;
}
.row.bottom {
  align-items: flex-start;
}
.row.bottom > button {
  margin-top: 1.625rem;
}
.badge {
  padding: 0 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  line-height: 1.375rem;
  background: var(--sunken);
  color: var(--muted);
}
.badge.client {
  background: var(--warning-subtle);
  color: var(--warning);
}
.badge.internal {
  background: var(--primary-subtle);
  color: var(--primary);
}

.field {
  display: grid;
  gap: 0.25rem;
  justify-items: start;
}
label {
  font-weight: 500;
}
input,
select,
button,
.button {
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--control);
  border-radius: 0.375rem;
  min-height: 2.25rem;
  padding: 0.25rem 0.75rem;
}
input,
select {
  width: 22rem;
  max-width: 100%;
}
input.short {
  width: 8rem;
  text-transform: uppercase;
}
button,
.button {
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.button {
  display: inline-flex;
  align-items: center;
}
button:hover {
  background: var(--sunken);
}
button:disabled {
  opacity: 0.6;
  cursor: default;
}
.primary,
.primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.danger,
.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-danger);
}
button.small {
  min-height: 1.875rem;
  padding: 0 0.625rem;
  font-size: 0.8125rem;
}
.scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}
/* Inside a panel, which has its own edge. */
.scroll.plain {
  width: 100%;
  border: 0;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--line);
}
thead th {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}
tbody tr:last-child > * {
  border-bottom: 0;
}
dialog {
  width: min(28rem, calc(100vw - 2rem));
  margin: auto;
  padding: 1.25rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}
dialog[open] {
  display: grid;
  gap: 0.75rem;
}
dialog::backdrop {
  background: rgb(2 6 23 / 0.5);
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* A check that failed is said in words, and marked so it is seen. */
.failing {
  color: var(--danger);
  font-weight: 600;
}

/* A project's factory settings, read as label and value. */
.facts {
  display: grid;
  grid-template-columns: minmax(12rem, max-content) 1fr;
  gap: 0.5rem 1.25rem;
  margin: 0 0 0.75rem;
}
.facts dt {
  color: var(--muted);
}
.facts dd {
  margin: 0;
}
/* A box to tick is its own size, not a text field's. */
input[type='checkbox'] {
  width: 1.125rem;
  height: 1.125rem;
  min-height: 0;
  margin: 0;
  accent-color: var(--primary);
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0.25rem 0;
}
label.check {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  font-weight: 400;
}
/* Fields side by side, as many as fit, each as wide as its column. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0 1rem;
}
.grid input,
.grid select {
  width: 100%;
}
@media (max-width: 40rem) {
  .facts {
    grid-template-columns: 1fr;
  }
  .facts dd {
    margin-bottom: 0.5rem;
  }
}

/* The board. A story waiting for a person is marked, and says for whom. */
.toggle {
  display: inline-flex;
  gap: 0;
}
.toggle button {
  border-radius: 0;
}
.toggle button:first-child {
  border-radius: 0.375rem 0 0 0.375rem;
}
.toggle button:last-child {
  border-radius: 0 0.375rem 0.375rem 0;
  margin-left: -1px;
}
.toggle button[aria-pressed='true'] {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}
.waits {
  color: var(--warning);
  font-weight: 600;
  margin: 0.25rem 0;
}
tr.waiting th {
  box-shadow: inset 3px 0 0 var(--warning);
}
.columns {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(12rem, 1fr);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.column {
  min-width: 0;
}
.lane .story {
  min-width: 0;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}
.column .lane {
  min-width: 0;
}
.column h3 {
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
}
.lane {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.lane .story {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.5rem 0.625rem;
  background: var(--surface);
}
.lane .story p {
  margin: 0.25rem 0;
}
.lane .story .title {
  font-weight: 600;
}
.lane .story.waiting {
  border-left: 4px solid var(--warning);
}
.lane .story.done {
  opacity: 0.75;
}
