/* F&B THỰC CHIẾN — hệ thiết kế: thư viện ẩm thực cao cấp + bảng điều hành */
:root {
  --bg: #F6F1E7; --bg-2: #EEE6D6; --surface: #FFFDF8; --surface-2: #FAF5EB; --line: #E3D8C4; --line-2: #D5C7AE;
  --text: #29251F; --text-2: #5B5247; --muted: #857A6B;
  --brand: #2F5D50; --brand-2: #3D7363; --brand-ink: #FFFDF8; --brand-soft: #DCE8DF;
  --coffee: #6B4A35; --coffee-soft: #EFE1D3;
  --blush: #F3DFD7; --butter: #F5EBCC; --sky: #DCE6EE; --lilac: #E7E1EF; --sage: #E1EBDD;
  --ok: #2B7A57; --ok-soft: #DDEFE4; --warn: #94650E; --warn-soft: #F7EBCD; --bad: #A13A31; --bad-soft: #F6DED9;
  --focus: #1F6FB2;
  --shadow: 0 1px 2px rgba(60, 45, 25, .06), 0 6px 18px rgba(60, 45, 25, .06);
  --radius: 16px; --radius-s: 10px;
  --serif: "Times New Roman", Times, "Liberation Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fs: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131210; --bg-2: #1A1815; --surface: #1F1C18; --surface-2: #25221D; --line: #37322A; --line-2: #4A4339;
    --text: #EFE8DC; --text-2: #CBC1B1; --muted: #9D9384;
    --brand: #8CC3AA; --brand-2: #A7D4BF; --brand-ink: #10221B; --brand-soft: #21352D;
    --coffee: #D4B79F; --coffee-soft: #3A2E25;
    --blush: #3A2925; --butter: #373020; --sky: #222E37; --lilac: #2C2835; --sage: #24302A;
    --ok: #7FCFA4; --ok-soft: #1E3428; --warn: #E2BD6C; --warn-soft: #382F1E; --bad: #F1958A; --bad-soft: #3D2421;
    --focus: #7DB8F0; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131210; --bg-2: #1A1815; --surface: #1F1C18; --surface-2: #25221D; --line: #37322A; --line-2: #4A4339;
  --text: #EFE8DC; --text-2: #CBC1B1; --muted: #9D9384;
  --brand: #8CC3AA; --brand-2: #A7D4BF; --brand-ink: #10221B; --brand-soft: #21352D;
  --coffee: #D4B79F; --coffee-soft: #3A2E25;
  --blush: #3A2925; --butter: #373020; --sky: #222E37; --lilac: #2C2835; --sage: #24302A;
  --ok: #7FCFA4; --ok-soft: #1E3428; --warn: #E2BD6C; --warn-soft: #382F1E; --bad: #F1958A; --bad-soft: #3D2421;
  --focus: #7DB8F0; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; font-size: var(--fs); scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--serif); line-height: 1.6; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }
img, svg { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-2); }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.25; margin: 0 0 .5em; color: var(--text); font-weight: 700; letter-spacing: -.005em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.45rem); }
h2 { font-size: clamp(1.32rem, 1.1rem + .9vw, 1.65rem); }
h3 { font-size: 1.16rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .86rem; }
.muted { color: var(--muted); }
.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; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--brand); color: var(--brand-ink); padding: 10px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { top: calc(8px + var(--safe-t)); }

/* ---------- Khung ---------- */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100dvh; }
.col { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) calc(14px + var(--safe-r)) 8px calc(14px + var(--safe-l));
  background: color-mix(in srgb, var(--bg) 92%, transparent); border-bottom: 1px solid var(--line); }
