/* 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;
}

/* ---------------------------------------------------------------- header, nav, footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header__inner {
  max-width: 72rem; margin: 0 auto; padding: 0.5rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 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); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0.5rem 0.75rem;
  color: var(--text); text-decoration: none; border-bottom: 3px solid transparent;
}
.site-nav a:hover { text-decoration: underline; color: var(--text); }
.site-nav a[aria-current] { font-weight: 700; border-bottom-color: var(--link); }
.site-user { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.site-user p { margin: 0; color: var(--muted); }
.site-user strong { color: var(--text); }

main { flex: 1; width: 100%; max-width: 72rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.875rem; }
.site-footer p { max-width: 72rem; 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 { 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="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: center; gap: 0.5rem; min-height: 2rem; }
.choice input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--link); flex: none; }
.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; }

/* ---------------------------------------------------------------- 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 { color: var(--error); }
.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; }
  .site-nav a[aria-current] { border-bottom-color: Highlight; }
}
@media (prefers-reduced-motion: no-preference) {
  a, .button { transition: color 0.1s, background-color 0.1s; }
}
