/* floating. brand — tokens and type from flt.pt */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(/static/fonts/inter-latin.woff2) format("woff2");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/jetbrains-mono-latin-400.woff2) format("woff2");
}

:root {
  --paper:    #f5f3ee;
  --mist:     #e8e5dd;
  --fog:      #6f6c76;
  --ink-soft: #2a2730;
  --ink:      #15141a;
  --rule:      rgba(20, 20, 26, 0.10);
  --rule-soft: rgba(20, 20, 26, 0.06);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(16px, 3vw, 40px);
  color-scheme: light;
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); letter-spacing: -0.005em; }
::selection { background: var(--ink); color: var(--paper); }
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); transition: border-color 150ms var(--ease); }
a:hover { border-color: var(--ink); }
.hidden { display: none !important; }

/* ------------------------------------------------------------- header */
header {
  position: sticky; top: 0; z-index: 5; height: 64px;
  display: flex; align-items: center; gap: 28px; padding: 0 var(--gutter);
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.lockup { display: flex; align-items: baseline; gap: 14px; border: 0; white-space: nowrap; }
.lockup .word { font-size: 22px; font-weight: 600; letter-spacing: -0.038em; line-height: 1; }
.lockup .product { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--fog); }
nav { display: flex; gap: 22px; flex: 1; }
button.tab { background: none; border: 0; padding: 4px 0; color: var(--ink-soft); font-size: 14px; border-bottom: 1px solid transparent; border-radius: 0; }
button.tab:hover { color: var(--ink); }
button.tab.active { color: var(--ink); border-bottom-color: var(--ink); }

/* ------------------------------------------------------------ buttons */
button, .button {
  font: inherit; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: 3px;
  padding: 7px 12px; cursor: pointer; transition: opacity 150ms var(--ease), border-color 150ms var(--ease);
}
button:hover, .button:hover { opacity: .86; }
button .dot, .button .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; transition: transform 150ms var(--ease); }
button:hover .dot, .button:hover .dot { transform: translateX(3px); }
button.ghost, .button.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
button.ghost:hover, .button.ghost:hover { border-color: var(--ink); opacity: 1; }
button:disabled { opacity: .4; cursor: default; }

/* ------------------------------------------------------------- labels */
.label, legend, th, .filters label, .eyebrow {
  font-family: var(--mono); font-size: 10.5px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fog);
}
.pill { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-soft); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.pill.warn::before { background: transparent; border: 1px solid var(--ink); }
.pill.bad::before { background: transparent; border: 1px dashed var(--fog); }

/* --------------------------------------------------------------- page */
main { padding: 28px var(--gutter) 40px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h2 { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; margin: 6px 0 0; }
.page-head p { margin: 8px 0 0; color: var(--ink-soft); max-width: 62ch; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; margin: 28px 0 10px; }
.muted { color: var(--fog); }

#tab-opps { display: grid; grid-template-columns: 270px 1fr; gap: 28px; align-items: start; }
.filters {
  position: sticky; top: 88px; max-height: calc(100vh - 108px); overflow: auto; padding-right: 12px;
  scrollbar-width: thin; scrollbar-color: var(--rule) transparent; scrollbar-gutter: stable;
}
.filters label { display: block; margin: 12px 0; }
/* the search section reads like the fieldsets below: label, rule, then the reset on the right */
.filters-head { display: flex; align-items: center; gap: 8px; }
.filters-head::after { content: ""; flex: 1; order: 1; border-top: 1px solid var(--rule); }
.filters .filters-head label { margin: 0; }
.filters-head button {
  order: 2; background: none; border: 0; border-radius: 0; padding: 0;
  font-family: var(--mono); font-size: 10.5px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fog);
}
.filters-head button:hover { color: var(--ink); opacity: 1; }
.filters-head + input { margin-top: 12px; }
.filters label.check {
  display: flex; gap: 8px; align-items: center; font-family: var(--sans); font-size: 13.5px;
  letter-spacing: 0; text-transform: none; color: var(--ink);
}
input:not([type=checkbox]):not([type=radio]), select {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 13.5px; letter-spacing: 0; text-transform: none;
  color: var(--ink); background: transparent; padding: 7px 9px; border: 1px solid var(--rule); border-radius: 3px;
  transition: border-color 150ms var(--ease);
}
input:not([type=checkbox]):not([type=radio]):focus, select:focus { outline: none; border-color: var(--ink); }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); width: 14px; height: 14px; margin: 0; }
fieldset { border: 0; border-top: 1px solid var(--rule); padding: 14px 0 0; margin: 16px 0 0; }
legend { padding: 0 8px 0 0; }
/* even columns; when two do not fit side by side, each preset takes a full row instead of wrapping raggedly */
.filters fieldset > select { margin-top: 10px; }
.inline-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.inline-filters input, .inline-filters select { width: auto; display: inline-block; margin: 0; }
.inline-filters label.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13.5px; }

