:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2933;
  background: #f7f8fb;
  scroll-behavior: smooth;
  --blue: #0a68d8;
  --blue-soft: #eef4ff;
  --border: #dfe3e8;
  --focus: #7d1d23;
  --muted: #667085;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 10;
  top: 8px;
  left: 8px;
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  text-decoration: none;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.wrap {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  align-items: start;
  column-gap: 32px;
  row-gap: 0;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.page-header {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 32px 44px 12px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}
.guide-tools { position: sticky; grid-column: 1; grid-row: 1 / span 2; top: 24px; min-width: 0; }
.language-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.language-picker button {
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #344054;
  cursor: pointer;
}
.language-picker button[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue); font-weight: 700; }

.toc {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.06);
}
.toc h2 { margin: 0 0 10px; color: var(--muted); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.toc a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 7px;
  color: #1f2933;
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.toc a:hover { background: #f0f5ff; color: var(--blue); }
.toc a[aria-current="location"] { background: var(--blue-soft); color: var(--blue); font-weight: 700; }

main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding: 12px 44px 40px;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}
h1, h2, p, li, a, aside { overflow-wrap: anywhere; }
h1 { margin: 0 0 8px; color: #111827; font-size: clamp(28px, 4vw, 36px); line-height: 1.15; }
h2 { margin: 0 0 10px; color: #111827; font-size: 22px; line-height: 1.3; }
p, li { font-size: 15.5px; line-height: 1.65; }
p { margin: 0 0 14px; }
ol { margin: 0 0 16px; padding-left: 24px; }
li { margin-bottom: 8px; }
a { color: var(--blue); }
[hidden] { display: none !important; }

.crumb { margin: -8px 0 8px; font-size: 14px; }
.crumb a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.lede { margin-bottom: 8px; color: var(--muted); font-size: 16px; }
.updated { margin-bottom: 18px; color: var(--muted); font-size: 13px; }
.sign-in-row { margin-bottom: 24px; }
.primary-action, .topic-action, #clear-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}
.topic-action.secondary { background: #fff; color: var(--blue); }
.topic-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.env-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #9a5600;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.search-panel {
  margin: 0 0 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}
.search-panel label { display: block; margin-bottom: 7px; color: #111827; font-weight: 700; }
.search-panel input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #aab2bd;
  border-radius: 8px;
  background: #fff;
  color: #111827;
}
#result-count { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.no-results { margin-bottom: 20px; padding: 18px; border: 1px dashed #98a2b3; border-radius: 10px; text-align: center; }
.no-results p { margin-bottom: 12px; }

.topic {
  padding: 28px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 24px;
}
.topic:first-child { border-top: 0; }
.topic-copy > p:first-child { color: #475467; font-size: 16px; }
.balance-callout, .role-note {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 9px;
  font-size: 14.5px;
  line-height: 1.6;
}
.balance-callout { border: 1px solid #d6e4ff; border-left: 5px solid var(--blue); background: #f0f5ff; }
.role-note { border: 1px solid #e4e7ec; border-left: 5px solid #667085; background: #f9fafb; }

a:focus-visible, button:focus-visible, input:focus-visible, main:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .wrap { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 16px 12px 56px; }
  .page-header, .guide-tools, main { grid-column: 1; grid-row: auto; }
  .page-header { padding: 18px 20px 20px; border: 1px solid var(--border); border-radius: 12px; }
  .guide-tools { position: static; min-width: 0; }
  .toc { overflow-x: auto; padding: 12px; }
  .toc h2 { padding: 0 4px; }
  .toc a { display: inline-flex; max-width: 220px; margin-right: 4px; vertical-align: top; }
  main { padding: 26px 20px; border-top: 1px solid var(--border); border-radius: 12px; }
  .topic { scroll-margin-top: 12px; }
}

@media (max-width: 390px) {
  .wrap { padding-right: 8px; padding-left: 8px; }
  main { padding: 22px 16px; }
  .language-picker { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .primary-action, .topic-action { width: 100%; }
  .topic-actions { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  :root { color: #000; background: #fff; }
  body { background: #fff; }
  .wrap { display: block; max-width: none; padding: 0; }
  .guide-tools, .search-panel, .no-results, .sign-in-row, .env-badge, .skip-link { display: none !important; }
  .page-header, main { padding: 0; border: 0; box-shadow: none; }
  .topic { break-inside: avoid; }
  .topic[hidden], [data-lang][hidden] { display: block !important; }
  .topic-action { border: 0; padding: 0; background: transparent; color: #000; }
  .topic-action[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; font-weight: 400; }
}
