:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-strong: #eef5fb;
  --text: #202326;
  --muted: #5f6468;
  --border: #d9e3ee;
  --accent: #2c8da3;
  --accent-strong: #1d6676;
  --accent-soft: #e1f5f8;
  --danger: #9f2f2f;
  --warning: #8a5a00;
  --ok: #16845f;
  --code: #0f1720;
  --shadow: 0 12px 38px rgba(25, 45, 75, 0.1);
  color-scheme: light;
  font-family: "Segoe UI Variable", "Segoe UI", Aptos, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #202328;
    --surface: #25292f;
    --surface-strong: #303640;
    --text: #f5f7fb;
    --muted: #c5ccd6;
    --border: #3a414c;
    --accent: #6aa7ff;
    --accent-strong: #9fc6ff;
    --accent-soft: #303741;
    --danger: #ff9b9b;
    --warning: #ffd37a;
    --ok: #7ee0af;
    --code: #11161d;
    --shadow: 0 18px 48px rgba(0, 0, 0, .28);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #202328;
  --surface: #25292f;
  --surface-strong: #303640;
  --text: #f5f7fb;
  --muted: #c5ccd6;
  --border: #3a414c;
  --accent: #6aa7ff;
  --accent-strong: #9fc6ff;
  --accent-soft: #303741;
  --danger: #ff9b9b;
  --warning: #ffd37a;
  --ok: #7ee0af;
  --code: #11161d;
  --shadow: 0 18px 48px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-strong: #eef5fb;
  --text: #202326;
  --muted: #5f6468;
  --border: #d9e3ee;
  --accent: #2c8da3;
  --accent-strong: #1d6676;
  --accent-soft: #e1f5f8;
  --danger: #9f2f2f;
  --warning: #8a5a00;
  --ok: #16845f;
  --code: #0f1720;
  --shadow: 0 12px 38px rgba(25, 45, 75, 0.1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--surface-strong) 70%, var(--bg)) 62%, var(--bg));
  color: var(--text);
  font-size: 16px;
  line-height: 1.58;
}
a {
  color: var(--accent-strong);
  text-decoration: none;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  transform: translateY(-150%);
  background: var(--text);
  color: white;
  padding: .6rem .85rem;
  border-radius: 6px;
  z-index: 20;
}
.skip-link:focus { transform: translateY(0); }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(18px);
}
.header-inner {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(220px, 640px) 1fr auto;
  gap: 1rem;
  align-items: center;
  min-height: 68px;
  padding: 0 1.25rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: block;
  object-fit: contain;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.brand span { display: block; }
.brand small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.1;
}
.search-box { position: relative; }
.search-box input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: .75rem .85rem;
  font: inherit;
}
.search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + .35rem);
  left: 0;
  right: 0;
  max-height: 70vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: .4rem;
  display: none;
}
.search-results a {
  display: block;
  padding: .65rem .75rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}