/* -------------------------------------------- landscape tree and crumb */
.group > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 2px 0;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fog);
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary::after { content: ""; flex: 1; border-top: 1px solid var(--rule); order: 1; }
.group > summary::before { content: "▸"; order: 3; font-size: 10px; }
.group[open] > summary::before { content: "▾"; }
.group > summary:hover { color: var(--ink); }
.explore { margin-bottom: 18px; }
.filters details.group:not(.explore) { margin-top: 16px; }
.group > summary .clear { order: 2; display: none; color: var(--fog); cursor: pointer; }
.group > summary .clear:hover { color: var(--ink); }
.group.on > summary .clear { display: inline; }
.group.on > summary { color: var(--ink); }
.group > .hint { margin: 6px 0 4px; font-size: 12px; line-height: 1.4; color: var(--fog); }
.filters .opts { margin-top: 8px; }
.filters .opts label.check { margin: 5px 0; }
.filters .opts label.check .t { flex: 1; min-width: 0; }
.filters label.check .n, .filters .opts .n {
  margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--fog); font-variant-numeric: tabular-nums;
}
.filters label.check.zero { color: var(--fog); }
.filters .sub-opt { font-size: 12.5px; }
.filters .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.filters .pair label { margin: 10px 0 0; }
.filters input[type=date] { min-width: 0; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
.chip.mini { padding: 3px 10px; font-size: 12px; font-weight: 400; }
.explore .hint { margin: 8px 0 6px; font-size: 12px; color: var(--fog); }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 14px; border-left: 1px solid var(--rule-soft); margin-left: 7px; }
.tree .node { display: flex; align-items: baseline; gap: 2px; }
.tree button { background: none; border: 0; border-radius: 0; color: var(--ink); font-weight: 400; padding: 3px 0; }
.tree button:hover { opacity: 1; }
.tree .tw { flex: none; width: 16px; justify-content: center; font-size: 10px; color: var(--fog); padding: 3px 0; }
.tree .nl { flex: 1; min-width: 0; text-align: left; font-size: 13px; line-height: 1.3; display: block; }
.tree .nl:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule); }
.tree .n { flex: none; font-family: var(--mono); font-size: 11px; color: var(--fog); font-variant-numeric: tabular-nums; padding-left: 6px; }
.tree li.empty > .node .nl { color: var(--fog); }
.tree li.active > .node .nl { font-weight: 600; }
.tree li.active > .node .nl::before { content: "● "; font-size: 9px; vertical-align: 1px; }
.tree > li > .node .nl { font-weight: 500; }
.crumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 8px 0;
  border-bottom: 1px solid var(--rule); font-size: 13px;
}
.crumb .sep { color: var(--fog); }
.crumb button { background: none; border: 0; border-radius: 0; padding: 0; color: var(--ink-soft); font-weight: 400; }
.crumb button.link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; opacity: 1; }
.crumb .x { margin-left: 4px; font-size: 16px; color: var(--fog); padding: 0 6px; }
.crumb .x:hover { color: var(--ink); opacity: 1; }

