/* Overmind, in QED's brand: navy ink, cyan highlights, yellow for the one
   action that matters on a page. Tokens mirror qed-website's @theme. */

:root {
  --navy: #011e30;
  --navy-900: #0a4563;
  --navy-700: #155b7d;
  --cyan: #c6e1f3;
  --cyan-100: #8cc5e9;
  --cyan-50: #ebf5fb;
  --blue: #2b71d0;
  --yellow: #ffd166;
  --yellow-900: #ffc336;
  --salmon: #efa99c;
  --salmon-50: #fcebe7;
  --red: #b4231b;
  --off-white: #f7f7f7;
  --ink: #0d1b2a;
  --ink-2: #3d5566;
  --ink-3: #6b7d8b;
  --border: #e5e7eb;
  --hairline: #eef1f4;
  --surface: #ffffff;

  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgb(1 30 48 / 0.05);
  --shadow: 0 10px 30px rgb(1 30 48 / 0.08);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  color-scheme: light;
  interpolate-size: allow-keywords;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--off-white);
  color: var(--ink);
  font: 400 0.9375rem/1.55 var(--font-body);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--navy);
}

h1 {
  font-size: clamp(1.625rem, 1.2rem + 1.4vw, 2.125rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.012em;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: -0.005em;
}

p {
  margin: 0;
}

a {
  color: var(--navy-900);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--navy-700);
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.text-fail {
  color: var(--red);
}

.page-actions .muted {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 2px;
  font-size: 0.8125rem;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(255 255 255 / 0.82);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

/* The bar lifts off the page once content scrolls under it, like qed.tech's
   navbar. Browsers without scroll timelines keep the static border. */
@supports (animation-timeline: scroll()) {
  .topbar {
    animation: topbar-lift linear both;
    animation-timeline: scroll(root);
    animation-range: 0 32px;
  }

  @keyframes topbar-lift {
    to {
      border-bottom-color: transparent;
      box-shadow: var(--shadow);
    }
  }
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--navy);
  text-decoration: none;
}

.brand:hover {
  color: var(--navy);
}

.brand-mark {
  width: 26px;
  height: 26px;
  color: var(--navy-900);
}

.brand-name {
  font: 700 1.0625rem/1 var(--font-display);
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  flex-shrink: 0;
  padding: 7px 12px;
  border-radius: 10px;
  color: var(--ink-2);
  font: 550 0.875rem/1.2 var(--font-display);
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}

.nav a:hover {
  background: var(--hairline);
  color: var(--navy);
}

.nav a[aria-current="page"] {
  background: var(--cyan-50);
  color: var(--navy-900);
  font-weight: 700;
}

.nav-sep {
  flex-shrink: 0;
  width: 1px;
  height: 18px;
  margin: 0 8px;
  background: var(--border);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  font: 700 0.8125rem/1 var(--font-display);
  text-transform: uppercase;
}

.account-email {
  max-width: 220px;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account form {
  margin: 0;
}

/* ---------- Page scaffolding ---------- */

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px 32px 72px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--navy-700);
  font: 650 0.75rem/1 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lede {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.section + .section {
  margin-top: 44px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.section-head p {
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--cyan-50);
  color: var(--navy-900);
  font-size: 0.8125rem;
}

.note code {
  overflow-wrap: anywhere;
}

.note svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

/* ---------- Buttons ---------- */

.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--navy-900);
  font: 650 0.875rem/1 var(--font-display);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    transform 120ms var(--ease-out);
}

.btn:hover,
button:hover {
  border-color: var(--cyan-100);
  background: var(--cyan-50);
  color: var(--navy-900);
}

.btn:active,
button:active {
  transform: scale(0.97);
}

.btn svg,
button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  border-color: var(--yellow-900);
  background: var(--yellow);
  color: var(--navy);
}

.btn-primary:hover {
  border-color: var(--yellow-900);
  background: var(--yellow-900);
  color: var(--navy);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}

