:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f9;
  --surface-strong: #e2e8f0;
  --text: #172033;
  --muted: #667085;
  --border: #d8e0ea;
  --primary: #1d4ed8;
  --primary-strong: #173ea7;
  --primary-soft: #e8efff;
  --success: #166534;
  --success-bg: #ecfdf3;
  --warning: #9a6700;
  --warning-bg: #fff8e1;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --info: #175cd3;
  --info-bg: #eff8ff;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --header-height: 76px;
  --search-height: 72px;
  --sidebar-width: 296px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111827;
  --surface-soft: #172033;
  --surface-strong: #223047;
  --text: #eef2f8;
  --muted: #a7b0c0;
  --border: #2c3a52;
  --primary: #7aa2ff;
  --primary-strong: #9ab8ff;
  --primary-soft: #1b2b4d;
  --success: #78d89a;
  --success-bg: #123222;
  --warning: #f7c65b;
  --warning-bg: #372b10;
  --danger: #ff9b93;
  --danger-bg: #3d1c1a;
  --info: #8bb8ff;
  --info-bg: #132a4b;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #111827;
    --surface-soft: #172033;
    --surface-strong: #223047;
    --text: #eef2f8;
    --muted: #a7b0c0;
    --border: #2c3a52;
    --primary: #7aa2ff;
    --primary-strong: #9ab8ff;
    --primary-soft: #1b2b4d;
    --success: #78d89a;
    --success-bg: #123222;
    --warning: #f7c65b;
    --warning-bg: #372b10;
    --danger: #ff9b93;
    --danger-bg: #3d1c1a;
    --info: #8bb8ff;
    --info-bg: #132a4b;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.58;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent);
}

button {
  color: inherit;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--primary-strong);
}

.hidden {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  transition: top 0.2s ease;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-brand img {
  flex: 0 0 auto;
  border-radius: 11px;
  box-shadow: var(--shadow);
}

.header-title {
  font-size: 19px;
  font-weight: 760;
  letter-spacing: -0.01em;
}

.header-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.theme-control select,
.header-button,
.mobile-nav-toggle {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
}

.header-button,
.mobile-nav-toggle {
  cursor: pointer;
  font-weight: 650;
}

.header-button:hover,
.mobile-nav-toggle:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.mobile-nav-toggle {
  display: none;
}

.search-shell {
  position: sticky;
  top: var(--header-height);
  z-index: 40;
  min-height: var(--search-height);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 840px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.search-box > span {
  color: var(--muted);
  font-size: 20px;
}

.search-box input {
  width: 100%;
  height: 46px;
  border: 0;
  background: transparent;
  color: var(--text);
}

.search-box input::placeholder {
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}

.clear-search {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: var(--surface-soft);
  color: var(--muted);
}

.search-status {
  min-width: 170px;
  color: var(--muted);
  font-size: 13px;
}

.site-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 0;
  max-width: 1540px;
  margin: 0 auto;
}

.help-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--search-height));
  align-self: start;
  height: calc(100vh - var(--header-height) - var(--search-height));
  overflow: auto;
  padding: 24px 18px 32px 28px;
  border-right: 1px solid var(--border);
}

