/* Fonts: Bai Jamjuree, SIL Open Font License 1.1, self-hosted */
@font-face { font-family: "Bai Jamjuree"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/bai-jamjuree-400.woff2") format("woff2"); }
@font-face { font-family: "Bai Jamjuree"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/bai-jamjuree-500.woff2") format("woff2"); }
@font-face { font-family: "Bai Jamjuree"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/bai-jamjuree-600.woff2") format("woff2"); }
@font-face { font-family: "Bai Jamjuree"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/bai-jamjuree-700.woff2") format("woff2"); }

:root {
  --red: #dd0000;
  --red-ink: #b80000;
  --red-tint: #fff3f3;
  --black: #020204;
  --navy: #091019;
  --navy-2: #05090e;
  --ink: #222222;
  --muted: #5a6068;
  --line: #e6e7ea;
  --soft: #f4f5f6;
  --hero: #eceef0;
  --ok: #1e7e3a;
  --warn: #a14a00;
  --note-bg: #f2f4f7;
  --warn-bg: #fff5ea;
  --tip-bg: #eef6f0;
  --radius: 8px;
  --shadow: 0 3px 16px rgba(10, 14, 20, 0.08);
  --container: 1120px;
  --text: 760px;
  --font: "Bai Jamjuree", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.65; color: var(--ink); background: #fff; overflow-x: clip; }
img, svg { max-width: 100%; height: auto; }
img { display: block; }
a { color: var(--red-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--red); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; }
h1, h2 { text-transform: uppercase; font-weight: 700; letter-spacing: 0.005em; }
h3 { font-weight: 600; font-size: 1.15rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin-bottom: 0.35em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.icon--sm { width: 16px; height: 16px; }
.icon--xs { width: 13px; height: 13px; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: #fff; color: var(--ink); padding: 10px 16px; border-radius: 6px; font-weight: 600; }
.skip:focus { top: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 28px; border-radius: 999px; font-weight: 700; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none; border: 2px solid transparent; transition: background-color 0.15s, color 0.15s; }
.btn--primary { background: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-ink); color: #fff; }
.btn--light { background: #fff; color: var(--ink); }
.btn--light:hover { background: var(--soft); color: var(--ink); }

/* Header */
.site-header { background: var(--red); color: #fff; position: sticky; top: 0; z-index: 50; }
.site-header__bar { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 24px; position: relative; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.05; margin: 0; }
.logo:hover { color: #fff; }
.logo__mark { width: 32px; height: 32px; flex: none; }
.logo__text { font-size: 15px; }
.logo__text span { display: block; font-weight: 500; font-size: 12px; letter-spacing: 0.12em; opacity: 0.9; }
.site-header :focus-visible { outline-color: #fff; }
.nav ul { list-style: none; display: flex; align-items: center; gap: 26px; margin: 0; padding: 0; }
.nav li { margin: 0; }
.nav a { color: #fff; text-decoration: none; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: #fff; color: #fff; }
.nav .nav__submit { border: 2px solid #fff; border-radius: 999px; padding: 7px 16px; }
.nav .nav__submit:hover { background: #fff; color: var(--red-ink); }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle__btn { display: none; cursor: pointer; padding: 8px; color: #fff; }

/* Page head (inner pages) */
.page-head { background: var(--hero); padding: 28px 0 36px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); max-width: 22ch; margin-top: 14px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0; padding: 0; font-size: 14px; color: var(--muted); }
.crumbs li { margin: 0; }
.crumbs li + li::before { content: "/"; margin: 0 8px; color: #9aa0a6; }
.crumbs a { color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--muted); margin: 0; }
.meta span + span { padding-left: 18px; border-left: 1px solid #c8ccd1; }

/* Article layout */
.layout { display: grid; grid-template-columns: minmax(0, var(--text)) 280px; gap: 48px; justify-content: space-between; padding-block: 40px 72px; }
.layout--single { grid-template-columns: minmax(0, var(--text)); justify-content: center; }
.layout--wide { grid-template-columns: minmax(0, 1fr); }
.article > .sec { margin-bottom: 44px; }
.article h2 { font-size: 1.45rem; padding-top: 4px; }
.article .legal-note { font-size: 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; background: var(--soft); }
.sidebar { position: relative; }
.toc--side { position: sticky; top: 92px; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; background: #fff; box-shadow: var(--shadow); }
.toc__title { font-weight: 700; text-transform: uppercase; font-size: 13px; letter-spacing: 0.06em; margin-bottom: 10px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--ink); text-decoration: none; font-size: 14px; line-height: 1.4; }
.toc a:hover, .toc a.is-active { color: var(--red-ink); border-left-color: var(--red); }
.toc--inline { display: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 32px; background: var(--soft); }

/* Blocks inside articles */
.bluf { border-left: 4px solid var(--red); background: var(--red-tint); padding: 18px 22px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 1.06rem; }
.bluf p:last-child { margin: 0; }
.callout { border-radius: var(--radius); padding: 18px 22px; margin: 0 0 1.2em; border: 1px solid transparent; border-left-width: 5px; font-size: 1.02rem; }
.callout p:last-child { margin-bottom: 0; }
.callout__label { display: flex; align-items: center; gap: 8px; font-weight: 700; text-transform: uppercase; font-size: 13px; letter-spacing: 0.06em; margin-bottom: 6px; }
.callout--note { background: var(--note-bg); border-color: #d9dee5; border-left-color: var(--navy); }
.callout--warning { background: var(--warn-bg); border-color: #f2d9bd; border-left-color: var(--warn); }
.callout--warning .callout__label { color: var(--warn); }
.callout--tip { background: var(--tip-bg); border-color: #cfe5d6; border-left-color: var(--ok); }
.callout--tip .callout__label { color: var(--ok); }

.item__icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--red-tint); color: var(--red); margin-bottom: 12px; }
.item__icon .icon { width: 22px; height: 22px; }
.sec[data-layout="tiles"], .sec[data-layout="cards"], .sec[data-layout="cols"] { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sec[data-layout="cols"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sec[data-layout="tiles"] > :not(.item), .sec[data-layout="cards"] > :not(.item), .sec[data-layout="cols"] > :not(.item) { grid-column: 1 / -1; }
.article .item { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: #fff; box-shadow: var(--shadow); }
.article .item h3 { font-size: 1.08rem; }
.article .item p:last-child { margin-bottom: 0; }
.article .item p { font-size: 15px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1.2em; background: #fff; }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.data-table thead th { background: var(--black); color: #fff; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; position: sticky; top: 0; z-index: 2; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tbody th { font-weight: 600; }
.data-table tbody tr { transition: background-color 0.15s; }
.data-table tbody tr:hover { background: var(--red-tint); }
.matrix td, .matrix thead th:not(:first-child) { text-align: center; white-space: nowrap; }
.cov { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.cov--yes { background: #e3f3e8; color: var(--ok); }
.cov--no { background: #fde8e8; color: var(--red-ink); }
.cov--na { background: #eceef1; color: #5e646c; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 0; margin: 0 0 14px; font-size: 14px; }
.legend li { margin: 0; display: flex; align-items: center; }

.steps { list-style: none; counter-reset: step; padding: 0; }
.steps--plain li { counter-increment: step; position: relative; padding: 2px 0 14px 50px; margin: 0; }
.steps--plain li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 700; display: grid; place-items: center; }
.steps--plain li:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 38px; bottom: 2px; width: 2px; background: var(--line); }
.checklist, .mistakes { list-style: none; padding: 0; display: grid; gap: 10px; }
.checklist li, .mistakes li { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.checklist .icon { color: var(--ok); margin-top: 4px; }
.mistakes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mistakes li { flex-direction: column; gap: 6px; border-top: 3px solid var(--warn); font-size: 15px; }
.mistakes .icon { color: var(--warn); }
.criteria { list-style: none; counter-reset: crit; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.criteria li { counter-increment: crit; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 16px 62px; position: relative; box-shadow: var(--shadow); font-size: 15px; }
.criteria li::before { content: counter(crit); position: absolute; left: 18px; top: 16px; width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.sec[data-layout="topics"] ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.sec[data-layout="topics"] li { margin: 0; border: 1px solid var(--line); border-top: 3px solid var(--red); border-radius: var(--radius); padding: 16px; font-size: 15px; box-shadow: var(--shadow); }
.sec[data-layout="topics"] li strong { display: block; margin-bottom: 4px; font-size: 16px; }
.sec[data-layout="email"] p:first-of-type a { font-size: 1.25rem; font-weight: 700; word-break: break-word; }
.template-line { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; font-size: 15px; }
.source-list { list-style: none; padding: 0; }
.source-list li { padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; display: flex; flex-direction: column; gap: 2px; }
.source-list a { font-weight: 600; }
.source-list span { color: var(--muted); font-size: 15px; }
.sec[data-layout="related"] ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.sec[data-layout="related"] li { margin: 0; }
.sec[data-layout="related"] a { display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; font-weight: 600; color: var(--ink); background: #fff; }
.sec[data-layout="related"] a:hover { border-color: var(--red); color: var(--red-ink); }
.link-list { padding-left: 1.2em; }

/* Guide hub */
.sec[data-layout="guide-cards"] { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.sec[data-layout="guide-cards"] > :not(.guide-card) { grid-column: 1 / -1; max-width: var(--text); }
.guide-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: #fff; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: border-color 0.15s; }
.guide-card:hover { border-color: var(--red); color: var(--ink); }
.guide-card h3 { font-size: 1.12rem; }
.guide-card p { font-size: 15px; color: var(--muted); }
.guide-card__more { margin-top: auto; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--red-ink); }

/* FAQ */
.faq { border-bottom: 1px solid var(--line); }
.faq:first-of-type { border-top: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 2px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary h3 { margin: 0; font-size: 1.05rem; }
.faq summary::after { content: ""; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dd0000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 14px no-repeat; transition: transform 0.2s; }
.faq[open] summary::after { transform: rotate(45deg); }
.faq summary:hover h3 { color: var(--red-ink); }
.faq__answer { padding: 0 2px 16px; }
.faq__answer p:last-child { margin: 0; }

/* Infographics */
.ig { margin: 8px 0 1.2em; }
.ig-sum__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.ig-sum__part { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 118px; max-width: 150px; padding: 16px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; font-weight: 600; font-size: 14px; line-height: 1.3; box-shadow: var(--shadow); }
.ig-sum__part .icon { color: var(--red); width: 26px; height: 26px; }
.ig-sum__total { background: var(--red); border-color: var(--red); color: #fff; }
.ig-sum__total .icon { color: #fff; }
.ig-sum__op { font-size: 26px; font-weight: 700; color: var(--muted); }
.ig-flow { display: grid; gap: 12px; }
.ig-flow__row { display: grid; grid-template-columns: 54px minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr); align-items: center; gap: 6px; }
.ig-flow__term { font-weight: 700; font-size: 18px; color: var(--navy); }
.ig-flow__node { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; font-weight: 600; line-height: 1.3; background: #fff; }
.ig-flow__node .icon { color: var(--muted); }
.ig-flow__node.is-payer { border-color: var(--red); background: var(--red-tint); }
.ig-flow__node.is-payer .icon { color: var(--red); }
.ig-flow__node--border { background: var(--soft); }
.ig-flow__line { height: 2px; background: repeating-linear-gradient(90deg, #9aa0a6 0 6px, transparent 6px 10px); }
.ig-decide { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--soft); }
.ig-decide__q { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-size: 17px; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 12px 16px; width: max-content; max-width: 100%; margin: 0 auto 18px; }
.ig-decide__branches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ig-decide__branch { display: flex; flex-direction: column; gap: 10px; }
.ig-decide__tag { font-weight: 700; text-transform: uppercase; font-size: 13px; letter-spacing: 0.06em; color: var(--muted); }
.ig-decide__step { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-weight: 600; font-size: 15px; line-height: 1.35; }
.ig-decide__step .icon { color: var(--red); }
.ig-decide__step.is-urgent { border-color: var(--red); }

/* Footer */
.site-footer { background: var(--navy); color: #dfe3e8; margin-top: 0; }
.site-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1.1fr 1fr; gap: 32px; padding-block: 56px 40px; }
.logo--footer { color: var(--red); }
.logo--footer .logo__text span { color: #fff; opacity: 1; }
.site-footer__h { color: var(--red); font-weight: 700; text-transform: uppercase; font-size: 14px; letter-spacing: 0.04em; margin-bottom: 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: #fff; text-decoration: none; font-size: 15px; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer :focus-visible { outline-color: #fff; }
.site-footer__mail { display: flex; align-items: center; gap: 10px; margin-top: 18px; word-break: break-word; }
.site-footer__bottom { background: var(--navy-2); padding: 18px 0; font-size: 14px; color: #c3c9d0; }
.site-footer__bottom .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; }
.site-footer__bottom p { margin: 0; }

/* Reading progress */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; background: #fff; transform-origin: 0 50%; transform: scaleX(0); }

/* Responsive */
@media (max-width: 1099px) {
  .nav-toggle__btn { display: inline-flex; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--red-ink); padding: 8px 20px 18px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); }
  .nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .nav a { display: block; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.2); }
  .nav .nav__submit { margin-top: 12px; text-align: center; }
  .nav-toggle:checked ~ .nav { display: block; }
  .layout { grid-template-columns: minmax(0, 1fr); padding-block: 28px 56px; }
  .sidebar { display: none; }
  .toc--inline { display: block; }
  .site-footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sec[data-layout="guide-cards"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  body { font-size: 16px; }
  .sec[data-layout="tiles"], .sec[data-layout="cards"], .sec[data-layout="cols"], .sec[data-layout="guide-cards"],
  .mistakes, .criteria, .sec[data-layout="topics"] ul, .ig-decide__branches { grid-template-columns: minmax(0, 1fr); }
  .ig-flow__row { grid-template-columns: 44px minmax(0, 1fr); }
  .ig-flow__line { display: none; }
  .ig-flow__row .ig-flow__node { grid-column: 2; }
  .ig-flow__term { grid-row: 1 / span 3; align-self: start; padding-top: 10px; }
  .ig-sum__part { min-width: 0; flex: 1 1 40%; max-width: none; }
  .site-footer__grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .logo__text { font-size: 13px; }
  .logo__text span { font-size: 11px; }
  .data-table { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.article .ig-sum__row { flex-wrap: nowrap; gap: 6px; }
.article .ig-sum__part { min-width: 0; max-width: none; flex: 1 1 0; padding: 14px 6px; font-size: 13px; }
.article .ig-sum__op { font-size: 20px; }
@media (max-width: 767px) { .article .ig-sum__row { flex-wrap: wrap; } .article .ig-sum__part { flex: 1 1 40%; } }
.guide-card__img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.guide-card__body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.photo { margin: -12px 0 40px; }
.photo img { width: 100%; height: auto; border-radius: var(--radius); }
.photo figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.photo figcaption a { color: var(--muted); }
@media (max-width: 480px) {
  .meta { flex-direction: column; gap: 2px; }
  .meta span + span { padding-left: 0; border-left: 0; }
}