.btn-ghost:hover {
  border-color: transparent;
  background: var(--hairline);
  color: var(--navy);
}

.btn-sm {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.8125rem;
}

button:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

button:disabled:hover {
  border-color: var(--border);
  background: var(--surface);
}

.btn-primary:disabled:hover {
  border-color: var(--yellow-900);
  background: var(--yellow);
}

/* Busy state for forms that post and redirect: the button keeps its width,
   the label dims and a spinner takes over, so a double click can't fire twice. */
button[aria-busy="true"] {
  position: relative;
  color: transparent;
  pointer-events: none;
}

button[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 14px;
  height: 14px;
  margin: auto;
  border: 2px solid var(--navy);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Segmented control: a set of links where one is the current view. */
.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.segmented a {
  min-width: 52px;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--ink-2);
  font: 650 0.8125rem/1 var(--font-display);
  text-align: center;
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}

.segmented a:hover {
  color: var(--navy);
}

.segmented a[aria-current="true"] {
  background: var(--navy-900);
  color: #fff;
}

/* ---------- Forms ---------- */

input[type="text"],
input[type="date"],
input[type="search"],
select {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 500 0.875rem/1 var(--font-body);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

select {
  padding-right: 32px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%233d5566' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 14px;
  cursor: pointer;
}

input:hover,
select:hover {
  border-color: var(--cyan-100);
}

input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(43 113 208 / 0.18);
}

.field {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font: 600 0.75rem/1 var(--font-display);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 20px;
}

.week-picker {
  margin-bottom: 32px;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow: auto;
  max-height: 72vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.table-wrap.is-short {
  max-height: none;
}

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

table.data th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  color: var(--ink-2);
  font: 650 0.75rem/1.2 var(--font-display);
  letter-spacing: 0.01em;
  text-align: left;
  white-space: nowrap;
}

table.data td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  vertical-align: middle;
  transition: background-color 120ms ease;
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover td {
  background: #f7fbfe;
}

table.data .num,
table.data th.num {
  text-align: right;
  white-space: nowrap;
}

table.data .nowrap {
  white-space: nowrap;
}

table.data .actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

table.data .empty-row td {
  padding: 40px 16px;
  color: var(--ink-3);
  text-align: center;
}

/* Wide report grid: project + environment stay pinned while the metrics
   scroll; the soft right shadow marks the edge content slides under. */
table.report [data-col="project"] {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 210px;
  box-shadow:
    inset -1px 0 0 var(--border),
    6px 0 10px -8px rgb(1 30 48 / 0.18);
}

table.report th[data-col="project"] {
  z-index: 3;
}

table.report td {
  padding-block: 10px;
  white-space: nowrap;
}

table.report td[data-col="project"] a {
  font-weight: 700;
  text-decoration: none;
}

table.report td[data-col="project"] a:hover {
  text-decoration: underline;
}