.sidebar-heading {
  margin: 0 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.help-sidebar nav {
  display: grid;
  gap: 3px;
}

.help-nav-link {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
}

.help-nav-link .nav-index {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.help-nav-link:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.help-nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 720;
}

.help-nav-link.active .nav-index {
  color: var(--primary);
}

.sidebar-support {
  display: grid;
  gap: 5px;
  margin-top: 24px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
}

.sidebar-support span {
  color: var(--muted);
}

.help-main {
  min-width: 0;
  padding: 32px clamp(24px, 5vw, 76px) 44px;
}

.help-article {
  max-width: 930px;
  min-height: 62vh;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 52px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.help-article h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.help-article h2 {
  margin: 38px 0 12px;
  padding-top: 6px;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.help-article h3 {
  margin: 28px 0 10px;
  font-size: 18px;
}

.help-article p,
.help-article li {
  font-size: 16px;
}

.help-article p {
  margin: 10px 0;
}

.help-article ul,
.help-article ol {
  padding-left: 24px;
}

.help-article li + li {
  margin-top: 7px;
}

.help-article code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.help-article .section-kicker {
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.help-article .lead {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.callout {
  margin: 22px 0;
  padding: 16px 18px;
  border-left: 4px solid var(--info);
  border-radius: 10px;
  background: var(--info-bg);
}

.callout strong:first-child {
  display: block;
  margin-bottom: 4px;
}

.callout.tip {
  border-left-color: var(--success);
  background: var(--success-bg);
}

.callout.warning {
  border-left-color: var(--warning);
  background: var(--warning-bg);
}

.callout.danger {
  border-left-color: var(--danger);
  background: var(--danger-bg);
}

.steps {
  counter-reset: help-step;
  display: grid;
  gap: 12px;
  margin: 18px 0 24px;
  padding: 0;
  list-style: none;
}

.steps > li {
  counter-increment: help-step;
  position: relative;
  min-height: 46px;
  padding: 11px 14px 11px 54px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-soft);
}

.steps > li::before {
  content: counter(help-step);
  position: absolute;
  left: 14px;
  top: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 760;
  font-size: 13px;
}

.workflow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 18px 0 24px;
}

.workflow span {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  font-weight: 650;
}

.workflow b {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.help-table th,
.help-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.help-table th {
  background: var(--surface-soft);
  font-size: 13px;
}

.help-table tr:last-child td {
  border-bottom: 0;
}

.search-results {
  max-width: 930px;
  margin: 0 auto 22px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-results h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.search-result-list {
  display: grid;
  gap: 8px;
}

.search-result {
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  cursor: pointer;
}

.search-result:hover {
  border-color: var(--primary);
}

.search-result strong {
  color: var(--text);
}

.search-result span {
  color: var(--muted);
  font-size: 13px;
}

.search-empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.section-navigation {
  max-width: 930px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 22px auto 0;
}

.section-navigation button {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 680;
}

.section-navigation button:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.section-navigation button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.site-footer {
  max-width: 930px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 34px auto 0;
  padding: 18px 4px;
  color: var(--muted);
  font-size: 13px;
}

.scroll-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 45;
}

.not-found-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.not-found-card {
  max-width: 560px;
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.not-found-card h1 {
  margin: 8px 0;
}

.eyebrow {
  color: var(--primary);
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.primary-link {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.primary-link:hover {
  color: #fff;
  background: var(--primary-strong);
}

@media (max-width: 980px) {
  :root {
    --header-height: auto;
    --search-height: auto;
  }

  .site-header,
  .search-shell {
    position: relative;
    top: auto;
  }

  .site-header {
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .search-shell {
    padding: 10px 16px;
    flex-wrap: wrap;
  }

  .search-box {
    max-width: none;
  }

  .search-status {
    width: 100%;
    min-width: 0;
  }

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

  .help-sidebar {
    display: none;
    position: fixed;
    z-index: 100;
    inset: 0 14% 0 0;
    height: 100vh;
    padding: 24px;
    background: var(--surface);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.28);
    border-right: 1px solid var(--border);
  }

  .help-sidebar.open {
    display: block;
  }

  .help-main {
    padding: 22px 16px 38px;
  }

  .help-article {
    padding: 26px 22px;
  }
}

@media (max-width: 620px) {
  .header-brand {
    width: calc(100% - 120px);
  }

  .header-title {
    font-size: 17px;
  }

  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .theme-control {
    justify-content: space-between;
  }

  .theme-control select,
  .header-button {
    flex: 1;
  }

  .help-main {
    padding-left: 10px;
    padding-right: 10px;
  }

  .help-article {
    border-radius: 12px;
    padding: 22px 17px;
  }

  .help-article h1 {
    font-size: 32px;
  }

  .help-article h2 {
    font-size: 22px;
  }

  .help-article p,
  .help-article li {
    font-size: 15.5px;
  }

  .section-navigation {
    display: grid;
    grid-template-columns: 1fr;
  }

  .site-footer {
    display: grid;
    gap: 5px;
  }

  .workflow {
    align-items: stretch;
    flex-direction: column;
  }

  .workflow b {
    text-align: center;
    transform: rotate(90deg);
  }
}

@media print {
  @page {
    margin: 16mm;
  }

  body {
    background: #fff;
    color: #000;
  }

  .site-header,
  .search-shell,
  .help-sidebar,
  .search-results,
  .section-navigation,
  .site-footer,
  .scroll-top,
  .skip-link {
    display: none !important;
  }

  .site-layout,
  .help-main {
    display: block;
    max-width: none;
    padding: 0;
    margin: 0;
  }

  .help-article {
    max-width: none;
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .callout,
  .steps > li,
  .table-wrap {
    break-inside: avoid;
  }

  a {
    color: #000;
    text-decoration: none;
  }
}
