/* Kho TUT · cùng bộ nhận diện với landing Minh Duy Media: trời sáng, giấy kraft dán băng keo, cobalt + vàng mù tạt. */
:root {
  --sky: #d9e9fb; --sky-2: #eef5fe;
  --paper: #ead6aa; --paper-dot: rgba(120, 88, 30, .13);
  --ink: #13265e; --cobalt: #2347c8; --mustard: #f4c22c;
  --muted: #4a5a82; --card: #ffffff; --butter: #fff3c9; --peri: #e3e9ff; --mint: #e1f4e4;
  --coral: #ef6a5b; --ok: #1f9a58;
  --line: rgba(19, 38, 94, .16); --tape: rgba(244, 194, 44, .78); --shadow: rgba(19, 38, 94, .18);
  --f-display: "Lexend", "Be Vietnam Pro", system-ui, sans-serif;
  --f-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --f-hand: "Patrick Hand", "Be Vietnam Pro", cursive;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--sky) 0, var(--sky-2) 560px, var(--sky-2) 100%); background-color: var(--sky-2);
  color: var(--ink); font: 400 1rem/1.65 var(--f-body); -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap.narrow { max-width: 780px; }
h1, h2, h3 { font-family: var(--f-display); color: var(--ink); margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--cobalt); }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { font: 500 .88em var(--f-mono); background: var(--peri); color: var(--ink); padding: .1em .4em; border-radius: 5px; overflow-wrap: anywhere; }

/* thanh trên */
.top { padding-block: 16px; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 800 1.02rem var(--f-display); letter-spacing: .04em; color: var(--cobalt); text-decoration: none; }
.brand svg { width: 26px; height: 26px; flex: none; }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a { font: 600 .88rem var(--f-display); color: var(--ink); text-decoration: none; padding: 7px 12px; border-radius: 999px; }
.topnav a:hover { background: rgba(255, 255, 255, .7); }
.topnav a[aria-current] { background: var(--card); box-shadow: inset 0 0 0 2px var(--cobalt); color: var(--cobalt); }

