/* Minh Thảo - Tài Chính Mỹ. Phone first; light by default, dark follows the device. No inline styles (CSP). */
@font-face { font-family: "Fraunces"; font-weight: 700; font-display: swap; src: url(/fonts/Fraunces-Bold.woff2) format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-display: swap; src: url(/fonts/BeVietnamPro-Medium.woff2) format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-display: swap; src: url(/fonts/BeVietnamPro-Bold.woff2) format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 800; font-display: swap; src: url(/fonts/BeVietnamPro-ExtraBold.woff2) format("woff2"); }

:root {
  --bg: #FFF8EE;
  --card: #FFFFFF;
  --soft: #F6EDE0;
  --line: #E8DCCB;
  --text: #22302E;
  --muted: #5E6B68;
  --green: #2F6F68;
  --green-ink: #2F6F68;
  --on-green: #FFFFFF;
  --pink: #E8879A;
  --pink-ink: #B9445F;
  --gold: #F2B544;
  --gold-soft: #FCEBC7;
  --radius: 16px;
  --head: "Fraunces", Georgia, serif;
  --ui: "Be Vietnam Pro", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14201E;
    --card: #1B2A27;
    --soft: #20322F;
    --line: #2E4440;
    --text: #F4EFE6;
    --muted: #A9B8B4;
    --green: #3E8A81;
    --green-ink: #8FD0C6;
    --on-green: #FFFFFF;
    --pink-ink: #F4AAB8;
    --gold-soft: #3A3220;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 var(--body); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--green-ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.wrap { display: block; width: 100%; max-width: 780px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--green); color: var(--on-green); padding: 6px 10px; z-index: 9; }

h2, h3 { scroll-margin-top: 120px; }
h1, h2 { font-family: var(--head); font-weight: 700; line-height: 1.22; letter-spacing: -0.005em; }
h3 { font-family: var(--ui); font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.95rem; margin: 0.35em 0 0.3em; }
h2 { font-size: 1.4rem; margin: 2em 0 0.6em; }
h3 { font-size: 1.08rem; margin: 1.6em 0 0.4em; }
.kicker { font-family: var(--ui); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.lede { font-size: 1.12rem; }
.meta, .crumb, .small { color: var(--muted); font-size: 0.9rem; }
.crumb { margin: 1.4em 0 0; font-family: var(--ui); font-weight: 500; }
.crumb a { color: var(--muted); }

/* header */
.top { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { width: 38px; height: auto; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-family: var(--head); font-size: 1.2rem; color: var(--pink-ink); }
.brand small { font-family: var(--ui); font-weight: 700; font-size: 0.78rem; color: var(--green-ink); letter-spacing: 0.02em; }
.top nav { display: flex; gap: 2px; overflow-x: auto; margin: 0 -8px; }
.top nav a { color: var(--muted); text-decoration: none; padding: 8px; font-family: var(--ui); font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.top nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -3px 0 var(--pink); }
.notice { margin: 0; background: var(--gold-soft); color: var(--text); font-size: 0.86rem; padding: 7px 0; border-bottom: 1px solid var(--line); }

/* buttons */
.links { display: flex; flex-wrap: wrap; gap: 10px; margin: 1em 0 0; }
.btn { display: inline-block; background: var(--green); color: var(--on-green); border: 0; cursor: pointer; text-decoration: none; font-family: var(--ui); font-weight: 700; padding: 10px 18px; border-radius: 999px; font-size: 0.95rem; }
.btn-ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.btn:hover { filter: brightness(1.08); }

/* home */
.hero { display: grid; gap: 8px; padding: 22px 0 6px; align-items: center; }
.hero-img { width: 96px; }
.hero h1 { font-size: 2rem; margin-top: 0.15em; }
@media (min-width: 680px) {
  .hero { grid-template-columns: 170px 1fr; gap: 28px; padding-top: 36px; }
  .hero-img { width: 170px; }
  h1, .hero h1 { font-size: 2.35rem; }
}

/* tool call-to-action */
.toolcta { display: grid; gap: 2px; margin: 22px 0; padding: 18px 20px; border-radius: var(--radius); background: var(--green); color: var(--on-green); text-decoration: none; }
.toolcta .kicker { color: rgba(255, 255, 255, 0.82); }
.toolcta b { font-family: var(--head); font-size: 1.35rem; line-height: 1.25; }
.toolcta small { font-size: 0.98rem; opacity: 0.92; }
.toolcta .go { font-family: var(--ui); font-weight: 700; margin-top: 6px; }
.toolcta.big b { font-size: 1.6rem; }
.toolcta.soon { background: var(--soft); color: var(--text); border: 1px dashed var(--line); }
.toolcta.soon .kicker { color: var(--muted); }
a.toolcta:hover { filter: brightness(1.06); }

/* lists */
.list { list-style: none; padding: 0; margin: 1.2em 0; display: grid; gap: 10px; }
.list a { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.list a:hover { border-color: var(--green); }
.list .num { flex: none; font-family: var(--ui); font-weight: 800; font-size: 0.8rem; color: var(--on-green); background: var(--pink-ink); border-radius: 8px; padding: 3px 7px; margin-top: 3px; }
.list b { display: block; font-family: var(--ui); font-weight: 700; line-height: 1.35; }
.list small { display: block; color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.list.compact a { padding: 11px 14px; align-items: center; }
.list.compact .num { margin-top: 0; }

.tools { list-style: none; padding: 0; display: grid; gap: 12px; }
@media (min-width: 680px) { .tools { grid-template-columns: 1fr 1fr; } }
.tcard { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 16px 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
a.tcard { border: 2px solid var(--green); }
.tcard b { font-family: var(--head); font-size: 1.2rem; line-height: 1.25; }
.tcard small { color: var(--muted); }
.tcard .path { margin-top: auto; padding-top: 6px; font-family: var(--ui); font-weight: 700; font-size: 0.85rem; color: var(--green-ink); }
.tcard.soon { opacity: 0.8; border-style: dashed; }
.tcard.soon .path { color: var(--muted); }

/* handbook page */
.vbox { display: grid; gap: 14px; margin: 20px 0; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.vbox .thumb img { border-radius: 10px; width: 100%; }
.vbox-tall { grid-template-columns: 120px 1fr; align-items: start; }
@media (min-width: 680px) { .vbox { grid-template-columns: 260px 1fr; align-items: center; } .vbox-tall { grid-template-columns: 150px 1fr; } }
.vtitle { font-family: var(--ui); font-weight: 700; margin: 4px 0 0; line-height: 1.35; }
.vtext .links { margin-top: 10px; }
.vtext .small { margin: 8px 0 0; }

.toc { background: var(--soft); border-radius: var(--radius); padding: 12px 18px; margin: 18px 0; }
.toc p { margin: 0 0 4px; font-family: var(--ui); font-weight: 700; font-size: 0.9rem; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.2em; }

.prose { overflow-wrap: anywhere; }
.prose li { margin: 0.3em 0; }
.prose blockquote { margin: 1em 0; padding: 4px 16px; border-left: 4px solid var(--pink); color: var(--text); background: var(--soft); border-radius: 0 10px 10px 0; }
.box { border-radius: var(--radius); padding: 4px 18px; margin: 1.4em 0; }
.box h2 { margin-top: 0.8em; font-size: 1.25rem; }
.box-todo { background: var(--gold-soft); border: 1px solid var(--gold); }
.box-warn { background: var(--soft); border-left: 5px solid var(--pink); }
.box-help { background: var(--card); border: 2px solid var(--green); }
.checklist { list-style: none; padding: 0; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; }
.checklist input { margin-top: 0.42em; width: 18px; height: 18px; accent-color: var(--green); flex: none; }

.table { overflow-x: auto; margin: 1.2em 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--ui); font-weight: 700; background: var(--soft); }
@media (max-width: 560px) {
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px 4px; background: var(--card); }
  td { border: 0; padding: 4px 10px; }
  td::before { content: attr(data-label); display: block; font-family: var(--ui); font-weight: 700; font-size: 0.8rem; color: var(--muted); }
}

.story { color: var(--muted); font-size: 0.92rem; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 2em; }
.draft { background: var(--gold); color: #22302E; font-family: var(--ui); font-weight: 800; padding: 8px 12px; border-radius: 10px; margin: 16px 0 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 2.4em 0 1em; }
.pager a { display: block; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 0.95rem; }
.pager span { display: block; font-family: var(--ui); font-weight: 700; color: var(--muted); font-size: 0.82rem; }
.pager .next { text-align: right; }

/* calculator */
.calc { display: grid; gap: 18px; margin: 22px 0 28px; }
@media (min-width: 900px) {
  body:has(.tool) .wrap { max-width: 1120px; }
  .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
  .result { position: sticky; top: 120px; }
}
.inputs, .result { border-radius: var(--radius); padding: 18px 20px; }
.inputs { background: var(--card); border: 1px solid var(--line); }
.field { margin: 0 0 16px; }
.field label, .field .lbl { display: block; font-family: var(--ui); font-weight: 700; margin-bottom: 4px; }
.field .hint { display: block; color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.money { display: flex; align-items: center; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); }
.money:focus-within { border-color: var(--green); }
.money span { padding: 0 4px 0 12px; font-family: var(--ui); font-weight: 700; color: var(--muted); font-size: 1.15rem; }
.money input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: 700 1.25rem var(--ui); padding: 10px 12px 10px 2px; outline: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--green); flex: none; }
details.more { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
details.more summary { cursor: pointer; font-family: var(--ui); font-weight: 700; color: var(--green-ink); margin-bottom: 12px; }

.result { background: var(--green); color: var(--on-green); }
.result .kicker { color: rgba(255, 255, 255, 0.8); }
.big-num { font: 800 2.6rem/1.1 var(--ui); margin: 4px 0 2px; letter-spacing: -0.01em; }
.result .sub { margin: 0; opacity: 0.92; }
.rows { margin: 16px 0 0; padding: 0; list-style: none; border-top: 1px solid rgba(255, 255, 255, 0.25); }
.rows li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.18); }
.rows li b { font-family: var(--ui); white-space: nowrap; }
.rows li.total { font-weight: 700; }
.dates { margin: 14px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dates li { background: rgba(255, 255, 255, 0.12); border-radius: 10px; padding: 6px 4px; text-align: center; font-family: var(--ui); font-size: 0.82rem; line-height: 1.3; }
.dates li b { display: block; font-size: 1rem; }
.dates li.past { opacity: 0.55; text-decoration: line-through; }
.dates li.next { background: var(--gold); color: #22302E; }
.note { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.12); font-size: 0.92rem; }
.note.ok { background: var(--gold); color: #22302E; }
.estimate { display: inline-block; font-family: var(--ui); font-weight: 800; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; background: var(--gold); color: #22302E; border-radius: 6px; padding: 2px 7px; }
.nojs { background: var(--gold-soft); padding: 10px 14px; border-radius: 10px; }

/* footer */
.foot { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; background: var(--soft); }
.foot p { margin: 0.6em 0; }
.signup { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.signup p { margin: 0.3em 0; }
.signup label { font-family: var(--ui); font-weight: 700; display: block; margin: 6px 0 4px; }
.su-row { display: flex; flex-wrap: wrap; gap: 8px; }
.su-row input { flex: 1 1 220px; border: 2px solid var(--line); border-radius: 999px; padding: 9px 14px; font: inherit; background: var(--bg); color: var(--text); }

/* form controls used by the tools */
fieldset.field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
fieldset.field .check { margin: 4px 0; }
.field select { width: 100%; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font: 700 1.02rem var(--ui); padding: 10px 12px; }
.field select:focus { border-color: var(--green); outline: none; }
.rows li b { text-align: right; }

/* PDF download card */
.pdfcard { display: grid; gap: 2px; margin: 16px 0; padding: 14px 18px; border-radius: var(--radius); background: var(--card); border: 2px solid var(--pink); color: var(--text); text-decoration: none; }
.pdfcard b { font-family: var(--head); font-size: 1.15rem; line-height: 1.25; }
.pdfcard small { color: var(--muted); }
.pdfcard .go { font-family: var(--ui); font-weight: 700; color: var(--pink-ink); margin-top: 4px; }
.tools .pdfcard { margin: 0; height: 100%; }

/* printable checklist pages (/in/…), printed to PDF by tools/makepdf.py */
@page { size: Letter; margin: 0.55in 0.6in; }
body.printdoc { background: #fff; color: #22302E; font: 11.5pt/1.45 var(--ui); font-weight: 500; max-width: 7.3in; margin: 0 auto; padding: 0; color-scheme: light; }
.printdoc .ph { display: flex; align-items: center; gap: 10px; border-bottom: 2px solid #E8879A; padding-bottom: 8px; }
.printdoc .ph img { width: 34px; }
.printdoc .ph div { display: flex; flex-direction: column; line-height: 1.1; }
.printdoc .ph b { font-family: var(--head); font-size: 15pt; color: #B9445F; }
.printdoc .ph small { font-weight: 700; font-size: 8.5pt; color: #2F6F68; }
.printdoc .ph-url { margin: 0 0 0 auto; font-weight: 700; color: #2F6F68; font-size: 10pt; }
.printdoc h1 { font-size: 21pt; margin: 12px 0 4px; }
.printdoc .lede { font-size: 11pt; margin: 0 0 8px; color: #3c4a47; }
.printdoc h2 { font-size: 13pt; margin: 14px 0 6px; font-family: var(--head); }
.printdoc p { margin: 5px 0; }
.printdoc ul, .printdoc ol { margin: 4px 0; padding-left: 1.2em; }
.printdoc .checklist { padding: 0; }
.printdoc .checklist li { margin: 0; padding: 5px 0; border-bottom: 1px dotted #d9cdbb; break-inside: avoid; }
.printdoc .checklist input { width: 14px; height: 14px; margin-top: 2px; accent-color: #2F6F68; }
.printdoc .box { padding: 2px 12px; margin: 10px 0; border-radius: 10px; break-inside: avoid; }
.printdoc .box h2 { margin-top: 6px; }
.printdoc .box-todo { background: #FCEBC7; border: 1px solid #F2B544; }
.printdoc .box-help { border: 1.5px solid #2F6F68; background: #fff; }
.printdoc .box-warn { background: #F6EDE0; border-left: 4px solid #E8879A; }
.printdoc .table { margin: 8px 0; overflow: visible; }
.printdoc table { font-size: 10.5pt; }
.printdoc th { background: #F6EDE0; }
.printdoc th, .printdoc td { border: 1px solid #d9cdbb; padding: 6px 8px; height: 26px; }
.printdoc a { color: #22302E; text-decoration: none; }
.printdoc .pf { margin-top: 14px; padding-top: 8px; border-top: 1px solid #d9cdbb; font-size: 8.5pt; color: #5E6B68; }

/* simulators: chart colours (validated for colour-blind separation, light and dark) */
:root { --c-a: #06819C; --c-b: #B9650F; --c-ghost: #9AA5A2; --c-band: rgba(6, 129, 156, 0.14); }
@media (prefers-color-scheme: dark) { :root { --c-a: #2A9BB4; --c-b: #C9822E; --c-ghost: #6E807C; --c-band: rgba(42, 155, 180, 0.18); } }
.slider { display: grid; grid-template-columns: 1fr; gap: 8px; }
.slider input[type=range] { width: 100%; accent-color: var(--green); height: 28px; margin: 0; }
.range-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8rem; margin-top: -4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.chips legend { padding: 0; margin-bottom: 6px; font-family: var(--ui); font-weight: 700; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chips span { display: inline-block; padding: 7px 14px; border-radius: 999px; border: 2px solid var(--line); font-family: var(--ui); font-weight: 700; font-size: 0.95rem; background: var(--bg); }
.chips input:checked + span { background: var(--green); border-color: var(--green); color: var(--on-green); }
.chips input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.chartcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 10px; margin: 0 0 28px; }
.chartcard h2 { margin: 0 0 4px; font-size: 1.2rem; }
.chartcard .small { margin: 0 0 8px; }
.chartbox { position: relative; height: 300px; }
@media (min-width: 900px) { .chartbox { height: 380px; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 6px 0 4px; padding: 0; list-style: none; font-size: 0.9rem; color: var(--text); }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 6px; }
.legend i.sw { height: 12px; border: 0; border-radius: 3px; }
.legend .la { border-color: var(--c-a); } .legend .lb { border-color: var(--c-b); } .legend .lg { border-color: var(--c-ghost); border-top-style: dashed; }
.legend .sa { background: var(--c-a); } .legend .sb { background: var(--c-b); } .legend .sband { background: var(--c-band); }
.chartcard details { margin-top: 8px; }
.chartcard summary { cursor: pointer; font-family: var(--ui); font-weight: 700; color: var(--green-ink); font-size: 0.92rem; }
.chartcard table { margin-top: 8px; font-size: 0.88rem; }
.result .warn { background: #fff; color: #8a2a3d; font-weight: 700; }

/* the hidden attribute always wins over display rules above */
[hidden] { display: none !important; }

/* deadline calendar */
.cal { list-style: none; padding: 0; margin: 18px 0 28px; display: grid; gap: 10px; }
.cal-item { display: grid; grid-template-columns: 84px 1fr; gap: 14px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.cal-item.past { opacity: 0.5; }
.cal-date { text-align: center; font-family: var(--ui); line-height: 1.15; border-right: 2px solid var(--pink); padding-right: 12px; }
.cal-date b { display: block; font-size: 1.5rem; font-weight: 800; color: var(--pink-ink); }
.cal-date span { display: block; font-weight: 700; }
.cal-date small { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.cal-body p { margin: 0 0 4px; }
.cal-title { font-family: var(--ui); font-weight: 700; }
.cal-links { font-size: 0.9rem; }

/* two-sided comparison headings inside a form (e.g. /xe) */
.xe-head { font-family: var(--ui); font-weight: 800; margin: 18px 0 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.xe-head:first-of-type { border-top: 0; padding-top: 0; }
.xe-head i.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }
.xe-head .sa { background: var(--c-a); } .xe-head .sb { background: var(--c-b); }

/* topic icons (replace internal video codes) */
.ico { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; }
.ico svg { width: 24px; height: 24px; }
.ico-lg { width: 52px; height: 52px; border-radius: 15px; }
.ico-lg svg { width: 30px; height: 30px; }
.t-green { background: #E1EFEC; color: #2F6F68; }
.t-pink { background: #FBE4E9; color: #B9445F; }
.t-gold { background: #FCEBC7; color: #8A5A00; }
@media (prefers-color-scheme: dark) {
  .t-green { background: #23423D; color: #9AD7CC; }
  .t-pink { background: #4A2A33; color: #F4AAB8; }
  .t-gold { background: #46391C; color: #F2C66B; }
}
.titlerow { display: flex; align-items: center; gap: 14px; margin: 0.35em 0 0.3em; }
.titlerow h1 { margin: 0; }
.list a { align-items: center; }
.list .ico { margin-top: 0; }
.tcard .ico { margin-bottom: 6px; }
.toolcta .ico { margin-bottom: 8px; background: rgba(255, 255, 255, 0.92); }
.toolcta.soon .ico { background: var(--card); }
.story-banner { display: inline-block; margin: 6px 0 0; padding: 6px 12px; border-radius: 999px; background: var(--gold-soft); border: 1px solid var(--gold); font-family: var(--ui); font-weight: 700; font-size: 0.88rem; }
:root { --c-zero: rgba(154, 165, 162, 0.22); }
@media (prefers-color-scheme: dark) { :root { --c-zero: rgba(110, 128, 124, 0.28); } }
.legend .sgrey { background: var(--c-zero); }
.chartcard .chips { margin: 4px 0 8px; }
.tool-h2 { margin: 1.4em 0 0; }
.chartbox-short { height: 230px; }
@media (min-width: 900px) { .chartbox-short { height: 240px; } }

/* Thuật ngữ: tappable terms open a native popover (no JS). Dotted underline = "tap me". */
.term { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  text-decoration: underline dotted; text-decoration-color: var(--pink); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.term:hover { color: var(--green-ink); }
.result .term { text-decoration-color: rgba(255, 255, 255, 0.7); }
.tnpop { display: none; }
.tnpop:popover-open { display: block; }
.tnpop { width: min(92vw, 440px); margin: auto; padding: 18px 20px 14px; border: 1px solid var(--line); border-top: 5px solid var(--pink);
  border-radius: 16px; background: var(--card); color: var(--text); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25); font-size: 1.05rem; line-height: 1.6; }
.tnpop::backdrop { background: rgba(0, 0, 0, 0.45); }
.tnpop p { margin: 0 0 10px; }
.tn-label { font-family: var(--ui); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tn-en { text-transform: none; letter-spacing: 0; font-style: italic; font-weight: 500; }
.tn-term { font-family: var(--head); font-weight: 700; font-size: 1.4rem; line-height: 1.2; }
.tn-ex { background: var(--soft); border-radius: 10px; padding: 8px 12px; font-size: 0.98rem; }
.tn-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 0.92rem; margin: 4px 0 0; flex-wrap: wrap; }
.tn-links button { font: 700 1rem var(--ui); background: var(--green); color: var(--on-green); border: 0; border-radius: 999px; padding: 9px 20px; cursor: pointer; }
.glossary { margin: 1.2em 0 2em; }
.gl-item { border-top: 1px solid var(--line); padding: 14px 0; scroll-margin-top: 120px; }
.gl-item:target { background: var(--gold-soft); box-shadow: -10px 0 0 var(--gold-soft), 10px 0 0 var(--gold-soft); }
.gl-item dt { font-family: var(--head); font-weight: 700; font-size: 1.2rem; }
.gl-item dt .tn-en { margin-left: 6px; font-family: var(--body); font-size: 0.9rem; color: var(--muted); }
.gl-item dd { margin: 4px 0 0; }
.gl-item dd p { margin: 0 0 6px; }
.gl-meta { font-size: 0.9rem; }
.more { margin: 1.2em 0; }
@media print { .tnpop { display: none !important; } .term { all: unset; } }
