/* Synergentic API portal. No JavaScript; light and dark themes follow the system setting.
   Contrast ratios are against --bg (and --surface, which is close to it). */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f5f6f8;
  --text: #1a1a1a;
  --muted: #595959;
  --link: #0a58ca;
  --link-hover: #083f91;
  --on-primary: #ffffff;
  --error: #b3261e;
  --error-bg: #fdecea;
  --success: #1e7b34;
  --success-bg: #e8f5ec;
  --notice-bg: #fff6db;
  --notice-border: #8a6100;
  --border: #c9ccd1;
  --border-input: #767676;
  --focus: #0a58ca;
  --focus-ring-bg: #ffffff;
  --danger: #b3261e;
  --tag-bg: #e7eefc;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1c1d20;
    --text: #e8e8e8;
    --muted: #a8a8a8;
    --link: #8ab4f8;
    --link-hover: #b3cdfa;
    --on-primary: #121212;
    --error: #ff8a80;
    --error-bg: #2a1614;
    --success: #7ee2a8;
    --success-bg: #12261a;
    --notice-bg: #2a2410;
    --notice-border: #e0b84c;
    --border: #3d4046;
    --border-input: #8a8a8a;
    --focus: #8ab4f8;
    --focus-ring-bg: #121212;
    --danger: #ff8a80;
    --tag-bg: #1f2d45;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------------------------------------------------------------- focus and links */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 0.15em; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus {
  left: 1rem; top: 1rem; z-index: 10;
  padding: 0.5rem 1rem; background: var(--bg); color: var(--text);
  border: 2px solid var(--focus);
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- top bar, sidebar, footer */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar__inner {
  max-width: 84rem; margin: 0 auto; padding: 0.25rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.5rem;
}
.site-name {
  font-weight: 700; font-size: 1.125rem; color: var(--text); text-decoration: none;
  padding: 0.5rem 0; min-height: 2.75rem; display: inline-flex; align-items: center;
}
.site-name:hover { text-decoration: underline; color: var(--text); }
.signed-in { margin: 0 0 0 auto; color: var(--muted); }
.signed-in strong { color: var(--text); }
.topnav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.topnav a, .topnav__button {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0.5rem 0.75rem;
  color: var(--text); text-decoration: none; border: 0; border-bottom: 3px solid transparent;
  background: none; font: inherit; cursor: pointer;
}
.topnav a:hover, .topnav__button:hover { text-decoration: underline; color: var(--text); }
.topnav a[aria-current] { font-weight: 700; border-bottom-color: var(--link); }

.shell { flex: 1; width: 100%; max-width: 84rem; margin: 0 auto; }
.shell--sidebar { display: grid; grid-template-columns: 14rem minmax(0, 1fr); }
.sidebar { border-right: 1px solid var(--border); padding: 1.5rem 0.75rem 2rem 1rem; }
.sidebar__heading {
  font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); margin: 0 0 0.5rem 0.5rem;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0.5rem; border-radius: 0.375rem;
  color: var(--text); text-decoration: none; border-left: 4px solid transparent;
}
.sidebar a:hover { background: var(--surface); text-decoration: underline; color: var(--text); }
.sidebar a[aria-current] { font-weight: 700; background: var(--surface); border-left-color: var(--link); }
.sidebar__status { font-size: 0.8125rem; font-weight: 400; color: var(--success); }
.sidebar__status--down { color: var(--error); font-weight: 700; }
@media (max-width: 48rem) {
  .shell--sidebar { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); padding: 0.75rem 1rem; }
  .signed-in { margin-left: 0; width: 100%; }
}

.subnav { margin: 0 0 1.25rem; border-bottom: 1px solid var(--border); }
.subnav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.subnav a {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0.5rem 0.875rem;
  color: var(--text); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.subnav a:hover { text-decoration: underline; color: var(--text); }
.subnav a[aria-current] { font-weight: 700; border-bottom-color: var(--link); }

main { min-width: 0; padding: 1.5rem 1rem 3rem 1.5rem; }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.875rem; }
.site-footer p { max-width: 84rem; margin: 0 auto; padding: 1rem; }

