/* ==========================================================================
   Bladevel — Thuyết trình · MÀN QUẢN LÝ (2026-11-10 · giao diện Canva)
   --------------------------------------------------------------------------
   THIẾT KẾ LẠI TOÀN BỘ theo ngôn ngữ trang chủ Canva (thay bản "Tối giản"
   2026-11-08): ảnh bìa tràn viền + lớp phủ gradient, thanh tìm kiếm tối giản,
   dải danh mục icon nét, lưới thẻ thiết kế có nút nhanh khi rê chuột, băng
   chuyền mẫu, modal xem trước + form tạo mới, toast tối.
     • Toàn bộ class đặt tiền tố sm- (sm-home, sm-cover, sm-cat, sm-card…)
       để không đụng .card / .toast / .overlay… của theme.css.
     • Hợp đồng DOM với slide-manager.js: mọi id sm* + class sm-* đổi cùng
       nhau trong đợt này (view + CSS + JS viết lại đồng bộ).
     • Chế độ tối (html.dark) và mọi breakpoint như chuẩn app.
   Tài nguyên: nạp bởi layouts/teacher khi $slideScreen === 'manager'.
   ========================================================================== */

/* ---------- biến (sáng / tối) ---------- */
.sm-home {
  --smc-a: #8b3dff;            /* tím Canva — nút chính, trạng thái bật */
  --smc-a-deep: #7a2fe8;
  --smc-a-line: #c3adf2;       /* viền ô nhập khi focus */
  --smc-a-soft: rgba(139, 61, 255, .08);
  --smc-a-tint: #f2ecfd;       /* nền danh mục đang bật */
  --smc-a-ink: #7a2fe8;
  --smc-ink: #17171e;          /* chữ chính */
  --smc-ink2: #1c1c24;         /* chữ tiêu đề thẻ */
  --smc-mut: #77777f;          /* chữ phụ */
  --smc-mut2: #8f8f99;         /* chữ mờ */
  --smc-brd: #e4e4ea;          /* viền thường */
  --smc-brd2: #edeff4;
  --smc-field: #f6f7f9;
  --smc-card: #ffffff;
  --smc-star: #f59e0b;
  --smc-danger: #dc2626;
  --smc-hover: rgba(20, 24, 34, .05);

  font-family: 'Be Vietnam Pro', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--smc-ink);
  -webkit-font-smoothing: antialiased;
}
html.dark .sm-home {
  --smc-a: #8b3dff;
  --smc-a-deep: #9d61ff;
  --smc-a-line: rgba(158, 122, 255, .6);
  --smc-a-soft: rgba(139, 61, 255, .18);
  --smc-a-tint: rgba(139, 61, 255, .16);
  --smc-a-ink: #c9b2ff;
  --smc-ink: #f0f1f4;
  --smc-ink2: #e7e8ee;
  --smc-mut: #a7abb5;
  --smc-mut2: #7d818c;
  --smc-brd: rgba(255, 255, 255, .12);
  --smc-brd2: rgba(255, 255, 255, .07);
  --smc-field: rgba(255, 255, 255, .05);
  --smc-card: #20232a;
  --smc-hover: rgba(255, 255, 255, .07);
}

[hidden] { display: none !important; }

