:root {
  --cp-bg: #f5f7fc;
  --cp-panel: #ffffff;
  --cp-text: #213150;
  --cp-muted: #5c6b8a;
  --cp-border: #dbe4f3;
  --cp-border-soft: rgba(23, 66, 245, 0.1);
  --cp-accent: #1742f5;
  --cp-accent-dark: #070d63;
  --cp-accent-bright: #3895ff;
  --cp-link: #1742f5;
  --cp-note-bg: #edf3ff;
  --cp-note-border: #1742f5;
  --cp-warning-bg: #fff8e6;
  --cp-warning-border: #d7a72f;
  --cp-shadow: 0 18px 48px rgba(17, 31, 77, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--cp-bg);
  color: var(--cp-text);
  font-family: Aptos, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

a {
  color: var(--cp-link);
  text-decoration: none;
}

a:hover,
a:focus {
  color: var(--cp-accent-dark);
  text-decoration: underline;
}

.offline-shell-body {
  min-height: 100vh;
}

.offline-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.offline-header {
  align-items: center;
  background:
    radial-gradient(circle at top left, rgba(122, 98, 255, 0.26), transparent 32%),
    linear-gradient(135deg, #1742f6 0%, #070d63 58%, #00021d 100%);
  border-bottom: 1px solid rgba(252, 253, 255, 0.18);
  box-shadow: 0 14px 34px rgba(7, 13, 99, 0.22);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px 22px;
}

.offline-brand {
  align-items: center;
  display: flex;
  gap: 13px;
}

.brand-logo {
  display: block;
  height: 34px;
  max-width: 148px;
  object-fit: contain;
  width: auto;
}

.offline-header h1 {
  color: #fcfdff;
  font-family: "Aptos Display", Aptos, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0;
}

.offline-search {
  max-width: 420px;
  min-width: 260px;
  position: relative;
  width: 34vw;
  z-index: 5;
}

.offline-search-input {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  color: #fff;
  font: inherit;
  height: 42px;
  outline: 0;
  padding: 0 14px;
  width: 100%;
}

.offline-search-input::placeholder {
  color: rgba(252, 253, 255, 0.78);
  font-weight: 700;
}

.offline-search-input:focus {
  background: #fff;
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(56, 149, 255, 0.32);
  color: var(--cp-text);
}

.offline-search-results {
  background: #fff;
  border: 1px solid rgba(17, 31, 77, 0.14);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(0, 2, 29, 0.22);
  left: 0;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
}

.offline-search-result {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--cp-text);
  cursor: pointer;
  display: block;
  font: inherit;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}

.offline-search-result:hover,
.offline-search-result:focus {
  background: #edf3ff;
  outline: 0;
}

.offline-search-result-title {
  color: var(--cp-accent-dark);
  display: block;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.offline-search-result-excerpt {
  color: var(--cp-muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

.offline-search-empty {
  color: var(--cp-muted);
  font-size: 13px;
  padding: 10px;
}

.offline-page-layout {
  display: grid;
  grid-template-columns: minmax(260px, 26vw) 1fr;
  min-height: 0;
}

.toc-panel {
  background: #f4f7ff;
  border-right: 1px solid var(--cp-border-soft);
  height: calc(100vh - 76px);
  overflow-y: auto;
  position: sticky;
  top: 0;
}

.topic-page {
  min-width: 0;
  padding: 28px;
}

.topic-content {
  background: var(--cp-panel);
  border: 1px solid var(--cp-border-soft);
  border-radius: 8px;
  box-shadow: var(--cp-shadow);
  margin: 0 auto;
  max-width: 1060px;
  padding: 28px 34px 40px;
}

.topic-content h1 {
  border-bottom: 1px solid var(--cp-border-soft);
  color: var(--cp-accent-dark);
  font-family: "Aptos Display", Aptos, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0 0 20px;
  padding-bottom: 14px;
}

.topic-content h2 {
  border-top: 1px solid var(--cp-border-soft);
  color: var(--cp-accent-dark);
  font-size: 22px;
  letter-spacing: 0;
  margin: 32px 0 12px;
  padding-top: 16px;
}

.topic-content h3 {
  color: var(--cp-accent-dark);
  font-size: 18px;
  margin: 26px 0 10px;
}

.topic-content h4 {
  font-size: 16px;
  margin: 22px 0 8px;
}

.topic-content p,
.topic-content ul,
.topic-content ol {
  margin-top: 0;
}

.topic-content li + li {
  margin-top: 4px;
}

.topic-content img {
  height: auto;
  max-width: 100%;
  vertical-align: middle;
}

.topic-content table {
  border-collapse: collapse;
  display: block;
  margin: 18px 0 24px;
  overflow-x: auto;
  width: 100%;
}

.topic-content th,
.topic-content td {
  border: 1px solid var(--cp-border);
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}

.topic-content th {
  background: #edf3ff;
  color: var(--cp-accent-dark);
  font-weight: 700;
}

.topic-content tr:nth-child(even) td {
  background: #fbfcfe;
}

.note,
.note_note,
.note_tip,
.note_important,
.note_warning,
.note_caution {
  border-left: 4px solid var(--cp-note-border);
  background: var(--cp-note-bg);
  border-radius: 4px;
  margin: 16px 0;
  padding: 12px 14px;
}

.note_warning,
.note_caution {
  background: var(--cp-warning-bg);
  border-left-color: var(--cp-warning-border);
}

.note__title {
  font-weight: 700;
  margin-right: 4px;
}

.ph.uicontrol,
.uicontrol {
  font-weight: 700;
}

code,
pre {
  font-family: Consolas, "Courier New", monospace;
}

pre {
  background: #17212b;
  border-radius: 6px;
  color: #f5f7fa;
  overflow-x: auto;
  padding: 14px;
}

hr {
  border: 0;
  border-top: 1px solid var(--cp-border);
  margin: 28px 0;
}

.toc-body {
  background: #f4f7ff;
}

.toc-page {
  padding: 16px 12px 24px;
}

.toc-page h1 {
  color: var(--cp-accent-dark);
  font-family: "Aptos Display", Aptos, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0 0 14px;
  padding: 0 8px;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.toc-list .toc-list {
  margin-left: 18px;
}

.toc-item.is-collapsed > .toc-list {
  display: none;
}

.toc-row {
  align-items: center;
  display: grid;
  gap: 4px;
  grid-template-columns: 22px minmax(0, 1fr);
  min-height: 30px;
}

.toc-toggle,
.toc-toggle-spacer {
  display: inline-flex;
  height: 22px;
  width: 22px;
}

.toc-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--cp-muted);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  justify-content: center;
  padding: 0;
}

.toc-toggle:hover,
.toc-toggle:focus {
  background: rgba(23, 66, 245, 0.08);
  color: var(--cp-accent);
}

.toc-item a {
  border-radius: 8px;
  color: var(--cp-text);
  display: block;
  font-size: 14px;
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 6px 8px;
}

.toc-depth-0 > a {
  color: var(--cp-accent-dark);
  font-weight: 700;
  margin-top: 6px;
}

.toc-depth-1 > a {
  font-weight: 600;
}

.toc-item a:hover,
.toc-item a:focus {
  background: rgba(23, 66, 245, 0.08);
  text-decoration: none;
}

.toc-row a.is-active,
.toc-row a[aria-current="page"] {
  background: linear-gradient(90deg, rgba(23, 66, 245, 0.16), rgba(56, 149, 255, 0.12));
  box-shadow: inset 3px 0 0 var(--cp-accent);
  color: var(--cp-accent-dark);
  font-weight: 800;
}

@media (max-width: 760px) {
  .offline-header {
    align-items: stretch;
    flex-direction: column;
  }

  .offline-search {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .offline-page-layout {
    grid-template-columns: 1fr;
  }

  .toc-panel {
    border-bottom: 1px solid var(--cp-border);
    border-right: 0;
    height: auto;
    max-height: 42vh;
    position: relative;
  }

  .topic-page {
    padding: 12px;
  }

  .topic-content {
    padding: 20px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topic-page {
    padding: 0;
  }

  .topic-content {
    border: 0;
    max-width: none;
    padding: 0;
  }
}
