/* Design tokens: light theme is the default, dark theme is opt-in via #theme-switch.
   System fonts only, so the console renders instantly and works without internet access. */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, "Cascadia Mono",
    Consolas, "Liberation Mono", monospace;

  --radius: 6px;
  --gutter: 16px;
  --row-height: 36px;

  --background: #f3f5f8;
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --border: #e2e5e9;
  --border-strong: #cdd2d8;
  --text-color: #14181f;
  --text-muted: #59636f;
  --text-subtle: #8b939e;
  --accent: #2563c9;
  --accent-soft: #e8f0fc;
  --row-hover: #e6eefb;
  --teal-text: #0f6e6e;
  --teal-bg: #e0f3f1;
  --violet-text: #5b3db8;
  --violet-bg: #eeeafb;
  --amber: #d48a10;

  --success-text: #17663a;
  --success-bg: #e5f3ea;
  --success-dot: #22a05a;
  --warning-text: #8a5200;
  --warning-bg: #fcf0db;
  --danger-dot: #d0453a;
  --neutral-text: #4b5563;
  --neutral-bg: #edeff2;

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

  --switch-text: "Dark";
}

/* 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: #0c1015;
  color-scheme: dark;
}

.theme-switch:checked ~ #admin {
  --background: #0c1015;
  --surface: #12171e;
  --surface-muted: #161c24;
  --border: #222a34;
  --border-strong: #2e3845;
  --text-color: #e5e8ec;
  --text-muted: #9aa3ae;
  --text-subtle: #6a7480;
  --accent: #6aa5f5;
  --accent-soft: #172a45;
  --row-hover: #223149;
  --teal-text: #5fd0c4;
  --teal-bg: #12302e;
  --violet-text: #b8a3f5;
  --violet-bg: #251d42;
  --amber: #e9a83a;

  --success-text: #7dcf98;
  --success-bg: #142c1d;
  --success-dot: #3fbf70;
  --warning-text: #eab35a;
  --warning-bg: #33260f;
  --danger-dot: #e8635a;
  --neutral-text: #b3bbc6;
  --neutral-bg: #222a34;

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

  --switch-text: "Light";
  color-scheme: dark;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  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);
}

.switch-label,
.logout,
.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: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.switch-label::before {
  content: var(--switch-text);
}

.switch-label:hover,
.logout:hover,
.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;
}

.theme-switch:focus-visible ~ #admin .switch-label {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Layout */
.admin {
  display: grid;
  height: 100vh;
  grid-template-rows: 44px 1fr 24px;
  grid-template-columns: 196px 1fr;
  grid-template-areas: "header header" "nav main" "footer footer";
  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;
}

/* Status bar */
footer {
  display: flex;
  grid-area: footer;
  justify-content: space-between;
  align-items: center;
  gap: var(--gutter);
  padding: 0 12px;
  color: var(--text-muted);
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 11.5px;
}