.sm-home :where(button) { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.sm-home a { color: inherit; }
.sm-home img { -webkit-user-drag: none; user-select: none; }
.sm-home :focus-visible { outline: 2px solid var(--smc-a); outline-offset: 2px; border-radius: 6px; }

/* ==========================================================================
   1) COVER — tràn viền trên cùng (canva .cover)
   ========================================================================== */
/* KHÔNG đặt width cho .sm-home: để margin âm (-26/-28) ở khối dưới tự dẫn
   dải cover tràn kín cả 2 mép. Nếu đặt width:100% thì hộp bị "định độ"
   (over-constrained) -> margin-right âm bị bỏ qua -> ảnh hụt ~56px bên phải
   (lỗi "ảnh không kéo full ngang" đã từng gặp). */

/* Trang này chỉ được cuộn DỌC — mọi tràn ngang (nút carousel, bóng đổ…)
   bị cắt bỏ để bố cục không bị lệch/kéo sang ngang. */
html, body { overflow-x: hidden; overflow-x: clip; }

/* Huỷ padding .page-content để cover tràn KÍN cả mép trên lẫn 2 bên ở MỌI
   trạng thái (sidebar mở / thu gọn / mobile) — ảnh hero phải chạm cạnh trên
   của cửa sổ và chạy hết chiều ngang vùng nội dung. Nút burger (chỉ xuất
   hiện ≤1200px) chuyển thành nút nổi đè lên ảnh (xem .burger.mobile-only
   bên dưới) nên không cần chừa dòng trống phía trên nữa. */
@media (min-width: 761px) {
  .fm-main .page-content .sm-home { margin: -26px -28px 0; }
}
@media (max-width: 760px) {
  .fm-main .page-content .sm-home { margin: -20px -16px 0; }
}

/* Nút mở menu (hiện khi ≤1200px) nổi góc trên-trái ĐÈ LÊN ảnh cover — giống
   trang trình chiếu: nền trắng mờ + viền để nổi bật trên cả ảnh sáng lẫn tối. */
.fm-main .page-content { position: relative; }
.fm-main .page-content > .burger.mobile-only {
  position: absolute; top: 14px; left: 14px; margin-bottom: 0; z-index: 90;
  background: rgba(255, 255, 255, .92); color: #1f2937;
  border: 1px solid rgba(15, 23, 42, .10); border-radius: 10px;
  box-shadow: 0 1px 8px rgba(15, 23, 42, .14);
}
html.dark .fm-main .page-content > .burger.mobile-only {
  background: rgba(25, 27, 33, .92); color: #e5e7eb;
  border-color: rgba(255, 255, 255, .14);
}

.sm-cover { position: relative; height: 250px; overflow: hidden; background: #14101f; }
.sm-cover-img {
  position: absolute; inset: 0;
  background-image: url('/assets/img/slides-hero-sang.jpg');
  background-size: cover; background-position: center;
}
html.dark .sm-cover-img { background-image: url('/assets/img/slides-hero-toi.jpg'); }
/* Chế độ tối (ảnh bản đêm: chùa + đèn lồng): phủ đậm hơn để chữ nổi và
   ảnh hoà với nền tối của trang. */
html.dark .sm-cover-ov {
  background:
    linear-gradient(180deg, rgba(5, 4, 16, .20), rgba(5, 4, 16, 0) 32%, rgba(5, 4, 16, .5) 100%),
    linear-gradient(90deg, rgba(5, 4, 16, .76), rgba(5, 4, 16, .40) 55%, rgba(5, 4, 16, .08));
}
/* Chế độ tối dùng ảnh bản đêm + scrim tối -> chữ TRẮNG như cũ (base đã đổi
   sang mực đậm cho bản sáng). */
html.dark .sm-cover-body { color: #fff; }
html.dark .sm-cover-body h2 { color: #fff; text-shadow: 0 1px 18px rgba(8, 5, 26, .55); }
html.dark .sm-cover-body p { color: #fff; opacity: .92; text-shadow: 0 1px 10px rgba(8, 5, 26, .5); }
.sm-cover-ov {
  position: absolute; inset: 0;
  /* Bản sáng — kiểu “airy” như trang chủ Canva thật: lớp VOAN KEM mỏng dần
     giữ chất giấy kem của tranh folk-art, chữ bên trái đổi sang MỰC ĐẬM
     (xem .sm-cover-body) thay vì chữ trắng trên scrim tối dễ bệt. */
  background: linear-gradient(90deg, rgba(248, 242, 229, .95) 0%, rgba(248, 242, 229, .68) 40%, rgba(248, 242, 229, 0) 68%);
}
.sm-cover-body {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  gap: 8px; padding: 0 40px; color: #33261a; max-width: 1400px; margin: 0 auto; width: 100%;
}
.sm-cover-body h2 {
  font-size: 27px; font-weight: 700; letter-spacing: -.01em; color: #241a10;
  text-shadow: 0 1px 12px rgba(248, 242, 229, .8);
}
.sm-cover-body p {
  font-size: 13.5px; line-height: 20px; max-width: 480px; color: #6b5947; opacity: 1;
  text-shadow: 0 1px 10px rgba(248, 242, 229, .85);
}
.sm-cover-body .sm-btn { margin-top: 10px; align-self: flex-start; }
/* Nút trên cover: gradient tím + quang bóng, nâng nhẹ khi hover (nút trong
   modal giữ nguyên kiểu phẳng). */
.sm-cover .sm-btn-primary {
  height: 38px; padding: 0 20px; border-radius: 10px;
  background: linear-gradient(135deg, #9d5bff, #8b3dff 55%, #7a2fe8);
  box-shadow: 0 10px 26px rgba(35, 16, 70, .48), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.sm-cover .sm-btn-primary:hover {
  background: linear-gradient(135deg, #aa74ff, #9a55ff 55%, #8b3dff);
  box-shadow: 0 12px 30px rgba(35, 16, 70, .58), inset 0 1px 0 rgba(255, 255, 255, .3);
  transform: translateY(-1px);
}

/* ==========================================================================
   2) THANH TÌM KIẾM (canva .searchbar)
   ========================================================================== */
.sm-searchbar {
  width: min(600px, 92%); height: 42px; margin: 24px auto 0;
  background: var(--smc-card); border: 1px solid var(--smc-brd); border-radius: 10px;
  display: flex; align-items: center; padding: 0 14px; gap: 10px;
  color: var(--smc-mut);
  transition: border-color .15s, box-shadow .15s;
}
.sm-searchbar:focus-within { border-color: var(--smc-a-line); box-shadow: 0 0 0 3px var(--smc-a-soft); }
.sm-searchbar svg { flex: none; }
.sm-searchbar input {
  flex: 1; min-width: 0; border: none; outline: none; background: none;
  font: inherit; font-size: 14px; color: var(--smc-ink);
}
.sm-searchbar input::placeholder { color: var(--smc-mut2); }
.sm-qclear {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--smc-mut); font-size: 15px;
}
.sm-qclear:hover { background: var(--smc-hover); color: var(--smc-ink); }
.sm-home kbd {
  font-family: inherit; font-size: 11px; color: var(--smc-mut2);
  border: 1px solid var(--smc-brd); border-radius: 4px; padding: 0 5px;
  background: var(--smc-card);
}

/* ==========================================================================
   3) DANH MỤC — icon nét, không nền (canva .cats)
   ========================================================================== */
.sm-cats-wrap { margin-top: 14px; }
.sm-cats {
  display: flex; align-items: flex-start; gap: 2px; overflow-x: auto;
  padding: 2px 10px 6px; scrollbar-width: none;
}
.sm-cats::-webkit-scrollbar { display: none; }
.sm-cats > *:first-child { margin-left: auto; }
.sm-cats > *:last-child { margin-right: auto; }
.sm-cat {
  flex: none; min-width: 66px; padding: 8px 9px 7px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--smc-mut);
  transition: background .15s, color .15s, transform .1s;
}
.sm-cat:hover { background: var(--smc-hover); color: var(--smc-ink); }
.sm-cat:active { transform: scale(.94); }
.sm-cat svg { display: block; }
.sm-cat span { font-size: 10.5px; line-height: 13px; white-space: nowrap; }
.sm-cat.active { background: var(--smc-a-tint); color: var(--smc-a-ink); }
.sm-cat.active span { font-weight: 600; }

/* ==========================================================================
   3b) ICON MÀU (2026-11-22) — huy hiệu gradient kiểu Canva
   --------------------------------------------------------------------------
   • .sm-feats / .sm-feat : hàng LỐI TẮT TÍNH NĂNG dưới ô tìm kiếm (icon tròn 46px).
   • .sm-cat-ic           : huy hiệu vuông bo 34px cho dải danh mục (thay icon nét xám).
   Màu mỗi icon truyền qua biến --c1 / --c2 (style inline); glyph trắng bên trong.
   ========================================================================== */
.sm-feats-wrap { margin-top: 20px; }
.sm-feats {
  display: flex; align-items: flex-start; gap: 8px; overflow-x: auto;
  padding: 4px 10px 8px; scrollbar-width: none;
}
.sm-feats::-webkit-scrollbar { display: none; }
.sm-feats > *:first-child { margin-left: auto; }
.sm-feats > *:last-child { margin-right: auto; }
.sm-feat {
  flex: none; min-width: 76px; padding: 6px 6px 5px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: background .15s, transform .1s;
}
.sm-feat:hover { background: var(--smc-hover); }
.sm-feat:active { transform: scale(.95); }
.sm-feat-ic {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--c1), var(--c2));
  box-shadow: 0 6px 14px -6px var(--c2), inset 0 1px 0 rgba(255, 255, 255, .38);
  transition: transform .15s ease;
}
.sm-feat:hover .sm-feat-ic { transform: translateY(-2px) scale(1.07); }
.sm-feat-ic svg { display: block; }
.sm-feat span { font-size: 11.5px; line-height: 14px; font-weight: 500; color: var(--smc-ink2); white-space: nowrap; }

.sm-cat-ic {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-style: normal;
  background: linear-gradient(145deg, var(--c1), var(--c2));
  box-shadow: 0 5px 12px -6px var(--c2), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.sm-cat:hover .sm-cat-ic { transform: translateY(-1px) scale(1.05); }
.sm-cat.active .sm-cat-ic { box-shadow: 0 0 0 2px var(--smc-card), 0 0 0 4px var(--c1); }
.sm-cat-ic svg { display: block; }

/* --- Gộp 2 hàng thành 1 HÀNG NGANG (lối tắt | vạch | danh mục), tràn thì cuộn ngang --- */
.sm-iconrow {
  display: flex; align-items: flex-start; justify-content: flex-start; gap: 10px;
  margin-top: 20px; overflow-x: auto; padding: 0 10px; scrollbar-width: none;
}
.sm-iconrow::-webkit-scrollbar { display: none; }
.sm-iconrow > :first-child { margin-left: auto; }
.sm-iconrow > :last-child { margin-right: auto; }
.sm-iconrow .sm-feats-wrap, .sm-iconrow .sm-cats-wrap { margin-top: 0; flex: none; }
.sm-iconrow .sm-feats, .sm-iconrow .sm-cats { overflow: visible; padding-left: 0; padding-right: 0; }
.sm-iconrow .sm-feats > *, .sm-iconrow .sm-cats > * { margin-left: 0 !important; margin-right: 0 !important; }
.sm-iconrow .sm-cats-wrap { margin-top: 6px; } /* huy hiệu 34px canh giữa theo icon tròn 46px */
.sm-iconrow-sep { flex: none; width: 1px; height: 52px; margin: 8px 6px 0; background: var(--smc-brd); }

/* (2026-11-23) Màn laptop hẹp: 1 hàng không đủ chỗ ⇒ JS thêm .is-wrap — KHÔNG cuộn/tràn nữa,
   lối tắt nằm hàng trên, danh mục xuống hàng dưới, cả hai canh giữa; bỏ vạch ngăn. */
.sm-iconrow.is-wrap { flex-wrap: wrap; justify-content: center; overflow-x: visible; row-gap: 14px; }
.sm-iconrow.is-wrap > :first-child, .sm-iconrow.is-wrap > :last-child { margin-left: 0; margin-right: 0; }
.sm-iconrow.is-wrap .sm-iconrow-sep { display: none; }
.sm-iconrow.is-wrap .sm-feats-wrap, .sm-iconrow.is-wrap .sm-cats-wrap { flex: 0 1 auto; max-width: 100%; }
.sm-iconrow.is-wrap .sm-cats-wrap { margin-top: 0; width: 100%; }
.sm-iconrow.is-wrap .sm-feats, .sm-iconrow.is-wrap .sm-cats { flex-wrap: wrap; justify-content: center; }

/* ==========================================================================
   4) KHUNG CHÍNH (canva .wrap)
   ========================================================================== */
.sm-wrap { max-width: 1400px; margin: 0 auto; padding: 6px 30px 26px; }

.sm-shead { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; }
.sm-shead h2 { font-size: 15px; font-weight: 650; color: var(--smc-ink); letter-spacing: -.005em; }
.sm-shead-r { display: flex; align-items: center; gap: 12px; }
.sm-count { font-size: 12px; color: var(--smc-mut2); }

.sm-sort {
  height: 30px; padding: 0 8px; border: 1px solid var(--smc-brd); border-radius: 8px;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--smc-mut);
  background: var(--smc-card); cursor: pointer;
  transition: border-color .15s, color .15s;
}
.sm-sort:hover { border-color: var(--smc-a); color: var(--smc-a-ink); }

/* ==========================================================================
   5) LƯỚI BÀI GIẢNG (canva .grid + .card)
   ========================================================================== */
.sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 24px 18px; }

.sm-card { text-align: left; display: flex; flex-direction: column; align-items: stretch; }

/* Ảnh xem trước: dựng lại slide đầu 960x540 rồi thu nhỏ vừa khung.
   .sm-clip (con) mới là lớp cắt góc + overflow — .sm-thumb KHÔNG overflow
   để menu ⋮ (absolute trong .sm-thumb) trồi lên trên được mà không bị cắt. */
.sm-thumb {
  position: relative; border-radius: 8px; cursor: pointer;
  aspect-ratio: 16 / 9; background: var(--smc-field);
  border: 1px solid var(--smc-brd2);
  transition: box-shadow .15s, border-color .15s;
}
.sm-card:hover .sm-thumb { box-shadow: 0 4px 18px rgba(20, 20, 43, .16); border-color: transparent; }
.sm-clip { position: absolute; inset: 0; border-radius: 8px; overflow: hidden; }
.sm-card.menu-open { position: relative; z-index: 20; }
.sm-stage {
  position: absolute; left: 0; top: 0; width: 960px; height: 540px;
  transform-origin: 0 0; background: #fff; overflow: hidden;
}
.sm-stage-blank {  /* slide trống: nền tím nhạt — nội dung nháp do JS vẽ thêm */
  background: linear-gradient(135deg, #faf9ff 0%, #f3f0fc 55%, #ece7fa 100%);
}
html.dark .sm-stage-blank { background: linear-gradient(135deg, #e3e0ee 0%, #d8d3ec 55%, #cdc7e4 100%); }

/* Nút "Mở" giữa ảnh khi rê chuột (canva .quick) */
.sm-quick {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 10, 45, .25); opacity: 0; transition: opacity .15s;
}
.sm-card:hover .sm-quick, .sm-card:focus-visible .sm-quick { opacity: 1; }
.sm-quick b {
  background: #fff; color: #17171e; font-size: 12px; font-weight: 600; border-radius: 999px;
  padding: 7px 14px; box-shadow: 0 2px 8px rgba(20, 20, 43, .25);
}

/* Thanh công cụ góc phải dưới khi rê chuột: ghim + menu ⋮ */
.sm-tools {
  position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px;
  opacity: 0; transform: translateY(3px); transition: opacity .15s, transform .15s;
}
.sm-card:hover .sm-tools, .sm-card:focus-visible .sm-tools,
.sm-tools.stay { opacity: 1; transform: none; }
.sm-tool {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255, 255, 255, .94); color: #33333b;
  box-shadow: 0 1px 6px rgba(20, 20, 43, .28);
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s, background .15s;
}
.sm-tool:hover { transform: scale(1.06); }
.sm-tool:active { transform: scale(.96); }
.sm-tool svg { display: block; }
.sm-tool.sm-tool-pin.on { color: var(--smc-star); }
.sm-tool.sm-tool-pin.on svg { fill: var(--smc-star); }

/* Menu dọc của nút ⋮ */
.sm-menu {
  position: absolute; right: 8px; bottom: 46px; z-index: 6; min-width: 178px;
  background: var(--smc-card); border: 1px solid var(--smc-brd2); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(15, 10, 35, .18); padding: 5px;
  animation: sm-menuin .13s ease;
}
.sm-menu.below { bottom: auto; top: calc(100% + 6px); }
@keyframes sm-menuin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.sm-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--smc-ink);
  text-align: left;
}
.sm-menu button:hover { background: var(--smc-hover); }
.sm-menu button svg { flex: none; color: var(--smc-mut); }
.sm-menu button.sm-menu-danger { color: var(--smc-danger); }
.sm-menu button.sm-menu-danger svg { color: var(--smc-danger); }

/* Tên + dòng mô tả dưới ảnh (canva .ct / .cm) */
.sm-ct {
  display: block; margin-top: 8px; font-size: 12.5px; line-height: 16px; font-weight: 600;
  color: var(--smc-ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sm-cm {
  margin-top: 3px; font-size: 11px; line-height: 14px; color: var(--smc-mut);
  display: flex; align-items: center; white-space: nowrap; overflow: hidden;
}
.sm-mi { flex: 0 0 14px; width: 14px; height: 14px; border-radius: 50%; margin-right: 5px; position: relative; }
.sm-mi::after {
  content: ''; position: absolute; left: 3px; top: 3.6px; width: 8px; height: 6.5px;
  background: #fff; border-radius: 1.5px;
}
.sm-cm span { overflow: hidden; text-overflow: ellipsis; }

/* Trạng thái trống */
.sm-empty { text-align: center; padding: 48px 0 8px; color: var(--smc-mut); font-size: 14px; }
.sm-empty b { color: var(--smc-ink); }
.sm-empty .sm-btn { margin-top: 14px; }
.sm-empty-ic { display: flex; justify-content: center; margin-bottom: 10px; color: #c7c7d1; }
.sm-empty-ic svg { width: 42px; height: 42px; }

/* Nút "Hiển thị thêm" (canva .more) */
.sm-morewrap { text-align: center; margin: 30px 0 4px; }
.sm-more {
  height: 32px; padding: 0 18px; background: var(--smc-card); border: 1px solid var(--smc-brd);
  border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--smc-ink);
  transition: border-color .15s, color .15s, transform .1s;
}
.sm-more:hover { border-color: var(--smc-a); color: var(--smc-a-ink); }
.sm-more:active { transform: scale(.97); }
.sm-allmsg { font-size: 12.5px; color: var(--smc-mut2); }

/* ==========================================================================
   6) BĂNG CHUYỀN MẪU (canva .car / .tmpls)
   ========================================================================== */
.sm-car { position: relative; margin: 0 44px; }
.sm-tmpls {
  display: flex; gap: 18px; align-items: flex-start; overflow-x: auto;
  padding: 6px 2px 14px; scroll-snap-type: x mandatory; scroll-padding-left: 2px;
  scrollbar-width: none; /* trượt bằng nút < > do JS (carGo) điều khiển -> không dùng scroll-behavior */
}
.sm-tmpls::-webkit-scrollbar { display: none; }
.sm-titem { flex: none; scroll-snap-align: start; cursor: pointer; width: 224px; }
.sm-timg {
  position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--smc-brd2); background: var(--smc-field);
}
.sm-tname {
  margin-top: 7px; font-size: 12px; font-weight: 600; color: var(--smc-ink2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sm-ttype {
  margin-top: 2px; font-size: 11px; color: var(--smc-mut);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sm-car-btn {
  position: absolute; top: 42px; z-index: 3; width: 38px; height: 38px; border-radius: 50%;
  background: var(--smc-card); color: var(--smc-ink2);
  box-shadow: 0 1px 6px rgba(20, 20, 43, .2);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s, opacity .15s;
}
.sm-car-btn:hover { transform: scale(1.06); }
.sm-car-btn[disabled] { opacity: .3; cursor: default; transform: none; }
.sm-car-btn.prev { left: -44px; }
.sm-car-btn.next { right: -44px; }

/* ==========================================================================
   7) CHÚ THÍCH CUỐI TRANG
   ========================================================================== */
.sm-foot {
  margin: 26px 0 6px; text-align: center; font-size: 12px; color: var(--smc-mut2);
}

/* ==========================================================================
   8) NÚT (canva .btn)
   ========================================================================== */
.sm-btn {
  height: 34px; padding: 0 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .1s, background .15s, border-color .15s, color .15s;
}
.sm-btn:active { transform: scale(.97); }
.sm-btn-primary { background: var(--smc-a); color: #fff; }
.sm-btn-primary:hover { background: var(--smc-a-deep); }
.sm-btn-primary:disabled { opacity: .65; cursor: default; transform: none; }
.sm-btn-ghost { background: var(--smc-card); border: 1px solid var(--smc-brd); color: var(--smc-ink); }
.sm-btn-ghost:hover { border-color: var(--smc-a); color: var(--smc-a-ink); }
.sm-btn .msr { font-size: 18px; }
.sm-spin { animation: sm-rot 1s linear infinite; }
@keyframes sm-rot { to { transform: rotate(360deg); } }

/* ==========================================================================
   9) MODAL (canva .overlay + .modal)
   ========================================================================== */
.sm-float {
  position: fixed; inset: 0; background: rgba(15, 10, 35, .5); z-index: 1060;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: sm-fadein .15s ease;
}
@keyframes sm-fadein { from { opacity: 0; } to { opacity: 1; } }
.sm-modal {
  position: relative; width: min(640px, 100%); background: var(--smc-card);
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); overflow: hidden;
  animation: sm-popin .18s ease;
}
@keyframes sm-popin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sm-mclose {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: #33333b; font-size: 17px;
  box-shadow: 0 1px 5px rgba(20, 20, 43, .2);
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
html.dark .sm-mclose { background: rgba(32, 35, 42, .92); color: #e7e8ee; }
.sm-mclose:hover { background: #fff; }
html.dark .sm-mclose:hover { background: #2a2e37; }

.sm-mimgwrap {
  background: #f5f5f8; display: flex; align-items: center; justify-content: center;
  max-height: 46vh; overflow: hidden; padding: 18px;
}
html.dark .sm-mimgwrap { background: #171920; }
.sm-mimgwrap .sm-stage-fit { position: relative; width: 560px; max-width: 100%; aspect-ratio: 16 / 9; }
.sm-mimgwrap .sm-stage { transform-origin: 0 0; }

.sm-mbody { padding: 16px 20px 20px; }
.sm-mbody > b { font-size: 15.5px; color: var(--smc-ink); }
.sm-mmeta { display: flex; align-items: center; margin-top: 6px; font-size: 12px; color: var(--smc-mut); }
.sm-mactions { display: flex; gap: 10px; margin-top: 15px; }

/* ---- modal tạo bài giảng (form) ---- */
.sm-modal-form { width: min(480px, 100%); }
.sm-modal-form .sm-mbody > b { display: block; font-size: 16.5px; }
.sm-tpl-chip {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 10px;
  background: var(--smc-a-tint); color: var(--smc-a-ink);
  font-size: 12px; font-weight: 500; border-radius: 999px; padding: 5px 7px 5px 11px;
}
.sm-tpl-chip b { font-weight: 700; }
.sm-tpl-chip button { width: 18px; height: 18px; border-radius: 50%; font-size: 12px; color: inherit; }
.sm-tpl-chip button:hover { background: var(--smc-a-soft); }
.sm-modal-form form { margin-top: 14px; display: flex; flex-direction: column; gap: 13px; }
.sm-field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sm-field > span { font-size: 12px; font-weight: 600; color: var(--smc-mut); }
.sm-field input, .sm-field select {
  height: 40px; padding: 0 12px; border: 1px solid var(--smc-brd); border-radius: 8px;
  font: inherit; font-size: 13.5px; color: var(--smc-ink); background: var(--smc-card);
  transition: border-color .15s, box-shadow .15s;
}
.sm-field input:focus, .sm-field select:focus {
  outline: none; border-color: var(--smc-a-line); box-shadow: 0 0 0 3px var(--smc-a-soft);
}
.sm-field input::placeholder { color: var(--smc-mut2); }
.sm-form-row { display: flex; gap: 10px; }
.sm-hints { margin-top: 2px; font-size: 11.5px; color: var(--smc-mut2); }
.sm-hints kbd { font-size: 10.5px; }

/* ==========================================================================
   10) MÀN CHUYỂN CẢNH khi mở trình soạn + TOAST (canva .toast)
   ========================================================================== */
.sm-overlay {
  position: fixed; inset: 0; z-index: 1080; background: rgba(15, 10, 35, .55);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: #fff; font-size: 13.5px;
  opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s;
}
.sm-overlay.show { opacity: 1; visibility: visible; }
.sm-ring {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff;
  animation: sm-rot 1s linear infinite;
}

.sm-toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: var(--smc-ink); color: #fff; font-size: 13px; padding: 10px 18px; border-radius: 9px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28); z-index: 1100; max-width: 88vw; text-align: center;
  opacity: 0; visibility: hidden; transform: translate(-50%, 8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  pointer-events: none;
}
html.dark .sm-toast { background: #2a2e37; border: 1px solid rgba(255, 255, 255, .1); }
.sm-toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ==========================================================================
   11) RESPONSIVE + GIẢM CHUYỂN ĐỘNG
   ========================================================================== */
@media (max-width: 720px) {
  .sm-cover { height: 180px; }
  .sm-cover-body { padding: 0 22px; }
  /* Mobile: khung hẹp nên phần giữa tranh (chim, hoa) lọt vào vùng chữ —
     phủ voan kem dày hơn toàn dải để chữ mực luôn dễ đọc, tranh hiện mềm. */
  .sm-cover-ov {
    background: linear-gradient(90deg, rgba(248, 242, 229, .95) 0%, rgba(248, 242, 229, .82) 55%, rgba(248, 242, 229, .45) 100%);
  }
  .sm-cover-body h2 { font-size: 18px; }
  .sm-cover-body p { font-size: 12px; line-height: 17px; }
  .sm-cover-body .sm-btn { height: 32px; padding: 0 14px; font-size: 12.5px; }
  .sm-wrap { padding: 4px 16px 20px; }
  .sm-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 12px; }
  .sm-searchbar { margin-top: 18px; }
  .sm-searchbar kbd { display: none; }
  .sm-shead h2 { font-size: 14px; }
  .sm-cat { min-width: 58px; padding: 8px 7px 7px; }
  .sm-car { margin: 0 14px; }
  .sm-car-btn.prev { left: -14px; }
  .sm-car-btn.next { right: -14px; }
  .sm-titem { width: 190px; }
  .sm-form-row { flex-direction: column; gap: 13px; }
  .sm-mimgwrap .sm-stage-fit { width: 100%; }
  .sm-toast { bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .sm-float, .sm-modal, .sm-menu, .sm-toast { animation: none; }
  .sm-tmpls { scroll-behavior: auto; }
  .sm-card:hover .sm-thumb { transition: none; }
}


/* ==========================================================================
   12) KHUNG TRANG (2026-11-22) — HEADER + FOOTER + lề xám như trang chat
   --------------------------------------------------------------------------
   Chỉ áp cho màn quản lý Thuyết trình (body.sm-framed do layouts/teacher gắn).
   • Nền body xám (--ai-app) lộ ra thành LỀ 6px ở trên / PHẢI / dưới quanh khung
     nội dung; khung .main bo góc 16px + viền mảnh — y hệt .main của trang chat.
   • Footer (.sm-footbar) là thanh trắng bo góc nổi trong khung, cố định;
     chỉ phần giữa (.page-content) cuộn. (Đã bỏ header theo yêu cầu.)
   • Màn SOẠN slide (tws-full) không bị ảnh hưởng.
   ========================================================================== */
html:has(body.sm-framed), body.sm-framed { height: 100%; overflow: hidden; }
body.sm-framed { background: var(--ai-app); }

body.sm-framed .main.fm-main {
  height: calc(100vh - 12px); height: calc(100dvh - 12px); min-height: 0;
  margin: 6px 6px 6px calc(var(--ai-sbw) + 6px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--ai-page);
  border: 1px solid rgba(20, 24, 34, .10); border-radius: 16px;
  transition: margin-left .2s ease, background-color .25s ease, border-color .25s ease;
}
html.dark body.sm-framed .main.fm-main { border-color: rgba(255, 255, 255, .10); }
body.sm-framed.sb-collapsed .main.fm-main { margin-left: calc(var(--ai-sbwc) + 6px); }

/* Vùng giữa: cuộn bên trong khung, không còn padding (cover tự có lề) */
body.sm-framed .fm-main .page-content {
  flex: 1 1 auto; min-height: 0; padding: 0; overflow-y: auto; overflow-x: hidden;
}
body.sm-framed .fm-main .page-content .sm-home { margin: 0; }
/* Cover KÉO FULL ngang + dính mép trên khung (góc trên tự bo theo khung .main) */
body.sm-framed .sm-cover { margin: 0; border-radius: 0; }

/* ---------- Nội dung KÉO RỘNG sát sidebar + cạnh phải (kiểu Canva), mẫu to hơn ---------- */
@media (min-width: 721px) {
  body.sm-framed .sm-wrap { max-width: none; margin: 0; padding: 6px 24px 26px; }
  body.sm-framed .sm-cover-body { max-width: none; margin: 0; padding: 0 24px; }
  /* Băng chuyền mẫu: bỏ lề 44px, 2 nút < > đè lên mép thẻ (như Canva) */
  body.sm-framed .sm-car { margin: 0; --sm-tw: 280px; }
  body.sm-framed .sm-tmpls { gap: 18px; padding: 6px 2px 14px; }
  body.sm-framed .sm-titem { width: var(--sm-tw); }
  body.sm-framed .sm-tname { margin-top: 9px; font-size: 13px; }
  body.sm-framed .sm-ttype { font-size: 11.5px; }
  body.sm-framed .sm-car-btn { top: calc(6px + var(--sm-tw) * 9 / 32 - 19px); }
  body.sm-framed .sm-car-btn.prev { left: 8px; }
  body.sm-framed .sm-car-btn.next { right: 8px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  body.sm-framed .main.fm-main,
  body.sm-framed.sb-collapsed .main.fm-main { margin-left: 6px !important; }
}
@media (max-width: 760px) {
  body.sm-framed .main.fm-main { margin: 0 !important; height: 100vh; height: 100dvh; border-radius: 0; border: none; }
}