.topbar .brand { flex: 1; min-width: 0; }
.iconbtn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.iconbtn svg { width: 22px; height: 22px; }
.sidebar { display: none; }
main { padding: 18px calc(16px + var(--safe-r)) calc(var(--nav-h) + 36px + var(--safe-b)) calc(16px + var(--safe-l)); width: 100%; max-width: 1180px; margin: 0 auto; min-width: 0; }
main:focus { outline: none; }
.bottomnav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 4px calc(4px + var(--safe-r)) calc(4px + var(--safe-b)) calc(4px + var(--safe-l)); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; color: var(--muted); text-decoration: none; font-size: .74rem; border-radius: 12px; font-family: var(--sans); }
.bottomnav a svg { width: 23px; height: 23px; }
.bottomnav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); font-weight: 600; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand .mark { width: 40px; height: 40px; flex: none; }
.brand .word { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand .word b { font-size: 1.02rem; letter-spacing: .08em; white-space: nowrap; }
.brand .word span { font-size: .68rem; color: var(--muted); letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 260px minmax(0, 1fr); }
  .topbar { display: none; }
  .bottomnav { display: none; }
  .sidebar { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100dvh; padding: 22px 14px 18px calc(14px + var(--safe-l)); border-right: 1px solid var(--line); background: var(--surface-2); overflow-y: auto; }
  .sidebar .brand { padding: 4px 8px 18px; }
  .sidebar .brand .mark { width: 48px; height: 48px; }
  .sidebar .brand .word b { font-size: .98rem; letter-spacing: .04em; }
  .sidebar .brand .word span { white-space: normal; line-height: 1.3; margin-top: 3px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 4px; }
  .sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none; color: var(--text-2); font-size: 1.02rem; }
  .sidebar nav a svg { width: 21px; height: 21px; flex: none; }
  .sidebar nav a:hover { background: var(--bg-2); color: var(--text); }
  .sidebar nav a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
  .sidebar .side-foot { margin-top: auto; font-size: .8rem; color: var(--muted); padding: 12px 8px 0; border-top: 1px solid var(--line); }
  main { padding: 30px 36px 48px; }
}

.netbar { display: none; position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); top: calc(8px + var(--safe-t)); background: var(--warn-soft); color: var(--warn); border: 1px solid var(--line-2); padding: 6px 14px; border-radius: 99px; font-family: var(--sans); font-size: .8rem; }
.netbar.show { display: block; }
.storebar { margin: 0 0 14px; }

/* ---------- Thành phần ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card.tint-sage { background: var(--sage); } .card.tint-blush { background: var(--blush); } .card.tint-butter { background: var(--butter); } .card.tint-sky { background: var(--sky); } .card.tint-lilac { background: var(--lilac); }
.card > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.section { margin: 30px 0 14px; }
.eyebrow { font-family: var(--sans); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.lead { font-size: 1.08rem; color: var(--text-2); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 600 .95rem/1.2 var(--sans); cursor: pointer; text-decoration: none; touch-action: manipulation; }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); color: var(--brand-ink); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .86rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn.on { background: var(--butter); border-color: var(--warn); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--bg-2); color: var(--text-2); font: 500 .76rem/1.5 var(--sans); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.brand { background: var(--brand-soft); color: var(--brand); } .chip.coffee { background: var(--coffee-soft); color: var(--coffee); }
a.chip { text-decoration: none; white-space: normal; text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.progress { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: inherit; transition: width .6s ease; }
.ring { --p: 0; width: 92px; height: 92px; flex: none; }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--bg-2); }
.ring .val { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.3,.7,.2,1); transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring text { font: 700 19px var(--serif); fill: var(--text); }

/* Form */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label { font: 600 .9rem/1.3 var(--sans); color: var(--text-2); }
.field .hint { font: .78rem/1.35 var(--sans); color: var(--muted); }
.field .err { font: 600 .8rem/1.35 var(--sans); color: var(--bad); }
.field .interp { font: .78rem/1.3 var(--sans); color: var(--brand); min-height: 1em; }
input[type="text"], input[type="date"], input[type="month"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 1rem/1.35 var(--sans); }
textarea { font-family: var(--serif); font-size: 1rem; line-height: 1.55; resize: vertical; min-height: 120px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-soft); }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 2px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 0; }
.input-unit { position: relative; display: flex; align-items: stretch; }
.input-unit input { padding-right: 58px; }
.input-unit .unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: .8rem var(--sans); color: var(--muted); pointer-events: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0 0 14px; min-width: 0; background: var(--surface); }
legend { font: 700 1rem var(--serif); padding: 0 6px; color: var(--coffee); }
.fgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; flex-wrap: wrap; }
.seg button { min-height: 42px; padding: 6px 14px; border: 0; background: var(--surface); color: var(--text-2); font: 600 .86rem var(--sans); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.seg button + button { border-left: 1px solid var(--line-2); }

/* Bảng */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); max-width: 100%; }
table { border-collapse: collapse; width: 100%; font: .9rem/1.4 var(--sans); }
caption { caption-side: top; text-align: left; padding: 10px 12px 4px; font: 600 .86rem var(--sans); color: var(--text-2); }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--surface-2); font-weight: 700; color: var(--text-2); position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; background: var(--surface-2); }
tr.neg td.num.cl, td.neg { color: var(--bad); }
tbody tr:last-child td { border-bottom: 0; }
.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }

