*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #c0271c;
  --red-dark: #9b1c13;
  --blue: #1a3a8f;
  --blue-dark: #0f266b;
  --text-dark: #1a1a2e;
  --text-mid: #4a4a6a;
  --text-light: #7a7a9a;
  --bg-light: #f4f6fb;
  --border: #e0e4f0;
  --wrap: 1240px;
}

html { scroll-behavior: smooth; }
body {
  font-family: Inter, system-ui, sans-serif;
  color: var(--text-dark);
  background: #fff;
  overflow-x: hidden;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--blue); }

.wrap {
  width: min(var(--wrap), calc(100% - 48px));
  margin-inline: auto;
}

/* Top bar */
.topbar {
  background: var(--blue-dark);
  color: #fff;
  font-size: 13px;
  padding: 8px 0;
}
.topbar .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.topbar a { color: #c8d8ff; text-decoration: none; }
.topbar a:hover { color: #fff; }
.tb-right { display: flex; gap: 12px; align-items: center; }
.tb-right a {
  width: 26px; height: 26px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; font-weight: 700;
}
.tb-right a:hover { background: var(--red); border-color: var(--red); }

/* Header / nav */
header.site {
  background: #fff;
  box-shadow: 0 2px 20px rgba(26,58,143,0.10);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 16px;
  position: relative;
}
.brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.logo-img { height: 48px; width: auto; max-width: 220px; display: block; }
.logo-fallback {
  font-family: Poppins, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--blue);
}
.links {
  display: flex;
  list-style: none;
  gap: 28px;
  align-items: center;
}
.links a {
  text-decoration: none;
  color: var(--text-dark);
  font-size: 14.5px;
  font-weight: 500;
}
.links a:hover { color: var(--red); }
.btn, .links a.btn {
  display: inline-block;
  background: var(--red);
  color: #fff !important;
  padding: 10px 22px;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--red);
  font-size: 14.5px;
  cursor: pointer;
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.outline {
  background: transparent;
  color: #fff !important;
  border-color: rgba(255,255,255,0.7);
}
.btn.outline:hover { background: #fff; color: var(--blue-dark) !important; }
.hamb {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}
.hamb span { display: block; width: 24px; height: 2.5px; background: var(--blue-dark); border-radius: 2px; }

/* Hero */
.hero {
  background: linear-gradient(120deg, var(--blue-dark), var(--blue));
  padding: 48px 0 56px;
  color: #fff;
}
.crumbs { font-size: 14px; color: rgba(255,255,255,0.7); margin-bottom: 18px; }
.crumbs a { color: rgba(255,255,255,0.85); text-decoration: none; }
.crumbs a:hover { color: #fff; }
.pill {
  display: inline-block;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.hero h1 {
  font-family: Poppins, sans-serif;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  line-height: 1.2;
  max-width: 920px;
}
.lede {
  font-size: 17px;
  color: rgba(255,255,255,0.8);
  max-width: 720px;
  line-height: 1.7;
  margin-top: 14px;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 22px;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
}
.meta b { color: #fff; font-weight: 600; }

/* Article + sidebar */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
  align-items: start;
  padding: 40px 0 72px;
}
article {
  min-width: 0;
  font-size: 17px;
  color: var(--text-dark);
  line-height: 1.8;
}
article > p { margin: 0 0 1.05em; }
article h2 {
  font-family: Poppins, sans-serif;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 700;
  line-height: 1.3;
  margin: 2em 0 0.7em;
  color: var(--blue-dark);
  scroll-margin-top: 96px;
}
article h3 {
  font-family: Poppins, sans-serif;
  font-size: 20px;
  font-weight: 650;
  margin: 1.6em 0 0.55em;
  color: var(--text-dark);
  scroll-margin-top: 96px;
}
article h4 {
  font-family: Poppins, sans-serif;
  font-size: 16px;
  font-weight: 650;
  margin: 0 0 6px;
}
article ul, article ol { margin: 0 0 1.2em 1.2em; }
article li { margin-bottom: 0.4em; }
article code {
  font-size: 0.9em;
  background: var(--bg-light);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}
.lead-in {
  font-size: 19px;
  color: var(--text-mid);
  line-height: 1.75;
}

.featured {
  margin: 0 0 28px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-light);
}
.featured img { width: 100%; height: auto; display: block; }
.featured figcaption {
  font-size: 13px;
  color: var(--text-light);
  padding: 10px 14px 14px;
}

.callout {
  background: #fff7f6;
  border: 1px solid #f3cfcb;
  border-left: 4px solid var(--red);
  border-radius: 10px;
  padding: 20px 24px;
  margin: 8px 0 28px;
}
.callout h2 {
  margin: 0 0 10px;
  font-size: 20px;
  color: var(--red-dark);
}
.callout ul { margin-bottom: 0; }

.toc {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px 18px;
  margin: 0 0 32px;
}
.toc h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--blue-dark);
}
.toc ol { margin: 0 0 0 1.15em; }
.toc a { color: var(--blue); text-decoration: none; }
.toc a:hover { color: var(--red); text-decoration: underline; }

.steps { display: grid; gap: 14px; margin: 8px 0 28px; }
.step {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 4px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(26,58,143,0.04);
}
.step .n {
  grid-row: 1 / span 2;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--blue-dark);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: start;
}
.step h4 { margin: 4px 0 0; }
.step p { margin: 0; font-size: 15px; color: var(--text-mid); line-height: 1.65; }

