/* ============ Sổ Tay Vào Bếp — Tiệm Bánh Retro ============ */
/* Vintage Saigon bakery: cream ground, brick + mint + mustard, solid ink
   borders with hard offset shadows, ticket-stub cards, stamp chips.
   Functional class names match app.js — restyle, don't rename. */

/* ---------- fonts (all local, offline) ---------- */
@font-face { font-family: 'Baloo 2'; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/baloo-700-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Baloo 2'; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/baloo-700-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/bevietnam-400-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/bevietnam-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fonts/bevietnam-600-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fonts/bevietnam-600-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'MS Rounded'; font-display: block; /* never flash raw ligature names */
  src: url(fonts/material-symbols-rounded.woff2?v=61b88106) format('woff2'); }

/* material symbols: outline at rest, FILL on hover/active */
.ms { font-family: 'MS Rounded'; font-weight: normal; font-style: normal; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap;
  direction: ltr; -webkit-font-smoothing: antialiased; font-size: 20px; vertical-align: -4px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  transition: font-variation-settings .25s ease; }
.ms.filled, .fill-h:hover > .ms, .fill-h:hover .ms, a:hover > .ms, button:hover > .ms,
.active > .ms, .on > .ms { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ---------- tokens ---------- */
:root {
  --bg: #f7ecd4;
  --surface: #fdf6e5;
  --surface-2: #f1e2c2;
  --ink: #47311f;
  --ink-2: #6f5136;
  --ink-3: #7d5f42;         /* ≥4.5:1 on --bg (WCAG AA for the small hint text) */
  --accent: #bf4a33;          /* brick */
  --accent-deep: #96351f;
  --accent-soft: #f3d9c8;
  --mint: #79b9a4;
  --mint-deep: #23443a;
  --mint-soft: #ddeee7;
  --mustard: #dda32f;
  --mustard-soft: #f4e3b7;
  --line: #47311f;            /* borders are ink in this world */
  --line-soft: #d9c49b;
  --good: #3d7a52;
  --good-soft: #dcecdf;
  --radius: 12px;
  --radius-sm: 8px;
  --hard: 4px 4px 0 rgba(71, 49, 31, .22);
  --hard-lg: 7px 7px 0 rgba(71, 49, 31, .26);
  --font-display: 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Be Vietnam Pro', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: .18s; }
::view-transition-new(root) { animation-duration: .25s; }

body { background: var(--bg); color: var(--ink); font-family: var(--font-body);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(rgba(71, 49, 31, .045) 1px, transparent 1.2px);
  background-size: 22px 22px; }
::selection { background: var(--mustard-soft); color: var(--accent-deep); }
img { max-width: 100%; display: block; }
a { color: var(--accent-deep); text-decoration: none; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; }
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- header: the awning ---------- */
.site-head { position: sticky; top: 0; z-index: 50; background: var(--bg); }
.site-head::before { content: ''; display: block; height: 14px;
  background: repeating-linear-gradient(90deg, var(--mint) 0 42px, var(--surface) 42px 84px); }
.site-head::after { content: ''; position: absolute; left: 0; right: 0; top: 14px; height: 10px;
  pointer-events: none; z-index: 51;
  background: radial-gradient(circle 21px at 21px 0, var(--mint) 0 9.5px, transparent 10.5px) 0 0 / 84px 10px,
              radial-gradient(circle 21px at 21px 0, var(--surface) 0 9.5px, transparent 10.5px) 42px 0 / 84px 10px; }
.head-inner { display: flex; align-items: center; gap: 26px; height: 64px;
  border-bottom: 2px solid var(--line); }
.site-head.scrolled .head-inner { background: var(--bg); }
.brand { display: flex; align-items: center; flex-shrink: 0; }
.brand img.logo { width: 40px; height: 40px; display: block;
  filter: drop-shadow(2px 2px 0 var(--mustard-soft));
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1); }
.brand:hover img.logo { transform: rotate(-10deg) scale(1.15); }
.head-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1;
  /* room for the hover translate + hard shadow inside this scroll container */
  padding: 3px 4px 5px; margin: -3px -4px -5px; }
.head-nav::-webkit-scrollbar { display: none; }
.head-nav a { position: relative; padding: 5px 12px; border: 1.5px solid transparent;
  border-radius: 8px; color: var(--ink-2); font-size: .9rem; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; transition: all .18s; }
.head-nav a .ms { font-size: 17px; vertical-align: -3px; }
.head-nav a:hover { border-color: var(--line); background: var(--surface);
  box-shadow: 2px 2px 0 rgba(71, 49, 31, .22); transform: translate(-1px, -1px); color: var(--ink); }
.head-nav a.active { border-color: var(--line); background: var(--mustard-soft); color: var(--accent-deep); }

/* ---------- hero ---------- */
/* longhand only: .hero shares the element with .container, whose 24px side
   padding must survive (a `padding:` shorthand here would zero it out) */
.hero { position: relative; padding-top: 56px; padding-bottom: 36px; overflow: hidden; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.06; letter-spacing: .01em;
  color: var(--accent); text-shadow: 3px 3px 0 var(--mustard-soft); max-width: 700px; }
.hero .sub { margin-top: 14px; color: var(--ink-2); font-size: 1.04rem; max-width: 620px; }
.est-tag { display: inline-block; background: var(--ink); color: var(--bg); font-size: .74rem;
  font-weight: 700; padding: 4px 14px; border-radius: 3px; letter-spacing: .22em;
  text-transform: uppercase; margin-top: 14px; }
.amb { position: absolute; pointer-events: none; user-select: none; opacity: .12; }
.amb img { width: 100%; height: 100%; }
.burst { position: absolute; width: 104px; height: 104px; display: grid; place-items: center;
  background: var(--mustard); z-index: 2;
  clip-path: polygon(50% 0, 61% 12%, 76% 6%, 79% 22%, 95% 24%, 89% 39%, 100% 50%, 89% 61%, 95% 76%, 79% 78%, 76% 94%, 61% 88%, 50% 100%, 39% 88%, 24% 94%, 21% 78%, 5% 76%, 11% 61%, 0 50%, 11% 39%, 5% 24%, 21% 22%, 24% 6%, 39% 12%);
  animation: burstPulse 6s ease-in-out infinite; }
.burst span { font-family: var(--font-display); color: var(--ink); font-size: .8rem;
  transform: rotate(-10deg); text-align: center; line-height: 1.15; padding: 0 14px; }
@keyframes burstPulse { 0%, 100% { transform: rotate(6deg) scale(1); } 50% { transform: rotate(13deg) scale(1.06); } }

/* ---------- stat tiles ---------- */
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.stat { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 18px; min-width: 122px; box-shadow: var(--hard); display: flex; gap: 12px; align-items: center; }
.stat .ms { color: var(--accent); font-size: 26px; }
.stat .label { font-size: .74rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.4rem; font-weight: 700; font-family: var(--font-display);
  font-variant-numeric: tabular-nums; line-height: 1.15; }

/* ---------- reveal (scoped to .js so content stays visible if JS fails) ---------- */
.js .reveal { opacity: 0; transform: translateY(20px); }
.js .reveal.in { opacity: 1; transform: none;
  transition: opacity .55s ease, transform .55s cubic-bezier(.22, .8, .36, 1);
  transition-delay: var(--d, 0s); }