/* Callout */
.callout { border-radius: var(--radius-s); padding: 12px 14px 12px 46px; position: relative; margin: 0 0 1em; background: var(--surface-2); border: 1px solid var(--line); }
.callout::before { content: ""; position: absolute; left: 14px; top: 14px; width: 20px; height: 20px; border-radius: 50%; background: currentColor; opacity: .9; -webkit-mask: var(--ico) center/contain no-repeat; mask: var(--ico) center/contain no-repeat; }
.callout > b:first-child { display: block; margin-bottom: 2px; }
.callout p:last-child { margin: 0; }
.callout.tip { background: var(--sage); color: var(--text); } .callout.tip::before { color: var(--ok); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 21h6v-1H9v1zm3-19a7 7 0 0 0-4 12.7V17h8v-2.3A7 7 0 0 0 12 2z'/%3E%3C/svg%3E"); }
.callout.warn { background: var(--warn-soft); } .callout.warn::before { color: var(--warn); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z'/%3E%3C/svg%3E"); }
.callout.note { background: var(--sky); } .callout.note::before { color: var(--focus); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E"); }
.callout.myth { background: var(--blush); } .callout.myth::before { color: var(--bad); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm5 13.6L15.6 17 12 13.4 8.4 17 7 15.6 10.6 12 7 8.4 8.4 7 12 10.6 15.6 7 17 8.4 13.4 12 17 15.6z'/%3E%3C/svg%3E"); }
.callout.assumed { background: var(--butter); } .callout.assumed::before { color: var(--coffee); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.2V21h3.8L17.8 9.9l-3.7-3.7L3 17.2zM20.7 7a1 1 0 0 0 0-1.4l-2.3-2.3a1 1 0 0 0-1.4 0l-1.8 1.8 3.7 3.7L20.7 7z'/%3E%3C/svg%3E"); }

.formula { border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 var(--radius-s) var(--radius-s) 0; padding: 12px 16px; margin: 0 0 1em; }
.formula .expr { font: 600 1.02rem/1.5 var(--sans); color: var(--text); overflow-wrap: anywhere; }
.formula ul { margin: 6px 0 0; padding-left: 18px; font-size: .92rem; color: var(--text-2); }

.figure { margin: 6px 0 18px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); padding: 10px; overflow: hidden; }
.figure svg { display: block; width: 100%; height: auto; }
.figure figcaption { font: .82rem/1.45 var(--sans); color: var(--muted); padding: 8px 4px 2px; }

/* Học */
.lesson-layout { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1200px) { .lesson-layout { grid-template-columns: minmax(0, 1fr) 270px; } .toc { position: sticky; top: 22px; align-self: start; max-height: calc(100dvh - 44px); overflow: auto; } }
.prose { max-width: 72ch; font-size: 1.04rem; }
.prose h2 { margin-top: 1.6em; padding-top: .2em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin: .25em 0; }
.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: t; }
.toc li a { display: block; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--text-2); font-size: .92rem; }
.toc li a:hover { background: var(--bg-2); }
.toc details summary { cursor: pointer; font: 600 .95rem var(--sans); min-height: 44px; display: flex; align-items: center; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { position: relative; padding: 0 0 16px 50px; counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font: 700 .95rem var(--sans); }
.steps li::after { content: ""; position: absolute; left: 16px; top: 36px; bottom: 2px; width: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps b { display: block; }
.mistake { display: grid; gap: 4px; border-left: 4px solid var(--bad); }
.quiz-q { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.quiz-q + .quiz-q { margin-top: 14px; }
.quiz-q .prompt { font-weight: 700; margin-bottom: 10px; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: 1rem/1.45 var(--serif); cursor: pointer; }
.opt .k { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); font: 700 .85rem var(--sans); }
.opt:hover:not([disabled]) { border-color: var(--brand); }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.correct .k { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }
.opt-note { font: .86rem/1.45 var(--sans); color: var(--text-2); margin: -2px 0 2px 40px; }
.feedback { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: .97rem; }
.feedback.ok { background: var(--ok-soft); } .feedback.bad { background: var(--bad-soft); }
.lesson-actions { position: sticky; bottom: calc(var(--nav-h) + 8px + var(--safe-b)); z-index: 20; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 8px; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); margin-top: 26px; }
@media (min-width: 900px) { .lesson-actions { bottom: 14px; } }
.badge-status { display: inline-flex; gap: 6px; align-items: center; }
.lesson-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--text); height: 100%; }
.lesson-card:hover { border-color: var(--brand); color: var(--text); }
.lesson-card h3 { margin: 0; font-size: 1.08rem; }
.lesson-card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.lesson-card .num { font: 700 .78rem var(--sans); color: var(--coffee); letter-spacing: .08em; }
.done-mark { color: var(--ok); }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-plain > li:last-child { border-bottom: 0; }

/* Trang chủ */
.hero { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: center; background: linear-gradient(135deg, var(--sage), var(--butter)); border: 1px solid var(--line); border-radius: 22px; padding: 22px; overflow: hidden; position: relative; }
@media (min-width: 760px) { .hero { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); padding: 30px 34px; } }
.hero h1 { margin-bottom: .3em; }
.hero .art { max-width: 380px; justify-self: center; width: 100%; }
.journey { text-align: left; cursor: pointer; border: 2px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-family: var(--serif); color: var(--text); }
.journey[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.journey .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); }
.journey .ico svg { width: 26px; height: 26px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font: 700 1.5rem var(--serif); }
.stat span { font: .8rem var(--sans); color: var(--muted); }

