/* Giáo trình số — Kiến trúc máy tính nâng cao. CSS tự viết, không framework. */

:root {
  --kmt-blue: #1F4E79;   --kmt-blue-l: #DEEBF7;
  --kmt-orange: #C55A11; --kmt-orange-l: #FBE5D6;
  --kmt-green: #38761D;  --kmt-green-l: #E2EFDA;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --text: #1d2530;
  --text-2: #4a5666;
  --muted: #6b7686;
  --border: #dde3ea;
  --border-strong: #c6cfda;
  --accent: var(--kmt-blue);
  --accent-ink: #ffffff;
  --accent-soft: var(--kmt-blue-l);
  --link: #1a5b9a;
  --mark: #fff1a8;
  --danger: #b42318;
  --ok: #2f6f1a;

  --box-vidu-bg: var(--kmt-blue-l);     --box-vidu-bd: var(--kmt-blue);
  --box-luuy-bg: var(--kmt-orange-l);   --box-luuy-bd: var(--kmt-orange);
  --box-lichsu-bg: var(--kmt-green-l);  --box-lichsu-bd: var(--kmt-green);
  --box-muctieu-bg: var(--kmt-orange-l); --box-muctieu-bd: var(--kmt-orange);
  --box-loigiai-bg: #eef1f4;            --box-loigiai-bd: #6b7686;

  --code-bg: #f6f8fa;
  --code-bar: #eef1f5;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-2: 0 10px 30px rgba(16, 24, 40, .16);

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-read: "Noto Serif", "Source Serif 4", Cambria, Georgia, serif; /* không dùng Charter: thiếu ơ, ư và các chữ có dấu móc */
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --topbar-h: 56px;
  --sidebar-w: 288px;
  --assistant-w: 392px;
  --read-w: 46rem;
  --radius: 10px;
  --radius-sm: 6px;
}

[data-theme="dark"] {
  --bg: #0e1319;
  --surface: #151b23;
  --surface-2: #1b232d;
  --text: #e3e8ef;
  --text-2: #b9c3cf;
  --muted: #8b97a6;
  --border: #29333f;
  --border-strong: #3a4654;
  --accent: #6ea8dc;
  --accent-ink: #0b1220;
  --accent-soft: #1b3550;
  --link: #8cc0f0;
  --mark: #5a4c0c;
  --danger: #ff8a7a;
  --ok: #8fd17a;

  --box-vidu-bg: #16293d;    --box-vidu-bd: #5d9ad3;
  --box-luuy-bg: #33231a;    --box-luuy-bd: #e08a4f;
  --box-lichsu-bg: #1b2c18;  --box-lichsu-bd: #79b85f;
  --box-muctieu-bg: #33231a; --box-muctieu-bd: #e08a4f;
  --box-loigiai-bg: #1d242d; --box-loigiai-bd: #8b97a6;

  --code-bg: #10161d;
  --code-bar: #18202a;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 12px 34px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.pad { padding: 1rem; }
[hidden] { display: none !important; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: .5rem .9rem; border-radius: var(--radius-sm); transition: top .15s; }
.skip-link:focus { top: 10px; }

/* ------------------------------------------------------------------ nút */
.btn { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: .5rem .9rem; border-radius: 8px; cursor: pointer; font-weight: 550; line-height: 1.2; text-decoration: none; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn.sm { padding: .34rem .7rem; font-size: .88rem; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
[data-theme="dark"] .btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.chip-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: .2rem .65rem; font-size: .82rem; cursor: pointer; color: var(--text-2); }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------------ thanh trên */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar-h); display: flex; align-items: center; gap: .75rem;
  padding: 0 .9rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--kmt-blue); color: #fff; font-weight: 800; letter-spacing: .5px; font-size: .9rem; }
[data-theme="dark"] .brand-mark { background: #2b5f91; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-title { font-weight: 700; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: .74rem; color: var(--muted); }
.search { position: relative; flex: 1 1 340px; max-width: 460px; margin-left: auto; }
.search input { width: 100%; height: 38px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 9px; padding: 0 2.2rem 0 2.2rem; }
.search input:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.search-ico { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-kbd { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); }
kbd { font: 600 .72rem var(--font-mono); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; color: var(--muted); background: var(--surface); }
.top-links { display: flex; gap: .15rem; }
.top-links a { text-decoration: none; color: var(--text-2); padding: .4rem .6rem; border-radius: 7px; font-weight: 520; font-size: .92rem; }
.top-links a:hover { background: var(--surface-2); color: var(--text); }
.top-links a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.top-actions { display: flex; align-items: center; gap: .25rem; }
.btn-assistant svg { width: 18px; height: 18px; }
#btn-instructor.unlocked { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.ico-sun { display: none; }
[data-theme="dark"] .ico-sun { display: block; }
[data-theme="dark"] .ico-moon { display: none; }
.only-narrow { display: none; }

/* ------------------------------------------------------------------ bố cục 3 cột */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--assistant-w); min-height: calc(100vh - var(--topbar-h)); }
.layout.as-collapsed { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 0; }
.layout.as-collapsed .assistant { display: none; }
.sidebar { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; border-right: 1px solid var(--border); background: var(--surface); overscroll-behavior: contain; }
.main { min-width: 0; outline: none; }
.page { max-width: calc(var(--read-w) + 4rem); margin: 0 auto; padding: 2rem 2rem 5rem; }
.loading { padding: 3rem 0; color: var(--muted); }