/* ---------- cards = tickets ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--hard); display: flex; flex-direction: column; position: relative;
  transition: transform .25s cubic-bezier(.22, .8, .36, 1), box-shadow .25s;
  transform-style: preserve-3d; }
.card:hover { transform: translate(-3px, -3px); box-shadow: var(--hard-lg); }
.card-cover { aspect-ratio: 16/9; overflow: hidden; background: var(--surface-2);
  border-bottom: 2px solid var(--line); border-radius: 10px 10px 0 0; }
.card-cover img { width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.22, .8, .36, 1); }
.card:hover .card-cover img { transform: scale(1.05); }
.card-cover .cover-emoji { display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 4rem; background: repeating-linear-gradient(135deg, var(--mint-soft) 0 26px, var(--surface) 26px 52px); }
.card-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.card-body h3 { font-size: 1.12rem; line-height: 1.3; }
.card-body h3 a { color: var(--ink); }
.card-body h3 a::after { content: ''; position: absolute; inset: 0; }
.card .meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; color: var(--ink-3); font-size: .85rem; }
.card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* continue-learning button (filled by app.js from saved progress) */
.card-continue { align-self: flex-start; position: relative; z-index: 2; max-width: 100%; }
.card-continue .cont-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* ticket variant: stub + perforation + punched notches */
.card.ticket { padding-left: 64px; }
.card.ticket::before, .card.ticket::after { content: ''; position: absolute; width: 16px; height: 16px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--line); top: 50%; z-index: 1; }
.card.ticket::before { left: -9px; transform: translateY(-50%); }
.card.ticket::after { right: -9px; transform: translateY(-50%); }
.card.ticket .lnum { position: absolute; left: 0; top: 0; bottom: 0; width: 56px;
  border-right: 2px dashed var(--line); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.15rem; color: var(--accent); background: none;
  border-radius: 10px 0 0 10px; min-width: 0; height: auto; padding: 0; }
.card.ticket .badge-ill { position: absolute; right: 12px; top: -18px; width: 52px; height: 52px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line); padding: 8px;
  box-shadow: 2px 2px 0 rgba(71, 49, 31, .22); z-index: 2;
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.card.ticket:hover .badge-ill { transform: rotate(-8deg) scale(1.12); }
.card.ticket .badge-ill img { width: 100%; height: 100%; object-fit: contain; }
.lnum { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 42px;
  padding: 0 8px; border-radius: 10px; background: var(--mustard-soft); color: var(--accent-deep);
  font-family: var(--font-display); font-size: .95rem; flex-shrink: 0; }

/* ---------- chips = stamps ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px;
  border: 1.5px solid var(--mint-deep); border-radius: 999px; background: var(--mint-soft);
  color: var(--mint-deep); font-size: .78rem; font-weight: 600; white-space: nowrap;
  box-shadow: 1.5px 1.5px 0 var(--mint-deep); }
.chip .ms { font-size: 14px; vertical-align: -2px; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: var(--good); box-shadow: 1.5px 1.5px 0 var(--good); }
.chip.ghost { background: transparent; border-style: dashed; color: var(--ink-3);
  border-color: var(--ink-3); box-shadow: none; }
.chip.pending { background: var(--mustard-soft); color: #7a5a10; border-color: #7a5a10; box-shadow: 1.5px 1.5px 0 #7a5a10; }
.chip.pending .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
/* icons.html: auto-mapping is new/changed since the last build — review then rebuild */
.chip.fresh { background: #f3e8ff; color: #6d28d9; border-color: #6d28d9; box-shadow: 1.5px 1.5px 0 #6d28d9; }
@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* ---------- buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 10px; border: 2px solid var(--line); font-size: .92rem;
  font-weight: 700; background: var(--accent); color: #fff7e8; box-shadow: var(--hard);
  transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 rgba(71, 49, 31, .26); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(71, 49, 31, .3); }
.btn.ghost { background: var(--surface); color: var(--accent-deep); }
.btn.ghost:hover { background: var(--mustard-soft); }
.btn.mint { background: var(--mint); color: var(--mint-deep); }
.btn.sm { padding: 5px 12px; font-size: .82rem; border-radius: 8px; box-shadow: 2.5px 2.5px 0 rgba(71, 49, 31, .22); }
.ripple { display: none; }

/* ---------- rings & bars ---------- */
.ring-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.ring { transform: rotate(-90deg); }
.ring .track { fill: none; stroke: #e7d3a8; }
.ring .fill { fill: none; stroke: var(--accent); stroke-linecap: round;
  transition: stroke-dashoffset 1.1s cubic-bezier(.22, .8, .36, 1); }
.ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-variant-numeric: tabular-nums; color: var(--ink); }
.ring-box { position: relative; display: inline-block; }
.pbar { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1.5px solid var(--line); overflow: hidden; }
.pbar > i { display: block; height: 100%; width: 0;
  background: repeating-linear-gradient(135deg, var(--accent) 0 8px, var(--accent-deep) 8px 16px);
  transition: width 1s cubic-bezier(.22, .8, .36, 1); }

/* ---------- sections ---------- */
.sec { margin: 42px 0 18px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sec h2 { font-size: 1.45rem; color: var(--accent-deep); }
.sec h2 .ms { color: var(--accent); font-size: 22px; }
.sec .hint { color: var(--ink-3); font-size: .87rem; }
.sec::after { content: ''; flex: 1; min-width: 40px; border-bottom: 2px dashed var(--line-soft); transform: translateY(-6px); }

.callout { background: var(--mustard-soft); border: 2px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--hard); padding: 13px 17px; color: var(--ink); font-size: .92rem; margin: 14px 0; white-space: pre-line; }

