/* The console's fonts, Figtree for text and Source Code Pro for data and code, ship with the framework
   (static/fonts, Latin subsets, SIL Open Font License beside each), so the console needs no internet access.
   Until they load, the system fonts show (font-display: swap): the console never waits for them. */
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/figtree-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Code Pro";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-code-pro-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Design tokens: light theme is the default, dark theme is opt-in via #theme-switch. */
:root {
  --font-sans: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Source Code Pro", ui-monospace, "SF Mono", Menlo, "Cascadia Mono",
    Consolas, "Liberation Mono", monospace;

  --radius: 6px;
  /* the type scale: the website's steps, one notch down for a dense tool (in rem, so the reader's text size applies) */
  --text-xs: 0.78125rem; /* 12.5px: small print, the smallest anywhere */
  --text-sm: 0.8125rem; /* 13px: secondary text, table headings, captions */
  --text-base: 0.9375rem; /* 15px: body and table text */
  --text-code: 0.875rem; /* 14px: code and data values */
  --text-panel: 1rem; /* 16px: panel titles */
  --text-lead: 1.03125rem; /* 16.5px: page intros */
  --text-title: 1.3125rem; /* 21px: page titles */
  --gutter: 16px;
  --row-height: 36px;

  --background: #edf0f4;
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --value-bg: #f7f9fb;
  --label-text: #726a66; /* the diagram brown, deep enough for text: 4.6:1 or more */ /* data values: a faint recessed well under the white panel */
  /* diagram cards: at rest, and highlighted (pointed at, or lit with the one that is) */
  --flow-node-bg: #f8f9fa;
  --flow-node-lit: #ffffff;
  --border: #e2e5e9;
  --border-strong: #cdd2d8;
  --text-color: #14181f;
  --text-secondary: #3a4350; /* the website's second ink: longer text that reads below the main text */
  --text-muted: #59636f;
  --text-subtle: #646c78; /* 4.6:1 or more on every light background (WCAG AA) */
  --accent: #24579f;
  --accent-soft: #e7edf6;
  --row-hover: #e4eaf3;
  --amber: #d48a10;

  --success-text: #17663a;
  --success-bg: #e5f3ea;
  --success-dot: #22a05a;
  --warning-text: #8a5200;
  --warning-bg: #fcf0db;
  --danger-dot: #d0453a;
  --danger-text: #a52a21;
  --danger-bg: #fbe6e4;
  /* a type's kind: its icon's colour, as well as its shape (cylinder, chip, f). Tableau-style mid-tones, the
     same in both themes, clear of the state colours (green, amber, red), each 3:1 or more on the panels */
  --kind-task: #4e79a7;
  --kind-ingested: #8a817c;
  --kind-computed: #d4628f;
  /* the kinds' colours deep enough for text, as the website's (4.5:1 or more on the page and the panels) */
  --kind-task-ink: #2f5680;
  --kind-ingested-ink: #645b56;
  --kind-computed-ink: #9e3a63;
  /* a figure that rose or fell, for the moment it changed (.fig-up-*, .fig-down-*) */
  --up-text: #17663a;
  --up-bg: color-mix(in srgb, #22a05a 26%, transparent);
  --down-text: #a52a21;
  --down-bg: color-mix(in srgb, #d0453a 24%, transparent);
  /* chart marks: checked for lightness and contrast against the surface (the dataviz validator) */
  --chart-accent: #24579f;
  --chart-warn: #b87708;
  --neutral-text: #4b5563;
  --neutral-bg: #edeff2;

  --json-key: #1d5bbf;
  --json-string: #17663a;
  --json-number: #a3361b;
  --json-boolean: #6b3fa0;
  --json-null: #8b939e;

}

/* the page itself is dark too, so no light canvas shows while a page loads (set in each page's head) */
html[data-theme="dark"],
html[data-theme="dark"] body {
  background: #06080e;
  color-scheme: dark;
}

.theme-switch:checked ~ #admin {
  --background: #06080e;
  --surface: #10151f;
  --surface-muted: #161c28;
  --value-bg: #0d1218;
  --label-text: #8f8681; /* the diagram brown, light enough for text on dark */ /* data values: a recessed well, darker than the panel */
  --flow-node-bg: #131921;
  --flow-node-lit: #0b1015;
  --border: #232c37;
  --border-strong: #2e3845;
  --text-color: #e5e8ec;
  --text-secondary: #b6c0cf;
  --text-muted: #9aa3ae;
  --text-subtle: #7f8995; /* 4.6:1 or more on every dark background */
  --accent: #8aaee0;
  --accent-soft: #1a2638;
  --row-hover: #1f2b3c;
  --amber: #e9a83a;

  --success-text: #7dcf98;
  --success-bg: #142c1d;
  --success-dot: #3fbf70;
  --warning-text: #eab35a;
  --warning-bg: #33260f;
  --danger-dot: #e8635a;
  --danger-text: #f08a82;
  --danger-bg: #3a1714;
  --chart-accent: #6690d0;
  --chart-warn: #c4841a;
  --neutral-text: #b3bbc6;
  --neutral-bg: #222a34;
  --kind-task-ink: #9dbbe2;
  --kind-ingested-ink: #c9bfb9;
  --kind-computed-ink: #ef9fbf;
  --up-text: #7dcf98;
  --up-bg: color-mix(in srgb, #3fbf70 30%, transparent);
  --down-text: #f08a82;
  --down-bg: color-mix(in srgb, #e8635a 30%, transparent);

  --json-key: #5e9df0;
  --json-string: #7dcf98;
  --json-number: #f09b7d;
  --json-boolean: #c3a3ef;
  --json-null: #6a7480;

  color-scheme: dark;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  color: var(--text-color);
  margin-top: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

pre,
code {
  font-family: var(--font-mono);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Theme switcher */
.theme-switch {
  /* Hides the checkbox */
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-color);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.btn:hover {
  background: var(--surface-muted);
  border-color: var(--text-subtle);
  text-decoration: none;
}

.btn-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  filter: brightness(1.08);
}

/* In dark mode the accent is a light blue meant for text: primary buttons use the same pairing as
   the selected menu item (accent text on the soft accent) instead of a bright fill */
.theme-switch:checked ~ #admin .btn-primary {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.theme-switch:checked ~ #admin .btn-primary:hover {
  border-color: var(--accent);
  filter: none;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex: none;
}

/* Layout */
.admin {
  display: grid;
  height: 100vh;
  grid-template-rows: 44px 1fr;
  grid-template-columns: 196px 1fr;
  grid-template-areas: "header header" "nav main";
  z-index: 1;
  background: var(--background);
  color: var(--text-color);
}

.admin_header {
  display: flex;
  grid-area: header;
  align-items: center;
  height: 44px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

navigation-menu {
  grid-area: nav;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.admin_main {
  grid-area: main;
  padding: 20px 24px 32px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* pages use the full width; long text keeps its own measure (.page-intro) */
.admin_main > * {
  display: block;
}

/* The connection to the app, in the header */
.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-subtle);
}

.conn.connected .dot {
  background: var(--success-dot);
}

.conn.disconnected .dot {
  background: var(--danger-dot);
}

/* Header */
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 196px;
  height: 100%;
  padding: 0 16px;
  color: var(--text-color);
  border-right: 1px solid var(--border);
}

.logo:hover {
  text-decoration: none;
}

/* the Calseda mark, its layered flow (website/brand.md, The mark): pale tails into deep blue, inverted on dark */
.logo-mark {
  display: inline-block;
  flex: none;
  width: 24px;
  height: 24px;
  background: url("/brand/calseda-mark.svg") center / contain no-repeat;
}
html[data-theme="dark"] .logo-mark { background-image: url("/brand/calseda-mark-on-dark.svg"); }

.logo h1 {
  margin: 0;
  font-size: var(--text-panel);
  font-weight: 600; /* the lockup: lower case, Figtree semibold, slightly tight (website/brand.md) */
  letter-spacing: -0.01em;
}

/* The application's name (components/app-name.js), level with the page's content */
app-name {
  min-width: 0;
  padding: 0 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-base);
  font-weight: 600;
}

.toolbar {
  display: flex;
  flex: 1;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
}

/* The header's account menu (components/account-menu.js): a round button with the person's initials, or a person
   icon, opening a panel with who is signed in, the theme, and Sign out (or Sign in while nobody is) */
account-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.account-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font: 600 var(--text-xs)/1 var(--font-sans);
  letter-spacing: 0.02em;
  cursor: pointer;
}

.account-button:has(svg) svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

/* initials: the person, in the accent's soft pairing */
.account-button:not(:has(svg)) {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  border-color: var(--text-subtle);
  color: var(--text-color);
}

.account-button:not(:has(svg)):hover,
.account-button:not(:has(svg))[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.account-panel {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 30;
  width: 248px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.18);
  font-size: var(--text-sm);
}

.account-panel[hidden] {
  display: none;
}

.account-who {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.account-who strong {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-who span {
  color: var(--text-muted);
  font-size: var(--text-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-theme {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 4px 4px 10px;
  color: var(--text-muted);
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.segmented button {
  height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-muted);
  font: 500 var(--text-xs) var(--font-sans);
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text-color);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.account-panel form, .account-action {
  margin: 6px 0 0;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.account-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-color);
  font: 500 var(--text-sm) var(--font-sans);
  text-align: left;
  cursor: pointer;
}

a.account-item,
a.account-item:hover {
  box-sizing: border-box;
  text-decoration: none;
}

.account-item:hover {
  background: var(--surface-muted);
}

.account-button:focus-visible,
.segmented button:focus-visible,
.account-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* hidden means hidden, whatever display a class gives (a button left out for a viewer keeps .btn's inline-flex otherwise) */
[hidden] {
  display: none !important;
}

/* a long table's search box (services/table-factory.js), styled as the console's other controls */
.table-search {
  height: 30px;
  min-width: 14rem;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-color);
  font: inherit;
  font-size: var(--text-sm);
}
.table-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* Navigation */
/* the button that opens the menu on narrow screens (see Responsive) */
.menu_toggle {
  display: none;
}

.menu {
  list-style-type: none;
  margin: 0;
  padding: 12px 10px;
}

.menu_item + .menu_item {
  margin-top: 2px;
}

.menu_heading:first-child {
  margin-top: 4px;
}

.menu_heading {
  margin: 16px 0 6px;
  padding: 0 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-subtle);
}

.menu_link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  color: var(--text-muted);
  font-weight: 500;
  border-radius: var(--radius);
}

.menu_link svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--text-subtle);
}