table.report .env-name {
  margin-left: 6px;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

table.report :is(
    [data-col="cost"],
    [data-col="ci_pipelines"],
    [data-col="ci_min_s"],
    [data-col="ci_max_s"],
    [data-col="ci_avg_s"],
    [data-col="ci_median_s"],
    [data-col="availability_pct"],
    [data-col="pod_restarts"],
    [data-col="http_500"],
    [data-col="http_5xx"],
    [data-col="cve_critical"],
    [data-col="cve_high"],
    [data-col="deploys"]
  ) {
  text-align: right;
}

table.report td[data-col="week"],
table.report td[data-col="cost_currency"] {
  color: var(--ink-3);
}

table.report td[data-col="cluster"] {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blank {
  color: #b8c2ca;
}

/* ---------- Badges, chips, status ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--hairline);
  color: var(--ink-2);
  font: 650 0.75rem/1.3 var(--font-display);
  white-space: nowrap;
}

.badge-ok {
  background: var(--cyan-50);
  color: var(--navy-900);
}

.badge-fail {
  background: var(--salmon-50);
  color: var(--red);
}

.badge-running {
  background: #fff4d6;
  color: #7a5200;
}

.badge-role {
  background: var(--cyan-50);
  color: var(--navy-900);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge-running .dot {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

code.chip {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--hairline);
  color: var(--navy-900);
  font-size: 0.75rem;
  white-space: nowrap;
}

.delta {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font: 700 0.8125rem/1.2 var(--font-display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.delta.is-worse {
  background: var(--salmon-50);
  color: var(--red);
}

.delta.is-better {
  background: var(--cyan-50);
  color: var(--navy-900);
}

.delta.is-neutral {
  background: var(--hairline);
  color: var(--ink-2);
}

.cap {
  display: inline-block;
}

.cap::first-letter {
  text-transform: uppercase;
}

/* ---------- Tooltips ---------- */

.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.tip-body {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 30;
  width: max-content;
  max-width: 260px;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--navy);
  box-shadow: var(--shadow);
  color: #fff;
  font: 500 0.75rem/1.45 var(--font-body);
  letter-spacing: 0.005em;
  text-align: left;
  text-transform: none;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px) scale(0.97);
  transform-origin: bottom center;
  transition:
    opacity 130ms var(--ease-out),
    transform 130ms var(--ease-out);
}

.tip-below .tip-body {
  top: calc(100% + 8px);
  bottom: auto;
  left: 0;
  transform: translate(0, -4px) scale(0.97);
  transform-origin: top left;
}

.tip:hover .tip-body,
.tip:focus-visible .tip-body {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.tip-below:hover .tip-body,
.tip-below:focus-visible .tip-body {
  transform: translate(0, 0) scale(1);
}

/* Hover waits a beat so passing the cursor over doesn't flash tooltips;
   keyboard focus shows it at once. */
.tip:hover .tip-body {
  transition-delay: 300ms;
}

.tip-icon {
  width: 14px;
  height: 14px;
  color: var(--ink-3);
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  margin: 0;
  padding: 0;
  list-style: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--navy-900);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 0.875rem;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 300ms var(--ease-out),
    transform 300ms var(--ease-out);
}

@starting-style {
  .toast {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
  transition-duration: 180ms;
}

.toast-success {
  border-left-color: var(--cyan-100);
}

.toast-warning {
  border-left-color: var(--yellow-900);
}

.toast-error {
  border-left-color: var(--salmon);
}

.toast-text {
  flex: 1;
  padding-top: 5px;
}

.toast-close {
  min-height: 28px;
  width: 28px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--ink-3);
}

/* ---------- Dashboard: what moved ---------- */

.moved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.moved-card {
  padding: 18px 20px 8px;
}

.moved-card h3 {
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 650;
}

.moved-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.moved-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--hairline);
}

.moved-list li:first-child {
  border-top: 0;
}

.moved-who {
  min-width: 0;
  color: var(--navy);
  font: 700 0.9375rem/1.3 var(--font-display);
  overflow-wrap: anywhere;
}

.moved-who span {
  color: var(--ink-3);
  font-weight: 550;
  white-space: nowrap;
}