.table-wrap {
  overflow-x: auto;
  margin: 8px 0 28px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  background: var(--blue-dark);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: #f8f9fd; }

.schema-graphic {
  background: #0d1b3e;
  color: #dce4ff;
  border-radius: 12px;
  padding: 22px 20px 8px;
  margin: 8px 0 28px;
  overflow-x: auto;
}
.schema-graphic h3 { color: #fff; margin: 0 0 4px; font-family: Poppins, sans-serif; }
.schema-graphic .sub { font-size: 13px; color: #9aa8d4; margin-bottom: 12px; }
.schema-graphic .mermaid { background: transparent; }
.schema-graphic svg { max-width: 100%; height: auto; }

.cta-band {
  background: linear-gradient(120deg, var(--blue-dark), var(--blue));
  color: #fff;
  border-radius: 14px;
  padding: 32px 28px;
  margin: 28px 0 16px;
}
.cta-band h2 {
  color: #fff;
  margin: 0 0 10px;
  font-size: 24px;
}
.cta-band p { color: rgba(255,255,255,0.85); margin-bottom: 18px; }
.cta-band .btn { margin: 0 8px 8px 0; }

.faq {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 0 10px;
  background: #fff;
  padding: 0 18px;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 16px 0;
  list-style: none;
  font-family: Poppins, sans-serif;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  float: right;
  color: var(--red);
  font-weight: 700;
}
.faq[open] summary::after { content: "–"; }
.faq .a { padding: 0 0 16px; color: var(--text-mid); }
.faq .a p:last-child { margin-bottom: 0; }

/* Sidebar */
aside { position: sticky; top: 96px; display: grid; gap: 16px; }
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 18px rgba(26,58,143,0.06);
}
.card h3 {
  font-family: Poppins, sans-serif;
  font-size: 16px;
  margin: 0 0 12px;
}
.card.dark {
  background: linear-gradient(160deg, var(--blue-dark), var(--blue));
  color: #fff;
  border: none;
}
.card.dark h3 { color: #fff; }
.card.dark p { color: rgba(255,255,255,0.8); font-size: 14px; margin-bottom: 16px; }
.toc-side { display: flex; flex-direction: column; gap: 8px; }
.toc-side a {
  font-size: 13.5px;
  color: var(--text-mid);
  text-decoration: none;
  line-height: 1.4;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}
.toc-side a:hover { color: var(--red); border-left-color: var(--red); }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list span {
  font-size: 12px;
  background: var(--bg-light);
  color: var(--text-mid);
  padding: 5px 10px;
  border-radius: 999px;
}

/* Footer */
footer.site {
  background: #0d1b3e;
  color: rgba(255,255,255,0.75);
  padding: 70px 0 0;
}
footer.site .cols {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.4fr;
  gap: 48px;
  margin-bottom: 56px;
}
footer.site h4 {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 22px;
  position: relative;
  padding-bottom: 12px;
}
footer.site h4::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0;
  width: 36px; height: 2px;
  background: var(--red);
}
footer.site ul { list-style: none; }
footer.site li { margin-bottom: 10px; font-size: 14px; }
footer.site a { color: rgba(255,255,255,0.7); text-decoration: none; }
footer.site a:hover { color: #fff; }
.foot-logo img {
  height: 42px;
  width: auto;
  max-width: 180px;
  background: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}
.foot-brand p { font-size: 14px; line-height: 1.8; margin-bottom: 12px; }
.foot-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 22px 0;
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.45);
}

@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  aside { position: static; }
}

@media (max-width: 900px) {
  footer.site .cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .wrap { width: min(var(--wrap), calc(100% - 32px)); }
  .hamb { display: flex; }
  .links {
    display: none;
    position: absolute;
    top: 100%;
    left: -16px;
    right: -16px;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 24px 16px;
    box-shadow: 0 12px 24px rgba(26,58,143,0.12);
  }
  .links.open { display: flex; }
  .links a {
    display: block;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
  }
  .links a.btn { margin-top: 12px; text-align: center; border-bottom: none; }
  .nav { min-height: 64px; }
  .logo-img { height: 40px; }
  .hero { padding: 32px 0 40px; }
  .step { grid-template-columns: 40px 1fr; }
  .step .n { width: 36px; height: 36px; font-size: 12px; }
  footer.site .cols { grid-template-columns: 1fr; }
  .topbar .tb-left { line-height: 1.6; }
}