.menu_link:hover {
  color: var(--text-color);
  background-color: var(--surface-muted);
  text-decoration: none;
}

.menu_link[aria-current="page"] {
  color: var(--accent);
  background-color: var(--accent-soft);
}

.menu_link[aria-current="page"] svg {
  color: var(--accent);
}

/* Page header: title or breadcrumb trail, help, actions */
.page-head {
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 16px;
}

.page-head h1,
.admin_main h1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  font-size: var(--text-title);
  font-weight: 600;
  letter-spacing: -0.01em; /* as the website's headings */
}

.admin_main h1 {
  margin-bottom: 16px;
}

.page-head h1 {
  margin-bottom: 0;
}

.admin_main h1 a {
  color: var(--accent);
  font-weight: 500;
}

.admin_main h1 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.crumb-sep {
  color: var(--text-subtle);
  font-weight: 400;
}

.page-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.section-title {
  margin: 24px 0 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
}

/* Metric strip: a single bordered row of cells divided by hairlines */
.dashboard {
  --column-count: 2;
  display: grid;
  grid-template-columns: repeat(var(--column-count), 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard_item {
  grid-column-end: span 2;
}

/* metric cards inside a panel */
.widget > .dashboard {
  margin: 0;
  padding: 16px;
}

.dashboard_item.full {
  grid-column: 1/-1;
}

.dashboard_item.col {
  grid-column-end: span 1;
}

@media screen and (min-width: 48rem) {
  .dashboard {
    --column-count: 4;
  }

  .dashboard.five {
    --column-count: 5;
  }
}

.card {
  height: 100%;
  padding: 12px 16px 14px;
  background: var(--surface);
  color: var(--text-color);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card h3 {
  margin: 0 0 4px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
}

.card p {
  display: block;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.card .sub {
  display: block;
  margin-top: 2px;
  font-size: var(--text-xs);
  color: var(--text-subtle);
}

.card p.waiting {
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--text-muted);
}

.card .tooltip {
  display: block;
}

.meter {
  height: 6px;
  margin-top: 10px;
  background: var(--neutral-bg);
  border-radius: 3px;
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--success-dot);
}

.meter.warn > span {
  background: var(--amber);
}

.meter.high > span {
  background: var(--danger-dot);
}

/* Panels */
.widget {
  position: relative;
  margin-bottom: 20px;
  background: var(--surface);
  color: var(--text-color);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: var(--text-panel);
  font-weight: 600;
}

/* a choice of view, such as Fields or JSON, at the heading's right */
.panel-head .segmented {
  margin-left: auto;
}

.panel-head .note {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.notice {
  color: var(--text-muted);
}

.panel-body {
  padding: 14px;
}

.widget-table-overlay {
  overflow-x: auto;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-color);
  font-variant-numeric: tabular-nums;
}

.table th {
  height: 32px;
  padding: 0 16px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  height: var(--row-height);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

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

.table td.id,
.table td.idConvention {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.table td.role {
  width: 1%;
}

.table td.empty {
  color: var(--text-subtle);
  cursor: default;
}

.table-striped tbody tr.row-link {
  cursor: pointer;
}

.table-striped tbody tr.row-link td {
  transition: background-color 0.08s;
}

.table-striped tbody tr.row-link:hover td {
  background-color: var(--row-hover);
}

/* Clickable rows: a chevron appears on hover */
.table th.go,
.table td.go {
  width: 1%;
  padding: 0 12px 0 0;
}

.table td.go svg {
  display: block;
  width: 14px;
  height: 14px;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.12s, transform 0.12s;
}

.table-striped tbody tr.row-link:hover td.go svg {
  opacity: 1;
  transform: none;
}


/* The row for the page being shown, e.g. the current ID in the Identifiers table */
.table tbody tr.current td {
  font-weight: 600;
}

.table-striped tbody tr.waiting td.timestamp {
  color: var(--warning-text);
}

.table-lr td,
.table-lr th {
  padding: 0.55rem;
  border-top: 1px solid var(--border);
  text-align: left;
}

.table-lr td {
  font-family: var(--font-mono);
}

/* Forms */
input,
button,
select,
optgroup,
textarea {
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

.form-control {
  display: block;
  width: 50%;
  height: 30px;
  padding: 0 8px;
  font-size: var(--text-base);
  color: var(--text-color);
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: 0;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: 10px;
  border: 2px solid var(--background);
}

/* Data display */
.timestamp {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.data-view {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--value-bg);
  padding: 12px 14px;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  word-wrap: break-word;
}

.version-id {
  display: block;
  padding: 6px 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

/* Status tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  border-radius: 4px;
  color: var(--neutral-text);
  background-color: var(--neutral-bg);
}

.card .tag {
  margin-top: 5px;
}

.tag-entity {
  color: var(--neutral-text);
  background: var(--neutral-bg);
}

.tag-task {
  color: var(--kind-task);
  background-color: color-mix(in srgb, var(--kind-task) 14%, transparent);
}

.string {
  color: var(--json-string);
}
.number {
  color: var(--json-number);
}
.boolean {
  color: var(--json-boolean);
}
.null {
  color: var(--json-null);
}
.key {
  color: var(--json-key);
}

.live {
  color: inherit;
}

.waiting {
  color: var(--warning-text);
}

.notice {
  padding: 12px 14px;
  color: var(--text-muted);
}

/* Data flow diagrams: stages as columns of cards, with SVG connectors (see components/flow-graph.js) */
.diagram-panel .panel-head {
  flex-wrap: wrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend .flow-icon {
  width: 18px;
  height: 18px;
}

.legend .flow-icon svg {
  width: 12px;
  height: 12px;
}

.flow-diagram {
  overflow-x: auto;
}

.flow-diagram.hidden-diagram {
  display: none;
}

.flow-viewport {
  overflow: hidden;
}

.flow {
  position: relative;
  transform-origin: 0 0;
  display: flex;
  align-items: center;
  width: max-content;
  min-width: 100%;
  padding: 20px 24px 24px;
  box-sizing: border-box;
}

.flow-stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: none;
}

.flow-stage h3 {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.flow-nodes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* the gaps take any spare width, so the diagram spans the whole panel */
.flow-gap {
  flex: 1 0 32px;
  align-self: stretch;
}

.flow-gap.decides {
  flex-basis: 52px;
}

.flow-node {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 140px;
  /* no maximum: a column is as wide as its longest name or subtitle (NetworkHestonCalibrationWorker), and its boxes
     share that width; names are never cut */
  box-sizing: border-box;
  padding: 9px 12px 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--flow-node-bg);
  color: var(--text-color);
  text-decoration: none;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
  transition: border-color 0.12s, box-shadow 0.12s, background-color 0.12s;
}

.flow-node:hover,
.flow.focus .flow-node.lit {
  background: var(--flow-node-lit);
}

.flow-node:hover {
  border-color: var(--text-subtle);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.08);
  text-decoration: none;
}

.flow-node.worker {
  min-width: 160px;
  padding: 12px 14px 12px 12px;
  border-color: var(--text-muted);
  background: var(--surface-muted);
}

.flow-node.worker .flow-name {
  font-size: var(--text-panel);
}

.flow-node.unused {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}

.flow-node.unused .flow-name {
  color: var(--text-muted);
}

.flow-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--neutral-text);
  background: var(--neutral-bg);
}

.flow-icon svg {
  width: 14px;
  height: 14px;
}

/* a type's kind shows in its icon's shape and colour */
.flow-icon.task { --kind: var(--kind-task); }
.flow-icon.ingress, .flow-icon.internal { --kind: var(--kind-ingested); }
.flow-icon.egress { --kind: var(--kind-computed); }
.flow-icon.task, .flow-icon.ingress, .flow-icon.egress, .flow-icon.internal { color: var(--kind); background: color-mix(in srgb, var(--kind) 14%, transparent); }
.flow-node.worker .flow-icon.task { background: var(--surface); }

.flow-icon.unused {
  border: 1px dashed var(--text-subtle);
  background: transparent;
}

.flow-node.unused .flow-icon svg {
  color: var(--text-subtle);
}

.flow-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.flow-name {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.flow-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.flow-ends {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
}

.flow-end {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.flow-end svg {
  flex: none;
  width: 12px;
  height: 12px;
  color: var(--text-subtle);
}

.flow-end code {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-subtle);
  text-overflow: ellipsis;
}

.flow-wires {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
}

.flow-wires .wire {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.5;
}

.flow-wires .wire.needs,
.flow-wires .wire.produces {
  stroke: var(--text-subtle);
  stroke-opacity: 0.7;
}

.flow-wires .wire.decides {
  stroke: var(--text-subtle);
  stroke-dasharray: 4 4;
}

.flow-wires .wire.declared {
  stroke: var(--text-subtle);
  stroke-dasharray: 2 4;
}

/* an arrowhead takes its arrow's colour */
.flow-wires marker path { fill: context-stroke; }

.flow-wires .wire-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  fill: var(--text-muted);
}

/* Visibility transitions (used by the loading screen) */
.hidden {
  transition: opacity 0.2s linear, margin-top 0.3s step-start,
    z-index 0.3s step-start;
  opacity: 0;
  margin-top: -100vh;
  z-index: -5 !important;
  transition-timing-function: linear, step-end, step-end;
}

/* Tooltips */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  min-width: 200px;
  max-width: 360px;
  width: max-content;
  padding: 6px 9px;
  position: absolute;
  z-index: 10;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #14181f;
  color: #eef0f3;
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: normal;
  border-radius: var(--radius);
}

.tooltip:hover .tooltiptext {
  visibility: visible;
}

.tooltip .tooltiptext.right {
  bottom: 50%;
  left: 125%;
  transform: none;
}

.tooltip .tooltiptext.left {
  bottom: 50%;
  left: auto;
  right: 125%;
  transform: none;
}

.tooltip .tooltiptext.top,
.tooltip .tooltiptext.bottom {
  top: 125%;
  bottom: auto;
}

/* Responsive: on narrow screens the sidebar becomes a menu button at the left of the header, which opens the
   same menu as a panel over the page */
@media screen and (max-width: 48rem) {
  .admin {
    grid-template-rows: 44px 1fr;
    grid-template-columns: 1fr;
    grid-template-areas: "header" "main";
  }

  .admin_header {
    padding-left: 44px; /* room for the menu button */
  }

  .conn > span {
    display: none; /* the connection's dot alone fits the narrow header */
  }

  app-name {
    padding: 0 8px;
  }

  /* the app's own name says where you are; the mark stays for Calseda */
  .admin_header:has(app-name:not(:empty)) .logo h1 {
    display: none;
  }

  .logo {
    width: auto;
    padding-left: 4px;
    border-right: 0;
  }

  navigation-menu {
    grid-area: header;
    justify-self: start;
    position: relative;
    z-index: 20;
    width: 44px;
    height: 44px;
    background: none;
    border-right: 0;
    overflow: visible;
  }

  .menu_toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
  }

  .menu_toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
  }

  .menu_toggle:hover,
  navigation-menu[open] .menu_toggle {
    color: var(--text-color);
  }

  .navbar {
    display: none;
  }

  navigation-menu[open] .navbar {
    display: block;
    position: absolute;
    top: 44px;
    left: 0;
    width: min(280px, 85vw);
    max-height: calc(100vh - 44px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 var(--radius) 0;
    box-shadow: 0 12px 32px rgb(0 0 0 / 0.18);
  }

  .admin_main {
    padding: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════
   Help — inline explanations and hover text
   ═══════════════════════════════════════════════════════════ */

/* Text with a description: hovering it shows the floating help panel */
.has-help {
  cursor: help;
  text-decoration: underline dotted var(--text-subtle);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Inside tables and chips the hover cue would be noise; the cursor is enough */
.table td .has-help,
.has-help:has(> .chip),
.has-help:has(> .pill),
.has-help:has(> .type-ref) {
  text-decoration: none;
}

.table tr.row-link .has-help {
  cursor: inherit;
}

.page-intro {
  max-width: 90ch;
  margin: -8px 0 16px;
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text-muted);
}

/* a long intro (components/help-panel.js) shows three lines until More */
.intro-wrap { margin: -8px 0 16px; }
.intro-wrap .page-intro { margin: 0; }
.page-intro.clamped:not(.open) { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.intro-more {
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.intro-more:hover { text-decoration: underline; }
.intro-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page-intro strong {
  color: var(--text-color);
  font-weight: 600;
}

/* Floating help panel — one shared element, positioned by help-panel.js */
.help-panel {
  position: fixed;
  z-index: 10000;
  max-width: 380px;
  padding: 10px 12px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.12s ease, visibility 0.12s;
  pointer-events: none;
  background: var(--surface, #fff);
  color: var(--text-color, #14181f);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.55;
  border: 1px solid var(--border-strong, #cdd2d8);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(10, 14, 20, 0.14);
}

.help-panel.visible {
  visibility: visible;
  opacity: 1;
}

.help-panel p {
  margin: 0 0 6px;
}

.help-panel p:last-child {
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════
   YAML descriptions — type summaries, description cells, chips
   ═══════════════════════════════════════════════════════════ */

.cell-desc.missing {
  color: var(--text-subtle);
  font-style: italic;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 0;
  padding: 14px 16px;
}

.facts:empty {
  display: none;
}

.fact {
  display: contents;
}

.fact dt {
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 22px;
  color: var(--text-muted);
}

.fact dd {
  max-width: 100ch; /* a readable line length for the notes */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 0;
  min-height: 22px;
}

.fact code {
  padding: 1px 6px;
  font-size: var(--text-xs);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.fact-note {
  flex: 0 0 100%; /* its own line under the name it describes */
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  margin: 1px 4px 1px 0;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 11px;
}

.chip:hover {
  text-decoration: none;
  filter: brightness(0.96);
}

/* Description cells: one line, full text on hover */
.table td.description {
  width: 50%;
  max-width: 0;
  white-space: nowrap;
}

.cell-desc {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.table td.needs,
.table td.produces,
.table td.types {
  white-space: normal;
  padding-top: 6px;
  padding-bottom: 6px;
}

/* Type and adapter names: a role icon and the name. Icon colours match the worker data flow diagram. */
.type-ref {
  display: inline-flex;
  vertical-align: middle;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--text-color);
  white-space: nowrap;
}

.type-ref svg {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--text-subtle);
}

a.type-ref:hover {
  text-decoration: none;
}

a.type-ref:hover span {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.type-ref svg { color: var(--text-muted); }
.type-ref.task svg { color: var(--kind-task); }
.type-ref.ingress svg, .type-ref.internal svg { color: var(--kind-ingested); }
.type-ref.egress svg { color: var(--kind-computed); }

.type-refs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

/* Panel heading icon: says what kind of thing the panel lists */
.panel-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: var(--neutral-text);
  background: var(--neutral-bg);
}

.panel-icon svg {
  width: 14px;
  height: 14px;
}

.panel-icon.task { --kind: var(--kind-task); }
.panel-icon.ingress, .panel-icon.internal { --kind: var(--kind-ingested); }
.panel-icon.egress { --kind: var(--kind-computed); }
.panel-icon.adapter { --kind: var(--neutral-text); }
.panel-icon.task, .panel-icon.ingress, .panel-icon.egress, .panel-icon.internal, .panel-icon.adapter { color: var(--kind); background: color-mix(in srgb, var(--kind) 14%, transparent); }

/* Page title icon, in the colour of the page's section */
#page_container h1 {
  position: relative;
  padding-left: 40px;
}

#page_container h1::before,
#page_container h1::after {
  content: "";
  position: absolute;
  top: 50%;
}

#page_container h1::before {
  left: 0;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  border-radius: 7px;
  background: var(--section-bg);
}

#page_container h1::after {
  left: 6px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  background: var(--section-color);
  -webkit-mask: var(--section-icon) center / contain no-repeat;
  mask: var(--section-icon) center / contain no-repeat;
}

#page_container[data-section="compute"] {
  --section-ink: var(--kind-task-ink);
  --section-color: var(--kind-task);
  --section-bg: color-mix(in srgb, var(--kind-task) 14%, transparent);
  --section-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='8' height='8' rx='1.5'/%3E%3Cpath d='M6.5 1.5v2M9.5 1.5v2M6.5 12.5v2M9.5 12.5v2M1.5 6.5h2M1.5 9.5h2M12.5 6.5h2M12.5 9.5h2'/%3E%3C/svg%3E");
}

#page_container[data-section="sources"] {
  --section-ink: var(--kind-ingested-ink);
  --section-color: var(--kind-ingested);
  --section-bg: color-mix(in srgb, var(--kind-ingested) 14%, transparent);
  --section-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='8' cy='3.5' rx='5.5' ry='2'/%3E%3Cpath d='M2.5 3.5v9c0 1.1 2.5 2 5.5 2s5.5-.9 5.5-2v-9M2.5 8c0 1.1 2.5 2 5.5 2s5.5-.9 5.5-2'/%3E%3C/svg%3E");
}

#page_container[data-section="results"] {
  --section-ink: var(--kind-computed-ink);
  --section-color: var(--kind-computed);
  --section-bg: color-mix(in srgb, var(--kind-computed) 14%, transparent);
  --section-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11.8 2.9c-.9-.7-2.7-.6-3.3 1.1L6.3 12.1c-.5 1.5-2.2 1.7-3.1 1'/%3E%3Cpath d='M5.3 6.6h5.4'/%3E%3C/svg%3E");
}

#page_container[data-section="resources"] {
  --section-ink: var(--text-subtle);
  --section-color: var(--neutral-text);
  --section-bg: color-mix(in srgb, var(--neutral-text) 14%, transparent);
  --section-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2' width='5' height='6' rx='1'/%3E%3Crect x='9' y='2' width='5' height='3' rx='1'/%3E%3Crect x='2' y='10' width='5' height='4' rx='1'/%3E%3Crect x='9' y='7' width='5' height='7' rx='1'/%3E%3C/svg%3E");
}

#page_container[data-section="data-flow"] {
  --section-ink: var(--text-subtle);
  --section-color: var(--neutral-text);
  --section-bg: color-mix(in srgb, var(--neutral-text) 14%, transparent);
  --section-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='3.5' cy='8' r='1.75'/%3E%3Ccircle cx='12.5' cy='3.5' r='1.75'/%3E%3Ccircle cx='12.5' cy='12.5' r='1.75'/%3E%3Cpath d='M5.25 8h1c2 0 2-4.5 4-4.5h.5M6.25 8c2 0 2 4.5 4 4.5h.5'/%3E%3C/svg%3E");
}


