/* ==========================================================================
   Mirsee Documentation Portal
   Brand: #1e75b9 primary / #1a6ba8 hover / neutral-900 surfaces / Geist type
   ========================================================================== */

:root {
  --brand:            #1e75b9;
  --brand-hover:      #1a6ba8;
  --brand-contrast:   #ffffff;

  --bg:               #ffffff;
  --bg-subtle:        #f6f8fa;
  --bg-sunken:        #eef1f5;
  --surface:          #ffffff;
  --surface-raised:   #ffffff;

  --text:             #16202b;
  --text-muted:       #596673;
  --text-faint:       #7d8996;

  --border:           #e2e7ed;
  --border-strong:    #cdd5de;

  --topbar-bg:        #171717;
  --topbar-border:    #2c2c2c;
  --topbar-text:      #ededed;
  --topbar-muted:     #a3a3a3;

  --accent-soft:      rgba(30, 117, 185, 0.09);
  --accent-ring:      rgba(30, 117, 185, 0.35);

  --ok:               #1a7f43;
  --warn:             #b45309;
  --danger:           #c0392f;
  --info:             var(--brand);

  --code-bg:          #f6f8fa;
  --code-border:      #e2e7ed;
  --code-text:        #24292f;

  --shadow-sm:  0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-md:  0 4px 12px rgba(16, 24, 40, .10), 0 2px 4px rgba(16, 24, 40, .06);
  --shadow-lg:  0 12px 32px rgba(16, 24, 40, .16);

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --topbar-h:   56px;
  --sidebar-w:  282px;
  --toc-w:      232px;
  --content-max: 860px;
  --radius:     8px;
  --radius-sm:  6px;
}

:root[data-theme="dark"],
:root[data-theme="auto"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { color-scheme: dark; }
}

/* Dark palette, applied for explicit dark and for auto+system-dark. */
:root[data-theme="dark"],
:root[data-theme="dark"] * ,
html[data-theme="dark"] {
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg:             #0f1115;
    --bg-subtle:      #14171d;
    --bg-sunken:      #0a0c10;
    --surface:        #14171d;
    --surface-raised: #191d24;

    --text:           #e6e9ee;
    --text-muted:     #a0abb8;
    --text-faint:     #78848f;

    --border:         #262b33;
    --border-strong:  #39414c;

    --brand:          #4c9ce0;
    --brand-hover:    #6bb0ea;

    --accent-soft:    rgba(76, 156, 224, 0.14);
    --accent-ring:    rgba(76, 156, 224, 0.40);

    --ok:             #48c07a;
    --warn:           #e0a33e;
    --danger:         #f0736a;

    --code-bg:        #0d1016;
    --code-border:    #262b33;
    --code-text:      #d6dbe3;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 4px 14px rgba(0,0,0,.45);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
  }
}

:root[data-theme="dark"] {
  --bg:             #0f1115;
  --bg-subtle:      #14171d;
  --bg-sunken:      #0a0c10;
  --surface:        #14171d;
  --surface-raised: #191d24;

  --text:           #e6e9ee;
  --text-muted:     #a0abb8;
  --text-faint:     #78848f;

  --border:         #262b33;
  --border-strong:  #39414c;

  --brand:          #4c9ce0;
  --brand-hover:    #6bb0ea;

  --accent-soft:    rgba(76, 156, 224, 0.14);
  --accent-ring:    rgba(76, 156, 224, 0.40);

  --ok:             #48c07a;
  --warn:           #e0a33e;
  --danger:         #f0736a;

  --code-bg:        #0d1016;
  --code-border:    #262b33;
  --code-text:      #d6dbe3;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 14px rgba(0,0,0,.45);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
}

/* ------------------------------------------------------------------ base */

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

/* Author `display` rules outrank the UA rule for [hidden], so restate it.
   Without this, .user-dropdown { display: flex } renders while hidden. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; }

img { max-width: 100%; }

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

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

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

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: 500 14px/1 var(--font-sans);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: currentColor; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  color: var(--topbar-text);
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--topbar-text); }
.brand:hover { text-decoration: none; }
.brand-logo { height: 20px; width: auto; display: block; }
.brand-divider {
  width: 1px; height: 18px; background: #454545; display: inline-block;
}
.brand-text { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }

.nav-toggle {
  display: none;
  background: transparent; border: 0; color: var(--topbar-text);
  padding: 8px; cursor: pointer; border-radius: 6px;
}
.nav-toggle svg { width: 18px; height: 13px; display: block; }
.nav-toggle:hover { background: #262626; }

/* search ------------------------------------------------------------- */