/* mục lục */
.toc { padding: .75rem .5rem 2rem; }
.toc-book { padding: .4rem .7rem .8rem; border-bottom: 1px solid var(--border); margin-bottom: .5rem; }
.toc-book a { font-weight: 700; color: var(--text); text-decoration: none; }
.toc-book .muted { font-size: .78rem; }
.toc-ch { margin: .1rem 0; }
.toc-ch-head { display: flex; align-items: flex-start; gap: .1rem; }
.toc-toggle { flex: none; width: 26px; height: 30px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 6px; }
.toc-toggle:hover { background: var(--surface-2); }
.toc-toggle svg { width: 14px; height: 14px; transition: transform .15s; }
.toc-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.toc-ch-link { flex: 1; display: block; padding: .32rem .5rem .32rem .2rem; text-decoration: none; color: var(--text); font-weight: 620; font-size: .9rem; line-height: 1.35; border-radius: 6px; }
.toc-ch-link .n { color: var(--accent); margin-right: .25rem; }
.toc-ch-link:hover { background: var(--surface-2); }
.toc-secs { list-style: none; margin: 0 0 .4rem; padding: 0 0 0 1.6rem; }
.toc-secs a { display: flex; gap: .45rem; padding: .26rem .55rem; border-radius: 6px; text-decoration: none; color: var(--text-2); font-size: .865rem; line-height: 1.35; border-left: 2px solid transparent; }
.toc-secs a:hover { background: var(--surface-2); color: var(--text); }
.toc-secs a .n { flex: none; min-width: 2.1em; color: var(--muted); font-variant-numeric: tabular-nums; }
.toc-secs a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }
.toc-secs a[aria-current="page"] .n { color: var(--accent); }
.toc-secs a.visited:not([aria-current]) .n::after { content: "•"; color: var(--kmt-green); margin-left: .15rem; }
.toc-secs a.toc-ex { color: var(--kmt-orange); }
[data-theme="dark"] .toc-secs a.toc-ex { color: #e5a173; }
.toc-foot { border-top: 1px solid var(--border); margin-top: .75rem; padding: .75rem .7rem; display: flex; flex-direction: column; gap: .35rem; font-size: .87rem; }
.toc-foot a { color: var(--text-2); text-decoration: none; }
.toc-foot a:hover { color: var(--accent); }

/* ------------------------------------------------------------------ vùng đọc */
.crumbs { font-size: .84rem; color: var(--muted); margin-bottom: .75rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.page-title { font: 750 1.9rem/1.25 var(--font-ui); letter-spacing: -.01em; margin: 0 0 .4rem; color: var(--kmt-blue); }
[data-theme="dark"] .page-title { color: #9cc7ef; }
.page-title .n { color: var(--kmt-orange); margin-right: .45rem; }
[data-theme="dark"] .page-title .n { color: #e8955c; }
.page-lead { color: var(--text-2); margin: 0 0 1.5rem; }
.page-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 1.25rem; }

.on-this-page { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: .2rem .9rem; margin: 0 0 1.75rem; font-size: .9rem; }
.on-this-page summary { cursor: pointer; padding: .45rem 0; font-weight: 600; color: var(--text-2); }
.on-this-page ol { margin: 0 0 .6rem; padding-left: 0; list-style: none; columns: 2; column-gap: 1.5rem; }
.on-this-page li { break-inside: avoid; padding: .12rem 0; }
.on-this-page a { text-decoration: none; color: var(--text-2); }
.on-this-page a:hover { color: var(--accent); }

.content { font-family: var(--font-read); font-size: 1.065rem; line-height: 1.72; color: var(--text); max-width: var(--read-w); }
.content p { margin: 0 0 1em; hyphens: auto; }
.content h2, .content h3, .content h4 { font-family: var(--font-ui); color: var(--kmt-blue); position: relative; line-height: 1.3; }
[data-theme="dark"] .content h2, [data-theme="dark"] .content h3, [data-theme="dark"] .content h4 { color: #9cc7ef; }
.content h2 { font-size: 1.38rem; margin: 2.2em 0 .7em; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.content h3 { font-size: 1.12rem; margin: 1.8em 0 .6em; }
.content h4 { font-size: 1rem; margin: 1.5em 0 .5em; }
.h-anchor { position: absolute; left: -1.3em; padding-right: .3em; opacity: 0; text-decoration: none; color: var(--muted); font-weight: 400; transition: opacity .12s; }
.content h2:hover .h-anchor, .content h3:hover .h-anchor, .h-anchor:focus { opacity: 1; }
.content ul, .content ol { padding-left: 1.5em; margin: 0 0 1em; }
.content li { margin: .25em 0; }
.content li > p { margin: 0 0 .4em; }
.content strong { font-weight: 700; }
.content code { font-family: var(--font-mono); font-size: .86em; background: var(--surface-2); border: 1px solid var(--border); padding: .05em .35em; border-radius: 4px; }
.content blockquote { margin: 1em 0; padding: .2em 1em; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.content hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.content a.xref { text-decoration: none; border-bottom: 1px dotted currentColor; }
.content a.xref:hover { border-bottom-style: solid; }
.content a.xref-missing { color: var(--muted); border-bottom: 0; cursor: default; }
.bib-cite { white-space: nowrap; }
a.bib { text-decoration: none; color: var(--link); border-bottom: 1px dotted currentColor; }
a.bib:hover { border-bottom-style: solid; }
.sec-refs { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: .2rem .9rem; margin: 2rem 0 1.5rem; font-size: .9rem; }
.sec-refs summary { cursor: pointer; padding: .45rem 0; font-weight: 600; color: var(--text-2); }
.ref-list { list-style: none; margin: 0 0 .6rem; padding: 0; }
.ref-list li { display: grid; grid-template-columns: minmax(7.5rem, max-content) 1fr; column-gap: .9rem; padding: .4rem 0; border-top: 1px solid var(--border); scroll-margin-top: 4.5rem; }
.ref-list li:first-child { border-top: 0; }
.ref-key { font-family: var(--font-mono); font-size: .85em; color: var(--text-2); overflow-wrap: anywhere; }
.ref-key a { text-decoration: none; }
.ref-text { overflow-wrap: anywhere; }
.ref-where { grid-column: 2; font-size: .85em; color: var(--muted); margin-top: .15rem; }
.ref-where a { color: var(--muted); }
.ref-all li { font-size: .95rem; }
.content pre.bibtex { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: .8rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.content pre.bibtex code { background: none; border: 0; padding: 0; font-size: .85rem; }
@media (max-width: 560px) { .ref-list li { grid-template-columns: 1fr; } .ref-where { grid-column: 1; } }
.content img { max-width: 100%; height: auto; }
.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--kmt-orange) 22%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--kmt-orange) 22%, transparent); } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }

/* hình */
.figure { margin: 1.8em 0; text-align: center; }
.figure .fig-zoom { display: inline-block; background: #fff; padding: .9rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-1); max-width: 100%; cursor: zoom-in; }
.figure img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; }
.figure figcaption, .code-block figcaption { font: .9rem/1.5 var(--font-ui); color: var(--text-2); margin: .7em auto 0; max-width: 40rem; text-align: center; }
.fig-label { font-weight: 700; color: var(--kmt-blue); }
[data-theme="dark"] .fig-label { color: #9cc7ef; }

/* toán */
.math-display { display: block; overflow-x: auto; overflow-y: hidden; margin: 1em 0; padding: .1em 0; }
.content .katex { font-size: 1.08em; }
.katex-display { margin: .4em 0; }
.katex-display > .katex { white-space: nowrap; }

/* bảng */
.table-caption { font: .92rem/1.45 var(--font-ui); text-align: center; color: var(--text-2); margin: 1.6em 0 .5em !important; }
.table-caption strong { color: var(--kmt-blue); }
[data-theme="dark"] .table-caption strong { color: #9cc7ef; }
.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.table-wrap:focus-visible { outline-offset: 0; }
.content table, .as-msg table, .page .table-wrap table { border-collapse: collapse; width: 100%; font: .92rem/1.45 var(--font-ui); }
.content th, .content td, .as-msg th, .as-msg td, .page .table-wrap th, .page .table-wrap td { padding: .5rem .7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.content th, .as-msg th, .page .table-wrap th { background: var(--kmt-blue); color: #fff; font-weight: 600; border-bottom: 0; }
[data-theme="dark"] .content th, [data-theme="dark"] .as-msg th, [data-theme="dark"] .page .table-wrap th { background: #24476a; }
.content tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--kmt-blue-l) 40%, transparent); }
[data-theme="dark"] .content tbody tr:nth-child(even) td { background: rgba(110, 168, 220, .06); }
.content tbody tr:last-child td { border-bottom: 0; }

/* hộp đặc biệt */
.box { margin: 1.5em 0; border-radius: var(--radius-sm); border: 1px solid; border-left-width: 4px; overflow: hidden; font-size: .98em; }
.box-title { font: 700 .93rem/1.4 var(--font-ui); padding: .5rem .95rem; color: #fff; }
.box-body { padding: .8rem 1rem .2rem; }
.box-body > :last-child { margin-bottom: .8rem; }
.box .box { margin: 1em 0; }
.box-vidu { background: var(--box-vidu-bg); border-color: var(--box-vidu-bd); }
.box-vidu > .box-title { background: var(--box-vidu-bd); }
.box-luuy, .box-muctieu { background: var(--box-luuy-bg); border-color: var(--box-luuy-bd); }
.box-luuy > .box-title, .box-muctieu > .box-title { background: var(--box-luuy-bd); }
.box-lichsu { background: var(--box-lichsu-bg); border-color: var(--box-lichsu-bd); }
.box-lichsu > .box-title { background: var(--box-lichsu-bd); }
.box-loigiai { background: var(--box-loigiai-bg); border-color: var(--box-loigiai-bd); }
.box-loigiai > .box-title { background: var(--box-loigiai-bd); }
[data-theme="dark"] .box-title { color: #0e1319; }
.box .table-wrap { background: var(--surface); }

/* mã nguồn */
.code-block { margin: 1.4em 0; }
.code-block figcaption { margin: 0 0 .45em; text-align: left; max-width: none; font-weight: 600; }
.code-frame { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--code-bg); overflow: hidden; }
.code-bar { display: flex; align-items: center; justify-content: space-between; padding: .2rem .35rem .2rem .75rem; background: var(--code-bar); border-bottom: 1px solid var(--border); min-height: 32px; }
.code-lang { font: 600 .72rem var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.copy-code { border: 1px solid transparent; background: none; color: var(--text-2); font: 500 .78rem var(--font-ui); padding: .15rem .5rem; border-radius: 5px; cursor: pointer; }
.copy-code:hover { border-color: var(--border-strong); background: var(--surface); }
.code-frame pre { margin: 0; padding: .8rem 1rem; overflow-x: auto; font: .85rem/1.6 var(--font-mono); tab-size: 4; }
.code-frame code { font: inherit; background: none; border: 0; padding: 0; }

/* màu cú pháp (tự viết, theo bảng màu giáo trình) */
.hljs-comment, .hljs-quote { color: #6a737d; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag { color: #1F4E79; font-weight: 600; }
.hljs-built_in, .hljs-variable, .hljs-template-variable { color: #C55A11; }
.hljs-type, .hljs-class .hljs-title, .hljs-title.class_ { color: #6f42c1; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #005cc5; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #38761D; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #a0410d; }
.hljs-meta, .hljs-meta .hljs-keyword { color: #7a5c00; }
.hljs-params { color: inherit; }
.hljs-operator { color: #8a2c86; }
[data-theme="dark"] .hljs-comment { color: #7f8b99; }
[data-theme="dark"] .hljs-keyword, [data-theme="dark"] .hljs-literal { color: #79b8ff; }
[data-theme="dark"] .hljs-built_in, [data-theme="dark"] .hljs-variable { color: #f0a46b; }
[data-theme="dark"] .hljs-type, [data-theme="dark"] .hljs-title.class_ { color: #c4a5ff; }
[data-theme="dark"] .hljs-title, [data-theme="dark"] .hljs-title.function_ { color: #8fd0ff; }
[data-theme="dark"] .hljs-string { color: #9ad97f; }
[data-theme="dark"] .hljs-number, [data-theme="dark"] .hljs-symbol { color: #f5b97c; }
[data-theme="dark"] .hljs-meta { color: #e7c86a; }
[data-theme="dark"] .hljs-operator { color: #e39be0; }

/* điều hướng trước/sau */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.pager a { display: block; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; background: var(--surface); color: var(--text); transition: border-color .12s, box-shadow .12s; }
.pager a:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.pager small { display: block; color: var(--muted); font-size: .78rem; margin-bottom: .15rem; }
.pager .next { text-align: right; grid-column: 2; }
.pager span.t { font-weight: 600; font-size: .93rem; }

/* ------------------------------------------------------------------ trang chủ & thẻ */
.hero { padding: 1.5rem 0 1.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.75rem; }
.hero .eyebrow { font-size: .8rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--kmt-orange); }
[data-theme="dark"] .hero .eyebrow { color: #e8955c; }
.hero h1 { font: 800 2.3rem/1.15 var(--font-ui); margin: .35rem 0 .4rem; letter-spacing: -.02em; color: var(--kmt-blue); }
[data-theme="dark"] .hero h1 { color: #b3d4f3; }
.hero .subtitle { font: 1.15rem/1.5 var(--font-read); color: var(--text-2); margin: 0 0 1rem; font-style: italic; }
.hero .meta { color: var(--muted); font-size: .9rem; margin: 0 0 1.2rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.continue small { font-weight: 400; opacity: .85; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); transition: border-color .12s, box-shadow .12s, transform .12s; }
a.card:hover { border-color: var(--accent); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.card .n { font: 700 .78rem var(--font-ui); color: var(--kmt-orange); letter-spacing: .05em; text-transform: uppercase; }
[data-theme="dark"] .card .n { color: #e8955c; }
.card .t { font-weight: 680; line-height: 1.35; }
.card .d { color: var(--muted); font-size: .86rem; }
.section-h { font: 700 1.1rem var(--font-ui); margin: 2rem 0 .9rem; color: var(--text); }
.feature-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; margin: 0; padding: 0; list-style: none; }
.feature-list li { padding: .85rem 1rem; border-radius: var(--radius); background: var(--surface-2); font-size: .9rem; color: var(--text-2); }
.feature-list b { display: block; color: var(--text); margin-bottom: .15rem; }

/* chương */
.sec-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.sec-list li + li { border-top: 1px solid var(--border); }
.sec-list a { display: flex; gap: .8rem; padding: .75rem 1rem; text-decoration: none; color: var(--text); }
.sec-list a:hover { background: var(--surface-2); }
.sec-list .n { color: var(--accent); font-weight: 650; min-width: 2.5em; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ bài tập */
.ex-filter { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.25rem; }
.ex-filter button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ex-list { display: flex; flex-direction: column; gap: 1rem; margin: 0 0 2rem; padding: 0; list-style: none; }
.ex { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 1rem 1.15rem .6rem; }
.ex-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .45rem; }
.ex-num { font: 700 1rem var(--font-ui); color: var(--kmt-blue); }
[data-theme="dark"] .ex-num { color: #9cc7ef; }
.diff { font: 600 .72rem var(--font-ui); padding: .12rem .5rem; border-radius: 999px; letter-spacing: .02em; }
.diff-co-ban { background: var(--kmt-green-l); color: #285716; }
.diff-trung-binh { background: var(--kmt-blue-l); color: #1F4E79; }
.diff-nang-cao { background: var(--kmt-orange-l); color: #933f08; }
[data-theme="dark"] .diff-co-ban { background: #1b2c18; color: #9ad97f; }
[data-theme="dark"] .diff-trung-binh { background: #16293d; color: #8cc0f0; }
[data-theme="dark"] .diff-nang-cao { background: #33231a; color: #f0a46b; }
.ex-related { font-size: .82rem; color: var(--muted); margin-left: auto; }
.ex-related a { color: var(--muted); }
.ex .content { font-size: 1rem; }
.ex-actions { display: flex; flex-wrap: wrap; gap: .45rem; padding: .3rem 0 .5rem; }
.hints { margin: .25rem 0 .6rem; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.hints li { border-left: 3px solid var(--kmt-orange); background: var(--box-luuy-bg); padding: .45rem .8rem; border-radius: 0 6px 6px 0; font-size: .95rem; }
.hints li b { font-family: var(--font-ui); font-size: .82rem; color: var(--kmt-orange); margin-right: .35rem; }
[data-theme="dark"] .hints li b { color: #e8955c; }
.solution { margin: .4rem 0 .7rem; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2); }
.solution > summary { cursor: pointer; padding: .5rem .8rem; font: 600 .9rem var(--font-ui); color: var(--ok); }
.solution > div { padding: 0 .9rem .5rem; }
.review-q { margin: 0; padding-left: 1.6rem; }
.review-q > li { margin: 0 0 .8rem; }

/* thuật ngữ */
.gl-tools { display: flex; gap: .6rem; align-items: center; margin: 0 0 1rem; flex-wrap: wrap; }
.gl-tools input { flex: 1 1 260px; height: 40px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 .8rem; background: var(--surface); }
.gl-table td:first-child { font-weight: 600; }
.gl-table td.en { font-style: italic; color: var(--text-2); }
.gl-table td.abbr { font: 600 .85rem var(--font-mono); }
.gl-table .ask { white-space: nowrap; }
.gl-letter { font: 700 .8rem var(--font-ui); color: var(--muted); }

/* tìm kiếm */
.sr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.sr-item a.sr-link { display: block; padding: .85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); }
.sr-item a.sr-link:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.sr-cite { font: 700 .8rem var(--font-ui); color: var(--kmt-orange); margin-right: .4rem; }
[data-theme="dark"] .sr-cite { color: #e8955c; }
.sr-title { font-weight: 650; }
.sr-snip { display: block; margin-top: .3rem; color: var(--text-2); font-size: .9rem; line-height: 1.55; }
mark { background: var(--mark); color: inherit; padding: 0 .1em; border-radius: 2px; }
.empty { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* hướng dẫn */
.prose { max-width: var(--read-w); }
.prose h2 { font-size: 1.25rem; margin: 2rem 0 .6rem; color: var(--kmt-blue); }
[data-theme="dark"] .prose h2 { color: #9cc7ef; }
.prose p, .prose li { color: var(--text-2); }
.kbd-table td { padding: .3rem .8rem .3rem 0; }

/* ------------------------------------------------------------------ trợ giảng */
.assistant { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; border-left: 1px solid var(--border); background: var(--surface); min-width: 0; }
.as-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .6rem .5rem .95rem; border-bottom: 1px solid var(--border); gap: .5rem; }
.as-title { display: flex; align-items: center; gap: .5rem; min-width: 0; flex-wrap: wrap; }
.as-title h2 { font-size: 1rem; margin: 0; }
.as-head-actions { display: flex; gap: .1rem; }
.badge { font: 600 .72rem var(--font-ui); padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); cursor: pointer; white-space: nowrap; }
.badge-backend::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: .35rem; vertical-align: 1px; }
.badge-backend[data-backend="server"]::before, .badge-backend[data-backend="key"]::before { background: #2e9d4a; }
.badge-backend[data-backend="offline"] { background: var(--box-luuy-bg); border-color: var(--box-luuy-bd); color: var(--kmt-orange); }
[data-theme="dark"] .badge-backend[data-backend="offline"] { color: #f0a46b; }
.badge-backend[data-backend="offline"]::before { background: var(--kmt-orange); }
.as-modes { display: flex; gap: .3rem; padding: .55rem .75rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.as-modes button { flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: .28rem .7rem; font-size: .82rem; font-weight: 550; cursor: pointer; }
.as-modes button:hover { border-color: var(--accent); }
.as-modes button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.as-modes button.instructor { border-style: dashed; }
.as-log { flex: 1; overflow-y: auto; padding: .9rem .85rem 1rem; display: flex; flex-direction: column; gap: .85rem; overscroll-behavior: contain; }
.as-empty { color: var(--muted); font-size: .9rem; padding: .25rem .2rem; }
.as-empty h3 { color: var(--text); font-size: .95rem; margin: 0 0 .4rem; }
.as-empty ul { padding-left: 1.1rem; margin: .4rem 0 .8rem; }
.as-suggest { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.as-suggest button { text-align: left; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: .4rem .7rem; font-size: .85rem; cursor: pointer; color: var(--text); }
.as-suggest button:hover { border-color: var(--accent); }
.as-msg { font-size: .925rem; line-height: 1.6; word-wrap: break-word; }
.as-msg.user { align-self: flex-end; max-width: 88%; background: var(--accent-soft); color: var(--text); padding: .55rem .8rem; border-radius: 12px 12px 4px 12px; white-space: pre-wrap; }
.as-msg.user .quote { display: block; border-left: 3px solid var(--accent); padding-left: .5rem; margin-bottom: .35rem; color: var(--text-2); font-size: .85rem; white-space: normal; }
.as-msg.user .tag { display: block; font-size: .75rem; font-weight: 650; color: var(--accent); margin-bottom: .2rem; }
.as-msg.bot { align-self: stretch; }
.as-msg.bot .bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; padding: .65rem .85rem .35rem; }
.as-msg.bot .bubble > :first-child { margin-top: 0; }
.as-msg.bot p { margin: 0 0 .65em; }
.as-msg.bot h1, .as-msg.bot h2, .as-msg.bot h3, .as-msg.bot h4 { font-size: .95rem; margin: .8em 0 .4em; color: var(--text); }
.as-msg.bot ul, .as-msg.bot ol { padding-left: 1.25rem; margin: 0 0 .65em; }
.as-msg.bot code { font-family: var(--font-mono); font-size: .85em; background: var(--surface); border: 1px solid var(--border); padding: 0 .3em; border-radius: 4px; }
.as-msg.bot .code-frame code { border: 0; padding: 0; background: none; }
.as-msg.bot .code-frame pre { font-size: .8rem; padding: .6rem .75rem; }
.as-msg.bot .math-display { font-size: .95em; }
.as-msg.bot blockquote { margin: .5em 0; padding-left: .7em; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.as-msg .meta { display: flex; align-items: center; gap: .35rem; margin-top: .35rem; flex-wrap: wrap; }
.as-msg .meta .muted { font-size: .75rem; }
.as-msg.streaming .bubble::after { content: ""; display: inline-block; width: .5em; height: 1em; background: var(--accent); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.as-msg.error .bubble { border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.as-msg.error .err { color: var(--danger); font-weight: 600; }
.cite { display: inline-flex; align-items: center; font: 650 .76rem/1.2 var(--font-ui); background: var(--accent-soft); color: var(--accent); border-radius: 5px; padding: .1rem .38rem; margin: 0 .08rem; text-decoration: none; vertical-align: 1px; white-space: nowrap; }
a.cite:hover { background: var(--accent); color: var(--accent-ink); }
.cite-unknown { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); cursor: help; }
.sources { margin-top: .45rem; font-size: .8rem; }
.sources summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: .15rem 0; }
.sources ol { margin: .3rem 0 0; padding-left: 1.2rem; }
.sources li { margin: .15rem 0; }
.sources li a { text-decoration: none; }
.sources li.used a { font-weight: 650; }
.offline-note { font-size: .82rem; color: var(--kmt-orange); background: var(--box-luuy-bg); border: 1px solid color-mix(in srgb, var(--box-luuy-bd) 45%, transparent); border-radius: 8px; padding: .45rem .65rem; margin-bottom: .55rem; }
[data-theme="dark"] .offline-note { color: #f0a46b; }
.off-card { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: .55rem .7rem; margin: 0 0 .5rem; }
.off-card .h { display: flex; gap: .4rem; align-items: baseline; font-weight: 650; font-size: .87rem; }
.off-card .h a { text-decoration: none; color: var(--text); }
.off-card .s { font-size: .84rem; color: var(--text-2); margin-top: .2rem; line-height: 1.5; }
.as-compose { border-top: 1px solid var(--border); padding: .55rem .7rem .7rem; background: var(--surface); }
.as-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.as-chips:not(:empty) { margin-bottom: .45rem; }
.chip { display: inline-flex; align-items: center; gap: .25rem; max-width: 100%; font-size: .78rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .15rem .25rem .15rem .6rem; color: var(--text-2); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.chip button:hover { background: var(--border); color: var(--text); }
.chip button svg { width: 12px; height: 12px; }
.as-form textarea { width: 100%; resize: none; min-height: 46px; max-height: 180px; border: 1px solid var(--border-strong); border-radius: 10px; padding: .55rem .7rem; background: var(--surface); line-height: 1.45; }
.as-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.as-form-row { display: flex; align-items: center; gap: .5rem; margin-top: .4rem; }
.as-hint { font-size: .74rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-count { font-size: .74rem; font-variant-numeric: tabular-nums; }

/* nút bôi đen */
.ask-selection { position: fixed; z-index: 60; display: inline-flex; align-items: center; gap: .4rem; background: var(--kmt-blue); color: #fff; border: 0; border-radius: 8px; padding: .42rem .75rem; font: 600 .84rem var(--font-ui); box-shadow: var(--shadow-2); cursor: pointer; transform: translate(-50%, 0); }
.ask-selection svg { width: 16px; height: 16px; }
.ask-selection:hover { background: #173d60; }
[data-theme="dark"] .ask-selection { background: #2b5f91; }

/* hộp thoại */
.dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(480px, calc(100vw - 2rem)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); }
.dialog::backdrop { background: rgba(10, 16, 24, .45); backdrop-filter: blur(2px); }
.dialog-body { padding: 1.25rem 1.35rem 1.1rem; display: flex; flex-direction: column; gap: .55rem; }
.dialog h2 { margin: 0 0 .25rem; font-size: 1.15rem; }
.dialog label { font-weight: 600; font-size: .88rem; }
.dialog input[type="password"], .dialog input[type="text"], .dialog select { width: 100%; height: 40px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 .7rem; background: var(--surface); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .6rem; }
.choice { border: 0; padding: 0; margin: 0 0 .3rem; display: flex; flex-direction: column; gap: .4rem; }
.choice legend { font-weight: 650; font-size: .9rem; margin-bottom: .35rem; }
.choice-item { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--border); border-radius: 9px; padding: .55rem .7rem; cursor: pointer; font-weight: 400 !important; }
.choice-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-item:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.choice-item input { margin-top: .25rem; }
.choice-item small { display: block; color: var(--muted); font-size: .8rem; }
.warn-box { font-size: .8rem; background: var(--box-luuy-bg); border-left: 3px solid var(--box-luuy-bd); padding: .5rem .65rem; border-radius: 0 6px 6px 0; margin: .2rem 0; color: var(--text-2); }
.form-error { color: var(--danger); font-size: .86rem; margin: 0; }
.key-fields { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.key-fields input { width: 100%; }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 90; background: #1d2530; color: #fff; padding: .55rem 1rem; border-radius: 8px; font-size: .88rem; box-shadow: var(--shadow-2); }
[data-theme="dark"] .toast { background: #e3e8ef; color: #0e1319; }
.scrim { position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(10, 16, 24, .4); z-index: 44; }
.noscript { padding: 2rem; text-align: center; }

/* ------------------------------------------------------------------ đáp ứng */
@media (max-width: 1280px) {
  :root { --sidebar-w: 260px; --assistant-w: 360px; }
  .page { padding: 1.75rem 1.5rem 4rem; }
}
@media (max-width: 1100px) {
  .layout, .layout.as-collapsed { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .assistant { position: fixed; top: var(--topbar-h); right: 0; bottom: 0; height: auto; width: min(420px, 100vw); z-index: 45; box-shadow: var(--shadow-2); transform: translateX(100%); transition: transform .2s ease; visibility: hidden; }
  .layout .assistant, .layout.as-collapsed .assistant { display: flex; }
  body.as-open .assistant { transform: none; visibility: visible; }
  .top-links { display: none; }
}
@media (max-width: 820px) {
  :root { --topbar-h: 54px; }
  .only-narrow { display: inline-grid; }
  .layout, .layout.as-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; height: auto; width: min(320px, 88vw); z-index: 46; transform: translateX(-100%); transition: transform .2s ease; visibility: hidden; box-shadow: var(--shadow-2); }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  .brand-text { display: none; }
  .search { flex: 1 1 auto; max-width: none; }
  .search-kbd { display: none; }
  .btn-assistant .label { display: none; }
  .btn-assistant { padding: .5rem .6rem; }
  .page { padding: 1.25rem 1rem 4rem; }
  .page-title { font-size: 1.5rem; }
  .hero h1 { font-size: 1.75rem; }
  .content { font-size: 1.02rem; }
  .on-this-page ol { columns: 1; }
  .h-anchor { display: none; }
  .assistant { width: 100vw; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .ex-related { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------ in */
@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; }
  .topbar, .sidebar, .assistant, .scrim, .ask-selection, .pager, .page-tools, .on-this-page, .h-anchor, .copy-code, .toast, .ex-actions, .skip-link { display: none !important; }
  .layout { display: block; }
  .page { max-width: none; padding: 0; }
  body { background: #fff; font-size: 11pt; }
  .content { max-width: none; font-size: 11pt; }
  .box, .content th, .box-title, .figure .fig-zoom { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .box, .figure, .code-block, .table-wrap, .math-display { break-inside: avoid; }
  .content h2, .content h3 { break-after: avoid; }
  a { color: inherit; text-decoration: none; }
  .figure .fig-zoom { box-shadow: none; }
  .code-frame pre { white-space: pre-wrap; }
}

/* tiêu điểm do chương trình đặt (chuyển trang, nhảy neo) — không vẽ khung */
[tabindex="-1"]:focus { outline: none; }
.box { border-color: color-mix(in srgb, var(--bd, currentColor) 35%, transparent); }
.box-vidu { --bd: var(--box-vidu-bd); border-left-color: var(--box-vidu-bd); }
.box-luuy, .box-muctieu { --bd: var(--box-luuy-bd); border-left-color: var(--box-luuy-bd); }
.box-lichsu { --bd: var(--box-lichsu-bd); border-left-color: var(--box-lichsu-bd); }
.box-loigiai { --bd: var(--box-loigiai-bd); border-left-color: var(--box-loigiai-bd); }
.page-title { margin-bottom: .6rem; }
.top-stat { text-decoration: none; font-weight: 600; font-size: .88rem; color: var(--ok); padding: .35rem .55rem; border-radius: 7px; }
.top-stat:hover { background: var(--surface-2); }
.dialog input[type="text"] { width: 100%; }

/* từ chối, điểm ôn tập */
.refusal-note { font: 600 .74rem var(--font-ui); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .35rem; }
.as-msg.refusal .bubble { border-style: dashed; }
.quiz-score { font: 650 .78rem var(--font-ui); color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); padding: .12rem .5rem; border-radius: 999px; }
.sources li::marker { color: var(--muted); font-weight: 600; }

/* thống kê */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin: 1rem 0 .5rem; }
.kpi { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.kpi .v { font: 750 1.6rem/1.1 var(--font-ui); color: var(--kmt-blue); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .kpi .v { color: #9cc7ef; }
.kpi .l { font-size: .8rem; color: var(--muted); }
.chart-days { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.chart-days .day { flex: 0 1 26px; height: 100%; display: flex; align-items: flex-end; }
.chart-days .day span { display: block; width: 100%; background: var(--kmt-blue); border-radius: 3px 3px 0 0; min-height: 2px; }
[data-theme="dark"] .chart-days .day span { background: #5d9ad3; }
.ex-filter a[aria-current="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ex-filter a { text-decoration: none; }

.page .table-wrap tbody tr:last-child td { border-bottom: 0; }
.page .table-wrap td { font-variant-numeric: tabular-nums; }