.search-results a:hover { background: var(--accent-soft); }
.search-results small { display: block; color: var(--muted); }
.menu-button {
  display: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: .55rem;
  font: inherit;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-direction: column;
}
.menu-button span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-strong));
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  justify-self: end;
  width: max-content;
}
.theme-toggle button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.theme-toggle button[aria-pressed="true"] {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border), 0 1px 4px rgba(0,0,0,.16);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle [data-theme-choice="dark"] svg { fill: color-mix(in srgb, currentColor 12%, transparent); }
.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 240px;
  gap: 1.5rem;
  max-width: 1480px;
  margin: 0 auto;
  padding: 1.25rem;
}
.left-nav, .right-toc {
  position: sticky;
  top: 86px;
  align-self: start;
  max-height: calc(100vh - 98px);
  overflow: auto;
}
.left-nav {
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 8px;
  padding: .7rem;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: 0 8px 28px rgba(25,45,75,.08);
}
.nav-mobile-header {
  display: none;
}
.nav-section {
  margin: 0 0 1rem;
}
.nav-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .9rem;
  text-transform: none;
  letter-spacing: 0;
  margin: .5rem 0;
  font-weight: 750;
  text-decoration: none;
  padding: .25rem 0;
  cursor: pointer;
  text-align: left;
}
a.nav-section-title {
  display: block;
}
button.nav-section-title::after {
  content: "";
  width: .48rem;
  height: .48rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .16s ease;
}
.nav-section[data-collapsed] > button.nav-section-title::after {
  transform: rotate(-45deg);
}
.nav-section[data-collapsed] > .nav-section-links {
  display: none;
}
.left-nav a, .right-toc a {
  display: block;
  text-decoration: none;
  color: var(--text);
  border-radius: 5px;
  padding: .42rem .55rem;
  font-size: .93rem;
}
.left-nav a {
  position: relative;
  border-left: 3px solid transparent;
  padding-left: .55rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.left-nav a[aria-current="page"], .left-nav a:hover {
  background: color-mix(in srgb, var(--accent-soft) 76%, var(--surface));
  color: var(--text);
  border-left-color: #3478f6;
  font-weight: 650;
}
.left-nav .nav-section-home a {
  border-left: 0;
  padding-left: 0;
}
.left-nav .nav-section-home a[aria-current="page"], .left-nav .nav-section-home a:hover {
  border-left-color: transparent;
}
.right-toc a:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.doc-main {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.article {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 2.25rem 2.5rem;
  min-width: 0;
}
.docs-draft-notice {
  margin: 0 0 1.25rem;
  padding: .95rem 1rem;
  border: 1px solid #efcf72;
  border-left: 4px solid #b45309;
  border-radius: 8px;
  background: #fff4bd;
  color: #7f1d1d;
  font-weight: 700;
  line-height: 1.45;
}
.breadcrumbs {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1rem;
}
h1, h2, h3 { line-height: 1.2; letter-spacing: 0; }
h1 {
  font-size: clamp(1.85rem, 2.8vw, 2.45rem);
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
  word-break: normal;
}
h2 { margin-top: 2rem; padding-top: .4rem; border-top: 1px solid var(--border); }
h3 { margin-top: 1.4rem; }
p, li { color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
code {
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface-strong) 82%, var(--surface));
  color: var(--text);
  padding: .12rem .32rem;
  font-size: .92em;
}
pre {
  overflow: auto;
  max-width: 100%;
  background: var(--code);
  color: #eef7ff;
  border-radius: 8px;
  padding: 1rem;
  margin-top: .35rem;
}
pre code { background: transparent; color: inherit; padding: 0; }
.code-block {
  margin: 1rem 0;
}
.code-toolbar {
  display: flex;
  justify-content: flex-end;
}
.copy-code {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  padding: .32rem .55rem;
  font: inherit;
  font-size: .86rem;
  cursor: pointer;
}
table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
th, td { border: 1px solid var(--border); padding: .65rem; text-align: left; vertical-align: top; }
td, th { overflow-wrap: anywhere; }
th { background: var(--surface-strong); }
.article table th,
.article table td {
  word-break: normal;
}
.article table th:first-child,
.article table td:first-child {
  width: 18%;
  min-width: 9rem;
  overflow-wrap: normal;
}
.article table th:nth-child(2),
.article table td:nth-child(2) {
  width: 9rem;
  min-width: 5.5rem;
  overflow-wrap: normal;
}
.parameter-table th:first-child,
.parameter-table td:first-child {
  width: 14rem;
  min-width: 12rem;
}
.parameter-table th:nth-child(2),
.parameter-table td:nth-child(2) {
  width: 10rem;
  min-width: 7rem;
  white-space: nowrap;
}
.parameter-table th:nth-child(3),
.parameter-table td:nth-child(3) {
  width: auto;
}
.permissions-table th:first-child,
.permissions-table td:first-child {
  width: 30%;
  min-width: 16rem;
}
.permissions-table th:nth-child(2),
.permissions-table td:nth-child(2) {
  width: 16%;
  min-width: 9rem;
}
.permissions-table th:nth-child(3),
.permissions-table td:nth-child(3) {
  width: 7rem;
  min-width: 7rem;
  white-space: nowrap;
}
.permissions-table th:nth-child(4),
.permissions-table td:nth-child(4) {
  width: auto;
}
.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: .85rem 1rem;
  background: color-mix(in srgb, var(--surface-strong) 55%, var(--surface));
  margin: 1rem 0;
}
.callout.warning, .callout.caution { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, var(--surface)); }
.callout.danger { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin: 1.25rem 0;
}
.meta-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .8rem;
  background: color-mix(in srgb, var(--surface) 78%, var(--surface-strong));
  min-width: 0;
  overflow-wrap: anywhere;
}
.meta-card strong { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: .15rem .55rem;
  margin: .12rem;
  background: var(--surface-strong);
  color: var(--text);
  text-decoration: none;
  font-size: .88rem;
}
.risk-high, .dangerous { color: var(--danger); font-weight: 650; }
.risk-medium { color: var(--warning); font-weight: 650; }
.risk-low { color: var(--ok); font-weight: 650; }
.filter-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: .75rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 78%, var(--surface-strong));
}
.filter-panel label { display: grid; gap: .25rem; color: var(--muted); font-size: .86rem; }
.filter-panel input, .filter-panel select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .55rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
}
.command-filter-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.command-filter-panel label:first-child {
  grid-column: 1 / -1;
}
.permission-filter-panel {
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) minmax(140px, 180px);
}
.command-list {
  display: grid;
  gap: .7rem;
}
.command-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .85rem;
  background: var(--surface);
  min-width: 0;
  overflow-wrap: anywhere;
}
.command-item a { color: var(--text); text-decoration: none; font-weight: 700; }
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding-top: 1rem;
}
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 1.25rem;
  text-align: center;
}
@media (max-width: 1120px) {
  .layout { grid-template-columns: 260px minmax(0, 1fr); }
  .right-toc { display: none; }
  .filter-panel { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}
@media (max-width: 760px) {
  .header-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: .75rem;
    padding: .65rem .85rem .8rem;
  }
  .menu-button {
    display: inline-flex;
    grid-column: 1;
    grid-row: 1;
  }
  .brand {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }
  .brand-mark {
    display: none;
  }
  .brand span {
    min-width: 0;
  }
  .theme-toggle {
    grid-column: 3;
    grid-row: 1;
  }
  .search-box {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .layout { display: block; padding: .75rem; }
  .left-nav {
    display: none;
    position: fixed;
    z-index: 12;
    inset: 6.25rem .85rem .85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    max-height: calc(100dvh - 7.1rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 20px 60px rgba(0,0,0,.24);
  }
  body.nav-open .left-nav { display: block; }
  body.nav-open { overflow: hidden; }
  .nav-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .78rem;
  }
  .nav-mobile-header button {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-strong);
    color: var(--text);
    padding: .45rem .65rem;
    font: inherit;
    text-transform: none;
    letter-spacing: 0;
  }
  .article { padding: 1.25rem; }
  .meta-grid, .filter-panel { grid-template-columns: 1fr; }
}