/* ---------- player ---------- */
.player-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr); gap: 22px; align-items: start; }
.player-box { background: #2e1d10; border: 2px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--hard-lg); }
.player-box video { width: 100%; aspect-ratio: 16/9; display: block; background: #000; }
.player-ctrl { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px;
  background: #2e1d10; color: #f0e2c8; border-top: 2px solid rgba(247, 236, 212, .18); }
.player-ctrl .now { font-size: .9rem; font-weight: 600; margin-right: auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speed-btn, .ctrl-btn { background: rgba(247, 236, 212, .12); color: #f0e2c8;
  border: 1.5px solid rgba(247, 236, 212, .35); border-radius: 8px; padding: 4px 10px;
  font-size: .8rem; font-weight: 600; transition: all .18s; }
.speed-btn:hover, .ctrl-btn:hover { background: rgba(247, 236, 212, .25); transform: translateY(-1px); }
.speed-btn.active { background: var(--mustard); color: var(--ink); border-color: var(--mustard); }
.ctrl-btn.on { background: var(--good); color: #fff; border-color: var(--good); }
.ctrl-btn .ms { font-size: 18px; vertical-align: -4px; }

.playlist { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--hard); max-height: 560px; display: flex; flex-direction: column; }
.playlist .pl-head { padding: 12px 16px; border-bottom: 2px solid var(--line); font-weight: 700;
  font-family: var(--font-display); font-size: .98rem; display: flex; justify-content: space-between;
  align-items: center; background: var(--mustard-soft); }
.playlist .pl-items { overflow-y: auto; }
.pl-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 16px; background: none; border: none; border-bottom: 1.5px dashed var(--line-soft);
  color: var(--ink-2); font-size: .88rem; transition: background .2s, padding-left .2s; position: relative; }
.pl-item:last-child { border-bottom: none; }
.pl-item:hover { background: var(--surface-2); padding-left: 20px; }
.pl-item.active { background: var(--mint-soft); color: var(--mint-deep); font-weight: 600; }
.pl-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.pl-item .idx { width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2);
  border: 1.5px solid var(--line-soft); flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; font-size: .76rem; font-weight: 700; color: var(--ink-3); }
.pl-item.active .idx { background: var(--accent); border-color: var(--accent); color: #fff; }
.pl-item .check { margin-left: auto; flex-shrink: 0; color: var(--good); opacity: 0; transform: scale(.4);
  transition: opacity .3s, transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.pl-item.watched .check { opacity: 1; transform: scale(1); }

/* ---------- attachments / pdf ---------- */
.attach-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.pdf-fold { margin-top: 16px; border: 2px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--surface); box-shadow: var(--hard); }
.pdf-fold summary { padding: 13px 18px; cursor: pointer; font-weight: 700; list-style: none;
  display: flex; align-items: center; gap: 10px; transition: background .2s; }
.pdf-fold summary::-webkit-details-marker { display: none; }
.pdf-fold summary:hover { background: var(--mustard-soft); }
.pdf-fold summary .arrow { margin-left: auto; transition: transform .3s; }
.pdf-fold[open] summary .arrow { transform: rotate(180deg); }
/* the title owns leftover width; a long filename chip clips instead of
   squeezing the title into a one-word-per-line column */
.pdf-fold summary .fold-title { flex: 1 1 auto; min-width: 0; }
.pdf-fold summary .chip { max-width: 42vw; overflow: hidden; flex-shrink: 0; }
.pdf-fold iframe { width: 100%; height: 75vh; border: none; display: block; border-top: 2px solid var(--line); }

/* lesson.md text sections ("Nội dung bài học") reuse the pdf-fold shell */
.note-fold { margin-top: 12px; }
.note-fold summary { gap: 8px; }
.note-body { padding: 2px 18px 14px; line-height: 1.65; border-top: 2px solid var(--line); }
.note-body p { margin: 10px 0; }
.note-body a { color: var(--accent-deep); font-weight: 600; }
/* …but real buttons inside a doc keep button ink — the link rule above was
   painting accent-deep text on the accent background (red on red) */
.note-body a.btn { color: #fff7e8; font-weight: 700; }
.note-body a.btn.ghost { color: var(--accent-deep); }
.md-img { display: inline-block; margin: 6px 8px 6px 0; border: 2px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden; }
.md-img img { display: block; max-width: min(100%, 420px); }

/* *.doc.json "tài liệu đẹp" — LLM-extracted PDF/Excel content */
.doc-body h4 { margin: 16px 0 6px; color: var(--accent-deep); font-size: 1rem; }
.doc-body ul { margin: 8px 0 8px 22px; display: grid; gap: 4px; }
.doc-body .tbl-wrap { margin: 8px 0 14px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); }
.doc-cap { font-weight: 700; font-size: .85rem; color: var(--ink-2); margin: 10px 0 4px; }
.doc-body .callout { margin: 10px 0; display: flex; gap: 8px; align-items: flex-start; }
/* "file gốc" chip on a doc fold — links back to the PDF/Excel the doc replaced */
a.doc-src { text-decoration: none; }
a.doc-src:hover { color: var(--accent-deep); border-color: var(--accent-deep); }
.doc-warn { background: #fdeae6; border-color: var(--accent); }
.doc-warn .ms { color: var(--accent-deep); }
.doc-tip .ms { color: var(--mint-deep); }

/* mini TOC over long docs — anchor chips to the "PHẦN …" headings */
.doc-toc { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0 4px; }
.doc-toc > .ms { color: var(--ink-3); }
.doc-toc .gchip { text-decoration: none; }
.doc-body h4 { scroll-margin-top: 92px; }
/* step timer chip inside static doc steps */
.doc-step .step-timer, .doc-step .step-timer .ms { color: var(--accent-deep); }
.doc-step .step-timer { margin-top: 6px; border-color: var(--accent-deep); background: var(--surface-2); }

/* doc widgets: stats tiles, numbered steps, registered recipe card */
.doc-stat-row { margin: 12px 0; }
.doc-stat .value { font-size: 1.02rem; }
.doc-steps { display: grid; gap: 8px; margin: 10px 0 14px; }
.doc-step { display: flex; gap: 10px; align-items: flex-start; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.doc-step .ds-n { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800; font-size: .8rem;
  display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.doc-recipe { border: 2px solid var(--mint-deep); border-radius: var(--radius);
  background: var(--mint-soft); padding: 14px 16px; margin: 12px 0 16px; }
.doc-recipe .dr-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px; }
.doc-recipe .dr-head > .ms { color: var(--mint-deep); }
.doc-recipe .dr-head b { font-size: 1.05rem; }
.dr-ings { list-style: none; display: grid; gap: 4px 10px; margin: 8px 0 12px;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.dr-ings li { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1.5px solid var(--line-soft); border-radius: var(--radius-sm); padding: 4px 9px;
  font-size: .92rem; }
.dr-ings .di-group { grid-column: 1 / -1; border: none; background: none; padding: 8px 2px 0;
  font-weight: 800; font-size: .76rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--mint-deep); }
.dr-ings .di-name { flex: 1; min-width: 0; }
.dr-ings .di-amt { white-space: nowrap; color: var(--accent-deep); font-variant-numeric: tabular-nums; }
.dr-ings .di-more { border: none; background: none; color: var(--ink-3); font-size: .85rem; }
.doc-ing-ico { display: inline-flex; width: 22px; height: 22px; flex: 0 0 auto;
  vertical-align: middle; margin-right: 6px; }
.doc-ing-ico img, .doc-ing-ico .lot-ico { width: 100%; height: 100%; object-fit: contain; }
.tbl .doc-ing-ico { margin-right: 8px; }

/* "cards" doc block — spreadsheet rows extracted as a compact card grid */
.doc-cards { margin: 10px 0 16px; }
.doc-cards .doc-cards-search { display: block; width: 100%; margin: 6px 0 12px; }
.doc-card-grid { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.doc-card { padding: 12px; gap: 7px; }
.doc-card h4 { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.doc-badge { font-size: .8rem; color: var(--good); background: var(--good-soft);
  border: 1px solid var(--good); border-radius: 6px; padding: 3px 8px; }

/* recipe variants (biến tấu vị) — switcher chips + marked rows */
.rc-variants { margin-top: 10px; }
.ing-row.var { background: var(--mint-soft); border-radius: 6px; }
.opt-tag.var-tag { color: var(--mint-deep); border-color: var(--mint-deep); }

/* ---------- gallery & lightbox ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery a { border: 2px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  aspect-ratio: 1; display: block; position: relative; box-shadow: 3px 3px 0 rgba(71, 49, 31, .2);
  transition: transform .2s, box-shadow .2s; background: var(--surface); }
.gallery a:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 5px 5px 0 rgba(71, 49, 31, .25); }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(38, 24, 12, .93);
  display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .3s; }
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 6px; border: 3px solid var(--mustard);
  transform: scale(.92); transition: transform .3s cubic-bezier(.22, .8, .36, 1); }
.lightbox.open img { transform: scale(1); }
.lb-btn { position: absolute; background: rgba(247, 236, 212, .14); border: 1.5px solid rgba(247, 236, 212, .4);
  color: #f7ecd4; width: 46px; height: 46px; border-radius: 50%; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center; transition: all .2s; }
.lb-btn:hover { background: rgba(247, 236, 212, .3); transform: scale(1.1); }
.lb-prev { left: 18px; } .lb-next { right: 18px; } .lb-close { top: 18px; right: 18px; }
.lb-count { position: absolute; bottom: 20px; color: rgba(247, 236, 212, .8); font-size: .9rem; }

/* ---------- Q&A ---------- */
.qa-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.qa-search, .mat-search { flex: 1; min-width: 220px; padding: 10px 16px; border: 2px solid var(--line);
  border-radius: 10px; background: var(--surface); font-size: .92rem; color: var(--ink);
  outline: none; box-shadow: var(--hard); transition: box-shadow .2s, transform .2s; }
.qa-search:focus, .mat-search:focus { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 rgba(191, 74, 51, .35); }
.qa-item { border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  margin-bottom: 12px; overflow: hidden; box-shadow: 3px 3px 0 rgba(71, 49, 31, .18); transition: box-shadow .2s; }
.qa-item:hover { box-shadow: var(--hard); }
.qa-q { width: 100%; text-align: left; background: none; border: none; padding: 14px 18px;
  display: flex; gap: 12px; align-items: flex-start; color: var(--ink); }
.qa-q .avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--mint-soft); border: 2px solid var(--mint-deep); color: var(--mint-deep);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.qa-q .q-main { flex: 1; min-width: 0; }
.qa-q .q-author { font-weight: 600; font-size: .87rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.qa-q .q-author .time { color: var(--ink-3); font-weight: 400; font-size: .77rem; }
.qa-q .q-text { color: var(--ink-2); font-size: .92rem; margin-top: 3px; white-space: pre-line; }
.qa-q .chev { flex-shrink: 0; color: var(--ink-3); transition: transform .3s; margin-top: 4px; }
.qa-item.open .qa-q .chev { transform: rotate(180deg); }
.qa-a { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s cubic-bezier(.22, .8, .36, 1); }
.qa-item.open .qa-a { grid-template-rows: 1fr; }
.qa-a > div { overflow: hidden; }
.qa-answer { margin: 0 18px 12px 64px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1.5px dashed var(--line-soft); font-size: .9rem;
  color: var(--ink-2); white-space: pre-line; }
.qa-answer .who { font-weight: 700; font-size: .82rem; color: var(--ink); display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.team-pill { background: var(--accent); color: #fff7e8; border-radius: 3px; padding: 1px 8px;
  font-size: .66rem; font-weight: 700; letter-spacing: .08em; }
/* student comment photos (real results shared in the class Q&A) */
.qa-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.qa-photo { width: 96px; height: 96px; border: 2px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; display: block; box-shadow: 2px 2px 0 rgba(71, 49, 31, .18);
  transition: transform .18s, box-shadow .18s; background: var(--surface); flex: 0 0 auto; }
.qa-photo:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 4px 4px 0 rgba(71, 49, 31, .24); }
.qa-photo img { width: 100%; height: 100%; object-fit: cover; }
/* photos attached to the question itself sit directly in .qa-a (no .qa-answer
   bubble around them) — give them the same inset as the answer bubbles */
.qa-a > div > .qa-photos { margin: 2px 18px 14px 64px; }
.q-text:empty::after { content: "📷 (kèm ảnh thực tế)"; color: var(--ink-3); }

/* ---------- tabs = folder tabs ---------- */
.tab-bar { position: relative; display: flex; gap: 6px; margin-bottom: 0; overflow-x: auto;
  scrollbar-width: none; padding: 0 8px; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn { background: var(--surface-2); border: 2px solid var(--line); border-bottom: none;
  padding: 10px 18px 12px; font-size: .93rem; font-weight: 700; color: var(--ink-3);
  white-space: nowrap; border-radius: 10px 10px 0 0; transition: all .18s; position: relative; top: 4px; }
.tab-btn:hover { color: var(--ink); background: var(--mustard-soft); }
.tab-btn.active { color: var(--accent-deep); background: var(--surface); top: 0; padding-bottom: 16px; z-index: 2; }
.tab-btn .ms { font-size: 17px; vertical-align: -3px; }
.tab-ind { display: none; }
.tab-panel { display: none; background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--hard); padding: 20px; position: relative; z-index: 1; }
.tab-panel.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- materials ---------- */
.mat-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.group-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.gchip { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 5px 14px; font-size: .83rem; font-weight: 600;
  box-shadow: 2px 2px 0 rgba(71, 49, 31, .18); transition: all .15s; }
.gchip:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(71, 49, 31, .22); }
.gchip.active { background: var(--accent); border-color: var(--line); color: #fff7e8; }
.mat-group-title { font-family: var(--font-display); font-size: 1.12rem; margin: 24px 0 4px; color: var(--accent-deep); }
.mat-group-desc { color: var(--ink-3); font-size: .86rem; margin-bottom: 12px; }
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 16px; }
.mat-card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 9px; box-shadow: 3px 3px 0 rgba(71, 49, 31, .18);
  transition: transform .2s, box-shadow .2s; position: relative; }
.mat-card:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(71, 49, 31, .24); }
.mat-card .thumb { height: 120px; border-radius: var(--radius-sm); background: var(--mint-soft);
  border: 1.5px dashed var(--mint-deep); display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 2.4rem; padding: 8px; }
.mat-card .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .3s; }
.mat-card:hover .thumb img { transform: scale(1.08) rotate(-2deg); }

/* Assigned lottie item-icons (picker "Gán icon"). The player injects an <svg>
   that fills the box; each context sizes the box to match its <img> sibling.
   Later context rules (.a-ico / .ai-cur-img / .chip-ico) override the default. */
.lot-ico { display: inline-block; width: 32px; height: 32px; line-height: 0; vertical-align: middle; }
.lot-ico svg { width: 100% !important; height: 100% !important; display: block; }
.mat-card .thumb .lot-ico { width: 104px; height: 104px; }
.mat-card:hover .thumb .lot-ico { transform: scale(1.06); transition: transform .3s; }
.cat-ico .lot-ico { width: 100%; height: 100%; }
.ai-cur .lot-ico { width: 34px; height: 34px; }
.mat-card h4 { font-size: .96rem; line-height: 1.3; }
.mat-card .price { font-weight: 700; color: var(--accent-deep); font-variant-numeric: tabular-nums; }
.mat-card .price .live { font-size: .7rem; background: var(--good-soft); color: var(--good);
  border: 1px solid var(--good); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }
.mat-card .note { font-size: .84rem; color: var(--ink-2); }
.mat-card .note.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-more { background: none; border: none; color: var(--accent-deep); font-size: .8rem; font-weight: 700; text-align: left; padding: 0; }
.mat-card .links { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.shop-add { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 8px;
  border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center;
  transition: all .15s; z-index: 2; }
.shop-add .ms { font-size: 18px; color: var(--ink-3); vertical-align: 0; }
.shop-add:hover { background: var(--mustard-soft); transform: scale(1.08); }
.shop-add.on { background: var(--good); border-color: var(--good); }
.shop-add.on .ms { color: #fff; font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ---------- calculator ---------- */
.calc-note { margin-bottom: 18px; }
.calc-grid { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.5fr); gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--hard); overflow: hidden; }
.panel > .p-head { padding: 13px 18px; font-weight: 700; font-family: var(--font-display);
  border-bottom: 2px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; background: var(--mustard-soft); }
/* generic panel body — .tp-body was only padded inside .tool-panel, leaving
   profile/add-recipe panels with text flush against the border */
.panel .tp-body { padding: 14px 18px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .89rem; }
.tbl th { text-align: left; padding: 9px 14px; background: var(--surface-2); color: var(--ink-2);
  font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0;
  border-bottom: 2px solid var(--line); }
.tbl td { padding: 8px 14px; border-top: 1.5px dashed var(--line-soft); vertical-align: middle; }
.tbl tr:hover td { background: var(--mustard-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-input { width: 112px; padding: 6px 9px; border: 1.5px solid transparent; border-radius: 7px;
  background: transparent; text-align: right; font-size: .89rem; font-variant-numeric: tabular-nums;
  color: var(--ink); transition: all .2s; font-weight: 700; }
.price-input:hover { border-color: var(--line-soft); background: var(--surface); }
.price-input:focus { outline: none; border-color: var(--accent); background: #fff;
  box-shadow: 2px 2px 0 rgba(191, 74, 51, .3); }
.price-input.changed { color: var(--accent-deep); background: var(--accent-soft); }
.price-input.live { color: var(--good); background: var(--good-soft); }
.flash { animation: flash .7s ease; }
@keyframes flash { 0% { background: var(--mustard-soft); } 100% { background: transparent; } }
.recipe-card { margin-bottom: 20px; }
.recipe-card .p-head { background: var(--mint-soft); font-size: 1.02rem; }
.sub-title { padding: 11px 18px 2px; font-weight: 700; font-size: .93rem; color: var(--accent-deep); }
.recipe-total { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 18px; background: var(--surface-2); border-top: 2px solid var(--line); }
.recipe-total .lbl { font-size: .88rem; color: var(--ink-2); font-weight: 600; }
.recipe-total .val { font-size: 1.3rem; font-weight: 700; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.batch-ctl { display: inline-flex; align-items: center; gap: 4px; }
.batch-ctl button { width: 26px; height: 26px; border-radius: 7px; border: 1.5px solid var(--line);
  background: var(--surface); font-weight: 700; color: var(--accent-deep); transition: all .15s;
  box-shadow: 1.5px 1.5px 0 rgba(71, 49, 31, .2); }
.batch-ctl button:hover { background: var(--mustard-soft); transform: translate(-1px, -1px); }
.batch-ctl .bval { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.sumline { display: flex; justify-content: space-between; padding: 7px 18px; font-size: .88rem;
  color: var(--ink-2); border-top: 1.5px dashed var(--line-soft); }
.sumline .num { font-weight: 700; color: var(--ink); }
.price-status { font-size: .8rem; color: var(--ink-3); }
.price-status.ok { color: var(--good); }
.price-status.err { color: var(--accent-deep); }
.price-age { font-size: .68rem; color: var(--ink-3); text-align: right; padding-right: 9px; margin-top: -2px; }
.price-age.stale { color: var(--accent); }
.row-shop { color: var(--ink-3); vertical-align: -3px; }
.row-shop:hover { color: var(--accent); }
.row-shop .ms { font-size: 15px; }

/* ---------- search ---------- */
.searchbox-wrap { position: relative; max-width: 660px; margin: 8px auto 26px; }
.searchbox { width: 100%; padding: 15px 22px 15px 52px; font-size: 1.02rem; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: var(--hard); outline: none; transition: box-shadow .2s, transform .2s; }
.searchbox:focus { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 rgba(191, 74, 51, .3); }
.searchbox-wrap .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 1.15rem; color: var(--accent); }
.result-item { display: block; background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 10px;
  box-shadow: 3px 3px 0 rgba(71, 49, 31, .16); transition: transform .15s, box-shadow .15s; }
.result-item:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(191, 74, 51, .3); }
.result-item .r-title { font-weight: 600; color: var(--ink); }
.result-item .r-sub { font-size: .85rem; color: var(--ink-2); margin-top: 2px; }
.result-item .r-crumb { font-size: .76rem; color: var(--ink-3); margin-top: 3px; }
mark { background: var(--mustard); color: var(--ink); border-radius: 3px; padding: 0 2px; }
.no-results { text-align: center; color: var(--ink-3); padding: 40px 0; font-size: .95rem; }

/* ---------- prev/next & crumbs ---------- */
.lesson-nav { display: flex; gap: 14px; margin: 40px 0; }
.lesson-nav a { flex: 1; background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 14px 20px; transition: all .18s; box-shadow: var(--hard); }
.lesson-nav a:hover { transform: translate(-2px, -2px); box-shadow: var(--hard-lg); }
.lesson-nav .dir { font-size: .78rem; color: var(--ink-3); }
.lesson-nav .ttl { font-weight: 700; font-size: .93rem; color: var(--ink); }
.lesson-nav a.next { text-align: right; }
.crumb { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .85rem;
  color: var(--ink-3); padding: 20px 0 6px; }
.crumb a { color: var(--ink-3); font-weight: 600; }
.crumb a:hover { color: var(--accent-deep); }
.crumb .sep { opacity: .5; }

/* ---------- toast & confetti ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 90px); z-index: 90;
  background: var(--ink); color: var(--bg); border: 2px solid var(--mustard);
  padding: 12px 22px; border-radius: 12px; font-size: .92rem; font-weight: 600;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .3); opacity: 0;
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), opacity .3s;
  display: flex; gap: 10px; align-items: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast .lot-box { width: 42px; height: 42px; flex-shrink: 0; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; }
.dust { position: fixed; width: 7px; height: 7px; border-radius: 50%; background: #f0e0bb;
  border: 1px solid #d9c49b; pointer-events: none; z-index: 94; }

/* ---------- lottie boxes ---------- */
.lot-box { display: inline-block; }
.lot-box svg { display: block; }
/* thick-outline saved icons read as chunky when large — mount them small on a
   dashed "sticker" badge so the heavy stroke looks intentional */
.lot-sticker { width: 88px; height: 88px; padding: 14px; background: var(--surface);
  border: 2px dashed var(--mint-deep); border-radius: 50%; box-shadow: var(--hard); }
.hero-lot { position: absolute; right: 4%; top: 60px; width: 124px; height: 124px;
  padding: 18px; background: var(--surface); border: 2px dashed var(--mint-deep);
  border-radius: 50%; box-shadow: var(--hard); }

/* ---------- external video link cards (recipe view) ---------- */
.video-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.video-link-card { display: flex; gap: 12px; align-items: center; background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius); padding: 10px;
  box-shadow: var(--hard); transition: transform .18s, box-shadow .18s; }
.video-link-card:hover { transform: translate(-2px, -2px); box-shadow: var(--hard-lg); }
.video-link-card .vl-thumb { width: 120px; aspect-ratio: 16/9; flex-shrink: 0; border-radius: 8px;
  overflow: hidden; border: 1.5px solid var(--line); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; }
.video-link-card .vl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-link-card .vl-thumb .ms { font-size: 30px; color: var(--accent); }
.video-link-card .vl-body { min-width: 0; }
.video-link-card .vl-body b { display: block; font-size: .9rem; line-height: 1.35; color: var(--ink);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.video-link-card .vl-src { font-size: .76rem; color: var(--ink-3); display: inline-flex;
  align-items: center; gap: 4px; margin-top: 4px; }
.video-link-card .vl-src .ms { font-size: 14px; }

/* ---------- cooking tools ---------- */
.notes-card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--hard); padding: 16px 18px; margin-top: 18px;
  background-image: repeating-linear-gradient(var(--surface) 0 27px, var(--line-soft) 27px 28px); }
.notes-card h3 { font-size: 1.05rem; color: var(--accent-deep); display: flex; gap: 8px; align-items: center; }
.notes-card textarea { width: 100%; min-height: 84px; margin-top: 8px; border: none; background: transparent;
  resize: vertical; font-size: .95rem; line-height: 28px; color: var(--ink-2); outline: none; }
.notes-card .saved { font-size: .74rem; color: var(--ink-3); }

.timer-fab, .shoplist-fab { position: fixed; z-index: 80; bottom: 22px; border: 2px solid var(--line);
  border-radius: 14px; background: var(--mustard); color: var(--ink); font-weight: 700;
  padding: 11px 16px; display: flex; gap: 8px; align-items: center; box-shadow: var(--hard);
  transition: transform .15s, box-shadow .15s; font-size: .9rem; }
.timer-fab { right: 22px; }
.shoplist-fab { right: 22px; }
.timer-fab:hover, .shoplist-fab:hover { transform: translate(-2px, -2px); box-shadow: var(--hard-lg); }
.timer-fab .ms, .shoplist-fab .ms { font-size: 20px; }
.timer-fab.running { background: var(--accent); color: #fff7e8; }

.tool-panel { position: fixed; z-index: 85; right: 22px; bottom: 82px; width: min(340px, calc(100vw - 44px));
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--hard-lg); display: none; max-height: 70vh; overflow-y: auto; }
.tool-panel.open { display: block; animation: fadeIn .25s ease; }
.tool-panel .tp-head { padding: 12px 16px; border-bottom: 2px solid var(--line); font-weight: 700;
  font-family: var(--font-display); background: var(--mustard-soft); display: flex;
  justify-content: space-between; align-items: center; }
.tool-panel .tp-body { padding: 14px 16px; }
.timer-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1.5px dashed var(--line-soft); }
.timer-row .t-name { flex: 1; font-size: .88rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.timer-row .t-left { font-family: var(--font-display); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.timer-row.done .t-left { color: var(--accent); animation: pulse 1s ease-in-out infinite; }
.timer-row button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 7px;
  width: 28px; height: 28px; display: grid; place-items: center; }
.timer-row button .ms { font-size: 16px; vertical-align: 0; }
.timer-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.shop-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1.5px dashed var(--line-soft); font-size: .89rem; }
.shop-row .x { margin-left: auto; border: none; background: none; color: var(--ink-3); font-weight: 700; }

/* ---------- cook mode ---------- */
.cookmode { position: fixed; inset: 0; z-index: 96; background: #241609; display: none;
  flex-direction: column; color: #f7ecd4; }
.cookmode.open { display: flex; }
.cookmode .cm-head { display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  border-bottom: 2px solid rgba(247, 236, 212, .25); }
.cookmode .cm-head h2 { font-size: 1.1rem; color: var(--mustard); }
.cookmode .cm-head .btn { margin-left: auto; }
.cookmode .cm-body { flex: 1; display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px; padding: 18px 20px; min-height: 0; }
.cookmode .cm-video { display: flex; align-items: center; min-height: 0; }
.cookmode .cm-video video { width: 100%; max-height: 100%; border-radius: 10px; border: 2px solid rgba(247, 236, 212, .3); }
.cookmode .cm-side { overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.cookmode .cm-note { background: rgba(247, 236, 212, .08); border: 1.5px dashed rgba(247, 236, 212, .4);
  border-radius: 10px; padding: 14px; font-size: 1.05rem; line-height: 1.7; white-space: pre-wrap; }
.cookmode .cm-note:empty::before { content: 'Ghi chú của bạn sẽ hiện ở đây — thêm ở cuối trang bài học.'; color: rgba(247,236,212,.5); }
.cookmode .wake { font-size: .78rem; color: rgba(247, 236, 212, .55); }

/* ---------- account / profiles ---------- */
.user-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink-2); font-size: .88rem; font-weight: 600; white-space: nowrap;
  box-shadow: 2px 2px 0 rgba(71, 49, 31, .18); transition: all .18s; flex-shrink: 0; }
.user-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(71, 49, 31, .22);
  background: var(--mustard-soft); color: var(--ink); }
.user-btn .ms { font-size: 18px; vertical-align: -3px; color: var(--accent); }
.user-btn #user-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
/* the admin account wears gold */
.user-btn.is-admin { border-color: #a8770a; background: var(--mustard-soft);
  box-shadow: 2px 2px 0 rgba(168, 119, 10, .45); }
.user-btn.is-admin .ms, .user-btn.is-admin #user-name { color: #7a5a10; }
.role-pill.gold { background: #a8770a; color: #fff7e8; }
.user-row .avatar.adm { background: var(--mustard-soft); border-color: #a8770a; color: #7a5a10; }
/* saved sessions on this device — one-tap account switching */
.sess-head { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); margin: 4px 0 2px; }
.user-row .forget { margin-left: auto; width: 24px; height: 24px; border-radius: 6px; border: none;
  background: none; color: var(--ink-3); font-size: 1rem; line-height: 1; flex-shrink: 0; }
.user-row .forget:hover { background: var(--surface-2); color: var(--accent-deep); }
.auth-link { background: none; border: none; padding: 0; color: var(--accent-deep);
  font-size: .8rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.role-pill { background: var(--accent); color: #fff7e8; border-radius: 3px; padding: 0 6px;
  font-size: .64rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
/* shares .tool-panel chrome but drops down from the header instead */
.user-panel { top: 86px; bottom: auto; width: min(320px, calc(100vw - 44px)); }
.user-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 6px; background: none; border: none; border-bottom: 1.5px dashed var(--line-soft);
  font-size: .92rem; font-weight: 600; color: var(--ink-2); border-radius: 6px; }
.user-row:hover { background: var(--mustard-soft); color: var(--ink); }
.user-row .avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--mint-soft); border: 2px solid var(--mint-deep); color: var(--mint-deep);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.user-row.current { color: var(--accent-deep); }
.user-sync { font-size: .76rem; color: var(--ink-3); margin-top: 10px; }

/* ---------- catalog items (icon chips shared everywhere) ---------- */
.page-title { font-family: var(--font-display); font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  color: var(--accent); text-shadow: 2px 2px 0 var(--mustard-soft); }
.cat-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--mint-soft);
  border: 1.5px solid var(--mint-deep); flex-shrink: 0; display: inline-flex;
  align-items: center; justify-content: center; padding: 4px; }