.search {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  width: 100%;
}
.search input {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 34px;
  border-radius: var(--radius-sm);
  border: 1px solid #383838;
  background: #202020;
  color: var(--topbar-text);
  font: 400 14px/1 var(--font-sans);
}
.search input::placeholder { color: #808080; }
.search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30,117,185,.30);
  background: #232323;
}
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: #8a8a8a; pointer-events: none;
}
.search kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: #8a8a8a; border: 1px solid #404040;
  border-radius: 4px; padding: 1px 5px; background: #2a2a2a; pointer-events: none;
}
.search input:focus ~ kbd { display: none; }

.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden; z-index: 70; max-height: 60vh; overflow-y: auto;
}
.search-results a {
  display: block; padding: 10px 14px; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.is-active { background: var(--accent-soft); text-decoration: none; }
.search-results .sr-title { font-weight: 500; font-size: 14px; display: block; }
.search-results .sr-snippet { font-size: 12.5px; color: var(--text-muted); display: block; margin-top: 2px; }
.search-results .sr-empty { padding: 14px; color: var(--text-muted); font-size: 13.5px; }

/* version picker ------------------------------------------------------ */

.version-picker { position: relative; }
.version-button {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 10px;
  background: #202020; border: 1px solid #383838; border-radius: var(--radius-sm);
  color: var(--topbar-text); font: 500 13px/1 var(--font-sans); cursor: pointer;
}
.version-button:hover { background: #272727; border-color: #4a4a4a; }
.version-label { color: var(--topbar-muted); font-weight: 400; }
.version-current { font-family: var(--font-mono); font-size: 12.5px; }
.version-button .chev { width: 10px; height: 7px; color: var(--topbar-muted); }

.version-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 210px; max-height: 340px; overflow-y: auto;
  list-style: none; margin: 0; padding: 5px;
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  /* Above the user dropdown, which sits later in the DOM and would otherwise
     paint over this one whenever the two boxes overlap. */
  z-index: 90;
}
.version-menu a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font-mono); font-size: 13px;
}
.version-menu a:hover { background: var(--accent-soft); text-decoration: none; }
.version-menu a.is-active { background: var(--accent-soft); color: var(--brand); font-weight: 500; }

.badge {
  font: 500 10.5px/1 var(--font-sans); letter-spacing: .03em; text-transform: uppercase;
  padding: 3px 6px; border-radius: 4px;
}
.badge-latest { background: var(--accent-soft); color: var(--brand); }
.badge-pre    { background: rgba(180,83,9,.14); color: var(--warn); }
.badge-branch { background: var(--bg-sunken); color: var(--text-muted); }

/* user menu ------------------------------------------------------------ */

.user-menu { position: relative; }
.user-button {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  background: var(--brand); border: 0; color: #fff; padding: 0;
  display: grid; place-items: center;
}
.user-button:hover { background: var(--brand-hover); }
.avatar { font: 600 12px/1 var(--font-sans); letter-spacing: .02em; }

.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px;
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 80;
  padding: 6px; display: flex; flex-direction: column;
}
.user-identity {
  padding: 10px; border-bottom: 1px solid var(--border); margin-bottom: 5px;
  display: flex; flex-direction: column; gap: 2px;
}
.user-identity strong { font-size: 14px; color: var(--text); }
.user-identity span { font-size: 12.5px; color: var(--text-muted); word-break: break-all; }
.user-dropdown a,
.user-dropdown button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: transparent; border: 0; cursor: pointer;
  font: 400 14px/1.4 var(--font-sans); color: var(--text);
}
.user-dropdown a:hover,
.user-dropdown button:hover { background: var(--accent-soft); text-decoration: none; }
.user-dropdown form { margin: 0; }

/* ----------------------------------------------------------- docs shell */

.docs-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
}