/* Connect an agent (components/connect-agent.js) */
.connect-client {
  margin-bottom: 18px;
}

.connect-client h3 {
  margin: 0 0 2px;
  font-size: var(--text-base);
  font-weight: 600;
}

.connect-client p,
.connect-note {
  margin: 0 0 8px;
  color: var(--text-muted);
}

.code-row {
  position: relative;
}

.code-row pre {
  min-width: 0;
  margin: 0;
  padding-right: 76px; /* room for Copy */
  overflow-x: auto;
  white-space: pre;
}

.code-row .btn {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 26px;
}

/* ---- one page per entity: where it comes from, its value, its connections (no accent bars) */
.tag-kind { background: var(--neutral-bg); color: var(--neutral-text); margin-left: 0.5rem; vertical-align: middle; }
.card .age { display: block; color: var(--text-subtle); font-size: 0.85em; margin-top: 0.25rem; }
.toggle-line { display: inline-flex; gap: 0.4rem; align-items: center; color: var(--text-muted); font-size: 0.9em; cursor: pointer; }
.missing { color: var(--text-subtle); }

/* Tables keep their column widths as data arrives: laid out from the set widths, not from the content,
   so a ticking price, age or value doesn't move every column. Text too long for its column ends in an
   ellipsis (the full text is in the cell's title). */
