/* ==========================================================================
   Kho học liệu Hóa học — giao diện
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Thương hiệu — xanh teal/ngọc */
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-darker: #115e59;
  --primary-light: #ccfbf1;
  --primary-50: #f0fdfa;

  /* Màu theo loại nội dung */
  --lesson: #6366f1;   --lesson-bg: #eef2ff;
  --file:   #f59e0b;   --file-bg:   #fffbeb;
  --video:  #f43f5e;   --video-bg:  #fff1f2;
  --quiz:   #8b5cf6;   --quiz-bg:   #f5f3ff;

  /* Nền & chữ */
  --bg: #f6f8fb;
  --card: #ffffff;
  --border: #e6ecf2;
  --border-strong: #d3dce6;
  --text: #10233b;
  --text-soft: #3d5169;
  --muted: #6b7c93;
  --danger: #e11d48;
  --good: #16a34a;

  --radius: 14px;
  --radius-lg: 20px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 35, 59, .06), 0 1px 3px rgba(16, 35, 59, .05);
  --shadow: 0 4px 14px rgba(16, 35, 59, .08);
  --shadow-lg: 0 12px 34px rgba(16, 35, 59, .14);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

body {
  font-family: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(24px, 3vw, 32px); }

::selection { background: var(--primary-light); color: var(--primary-darker); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(100deg, var(--primary-darker), var(--primary) 60%, #0891b2);
  color: #fff;
  padding: 12px 22px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 18px rgba(13, 148, 136, .28);
}
.brand {
  color: #fff; font-weight: 800; font-size: 19px; white-space: nowrap;
  display: flex; align-items: center; gap: 8px; letter-spacing: -.02em;
}
.brand-mark { font-size: 22px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.2)); }
.menu-toggle {
  display: grid; place-items: center; background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 40px; height: 40px; border-radius: 10px; font-size: 20px; cursor: pointer; flex-shrink: 0;
}
/* Ẩn sidebar trên desktop khi bấm nút ☰ */
@media (min-width: 821px) {
  body.nav-collapsed .sidebar { display: none; }
}
.searchbox {
  flex: 1; display: flex; max-width: 520px;
  background: rgba(255,255,255,.16); border-radius: 11px; padding: 3px;
  transition: background .2s var(--ease);
}
.searchbox:focus-within { background: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.16); }
.searchbox input {
  flex: 1; border: none; background: transparent; padding: 8px 14px;
  font-size: 14.5px; outline: none; color: #fff; font-family: inherit;
}
.searchbox:focus-within input { color: var(--text); }
.searchbox input::placeholder { color: rgba(255,255,255,.8); }
.searchbox:focus-within input::placeholder { color: var(--muted); }
.searchbox button {
  border: none; background: transparent; color: #fff; font-size: 15px;
  padding: 0 12px; border-radius: 9px; cursor: pointer; transition: transform .15s var(--ease);
}
.searchbox:focus-within button { color: var(--primary); }
.searchbox button:hover { transform: scale(1.15); }
.usernav { margin-left: auto; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.hello { font-size: 14px; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.22); font-weight: 700; font-size: 14px;
  border: 1.5px solid rgba(255,255,255,.5);
}