/* ------------------------------------------------------------ profile */
.profile-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--ink); }
.chips, .views { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: transparent; color: var(--ink); border: 1px solid var(--rule); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 500;
}
.chip:hover { border-color: var(--ink); opacity: 1; }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.active::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--paper); }
#profile-new { padding: 5px 12px; font-size: 12.5px; border-radius: 999px; }
.profile-summary { margin: 0 0 18px; color: var(--ink-soft); font-size: 13px; }
.views { margin: 10px 0 12px; }
.views .muted { font-size: 12.5px; line-height: 1.4; }
.view { display: inline-flex; align-items: center; }
.view .x { background: none; border: 0; color: var(--fog); padding: 2px 6px; font-size: 14px; }
.view .x:hover { color: var(--ink); }
.why { color: var(--ink); }
td.why-cell { max-width: 320px; }
.for-you { border-top: 1px solid var(--ink); padding: 12px 0 4px; margin-bottom: 8px; }
.for-you .eyebrow { margin-bottom: 8px; }
.for-you ul { margin: 8px 0 12px; }
.profile-form { border-top: 1px solid var(--ink); padding-top: 6px; max-width: 460px; }
.profile-form > label { display: block; margin: 14px 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fog); }
.profile-form label.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; font-size: 13.5px; color: var(--ink); }
.profile-form .hint { margin: -8px 0 10px; font-size: 12px; color: var(--fog); }
.profile-form #profile-error { color: var(--ink); margin: 8px 0; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

/* -------------------------------------------------------------- table */
.results-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#count, #plan-count { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fog); }
table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--ink); }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { position: sticky; top: 64px; background: var(--paper); z-index: 1; padding-top: 12px; padding-bottom: 10px; }
td { font-size: 13.5px; line-height: 1.4; }
td:first-child, th:first-child { padding-left: 0; }
tbody tr { transition: background 120ms var(--ease); }
tbody tr:hover { background: var(--mist); cursor: pointer; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td .sub { color: var(--fog); font-size: 12px; margin-top: 2px; }
td .id { font-family: var(--mono); font-size: 11px; color: var(--fog); margin-top: 3px; }
.date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.days { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--fog); margin-top: 2px; }
.days.urgent { color: var(--ink); }
.days.urgent::before { content: "● "; }

/* yes / no / unknown, in the dot language: filled, empty, outlined-dashed */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink); }
.badge.yes::before { background: var(--ink); }
.badge.no { color: var(--fog); }
.badge.no::before { border-color: var(--fog); }
.badge.unknown::before { border-style: dashed; border-color: var(--fog); }
.sme { font-size: 11px; letter-spacing: 3px; color: var(--ink); white-space: nowrap; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 18px 0; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--fog); }

/* ------------------------------------------------------------- drawer */
.drawer { position: fixed; inset: 0; background: rgba(21, 20, 26, 0.28); display: flex; justify-content: flex-end; z-index: 10; }
.drawer-body { width: min(720px, 100%); height: 100%; overflow: auto; background: var(--paper); padding: 28px 32px; position: relative; border-left: 1px solid var(--rule); }
.drawer .close { position: absolute; right: 22px; top: 22px; padding: 4px 9px; }
.drawer h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; margin: 6px 56px 20px 0; }
.drawer dl { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; margin: 0 0 20px; padding-top: 14px; border-top: 1px solid var(--ink); }
.drawer dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fog); padding-top: 2px; }
.drawer dd { margin: 0; overflow-wrap: anywhere; font-size: 13.5px; }
.drawer ul { padding-left: 18px; }
.drawer .desc { white-space: pre-wrap; line-height: 1.55; color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: 16px; max-width: 68ch; }

/* ------------------------------------------------------------- footer */
footer {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 22px var(--gutter) 28px; border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fog);
}
footer a { color: var(--fog); }
.pipeline-actions { margin: 8px 0 14px; }

/* mobile-only pieces, hidden on desktop */
.sheet-head, .sheet-foot, .filters-toggle, .pill .short { display: none; }
html { -webkit-text-size-adjust: 100%; }