.cat-ico img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cat-ico.ms-ico { color: var(--mint-deep); }
.cat-ico .ms { font-size: 18px; vertical-align: 0; }
.chip-ico { width: 16px; height: 16px; object-fit: contain; margin-right: 2px; }
.chips-out { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 8px; }
.chips-out.center { justify-content: center; max-width: 660px; margin: -14px auto 20px; }
.chip .chip-x { background: none; border: none; color: inherit; font-weight: 700;
  padding: 0 0 0 5px; font-size: .75rem; opacity: .7; }
.chip .chip-x:hover { opacity: 1; }
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }

/* ---------- recipe cards & library ---------- */
.lib-tools { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.rc-card .card-cover { position: relative; }
.rc-cat { position: absolute; left: 10px; bottom: 10px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 999px; padding: 2px 11px;
  font-size: .76rem; font-weight: 700; box-shadow: 2px 2px 0 rgba(71, 49, 31, .2); }
.rc-collage { height: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  align-items: center; justify-items: center; padding: 18px 26px;
  background: repeating-linear-gradient(135deg, var(--mint-soft) 0 26px, var(--surface) 26px 52px); }
.rc-collage img { max-width: 64px; max-height: 64px; filter: drop-shadow(2px 2px 0 rgba(71, 49, 31, .18)); }
.rc-collage.n1 { grid-template-columns: 1fr; }
.rc-collage.n1 img { max-width: 96px; max-height: 96px; }
.rc-collage.n3 img:first-child { grid-column: span 2; }
/* 5–6 icons: three columns, slightly smaller marks */
.rc-collage.n5, .rc-collage.n6 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rc-collage.n5 img, .rc-collage.n6 img { max-width: 52px; max-height: 52px; }
.rc-collage.n5 img:first-child { grid-column: span 2; }
.gchip.active[data-on], .gchip.active[data-cat] { background: var(--accent); color: #fff7e8; }

/* ---------- recipe viewer ---------- */
.rc-head { display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap; padding: 22px 0 8px; }
.rc-head-cover { width: min(340px, 100%); border: 2px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--hard); aspect-ratio: 16/10; background: var(--surface-2); }
.rc-head-cover img { width: 100%; height: 100%; object-fit: cover; }
.rc-head-cover .cover-emoji, .rc-head-cover .rc-collage { height: 100%; display: grid; }
.rc-head-cover .cover-emoji { place-items: center; font-size: 3.4rem; }
.rc-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 26px;
  align-items: start; margin-top: 8px; }