/* ---------- Layout ---------- */
.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 288px; flex-shrink: 0; background: var(--card);
  border-right: 1px solid var(--border); padding: 20px 14px;
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
}
.sidebar-head {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; text-transform: uppercase; font-size: 11.5px;
  color: var(--muted); letter-spacing: .08em; margin-bottom: 12px; padding: 0 8px;
}
.content {
  flex: 1; padding: 30px 40px; max-width: 1040px; width: 100%;
  animation: fadeUp .4s var(--ease) both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Tree menu ---------- */
.tree { list-style: none; }
.tree .tree { padding-left: 14px; margin-left: 13px; border-left: 1.5px dashed var(--border-strong); }
.tree-row { display: flex; align-items: center; gap: 2px; }
.tree-caret {
  border: none; background: none; cursor: pointer; color: var(--muted);
  width: 20px; height: 24px; font-size: 11px; flex-shrink: 0;
  transition: transform .2s var(--ease); display: grid; place-items: center;
}
.tree-caret.open { transform: rotate(90deg); }
.tree-dot {
  width: 20px; height: 24px; flex-shrink: 0; position: relative;
}
.tree-dot::before {
  content: ""; position: absolute; left: 7px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--border-strong);
}
.tree-link {
  flex: 1; display: block; padding: 6px 10px; border-radius: 8px;
  color: var(--text-soft); font-size: 14px; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.tree-link:hover { background: var(--primary-50); color: var(--primary-dark); }
.tree-link.active {
  background: linear-gradient(100deg, var(--primary), #0891b2); color: #fff; font-weight: 600;
  box-shadow: 0 3px 10px rgba(13, 148, 136, .32);
}
.collapsed > .tree { display: none; }

/* ---------- Nút quản lý danh mục (⋮) + kéo-thả ---------- */
.tree-menu-btn {
  flex-shrink: 0; margin-left: 2px; border: none; background: none; color: var(--muted);
  cursor: grab; font-size: 19px; line-height: 1; width: 30px; height: 30px;
  border-radius: 8px; display: grid; place-items: center; touch-action: none;
  opacity: .32; transition: opacity .15s var(--ease), color .15s, background .15s;
}
.tree-row:hover .tree-menu-btn { opacity: .7; }
.tree-menu-btn:hover { opacity: 1; color: var(--primary-dark); background: var(--primary-50); }
.tree-menu-btn:active { cursor: grabbing; }
/* Thiết bị cảm ứng (không hover): luôn hiện nút cho dễ bấm */
@media (hover: none) { .tree-menu-btn { opacity: .5; } }

/* Dòng đang được kéo */
.tree-row.dragging-src { opacity: .4; }
.cat-drag-ghost {
  position: fixed; z-index: 320; pointer-events: none; transform: translate(12px, 10px);
  background: var(--primary-dark); color: #fff; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow-lg); max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body.cat-dragging { cursor: grabbing; }
body.cat-dragging .tree-link { cursor: grabbing; }

/* Chỉ báo điểm thả */
.tree-row { position: relative; border-radius: 8px; }
.tree-row.drop-inside { background: var(--primary-50); box-shadow: inset 0 0 0 2px var(--primary); }
.tree-row.drop-before::before,
.tree-row.drop-after::after {
  content: ""; position: absolute; left: 22px; right: 4px; height: 3px;
  background: var(--primary); border-radius: 2px;
}
.tree-row.drop-before::before { top: -2px; }
.tree-row.drop-after::after { bottom: -2px; }

/* Vùng thả để đưa danh mục ra cấp gốc (chỉ hiện khi đang kéo) */
.tree-root-drop {
  display: none; margin: 0 0 8px; padding: 10px 12px; border-radius: 10px;
  border: 1.5px dashed var(--primary); background: var(--primary-50);
  color: var(--primary-dark); font-size: 12.5px; font-weight: 600; text-align: center;
}
body.cat-dragging .tree-root-drop { display: block; }
.tree-root-drop.active { background: var(--primary-light); box-shadow: inset 0 0 0 2px var(--primary); }

.tree-hint { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 0 0 10px; padding: 0 8px; }
.tree-hint b { color: var(--primary-dark); font-weight: 700; }

/* ---------- Hộp thoại quản lý danh mục (dùng chung) ---------- */
.cmodal-back {
  position: fixed; inset: 0; z-index: 300; background: rgba(16, 35, 59, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeUp .15s var(--ease);
}
.cmodal {
  background: var(--card); border-radius: var(--radius-lg); width: 100%; max-width: 380px;
  max-height: 82vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg);
}
.cmodal-head { padding: 15px 18px; font-size: 15px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cmodal-head b { color: var(--primary-dark); }
.cmodal-body { overflow-y: auto; padding: 8px; }
.cmodal-body.pad { padding: 16px 18px; font-size: 14px; color: var(--text-soft); line-height: 1.55; }
.cmodal-body.pad b { color: var(--text); }
.cmodal-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: none; background: none;
  padding: 12px 14px; border-radius: 9px; font-size: 14.5px; color: var(--text-soft);
  cursor: pointer; font-family: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmodal-opt .ic { width: 20px; text-align: center; flex-shrink: 0; }
.cmodal-opt:hover:not(:disabled) { background: var(--primary-50); color: var(--primary-dark); }
.cmodal-opt:disabled { opacity: .4; cursor: default; }
.cmodal-opt.danger { color: var(--danger); }
.cmodal-opt.danger:hover { background: #fff1f3; }
.cmodal-opt .sub { font-size: 11px; color: var(--muted); font-weight: 400; }
.cmodal-input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 15px; font-family: inherit; color: var(--text); box-sizing: border-box;
}
.cmodal-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.cmodal-foot { display: flex; gap: 8px; padding: 10px 12px 14px; flex-shrink: 0; }
.cmodal-btn {
  flex: 1; padding: 11px; border: 1px solid var(--border-strong); background: var(--card);
  border-radius: 10px; font-weight: 600; color: var(--text-soft); cursor: pointer; font-family: inherit; font-size: 14px;
}
.cmodal-btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.cmodal-btn.primary { background: linear-gradient(100deg, var(--primary), var(--primary-dark)); border: none; color: #fff; }
.cmodal-btn.primary:hover { color: #fff; box-shadow: 0 4px 14px rgba(13, 148, 136, .35); }
.cmodal-btn.danger { background: var(--danger); border: none; color: #fff; }
.cmodal-btn.danger:hover { color: #fff; box-shadow: 0 4px 14px rgba(225, 29, 72, .35); }
@media (max-width: 560px) {
  .cmodal-back { align-items: flex-end; padding: 0; }
  .cmodal { max-width: none; border-radius: 18px 18px 0 0; max-height: 88vh; }
  .cmodal-opt { padding: 14px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 17px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--card); color: var(--text-soft);
  font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: all .18s var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary {
  background: linear-gradient(100deg, var(--primary), var(--primary-dark)); border: none; color: #fff;
  box-shadow: 0 4px 14px rgba(13, 148, 136, .3);
}
.btn-primary:hover { color: #fff; box-shadow: 0 7px 20px rgba(13, 148, 136, .42); }
.btn-light { background: #fff; border: none; color: var(--primary-dark); box-shadow: var(--shadow); }
.btn-light:hover { color: var(--primary-darker); }
.btn-outline-light { background: transparent; border: 1.5px solid rgba(255,255,255,.6); color: #fff; }
.btn-outline-light:hover { background: rgba(255,255,255,.14); color: #fff; border-color: #fff; }
.btn-ghost { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.24); color: #fff; border-color: rgba(255,255,255,.5); }
.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 12px 24px; font-size: 15.5px; border-radius: 12px; }

.mini-btn {
  border: 1px solid var(--border-strong); background: var(--card); border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer; font-size: 14px; line-height: 1;
  display: inline-grid; place-items: center; transition: all .15s var(--ease); color: var(--text-soft);
}
.mini-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: #fff1f3; }
.inline { display: inline; }

/* ---------- Forms ---------- */
.inline-form { display: flex; gap: 8px; margin: 10px 0; }
.inline-form input[type="text"] {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 9px;
  font-size: 14px; font-family: inherit; outline: none; transition: border-color .15s var(--ease), box-shadow .15s;
}
.hidden { display: none !important; }
.big-form { max-width: 660px; display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.big-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; color: var(--text-soft); }
.big-form input[type="text"], .big-form input[type="url"], .big-form input[type="password"],
.big-form textarea, .big-form input[type="file"], .big-form select {
  padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 14.5px; font-family: inherit; font-weight: 400; background: var(--card);
  color: var(--text); outline: none; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.big-form select { cursor: pointer; }

/* Đề thi nhiều dạng câu (mc / đúng-sai / trả lời ngắn) */
.exam-part {
  margin: 22px 0 10px; font-size: 15px; font-weight: 800; color: var(--primary-dark);
  text-transform: uppercase; letter-spacing: .02em; padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-light);
}
.tf-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.tf-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
}
.tf-text { flex: 1; min-width: 160px; font-size: 14.5px; }
.tf-choices { display: flex; gap: 6px; flex-shrink: 0; }
.tf-choices label {
  display: flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 600;
  padding: 5px 12px; border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer;
}
.tf-choices label:has(input:checked) { border-color: var(--primary); background: var(--primary-50); color: var(--primary-dark); }
.short-input {
  margin-top: 6px; width: 100%; max-width: 360px; padding: 10px 13px; font-size: 15px;
  border: 1px solid var(--border-strong); border-radius: 10px; outline: none; font-family: inherit;
}
.big-form textarea { resize: vertical; line-height: 1.7; }
input:focus, textarea:focus, .inline-form input:focus {
  border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(13, 148, 136, .14);
}
input[type="file"] { cursor: pointer; }
.radio-row { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-row label {
  display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px;
  padding: 10px 16px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer;
  transition: all .15s var(--ease); flex-direction: row;
}
.radio-row label:has(input:checked) { border-color: var(--primary); background: var(--primary-50); color: var(--primary-dark); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* Video minh họa cho cẩm nang (bài học) */
.lesson-video-field { display: flex; flex-direction: column; gap: 9px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 12px; }
.lesson-video-field .lvf-title { font-weight: 700; color: var(--lesson); }

/* Bảng QR của cẩm nang */
.lesson-qr { margin-top: 26px; }
.lesson-qr-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.lesson-qr-box img { width: 148px; height: 148px; display: block; border: 1px solid var(--border); border-radius: 10px; }
.lesson-qr-actions { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 220px; }
.lesson-qr-actions input { padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 9px; font-size: 13px; width: 100%; box-sizing: border-box; color: var(--text-soft); }
.lesson-qr-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* Footer + đếm lượt truy cập */
.site-footer { text-align: center; padding: 18px 16px 22px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); margin-top: 6px; }
.site-footer .visit-counter strong { color: var(--primary-dark); font-weight: 700; }
.error-msg {
  background: #fff1f3; border: 1px solid #fecdd3; color: var(--danger);
  padding: 11px 15px; border-radius: 10px; margin: 12px 0; font-size: 14px; font-weight: 500;
}
.big-form code, .lesson-content code {
  background: var(--primary-50); color: var(--primary-dark); padding: 1px 6px;
  border-radius: 5px; font-size: .9em; font-family: "SF Mono", Menlo, monospace;
}

/* ---------- Auth ---------- */
.auth-box {
  max-width: 430px; margin: 48px auto; background: var(--card);
  padding: 36px 34px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.auth-box h1 { margin-bottom: 6px; }
.auth-box .big-form { margin: 20px 0 16px; }

/* ---------- Page bits ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 16px; font-weight: 500; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.page-head { display: flex; align-items: center; gap: 12px; margin: 16px 0 8px; flex-wrap: wrap; }
.page-head h1, .page-head h2 { margin: 0; }
.page-actions { display: flex; gap: 6px; }
.section-title { font-size: 18px; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title::before {
  content: ""; width: 4px; height: 18px; border-radius: 3px;
  background: linear-gradient(var(--primary), #0891b2);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lead { font-size: 15.5px; color: var(--text-soft); margin: 12px 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--primary-darker) 0%, var(--primary) 45%, #0891b2 100%);
  color: #fff; border-radius: var(--radius-lg); padding: 46px 42px; margin-bottom: 26px;
  box-shadow: 0 14px 40px rgba(13, 148, 136, .28);
}
.hero-inner { position: relative; z-index: 2; }
.hero-eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; background: rgba(255,255,255,.18); padding: 5px 13px;
  border-radius: 30px; margin-bottom: 14px; border: 1px solid rgba(255,255,255,.25);
}
.hero h1 { font-size: clamp(26px, 3.6vw, 40px); font-weight: 800; margin-bottom: 12px; }
.hero p { opacity: .96; max-width: 540px; font-size: 15.5px; }
.hero-cta { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.hero-atoms { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.hero-atoms .atom { position: absolute; opacity: .16; filter: grayscale(1) brightness(3); }
.atom { animation: float 7s ease-in-out infinite; }
.a1 { top: 12%; right: 8%;  font-size: 90px; animation-delay: 0s; }
.a2 { top: 52%; right: 22%; font-size: 54px; animation-delay: 1.2s; opacity: .22 !important; }
.a3 { top: 68%; right: 5%;  font-size: 64px; animation-delay: 2.1s; }
.a4 { top: 20%; right: 32%; font-size: 40px; animation-delay: .6s; }
.a5 { top: 74%; right: 40%; font-size: 46px; animation-delay: 1.8s; }
.a6 { top: 6%;  right: 46%; font-size: 34px; animation-delay: 2.6s; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-18px) rotate(8deg); } }
@media (prefers-reduced-motion: reduce) { .atom { animation: none; } }

/* ---------- Stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 12px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  border-left: 4px solid var(--type-color, var(--primary));
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-icon {
  font-size: 22px; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: var(--type-bg, var(--primary-50));
}
.stat-text { display: flex; flex-direction: column; }
.stat-num { font-size: 24px; font-weight: 800; color: var(--type-color, var(--primary)); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; }

/* ---------- Subcategories ---------- */
.subcat-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.subcat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 11px;
  padding: 13px 20px; font-size: 14px; font-weight: 600; color: var(--text-soft);
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  transition: all .18s var(--ease); box-shadow: var(--shadow-sm);
}
.subcat-card:hover { border-color: var(--primary); color: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow); }
.subcat-card.add { border-style: dashed; color: var(--muted); background: transparent; box-shadow: none; font-family: inherit; }
.subcat-card.add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.add-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* ---------- Item list ---------- */
.item-list { display: flex; flex-direction: column; gap: 11px; margin-top: 8px; }

/* Nút đổi kiểu hiển thị */
.view-switch { display: flex; justify-content: flex-end; gap: 6px; margin: 4px 0 2px; }
.view-btn {
  border: 1px solid var(--border-strong); background: var(--card); color: var(--muted);
  font-size: 13px; font-weight: 600; font-family: inherit; padding: 5px 12px; border-radius: 8px; cursor: pointer;
}
.view-btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.view-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Dạng lưới (lướt) */
.item-list.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.view-grid .item-card { flex-direction: column; align-items: stretch; text-align: left; gap: 10px; }
.view-grid .item-icon { width: 100%; height: 84px; font-size: 34px; border-radius: 12px; }
.view-grid .item-arrow { display: none; }
.view-grid .item-desc { white-space: normal; }
.item-card {
  display: flex; gap: 15px; align-items: center; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 18px;
  color: var(--text); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.item-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--type-color, var(--primary)); opacity: 0; transition: opacity .18s var(--ease);
}
.item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--type-color, var(--primary)); }
.item-card:hover::before { opacity: 1; }
.item-icon {
  font-size: 24px; width: 50px; height: 50px; flex-shrink: 0; border-radius: 12px;
  display: grid; place-items: center; background: var(--type-bg, var(--primary-50));
}
.item-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.item-title { font-weight: 600; font-size: 15.5px; }
.item-meta { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.meta-dot { opacity: .5; }
.item-desc {
  font-size: 13.5px; color: var(--text-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 640px;
}
.item-arrow {
  color: var(--type-color, var(--primary)); font-size: 18px; opacity: 0;
  transform: translateX(-6px); transition: all .18s var(--ease); flex-shrink: 0;
}
.item-card:hover .item-arrow { opacity: 1; transform: none; }

/* Badge màu theo loại */
.type-badge {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px;
  border-radius: 20px; color: var(--type-color, var(--primary)); background: var(--type-bg, var(--primary-50));
}

/* Bảng màu cho từng loại (dùng chung item-card, stat-card, badge) */
.type-lesson { --type-color: var(--lesson); --type-bg: var(--lesson-bg); }
.type-file   { --type-color: var(--file);   --type-bg: var(--file-bg); }
.type-video  { --type-color: var(--video);  --type-bg: var(--video-bg); }
.type-quiz   { --type-color: var(--quiz);   --type-bg: var(--quiz-bg); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 44px 20px; }
.empty-emoji { font-size: 46px; margin-bottom: 10px; opacity: .7; }

/* ---------- Item detail ---------- */
.lesson-content {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 32px; margin-top: 16px; font-size: 16px; box-shadow: var(--shadow-sm); color: var(--text-soft);
}
.lesson-content h3 { margin: 18px 0 8px; color: var(--primary-darker); font-size: 20px; }
.lesson-content h3:first-child, .lesson-content h4:first-child { margin-top: 0; }
.lesson-content h4 { margin: 16px 0 6px; color: var(--primary-dark); font-size: 16.5px; }
.lesson-content p { margin: 10px 0; }
.lesson-content strong { color: var(--text); }

.file-box {
  background: linear-gradient(120deg, var(--file-bg), #fff); border: 1px solid #fde68a;
  border-radius: var(--radius); padding: 20px 22px; margin: 16px 0;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.pdf-frame { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: 12px; margin-top: 6px; }
.preview-img { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); }

/* Nhiều file trong một mục */
.file-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.file-head p { margin: 0; }

.file-card { border: 1px solid var(--border); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-sm); overflow: hidden; }
.file-thumb { display: flex; align-items: center; justify-content: center; text-decoration: none; background: #f1f5f9; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-ico-big { font-size: 46px; line-height: 1; }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14.5px; }
.file-size { font-size: 13px; white-space: nowrap; }
.file-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* ▦ Dạng lưới — kiểu Google Drive: ảnh thu nhỏ to */
.file-grid.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 8px; }
.view-grid .file-thumb { height: 150px; }
.view-grid .file-info { padding: 10px 12px 0; }
.view-grid .file-actions { display: flex; gap: 6px; padding: 8px 12px 12px; }
.view-grid .file-actions .btn { flex: 1; text-align: center; }

/* ☰ Dạng list — hàng ngang gọn */
.file-grid.view-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.view-list .file-card { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.view-list .file-thumb { width: 52px; height: 52px; flex-shrink: 0; border-radius: 10px; overflow: hidden; }
.view-list .file-ico-big { font-size: 26px; }
.view-list .file-info { flex: 1; flex-direction: row; align-items: baseline; gap: 10px; }
.view-list .file-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Ngân hàng đề thi */
.qbank-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.stat-pill { background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px; font-size: 13.5px; }
.stat-pill.t-mc { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.stat-pill.t-tf { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.stat-pill.t-short { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.qbank-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.qb-input { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-size: 14px; background: var(--card); }
#qb-search { flex: 1; min-width: 220px; }
.qbank-count { margin: 2px 0 10px; }
.qbank-list { display: flex; flex-direction: column; gap: 8px; }
.qbank-row { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: var(--shadow-sm); }
.qb-badge { flex-shrink: 0; align-self: flex-start; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.qb-badge.t-mc { background: #eff6ff; color: #1d4ed8; }
.qb-badge.t-tf { background: #f0fdf4; color: #15803d; }
.qb-badge.t-short { background: #fef2f2; color: #b91c1c; }
.qb-main { min-width: 0; flex: 1; }
.qb-q { font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }
.qb-ans { font-size: 13.5px; color: var(--muted); }
.qb-ans span { color: #15803d; font-weight: 600; }
.qb-src { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.qb-srckind { font-weight: 600; }
.qb-cat { font-style: italic; }

/* Mã đề + lưu mã đề */
.exam-meta-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.exam-meta-bar p { margin: 0; }
.exam-code-badge { flex-shrink: 0; background: #ecfeff; border: 1px solid #a5f3fc; color: #0e7490; padding: 5px 14px; border-radius: 999px; font-size: 14px; }
.exam-code-badge strong { font-size: 16px; letter-spacing: 1px; }
.exam-save-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 4px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.saved-pill { background: #fef9c3; border: 1px solid #fde047; color: #854d0e; padding: 4px 12px; border-radius: 999px; font-size: 13.5px; }
.danger-outline { background: #fff; border: 1px solid var(--danger, #dc2626); color: var(--danger, #dc2626); }
.danger-outline:hover { background: var(--danger, #dc2626); color: #fff; }

.video-wrap { position: relative; padding-top: 56.25%; margin-top: 16px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.video-player { width: 100%; max-height: 72vh; border-radius: 14px; background: #000; margin-top: 16px; box-shadow: var(--shadow-lg); }

/* ---------- Quiz ---------- */
.q-block-view, .q-review {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin: 13px 0; box-shadow: var(--shadow-sm);
}
.q-text { margin-bottom: 10px; font-size: 15.5px; }
.q-opt-label {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-radius: 10px;
  cursor: pointer; font-size: 14.5px; border: 1px solid transparent; transition: all .14s var(--ease); margin: 4px 0;
}
.q-opt-label:hover { background: var(--quiz-bg); border-color: #ddd6fe; }
.q-opt-label:has(input:checked) { background: var(--quiz-bg); border-color: var(--quiz); font-weight: 500; }
.q-opt-label input { accent-color: var(--quiz); width: 17px; height: 17px; }
.q-opt-line { padding: 8px 13px; border-radius: 10px; font-size: 14.5px; margin: 4px 0; }
.q-review.correct { border-left: 4px solid var(--good); }
.q-review.wrong { border-left: 4px solid var(--danger); }
.q-opt-line.is-correct { background: #dcfce7; color: #14532d; font-weight: 600; }
.q-opt-line.is-chosen-wrong { background: #ffe4e6; color: #881337; }
.score-box {
  border-radius: var(--radius); padding: 18px 22px; margin: 16px 0; font-size: 17px;
  background: linear-gradient(120deg, #fff1f3, #fff); border: 1px solid #fecdd3;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.score-box.good { background: linear-gradient(120deg, #f0fdf4, #fff); border-color: #bbf7d0; }
.score-box strong { font-size: 20px; }

/* Trình soạn trắc nghiệm */
.q-builder {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin: 12px 0; display: flex; flex-direction: column; gap: 11px;
  box-shadow: var(--shadow-sm); border-left: 4px solid var(--quiz);
}
.q-builder-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--quiz); }
.q-head-left { display: flex; align-items: center; gap: 8px; }
.q-drag {
  border: none; background: none; color: var(--muted); cursor: grab;
  font-size: 16px; line-height: 1; padding: 4px 7px; border-radius: 6px;
  touch-action: none; flex-shrink: 0;
}
.q-drag:hover { color: var(--quiz); background: var(--quiz-bg); }
.q-drag:active { cursor: grabbing; }
.q-builder.dragging { opacity: .6; box-shadow: 0 10px 26px rgba(16, 35, 59, .18); }
.q-builder textarea, .q-builder input[type="text"] {
  padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 9px;
  font-size: 14px; font-family: inherit; width: 100%; outline: none;
}
.opt-row { display: flex; align-items: center; gap: 10px; }
.opt-row input[type="radio"] { flex-shrink: 0; accent-color: var(--quiz); width: 17px; height: 17px; }
.opt-hint { font-size: 12.5px; color: var(--muted); margin-left: 8px; }
.q-body { display: flex; flex-direction: column; gap: 10px; }
.q-type {
  padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: 13.5px; font-weight: 600; font-family: inherit; background: var(--quiz-bg);
  color: var(--quiz); cursor: pointer;
}
.tf-build-list { display: flex; flex-direction: column; gap: 8px; }
.tf-build { display: flex; align-items: center; gap: 8px; }
.tf-label { font-weight: 700; color: var(--quiz); width: 20px; flex-shrink: 0; }
.tf-build .tf-stmt { flex: 1; }
.tf-ans {
  flex-shrink: 0; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; background: var(--card); cursor: pointer;
}
.q-answer { border-color: var(--quiz) !important; }

/* Ô nhập câu hỏi từ ảnh bằng AI (trong trình soạn trắc nghiệm) */
.ai-import {
  border: 1px dashed var(--quiz); background: var(--quiz-bg); border-radius: var(--radius);
  padding: 14px 16px; margin: 8px 0 4px; display: flex; flex-direction: column; gap: 8px;
}
.ai-import-head { font-weight: 700; color: var(--quiz); }
.ai-import-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ai-import-row input[type="file"] { flex: 1; min-width: 180px; font-size: 13px; }
.ai-import-status { margin: 0; color: var(--muted); }
.ai-import-status.ok { color: var(--good); font-weight: 600; }
.ai-import-status.err { color: var(--danger); font-weight: 600; }

/* Bàn làm việc ngân hàng câu hỏi */
.bank-add { margin-bottom: 12px; }
.pool-box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); overflow: hidden; }
.pool-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--quiz-bg); }
.pool-head strong { color: var(--quiz); }
.pool-list { max-height: 340px; overflow-y: auto; }
.pool-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.pool-item:last-child { border-bottom: none; }
.pool-item .type-badge { flex-shrink: 0; }
.pool-num { flex-shrink: 0; font-weight: 700; color: var(--muted); min-width: 22px; text-align: right; }
.pool-q { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); }
.pool-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; background: var(--quiz-bg); color: var(--quiz); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.pool-group-n { font-weight: 600; font-size: 12px; text-transform: none; letter-spacing: 0; background: #fff; border: 1px solid var(--border); color: var(--muted); padding: 1px 9px; border-radius: 999px; }
.pool-del { flex-shrink: 0; }
.pool-save { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.pool-save input { flex: 1; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 9px; font-size: 14px; font-family: inherit; outline: none; }

.gen-box { max-width: 640px; display: flex; flex-direction: column; gap: 14px; }
.gen-box > label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 14px; color: var(--text-soft); }
.gen-box input[type="text"], .gen-box select { padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 10px; font-size: 14.5px; font-family: inherit; outline: none; background: var(--card); }
.gen-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.gen-counts label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13.5px; color: var(--text-soft); position: relative; }
.gen-counts input { padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; font-size: 15px; font-family: inherit; outline: none; }
.gen-max { position: absolute; right: 12px; bottom: 10px; color: var(--muted); font-size: 13px; font-weight: 500; pointer-events: none; }

.bank-list { display: flex; flex-direction: column; gap: 10px; }
.bank-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }
.bank-info { display: flex; flex-direction: column; gap: 2px; }
.bank-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* Hộp sửa câu hỏi (modal) */
.q-editor-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(16,35,59,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.q-editor-box { background: var(--card); border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; }
.q-editor-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.q-editor-head strong { flex-shrink: 0; }
.q-editor-head .q-type { margin-left: auto; }
.q-editor-body { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.qe-field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 14px; color: var(--text-soft); }
.qe-field textarea, .qe-field input, .qe-opt, .qe-stmt-text {
  padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 9px; font-size: 14.5px; font-family: inherit; outline: none; width: 100%;
}
.qe-opts, .qe-stmts { display: flex; flex-direction: column; gap: 8px; }
.qe-opt-row, .qe-stmt-row { display: flex; align-items: center; gap: 8px; }
.qe-opt-row input[type="radio"] { flex-shrink: 0; accent-color: var(--quiz); width: 17px; height: 17px; }
.qe-stmt-ans { flex-shrink: 0; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; font-family: inherit; font-size: 13.5px; }
.q-editor-foot { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }

/* Cấu hình thi (admin) */
.exam-settings { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--card); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 12px; margin: 6px 0 14px; max-width: 720px; }
.exam-toggle { display: flex; align-items: flex-start; gap: 9px; font-size: 14.5px; cursor: pointer; }
.exam-toggle input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--quiz); flex-shrink: 0; }
.exam-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.exam-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--text-soft); }
.exam-grid input { padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 9px; font-size: 14px; font-family: inherit; outline: none; }
.exam-save { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.exam-score-head { font-weight: 700; color: var(--quiz); font-size: 14px; margin-top: 4px; }
.exam-grid input[type="number"] { width: 100%; }
#pt-total { color: var(--primary-dark); }

/* Bảng điểm theo dạng (kết quả) */
.result-breakdown { width: 100%; max-width: 520px; border-collapse: collapse; margin: 14px 0; font-size: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.result-breakdown th, .result-breakdown td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.result-breakdown th { background: var(--quiz-bg); color: var(--quiz); font-weight: 700; font-size: 13px; }
.result-breakdown td:not(:first-child), .result-breakdown th:not(:first-child) { text-align: center; }
.result-breakdown .bd-total { background: var(--bg); font-weight: 700; }
.result-breakdown .bd-total td { border-bottom: none; }

/* Cổng vào bài thi (học sinh) */
.exam-gate { margin: 16px 0; }
.gate-msg { background: var(--file-bg); border: 1px solid #fde68a; border-radius: var(--radius); padding: 18px 20px; font-size: 15px; }
.gate-card { max-width: 420px; margin: 10px auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px 24px; box-shadow: var(--shadow-lg); text-align: center; }
.gate-card h3 { margin-bottom: 6px; }
.gate-form { display: flex; gap: 8px; margin-top: 14px; }
.gate-form input { flex: 1; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 10px; font-size: 15px; outline: none; text-align: center; letter-spacing: .05em; }

/* Đánh giá của AI sau khi nộp */
.ai-assess { margin: 16px 0; background: linear-gradient(120deg, var(--primary-50), #fff); border: 1px solid var(--primary-light); border-radius: var(--radius); padding: 18px 20px; }
.ai-assess h3 { color: var(--primary-dark); margin-bottom: 8px; }
.assess-body { font-size: 14.5px; line-height: 1.7; color: var(--text-soft); }
.assess-body strong { color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .menu-toggle { display: grid; place-items: center; order: -1; }
  .brand-text { display: none; }
  .layout { display: block; }
  .sidebar {
    position: fixed; top: 60px; left: 0; bottom: 0; z-index: 40; width: 280px;
    height: auto; transform: translateX(-100%); transition: transform .25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .content { padding: 20px 18px; max-width: none; }
  .hero { padding: 32px 24px; }
  .hero-atoms .a4, .hero-atoms .a5, .hero-atoms .a6 { display: none; }
  .add-buttons { margin-left: 0; width: 100%; }
  .usernav .hello { display: none; }
}
@media (max-width: 560px) {
  .searchbox { max-width: none; }
  .topbar { gap: 10px; padding: 10px 14px; }
}

/* ==========================================================================
   Trợ lý AI Hóa học
   ========================================================================== */
.ai-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 60;
  display: flex; align-items: center; gap: 9px; padding: 13px 20px;
  background: linear-gradient(120deg, var(--primary), #0891b2); color: #fff;
  border: none; border-radius: 40px; font-size: 15px; font-weight: 700; font-family: inherit;
  cursor: pointer; box-shadow: 0 8px 24px rgba(13, 148, 136, .45);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  animation: fabIn .4s var(--ease) both;
}
.ai-fab:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 12px 30px rgba(13, 148, 136, .55); }
.ai-fab-icon { font-size: 20px; animation: wiggle 3s ease-in-out infinite; }
@keyframes wiggle { 0%, 92%, 100% { transform: rotate(0); } 94% { transform: rotate(-12deg); } 96% { transform: rotate(12deg); } 98% { transform: rotate(-8deg); } }
@keyframes fabIn { from { opacity: 0; transform: translateY(20px) scale(.8); } to { opacity: 1; transform: none; } }

.ai-panel {
  position: fixed; bottom: 24px; right: 24px; z-index: 61;
  width: 380px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 48px);
  background: var(--card); border-radius: 18px; box-shadow: 0 20px 60px rgba(16, 35, 59, .28);
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border);
  animation: panelIn .28s var(--ease) both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }

.ai-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; background: linear-gradient(120deg, var(--primary-darker), var(--primary) 70%, #0891b2);
  color: #fff; flex-shrink: 0;
}
.ai-head-title { display: flex; align-items: center; gap: 11px; }
.ai-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.2); font-size: 20px; border: 1.5px solid rgba(255,255,255,.4);
}
.ai-head-title strong { display: block; font-size: 15.5px; }
.ai-sub { font-size: 12px; opacity: .85; }
.ai-close {
  background: rgba(255,255,255,.16); border: none; color: #fff; width: 32px; height: 32px;
  border-radius: 9px; cursor: pointer; font-size: 15px; transition: background .15s var(--ease);
}
.ai-close:hover { background: rgba(255,255,255,.3); }

.ai-messages {
  flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(var(--bg), #fff);
}
.ai-msg { display: flex; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble {
  max-width: 84%; padding: 11px 14px; border-radius: 15px; font-size: 14.5px; line-height: 1.62;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.ai-msg.bot .ai-bubble {
  background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 5px;
  color: var(--text); box-shadow: var(--shadow-sm);
}
.ai-msg.user .ai-bubble {
  background: linear-gradient(120deg, var(--primary), var(--primary-dark)); color: #fff;
  border-bottom-right-radius: 5px;
}
.ai-bubble pre {
  background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 9px; margin: 6px 0;
  overflow-x: auto; font-size: 13px; font-family: "SF Mono", Menlo, monospace;
}
.ai-bubble code { background: var(--primary-50); color: var(--primary-dark); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.ai-msg.user .ai-bubble code { background: rgba(255,255,255,.22); color: #fff; }
/* Markdown + công thức trong câu trả lời AI */
.ai-bubble .ai-h { font-weight: 700; line-height: 1.35; margin: 9px 0 3px; }
.ai-bubble .ai-h:first-child { margin-top: 0; }
.ai-bubble .ai-h1 { font-size: 1.16em; }
.ai-bubble .ai-h2 { font-size: 1.1em; }
.ai-bubble .ai-h3, .ai-bubble .ai-h4, .ai-bubble .ai-h5, .ai-bubble .ai-h6 { font-size: 1.04em; color: var(--primary-dark); }
.ai-msg.user .ai-bubble .ai-h3, .ai-msg.user .ai-bubble .ai-h4 { color: #fff; }
.ai-bubble .ai-ul { margin: 4px 0; padding-left: 20px; }
.ai-bubble .ai-ul li { margin: 2px 0; }
.ai-bubble .ai-sp { height: 7px; }
.ai-bubble .ai-math { font-family: "Cambria Math", "STIX Two Math", Georgia, "Times New Roman", serif; }
.ai-bubble .ai-math sup { font-size: .74em; vertical-align: super; line-height: 0; }
.ai-bubble .ai-math sub { font-size: .74em; vertical-align: sub; line-height: 0; }
.ai-bubble .ai-math b { font-weight: 700; }
.ai-bubble.typing { display: flex; gap: 4px; align-items: center; }
.ai-bubble.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5;
  animation: blink 1.3s infinite both;
}
.ai-bubble.typing span:nth-child(2) { animation-delay: .2s; }
.ai-bubble.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.ai-suggests { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; margin-top: 2px; }
.ai-chip {
  background: var(--primary-50); border: 1px solid var(--primary-light); color: var(--primary-dark);
  padding: 7px 13px; border-radius: 20px; font-size: 13px; font-family: inherit; cursor: pointer;
  text-align: left; transition: all .15s var(--ease);
}
.ai-chip:hover { background: var(--primary-light); transform: translateX(2px); }

.ai-form {
  display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--border);
  background: var(--card); flex-shrink: 0;
}
.ai-form textarea {
  flex: 1; border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px 13px;
  font-size: 14.5px; font-family: inherit; resize: none; outline: none; max-height: 120px; line-height: 1.5;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.ai-send {
  flex-shrink: 0; width: 42px; height: 42px; border: none; border-radius: 12px;
  background: linear-gradient(120deg, var(--primary), var(--primary-dark)); color: #fff;
  font-size: 17px; cursor: pointer; transition: all .15s var(--ease);
  box-shadow: 0 4px 12px rgba(13, 148, 136, .35);
}
.ai-send:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13, 148, 136, .45); }
.ai-send:disabled { opacity: .5; cursor: default; }

@media (max-width: 560px) {
  .ai-panel { bottom: 0; right: 0; left: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .ai-fab { bottom: 16px; right: 16px; }
}

/* ==========================================================================
   Trò chơi (Ion Drop)
   ========================================================================== */
.game-link { gap: 5px; }
@media (max-width: 900px) { .game-link-text { display: none; } }

/* Thẻ quảng bá game ở trang chủ */
.game-promo {
  display: flex; align-items: center; gap: 16px; margin: 16px 0 4px;
  padding: 16px 20px; border-radius: var(--radius);
  background: linear-gradient(120deg, #0d1730, #142a52 60%, #0d9488);
  color: #fff; box-shadow: var(--shadow); border: 1px solid rgba(120,200,255,.2);
  text-decoration: none !important; transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.game-promo:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.game-promo-icon { font-size: 34px; flex-shrink: 0; }
.game-promo-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.game-promo-title { font-weight: 700; font-size: 16.5px; }
.game-promo-desc { font-size: 13.5px; opacity: .9; }
.game-promo-cta {
  flex-shrink: 0; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13.5px; white-space: nowrap;
}

/* Khung nhúng game */
.game-shell { display: flex; justify-content: center; margin: 16px 0 24px; }
.game-frame {
  width: 100%; max-width: 600px; height: min(82vh, 780px);
  border: 1px solid var(--border); border-radius: 16px; background: #070b16;
  box-shadow: var(--shadow-lg); display: block;
}
.game-frame.tall { max-width: 440px; height: min(80vh, 800px); background: #05080f; }

.game-guide { max-width: 720px; }
.guide-list { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.guide-list li {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 15px; font-size: 14.5px; color: var(--text-soft); box-shadow: var(--shadow-sm);
}
.guide-list strong { color: var(--text); }
.ion-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ion-tag {
  font-weight: 700; font-size: 14px; padding: 5px 13px; border-radius: 20px;
  border: 1.5px solid;
}
.ion-tag.cat { background: #fff7ed; color: #b45309; border-color: #fed7aa; }
.ion-tag.an { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }

@media (max-width: 560px) {
  .game-promo-cta { display: none; }
  .game-frame { height: min(78vh, 720px); }
}

/* ==========================================================================
   Thanh menu ngang các mục (kiểu hub học liệu)
   ========================================================================== */
.sectionbar {
  position: sticky; top: 60px; z-index: 30;
  background: #fff; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.sectionbar-inner {
  display: flex; gap: 4px; max-width: 1320px; margin: 0 auto; padding: 6px 12px;
  overflow-x: auto; scrollbar-width: none;
}
.sectionbar-inner::-webkit-scrollbar { display: none; }
.sectionbar a {
  white-space: nowrap; padding: 8px 15px; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: var(--text-soft); transition: all .15s var(--ease);
}
.sectionbar a:hover { background: var(--primary-50); color: var(--primary-dark); }

/* ==========================================================================
   Lưới thẻ tính năng (feature hub)
   ========================================================================== */
.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 8px;
}
.feature-card {
  display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  color: var(--text); text-decoration: none !important;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.feature-top {
  height: 108px; display: grid; place-items: center; font-size: 46px; color: #fff;
  position: relative; overflow: hidden;
}
.feature-top::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 75% 25%, rgba(255,255,255,.25), transparent 60%);
}
.feature-body { padding: 15px 17px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.feature-title { font-weight: 700; font-size: 16.5px; }
.feature-desc { font-size: 13.5px; color: var(--muted); flex: 1; line-height: 1.5; }
.feature-count { font-size: 13px; font-weight: 600; color: var(--primary-dark); margin-top: 4px; }

.f-lesson { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.f-video  { background: linear-gradient(135deg, #fb7185, #e11d48); }
.f-file   { background: linear-gradient(135deg, #fbbf24, #d97706); }
.f-quiz   { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.f-game   { background: linear-gradient(135deg, #22d3ee, #0e2a52); }

/* Nhóm nút hành động bên phải tiêu đề trang */
.page-head-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Thẻ game + nút xóa (cho game admin tự thêm) */
.feature-card-wrap { position: relative; display: flex; }
.feature-card-wrap .feature-card { flex: 1; }
.feature-del { position: absolute; top: 8px; right: 8px; z-index: 2; }
.feature-del-btn {
  border: none; cursor: pointer; width: 30px; height: 30px; border-radius: 8px;
  background: rgba(0,0,0,.35); color: #fff; font-size: 15px; line-height: 1;
  display: grid; place-items: center; opacity: 0; transition: opacity .15s var(--ease), background .15s var(--ease);
}
.feature-card-wrap:hover .feature-del-btn { opacity: 1; }
.feature-del-btn:hover { background: #dc2626; }
.f-ai     { background: linear-gradient(135deg, #2dd4bf, #0f766e); }

@media (max-width: 820px) {
  .sectionbar { position: static; }
}

.prompt-view {
  background: #0f172a; color: #cbd5e1; padding: 16px 18px; border-radius: 12px;
  font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word;
  font-family: "SF Mono", Menlo, monospace; max-width: 720px; overflow-x: auto;
}

/* Banner đầu trang (upload theo từng trang) */
.page-banner { margin-bottom: 18px; }
.page-banner img {
  width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius);
  box-shadow: var(--shadow); display: block;
}
.hero.has-bg { background-size: cover; background-position: center; }

/* Trang tùy chỉnh giao diện */
.banner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.banner-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px;
}
.banner-card-head { display: flex; justify-content: space-between; align-items: center; }
.banner-preview {
  border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--border);
  aspect-ratio: 16 / 6; display: grid; place-items: center;
}
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }
.banner-preview.empty { color: var(--muted); font-size: 13px; border-style: dashed; }
.banner-upload { display: flex; gap: 8px; align-items: center; }
.banner-upload input[type="file"] { flex: 1; min-width: 0; font-size: 12.5px; }
.ai-bubble a { color: var(--primary-dark); font-weight: 600; text-decoration: underline; }
.ai-msg.user .ai-bubble a { color: #fff; }

/* ==================== ĐÁNH GIÁ (khảo sát) ==================== */
.card-block { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 16px 0; box-shadow: var(--shadow-sm); }
.block-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 12px; }
.danger-btn { color: var(--danger); }
.danger-btn:hover { border-color: var(--danger); color: var(--danger); background: #fff1f3; }

/* ----- Trình dựng mẫu ----- */
.dg-build-head { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 8px; gap: 10px; flex-wrap: wrap; }
.dg-add-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.dg-qlist { display: flex; flex-direction: column; gap: 12px; }
.dg-qcard { border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 14px; background: var(--bg); }
.dg-qcard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dg-qtype { font-size: 12px; font-weight: 700; color: var(--primary-dark); background: var(--primary-50); padding: 3px 9px; border-radius: 999px; }
.dg-qcard-tools { display: flex; gap: 3px; }
.dg-qcard .q-label { width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 9px; font-size: 14.5px; font-family: inherit; box-sizing: border-box; }
.dg-qcard .q-label:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.q-opts { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.q-opt { display: flex; gap: 6px; align-items: center; }
.q-opt-in { flex: 1; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 14px; font-family: inherit; }
.q-opt-in:focus { outline: none; border-color: var(--primary); }
.dg-inline { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13.5px; color: var(--text-soft); }
.dg-inline select { padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 8px; font-family: inherit; font-size: 13.5px; }
.dg-req-toggle { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--text-soft); cursor: pointer; }
.dg-build-foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.dg-ai-import { border: 1.5px dashed var(--primary); background: var(--primary-50); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.dg-ai-text { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.dg-ai-text strong { color: var(--primary-dark); font-size: 14.5px; }
.dg-ai-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dg-ai-row input[type="file"] { flex: 1; min-width: 140px; font-size: 13px; }

/* ----- Danh sách mẫu ----- */
.dg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dg-item { display: block; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--card); transition: all .16s var(--ease); }
.dg-item:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.dg-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.dg-item-title { font-weight: 700; color: var(--text); line-height: 1.35; }
.dg-item-meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.dg-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.dg-pill.open { color: var(--good); background: #e9f9ef; }
.dg-pill.closed { color: var(--muted); background: #eef2f6; }

/* ----- Trang quản lý ----- */
.dg-manage-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dg-manage-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.dg-linkrow { display: flex; gap: 6px; margin: 10px 0; }
.dg-linkrow input { flex: 1; min-width: 0; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; background: var(--bg); color: var(--text-soft); }
.dg-qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; }
.dg-qr { background: #fff; padding: 8px; border-radius: 10px; box-shadow: var(--shadow-sm); }
.dg-qr img { display: block; width: 200px; height: 200px; image-rendering: pixelated; }
.dg-manage-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.dg-manage-actions form { margin: 0; }
.dg-stats-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.dg-stats-head .block-title { margin: 0; }
.dg-stat { padding: 12px 0; border-top: 1px solid var(--border); }
.dg-stat:first-of-type { border-top: none; }
.dg-stat-q { font-weight: 600; color: var(--text); margin-bottom: 8px; }
.dg-avg { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.dg-avg-num { font-size: 24px; font-weight: 800; color: var(--primary-dark); }
.dg-bar-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.dg-bar-lbl { width: 34px; flex-shrink: 0; color: var(--text-soft); font-weight: 600; }
.dg-bar-lbl.choice { width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-bar { flex: 1; height: 12px; background: var(--primary-50); border-radius: 999px; overflow: hidden; }
.dg-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); border-radius: 999px; transition: width .3s var(--ease); }
.dg-bar-val { width: 74px; flex-shrink: 0; text-align: right; color: var(--muted); font-size: 12px; }
.dg-textlist { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.dg-textlist li { font-size: 14px; color: var(--text-soft); line-height: 1.5; }
@media (max-width: 860px) { .dg-manage-grid { grid-template-columns: 1fr; } }

/* ----- Biểu mẫu công khai (người ngoài đánh giá) ----- */
.dg-body { background: linear-gradient(160deg, #e8f7f4 0%, var(--bg) 45%); min-height: 100vh; }
.dg-wrap { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; }
.dg-card { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 26px 24px; }
.dg-header { text-align: center; border-bottom: 1px solid var(--border); padding-bottom: 18px; margin-bottom: 20px; }
.dg-badge { display: inline-block; font-size: 12px; font-weight: 700; color: var(--primary-dark); background: var(--primary-50); padding: 4px 12px; border-radius: 999px; margin-bottom: 10px; }
.dg-header h1 { font-size: 22px; line-height: 1.3; margin: 0; color: var(--text); }
.dg-desc { color: var(--text-soft); font-size: 14.5px; margin: 10px 0 0; line-height: 1.55; }
.dg-q { padding: 16px 0; border-bottom: 1px solid var(--border); }
.dg-q-label { display: block; font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 12px; line-height: 1.45; }
.dg-req { color: var(--danger); }
.dg-stars { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.dg-stars input { position: absolute; opacity: 0; width: 0; height: 0; }
.dg-stars label { font-size: 34px; line-height: 1; color: #dfe6ee; cursor: pointer; transition: color .12s, transform .12s; }
.dg-stars label:hover, .dg-stars label:hover ~ label,
.dg-stars input:checked ~ label { color: #f5b301; }
.dg-stars label:hover { transform: scale(1.12); }
.dg-stars input:focus-visible ~ label { outline: 2px solid var(--primary); outline-offset: 2px; }
.dg-scale-hint { display: flex; justify-content: space-between; max-width: 220px; margin-top: 4px; font-size: 11px; color: var(--muted); }
.dg-choices { display: flex; flex-direction: column; gap: 8px; }
.dg-choice { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; transition: all .14s var(--ease); font-size: 14.5px; }
.dg-choice:hover { border-color: var(--primary); background: var(--primary-50); }
.dg-choice input { accent-color: var(--primary); width: 18px; height: 18px; flex-shrink: 0; }
.dg-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-50); font-weight: 600; }
.dg-text { width: 100%; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 10px; font-size: 14.5px; font-family: inherit; box-sizing: border-box; resize: vertical; }
.dg-text:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.dg-submit { width: 100%; justify-content: center; margin-top: 22px; padding: 13px; font-size: 15.5px; }
.dg-msg { text-align: center; }
.dg-msg .dg-emoji { font-size: 52px; margin-bottom: 8px; }
.dg-msg h1 { font-size: 22px; margin: 0 0 8px; color: var(--text); }
.dg-msg .btn { margin-top: 16px; }
.dg-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