/* sidebar -------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--border);
  background: var(--bg-subtle);
}
.sidebar-inner { padding: 20px 8px 48px 16px; }

.sidebar-heading {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 0 8px 12px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 13px; letter-spacing: .01em; color: var(--text);
}
.sidebar-version {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 400;
  color: var(--text-muted); white-space: nowrap;
}

.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-level-1 { margin-left: 10px; padding-left: 8px; border-left: 1px solid var(--border); }
.nav-level-2 { margin-left: 10px; padding-left: 8px; border-left: 1px solid var(--border); }

.nav-item { margin: 1px 0; }

.nav-link, .nav-label {
  display: block; padding: 5px 9px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-muted); line-height: 1.45;
}
.nav-link:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.nav-link.is-active {
  background: var(--accent-soft); color: var(--brand); font-weight: 500;
  box-shadow: inset 2px 0 0 var(--brand);
}
.nav-label {
  color: var(--text); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .045em; padding-top: 14px;
}

.nav-group-head { display: flex; align-items: center; gap: 2px; }
.nav-group-head > .nav-link,
.nav-group-head > .nav-label { flex: 1; min-width: 0; }
.nav-caret {
  background: transparent; border: 0; cursor: pointer; padding: 5px;
  color: var(--text-faint); border-radius: 4px; display: grid; place-items: center;
}
.nav-caret svg { width: 10px; height: 7px; transition: transform .16s ease; transform: rotate(-90deg); }
.nav-caret:hover { background: var(--bg-sunken); color: var(--text); }
.nav-group.is-open > .nav-group-head .nav-caret svg { transform: rotate(0deg); }
.nav-group > .nav-list { display: none; }
.nav-group.is-open > .nav-list { display: block; }

.sidebar-scrim { display: none; }

/* content -------------------------------------------------------------- */

.content { min-width: 0; }
.content-inner {
  max-width: var(--content-max);
  padding: 28px 40px 88px;
  margin: 0 auto;
}

.version-notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 14px; margin-bottom: 20px;
  border: 1px solid rgba(180,83,9,.3); background: rgba(180,83,9,.08);
  border-radius: var(--radius); font-size: 13.5px; color: var(--text);
}
.version-notice a { font-weight: 500; }

.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-muted); margin-bottom: 14px;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--brand); }
.crumb-sep { color: var(--text-faint); }

/* on this page --------------------------------------------------------- */

.toc-rail {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 28px 16px 48px 4px;
}
.on-this-page ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.otp-title {
  margin: 0 0 10px; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint);
}
.on-this-page li a {
  display: block; padding: 4px 10px; font-size: 12.5px; line-height: 1.45;
  color: var(--text-muted); border-left: 2px solid transparent; margin-left: -1px;
}
.on-this-page li a:hover { color: var(--text); text-decoration: none; }
.on-this-page li a.is-active { color: var(--brand); border-left-color: var(--brand); font-weight: 500; }
.otp-h3 a { padding-left: 22px; font-size: 12px; }

/* pager ---------------------------------------------------------------- */

.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border);
}
.pager a {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); background: var(--surface);
}
.pager a:hover { border-color: var(--brand); text-decoration: none; box-shadow: var(--shadow-sm); }
.pager span { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.pager strong { font-size: 14px; font-weight: 500; color: var(--brand); }
.pager-next { text-align: right; }

.edit-link { margin-top: 36px; font-size: 13px; }

/* ------------------------------------------------------- markdown body */

.markdown-body { font-size: 15px; color: var(--text); }

.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  line-height: 1.25; font-weight: 600; letter-spacing: -.012em;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
  position: relative;
}
.markdown-body h1 { font-size: 32px; margin: 0 0 18px; letter-spacing: -.021em; }
.markdown-body h2 {
  font-size: 23px; margin: 46px 0 14px; padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}
.markdown-body h3 { font-size: 18.5px; margin: 34px 0 10px; }
.markdown-body h4 { font-size: 16px; margin: 26px 0 8px; }
.markdown-body h5, .markdown-body h6 { font-size: 14.5px; margin: 22px 0 8px; color: var(--text-muted); }

.header-anchor {
  opacity: 0; margin-left: 8px; color: var(--text-faint);
  font-weight: 400; text-decoration: none; transition: opacity .12s ease;
}
.markdown-body h2:hover .header-anchor,
.markdown-body h3:hover .header-anchor,
.markdown-body h4:hover .header-anchor { opacity: 1; }
.header-anchor:hover { color: var(--brand); text-decoration: none; }