.steps { list-style: none; counter-reset: step; }
.step-card { position: relative; display: flex; gap: 14px; background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--hard);
  padding: 15px 17px; margin-bottom: 14px; counter-increment: step; }
.step-card::before { content: counter(step); position: absolute; top: -12px; left: -10px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--mustard); color: var(--ink);
  border: 2px solid var(--line); font-family: var(--font-display); font-size: .9rem;
  display: flex; align-items: center; justify-content: center; box-shadow: 2px 2px 0 rgba(71, 49, 31, .2); }
.step-ico { width: 52px; height: 52px; flex-shrink: 0; border-radius: 12px; background: var(--mint-soft);
  border: 1.5px dashed var(--mint-deep); display: flex; align-items: center; justify-content: center;
  color: var(--mint-deep); overflow: hidden; }
.step-ico .ms { font-size: 26px; vertical-align: 0; }
.step-ico svg { width: 100% !important; height: 100% !important; }
.step-body { flex: 1; min-width: 0; }
.step-act { font-family: var(--font-display); font-size: .85rem; color: var(--accent-deep);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.step-text { color: var(--ink-2); white-space: pre-line; }
.step-timer { cursor: pointer; transition: transform .15s; }
.step-timer:hover { transform: translate(-1px, -1px); }
.ing-row { display: flex; gap: 10px; align-items: center; padding: 9px 16px;
  border-bottom: 1.5px dashed var(--line-soft); }
.ing-row:last-child { border-bottom: none; }
.ing-row.opt { opacity: .75; }
.ing-name { flex: 1; min-width: 0; font-size: .92rem; }
.ing-note { display: block; font-size: .78rem; color: var(--ink-3); }
.opt-tag { font-size: .68rem; color: var(--ink-3); border: 1px dashed var(--ink-3);
  border-radius: 999px; padding: 0 7px; vertical-align: 1px; }
.ing-qty { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ing-have { color: var(--good); font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ---------- basket ---------- */
.basket-check { display: flex; align-items: center; }
.basket-check input { width: 17px; height: 17px; accent-color: var(--good); cursor: pointer; }
.shop-row .b-name { flex: 1; min-width: 0; }
.shop-row .b-price { color: var(--ink-3); font-size: .78rem; margin-left: 4px; }
.shop-row .b-link { color: var(--accent-deep); flex-shrink: 0; }
.shop-row .b-link .ms { font-size: 17px; vertical-align: -3px; }
.shop-row.owned .b-name { text-decoration: line-through; color: var(--ink-3); }
.basket-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 10px 2px 4px; font-size: .88rem; color: var(--ink-2); }
.basket-total b { font-family: var(--font-display); font-size: 1.05rem; color: var(--ink);
  font-variant-numeric: tabular-nums; }
.basket-total.grand { border-top: 2px solid var(--line); margin-top: 12px; padding-top: 12px; }
.basket-total.grand b { font-size: 1.25rem; color: var(--accent-deep); }
.basket-sep { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: .84rem;
  color: var(--ink-2); margin: 14px 0 2px; }
.basket-sep .ms { font-size: 16px; color: var(--accent); }

/* ---------- inventory ---------- */
.inv-add { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border: 1.5px solid var(--line-soft); border-radius: 999px; background: var(--surface);
  color: var(--ink-3); font-size: .78rem; font-weight: 600; transition: all .15s; }
.inv-add .ms { font-size: 14px; vertical-align: -2px; }
.inv-add:hover { border-color: var(--line); color: var(--ink); }
.inv-add.on { background: var(--good-soft); border-color: var(--good); color: var(--good);
  box-shadow: 1.5px 1.5px 0 var(--good); }
.inv-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -6px 0 16px;
  padding: 10px 14px; background: var(--surface-2); border: 1.5px dashed var(--line-soft);
  border-radius: var(--radius-sm); font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.inv-bar .ms { color: var(--accent); }
.inv-bar .pbar { flex: 1; max-width: 180px; }
.inv-hidden { display: none !important; }
.ready-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: .88rem; }
.ready-row > span:first-child { min-width: 130px; font-weight: 600; }
.ready-row .pbar { flex: 1; max-width: 200px; }

/* ---------- add-recipe form ---------- */
.form-panel { margin-bottom: 16px; }
.form-panel .tp-body { padding: 16px; }
/* two flex children under space-between split icon from its label — keep them together */
.form-panel .p-head { justify-content: flex-start; gap: 9px; }
.form-panel .p-head .hint { margin-left: auto; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: .8rem;
  font-weight: 700; color: var(--ink-2); }
.form-grid input, .form-grid select, .ar-row input, .ar-step input, .ar-step select,
.ar-step textarea { box-shadow: none; padding: 8px 12px; min-width: 0; }
/* cover-image row: url box + live thumbnail + clear (add-recipe "Thông tin chung") */
.ar-cover-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.ar-cover-row label { display: flex; flex-direction: column; gap: 5px; font-size: .8rem;
  font-weight: 700; color: var(--ink-2); }
.ar-cover-row input { box-shadow: none; padding: 8px 12px; min-width: 0; }
.ar-cover-prev { width: 64px; height: 64px; border-radius: var(--radius-sm); overflow: hidden;
  border: 1.5px solid var(--line-soft); background: var(--surface-2); flex: none; }
.ar-cover-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* destructive action (delete a saved recipe) — reads as a warning, not a primary */
.btn.ghost.danger { color: var(--accent-deep); border-color: var(--accent-deep); }
.btn.ghost.danger:hover { background: var(--accent-soft); }
.ar-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 76px 90px 32px; gap: 8px;
  align-items: center; margin-bottom: 8px; }
