/* Trang riêng giáo viên (/app/t/<slug>) + trình dựng (/app/page).
   Mẫu = [data-tp-theme] → biến CSS. Thêm mẫu: thêm 1 khối biến dưới đây + id trong api/lib/tpage_clean.php + js/tpage/render.js. */

body[data-view="tpage"] .app-header, body[data-view="tpage"] .tabbar { display: none; }
body[data-view="tpage"] .app-main { padding: 0 !important; }

.tp {
  --tp-bg: #fff8f0; --tp-surface: #ffffff; --tp-ink: #22163a; --tp-muted: #6f6488; --tp-line: #f0dccb;
  --tp-accent: #ff6b2c; --tp-accent-ink: #ffffff; --tp-soft: color-mix(in srgb, var(--tp-accent) 12%, var(--tp-surface));
  --tp-hero: linear-gradient(135deg, #ffd9bf, #ffb38a 55%, #e9dcff);
  --tp-r: 18px; --tp-shadow: 0 1px 2px rgba(0,0,0,.05), 0 10px 28px -14px rgba(34,22,58,.28);
  --tp-font: var(--font); --tp-head: var(--font);
  background: var(--tp-bg); color: var(--tp-ink); font-family: var(--tp-font); min-height: 100dvh;
  display: flex; flex-direction: column; overflow-x: clip;
}
.tp[data-tp-theme="lopxanh"] { --tp-bg: #eef8f1; --tp-ink: #12352a; --tp-muted: #4d6b5e; --tp-line: #cfe8d9; --tp-accent: #1f8a5b; --tp-hero: linear-gradient(135deg, #bfe8cf, #6cc49a 60%, #2f8f65); }
.tp[data-tp-theme="hoanghon"] { --tp-bg: #fff1e6; --tp-ink: #3b1d10; --tp-muted: #80513a; --tp-line: #f6d4bd; --tp-accent: #e8590c; --tp-hero: linear-gradient(135deg, #ffb26b, #ff7b54 50%, #c2417a); }
.tp[data-tp-theme="toigian"] { --tp-bg: #ffffff; --tp-surface: #ffffff; --tp-ink: #111111; --tp-muted: #555555; --tp-line: #e4e4e4; --tp-accent: #111111; --tp-hero: linear-gradient(135deg, #f2f2f2, #d9d9d9); --tp-r: 6px; --tp-shadow: none; }
.tp[data-tp-theme="toigian"] .tp-card, .tp[data-tp-theme="toigian"] .tp-link, .tp[data-tp-theme="toigian"] .tp-stat, .tp[data-tp-theme="toigian"] .tp-sec { border: 1px solid var(--tp-line); }
.tp[data-tp-theme="kraft"] { --tp-bg: #efe2c8; --tp-surface: #fbf4e6; --tp-ink: #3a2a18; --tp-muted: #6e5638; --tp-line: #d9c39d; --tp-accent: #8a5a2b; --tp-hero: repeating-linear-gradient(45deg, #d8bf93 0 10px, #d2b78a 10px 20px); --tp-shadow: 0 2px 0 #d2b98c; }
.tp[data-tp-theme="demsao"] { --tp-bg: #141a33; --tp-surface: #1e2546; --tp-ink: #f2f4ff; --tp-muted: #b5bce0; --tp-line: #323b66; --tp-accent: #ffc857; --tp-accent-ink: #1a1530; --tp-hero: radial-gradient(2px 2px at 20% 30%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 70% 20%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 45% 65%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 85% 70%, #fff 50%, transparent 51%), linear-gradient(160deg, #27306b, #141a33 70%); --tp-shadow: 0 10px 28px -14px rgba(0,0,0,.6); }
.tp[data-tp-font="playfair"] { --tp-head: "HV Playfair", Georgia, serif; }
.tp[data-tp-font="patrick"] { --tp-head: "HV Patrick Hand", var(--font); --tp-font: "HV Patrick Hand", var(--font); font-size: 1.22em; }
.tp[data-tp-font="montserrat"] { --tp-head: "HV Montserrat", var(--font); --tp-font: "HV Montserrat", var(--font); }

/* ----- hero ----- */
.tp-hero { position: relative; }
.tp-cover { display: block; width: 100%; aspect-ratio: 16 / 5; max-height: clamp(110px, 20vw, 220px); object-fit: cover; background: var(--tp-hero); }
@media (max-width: 640px) { .tp-cover { aspect-ratio: 16 / 8; max-height: 140px; } }
.tp-hero-in { max-width: 960px; margin: -56px auto 0; padding: 0 20px; display: flex; align-items: flex-end; gap: 18px; position: relative; flex-wrap: wrap; }
.tp-avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 5px solid var(--tp-bg); background: var(--tp-surface); box-shadow: var(--tp-shadow); flex: none; }
.tp-avatar-txt { display: grid; place-items: center; font: 800 2.4rem/1 var(--tp-head); color: var(--tp-accent-ink); background: var(--tp-accent); }
.tp-hero-txt { flex: 1; min-width: 220px; padding-bottom: 6px; }
.tp-name { font: 800 clamp(1.7rem, 1.2rem + 2.2vw, 2.8rem)/1.15 var(--tp-head); letter-spacing: -.01em; overflow-wrap: anywhere; }
.tp-tagline { color: var(--tp-muted); margin-top: 4px; font-size: 1.05rem; overflow-wrap: anywhere; }
@media (max-width: 520px) { .tp-hero-in { margin-top: -48px; gap: 8px; align-items: flex-start; } .tp-avatar { width: 96px; height: 96px; } .tp-hero-txt { flex-basis: 100%; min-width: 0; } }

/* ----- sections ----- */
.tp-body { max-width: 960px; width: 100%; margin: 0 auto; padding: 24px 20px 40px; display: grid; gap: 22px; flex: 1; }
.tp-sec { background: var(--tp-surface); border-radius: var(--tp-r); box-shadow: var(--tp-shadow); padding: 20px; min-width: 0; }
.tp-h2 { font: 800 1.3rem/1.25 var(--tp-head); margin-bottom: 12px; overflow-wrap: anywhere; }
.tp-h2::after { content: ""; display: block; width: 44px; height: 4px; border-radius: 4px; background: var(--tp-accent); margin-top: 8px; }
.tp-rich { display: grid; gap: .7em; line-height: 1.65; overflow-wrap: anywhere; }
.tp-rich strong { font-weight: 800; }
.tp-empty { color: var(--tp-muted); font-style: italic; }

/* bài giảng */
.tp-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tp-cards[data-layout="list"] { grid-template-columns: 1fr; gap: 10px; }
@media (max-width: 520px) { .tp-cards:not([data-layout="list"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.tp-card { display: flex; flex-direction: column; height: 100%; border-radius: calc(var(--tp-r) - 4px); background: var(--tp-bg); color: inherit; text-decoration: none; overflow: hidden; border: 1px solid var(--tp-line); transition: transform .15s, box-shadow .15s; min-height: 44px; }
.tp-card:hover, .tp-card:focus-visible { transform: translateY(-2px); box-shadow: var(--tp-shadow); }
.tp-card:focus-visible { outline: 3px solid var(--tp-accent); outline-offset: 2px; }
.tp-card-img { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--tp-soft); }
.tp-card-ph { font: 800 2.2rem/1 var(--tp-head); color: var(--tp-accent); }
.tp-card-body { display: grid; gap: 4px; padding: 10px 12px 12px; }
.tp-card-t { font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.tp-card-m { color: var(--tp-muted); font-size: .85rem; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tp-lock { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; padding: 1px 8px; border-radius: 99px; background: var(--tp-soft); color: var(--tp-ink); font-weight: 700; font-size: .78rem; }
.tp-lock .icon { width: 14px; height: 14px; }
.tp-cards[data-layout="list"] .tp-card { flex-direction: row; align-items: center; }
.tp-cards[data-layout="list"] .tp-card-img { width: 96px; flex: none; aspect-ratio: 1; }

/* liên kết */
.tp-link-list { display: flex; flex-wrap: wrap; gap: 10px; }
.tp-link { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 18px 8px 8px; border-radius: 99px; background: var(--tp-accent); color: var(--tp-accent-ink); font-weight: 700; text-decoration: none; max-width: 100%; }
.tp-link > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-link-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--tp-accent-ink) 22%, transparent); flex: none; }
.tp-link-ic .icon { width: 18px; height: 18px; }
.tp-link:focus-visible { outline: 3px solid var(--tp-ink); outline-offset: 2px; }

/* thống kê */
.tp-stat-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.tp-stat { background: var(--tp-soft); border-radius: calc(var(--tp-r) - 4px); padding: 14px 8px; display: grid; gap: 2px; text-align: center; }
.tp-stat b { font: 800 1.9rem/1.1 var(--tp-head); color: var(--tp-accent); }
.tp[data-tp-theme="toigian"] .tp-stat b, .tp[data-tp-theme="demsao"] .tp-stat b { color: var(--tp-ink); }
.tp-stat span { color: var(--tp-muted); font-size: .9rem; }

/* video + ảnh */
.tp-video { position: relative; aspect-ratio: 16 / 9; border-radius: calc(var(--tp-r) - 4px); overflow: hidden; background: #000; }
.tp-video iframe, .tp-video-play { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tp-video-play { padding: 0; cursor: pointer; background: #000; }
.tp-video-play img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.tp-play-ic { position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.6); color: #fff; }
.tp-play-ic .icon { width: 30px; height: 30px; }
.tp-figure { margin: 0; display: grid; gap: 8px; }
.tp-figure img { width: 100%; border-radius: calc(var(--tp-r) - 4px); }
.tp-figure figcaption { color: var(--tp-muted); font-size: .9rem; text-align: center; }

.tp-foot { text-align: center; padding: 18px 16px 28px; font-size: .85rem; }
.tp-foot a { color: var(--tp-muted); text-decoration: none; display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 .3em; min-height: 44px; line-height: 1.5; padding: 4px 0; }
.tp-ownerbar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; background: var(--c-surface); border-bottom: 1px solid var(--c-line); }
.tp-404 { max-width: 520px; margin: 14vh auto; padding: 24px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.tp-404 h1 { font-size: 1.8rem; font-weight: 800; }

/* ===== Trình dựng /app/page ===== */
.tpb-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.tpb-top h1 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); font-weight: 800; margin-right: auto; }
.tpb-save { color: var(--c-muted); font-size: .85rem; min-width: 6em; }
.tpb-switch { display: none; }
.tpb { display: grid; grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); gap: 20px; align-items: start; }
.tpb-edit { display: grid; gap: 14px; min-width: 0; }
.tpb-prev { position: sticky; top: 12px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--c-line); max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--c-surface); }
.tpb-prev .tp { min-height: 0; font-size: .92rem; }
.tpb-prev .tp-cover { aspect-ratio: 16 / 6; }
@media (max-width: 1000px) {
  .tpb { grid-template-columns: 1fr; }
  .tpb-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 99px; background: var(--c-surface-2); margin-bottom: 12px; }
  .tpb-switch button { min-height: 44px; border: 0; border-radius: 99px; background: none; font: inherit; font-weight: 700; color: var(--c-muted); cursor: pointer; }
  .tpb-switch button[aria-pressed="true"] { background: var(--c-surface); color: var(--c-ink); box-shadow: var(--shadow-card); }
  .tpb[data-tab="edit"] .tpb-prev, .tpb[data-tab="prev"] .tpb-edit { display: none; }
  .tpb-prev { position: static; max-height: none; }
}
.tpb-panel { background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--shadow-card); padding: 14px; display: grid; gap: 12px; min-width: 0; }
.tpb-panel > summary { font-weight: 800; cursor: pointer; min-height: 44px; display: flex; align-items: center; list-style: none; }
.tpb-panel > summary::-webkit-details-marker { display: none; }
.tpb-panel > summary::after { content: "▾"; margin-left: auto; color: var(--c-muted); }
.tpb-panel:not([open]) > summary::after { content: "▸"; }
.tpb-themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tpb-theme { border: 3px solid transparent; border-radius: 14px; padding: 6px; background: var(--c-surface-2); cursor: pointer; display: grid; gap: 6px; font: inherit; font-size: .78rem; font-weight: 700; text-align: center; min-height: 44px; color: var(--c-ink); }
.tpb-theme[aria-pressed="true"] { border-color: var(--c-primary); }
.tpb-sw { display: flex; height: 26px; border-radius: 8px; overflow: hidden; }
.tpb-sw i { flex: 1; }
.tpb-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.tpb-row .select { min-height: 48px; }
.tpb-row > .field { flex: 1; min-width: 140px; }
.tpb-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--c-surface-2); }
.tpb-seg button { min-height: 40px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 9px; background: none; font: inherit; font-weight: 700; cursor: pointer; color: var(--c-muted); }
.tpb-seg button[aria-pressed="true"] { background: var(--c-surface); color: var(--c-ink); box-shadow: var(--shadow-card); }
.tpb-color { width: 52px; height: 44px; padding: 2px; border: 2px solid var(--c-line); border-radius: 10px; background: var(--c-surface); cursor: pointer; }
.tpb-hint { color: var(--c-muted); font-size: .82rem; overflow-wrap: anywhere; }
.tpb-blocks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tpb-block { background: var(--c-surface); border-radius: var(--r); box-shadow: var(--shadow-card); border: 2px solid transparent; min-width: 0; }
.tpb-block.dragging { opacity: .5; }
.tpb-block.drop-before { border-top-color: var(--c-primary); }
.tpb-block.drop-after { border-bottom-color: var(--c-primary); }
.tpb-bhead { display: flex; align-items: center; gap: 4px; padding: 6px; }
.tpb-handle { width: 44px; height: 44px; display: grid; place-items: center; cursor: grab; touch-action: none; color: var(--c-muted); border-radius: 10px; flex: none; user-select: none; -webkit-user-select: none; }
.tpb-handle:active { cursor: grabbing; background: var(--c-surface-2); }
.tpb-btitle { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-weight: 800; text-align: left; cursor: pointer; min-height: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-ink); }
.tpb-btitle small { font-weight: 600; color: var(--c-muted); margin-left: 6px; }
.tpb-bhead .btn.btn-icon, .tpb-item .btn.btn-icon { width: 44px; min-width: 44px; height: 44px; min-height: 44px; flex: none; }
.tpb-bbody { padding: 4px 14px 14px; display: grid; gap: 12px; }
.tpb-img { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tpb-img img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--c-surface-2); }
.tpb-img .input { flex: 1; min-width: 160px; }
.tpb-list { display: grid; gap: 8px; }
.tpb-item { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px; border-radius: 12px; background: var(--c-surface-2); }
.tpb-item > .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.tpb-item .select { width: auto; min-width: 110px; }
.tpb-item .input { flex: 1; min-width: 140px; }
.tpb-item .btn-icon { width: 44px; height: 44px; min-height: 44px; }
.tpb-slug { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tpb-slug .pre { color: var(--c-muted); font-size: .85rem; }
.tpb-slug .input { flex: 1; min-width: 150px; font-family: ui-monospace, Menlo, monospace; }

/* Cảm ứng: mọi nút trong trình dựng ≥ 44px */
.tpb-top .btn.btn, .tpb-edit .btn.btn { min-height: 44px; }

/* ---- Popup chọn bài hiện trên trang (03/11, picker.js) + danh sách gọn bài đã chọn ---- */
.tpb-shown-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.tpb-shown-h > b { min-width: 0; overflow-wrap: anywhere; }
.tpb-shown .btn { min-height: 44px; }
.tpb-chosen .badge { margin-left: 6px; vertical-align: middle; }
html.tpk-lock, html.tpk-lock body { overflow: hidden; }
.tpk-back { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.tpk { background: var(--c-surface, #fff); color: var(--c-ink); border-radius: var(--r-lg, 16px); box-shadow: 0 20px 60px rgba(0,0,0,.3); width: min(640px, 100%); max-height: min(86vh, 820px); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.tpk-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 16px; border-bottom: 1px solid var(--c-line, rgba(0,0,0,.08)); }
.tpk-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 1.1rem; }
.tpk-head .btn-icon { width: 44px; height: 44px; min-width: 44px; flex: none; }
.tpk-tools { padding: 10px 16px 4px; display: grid; gap: 6px; }
.tpk-tools .search { min-width: 0; max-width: none; }
.tpk-tools .search input { width: 100%; min-height: 44px; }
.tpk-hint { margin: 0; font-size: .85rem; color: var(--c-muted); }
.tpk-tree { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 10px 10px; }
.tpk-tree ul { list-style: none; margin: 0; padding: 0; }
.tpk-sub, .tpk-folder > .tpk-acts { padding-left: 18px !important; border-left: 2px solid var(--c-surface-2); margin-left: 21px !important; }
.tpk-frow { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tpk-frow > input, .tpk-act input { width: 22px; height: 22px; flex: none; margin: 11px; accent-color: var(--c-primary); }
.tpk-fbtn { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 6px; background: none; border: 0; border-radius: 10px; padding: 0 8px; font: inherit; font-weight: 700; color: inherit; text-align: left; cursor: pointer; }
.tpk-fbtn:hover { background: var(--c-surface-2); }
.tpk-fbtn .tpk-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tpk-fbtn small { flex: none; }
.tpk-caret { width: 1em; flex: none; color: var(--c-muted); }
.tpk-act { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 44px; border-radius: 10px; }
.tpk-act:hover { background: var(--c-surface-2); }
.tpk-act > label { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; min-height: 44px; cursor: pointer; }
.tpk-act .tpk-t { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-right: 6px; }
.tpk-act.is-off > label { opacity: .5; cursor: not-allowed; }
.tpk-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--c-muted); padding-right: 8px; }
.tpk-share { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 10px; margin-left: 44px; font-size: .88rem; font-weight: 600; color: var(--c-primary); }
.tpk-more { padding: 6px 0; }
.tpk-more .btn, .tpk-btns .btn { min-height: 44px; }
.tpk-empty { padding: 16px 8px; }
.tpk-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--c-line, rgba(0,0,0,.08)); }
.tpk-count { flex: 1; min-width: 0; font-weight: 700; }
.tpk-btns { display: flex; gap: 8px; }
.tpk-btns .btn { min-width: 96px; }
@media (max-width: 560px) {
  .tpk-back { padding: 0; align-items: stretch; }
  .tpk { width: 100%; max-height: none; height: 100%; height: 100dvh; border-radius: 0; }
  .tpk-sub, .tpk-folder > .tpk-acts { margin-left: 12px !important; padding-left: 8px !important; }
  .tpk-share { margin-left: 44px; }
}
.tpk .btn, .tpb-shown .btn { min-height: 44px; height: auto; }
.tpk .search input.input { height: 44px; min-height: 44px; }
.tpk, .tpb-shown { --tap: 44px; }
body:not([data-view="play"]) .tpk .btn, body:not([data-view="play"]) .tpb-shown .btn { min-height: 44px; height: 44px; }
body:not([data-view="play"]) .tpk .btn-icon { width: 44px; }
/* Ô tick popup chọn bài: vùng chạm 44x44, ô vẽ 22px ở giữa (03/11) */
.tpk-frow > input, .tpk-act input { -webkit-appearance: none; appearance: none; width: 44px; height: 44px; margin: 0; flex: none; cursor: pointer; border-radius: 10px;
  background: no-repeat center / 22px 22px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Crect x='1' y='1' width='20' height='20' rx='5' fill='%23fff' stroke='%23889' stroke-width='2'/%3E%3C/svg%3E"); }
.tpk-frow > input:checked, .tpk-act input:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Crect width='22' height='22' rx='6' fill='%232563eb'/%3E%3Cpath d='M6 11.5l3.3 3.3L16 8' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.tpk-frow > input:indeterminate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Crect width='22' height='22' rx='6' fill='%232563eb'/%3E%3Cpath d='M6 11h10' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.tpk-frow > input:disabled, .tpk-act input:disabled { cursor: not-allowed; opacity: .45; }
.tpk-frow > input:focus-visible, .tpk-act input:focus-visible { outline: 2px solid var(--c-primary, #2563eb); outline-offset: -4px; }
/* Đầu khối: tên + loại xuống 2 dòng, không tràn đè nút ↑ (03/11) */
.tpb-bhead .tpb-btitle { display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.tpb-bhead .tpb-btitle > *, .tpb-btitle small { margin-left: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Công tắc trong trình soạn trang: vùng chạm ≥44px, hình viên thuốc giữ nguyên (viền trong suốt) */
.tpb .switch input { box-sizing: content-box; border: 8px solid transparent; background-clip: padding-box; margin: -8px 0 -8px -8px; }

/* Kích thước ảnh bìa (03/11): fb = 820x312 (điện thoại 16:9), wide = 16:5, custom = --bn-h; phủ/vừa; tiêu điểm inline. */
.tp-hero.bn-fb .tp-cover { aspect-ratio: 820 / 312; max-height: 440px; }
.tp-hero.bn-wide .tp-cover { aspect-ratio: 16 / 5; max-height: 280px; }
.tp-hero.bn-custom .tp-cover { aspect-ratio: auto; height: var(--bn-h, 312px); max-height: none; }
.tp-hero.bn-contain .tp-cover { object-fit: contain; }
@media (max-width: 640px) {
  .tp-hero.bn-fb .tp-cover { aspect-ratio: 16 / 9; max-height: none; }
  .tp-hero.bn-wide .tp-cover { aspect-ratio: 16 / 7; max-height: none; }
  .tp-hero.bn-custom .tp-cover { height: min(var(--bn-h, 312px), 75vw); }
}
.tpb-prev .tp-hero.bn-fb .tp-cover { aspect-ratio: 820 / 312; max-height: none; }
.tpb-prev .tp-hero.bn-wide .tp-cover { aspect-ratio: 16 / 5; }
.tpb-prev .tp-hero.bn-custom .tp-cover { height: calc(var(--bn-h, 312px) * .5); }
.tpb-banner { display: grid; gap: 12px; }
.tpb-bn-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.tpb-banner .tpb-bn-row input[type=range] { flex: 1; min-width: 160px; height: 44px; min-height: 44px; accent-color: var(--c-accent, #ff6b2c); }
.tpb-bn-h { font-weight: 700; min-width: 56px; }
.tpb-banner .tpb-seg { flex-wrap: wrap; max-width: 100%; }
.tpb-focal { position: relative; width: 100%; max-width: 520px; aspect-ratio: 820 / 312; border-radius: 12px; overflow: hidden; background: var(--c-surface-2); touch-action: none; cursor: crosshair; user-select: none; }
.tpb-focal img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.tpb-fdot { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 3px solid #fff; background: rgba(255, 107, 44, .55); box-shadow: 0 0 0 2px rgba(0, 0, 0, .45); cursor: grab; padding: 0; }
.tpb-fdot:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.tpb-fring { position: absolute; left: 4%; bottom: -18%; width: 22%; aspect-ratio: 1; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .95); box-shadow: 0 0 0 2px rgba(0, 0, 0, .35); pointer-events: none; }
/* tên GV không đè lên ảnh bìa trên máy tính (ảnh bìa chỉ bị ảnh đại diện che góc trái dưới) */
@media (min-width: 521px) { .tp-hero.has-cover .tp-hero-in { margin-top: -46px; } .tp-hero.has-cover .tp-hero-txt { padding-top: 52px; } }

/* 03/11: nút admin ẩn bài trên trang GV (chỉ hiện với admin) */
.tp-li { position: relative; }
.tp-adm-hide { position: absolute; top: 6px; right: 6px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(214,40,40,.92); color: #fff; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.tp-adm-hide .icon { width: 20px; height: 20px; }
.tp-adm-hide:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