/* Công cụ */
.tool-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .tool-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .tool-layout .results { position: sticky; top: 18px; } }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.kpi .l { font: .78rem/1.3 var(--sans); color: var(--muted); }
.kpi .v { font: 700 1.25rem/1.25 var(--sans); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi.good { background: var(--ok-soft); } .kpi.bad { background: var(--bad-soft); } .kpi.key { background: var(--brand-soft); }
.kpi .sym { font-weight: 700; margin-right: 4px; }
.ing-row { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); padding: 12px; border: 1px dashed var(--line-2); border-radius: 12px; margin-bottom: 10px; background: var(--surface-2); }
.ing-row .wide { grid-column: 1 / -1; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 11px var(--sans); fill: var(--muted); }
.chart .grid line { stroke: var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font: .82rem var(--sans); color: var(--text-2); }
.legend i { display: inline-block; width: 22px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.banner-case { background: var(--butter); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 14px; font: .9rem/1.45 var(--sans); }

/* Checklist */
.task { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.task + .task { margin-top: 8px; }
.task.done { background: var(--ok-soft); }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.task.overdue { border-color: var(--bad); }
.task .t-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.statusbtn { min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.statusbtn svg { width: 22px; height: 22px; }
.task.done .statusbtn { background: var(--ok); color: #fff; border-color: var(--ok); }
.task.doing .statusbtn { background: var(--butter); color: var(--warn); }

/* Thư viện */
.term { padding: 14px 0; border-bottom: 1px solid var(--line); }
.term:target { background: var(--butter); border-radius: 10px; padding: 14px; }
.term dt { font-weight: 700; font-size: 1.05rem; }
.term dd { margin: 4px 0 0; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: thin; }
.tabs a { white-space: nowrap; padding: 9px 14px; border-radius: 99px; border: 1px solid var(--line-2); text-decoration: none; color: var(--text-2); font: 600 .86rem var(--sans); min-height: 42px; display: inline-flex; align-items: center; }
.tabs a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* Hộp thoại & thông báo */
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 28px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20, 16, 10, .45); }
dialog .dlg { padding: 20px; }
dialog .dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 0 20px 20px; }
.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; font: .92rem/1.4 var(--sans); box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.toast button { margin-left: auto; background: transparent; color: inherit; border: 1px solid currentColor; border-radius: 8px; padding: 6px 10px; font: 600 .85rem var(--sans); cursor: pointer; min-height: 36px; }
.toast.bad { background: var(--bad); color: #fff; }

footer.foot { margin-top: 44px; padding: 18px 0 6px; border-top: 1px solid var(--line); font: .84rem/1.6 var(--sans); color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; }
footer.foot a { color: var(--text-2); }

.empty { text-align: center; padding: 26px 16px; color: var(--muted); }
.empty svg { width: 120px; height: auto; margin: 0 auto 8px; display: block; opacity: .9; }

/* ---------- Logo & hiệu ứng ---------- */
.logo-mark .steam { transform-box: fill-box; transform-origin: 50% 100%; }
.logo-mark .cup { transform-box: fill-box; transform-origin: 50% 90%; }
:root:not([data-motion="off"]) .logo-mark .steam { animation: steam 3.6s ease-in-out infinite; }
:root:not([data-motion="off"]) .logo-mark .steam.s2 { animation-delay: 1.2s; }
:root:not([data-motion="off"]) .logo-mark .steam.s3 { animation-delay: 2.4s; }
:root:not([data-motion="off"]) .logo-mark .leaf { transform-box: fill-box; transform-origin: 0% 100%; animation: leaf 6s ease-in-out infinite; }
:root:not([data-motion="off"]) .brand:hover .logo-mark .cup { animation: tilt .8s ease-in-out; }
@keyframes steam { 0% { transform: translateY(3px) scaleY(.7); opacity: 0; } 30% { opacity: .95; } 70% { opacity: .6; } 100% { transform: translateY(-5px) scaleY(1.05); opacity: 0; } }
@keyframes leaf { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-7deg); } }
@keyframes tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-8deg); } 65% { transform: rotate(5deg); } }
:root:not([data-motion="off"]) .intro .logo-mark .ring-draw { stroke-dasharray: 260; stroke-dashoffset: 260; animation: draw 1.4s .1s cubic-bezier(.4,.1,.2,1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

:root:not([data-motion="off"]) .view-enter { animation: viewIn .32s cubic-bezier(.2,.7,.2,1) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
:root:not([data-motion="off"]) .rise > * { animation: viewIn .45s cubic-bezier(.2,.7,.2,1) both; }
:root:not([data-motion="off"]) .rise > *:nth-child(2) { animation-delay: .05s; } :root:not([data-motion="off"]) .rise > *:nth-child(3) { animation-delay: .1s; }
:root:not([data-motion="off"]) .rise > *:nth-child(4) { animation-delay: .15s; } :root:not([data-motion="off"]) .rise > *:nth-child(n+5) { animation-delay: .2s; }
:root:not([data-motion="off"]) .card.hover-lift { transition: transform .2s ease, border-color .2s ease; }
@media (hover: hover) { :root:not([data-motion="off"]) .card.hover-lift:hover { transform: translateY(-3px); } }
:root:not([data-motion="off"]) .pop { animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
:root:not([data-motion="off"]) .stamp { animation: stamp .7s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes stamp { 0% { transform: scale(1.8) rotate(-12deg); opacity: 0; } 60% { transform: scale(.94) rotate(-4deg); opacity: 1; } 100% { transform: scale(1) rotate(-4deg); } }
:root:not([data-motion="off"]) .art .float { transform-box: fill-box; animation: floaty 7s ease-in-out infinite; }
:root:not([data-motion="off"]) .art .float.d2 { animation-delay: -3.5s; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
:root:not([data-motion="off"]) .art .steam { transform-box: fill-box; transform-origin: 50% 100%; animation: steam 4s ease-in-out infinite; }
:root:not([data-motion="off"]) .art .steam.s2 { animation-delay: 1.3s; } :root:not([data-motion="off"]) .art .steam.s3 { animation-delay: 2.6s; }
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { transition-duration: 0s !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: 0s !important; scroll-behavior: auto !important; } }

/* ---------- In ---------- */
.print-only { display: none; }
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --text-2: #222; --muted: #444; --line: #bbb; color-scheme: light; }
  body { background: #fff; font-size: 11.5pt; }
  .sidebar, .topbar, .bottomnav, .lesson-actions, .no-print, .toasts, .netbar, footer.foot, .tabs, .btn, button { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; border-color: #bbb; }
  .print-only { display: block; }
  a { color: #000; text-decoration: none; }
  .tablewrap { overflow: visible; border: 0; }
  thead th { position: static; }
  .tool-layout { display: block; }
  h1 { font-size: 20pt; } h2 { font-size: 14pt; }
  @page { margin: 14mm; }
}

/* Thanh thao tác bài học gọn một hàng trên điện thoại */
@media (max-width: 600px) {
  .lesson-actions { flex-wrap: nowrap; gap: 6px; padding: 6px; }
  .lesson-actions .btn { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; padding: 6px 4px; min-height: 54px; font-size: .72rem; line-height: 1.15; text-align: center; }
  .lesson-actions .btn svg { width: 20px; height: 20px; }
}
/* Mục thu gọn có dấu chỉ hướng */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "▾"; margin-left: auto; padding-left: 12px; color: var(--muted); font-size: 1.1em; }
details[open] > summary::after { content: "▴"; }