.ar-chip { display: flex; }
.ar-row .x, .ar-step .x { border: 1.5px solid var(--line-soft); background: var(--surface);
  border-radius: 7px; width: 30px; height: 30px; color: var(--ink-3); }
.ar-row .x:hover, .ar-step .x:hover { color: var(--accent-deep); border-color: var(--line); }
.ar-step { border: 1.5px dashed var(--line-soft); border-radius: var(--radius-sm);
  padding: 10px; margin-bottom: 10px; }
.ar-step-top { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ar-step-top select { flex: 1; min-width: 140px; }
.ar-step textarea { width: 100%; resize: vertical; }
/* AI JSON import: the 1-2-3 how-to inside the fold */
.ai-steps { margin: 10px 0 4px 22px; display: grid; gap: 5px; font-size: .9rem; color: var(--ink-2); }
.ai-steps li::marker { font-weight: 800; color: var(--accent-deep); }
.ai-gen { display: flex; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }
.ai-gen input { flex: 1; min-width: 180px; }

.ar-savebar { position: sticky; bottom: 14px; display: flex; align-items: center; gap: 14px;
  justify-content: flex-end; flex-wrap: wrap; background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--hard-lg); padding: 12px 16px; margin: 20px 0 40px; }
.auth-err { color: var(--accent-deep); font-size: .82rem; font-weight: 600; margin-top: 8px; }