/* ------------------------------------------------- tablet and phone */
@media (max-width: 900px) {
  .lockup .product { display: none; }

  /* header: wordmark and health dot on one row, tabs on their own scrollable row */
  header { height: auto; flex-wrap: wrap; gap: 0 16px; padding-top: 8px; }
  .lockup { min-height: 40px; align-items: center; }
  .pill { margin-left: auto; min-width: 0; overflow: hidden; }
  .pill .long { overflow: hidden; text-overflow: ellipsis; }
  nav {
    order: 3; flex: 0 0 100%; gap: 22px; overflow-x: auto; scrollbar-width: none;
    margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter);
  }
  nav::-webkit-scrollbar { display: none; }
  button.tab { min-height: 44px; white-space: nowrap; flex: none; border-bottom-width: 2px; }

  main { padding-top: 22px; }
  #tab-opps { grid-template-columns: 1fr; gap: 0; }
  .results { min-width: 0; }
  th { position: static; }

  /* filters: a sheet opened from the "filtros" button */
  .filters {
    display: none; position: fixed; inset: 0; z-index: 20; max-height: none; padding: 0; overflow: hidden;
    background: rgba(21, 20, 26, 0.28);
  }
  .filters.open { display: block; }
  body:has(.filters.open), body:has(.drawer:not(.hidden)) { overflow: hidden; }
  .filters-sheet {
    display: flex; flex-direction: column; height: 100%; width: min(440px, 100%);
    background: var(--paper); border-right: 1px solid var(--rule);
  }
  .sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px var(--gutter); border-bottom: 1px solid var(--rule);
  }
  .sheet-head .close { width: 44px; height: 44px; justify-content: center; padding: 0; }
  #filters {
    flex: 1; overflow: auto; overscroll-behavior: contain; padding: 18px var(--gutter) 24px;
  }
  .sheet-foot { display: block; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); }
  .sheet-foot button { width: 100%; justify-content: center; min-height: 48px; font-size: 15px; }

  .results-head { justify-content: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
  .filters-toggle { display: inline-flex; min-height: 40px; padding: 0 14px; }
  .filters-toggle .n {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--ink); color: var(--paper);
    font-family: var(--mono); font-size: 11px; display: inline-flex; align-items: center; justify-content: center;
  }

  /* touch targets and inputs that do not trigger zoom on iOS */
  button, .button { min-height: 40px; }
  input:not([type=checkbox]):not([type=radio]), select { font-size: 16px; min-height: 44px; padding: 9px 11px; }
  input[type=checkbox], input[type=radio] { width: 18px; height: 18px; }
  .filters label.check, .profile-form label.check, .inline-filters label.check { min-height: 40px; margin: 2px 0; font-size: 15px; }
  .filters-head button { min-height: 40px; padding: 0 0 0 8px; }
  .chip, #profile-new { min-height: 40px; padding: 0 14px; font-size: 13.5px; }
  .view .x { min-width: 40px; justify-content: center; font-size: 18px; }
  .pager button { min-width: 112px; justify-content: center; }
  .tree button { min-height: 36px; }
  .chip.mini { min-height: 36px; padding: 0 12px; font-size: 13px; }
  .filters .pair { grid-template-columns: 1fr; }
  .tree .nl { font-size: 14.5px; }
  .tree .tw { width: 28px; }
  .group > summary { min-height: 40px; }
  .crumb button { min-height: 36px; }
  .crumb .x { min-width: 40px; }

  .inline-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .inline-filters input:not([type=checkbox]), .inline-filters select { width: 100%; display: block; }
  .inline-filters input[type=search] { grid-column: 1 / -1; }
  .inline-filters label.check, #plan-count { grid-column: 1 / -1; }
}

/* --------------------------------------------------------------- phone */
@media (max-width: 600px) {
  .page-head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 18px; }
  .page-head h2 { font-size: 28px; }
  .page-head .button, .pipeline-actions { align-self: flex-start; }
  .profile-bar { gap: 8px; }
  .profile-bar .label { flex: 0 0 100%; }
  .profile-summary { font-size: 14px; line-height: 1.45; }
  .pager { justify-content: space-between; gap: 8px; }
  .inline-filters { grid-template-columns: 1fr; }
}