.moved-values {
  grid-column: 1;
  color: var(--ink-3);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.moved-list .delta {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.moved-flag {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.empty {
  display: grid;
  justify-items: start;
  gap: 6px;
  padding: 28px;
  color: var(--ink-2);
}

.empty strong {
  color: var(--navy);
  font: 700 1rem/1.3 var(--font-display);
}

/* ---------- Dashboard: per-environment tiles ---------- */

.fold + .fold {
  margin-top: 12px;
}

.fold > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  list-style: none;
  transition: background-color 150ms ease;
}

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

.fold > summary:hover {
  background: #fafcfd;
}

.fold > summary h3 {
  font-size: 0.9375rem;
}

.fold-count {
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--ink-3);
  transition: transform 200ms var(--ease-out);
}

.fold[open] .chevron {
  transform: rotate(180deg);
}

.fold::details-content {
  block-size: 0;
  overflow: clip;
  transition:
    block-size 260ms var(--ease-out),
    content-visibility 260ms allow-discrete;
}

.fold[open]::details-content {
  block-size: auto;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  padding: 2px 18px 18px;
}

.tile {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 14px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.tile-who {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-who b {
  color: var(--navy);
  font-family: var(--font-display);
}

.tile-value {
  color: var(--navy);
  font: 700 1.375rem/1.15 var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.tile-value small {
  margin-left: 3px;
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
}

.tile-prev {
  color: var(--ink-3);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Project charts ---------- */

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr));
  gap: 16px;
}

.chart-card {
  padding: 18px 18px 8px;
}

.chart-card h2 {
  font-size: 0.9375rem;
}

.chart {
  height: 280px;
}

/* ---------- Runs ---------- */

.errors {
  font-size: 0.8125rem;
}

.errors summary {
  color: var(--red);
  font-weight: 650;
  cursor: pointer;
}

.errors ul {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.errors li {
  max-width: 460px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--salmon-50);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.errors li b {
  display: block;
  color: var(--red);
  font-family: var(--font-display);
}

/* ---------- Projects ---------- */

.row-link {
  color: var(--navy);
  font: 700 0.9375rem/1.3 var(--font-display);
  text-decoration: none;
}

.row-link:hover {
  color: var(--navy-900);
  text-decoration: underline;
}

.env-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.env {
  padding: 3px 9px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: #fbfcfd;
  font-size: 0.8125rem;
  white-space: nowrap;
}

tr.is-retired .row-link {
  color: var(--ink-3);
}

.crumb {
  color: inherit;
  text-decoration: none;
}

.crumb:hover {
  color: var(--navy-900);
  text-decoration: underline;
}

/* ---------- Members ---------- */

.member {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member .avatar {
  background: var(--cyan);
  color: var(--navy-900);
}

.role-form {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0 0 20px;
  padding: 0;
  color: var(--ink-2);
  font-size: 0.8125rem;
  list-style: none;
}

.legend b {
  color: var(--navy);
  font-family: var(--font-display);
}

/* ---------- Pager ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.pager-links {
  display: flex;
  gap: 8px;
}

/* ---------- Entrance (sign-in, no access) ---------- */

body.entrance {
  display: grid;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgb(21 91 125 / 0.55), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgb(10 69 99 / 0.6), transparent 60%),
    var(--navy);
}

body.entrance .page {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 48px 20px;
}

.entrance-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  width: min(420px, 100%);
  padding: 36px 32px 32px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.35);
}

.entrance-card h1 + p {
  margin-top: 8px;
}

.entrance-card .brand-mark {
  width: 36px;
  height: 36px;
}

.entrance-card h1 {
  font-size: 1.625rem;
}

.entrance-card p {
  color: var(--ink-2);
}

.entrance-card form {
  display: grid;
  gap: 12px;
}

.entrance-card .btn,
.entrance-card button {
  width: 100%;
  min-height: 46px;
  font-size: 0.9375rem;
}

.entrance-foot {
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.entrance-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 10px 16px;
  }

  .nav {
    order: 3;
    flex-basis: 100%;
    margin: 0 -16px;
    padding: 0 12px 2px;
  }

  .account {
    margin-left: auto;
  }

  .account-email {
    display: none;
  }

  .page {
    padding: 24px 16px 56px;
  }

  .toasts {
    top: 112px;
    right: 16px;
  }
}

/* ---------- Motion and transparency preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .topbar {
    animation: none;
    box-shadow: none;
  }

  button[aria-busy="true"]::after {
    animation: none;
    border-right-color: var(--navy);
    opacity: 0.6;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: #9aa7b1;
    --hairline: #c7d0d6;
    --ink-3: #4a5a66;
  }
}