/* ---------- profile page ---------- */
.pf-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 36px 0 6px; }
.pf-ava { width: 76px; height: 76px; border-radius: 50%; background: var(--mint-soft);
  border: 2.5px solid var(--mint-deep); color: var(--mint-deep); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 2rem; box-shadow: var(--hard); }
.pf-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-h4 { font-family: var(--font-display); font-size: .95rem; color: var(--accent-deep);
  margin: 14px 0 6px; display: flex; align-items: center; gap: 7px; }
.pf-h4:first-child { margin-top: 0; }
.pf-h4 .ms { font-size: 18px; color: var(--accent); }

/* ---------- footer ---------- */
.site-foot { margin-top: 70px; border-top: 2px solid var(--line); padding: 24px 0 34px;
  color: var(--ink-3); font-size: .84rem;
  background: repeating-linear-gradient(90deg, transparent 0 42px, rgba(121, 185, 164, .12) 42px 84px); }
.site-foot .container { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

/* ---------- course hero ---------- */
.course-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 30px; align-items: center; padding: 40px 0 10px; }
.course-hero h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); line-height: 1.15; color: var(--accent);
  text-shadow: 2px 2px 0 var(--mustard-soft); }
.course-hero .desc { color: var(--ink-2); margin-top: 12px; max-width: 680px; }
.teacher { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--ink-2); font-size: .92rem; }
.teacher .tava { width: 36px; height: 36px; border-radius: 50%; background: var(--mint-soft);
  border: 2px solid var(--mint-deep); display: flex; align-items: center; justify-content: center; }