.table-fixed { table-layout: fixed; min-width: 640px; }
.table-fixed col.go { width: 40px; }
.table-fixed td { overflow: hidden; text-overflow: ellipsis; }

/* Pointing at a card in a diagram picks out its arrows and neighbours */
.flow .wire, .flow .flow-node { transition: opacity 0.12s; }
.flow.focus .wire:not(.lit) { opacity: 0.08; }
.flow.focus .flow-node:not(.lit) { opacity: 0.4; }
.flow.focus .wire.lit { stroke-width: 2; }

/* the app map has many arrows between columns: give them room */
.type-map .flow-gap { flex-basis: 72px; }

/* ---- State and activity (components/status.js). Colour means state: green up to date, amber waiting,
   red failed, grey idle. Zero counts and idle rows stay quiet, so colour always asks for a look. */
.tone-ok { --tone-text: var(--success-text); --tone-bg: var(--success-bg); --tone-dot: var(--success-dot); }
.tone-wait { --tone-text: var(--warning-text); --tone-bg: var(--warning-bg); --tone-dot: var(--amber); }
.tone-fail { --tone-text: var(--danger-text); --tone-bg: var(--danger-bg); --tone-dot: var(--danger-dot); }
.tone-idle { --tone-text: var(--text-muted); --tone-bg: var(--neutral-bg); --tone-dot: var(--text-subtle); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  border-radius: 11px;
  color: var(--tone-text);
  background: var(--tone-bg);
}

.pill::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tone-dot);
}

.count { font-variant-numeric: tabular-nums; }
.count.zero { color: var(--text-subtle); }
.count.tone-ok, .count.tone-wait, .count.tone-fail { color: var(--tone-text); font-weight: 600; }
.table th.workers, .table td.workers { text-align: right; }

/* a task type's workers: one bar split by state, problems spelt out beside it */
.health-summary { display: inline-flex; align-items: center; gap: 10px; width: 100%; }
.health-bar {
  display: flex;
  flex: 0 0 120px;
  gap: 2px;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--neutral-bg);
}
.health-bar > span { background: var(--tone-dot); }
.health-text { font-size: 0.75rem; color: var(--text-muted); }
.health-text .tone-wait, .health-text .tone-fail { color: var(--tone-text); font-weight: 600; }

/* ages fade as values get older; the exact time is on hover */
.age-text { font-variant-numeric: tabular-nums; }
.age-text.fresh { color: var(--text-color); font-weight: 500; }
.age-text.recent { color: var(--text-muted); }
.age-text.stale { color: var(--text-subtle); }
.age-text.tone-wait { color: var(--warning-text); }

/* rows with nothing going on step back */
.table tbody tr.idle td { color: var(--text-subtle); }
.table tbody tr.idle td .type-ref svg { opacity: 0.5; }

/* a row whose value just changed is tinted for a moment */
@keyframes row-flash-a { from { background-color: color-mix(in srgb, var(--accent-soft) 70%, transparent); } to { background-color: transparent; } }
@keyframes row-flash-b { from { background-color: color-mix(in srgb, var(--accent-soft) 70%, transparent); } to { background-color: transparent; } }
.table tbody tr.flash-a td { animation: row-flash-a 0.9s ease-out; }
.table tbody tr.flash-b td { animation: row-flash-b 0.9s ease-out; }
/* a value's field or table cell that just changed (components/value-view.js) */
.vt-row.flash-a, .vt-grid td.flash-a { animation: row-flash-a 0.9s ease-out; }
.vt-row.flash-b, .vt-grid td.flash-b { animation: row-flash-b 0.9s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .table tbody tr.flash-a td, .table tbody tr.flash-b td { animation: none; }
  .vt-row.flash-a, .vt-row.flash-b, .vt-grid td.flash-a, .vt-grid td.flash-b { animation: none; }
}

/* a panel's explanation, behind a small ⓘ beside its title */
.has-help:has(> .help-icon) { display: inline-flex; align-items: center; text-decoration: none; }
.help-icon { display: inline-flex; color: var(--text-subtle); cursor: help; }
.help-icon svg { width: 14px; height: 14px; }
.help-icon:hover, .help-icon:focus-visible { color: var(--text-muted); }

/* map arrows take the colour of the kind of box they leave; pointing at a box brings its arrows forward */
.flow-wires .wire.from-ingress, .flow-wires .wire.from-internal { stroke: var(--kind-ingested); }
.flow-wires .wire.from-task { stroke: var(--kind-task); }
.flow-wires .wire.from-egress { stroke: var(--kind-computed); }
.flow.focus .wire.lit { stroke-opacity: 1; }

/* the Workers page's verdict in a sentence, under the title and its pill */
.summary-line { margin: -6px 0 14px; font-size: var(--text-lead); font-weight: 500; color: var(--text-color); }
.summary-line .tone-wait, .summary-line .tone-fail { color: var(--tone-text); font-weight: 600; }
#page_container h1 .pill { margin-left: 4px; font-size: var(--text-xs); }

/* a few figures in a line or two: label, then value */
.figures { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 0; padding: 4px 16px 16px; }
.figure { display: flex; align-items: baseline; gap: 8px; }
.figure dt { font-size: var(--text-xs); color: var(--text-muted); }
.figure dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.figure dd .muted, .figure dd .missing { font-weight: 400; }
.figure dd .tone-wait, .figure dd .tone-fail { color: var(--tone-text); }
.figure dd .age-text.recent, .figure dd .age-text.stale { color: inherit; }