.breadcrumbs ol { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.breadcrumbs li:not(:last-child)::after { content: "›"; content: "›" / ""; margin-left: 0.5rem; color: var(--muted); }
.breadcrumbs a { display: inline-block; padding: 0.25rem 0; }

/* ---------------------------------------------------------------- headings and text */
h1 { font-size: 1.75rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
.h1-sub { font-size: 1rem; font-weight: 400; color: var(--muted); }
.lede { color: var(--muted); max-width: 48rem; }
code, .mono { font-family: var(--mono); font-size: 0.9375em; }
.small { font-size: 0.875rem; }
.wrap { overflow-wrap: anywhere; }
.narrow { max-width: 40rem; }
.page-head, .section-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem;
}
.page-head h1, .section-head h2 { margin-bottom: 0; }
.page-head { margin-bottom: 1rem; }
.section-head { margin: 2rem 0 0.75rem; }
.section-head h2 { margin-top: 0; }
.empty { color: var(--muted); }
.filter { margin: 0 0 1rem; }
.tag {
  display: inline-block; font-size: 0.8125rem; font-weight: 600; padding: 0 0.4rem;
  border-radius: 0.25rem; background: var(--tag-bg); color: var(--text);
}

/* ---------------------------------------------------------------- messages */
.flash {
  margin: 0 0 1.25rem; padding: 0.75rem 1rem;
  border-left: 5px solid var(--success); background: var(--success-bg); color: var(--text);
}
.flash::before { content: "✓ "; content: "✓ " / ""; color: var(--success); font-weight: 700; }
.flash--error { border-left-color: var(--error); background: var(--error-bg); }
.flash--error::before { content: "⚠ "; content: "⚠ " / ""; color: var(--error); }
.error-summary {
  margin: 0 0 1.5rem; padding: 1rem 1.25rem;
  border: 3px solid var(--error); background: var(--error-bg);
}
.error-summary:focus { outline: 3px solid var(--focus); outline-offset: 3px; }
.error-summary h2, .error-summary h3 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.error-summary ul { margin: 0; padding-left: 1.25rem; }
.error-summary a { color: var(--error); font-weight: 600; }
.notice {
  margin: 0 0 1.5rem; padding: 1rem 1.25rem;
  border-left: 5px solid var(--notice-border); background: var(--notice-bg);
}
.notice p { margin: 0 0 0.75rem; }

/* ---------------------------------------------------------------- forms */
.form { margin-top: 1rem; }
.field { margin: 0 0 1.5rem; padding: 0; border: 0; min-width: 0; }
.field label, .field legend, .label-like { display: block; font-weight: 600; margin: 0 0 0.25rem; }
.label-like + p { margin-top: 0; }
.optional { font-weight: 400; color: var(--muted); }
.hint { color: var(--muted); margin: 0 0 0.5rem; max-width: 40rem; }
.field-error { color: var(--error); font-weight: 600; margin: 0 0 0.5rem; }
.field-error::before { content: "⚠ "; content: "⚠ " / ""; }
.field--error { border-left: 4px solid var(--error); padding-left: 0.75rem; }
fieldset.field { padding-left: 0; }
fieldset.field.field--error { padding-left: 0.75rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="search"],
input[type="number"], input[type="datetime-local"], select, textarea {
  display: block; width: 100%; max-width: 40rem;
  font: inherit; color: var(--text); background: var(--bg);
  border: 2px solid var(--border-input); border-radius: 0.25rem;
  padding: 0.5rem 0.625rem; min-height: 2.75rem;
}
textarea { resize: vertical; min-height: 5rem; }
input, select, textarea { scroll-margin-top: 10rem; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--error); border-width: 3px;
}
.input--short { max-width: 8rem; }
.input--medium { max-width: 20rem; }
.input--mono { font-family: var(--mono); }