/* ---------- responsive & motion ---------- */
@media (max-width: 900px) {
  /* A mask clips the focused/hovered button at the scrolling edge.  The
     icon-only compact nav is already a sufficient discoverability cue. */
  .head-nav { -webkit-mask-image: none; mask-image: none; }
  .player-grid { grid-template-columns: 1fr; }
  .playlist { max-height: 380px; }
  .calc-grid { grid-template-columns: 1fr; }
  .course-hero { grid-template-columns: 1fr; }
  .cookmode .cm-body { grid-template-columns: 1fr; }
  .rc-grid { grid-template-columns: 1fr; }
  .rc-head-cover { width: 100%; }
  .hero-lot { display: none; }
}
@media (max-width: 760px) {
  /* narrow header: icons speak for themselves, labels hide */
  .head-nav a .nav-label { display: none; }
  .head-nav a { padding: 7px 11px; }
  .head-nav a .ms { font-size: 21px; }
  .head-inner { gap: 12px; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .hero { padding-top: 38px; padding-bottom: 24px; }
  .amb, .burst { display: none; }
  .qa-answer { margin-left: 18px; }
  .qa-a > div > .qa-photos { margin-left: 18px; }
  .lesson-nav { flex-direction: column; }
  .card.ticket { padding-left: 56px; }
}
/* ---------- print: recipes, materials & tables on paper ---------- */
@media print {
  .site-head, .site-foot, .timer-fab, .shoplist-fab, .tool-panel, .user-panel,
  .player-grid, .attach-row, .lesson-nav, .crumb, .btn, .shop-add, .qa-tools,
  .mat-tools, .tab-bar, .searchbox-wrap, .hero-lot, .burst, .amb, .notes-card textarea:placeholder-shown { display: none !important; }
  body { background: #fff; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .card, .panel, .mat-card, .qa-item, .tab-panel, .stat, .callout { box-shadow: none; }
  .tab-panel { display: block !important; border: none; padding: 0; }
  .pdf-fold iframe { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- audit page (sổ tay bếp trưởng) ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px; margin: 16px 0 8px; }
.stat-tile { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.stat-tile .st-info { display: flex; flex-direction: column; min-width: 0; }
.stat-tile .st-info b { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.15;
  font-variant-numeric: tabular-nums; }
.stat-tile .st-info span { font-size: .82rem; color: var(--ink-2); }
.stat-tile .st-sub { font-size: .74rem !important; color: var(--accent-deep) !important; font-weight: 700; }
.copy-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.copy-card .tp-body .hint { margin-bottom: 10px; }
.copy-row { display: flex; gap: 8px; flex-wrap: wrap; }
.audit-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0 14px; }
.a-ico { width: 32px; height: 32px; object-fit: contain; display: block;
  filter: drop-shadow(1px 1px 0 rgba(71, 49, 31, .15)); }
.a-miss { color: var(--accent-deep); font-weight: 700; font-size: 1.05rem; }
.a-alias { font-size: .8rem; color: var(--ink-2); }
.av-lot { width: 44px; height: 44px; display: inline-block; }

/* ---------- manual icon picker (icons.html) ---------- */
.ai-list { display: flex; flex-direction: column; }
.ai-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-top: 1.5px dashed var(--line-soft); }
.ai-row:first-child { border-top: none; }
.ai-cur { width: 44px; height: 44px; flex: 0 0 auto; border: 1.5px solid var(--line);
  border-radius: 10px; background: var(--surface-2); display: flex; align-items: center;
  justify-content: center; overflow: hidden; }
.ai-cur-img { width: 34px; height: 34px; object-fit: contain; }
.ai-miss { color: var(--accent-deep); font-weight: 700; }
.ai-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ai-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-kind { font-size: .74rem; color: var(--ink-3); }
.ai-src { flex: 0 0 auto; }
.ai-pick { flex: 0 0 auto; }
.icon-modal { position: fixed; inset: 0; z-index: 120; background: rgba(38, 24, 12, .55);
  display: flex; align-items: flex-end; justify-content: center; }
.icon-modal[hidden] { display: none; }
.im-card { background: var(--surface); width: min(760px, 100%); max-height: 92vh;
  border: 2px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(38, 24, 12, .3);
  display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 640px) { .icon-modal { align-items: center; } .im-card { border-radius: 18px; } }
.im-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  border-bottom: 2px solid var(--line); background: var(--mustard-soft); }
.im-target { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-cur img { width: 24px; height: 24px; object-fit: contain; vertical-align: middle; margin-left: 6px; }
.im-x { border: none; background: none; font-size: 1.3rem; cursor: pointer; color: var(--ink-2);
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; }
.im-x:hover { background: var(--surface-2); }
.im-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px;
  border-bottom: 1.5px dashed var(--line-soft); }
.im-tools .qa-search { flex: 1; min-width: 140px; }
.im-toggle { font-size: .82rem; color: var(--ink-2); display: flex; align-items: center; gap: 5px;
  white-space: nowrap; cursor: pointer; }
.im-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px;
  padding: 14px 16px; overflow-y: auto; }
.im-ico { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px;
  border: 1.5px solid transparent; border-radius: 10px; background: var(--surface-2); cursor: pointer;
  transition: transform .12s, border-color .12s, box-shadow .12s; }
.im-ico:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 3px 3px 0 rgba(191, 74, 51, .25); }
.im-ico img { width: 42px; height: 42px; object-fit: contain; }
.im-nm { font-size: .62rem; color: var(--ink-3); max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.im-lot { position: relative; }
.im-lotbadge { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--mint-deep); background: var(--mint-soft); border-radius: 8px; }
/* click-to-preview: the badge/thumb becomes a live lottie player */
.im-lotbadge svg, .up-thumb svg { width: 100% !important; height: 100% !important; display: block; }
.im-ico.previewing { border-color: var(--accent); box-shadow: 3px 3px 0 rgba(191, 74, 51, .25); }
.im-ico.previewing .im-nm { color: var(--accent-deep); font-weight: 700; }
.im-count { padding: 4px 16px 12px; }

/* upload panel + rebuild */
.page-head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head-row .page-title { margin-right: auto; }
.apply-status { font-size: .82rem; font-weight: 700; padding: 4px 12px; border-radius: 99px;
  border: 1.5px solid var(--line); white-space: nowrap; }
.apply-status.dirty { background: var(--mustard-soft); color: var(--accent-deep); }
.apply-status.working { background: var(--mint-soft); color: var(--mint-deep); }
.apply-status.done { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.apply-status.err { background: var(--accent-soft); color: var(--accent-deep); }
#btn-rebuild .ms { animation: none; }
#btn-rebuild:disabled { opacity: .8; cursor: progress; }
#btn-rebuild:disabled .ms { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.upload-panel { margin-bottom: 16px; }
.upload-panel > summary { cursor: pointer; padding: 13px 18px; font-weight: 700; font-family: var(--font-display);
  list-style: none; display: flex; align-items: center; gap: 8px; }
.upload-panel > summary::-webkit-details-marker { display: none; }
.upload-panel > summary::after { content: "▾"; margin-left: auto; transition: transform .2s; }
.upload-panel[open] > summary::after { transform: rotate(180deg); }
.upload-panel > summary .hint { font-weight: 400; font-family: var(--font-body); }
.up-drop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px;
  border: 2px dashed var(--line-soft); border-radius: var(--radius-sm); background: var(--surface-2); }
.up-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.up-stage { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 12px; }
.up-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1.5px solid var(--line);
  border-radius: 10px; background: var(--surface); }
.up-thumb { width: 40px; height: 40px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line-soft); border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.up-thumb img { width: 32px; height: 32px; object-fit: contain; }
.up-name { flex: 1; min-width: 0; box-shadow: none; }
.up-rm { border: none; background: none; color: var(--ink-3); cursor: pointer; font-size: 1rem; flex: 0 0 auto; }
.up-rm:hover { color: var(--accent); }
.up-commit { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px;
  padding-top: 14px; border-top: 1.5px dashed var(--line-soft); }