/* a panel that starts closed, its title line acting as the toggle */
details.quiet-section > summary { cursor: pointer; list-style: none; }
details.quiet-section > summary::-webkit-details-marker { display: none; }
details.quiet-section > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.5px solid var(--text-subtle);
  border-bottom: 1.5px solid var(--text-subtle);
  transform: rotate(-45deg);
  transition: transform 0.12s;
}
details.quiet-section[open] > summary::after { transform: rotate(45deg); }
details.quiet-section > summary:hover { background: var(--row-hover); }

/* An entity's page opens with the answer: is it there, how fresh, what its worker is doing */
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: -4px 0 14px; }
.status-item { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); }
.status-item .age-text.fresh { color: var(--text-color); }
.muted { color: var(--text-muted); }


/* a section of a page that starts closed: its title is the toggle */
details.section { margin: 4px 0 20px; }
details.section > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 8px 0;
  cursor: pointer;
  list-style: none;
  font-size: var(--text-base);
  color: var(--text-color);
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--text-subtle);
  border-bottom: 1.5px solid var(--text-subtle);
  transform: rotate(-45deg);
  transition: transform 0.12s;
}
details.section[open] > summary::before { transform: rotate(45deg); }
details.section > summary .note { font-weight: 400; color: var(--text-muted); }
details.section > summary:hover { color: var(--accent); }

/* ---- Charts of the metric history (components/charts.js, metric-history.js). One measure per chart; colour
   only for state (red, amber) or, for a plain measure, the accent. Text stays in text colours. */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px 28px; padding: 4px 16px 16px; }
.chart { margin: 0; min-width: 0; }
.chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: var(--text-sm); font-weight: 600; }
.chart-summary { font-weight: 400; color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-plot { position: relative; padding-top: 16px; }
.chart-plot svg { display: block; width: 100%; height: 96px; overflow: visible; touch-action: none; }
.chart-y { position: absolute; top: 0; left: 0; font-size: var(--text-xs); line-height: 14px; color: var(--text-subtle); }
.chart-x { display: flex; justify-content: space-between; margin-top: 4px; font-size: var(--text-xs); color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.chart .chart-rule { stroke: var(--border); stroke-width: 1; }
.chart .chart-base { stroke: var(--border-strong); stroke-width: 1; }
.chart .chart-col { fill: var(--chart-accent); rx: 1; }
.chart .chart-col.tone-wait { fill: var(--chart-warn); }
.chart .chart-col.tone-fail { fill: var(--danger-dot); }
.chart .chart-line { fill: none; stroke: var(--chart-accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .chart-band { fill: var(--chart-accent); fill-opacity: 0.12; stroke: none; }
.chart .chart-crosshair { stroke: var(--text-subtle); stroke-width: 1; visibility: hidden; }
.chart-tip {
  position: absolute;
  top: 16px;
  transform: translate(-50%, calc(-100% - 6px));
  visibility: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 9px;
  font-size: var(--text-xs);
  white-space: nowrap;
  pointer-events: none;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.18);
  z-index: 5;
}
.chart-tip strong { color: var(--text-color); font-size: var(--text-sm); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the time span switch in a panel's title line */
.segmented { display: inline-flex; margin-left: auto; padding: 2px; gap: 2px; background: var(--neutral-bg); border-radius: var(--radius); }
.segmented button {
  height: 24px;
  padding: 0 10px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.segmented button.on { color: var(--text-color); background: var(--surface); font-weight: 500; }
.metric-history .notice { padding: 4px 16px 16px; }
details.quiet-section .metric-history { border: 0; margin: 0; }

/* a task type's last hour on the Workers page: one cell a minute, in its worst state's colour */
.health-strip { display: flex; gap: 1px; width: 100%; height: 14px; }
.health-strip .cell { flex: 1; min-width: 1px; border-radius: 1px; background: var(--tone-dot); cursor: help; }
.health-strip .cell.tone-none { background: var(--neutral-bg); }
.health-strip .cell.tone-ok { opacity: 0.55; }
/* a span switch keeps the last charts, faded, until the new span's history arrives */
.metric-history.loading .chart-grid { opacity: 0.45; transition: opacity 0.15s; }

/* ---- A value (components/value-view.js): any app's data as a tree on a recessed well of its own. Each field
   under its own name, as in the data, bold in the brown of the diagram lines; each value styled by what it is: text in the normal font,
   numbers, codes, true, false and null in the code font with digits of equal width; no hue, as every colour in
   the console already means something. */
.value-surface { padding: 6px 8px 8px; background: var(--value-bg); border-top: 1px solid var(--border); }
value-view { display: block; }
.vt { font-size: var(--text-base); line-height: 20px; }
.vt-row {
  display: grid;
  grid-template-columns: var(--key-width, 160px) minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  padding: 5px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.vt-row:last-child { border-bottom: 0; }
.vt-row:hover { background: color-mix(in srgb, var(--text-color) 4%, transparent); }
.vt-key {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding-left: calc(var(--depth) * 16px);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--label-text);
}
.vt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-toggle + .vt-name { cursor: pointer; }
.vt-toggle, .vt-toggle-space { flex: none; width: 18px; height: 18px; }
.vt-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--text-subtle);
  cursor: pointer;
}
.vt-toggle svg { width: 12px; height: 12px; transition: transform 0.12s; }
.vt-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.vt-toggle:hover { color: var(--text-color); }
.vt-val { min-width: 0; color: var(--text-color); overflow-wrap: anywhere; }
.vt-meta { color: var(--text-subtle); font-family: var(--font-mono); font-size: var(--text-sm); }
.vt-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.1s; }
.vt-row:hover .vt-actions, .vt-actions:focus-within { opacity: 1; }
.vt-actions button, .vt-more {
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
  font: 500 var(--text-xs)/1 var(--font-sans);
  cursor: pointer;
}
.vt-actions button:hover, .vt-more:hover { color: var(--text-color); border-color: var(--border-strong); }
.vt-more { margin-top: 6px; }
.vt-toggle:focus-visible, .vt-actions button:focus-visible, .vt-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.vv-num, .vv-code, .vv-bool, .vv-null {
  font-family: var(--font-mono);
  font-size: var(--text-code);
  font-variant-numeric: tabular-nums;
}
.vv-null { color: var(--text-subtle); }
.vv-time { font-variant-numeric: tabular-nums; }
.vv-age { margin-left: 10px; font-size: var(--text-xs); color: var(--text-subtle); }
.vv-cut { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.vt-items { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.vt-chip {
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  line-height: 20px;
}
.vt-single { padding: 10px 8px; font-size: var(--text-lead); }

/* a list of records: a compact table under its row, numbers right-aligned and lined up on the decimal point */
.vt-table { padding: 2px 8px 12px calc(var(--depth) * 16px + 26px); overflow-x: auto; }
.vt-grid { border-collapse: collapse; font-size: var(--text-base); }
.vt-grid th {
  padding: 4px 28px 6px 0;
  font: 700 var(--text-xs) var(--font-sans);
  text-align: left;
  white-space: nowrap;
  color: var(--label-text);
  border-bottom: 1px solid var(--border-strong);
}
.vt-grid td {
  padding: 6px 28px 6px 0;
  white-space: nowrap;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.vt-grid tbody tr:last-child td { border-bottom: 0; }
.vt-grid tbody tr:hover td { background: color-mix(in srgb, var(--text-color) 4%, transparent); }
.vt-grid .num { text-align: right; }
.vt-grid th:last-child, .vt-grid td:last-child { padding-right: 0; }
.vt-pad { visibility: hidden; }

/* a data value in a table of the console's own, such as the inputs a result was made from */
.table td.value { font-family: var(--font-mono); font-size: var(--text-code); }

/* on a narrow screen a value's names sit above their values */
@media (max-width: 600px) {
  .vt-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .vt-val { padding-left: calc(var(--depth) * 16px + 20px); }
  .vt-actions { display: none; }
}

/* a refused change of a task type, under its controls */
.control-error { color: var(--danger-text); }

/* a worker's name, in the Workers table's first column: the console's font, like a task type, labelling the row */
.worker-name { font-weight: 500; }

/* A task type's Running panel: a sentence and Pause or Resume, then how often it may compute, then where it applies */
.running-panel .facts { align-items: center; padding-top: 4px; }
.running-panel .facts dt { color: var(--text-muted); font-size: var(--text-xs); }
.running-panel .facts dd { margin: 0; }
.running-now { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.running-foot { margin: 0; padding: 0 16px 14px; color: var(--text-muted); font-size: var(--text-xs); }

/* ═══════════════════════════════════════════════════════════
   App page components: an app's own pages (components/page/): forms, tables, sentences of figures, charts
   ═══════════════════════════════════════════════════════════ */

.form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.field {
  display: grid;
  gap: 6px;
  max-width: 560px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.field-note {
  color: var(--text-subtle);
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.field-row .field {
  flex: 1 1 160px;
}

.form .table.holdings td {
  padding-top: 4px;
  padding-bottom: 4px;
}

/* a holdings editor: as wide as its contents, the quantity and Remove beside the instrument */
.form .table.holdings {
  justify-self: start; /* the form is a grid, which would stretch it */
  width: max-content;
  max-width: 100%;
}

.form .table.holdings select {
  width: 340px; /* a fixed width: a percentage here would let the table grow to the panel's */
  max-width: 100%;
}

.form .table input.quantity {
  width: 140px;
  text-align: right;
}

.table .num {
  text-align: right;
}

.table td.remove {
  width: 1%;
}

.table td.muted {
  color: var(--text-muted);
}

/* A table's total line (components/page/data-table.js tableTotal), as in accounts: a rule above, a double rule below */
.table tr.total td {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* as in accounts, the rules sit under the figures, not across the whole table */
.table tr.total td.num {
  border-top: 1px solid var(--text-color);
  border-bottom: 3px double var(--text-color);
}

.table:has(tr.total) {
  margin-bottom: 16px;
}

/* A sentence of figures in a result panel, in place of a row of cards; its figures are bold */
.page-sentence {
  margin: 14px 16px;
  max-width: 90ch;
}

.page-sentence:empty {
  display: none;
}

.page-sentence b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.actions .spacer {
  flex: 1;
}

.result-cards {
  padding: 16px 16px 0;
}

.verdict {
  margin: 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-weight: 500;
  background: var(--success-bg);
  color: var(--success-text);
}

.verdict.breach {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.verdict.waiting {
  background: var(--neutral-bg);
  color: var(--text-muted);
}

.table td.over-limit {
  color: var(--warning-text);
  font-weight: 500;
}

.table td.quote {
  font-style: italic;
}

.limit-meter {
  position: relative;
  overflow: visible;
}

/* a limit meter in a facts list: slim, beside its name */
.facts .limit-meter {
  width: 240px;
  margin-top: 8px;
}

.limit-meter .limit {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--text-color);
}

/* Charts (components/page/xy-chart.js, time-chart.js, hover-tip.js, legend.js): the figure, its caption, axis labels,
   hover text and legend. A page styles its own marks and legend keys (.page-chart-key.<name>). */
.page-chart { position: relative; margin: 0; }
.page-chart svg { display: block; overflow: visible; touch-action: none; }
.page-chart-plot { position: relative; } /* the hover text is placed over the plot */
.page-chart-caption { margin-bottom: 6px; font-size: var(--text-xs); color: var(--text-subtle); }
.page-chart-axis { font-size: 11px; fill: var(--text-subtle); font-variant-numeric: tabular-nums; }
.page-chart-tip { position: absolute; transform: translate(-50%, calc(-100% - 10px)); padding: 6px 9px; font-size: var(--text-xs); line-height: 1.45;
  white-space: nowrap; pointer-events: none; color: var(--text-color); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 2px 8px rgb(0 0 0 / 0.12); font-variant-numeric: tabular-nums; }
.page-chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; font-size: var(--text-xs); color: var(--text-muted); }
.page-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.page-chart-key { display: inline-block; width: 14px; height: 2px; background: var(--kind-computed); }

/* ═══════════════════════════════════════════════════════════
   The look shared with the website: a faint glow, translucent panels with a soft shadow, larger titles with a
   label above, the kinds' colours in the menu, and controls to match. Change you can see (.fig, .skeleton, the
   chart crosshair) is here too; every motion follows a real change the page received.
   ═══════════════════════════════════════════════════════════ */

/* a faint light from the top right, in the workers' blue and the results' pink, fixed while the page scrolls */
.admin_main {
  background:
    radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--kind-task) 12%, transparent), transparent 70%) fixed,
    radial-gradient(700px 420px at 100% 60%, color-mix(in srgb, var(--kind-computed) 6%, transparent), transparent 70%) fixed,
    var(--background);
}

.theme-switch:checked ~ #admin .admin_main {
  background:
    radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--kind-task) 16%, transparent), transparent 70%) fixed,
    radial-gradient(700px 420px at 100% 60%, color-mix(in srgb, var(--kind-computed) 7%, transparent), transparent 70%) fixed,
    var(--background);
}

/* panels: frosted, rounded, lifted a little off the page */
.widget {
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px rgb(20 24 31 / 0.02), 0 18px 40px -26px rgb(20 30 50 / 0.35);
}

.theme-switch:checked ~ #admin .widget {
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.03), 0 20px 50px -24px rgb(0 0 0 / 0.7);
}

