/* ==========================================================================
   Novo Chatbot Sync — design tokens, base elements, page layout
   Component styles live in components.css.
   ========================================================================== */

:root {
  color-scheme: light;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Neutrals */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e6e9ee;
  --code-bg: #f7f8fa;
  --border: #e3e6eb;
  --border-strong: #cbd1d9;
  --text: #151922;
  --text-2: #475061;
  --text-3: #687183;

  /* Single accent */
  --accent: #5b3fd6;
  --accent-hover: #4a2fc0;
  --accent-strong: #4a2fc0;
  --accent-soft: #efebfd;
  --accent-text: #ffffff;
  --link: #4a2fc0;
  --focus: #5b3fd6;

  /* Status */
  --ok: #157a3c;
  --ok-soft: #e6f5ec;
  --err: #c0262d;
  --err-soft: #fdecec;
  --run: #1c5dcc;
  --run-soft: #e7effd;
  --warn: #9a5800;
  --warn-soft: #fff3dc;
  --muted: #5d6573;
  --muted-soft: #eef0f3;

  /* Shape & depth */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 14px 36px rgba(16, 24, 40, 0.16), 0 2px 6px rgba(16, 24, 40, 0.06);
  --backdrop: rgba(12, 14, 20, 0.45);

  /* Layout */
  --header-h: 56px;
  --container: 1320px;
  --gutter: clamp(16px, 3vw, 28px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1015;
    --surface: #161920;
    --surface-2: #1c2029;
    --surface-3: #262b36;
    --code-bg: #12151b;
    --border: #2a2f3a;
    --border-strong: #3a414f;
    --text: #e7e9ef;
    --text-2: #b2b8c5;
    --text-3: #8b93a3;
    --accent: #9c86ff;
    --accent-hover: #b09fff;
    --accent-strong: #b8a8ff;
    --accent-soft: rgba(156, 134, 255, 0.14);
    --accent-text: #15112a;
    --link: #b8a8ff;
    --focus: #b09fff;
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.12);
    --err: #f87171;
    --err-soft: rgba(248, 113, 113, 0.12);
    --run: #6aa8ff;
    --run-soft: rgba(106, 168, 255, 0.13);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.12);
    --muted: #9aa2b1;
    --muted-soft: rgba(154, 162, 177, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.3);
    --backdrop: rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1015;
  --surface: #161920;
  --surface-2: #1c2029;
  --surface-3: #262b36;
  --code-bg: #12151b;
  --border: #2a2f3a;
  --border-strong: #3a414f;
  --text: #e7e9ef;
  --text-2: #b2b8c5;
  --text-3: #8b93a3;
  --accent: #9c86ff;
  --accent-hover: #b09fff;
  --accent-strong: #b8a8ff;
  --accent-soft: rgba(156, 134, 255, 0.14);
  --accent-text: #15112a;
  --link: #b8a8ff;
  --focus: #b09fff;
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, 0.12);
  --run: #6aa8ff;
  --run-soft: rgba(106, 168, 255, 0.13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --muted: #9aa2b1;
  --muted-soft: rgba(154, 162, 177, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.3);
  --backdrop: rgba(0, 0, 0, 0.6);
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd {
  margin: 0;
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

img, svg {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--accent-soft);
}

/* ---------- Utilities ---------- */

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 200;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 10px;
}

.num,
.tabular {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

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

.nowrap {
  white-space: nowrap;
}

.spacer {
  flex: 1 1 auto;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 560px) {
  .hide-sm {
    display: none !important;
  }
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
}

.topbar__inner {
  max-width: var(--container);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

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

.brand__mark {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.brand__name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__env {
  font: 500 11px/1 var(--font-mono);
  color: var(--text-3);
  border: 1px solid var(--border);
  padding: 4px 7px;
  border-radius: 999px;
}

.nav ul {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

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

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

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-toggle {
  display: none !important;
}

@media (max-width: 960px) {
  .nav-toggle {
    display: inline-grid !important;
  }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    padding: 8px var(--gutter) 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }

  .nav.is-open {
    display: block;
  }

  .nav ul {
    flex-direction: column;
  }

  .nav__link {
    padding: 11px 12px;
  }
}

@media (max-width: 560px) {
  .brand__env {
    display: none;
  }

  .topbar__inner {
    gap: 10px;
  }
}

@media (max-width: 380px) {
  .brand__name {
    font-size: 14px;
  }
}

/* ---------- Page ---------- */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px var(--gutter) 56px;
}

main:focus {
  outline: none;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 22px;
}

.page-head > div:first-child {
  min-width: 0;
}

.page-title {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.page-sub {
  margin-top: 4px;
  color: var(--text-2);
  max-width: 70ch;
}

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

.section-title {
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section + .section {
  margin-top: 30px;
}

.footer-note {
  margin-top: 40px;
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}