.group { border: 0; padding: 0; margin: 0 0 0.5rem; min-width: 0; }
.group > legend { padding: 0; margin: 0; }
.group > legend h2 { margin: 1.5rem 0 1rem; }

.choices { display: flex; flex-direction: column; gap: 0.5rem; }
.choices--inline { flex-direction: row; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.choice { display: flex; align-items: flex-start; gap: 0.5rem; min-height: 2rem; }
.choice input { width: 1.25rem; height: 1.25rem; margin: 0.15rem 0 0; accent-color: var(--link); flex: none; }
.choice-conditional { margin: 0.25rem 0 0.5rem 0.6rem; padding-left: 1.25rem; border-left: 4px solid var(--muted); }
.choice-conditional .field { margin-bottom: 0.5rem; }
.choice label { font-weight: 400; margin: 0; cursor: pointer; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 1.5rem; }
.actions a { padding: 0.5rem 0; }
.inline-form { display: inline; margin: 0; }

/* ---------------------------------------------------------------- buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0.5rem 1.125rem;
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  color: var(--on-primary); background: var(--link);
  border: 2px solid var(--link); border-radius: 0.375rem;
}
.button:hover { color: var(--on-primary); background: var(--link-hover); border-color: var(--link-hover); text-decoration: underline; }
.button--secondary, .button--quiet { color: var(--link); background: transparent; }
.button--secondary:hover, .button--quiet:hover { color: var(--link-hover); background: transparent; }
.button--quiet { border-color: var(--border-input); color: var(--text); }
.button--danger { color: var(--on-primary); background: var(--danger); border-color: var(--danger); }
.button--danger:hover { background: var(--danger); border-color: var(--danger); filter: brightness(0.9); }
.link-button {
  font: inherit; color: var(--link); background: none; border: 0; padding: 0.25rem 0;
  text-decoration: underline; text-underline-offset: 0.15em; cursor: pointer; min-height: 1.5rem;
}
.link-button:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

/* ---------------------------------------------------------------- filters and toolbars */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; margin: 0 0 1rem; }
.field--inline { margin: 0; }
.field--inline input, .field--inline select { min-width: 14rem; }
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
  padding: 0.625rem 0.75rem; margin: 0 0 0.75rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.375rem;
}
.toolbar__label { font-weight: 700; }
.toolbar__hint { color: var(--muted); margin-left: 0.5rem; }
.button--danger-outline { color: var(--danger); background: transparent; border-color: var(--danger); }
.button--danger-outline:hover { color: var(--on-primary); background: var(--danger); border-color: var(--danger); }
.select-cell { width: 3rem; text-align: center; }
.select-cell input { width: 1.25rem; height: 1.25rem; margin: 0.15rem 0 0; accent-color: var(--link); }
.table-wrap--error { border: 3px solid var(--error); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager span { color: var(--muted); padding: 0.25rem 0; }

/* ---------------------------------------------------------------- tables and details */
.table-wrap { overflow-x: auto; margin: 0 0 1rem; border: 1px solid var(--border); border-radius: 0.375rem; }
table { width: 100%; border-collapse: collapse; }
caption { text-align: left; font-weight: 600; padding: 0.75rem 1rem; caption-side: top; }
th, td { text-align: left; vertical-align: top; padding: 0.625rem 1rem; border-top: 1px solid var(--border); }
thead th { background: var(--surface); font-size: 0.9375rem; white-space: nowrap; }
tbody th { font-weight: 600; }
.row-actions { white-space: nowrap; }
.row-actions > * + * { margin-left: 1rem; }
.row-actions a, .row-actions .link-button { display: inline-block; padding: 0.25rem 0; min-height: 1.5rem; }
.status { font-weight: 600; }
.status--removed, .status--inactive, .status--down { color: var(--error); }
.status--active { color: var(--success); }
.status--scheduled { color: var(--muted); }
.status--published { color: var(--success); }

.details { display: grid; grid-template-columns: minmax(10rem, max-content) 1fr; gap: 0.5rem 1.5rem; margin: 0 0 1rem; }
.details dt { font-weight: 600; }
.details dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 36rem) {
  .details { grid-template-columns: 1fr; gap: 0.125rem; }
  .details dd { margin-bottom: 0.5rem; }
}
.row-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.row-links a { padding: 0.25rem 0; }
.notes {
  white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font);
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.375rem;
  padding: 0.75rem 1rem; margin: 0 0 1rem;
}
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { padding: 0.375rem 0; border-top: 1px solid var(--border); }
.pager { display: flex; gap: 1.5rem; margin: 0 0 1rem; }
.pager a { padding: 0.25rem 0; }
.aside { margin-top: 2.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }

@media (forced-colors: active) {
  .button, .link-button, input, select, textarea { border: 2px solid ButtonText; }
  .flash, .error-summary, .notice { border: 2px solid CanvasText; }
  .topnav a[aria-current], .subnav a[aria-current] { border-bottom-color: Highlight; }
  .sidebar a[aria-current] { border-left-color: Highlight; }
  .topnav__button { border: 0; border-bottom: 3px solid transparent; }
}
@media (prefers-reduced-motion: no-preference) {
  a, .button { transition: color 0.1s, background-color 0.1s; }
}

/* ---------------------------------------------------------------- cards, stats, charts */
.card { border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.25rem 1.25rem 1rem; margin: 0 0 1.5rem; }
.card > h2 { margin-top: 1rem; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 1.5rem; }
.badge { display: inline-block; font-size: 0.875rem; font-weight: 700; padding: 0.125rem 0.5rem; border-radius: 1rem; border: 2px solid currentColor; vertical-align: middle; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.figures li { background: var(--surface); border: 1px solid var(--border); border-radius: 0.375rem; padding: 0.75rem 1rem; }
.figures .figure__value { display: block; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.figures .figure__label { color: var(--muted); }
.chart { margin: 0 0 1.5rem; }
.chart figcaption { font-weight: 700; }
.chart__summary { color: var(--muted); margin: 0.25rem 0 0.5rem; }
.chart__svg { display: block; width: 100%; max-width: 48rem; height: auto; }
.chart__bar { fill: var(--link); }
.chart__grid { stroke: var(--border); stroke-width: 1; }
.chart__tick { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart__data summary { cursor: pointer; min-height: 2rem; padding: 0.25rem 0; color: var(--link); text-decoration: underline; }
.chart__data .table-wrap { margin-top: 0.5rem; max-height: 24rem; overflow-y: auto; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); gap: 0 1.5rem; }
.notes-rendered { border-left: 4px solid var(--border); padding: 0.25rem 0 0.25rem 1rem; margin: 0 0 1rem; overflow-wrap: anywhere; }
.notes-rendered > :first-child { margin-top: 0; }
.notes-rendered h3, .notes-rendered h4, .notes-rendered h5, .notes-rendered h6 { margin: 1rem 0 0.5rem; }
.notes-rendered code { background: var(--surface); padding: 0 0.25rem; border-radius: 0.25rem; }
.notes-rendered pre { background: var(--surface); padding: 0.75rem; overflow-x: auto; }
.code-block { font-family: var(--mono); background: var(--surface); border: 1px solid var(--border); border-radius: 0.375rem; padding: 0.5rem 0.75rem; overflow-wrap: anywhere; white-space: pre-wrap; margin: 0 0 1rem; }
@media (forced-colors: active) {
  .chart__bar { fill: Highlight; }
  .badge, .card { border-color: CanvasText; }
}

/* ---------------------------------------------------------------- notifications */
.status--live { color: var(--success); }
.status--scheduled, .status--draft, .status--expired { color: var(--muted); }
.status--withdrawn { color: var(--error); }
.severity { font-weight: 600; }
.severity--critical { color: var(--error); }
.severity--warning { color: var(--notice-border); }
.pre-line { white-space: pre-line; }
.npreview {
  border: 1px solid var(--border); border-left: 6px solid var(--link); border-radius: 0.375rem;
  background: var(--bg); padding: 0.75rem 1rem; margin: 0 0 1rem; max-width: 40rem;
}
.npreview--warning, .npreview--maintenance { border-left-color: var(--notice-border); }
.npreview--critical { border-left-color: var(--error); }
.npreview__meta { margin: 0; display: flex; gap: 0.5rem; align-items: center; }
.npreview__severity { font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.npreview__subject { margin: 0.25rem 0 0.5rem; font-size: 1.15rem; }
.npreview__body { border-left: 0; padding-left: 0; }
.npreview__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 0.25rem; list-style: none; padding: 0; }
.preview-card:focus { outline: 3px solid var(--focus); outline-offset: 3px; }
.npreview__button {
  display: inline-block; padding: 0.375rem 0.875rem; border-radius: 0.375rem; font-weight: 600;
  background: var(--link); color: var(--on-primary); border: 2px solid var(--link);
}
.npreview__button--quiet { background: transparent; color: var(--text); border-color: var(--border-input); }
.translation { border: 1px solid var(--border); border-radius: 0.375rem; padding: 0.5rem 1rem 0.75rem; }
.translation > legend { padding: 0 0.25rem; }
@media (forced-colors: active) {
  .npreview { border-left-color: CanvasText; }
  .npreview__button { border: 2px solid ButtonText; }
}

/* ---------------------------------------------------------------- API access */
.perm-group { font-weight: 600; }
.tag--warn { background: var(--notice-bg); color: var(--text); border: 1px solid var(--notice-border); }
.choice--described { flex-wrap: wrap; }
.choice--described .choice__desc { flex-basis: 100%; margin: 0 0 0.5rem 1.75rem; }
.choice__title { font-weight: 600; }
.perm-fieldset { border: 1px solid var(--border); border-radius: 0.375rem; padding: 0.5rem 1rem 0.25rem; }
.perm-fieldset > legend { padding: 0 0.25rem; }
.preset-list { padding-left: 1.25rem; }
.preset-list li { margin: 0.25rem 0; }
.preset-list a[aria-current] { font-weight: 700; }
.endpoint-list { list-style: none; margin: 0; padding: 0; }
#new-key { font-size: 0.875rem; }
.secret-field { min-height: 0; resize: none; overflow-wrap: anywhere; word-break: break-all; field-sizing: content; }
.choice--described label { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
fieldset.perm-fieldset { padding-left: 1rem; }

/* Licensing: status words carry the meaning; colour only reinforces it. */
.status--past_due, .status--suspended, .status--revoked, .status--blocked { color: var(--error); }
.status--merged, .status--anonymized { color: var(--muted); }

/* Passkeys (login and /account/passkeys) */
.passkey-signin { margin: 0 0 1.5rem; }
.button[aria-disabled="true"] { cursor: progress; }
.passkey-status { margin: 0.75rem 0 0; min-height: 1.5em; }
.passkey-status:empty { margin: 0; min-height: 0; }
.passkey-status--error { color: var(--error); font-weight: 600; }
.passkey-status--error::before { content: "⚠ "; content: "⚠ " / ""; }
.divider { margin: 1.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); }

/* Staging / development: a strip above the top bar so the environment is never mistaken for
   production. Text plus a dashed border, not colour alone. */
.env-banner { background: var(--notice-bg); border-bottom: 2px dashed var(--notice-border); color: var(--text); }
.env-banner p { max-width: 84rem; margin: 0 auto; padding: 0.375rem 1rem; font-size: 0.9375rem; }