.panel-head h2,
.panel-head h3 {
  font-size: 1.03rem;
  letter-spacing: -0.01em;
}

/* page titles: larger and tighter, as the website's headings */
.admin_main h1 {
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.page-head h1 {
  font-size: 1.5rem;
}

/* the small label above a page's title: the menu's heading and the page's entry (components/navigation-menu.js),
   in the colour of the page's section */
#page_container[data-label]::before {
  content: attr(data-label);
  display: block;
  margin-bottom: 10px;
  font: 500 11.5px/1.2 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--section-ink, var(--text-subtle));
}

/* an app page's title takes the colours of its menu badge (components/navigation-menu.js sets data-kind) */
#page_container[data-kind="task"] { --section-color: var(--kind-task); --section-bg: color-mix(in srgb, var(--kind-task) 14%, transparent); --section-ink: var(--kind-task-ink); }
#page_container[data-kind="source"] { --section-color: var(--kind-ingested); --section-bg: color-mix(in srgb, var(--kind-ingested) 14%, transparent); --section-ink: var(--kind-ingested-ink); }
#page_container[data-kind="result"] { --section-color: var(--kind-computed); --section-bg: color-mix(in srgb, var(--kind-computed) 14%, transparent); --section-ink: var(--kind-computed-ink); }
#page_container[data-kind="plain"] { --section-color: var(--neutral-text); --section-bg: color-mix(in srgb, var(--neutral-text) 14%, transparent); --section-ink: var(--text-subtle); }

/* the menu's icons sit in small badges of their kind's colour */
.menu_icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--neutral-bg);
}

.menu_link .menu_icon svg {
  width: 14px;
  height: 14px;
  color: var(--neutral-text);
}

.menu_icon.k-task { background: color-mix(in srgb, var(--kind-task) 20%, transparent); }
.menu_icon.k-source { background: color-mix(in srgb, var(--kind-ingested) 22%, transparent); }
.menu_icon.k-result { background: color-mix(in srgb, var(--kind-computed) 20%, transparent); }
.menu_link .menu_icon.k-task svg, .menu_link[aria-current="page"] .menu_icon.k-task svg { color: var(--kind-task-ink); }
.menu_link .menu_icon.k-source svg, .menu_link[aria-current="page"] .menu_icon.k-source svg { color: var(--kind-ingested-ink); }
.menu_link .menu_icon.k-result svg, .menu_link[aria-current="page"] .menu_icon.k-result svg { color: var(--kind-computed-ink); }

.menu_link {
  border-radius: 8px;
  transition: background-color 0.15s, color 0.15s;
}

.menu_link[aria-current="page"] {
  color: var(--text-color);
  background-color: color-mix(in srgb, var(--accent) 13%, transparent);
}

/* controls */
.btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.form-control {
  height: 32px;
  border-radius: 8px;
}

/* a select's own arrow, with room for it, so a long choice ends in "…" instead of running under the arrow */
select.form-control {
  appearance: none;
  padding-right: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%237d889a' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  cursor: pointer;
}

select.form-control[multiple] {
  background-image: none;
  padding-right: 8px;
}

/* a segmented choice with a thumb that slides to the one chosen (components/page/segmented.js adds the thumb) */
.segmented {
  position: relative;
  border-radius: 9px;
}

.segmented button {
  position: relative;
  z-index: 1;
  border-radius: 6px;
  transition: color 0.2s;
}

.segmented > .thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.18), 0 0 0 1px var(--border-strong);
  transition: left 0.28s cubic-bezier(0.3, 0.7, 0.2, 1), width 0.28s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.segmented.sliding button[aria-pressed="true"] {
  background: none;
  box-shadow: none;
}

/* a figure that moved: a brief tint, green up and red down, that fades (services/motion.js nextTint,
   components/page/figure.js). Each way has two names with the same animation, so a repeat restarts it. */
.fig {
  border-radius: 5px;
}

.fig-up-a { animation: fig-up-a 1.4s ease-out; }
.fig-up-b { animation: fig-up-b 1.4s ease-out; }
.fig-down-a { animation: fig-down-a 1.4s ease-out; }
.fig-down-b { animation: fig-down-b 1.4s ease-out; }

@keyframes fig-up-a { from { background-color: var(--up-bg); color: var(--up-text); } to { background-color: transparent; } }
@keyframes fig-up-b { from { background-color: var(--up-bg); color: var(--up-text); } to { background-color: transparent; } }
@keyframes fig-down-a { from { background-color: var(--down-bg); color: var(--down-text); } to { background-color: transparent; } }
@keyframes fig-down-b { from { background-color: var(--down-bg); color: var(--down-text); } to { background-color: transparent; } }