/* nút */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .96rem var(--f-display); text-decoration: none; cursor: pointer; white-space: nowrap;
  padding: 12px 22px; border-radius: 999px; border: 2px solid var(--ink); transition: transform .15s ease, box-shadow .15s ease;
}
.btn-sm { padding: 8px 16px; font-size: .86rem; }
.btn-main { background: var(--mustard); color: #13265e; border-color: #13265e; box-shadow: 0 4px 0 #13265e; }
.btn-main::after { content: ""; position: absolute; inset: 3px; border-radius: inherit; border: 1.5px dashed rgba(19, 38, 94, .45); pointer-events: none; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn:hover { transform: translateY(-2px); }
.btn-main:hover { box-shadow: 0 6px 0 #13265e; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #13265e; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--cobalt); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* giấy kraft */
.note-wrap { position: relative; filter: drop-shadow(0 10px 18px var(--shadow)); }
.note {
  background-color: var(--paper); background-image: radial-gradient(var(--paper-dot) 1px, transparent 1.2px); background-size: 7px 7px;
  padding: 40px clamp(20px, 4vw, 40px) 32px;
  clip-path: polygon(0 2.2%, 4% .4%, 9% 1.8%, 15% .2%, 22% 2%, 30% 0, 38% 1.4%, 47% .2%, 55% 1.8%, 63% 0, 72% 1.5%, 80% .3%, 88% 1.9%, 95% .2%, 100% 1.6%, 100% 98.2%, 96% 100%, 90% 98.6%, 82% 99.8%, 74% 98.3%, 66% 100%, 58% 98.8%, 50% 99.8%, 42% 98.3%, 34% 99.9%, 26% 98.5%, 18% 100%, 10% 98.6%, 4% 99.8%, 0 98.4%);
}
.tape { position: absolute; top: -12px; width: 104px; height: 28px; background: var(--tape); z-index: 2; }
.tape.t1 { left: 22px; transform: rotate(-4deg); }
.tape.t2 { right: 36px; transform: rotate(5deg); }
.eyebrow { font: 600 .76rem/1.4 var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.note h1 { font-weight: 800; font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.12; margin-top: 12px; letter-spacing: -.01em; }
.hl { color: var(--cobalt); background: linear-gradient(transparent 58%, var(--mustard) 58%, var(--mustard) 92%, transparent 92%); padding: 0 .06em; }
.lede { margin-top: 14px; font-size: 1.04rem; max-width: 60ch; }

/* lượt xem + huy hiệu nền tảng */
.eye { display: inline-flex; align-items: center; gap: 6px; font: 600 .82rem var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.eye svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.eye.big { font-size: .95rem; color: var(--ink); background: var(--card); border: 2px solid var(--ink); border-radius: 999px; padding: 5px 12px 5px 10px; box-shadow: 0 3px 0 var(--ink); }
.eye.big svg { width: 20px; height: 20px; color: var(--cobalt); }
.eye.big b { font-weight: 700; }
.pf { display: inline-flex; align-items: center; gap: 8px; font: 600 .8rem var(--f-display); color: var(--ink); }
.pf-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; border: 2px solid #13265e; flex: none; }
.pf-ico svg { width: 15px; height: 15px; }

/* đầu trang kho */
.tut-hero { padding-block: 18px 30px; }
.tut-hero .wrap { display: grid; gap: 22px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 20px; font: 500 .92rem var(--f-body); color: var(--muted); }
.stats b { font: 700 1.05rem var(--f-display); color: var(--ink); margin-right: 2px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 2px solid var(--ink); border-radius: 999px; padding: 6px 6px 6px 18px; box-shadow: 0 5px 0 var(--peri); max-width: 680px; }
.search svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; font: 500 1rem var(--f-body); color: var(--ink); background: none; padding: 8px 0; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

/* bộ lọc nền tảng */
.tut-body { padding-block: 6px 56px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; margin-bottom: 14px; scrollbar-width: thin; }
.chip { display: inline-flex; align-items: center; gap: 8px; flex: none; font: 600 .86rem var(--f-display); color: var(--ink); text-decoration: none; background: var(--card); border: 2px dashed var(--line); border-radius: 999px; padding: 6px 14px 6px 8px; }
.chip:first-child { padding-left: 14px; }
.chip .pf-ico { width: 22px; height: 22px; border-radius: 7px; border-width: 1.5px; }
.chip .pf-ico svg { width: 13px; height: 13px; }
.chip small { font: 600 .74rem var(--f-mono); color: var(--muted); }
.chip:hover { border-color: var(--cobalt); }
.chip.on { background: var(--ink); color: #fff; border: 2px solid var(--ink); }
.chip.on small { color: var(--mustard); }

.list-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.list-grid.solo { grid-template-columns: minmax(0, 1fr); }
.result-note { margin-bottom: 14px; color: var(--muted); }

/* thẻ bài */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.list-grid.solo .cards, .cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; box-shadow: 0 6px 0 var(--peri); transition: transform .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-4px) rotate(-.3deg); box-shadow: 0 9px 0 var(--mustard); }
.card-media { display: block; text-decoration: none; aspect-ratio: 16 / 9; background: var(--peri); border-bottom: 2px solid var(--ink); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.ph { height: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; padding: 16px 18px; background-color: var(--paper); background-image: radial-gradient(var(--paper-dot) 1px, transparent 1.2px); background-size: 7px 7px; }
.ph-ico { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; border: 2px solid #13265e; box-shadow: 0 4px 0 #13265e; transform: rotate(-6deg); background: var(--cobalt); }
.ph-ico svg { width: 28px; height: 28px; }
.ph[data-pf="facebook"] .ph-ico { background: #1877f2; }
.ph[data-pf="tiktok"] .ph-ico, .ph[data-pf="threads"] .ph-ico { background: #111; }
.ph[data-pf="instagram"] .ph-ico { background: linear-gradient(45deg, #f58529, #dd2a7b 55%, #8134af); }
.ph[data-pf="youtube"] .ph-ico { background: #ff0000; }
.ph[data-pf="zalo"] .ph-ico { background: #0068ff; }
.ph-t { font: 400 1.3rem/1.2 var(--f-hand); color: var(--ink); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card-body { padding: 14px 16px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pin { font: 700 .66rem var(--f-display); letter-spacing: .1em; text-transform: uppercase; background: var(--mustard); color: #13265e; padding: 3px 8px; border-radius: 4px; transform: rotate(2deg); }
.card h3 { font-size: 1.08rem; line-height: 1.32; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card h3 a:hover { color: var(--cobalt); }
.card p { font-size: .9rem; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 10px; border-top: 1.5px dashed var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; font: 500 .78rem var(--f-mono); color: var(--muted); }

/* cột phụ */
.side { display: grid; gap: 18px; position: sticky; top: 16px; }
.rank { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 16px 16px 8px; }
.rank h2 { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; }
.rank ol { list-style: none; margin: 0; padding: 0; }
.rank li + li { border-top: 1.5px dashed var(--line); }
.rank a { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 2px 10px; padding: 10px 0; text-decoration: none; color: var(--ink); }
.rk { grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--mustard); border: 2px solid #13265e; font: 800 .78rem var(--f-display); }
.rt { font: 600 .9rem/1.35 var(--f-display); }
.rank a:hover .rt { color: var(--cobalt); }
.rank .eye { font-size: .74rem; }
.rank .eye svg { width: 14px; height: 14px; }
.ask, .empty { background: var(--butter); border: 2px dashed rgba(19, 38, 94, .3); border-radius: 16px; padding: 18px; display: grid; gap: 8px; justify-items: start; }
.ask p, .empty p { color: var(--muted); font-size: .92rem; }
.empty { padding: 28px; }
.empty b { font: 700 1.15rem var(--f-display); }

/* bài viết */
.post-head { padding-block: 8px 28px; }
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; font: 600 .84rem var(--f-display); margin-bottom: 22px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--cobalt); }
.post-head h1 { font-size: clamp(1.7rem, 4.6vw, 2.6rem); line-height: 1.16; margin-top: 14px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 20px; font: 500 .86rem var(--f-body); color: var(--muted); }
.post-main { display: grid; gap: 26px; padding-bottom: 48px; }
.cover { margin: 0; border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; box-shadow: 0 8px 0 var(--peri); background: var(--card); }
.cover img { width: 100%; }
.toc { background: var(--card); border: 2px dashed var(--line); border-radius: 14px; padding: 16px 20px; }
.toc b { font: 700 .76rem var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.toc ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.toc a { font-weight: 600; text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.prose { background: var(--card); border: 2px solid var(--ink); border-radius: 18px; padding: clamp(20px, 4vw, 36px); font-size: 1.04rem; line-height: 1.75; display: grid; gap: 18px; min-width: 0; overflow-wrap: break-word; word-break: break-word; }
.prose > * { min-width: 0; }
.prose p, .prose li { overflow-wrap: break-word; word-break: break-word; }
.prose h2 { font-size: 1.4rem; line-height: 1.25; margin-top: 12px; padding-top: 18px; border-top: 2px dashed var(--line); scroll-margin-top: 16px; }
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { font-size: 1.12rem; line-height: 1.3; margin-top: 4px; scroll-margin-top: 16px; }
.prose ul, .prose ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.prose ul li::marker { color: var(--cobalt); }
.prose ol.steps { list-style: none; padding: 0; counter-reset: s; gap: 12px; }
.prose ol.steps li { counter-increment: s; position: relative; padding: 12px 14px 12px 54px; background: var(--sky-2); border-radius: 12px; border: 1.5px solid var(--line); }
.prose ol.steps li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--mustard); border: 2px solid #13265e; font: 800 .86rem var(--f-display); color: #13265e; }
.prose strong { font-weight: 700; background: linear-gradient(transparent 62%, rgba(244, 194, 44, .45) 62%); }
.prose a { overflow-wrap: anywhere; text-underline-offset: 3px; }
.prose hr { border: 0; border-top: 2px dashed var(--line); margin: 6px 0; width: 100%; }
.prose figure { margin: 0; display: grid; gap: 8px; justify-items: center; }
.prose figure img { border-radius: 12px; border: 1.5px solid var(--line); max-height: 80vh; width: auto; }
.prose figcaption { font: 400 1.05rem var(--f-hand); color: var(--muted); text-align: center; }
.prose .note { clip-path: none; background-color: var(--butter); background-image: none; border-left: 5px solid var(--mustard); border-radius: 10px; padding: 14px 16px; display: grid; gap: 4px; }
.prose .note b { font: 700 .74rem var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: #8a6400; }
.code { position: relative; background: #0d1838; border-radius: 12px; border: 2px solid #13265e; }
.code pre { margin: 0; padding: 16px 16px 14px; overflow-x: auto; }
.code code { background: none; color: #f2f5ff; padding: 0; font-size: .86rem; line-height: 1.6; white-space: pre; overflow-wrap: normal; }
.code-copy { position: absolute; top: 8px; right: 8px; font: 600 .74rem var(--f-display); color: #13265e; background: var(--mustard); border: 0; border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; border: 2px solid var(--ink); background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.linkcard { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; text-decoration: none; background: var(--peri); border: 2px solid var(--cobalt); border-radius: 12px; padding: 12px 16px; transition: transform .15s ease; }
.linkcard:hover { transform: translateY(-2px); }
.lc-host { font: 700 .98rem var(--f-display); color: var(--ink); }
.lc-url { font: 500 .78rem var(--f-mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 1; }
.lc-go { grid-row: 1 / span 2; grid-column: 2; font: 700 1.1rem var(--f-display); color: var(--cobalt); }

.attach { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; }
.attach h2 { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; padding: 12px 18px; background: var(--butter); border-bottom: 2px solid var(--ink); }
.attach ul { list-style: none; margin: 0; padding: 0; }
.attach li + li { border-top: 1.5px dashed var(--line); }
.attach a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; padding: 12px 18px; text-decoration: none; color: var(--ink); }
.attach a:hover { background: var(--sky-2); }
.at-name { font: 600 .95rem var(--f-display); }
.at-url { font: 500 .76rem var(--f-mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach a > span[aria-hidden] { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--cobalt); font-weight: 700; }

.share, .help { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 20px; border-radius: 16px; padding: 18px 20px; }
.share { background: var(--peri); border: 2px solid var(--cobalt); }
.share > div:first-child, .help > div:first-child { display: grid; gap: 4px; }
.share b, .help b { font: 700 1.02rem var(--f-display); }
.help { background: var(--butter); border: 2px dashed rgba(19, 38, 94, .3); }
.help p { color: var(--muted); font-size: .92rem; max-width: 46ch; }
.share-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.related { padding-block: 10px 56px; }
.related h2 { font-size: 1.4rem; margin-bottom: 18px; }
.preview-bar { background: var(--mustard); color: #13265e; text-align: center; font: 600 .9rem var(--f-display); padding: 10px 16px; }
.nf { padding-block: 40px 80px; max-width: 720px; }
.nf .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

/* chân trang */
.foot { border-top: 2px dashed var(--line); padding-block: 26px calc(26px + env(safe-area-inset-bottom, 0px)); background: rgba(255, 255, 255, .45); }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.foot p { color: var(--muted); font-size: .88rem; margin-top: 6px; }
.foot-cta { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- quản trị ---------- */
.p-admin .topnav { display: none; }
.admin { padding-block: 10px 60px; }
.auth { max-width: 420px; margin: 30px auto; background: var(--card); border: 2px solid var(--ink); border-radius: 18px; padding: 28px; display: grid; gap: 14px; box-shadow: 0 8px 0 var(--peri); }
.auth h1 { font-size: 1.5rem; }
.auth p { color: var(--muted); font-size: .92rem; }
.auth label, .f { display: grid; gap: 6px; font: 600 .9rem var(--f-display); }
.f small, .f-l small { font: 400 .8rem var(--f-body); color: var(--muted); }
.f-l { font: 600 .9rem var(--f-display); display: grid; gap: 2px; }
input:not([type=checkbox]):not([type=hidden]):not([type=file]), textarea, select {
  width: 100%; font: 500 .98rem var(--f-body); color: var(--ink); background: var(--card);
  border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: 0;
}
input:focus, textarea:focus, select:focus { border-color: var(--cobalt); }
textarea { resize: vertical; line-height: 1.6; }
#f-content { font: 400 .95rem/1.7 var(--f-mono); min-height: 420px; }
#f-content.drop { border-color: var(--cobalt); border-style: dashed; background: var(--peri); }
.msg { border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.msg.ok { background: var(--mint); color: #145c37; }
.msg.bad { background: #fde3df; color: #9b2a1c; }
.admin-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.admin-head h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
.admin-head .stats { margin-top: 8px; }
.admin-head-r { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.tbl { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px 16px; padding: 14px 18px; }
.row + .row { border-top: 1.5px dashed var(--line); }
.row-main { display: grid; gap: 2px; min-width: 0; }
.row-t { font: 600 1rem var(--f-display); color: var(--ink); text-decoration: none; }
.row-t:hover { color: var(--cobalt); }
.row-m { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.row-m code { font-size: .74rem; }
.row-act { display: flex; gap: 14px; font: 600 .86rem var(--f-display); }
.row-act a { text-decoration: none; }
.tag { font: 700 .66rem var(--f-display); letter-spacing: .08em; text-transform: uppercase; background: var(--mustard); color: #13265e; padding: 2px 7px; border-radius: 4px; }
.tag.draft { background: var(--peri); color: var(--cobalt); }
.admin-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; font: 600 .9rem var(--f-display); }
.admin-bar a { text-decoration: none; }
.admin-bar-r { display: flex; align-items: center; gap: 16px; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; margin-top: 14px; }
.ed-main { display: grid; gap: 18px; background: var(--card); border: 2px solid var(--ink); border-radius: 18px; padding: 20px; }
.ed-side { display: grid; gap: 14px; position: sticky; top: 14px; }
.box { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 16px; display: grid; gap: 12px; }
.box.danger { border-style: dashed; border-color: var(--line); }
.check { display: flex; align-items: center; gap: 8px; font: 500 .92rem var(--f-body); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--cobalt); }
.f-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.seg { display: inline-flex; background: var(--sky-2); border-radius: 999px; padding: 3px; border: 1.5px solid var(--line); }
.seg button { border: 0; background: none; font: 600 .82rem var(--f-display); color: var(--muted); padding: 5px 14px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--ink); color: #fff; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; }
.tools.off { opacity: .4; pointer-events: none; }
.tools button { font: 600 .82rem var(--f-display); color: var(--ink); background: var(--sky-2); border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 11px; cursor: pointer; }
.tools button:hover { border-color: var(--cobalt); color: var(--cobalt); }
.tools .t-img { background: var(--mustard); border-color: #13265e; color: #13265e; }
.preview { border-style: dashed; min-height: 420px; }
.muted { color: var(--muted); }
.cheat { font-size: .86rem; color: var(--muted); }
.cheat summary { cursor: pointer; font: 600 .86rem var(--f-display); color: var(--cobalt); }
.cheat ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.slug { display: flex; align-items: center; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--sky-2); }
.slug span { font: 500 .8rem var(--f-mono); color: var(--muted); padding-left: 10px; white-space: nowrap; }
.slug input { border: 0 !important; border-radius: 0 !important; font-family: var(--f-mono) !important; font-size: .86rem !important; padding-left: 2px !important; }
.cover-pick { aspect-ratio: 16 / 9; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; overflow: hidden; cursor: pointer; background: var(--sky-2); color: var(--muted); font-size: .86rem; }
.cover-pick img { width: 100%; height: 100%; object-fit: cover; }
.cover-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; font: 600 .9rem var(--f-display); padding: 10px 18px; border-radius: 999px; transition: opacity .2s ease, transform .2s ease; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #9b2a1c; }

/* ---------- màn hình nhỏ ---------- */
@media (max-width: 900px) {
  .list-grid, .editor { grid-template-columns: minmax(0, 1fr); }
  .list-grid.solo .cards, .cards.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side, .ed-side { position: static; }
  .ed-side { order: -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-side .box:first-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .cards, .list-grid.solo .cards, .cards.three { grid-template-columns: minmax(0, 1fr); }
  .tape { width: 78px; height: 24px; }
  .note { padding-top: 34px; }
  .topnav a { padding: 6px 9px; font-size: .82rem; }
  .search { padding-left: 14px; }
  .search .btn { padding-inline: 14px; }
  .prose { font-size: 1rem; border-radius: 14px; }
  .prose ol.steps li { padding-left: 48px; }
  .share .btn, .help .btn { flex: 1 1 auto; }
  .row { grid-template-columns: auto minmax(0, 1fr); }
  .row > .eye { grid-column: 2; }
  .row-act { grid-column: 1 / -1; }
  .ed-side { grid-template-columns: minmax(0, 1fr); }
  .ed-main { padding: 14px; }
  #f-content { min-height: 340px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- quản trị chung (menu + tổng quan) ---------- */
.p-admin .top { display: none; }
.qt-nav { position: sticky; top: 0; z-index: 40; background: var(--ink); color: #fff; box-shadow: 0 4px 0 var(--mustard); }
.qt-nav-in { max-width: 1080px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.qt-brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font: 700 .95rem var(--f-display); }
.qt-brand b { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--mustard); color: var(--ink); font: 800 .78rem var(--f-display); }
.qt-links { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.qt-links a { color: #dfe6ff; text-decoration: none; font: 600 .86rem var(--f-display); padding: 7px 12px; border-radius: 999px; white-space: nowrap; }
.qt-links a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.qt-links a[aria-current] { background: #fff; color: var(--ink); }
.qt-links a.qt-new { background: var(--mustard); color: var(--ink); }
.qt-right { display: flex; align-items: center; gap: 12px; }
.qt-right a, .qt-right button { color: #a9b6dd; font: 600 .82rem var(--f-display); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }
.qt-right a:hover, .qt-right button:hover { color: #fff; }
.qt-right form { margin: 0; }
.okc { color: var(--ok); font-weight: 700; } .badc { color: #9b2a1c; font-weight: 700; }
.qt-alert { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: center; background: #fde3df; color: #9b2a1c; border: 2px solid #9b2a1c; border-radius: 14px; padding: 14px 18px; text-decoration: none; margin-bottom: 18px; }
.qt-alert span { font: 700 .88rem var(--f-display); }
.qt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.qt-card { display: grid; gap: 2px; background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 16px; text-decoration: none; color: var(--ink); box-shadow: 0 5px 0 var(--peri); transition: transform .15s ease; }
.qt-card:hover { transform: translateY(-3px); }
.qt-card span { font: 600 .72rem var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.qt-card b { font: 800 1.6rem var(--f-display); color: var(--cobalt); font-variant-numeric: tabular-nums; }
.qt-card small { font-size: .8rem; color: var(--muted); }
.qt-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.qt-box { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 16px 18px; display: grid; gap: 4px; align-content: start; }
.qt-box-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.qt-box-h h2 { font-size: 1rem; }
.qt-box-h a { font: 600 .82rem var(--f-display); text-decoration: none; }
.qt-row { display: flex; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; padding: 9px 0; border-top: 1.5px dashed var(--line); font-size: .9rem; }
.qt-row a { font-weight: 600; text-decoration: none; color: var(--ink); }
.qt-row a:hover { color: var(--cobalt); }
@media (max-width: 600px) {
  .qt-nav { position: static; }
  .qt-links { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .qt-right { margin-left: auto; }
}
.stat-link { color: inherit; text-decoration: none; border-bottom: 1.5px dashed currentColor; }
.stat-link:hover { color: var(--cobalt); }
.admin .chips { margin-bottom: 4px; }

/* ---------- TUT trả phí: khung mở khoá ---------- */
.paywall { position: relative; margin: 8px 0 28px; }
.pw-ghost { display: grid; gap: 12px; padding: 4px 0 18px; filter: blur(5px); opacity: .5; user-select: none; pointer-events: none; }
.pw-ghost i { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--line), rgba(19, 38, 94, .08)); }
.pw-ghost i:nth-child(2) { width: 92%; } .pw-ghost i:nth-child(3) { width: 78%; } .pw-ghost i:nth-child(4) { width: 86%; } .pw-ghost i:nth-child(5) { width: 60%; }
.pw-box { position: relative; margin-top: -48px; background: var(--butter); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 0 7px 0 var(--ink); padding: 24px 22px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.pw-ico { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; background: var(--card); border: 2px solid var(--ink); }
.pw-box h2 { font-size: 1.3rem; }
.pw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .92rem; color: var(--muted); text-align: left; }
.pw-list li { position: relative; padding-left: 24px; }
.pw-list li::before { content: "✓"; position: absolute; left: 0; color: var(--ok, #1f9a58); font-weight: 800; }
.pw-buy { font-size: 1.05rem; padding: 13px 28px; }
.pw-buy[disabled] { opacity: .7; cursor: progress; }
.pw-msg { font-size: .9rem; background: var(--card); border-radius: 10px; padding: 8px 12px; }
.pw-msg.bad { color: #9b2a1c; }
.pw-note { font-size: .8rem; color: var(--muted); }
.unlocked-tag { display: inline-block; font: 700 .8rem var(--f-display); color: #145c37; background: #e1f4e4; border-radius: 999px; padding: 4px 12px; margin-bottom: 14px; }
.lock-mark { margin: 18px 0; padding: 10px 14px; border: 2px dashed var(--ink); border-radius: 12px; background: var(--butter); font: 700 .88rem var(--f-display); text-align: center; }
.pin.lock { background: var(--butter); color: #13265e; text-transform: none; letter-spacing: 0; }
.lock-help { font-size: .8rem; line-height: 1.5; margin-top: 8px; }
/* Kho TUT quản trị: người đã mua bài trả phí */
.buy-sum { display: grid; gap: 2px; padding: 10px 12px; margin-bottom: 12px; border-radius: 12px; background: var(--mint); color: var(--ink); text-decoration: none; }
.buy-sum span { font: 600 .72rem var(--f-display); text-transform: uppercase; letter-spacing: .06em; color: #145c37; }
.buy-sum b { font: 800 1.05rem var(--f-display); }
.buy-sum small { font-size: .78rem; color: var(--cobalt); font-weight: 600; }
.buy-sum:hover small { text-decoration: underline; }
.buyers-panel { margin-top: 26px; background: var(--card); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 0 7px 0 var(--peri); padding: 20px 22px; display: grid; gap: 12px; scroll-margin-top: 16px; }
.bp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.bp-head h2 { font-size: 1.25rem; margin-right: auto; }
.bp-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.bp-stats span { font-size: .82rem; color: var(--muted); background: var(--sky-2); border-radius: 999px; padding: 4px 12px; }
.bp-stats b { color: var(--ink); font-family: var(--f-display); }
.bp-q { width: 200px; }
.bp-help { font-size: .84rem; }
.bp-empty { padding: 16px; background: var(--butter); border-radius: 12px; color: var(--muted); }
.bp-table { display: grid; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.bp-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) 1fr .8fr 1fr minmax(260px, 1.6fr); gap: 6px 14px; align-items: center; padding: 10px 14px; }
.bp-row + .bp-row { border-top: 1px solid var(--line); }
.bp-row:not(.bp-th):hover { background: #f7f9ff; }
.bp-th { background: var(--sky-2); font: 700 .74rem var(--f-display); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.bp-code { display: grid; gap: 2px; }
.bp-code code { font-size: .86rem; justify-self: start; }
.bp-new { font-size: .72rem; color: #8a4a00; }
.bp-amt { font-weight: 700; }
.bp-dev { display: flex; align-items: center; gap: 8px; font: 600 .82rem var(--f-mono); }
.dots { display: inline-flex; gap: 4px; }
.dots b { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--card); }
.dots b.on { background: var(--ok); border-color: var(--ok); }
.bp-act { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.bp-act .btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.bp-out { grid-column: 1 / -1; display: grid; gap: 4px; font-size: .84rem; color: #145c37; }
.bp-out input { width: 100%; font: 500 .8rem var(--f-mono) !important; background: var(--mint) !important; }
.bp-out em { font-style: normal; font-weight: 600; }
@media (max-width: 860px) {
  .bp-th { display: none; }
  .bp-row { grid-template-columns: 1fr 1fr; }
  .bp-code, .bp-act { grid-column: 1 / -1; }
  .bp-act { justify-content: flex-start; }
  .bp-date::before, .bp-amt::before, .bp-dev::before { content: attr(data-l) ": "; font: 500 .74rem var(--f-body); color: var(--muted); }
}
.tut-note { margin-top: 12px; max-width: 62ch; font-size: .9rem; color: #8a4a00; background: rgba(255, 243, 201, .85); border-left: 4px solid var(--mustard); border-radius: 8px; padding: 8px 12px; }
.tut-note b { color: #8a4a00; }