.markdown-body p { margin: 0 0 16px; }
.markdown-body ul, .markdown-body ol { margin: 0 0 16px; padding-left: 26px; }
.markdown-body li { margin: 5px 0; }
.markdown-body li > ul, .markdown-body li > ol { margin: 5px 0; }

.markdown-body blockquote {
  margin: 0 0 16px; padding: 2px 18px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-muted);
}
.markdown-body blockquote > :last-child { margin-bottom: 0; }

.markdown-body hr { border: 0; border-top: 1px solid var(--border); margin: 34px 0; }

.markdown-body img {
  max-width: 100%; height: auto; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-subtle);
}

.external-link::after {
  content: "↗"; font-size: .82em; margin-left: 3px;
  color: var(--text-faint); vertical-align: baseline;
}

.pdf-link::before {
  content: "PDF"; font: 600 9.5px/1 var(--font-sans); letter-spacing: .04em;
  background: var(--danger); color: #fff; padding: 3px 4px; border-radius: 3px;
  margin-right: 6px; vertical-align: 1px;
}

/* inline + block code --------------------------------------------------- */

.markdown-body :not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  padding: .13em .36em;
  font-size: .875em;
  color: var(--code-text);
  word-break: break-word;
}

.code-block {
  position: relative;
  margin: 0 0 20px;
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}
.code-block::before {
  content: attr(data-lang);
  position: absolute; top: 0; left: 0;
  font: 500 10.5px/1 var(--font-mono); letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint); padding: 8px 10px; pointer-events: none;
}
.code-block[data-lang=""]::before, .code-block[data-lang="text"]::before { content: ""; }

.code-block pre {
  margin: 0; padding: 30px 16px 16px; overflow-x: auto;
  font-size: 13px; line-height: 1.62; color: var(--code-text);
  background: transparent;
}
.code-block pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.code-copy {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  padding: 4px 9px; border-radius: 5px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); font: 500 11.5px/1.4 var(--font-sans);
  cursor: pointer; opacity: 0; transition: opacity .13s ease;
}
.code-block:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--brand); border-color: var(--brand); }
.code-copy.is-copied { color: var(--ok); border-color: var(--ok); }

/* tables ---------------------------------------------------------------- */

.markdown-body table {
  width: 100%; border-collapse: collapse; margin: 0 0 20px;
  font-size: 13.5px; display: block; overflow-x: auto;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top;
}
.markdown-body th { background: var(--bg-subtle); font-weight: 600; }
.markdown-body tbody tr:nth-child(even) { background: var(--bg-subtle); }

/* admonitions ----------------------------------------------------------- */

.admonition {
  margin: 0 0 20px; padding: 13px 16px 13px 44px;
  border: 1px solid var(--border); border-left: 3px solid var(--text-faint);
  border-radius: var(--radius); background: var(--bg-subtle); position: relative;
}
.admonition > :last-child { margin-bottom: 0; }
.admonition-title {
  font-weight: 600; font-size: 13.5px; margin: 0 0 6px;
  letter-spacing: .005em;
}
.admonition::before {
  position: absolute; left: 15px; top: 13px;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 11px/1 var(--font-sans); color: #fff;
}
.admonition[data-icon="info"]::before   { content: "i"; background: var(--info); }
.admonition[data-icon="tip"]::before    { content: "★"; background: var(--ok); font-size: 10px; }
.admonition[data-icon="warn"]::before   { content: "!"; background: var(--warn); }
.admonition[data-icon="danger"]::before { content: "!"; background: var(--danger); }

.admonition-note, .admonition-info     { border-left-color: var(--info);  background: var(--accent-soft); }
.admonition-tip, .admonition-important { border-left-color: var(--ok);    background: rgba(26,127,67,.07); }
.admonition-warning, .admonition-caution { border-left-color: var(--warn); background: rgba(180,83,9,.08); }
.admonition-danger                     { border-left-color: var(--danger); background: rgba(192,57,47,.08); }

/* pdf embed ------------------------------------------------------------- */