footer p {
  margin: 0;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.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 (as on calseda.com), drawn as a mask so it takes the theme's colour */
.logo-mark {
  display: inline-block;
  flex: none;
  width: 22px;
  height: 22px;
  background: var(--teal-text);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='5' cy='6' r='2.6'/%3E%3Ccircle cx='5' cy='20' r='2.6'/%3E%3Ccircle cx='21' cy='13' r='3.4' fill='black'/%3E%3Cpath d='M7.5 7.2C12 8.5 13 12 17.6 12.6M7.5 18.8C12 17.5 13 14 17.6 13.4'/%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 26 26' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='5' cy='6' r='2.6'/%3E%3Ccircle cx='5' cy='20' r='2.6'/%3E%3Ccircle cx='21' cy='13' r='3.4' fill='black'/%3E%3Cpath d='M7.5 7.2C12 8.5 13 12 17.6 12.6M7.5 18.8C12 17.5 13 14 17.6 13.4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.logo h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

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

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

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

.menu_heading {
  margin: 16px 0 6px;
  padding: 0 10px;
  font-size: 11.5px;
  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: 18px;
  font-weight: 600;
}

.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: 12px;
  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: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.card p,
.card .large-timestamp {
  display: block;
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.card .large-timestamp {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 25px;
}

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

.card p.waiting {
  font-size: 13px;
  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: 16px;
  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: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.panel-head .note {
  font-size: 12px;
  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: 12.5px;
  color: var(--text-color);
  font-variant-numeric: tabular-nums;
}

.table th {
  height: 32px;
  padding: 0 16px;
  text-align: left;
  font-size: 11.5px;
  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: 12px;
}

.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: 13px;
  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: 12px;
}

.data-view {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--surface-muted);
  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: 11px;
  color: var(--text-subtle);
}

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

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

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

.badge-live {
  color: var(--success-text);
  background-color: var(--success-bg);
}

.badge-deleted {
  color: var(--neutral-text);
  background-color: var(--neutral-bg);
}

.badge-not_yet_available {
  color: var(--warning-text);
  background-color: var(--warning-bg);
}

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

.tag-task {
  color: var(--violet-text);
  background-color: var(--violet-bg);
}

.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: 12px;
  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: 11px;
  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;
  max-width: 200px;
  box-sizing: border-box;
  padding: 9px 12px 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  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;
}

.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(--violet-text);
  background: var(--violet-bg);
}

.flow-node.worker .flow-name {
  font-size: 14px;
}

.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;
}

.flow-icon.task { color: var(--violet-text); background: var(--violet-bg); }
.flow-icon.ingress { color: var(--teal-text); background: var(--teal-bg); }
.flow-icon.egress { color: var(--accent); background: var(--accent-soft); }
.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: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.flow-sub {
  overflow: hidden;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.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: 11px;
  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: 10.5px;
  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(--violet-text);
  stroke-opacity: 0.55;
}

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

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

.flow-wires marker path { fill: var(--border-strong); }
.flow-wires marker.needs path,
.flow-wires marker.produces path { fill: var(--violet-text); fill-opacity: 0.55; }
.flow-wires marker.decides path,
.flow-wires marker.declared path { fill: var(--text-subtle); }

.flow-wires .wire-label {
  font-family: var(--font-sans);
  font-size: 11px;
  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: 12px;
  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: collapse the sidebar into a top strip on narrow screens */
@media screen and (max-width: 48rem) {
  .admin {
    grid-template-rows: 44px auto 1fr 24px;
    grid-template-columns: 1fr;
    grid-template-areas: "header" "nav" "main" "footer";
  }

  .logo {
    width: auto;
    border-right: 0;
  }

  navigation-menu {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .menu {
    display: flex;
    overflow-x: auto;
  }

  .menu {
    gap: 4px;
    padding: 6px 8px;
  }

  .menu_item + .menu_item {
    margin-top: 0;
  }

  .menu_link {
    white-space: nowrap;
  }

  .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(> .type-ref) {
  text-decoration: none;
}

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

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

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

.panel-caption {
  margin: 0;
  padding: 8px 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

/* 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: 12.5px;
  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: 12px;
  font-weight: 500;
  line-height: 22px;
  color: var(--text-muted);
}

.fact dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 0;
  min-height: 22px;
}

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

.fact-note {
  font-size: 12.5px;
  color: var(--text-muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  margin: 1px 4px 1px 0;
  font-size: 12px;
  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.task svg { color: var(--violet-text); }
.type-ref.ingress svg { color: var(--teal-text); }
.type-ref.egress svg { color: var(--accent); }

.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 { color: var(--violet-text); background: var(--violet-bg); }
.panel-icon.ingress { color: var(--teal-text); background: var(--teal-bg); }
.panel-icon.egress { color: var(--accent); background: var(--accent-soft); }

/* 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-color: var(--violet-text);
  --section-bg: var(--violet-bg);
  --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="entities"] {
  --section-color: var(--teal-text);
  --section-bg: var(--teal-bg);
  --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");
}


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

.connect-client h3 {
  margin: 0 0 2px;
  font-size: 14px;
}

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

.code-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.code-row pre {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}