/* a placeholder in the shape of what is coming, while a panel waits for its first result (components/page/placeholder.js) */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text-color) 5%, transparent);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--text-color) 7%, transparent) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.3s infinite;
}

@keyframes skeleton-shimmer {
  to { transform: translateX(100%); }
}

.skeleton-sentence { display: block; height: 3.2em; max-width: 720px; margin: 4px 0; }
.skeleton-line { display: inline-block; vertical-align: middle; width: min(320px, 100%); height: 1em; border-radius: 6px; }
.skeleton-chart { display: block; height: 220px; margin: 8px 0; }

/* a chart's crosshair at the point under the pointer, and that point (components/page/hover-tip.js) */
.chart-crosshair {
  stroke: var(--border-strong);
  stroke-width: 1;
  pointer-events: none;
}

.chart-hot {
  fill: var(--surface);
  stroke: var(--kind-computed);
  stroke-width: 2;
  pointer-events: none;
}

/* the connection dot beats when the page receives a message (at most twice a second); its ring needs the room */
.conn {
  gap: 9px;
}

.conn .dot {
  position: relative;
}

.conn .dot.beat::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--success-dot);
  animation: dot-beat 0.9s ease-out;
}

@keyframes dot-beat {
  from { opacity: 0.8; transform: scale(0.5); }
  to { opacity: 0; transform: scale(1.6); }
}

@media (prefers-reduced-motion: reduce) {
  .fig-up-a, .fig-up-b, .fig-down-a, .fig-down-b, .skeleton::after, .conn .dot.beat::after { animation: none; }
  .segmented > .thumb, .menu_link, .btn { transition: none; }
}

/* The Data flow's type card (components/flow-card.js): solid, beside the clicked type, at a reading width, with labels
   beside their values and a link to the type's page at the bottom */
.flow-card {
  position: fixed;
  z-index: 50;
  overflow: auto;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 0.45);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-secondary);
}

.flow-card[hidden] { display: none; }
.flow-card-close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; font: 400 20px/1 var(--font-sans); color: var(--text-subtle); }
.flow-card-close:hover, .flow-card-close:focus-visible { background: var(--surface-muted); color: var(--text-color); }
.flow-card h3 { margin: 0 0 8px; padding-right: 28px; font-size: 1rem; font-weight: 600; color: var(--text-color); overflow-wrap: anywhere; letter-spacing: -0.01em; }
.flow-card p { margin: 0 0 8px; }
.flow-card-kind { margin-bottom: 5px; padding-right: 28px; font: 500 11px/1.2 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-subtle); }
.flow-card-kind.k-task { color: var(--kind-task-ink); }
.flow-card-kind.k-source { color: var(--kind-ingested-ink); }
.flow-card-kind.k-result { color: var(--kind-computed-ink); }
.flow-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--border); }
.flow-card dt { font-size: var(--text-sm); color: var(--text-subtle); }
.flow-card dd { margin: 0; }
.flow-card dd.num { font-family: var(--font-mono); font-size: 12px; color: var(--text-color); white-space: nowrap; }
.flow-card dd b { color: var(--text-color); font-weight: 600; }
.flow-card-link { display: inline-block; margin-top: 12px; font: 500 var(--text-sm) var(--font-sans); color: var(--accent); text-decoration: none; }
.flow-card-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* An app page's longer explanation, one click away: "About this page" under its intro, "How to read this chart" in a
   panel. Plain <details>, so it opens without script and a reader can find it with the browser's search. */
details.about-page,
details.about-chart {
  max-width: 90ch;
}

details.about-page { margin: -6px 0 18px; }
details.about-chart { margin: 4px 0 8px; }

details.about-page > summary,
details.about-chart > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

details.about-page > summary::-webkit-details-marker,
details.about-chart > summary::-webkit-details-marker { display: none; }

details.about-page > summary::before,
details.about-chart > summary::before {
  content: "";
  width: 10px;
  height: 10px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4.5 3l3 3-3 3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4.5 3l3 3-3 3'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.2s;
}

details[open].about-page > summary::before,
details[open].about-chart > summary::before { transform: rotate(90deg); }

details.about-page > summary:hover,
details.about-chart > summary:hover { color: var(--text-color); }

details.about-page > p {
  margin: 8px 0 0;
  max-width: 90ch;
  color: var(--text-muted);
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  details.about-page > summary::before, details.about-chart > summary::before { transition: none; }
}

/* "More about this" (components/type-doc.js): a type's document, under the page's intro, read as prose. Its headings
   start at h3, below the page's panels. */
.type-doc-body { margin-top: 10px; color: var(--text-secondary); line-height: 1.6; overflow-wrap: break-word; }
.type-doc-body > :first-child { margin-top: 0; }
.type-doc-body h3, .type-doc-body h4, .type-doc-body h5, .type-doc-body h6 { margin: 18px 0 6px; line-height: 1.35; }
.type-doc-body h3 { font-size: var(--text-panel); }
.type-doc-body h4 { font-size: var(--text-base); }
.type-doc-body h5, .type-doc-body h6 { font-size: var(--text-sm); }
.type-doc-body p, .type-doc-body ul, .type-doc-body ol, .type-doc-body blockquote { margin: 0 0 10px; }
.type-doc-body ul, .type-doc-body ol { padding-left: 22px; }
.type-doc-body li + li { margin-top: 3px; }
.type-doc-body blockquote { padding-left: 22px; color: var(--text-muted); }
.type-doc-body code { padding: 1px 5px; font-size: 0.9em; background: var(--value-bg); border: 1px solid var(--border); border-radius: 4px; }
.type-doc-body pre { margin: 0 0 12px; padding: 10px 12px; font-size: var(--text-sm); line-height: 1.5; background: var(--value-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.type-doc-body pre code { padding: 0; font-size: inherit; background: none; border: 0; }
.type-doc-body table { display: block; max-width: 100%; overflow-x: auto; margin: 4px 0 12px; border-collapse: collapse; font-size: var(--text-sm); }
.type-doc-body th, .type-doc-body td { padding: 6px 14px 6px 0; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.type-doc-body th { font-size: var(--text-xs); font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.type-doc-body hr { margin: 16px 0; border: 0; border-top: 1px solid var(--border); }

/* a select is as wide as its longest choice, so a name shows whole (within its field) */
.field select.form-control { justify-self: start; width: auto; min-width: 200px; max-width: 100%; }

/* a result panel's parts: a small heading over each table, notes at the same gaps */
.result-section { margin: 20px 16px 8px; font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); }
.result-note { margin: 4px 16px 12px; font-size: var(--text-sm); color: var(--text-subtle); }
.result-source { margin: 16px; }

/* ---- A figure's lineage (components/lineage-view.js): a result's page has Details and Lineage tabs; the lineage
   is a tree-table, with a small map (built on .flow) for a short one, a value's card on hover or focus and pinned
   cards beside it.
   Marks are words in a pill, never colour alone; nothing moves but what really changed. */
.page-tabs { margin: 0 0 16px; }
.segmented a {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 12px;
  border-radius: 4px;
  color: var(--text-muted);
  font: 500 var(--text-xs) var(--font-sans);
  text-decoration: none;
}
.segmented a:hover { color: var(--text-color); text-decoration: none; }
.segmented a[aria-current="page"] { background: var(--surface); color: var(--text-color); box-shadow: 0 0 0 1px var(--border-strong); }
.segmented a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.table td.lineage a.row-action { font-size: var(--text-sm); }

.lineage-head { flex-wrap: wrap; height: auto; min-height: 42px; padding: 8px 16px; row-gap: 8px; }
.lineage-head h2 { overflow-wrap: anywhere; }
.lineage-asof { font-weight: 400; color: var(--text-muted); }
.lineage-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.lineage-tools .segmented { margin-left: 0; }

.lineage-lines p, .lineage-incomplete { margin: 0 16px 10px; font-size: var(--text-sm); }
.lineage-lines p { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lineage-incomplete p { margin: 0 0 4px; }
.lineage-incomplete ul { margin: 0; padding-left: 1.25rem; color: var(--text-muted); }

.lineage-layout { display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--border); }
.lineage-layout.with-pins { grid-template-columns: minmax(0, 1fr) minmax(17rem, 24rem); }
@media (max-width: 900px) { .lineage-layout.with-pins { grid-template-columns: minmax(0, 1fr); } }
.lineage-main { min-width: 0; }
.lineage-pins { display: flex; flex-direction: column; gap: 12px; padding: 12px; background: var(--surface-muted); }

.link-button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; text-align: left; }
.link-button:hover { text-decoration: underline; }
.link-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* a value in the diagram: a button showing its card, and one showing its inputs */
.flow-node.pin-node { flex-direction: column; align-items: stretch; gap: 0; padding: 0; }
.flow-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 9px 12px 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}
button.flow-main { cursor: pointer; }
.flow-main:focus-visible, .flow-more:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.flow-node.pin-node:has(> .flow-main[aria-pressed="true"]) { border-color: var(--text-muted); background: var(--flow-node-lit); }
.flow-more {
  padding: 5px 12px 6px 44px;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  background: none;
  color: var(--accent);
  font: 500 var(--text-xs) var(--font-sans);
  text-align: left;
  cursor: pointer;
}
.flow-more:hover { text-decoration: underline; }
.flow-marks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.flow-mark {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 9px;
  background: var(--neutral-bg);
  color: var(--neutral-text);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}
.flow-mark.changed-since, .flow-mark.changed, .flow-mark.can-t-be-followed, .flow-mark.not-yet-available {
  background: var(--warning-bg);
  color: var(--warning-text);
}

/* inputs a worker looked up first are quieter than those it recalculates from */
.flow-wires .wire.live { stroke-opacity: 0.8; }
.flow-wires .wire.discovery { stroke-dasharray: 5 4; stroke-opacity: 0.5; }

/* the tree-table: the figure on top, one line per entity, each value's inputs indented under it */
.lineage-summary { margin: 0 16px 10px; font-size: var(--text-sm); color: var(--text-secondary); }
.lineage-tabs { display: inline-flex; margin: 0 16px 10px; }
.lineage-check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-secondary); white-space: nowrap; cursor: pointer; }
.lineage-check input { margin: 0; accent-color: var(--accent); }
.lineage-search { min-width: 12rem; }
.lineage-none { margin: 12px 16px; font-size: var(--text-sm); color: var(--text-muted); }
/* the Export menu is the account menu's panel and items (.account-panel, .account-item); only its anchor and notes are here */
.lineage-export { position: relative; }
.lineage-export-note { margin: 0; padding: 2px 10px 6px; font-size: var(--text-xs); color: var(--text-muted); }
.lineage-export-failure { color: var(--danger-text); }
.lineage-export-panel { width: max-content; min-width: 248px; max-width: 360px; }
.account-item:disabled { color: var(--text-muted); cursor: progress; background: none; }
@media (max-width: 600px) { .lineage-export-panel { right: auto; left: 0; max-width: calc(100vw - 2rem); } }