/* ------------------------------------------- cards and full-screen detail */
@media (max-width: 900px) {

  /* tables become stacked cards; column names come from data-label */
  table.cards, table.stack, .cards tbody, .stack tbody { display: block; }
  .cards thead, .stack thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .cards td, .stack td { padding: 0; border: 0; overflow-wrap: anywhere; }
  .cards td[colspan], .stack td[colspan] { display: block; flex: 0 0 100%; padding: 16px 0; }
  .cards td[data-label]::before, .stack td[data-label]::before {
    content: attr(data-label); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--fog); font-weight: 400; white-space: normal;
  }
  tbody tr:active { background: var(--mist); }

  /* opportunity card: title, programme · instrument, deadline and budget, then fit and why */
  .cards tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
  .cards tbody tr:hover { background: none; }
  .cards tbody tr:active { background: var(--mist); }
  .cards .c-title { order: 1; flex: 0 0 100%; font-size: 15.5px; font-weight: 500; line-height: 1.35; letter-spacing: -0.01em; }
  .cards .c-title .id { font-weight: 400; letter-spacing: 0; }
  .cards td.c-title::before, .cards td.c-prog::before { content: none; }
  .cards .c-prog, .cards .c-inst { order: 2; flex: 0 0 100%; font-size: 13.5px; color: var(--ink-soft); margin-top: 4px; }
  .cards .c-inst { order: 3; margin-top: 0; }
  .cards .c-prog .sub, .cards .c-inst .sub { display: inline; font-size: inherit; }
  .cards .c-prog .sub::before, .cards .c-inst .sub::before { content: " · "; }
  .cards td.c-inst::before { content: none; }
  .cards .sub:empty { display: none; }
  .cards .c-date, .cards .c-budget { order: 4; margin-top: 10px; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
  .cards .c-date { flex: 1 1 auto; }
  .cards .c-budget { order: 5; text-align: right; align-items: flex-end; }
  .cards .c-date .days { display: inline; margin: 0; }
  .cards .c-fit, .cards .c-why {
    order: 6; flex: 0 0 100%; display: grid; grid-template-columns: 72px 1fr; column-gap: 10px; align-items: baseline;
    margin-top: 8px;
  }
  .cards .c-fit { padding-top: 10px; border-top: 1px solid var(--rule-soft); }
  .cards .c-why { order: 7; max-width: none; margin-top: 6px; }
  .cards .c-fit > *, .cards .c-why > * { grid-column: 2; }
  .cards .c-fit .badge { white-space: normal; }

  /* plan and pipeline: a readable label / value list per row, the name on top */
  .stack tr { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
  .stack tbody tr:hover { background: none; cursor: default; }
  .stack td { display: grid; grid-template-columns: 120px 1fr; column-gap: 12px; align-items: baseline; text-align: left; }
  .stack td > * { grid-column: 2; }
  .stack td:not([data-label]) { display: block; }
  .stack td:empty { display: none; }
  .stack td.num { text-align: left; }
  .stack td.card-title { order: -1; display: block; font-size: 15.5px; font-weight: 500; line-height: 1.35; margin-bottom: 4px; }
  .stack td.card-title::before { content: none; }
  .stack td.card-title .sub { font-weight: 400; }
  .stack .days { display: block; }
  .stack td.date { white-space: normal; }
  .stack td button { width: 100%; justify-content: center; margin-top: 4px; }

  /* detail drawer: full screen, sticky close, comfortable reading */
  .drawer { background: var(--paper); }
  .drawer-body { width: 100%; border-left: 0; padding: 0 var(--gutter) calc(32px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  .drawer .close {
    position: sticky; top: 0; right: auto; z-index: 2; display: flex; margin: 0 calc(-1 * var(--gutter)) 0 auto;
    width: 56px; height: 52px; justify-content: center; padding: 0; font-size: 16px;
    background: var(--paper); border: 0; border-left: 1px solid var(--rule); border-bottom: 1px solid var(--rule); border-radius: 0;
  }
  #drawer-content { margin: -30px auto 0; max-width: 680px; }
  #drawer-content > .eyebrow:first-child { margin-right: 56px; }
  .drawer h2 { font-size: 22px; margin: 8px 0 18px; }
  .drawer dl { grid-template-columns: 1fr; gap: 3px; }
  .drawer dt { padding-top: 10px; }
  .drawer dd { font-size: 15px; line-height: 1.5; }
  .drawer .desc { font-size: 15px; line-height: 1.6; max-width: none; }
  .drawer li { margin: 6px 0; line-height: 1.45; }
  .profile-form { max-width: none; }
  .form-actions button { min-height: 44px; }
}

@media (max-width: 420px) {
  .pill .long { display: none; }
  .pill .short { display: inline; }
}

/* the database is not on a persistent volume: impossible to miss */
.pill.alert { color: var(--paper); background: var(--ink); padding: 3px 10px; border-radius: 999px; }
.pill.alert::before { background: var(--paper); }
.storage-banner { background: var(--ink); color: var(--paper); padding: 14px 18px; margin: 0 0 22px; border-radius: 4px; }
.storage-banner .sub { color: var(--mist); font-size: 12.5px; margin-top: 4px; }
.page-head p.storage-meta { font-family: var(--mono); font-size: 11px; color: var(--fog); }
.page-head p.storage-meta:empty { display: none; }
/* results by funding route; theme suggestions; quotes from the notice; run errors */
.routes { margin: 4px 0 10px; }
.routes .chip .n { opacity: .65; font-variant-numeric: tabular-nums; }
.themes { margin: -4px 0 6px; }
.themes .chip { font-size: 12.5px; }
.quotes { margin: 0; padding-left: 18px; }
.quotes li { margin-bottom: 4px; }
.sub.err { color: #9a3b2f; }

/* ------------------------------------------------------ loading states */
/* skeletons: transparent placeholder text on --mist, so each block takes the line height of
   the element it sits in and nothing moves when the real content replaces it */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sk {
  font-size: .8em; letter-spacing: .035em; color: transparent; vertical-align: middle; user-select: none;
  border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background: var(--mist) linear-gradient(100deg, transparent 35%, rgba(245, 243, 238, .75) 50%, transparent 65%) 100% 0 / 300% 100% no-repeat;
  animation: sk-shimmer 1.6s linear infinite;
}
@keyframes sk-shimmer { to { background-position: 0 0; } }
.sk-row:hover, .load-error-row:hover { background: none; cursor: default; }
.sk-box { flex: none; width: 14px; height: 14px; border-radius: 3px; background: var(--mist); }
.tree .sk-node .tw, .crumb .sk-x { color: var(--mist); }
.sk-input { display: block; height: 33px; margin-top: 6px; border-radius: 3px; background: var(--mist); }
.pill.sk-pill::before { background: var(--mist); }
select[aria-busy="true"] { color: var(--fog); }
[aria-busy="true"] { cursor: progress; }

/* a refetch that takes a while: the old content stays, dimmed, with the same shimmer behind it */
.refreshing {
  opacity: .5; transition: opacity 120ms var(--ease);
  background-image: linear-gradient(100deg, transparent 35%, rgba(232, 229, 221, .9) 50%, transparent 65%);
  background-size: 300% 100%; background-position: 100% 0; background-repeat: no-repeat;
  animation: sk-shimmer 1.6s linear infinite;
}
.sk-in { animation: sk-in 120ms var(--ease); }
.sk-undim { animation: sk-undim 120ms var(--ease); }
@keyframes sk-in { from { opacity: 0; } }
@keyframes sk-undim { from { opacity: .5; } }

.load-error { color: var(--ink-soft); font-size: 13px; letter-spacing: 0; text-transform: none; font-family: var(--sans); }
.load-error .retry {
  display: inline; min-height: 0; padding: 0; background: none; border: 0; border-radius: 0; color: var(--ink);
  font: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule);
}
.load-error .retry:hover { text-decoration-color: var(--ink); opacity: 1; }
#programme-error .load-error { display: block; margin-top: 6px; }

@media (max-width: 900px) {
  .sk-box { width: 18px; height: 18px; }
  .sk-input { height: 44px; }
  .load-error .retry { display: inline-flex; min-height: 40px; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .sk, .refreshing { animation: none; background-image: none; }
  .refreshing { transition: none; }
  .sk-in, .sk-undim { animation: none; }
}