.pdf-embed {
  margin: 0 0 22px; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; background: var(--bg-subtle);
}
.pdf-embed-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 13px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.pdf-embed-name { font-size: 13px; font-weight: 500; }
.pdf-embed-open { font-size: 12.5px; }
.pdf-embed iframe { display: block; width: 100%; height: 640px; border: 0; background: #fff; }
.pdf-embed figcaption {
  padding: 8px 13px; font-size: 12.5px; color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* footnotes + task lists ------------------------------------------------ */

.footnotes { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13.5px; }
.footnotes ol { padding-left: 20px; }
.markdown-body .task-list-item { list-style: none; margin-left: -20px; }
.markdown-body .task-list-item input { margin-right: 8px; }

/* -------------------------------------------------- syntax highlighting */

.hljs-comment, .hljs-quote            { color: #6a737d; font-style: italic; }
.hljs-keyword, .hljs-selector-tag,
.hljs-literal, .hljs-type             { color: #cf222e; }
.hljs-string, .hljs-meta .hljs-string,
.hljs-regexp, .hljs-addition          { color: #0a7d32; }
.hljs-number, .hljs-symbol,
.hljs-bullet, .hljs-variable,
.hljs-template-variable               { color: #953800; }
.hljs-title, .hljs-section,
.hljs-title.function_, .hljs-name     { color: #6639ba; }
.hljs-attr, .hljs-attribute,
.hljs-property                        { color: #0550ae; }
.hljs-built_in, .hljs-class .hljs-title { color: #0550ae; }
.hljs-meta, .hljs-doctag               { color: #8250df; }
.hljs-deletion                         { color: #82071e; background: rgba(255,129,130,.15); }
.hljs-emphasis { font-style: italic; }
.hljs-strong   { font-weight: 600; }

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .hljs-comment, :root[data-theme="auto"] .hljs-quote { color: #7d8590; }
  :root[data-theme="auto"] .hljs-keyword, :root[data-theme="auto"] .hljs-selector-tag,
  :root[data-theme="auto"] .hljs-literal, :root[data-theme="auto"] .hljs-type { color: #ff7b72; }
  :root[data-theme="auto"] .hljs-string, :root[data-theme="auto"] .hljs-regexp,
  :root[data-theme="auto"] .hljs-addition { color: #7ee787; }
  :root[data-theme="auto"] .hljs-number, :root[data-theme="auto"] .hljs-symbol,
  :root[data-theme="auto"] .hljs-bullet, :root[data-theme="auto"] .hljs-variable,
  :root[data-theme="auto"] .hljs-template-variable { color: #ffa657; }
  :root[data-theme="auto"] .hljs-title, :root[data-theme="auto"] .hljs-section,
  :root[data-theme="auto"] .hljs-title.function_, :root[data-theme="auto"] .hljs-name { color: #d2a8ff; }
  :root[data-theme="auto"] .hljs-attr, :root[data-theme="auto"] .hljs-attribute,
  :root[data-theme="auto"] .hljs-property,
  :root[data-theme="auto"] .hljs-built_in { color: #79c0ff; }
  :root[data-theme="auto"] .hljs-meta, :root[data-theme="auto"] .hljs-doctag { color: #d2a8ff; }
}

:root[data-theme="dark"] .hljs-comment, :root[data-theme="dark"] .hljs-quote { color: #7d8590; }
:root[data-theme="dark"] .hljs-keyword, :root[data-theme="dark"] .hljs-selector-tag,
:root[data-theme="dark"] .hljs-literal, :root[data-theme="dark"] .hljs-type { color: #ff7b72; }
:root[data-theme="dark"] .hljs-string, :root[data-theme="dark"] .hljs-regexp,
:root[data-theme="dark"] .hljs-addition { color: #7ee787; }
:root[data-theme="dark"] .hljs-number, :root[data-theme="dark"] .hljs-symbol,
:root[data-theme="dark"] .hljs-bullet, :root[data-theme="dark"] .hljs-variable,
:root[data-theme="dark"] .hljs-template-variable { color: #ffa657; }
:root[data-theme="dark"] .hljs-title, :root[data-theme="dark"] .hljs-section,
:root[data-theme="dark"] .hljs-title.function_, :root[data-theme="dark"] .hljs-name { color: #d2a8ff; }
:root[data-theme="dark"] .hljs-attr, :root[data-theme="dark"] .hljs-attribute,
:root[data-theme="dark"] .hljs-property,
:root[data-theme="dark"] .hljs-built_in { color: #79c0ff; }
:root[data-theme="dark"] .hljs-meta, :root[data-theme="dark"] .hljs-doctag { color: #d2a8ff; }

/* ------------------------------------------------------------ auth pages */

body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(30,117,185,.16), transparent 62%),
    var(--bg);
  padding: 32px 16px;
}

.auth-page { width: 100%; max-width: 400px; }

.auth-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
  padding: 9px 12px; border-radius: var(--radius); background: var(--topbar-bg);
  color: #ededed; font-weight: 600; font-size: 14px; width: fit-content;
}
.auth-brand img { height: 18px; }
.auth-brand-divider { width: 1px; height: 16px; background: #454545; }

.auth-card h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.015em; }
.auth-sub { margin: 0 0 20px; color: var(--text-muted); font-size: 13.5px; line-height: 1.5; }
.auth-body-text { font-size: 14px; color: var(--text-muted); margin: 0 0 18px; }

.auth-form { display: flex; flex-direction: column; gap: 5px; }
.auth-form label { font-size: 12.5px; font-weight: 500; margin-top: 11px; }
.auth-form input {
  height: 38px; padding: 0 11px; font: 400 14px/1 var(--font-sans);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
}
.auth-form input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--accent-ring);
}
.auth-form .btn { margin-top: 18px; }
.auth-form-inline .btn { margin-top: 0; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0; color: var(--text-faint); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.auth-links {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 20px; font-size: 13px; flex-wrap: wrap;
}
.auth-hint { font-size: 12.5px; color: var(--text-muted); margin: 16px 0 0; line-height: 1.6; }
.auth-hint code {
  background: var(--code-bg); border: 1px solid var(--code-border);
  padding: 1px 5px; border-radius: 4px; font-size: 12px;
}
.auth-footnote { text-align: center; margin: 18px 0 0; font-size: 12.5px; color: var(--text-faint); }
.auth-meta {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; margin-bottom: 16px;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.auth-meta span { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.auth-meta strong { font-size: 14px; word-break: break-all; }

.alert {
  padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13.5px;
  margin-bottom: 16px; border: 1px solid; line-height: 1.5;
}
.alert-error   { background: rgba(192,57,47,.08); border-color: rgba(192,57,47,.32); color: var(--danger); }
.alert-success { background: rgba(26,127,67,.08); border-color: rgba(26,127,67,.32); color: var(--ok); }
.alert-info    { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--brand); }

/* ------------------------------------------------------- generic pages */

.centered { display: grid; place-items: center; min-height: calc(100vh - var(--topbar-h)); padding: 40px 16px; }
.card-message {
  max-width: 540px; text-align: center; padding: 36px 32px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-raised); box-shadow: var(--shadow-md);
}
.card-message h1 { font-size: 22px; margin: 0 0 12px; }
.card-message p { color: var(--text-muted); margin: 0 0 12px; }
.card-message .btn { margin-top: 14px; }
.error-detail {
  text-align: left; font-size: 12px; background: var(--code-bg); padding: 12px;
  border-radius: var(--radius-sm); overflow-x: auto; border: 1px solid var(--code-border);
}

.search-page { max-width: 780px; margin: 0 auto; padding: 32px 24px 80px; }
.search-page h1 { font-size: 26px; margin: 0 0 6px; }
.search-list { list-style: none; margin: 26px 0 0; padding: 0; }
.search-list li { padding: 15px 0; border-bottom: 1px solid var(--border); }
.search-list li > a { font-size: 16px; font-weight: 500; }
.search-snippet { margin: 5px 0 4px; font-size: 13.5px; color: var(--text-muted); }
.search-snippet b { color: var(--text); background: var(--accent-soft); padding: 0 2px; border-radius: 2px; }
.search-path { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }

/* ----------------------------------------------------------- admin page */

.admin { max-width: 1180px; margin: 0 auto; padding: 30px 24px 90px; }

.admin-header {
  display: flex; flex-wrap: wrap; gap: 20px;
  align-items: flex-start; justify-content: space-between; margin-bottom: 26px;
}
.admin-header h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.018em; }
.admin-header p { margin: 0; color: var(--text-muted); font-size: 14px; }

.admin-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  min-width: 92px; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); text-align: left;
}
.stat-value { font-size: 20px; font-weight: 600; line-height: 1.2; display: block; }
.stat-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat.is-alert .stat-value { color: var(--warn); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; }
.tab {
  padding: 9px 15px; background: transparent; border: 0; cursor: pointer;
  font: 500 14px/1.3 var(--font-sans); color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }

.panel { display: none; }
.panel.is-active { display: block; }
.panel-hint { font-size: 13.5px; color: var(--text-muted); margin: 0 0 16px; }

.panel-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: space-between; margin-bottom: 14px;
}
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-muted); cursor: pointer;
  font: 500 13px/1.3 var(--font-sans);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Text fields only — a checkbox must keep its intrinsic size. */
#user-search, .inline-form input:not([type="checkbox"]) {
  height: 34px; padding: 0 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--text); font: 400 13.5px/1 var(--font-sans); min-width: 220px;
}
.field-check input[type="checkbox"] {
  width: 15px; height: 15px; margin: 0; accent-color: var(--brand); flex: none;
}
#user-search:focus, .inline-form input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--accent-ring);
}

.inline-form {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  padding: 16px; margin-bottom: 20px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle);
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field-grow { flex: 1; min-width: 220px; }
.field-grow input { width: 100%; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.field-check { justify-content: center; }
.field-check label {
  display: flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--text); font-weight: 400; white-space: nowrap;
}

.table-wrap {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto; background: var(--surface);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; padding: 10px 14px; background: var(--bg-subtle);
  border-bottom: 1px solid var(--border); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); white-space: nowrap;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg-subtle); }
.data-table .empty { text-align: center; color: var(--text-muted); padding: 28px; }
.col-actions { text-align: right; }
.data-table td.col-actions { text-align: right; white-space: nowrap; }
.data-table .btn { margin-left: 5px; }

.cell-user { display: flex; flex-direction: column; gap: 1px; }
.cell-user strong { font-weight: 500; }
.cell-user span { font-size: 12.5px; color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-size: 12.5px; }

.status-pill {
  display: inline-block; padding: 3px 9px; border-radius: 99px;
  font: 500 11.5px/1.5 var(--font-sans); text-transform: capitalize;
}
.status-active    { background: rgba(26,127,67,.13); color: var(--ok); }
.status-pending   { background: rgba(180,83,9,.15); color: var(--warn); }
.status-suspended { background: rgba(192,57,47,.13); color: var(--danger); }
.status-ok        { background: rgba(26,127,67,.13); color: var(--ok); }
.status-off       { background: var(--bg-sunken); color: var(--text-muted); }

.settings-grid { display: flex; flex-direction: column; gap: 2px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px; border: 1px solid var(--border); background: var(--surface);
}
.setting-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.setting-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.setting-row + .setting-row { border-top: 0; }
.setting-row strong { display: block; font-size: 14px; margin-bottom: 3px; }
.setting-row p { margin: 0; font-size: 13px; color: var(--text-muted); max-width: 62ch; }
.setting-row code {
  background: var(--code-bg); border: 1px solid var(--code-border);
  padding: 1px 5px; border-radius: 4px; font-size: 12px;
}

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer; border-radius: 99px;
  background: var(--border-strong); transition: background .16s ease;
}
.slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .16s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.28);
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--topbar-bg); color: #fff; padding: 11px 18px;
  border-radius: var(--radius); font-size: 13.5px; box-shadow: var(--shadow-lg);
  z-index: 200; max-width: 90vw;
}
.toast.is-error { background: var(--danger); }

/* ---------------------------------------------------------- responsive */

@media (max-width: 1240px) {
  .docs-shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc-rail { display: none; }
  .content-inner { padding: 28px 32px 88px; }
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .docs-shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: 300px;
    z-index: 55; transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow-lg); height: auto;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-scrim {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0;
    background: rgba(0,0,0,.42); z-index: 50;
  }

  .content-inner { padding: 22px 18px 72px; }
  .markdown-body h1 { font-size: 27px; }
  .markdown-body h2 { font-size: 20px; }
  .pager { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; padding: 0 12px; }
  .brand-text, .version-label { display: none; }
  .admin { padding: 22px 16px 80px; }
  .setting-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .pdf-embed iframe { height: 420px; }
}

@media (max-width: 620px) {
  .search kbd { display: none; }
  .admin-stats { width: 100%; }
  .stat { flex: 1; min-width: 78px; }
}

@media print {
  .topbar, .sidebar, .toc-rail, .pager, .edit-link, .code-copy { display: none !important; }
  .docs-shell { display: block; }
  .content-inner { max-width: none; padding: 0; }
}