.lineage-main { overflow-x: auto; }
.lineage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  color: var(--text-color);
  font-variant-numeric: tabular-nums;
}
.lineage-table th {
  height: 32px;
  padding: 0 10px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.lineage-table td {
  height: 2.1rem;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}
.lineage-table tbody tr:last-child td { border-bottom: 0; }
.lineage-table tbody tr[data-row] { cursor: default; }
.lineage-table tbody tr[data-pin], .lineage-table tbody tr.lt-group, .lineage-table tbody tr.lt-also { cursor: pointer; }
.lineage-table tbody tr[role="row"]:hover td { background: var(--surface-muted); }
.lineage-table tbody tr[aria-selected="true"] td { background: var(--flow-node-lit, var(--surface-muted)); }
.lineage-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lineage-table .lt-entity { width: 1%; }
.lineage-table th.lt-value { min-width: 8rem; }
/* beside pinned cards, the data time gives way (the card and the age say it) so the state columns stay in view */
@media (min-width: 641px) { .lineage-layout.with-pins .lineage-table .lt-time { display: none; } }
.lt-indent { display: inline-flex; align-items: center; gap: 6px; padding-left: calc(var(--depth, 0) * 1.25rem); }
.lt-fold, .lt-fold-space { flex: none; width: 20px; height: 20px; }
/* nesting guides: one line per level, under the fold button of the row it belongs to, coloured by level */
.lineage-table td:first-child { position: relative; }
.lt-guides { position: absolute; inset: 0 auto 0 0; pointer-events: none; }
.lt-guide {
  position: absolute; top: 0; bottom: -1px; width: 2px;
  left: calc(10px + 9px + var(--level) * 1.25rem);
  background: hsl(var(--guide-hue) 60% 55% / 0.55);
}
.lt-guide { --guide-hue: 212; }
.lt-guide:nth-child(6n + 2) { --guide-hue: 268; }
.lt-guide:nth-child(6n + 3) { --guide-hue: 186; }
.lt-guide:nth-child(6n + 4) { --guide-hue: 32; }
.lt-guide:nth-child(6n + 5) { --guide-hue: 322; }
.lt-guide:nth-child(6n + 6) { --guide-hue: 240; }
.lt-fold {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}
.lt-fold svg { width: 12px; height: 12px; transition: transform 0.12s; }
.lt-fold[aria-expanded="true"] svg { transform: rotate(90deg); }
.lt-fold:hover { color: var(--text-color); }
.lt-kind { flex: none; width: 1em; font-family: var(--font-mono); font-weight: 600; text-align: center; }
.lt-kind.k-result { color: var(--kind-computed-ink); }
.lt-kind.k-source { color: var(--text-muted); }
.lt-type { font-weight: 600; }
.lt-id { color: var(--text-secondary); font-family: var(--font-mono); font-size: var(--text-xs); }
.lt-figure .lt-type { font-size: var(--text-base); }
.lineage-table td.lt-value { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary); font-family: var(--font-mono); font-size: var(--text-xs); }
.lineage-table td.lt-time, .lineage-table td.lt-age { color: var(--text-secondary); font-family: var(--font-mono); font-size: var(--text-xs); }
.lineage-table td.lt-age { text-align: right; }
.lineage-table th.lt-age { text-align: right; }
.lineage-table td.lt-role { color: var(--text-muted); font-style: italic; }
.lineage-table td.lt-from { color: var(--text-secondary); }
.lt-also .lt-type, .lt-also .lt-id { color: var(--text-muted); font-weight: 500; }
.lt-also-link { color: var(--accent); font-size: var(--text-xs); }
.lt-group .lt-id { font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-muted); }
.lineage-table tr.lt-decided td { height: 1.6rem; color: var(--text-subtle); font-size: var(--text-xs); font-style: italic; }
.lineage-table tr.lt-more td { color: var(--text-muted); }
.lineage-table .flow-mark { font-size: 0.7rem; }
.mono { font-family: var(--font-mono); }

/* phone width: each row is the entity on one line, the other columns folded onto a second under its name */
@media (max-width: 640px) {
  .lineage-table, .lineage-table tbody { display: block; }
  .lineage-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .lineage-table tbody tr[role="row"] {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    padding: 6px 12px 6px calc(12px + 32px + var(--row-depth, 0) * 1.25rem);
    border-bottom: 1px solid var(--border);
  }
  .lineage-table tbody tr[role="row"] td { display: block; height: auto; padding: 0; border: 0; }
  .lineage-table tbody tr[role="row"] td:empty { display: none; }
  .lineage-table tbody tr[role="row"] td.lt-entity { flex: 1 0 100%; width: auto; margin-left: calc(-32px - var(--row-depth, 0) * 1.25rem); white-space: normal; }
  .lineage-table tbody tr[role="row"] td.lt-value { flex: 1 0 100%; max-width: 100%; }
  .lineage-table tbody tr.lt-decided { display: block; }
  .lt-guides { display: none; }
  .lineage-table tbody tr.lt-decided td { display: block; border: 0; }
  .lineage-table tbody tr:last-child { border-bottom: 0; }
  .lineage-search { min-width: 0; flex: 1 1 100%; }
}

/* a value's card: on hover or focus, and pinned beside the table */
.lineage-card {
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.lineage-card.hover {
  position: fixed;
  z-index: 50;
  max-height: calc(100vh - 80px);
  overflow: auto;
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 0.45);
}
.lineage-card.pinned { position: relative; }
.lineage-card h3 { margin: 0 0 6px; padding-right: 28px; font-size: var(--text-panel); font-weight: 600; color: var(--text-color); overflow-wrap: anywhere; }
.lineage-card h4 { margin: 0 0 4px; font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.lineage-card p { margin: 0 0 8px; }
.lineage-card .value-surface { max-height: 22rem; overflow: auto; }
/* in a card's narrow width, a field's Copy and Path float over its row instead of taking a column */
.lineage-card .vt-row { position: relative; grid-template-columns: minmax(0, min(var(--key-width, 160px), 45%)) minmax(0, 1fr); gap: 10px; }
.lineage-card .vt-actions { position: absolute; top: 4px; right: 4px; }
.lineage-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 10px; }
.lineage-facts dt { color: var(--text-subtle); }
.lineage-facts dd { margin: 0; color: var(--text-color); }
.lineage-changed-note { color: var(--warning-text); }
.lineage-reason { color: var(--text-muted); }
.lineage-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 10px; }
.lineage-card-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.lineage-entries ul { margin: 0 0 8px; padding-left: 1.1rem; }
.lineage-pin-hint { margin: 8px 0 0; font-size: var(--text-xs); }
@media (prefers-reduced-motion: reduce) {
  .lt-fold svg { transition: none; }
}
