:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --accent: #0891b2;
  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-2: #f0fdfa;
  --text: #102a2e;
  --muted: #64748b;
  --line: #dbe7ea;
  --danger: #b42318;
  --shadow: 0 14px 40px rgba(15, 118, 110, .10);
  --radius: 20px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: linear-gradient(135deg, #effffc, #eef9ff); }
.login-hero { padding: clamp(32px, 7vw, 90px); display: flex; flex-direction: column; justify-content: center; background: radial-gradient(circle at 10% 20%, rgba(13,148,136,.20), transparent 36%), radial-gradient(circle at 80% 80%, rgba(8,145,178,.15), transparent 38%); }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; font-size: 24px; color: var(--primary-dark); }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: var(--shadow); }
.login-hero h1 { max-width: 680px; margin: 34px 0 16px; font-size: clamp(38px, 5.7vw, 68px); line-height: 1.04; letter-spacing: -.045em; }
.login-hero p { max-width: 620px; color: var(--muted); font-size: 18px; line-height: 1.7; }
.hero-points { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-pill { padding: 10px 14px; border: 1px solid rgba(13,148,136,.18); background: rgba(255,255,255,.72); border-radius: 999px; color: var(--primary-dark); font-size: 13px; font-weight: 700; }
.login-side { display: grid; place-items: center; padding: 28px; }
.login-card { width: min(450px, 100%); background: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.95); border-radius: 28px; padding: 34px; box-shadow: 0 30px 80px rgba(15,118,110,.14); backdrop-filter: blur(12px); }
.login-card h2 { margin: 0 0 8px; font-size: 28px; }
.login-card > p { color: var(--muted); margin: 0 0 28px; line-height: 1.55; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 700; }
.field input { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 14px 15px; outline: 0; background: #fff; transition: .2s; }
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(13,148,136,.10); }
.remember { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; margin: 2px 0 20px; }
.primary-btn { border: 0; border-radius: 14px; padding: 13px 18px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; font-weight: 800; box-shadow: 0 10px 24px rgba(13,148,136,.20); }
.primary-btn:hover { filter: brightness(.98); transform: translateY(-1px); }
.login-card .primary-btn { width: 100%; }
.demo-note { margin-top: 18px; padding: 12px 14px; border-radius: 12px; color: var(--muted); background: #f8fafc; font-size: 12px; line-height: 1.5; }
.error { color: var(--danger); font-size: 13px; margin: -8px 0 12px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 18px; background: #083f43; color: #dff7f6; display: flex; flex-direction: column; overflow: hidden; }
.sidebar .brand { color: white; padding: 4px 6px 22px; }
.nav { display: grid; gap: 7px; margin-top: 10px; flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.nav-section-title { margin: 12px 6px 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #8bc5c2; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 999px; }
.nav-btn { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; padding: 12px 13px; border-radius: 13px; color: #d8ecec; background: transparent; text-align: left; font-weight: 650; }
.nav-btn:hover, .nav-btn.active { background: rgba(255,255,255,.10); color: white; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid rgba(255,255,255,.10); padding-top: 16px; }
.user-mini { display: flex; align-items: center; gap: 10px; padding: 9px 7px 14px; min-width: 0; }
.avatar { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.13); font-weight: 800; }
.user-mini strong, .user-mini span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mini span { color: #a9cbcb; font-size: 11px; margin-top: 3px; }
.logout-btn { width: 100%; border: 1px solid rgba(255,255,255,.14); background: transparent; color: #fff; border-radius: 12px; padding: 11px; }
.main { min-width: 0; }
.topbar { height: 72px; padding: 0 28px; background: rgba(255,255,255,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-menu { display: none; border: 0; background: #eef7f7; color: var(--primary-dark); width: 40px; height: 40px; border-radius: 12px; }
.breadcrumb { color: var(--muted); font-size: 13px; }
.topbar-badge { padding: 8px 12px; border-radius: 999px; background: #ecfdf5; color: var(--primary-dark); font-size: 12px; font-weight: 800; }
.content { padding: 32px; max-width: 1500px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 26px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.035em; }
.page-head p { margin: 8px 0 0; color: var(--muted); }
.search { width: min(360px, 100%); border: 1px solid var(--line); background: white; border-radius: 14px; padding: 12px 14px; outline: none; }
.search:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(13,148,136,.08); }

.catalog-section + .catalog-section { margin-top: 28px; }
.catalog-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.catalog-head h2 { margin: 0; font-size: 22px; }
.catalog-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.catalog-count { flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; background: #ecfdf5; color: var(--primary-dark); font-size: 12px; font-weight: 800; }
.subject-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.subject-card { position: relative; min-height: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(15,23,42,.04); transition: .22s ease; overflow: hidden; }
.subject-card::after { content: ''; position: absolute; width: 110px; height: 110px; right: -35px; top: -35px; border-radius: 50%; background: rgba(13,148,136,.06); }
.subject-card:hover { transform: translateY(-4px); border-color: #b9dcda; box-shadow: var(--shadow); }
.subject-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; font-size: 27px; background: linear-gradient(135deg, #ecfdf5, #ecfeff); border: 1px solid #d5f5ef; }
.subject-card h3 { margin: 18px 0 8px; font-size: 20px; }
.subject-card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 13px; }
.card-action { margin-top: auto; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; color: var(--primary-dark); font-size: 13px; font-weight: 800; }

.subject-header { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.subject-header .subject-icon { width: 64px; height: 64px; font-size: 34px; }
.subject-header h1 { margin: 0 0 5px; font-size: 32px; }
.subject-header p { margin: 0; color: var(--muted); }
.mobile-tabs { display: none; margin-bottom: 14px; background: #e8f1f2; border-radius: 14px; padding: 4px; }
.tab-btn { flex: 1; border: 0; padding: 10px; border-radius: 10px; color: var(--muted); background: transparent; font-weight: 800; }
.tab-btn.active { background: white; color: var(--primary-dark); box-shadow: 0 3px 12px rgba(15,23,42,.05); }
.study-layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr); gap: 20px; align-items: start; }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head { padding: 19px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head span { color: var(--muted); font-size: 11px; }
.knowledge { padding: 18px; max-height: calc(100vh - 205px); overflow: auto; }
.topic { border: 1px solid var(--line); border-radius: 16px; margin-bottom: 13px; overflow: hidden; }
.topic:last-child { margin-bottom: 0; }
.topic-title { padding: 14px 15px; font-weight: 800; background: #f7fbfb; border-bottom: 1px solid var(--line); }
.topic-item { padding: 13px 15px; border-bottom: 1px dashed #e6eef0; }
.topic-item:last-child { border-bottom: 0; }
.topic-item strong { display: block; margin-bottom: 5px; font-size: 13px; }
.topic-item p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 12px; }
.empty-state { padding: 40px 22px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); margin-bottom: 8px; }

.chat-panel { position: sticky; top: 94px; }
.ai-status { display: flex; align-items: center; gap: 8px; color: var(--primary-dark) !important; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 4px #d1fae5; }
.chat { height: calc(100vh - 290px); min-height: 430px; padding: 18px; overflow-y: auto; background: linear-gradient(#fbfefe, #f8fbfc); }
.msg { max-width: 88%; padding: 12px 14px; margin-bottom: 12px; border-radius: 16px; line-height: 1.55; font-size: 13px; white-space: pre-line; }
.msg.ai { background: white; border: 1px solid var(--line); border-top-left-radius: 5px; }
.msg.user { margin-left: auto; background: #dff7f3; border: 1px solid #c6ebe5; border-top-right-radius: 5px; }
.msg-meta { display: block; font-size: 10px; color: #94a3b8; margin-top: 7px; }
.chat-compose { padding: 13px; border-top: 1px solid var(--line); background: white; }
.quick-questions { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 9px; scrollbar-width: none; }
.quick-questions::-webkit-scrollbar { display:none; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 7px 10px; font-size: 10px; }
.compose-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.compose-row textarea { resize: none; min-height: 46px; max-height: 120px; border: 1px solid var(--line); border-radius: 13px; padding: 12px; outline: none; }
.compose-row textarea:focus { border-color: var(--primary); }
.send-btn { width: 46px; height: 46px; border: 0; border-radius: 13px; background: var(--primary); color: white; font-weight: 900; }
.disclaimer { padding: 9px 12px 12px; text-align: center; color: #94a3b8; font-size: 9px; background: white; }

@media (max-width: 1200px) { .subject-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 960px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-side { min-height: 100vh; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -280px; z-index: 30; width: 260px; transition: .24s ease; box-shadow: 18px 0 60px rgba(2,6,23,.22); }
  .sidebar.open { left: 0; }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 20; background: rgba(2,6,23,.42); }
  .mobile-menu { display: grid; place-items: center; }
  .subject-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .study-layout { grid-template-columns: 1fr; }
  .chat-panel { position: static; }
  .mobile-tabs { display: flex; }
  .study-layout .panel { display: none; }
  .study-layout .panel.mobile-active { display: block; }
  .knowledge { max-height: none; }
  .chat { height: 58vh; }
}
@media (max-width: 620px) {
  .content { padding: 20px 14px 28px; }
  .catalog-head { display: block; }
  .catalog-count { display: inline-flex; margin-top: 12px; }
  .topbar { padding: 0 14px; height: 64px; }
  .topbar-badge { display: none; }
  .page-head { display: block; }
  .search { margin-top: 16px; width: 100%; }
  .subject-grid { grid-template-columns: 1fr; gap: 12px; }
  .subject-card { min-height: 180px; }
  .subject-header .subject-icon { width: 54px; height: 54px; font-size: 28px; }
  .subject-header h1 { font-size: 26px; }
  .subject-header p { font-size: 12px; }
  .login-card { padding: 26px 22px; border-radius: 22px; }
}

.dashboard-actions { display: flex; align-items: center; gap: 10px; }
.add-subject-btn { flex: 0 0 auto; border: 0; border-radius: 14px; padding: 12px 16px; background: var(--primary); color: #fff; font-weight: 800; box-shadow: 0 8px 20px rgba(13,148,136,.16); }
.add-subject-btn:hover { background: var(--primary-dark); }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(2, 18, 23, .52); backdrop-filter: blur(5px); }
.subject-modal { width: min(520px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: 0 28px 80px rgba(2, 18, 23, .24); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.modal-head h2 { margin: 0; font-size: 23px; }
.modal-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.modal-close { width: 36px; height: 36px; border: 0; border-radius: 10px; background: #f1f5f9; color: var(--muted); font-size: 24px; line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.secondary-btn { border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; background: #fff; color: var(--text); font-weight: 700; }

@media (max-width: 620px) {
  .dashboard-actions { width: 100%; margin-top: 16px; }
  .dashboard-actions .search { margin-top: 0; flex: 1; min-width: 0; }
  .add-subject-btn { padding-inline: 13px; }
  .subject-modal { padding: 18px; border-radius: 18px; }
}

/* Search by specialty + lesson */
.search-results { display: grid; gap: 28px; }
.search-result-summary { color: var(--muted); font-size: 13px; }
.search-result-summary strong { color: var(--primary-dark); }
.search-result-section { display: grid; gap: 14px; }
.search-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.search-result-heading h2 { margin: 0; font-size: 21px; }
.search-result-heading span { color: var(--muted); font-size: 12px; }
.article-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.article-result { width: 100%; border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 15px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: left; color: var(--text); transition: .18s ease; }
.article-result:hover { border-color: #abd9d4; box-shadow: 0 10px 26px rgba(15,118,110,.08); transform: translateY(-2px); }
.article-result-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: #ecfdf5; font-size: 21px; }
.article-result-body { min-width: 0; display: grid; gap: 4px; }
.article-result-body strong { font-size: 14px; }
.article-result-body small { color: var(--primary-dark); font-size: 11px; font-weight: 700; }
.article-result-body > span { color: var(--muted); font-size: 11px; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.article-result > b { color: var(--primary); font-size: 18px; }
.topic-item { scroll-margin-top: 140px; transition: background .25s ease, box-shadow .25s ease; }
.topic-item.article-focus { background: #ecfdf5; box-shadow: inset 4px 0 0 var(--primary); }

@media (max-width: 780px) {
  .article-results { grid-template-columns: 1fr; }
}

/* Subject table of contents */
.back-link { border: 0; background: transparent; color: var(--primary-dark); padding: 0; margin: 0 0 18px; font-weight: 750; font-size: 13px; }
.back-link:hover { text-decoration: underline; }
.subject-index-page { max-width: 1320px; }
.subject-index-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 26px; background: linear-gradient(135deg, #ffffff, #f0fdfa); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 12px 36px rgba(15,118,110,.06); }
.subject-index-main { display: flex; align-items: center; gap: 18px; min-width: 0; }
.subject-index-icon { width: 72px; height: 72px; flex: 0 0 auto; font-size: 38px; border-radius: 20px; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--primary); font-size: 11px; font-weight: 850; letter-spacing: .09em; }
.subject-index-main h1 { margin: 0 0 7px; font-size: clamp(30px, 3vw, 42px); letter-spacing: -.035em; }
.subject-index-main p { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.55; font-size: 13px; }
.subject-index-actions { display: flex; gap: 10px; flex: 0 0 auto; }
.toc-meta { display: flex; gap: 10px; margin: 18px 0; }
.toc-meta span { padding: 9px 13px; border-radius: 999px; background: #eaf8f6; color: var(--muted); font-size: 12px; }
.toc-meta strong { color: var(--primary-dark); margin-right: 4px; }
.toc-list { display: grid; gap: 16px; }
.toc-chapter { background: #fff; border: 1px solid var(--line); border-radius: 19px; overflow: hidden; box-shadow: 0 7px 24px rgba(15,23,42,.035); }
.toc-chapter-head { display: flex; align-items: center; gap: 14px; padding: 17px 19px; background: #f8fcfc; border-bottom: 1px solid var(--line); }
.toc-number { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; background: #dff7f3; color: var(--primary-dark); font-size: 13px; font-weight: 850; }
.toc-chapter-head h2 { margin: 0 0 3px; font-size: 17px; }
.toc-chapter-head p { margin: 0; color: var(--muted); font-size: 11px; }
.toc-lessons { display: grid; }
.toc-lesson { width: 100%; display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 15px 19px; border: 0; border-bottom: 1px solid #edf2f3; background: #fff; color: var(--text); text-align: left; transition: .16s ease; }
.toc-lesson:last-child { border-bottom: 0; }
.toc-lesson:hover { background: #f4fbfa; }
.toc-lesson-index { color: #94a3b8; font-size: 11px; font-weight: 750; }
.toc-lesson-body { min-width: 0; display: grid; gap: 5px; }
.toc-lesson-body strong { font-size: 13px; }
.toc-lesson-body small { color: var(--muted); font-size: 11px; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.toc-arrow { color: var(--primary); font-weight: 850; }
.toc-empty { padding: 64px 24px; text-align: center; background: #fff; border: 1px dashed #cbdfe1; border-radius: 20px; color: var(--muted); }
.toc-empty-icon { margin-bottom: 12px; font-size: 34px; }
.toc-empty strong { display: block; color: var(--text); font-size: 18px; }
.toc-empty p { max-width: 520px; margin: 8px auto 0; line-height: 1.55; font-size: 12px; }

@media (max-width: 760px) {
  .subject-index-hero { display: block; padding: 20px; }
  .subject-index-main { align-items: flex-start; }
  .subject-index-icon { width: 58px; height: 58px; font-size: 30px; border-radius: 17px; }
  .subject-index-actions { margin-top: 18px; }
  .subject-index-actions > button { flex: 1; }
  .toc-lesson { grid-template-columns: 38px minmax(0,1fr) auto; padding: 14px; }
  .toc-lesson-body small { -webkit-line-clamp: 2; }
}

@media (max-width: 480px) {
  .subject-index-main { display: block; }
  .subject-index-icon { margin-bottom: 13px; }
  .subject-index-actions { display: grid; grid-template-columns: 1fr; }
  .toc-meta { flex-wrap: wrap; }
}

/* Trang bài học: chỉ hiển thị bài đang chọn + AI */
.article-only-knowledge { min-height: 260px; }
.lesson-only-topic { margin-bottom: 0; }
.lesson-only-item { padding: 22px 20px; }
.lesson-only-item strong { font-size: 18px; margin-bottom: 10px; }
.lesson-only-item p { font-size: 13px; line-height: 1.75; }

/* YK 1 - Mục lục xổ xuống trong sidebar */
.nav-subject { display: grid; gap: 4px; }
.nav-subject .nav-btn { justify-content: space-between; }
.nav-subject-main { min-width: 0; display: flex; align-items: center; gap: 11px; }
.nav-subject-main > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-chevron { flex: 0 0 auto; font-size: 16px; line-height: 1; transition: transform .18s ease; transform: rotate(0deg); }
.nav-chevron.collapsed { transform: rotate(-90deg); }
.nav-submenu { display: grid; gap: 8px; margin: 2px 0 8px 14px; padding: 4px 0 6px 12px; border-left: 1px solid rgba(139,197,194,.25); }
.nav-subgroup { display: grid; gap: 3px; }
.nav-subgroup-title { padding: 6px 8px 4px; color: #8bc5c2; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.nav-lesson { width: 100%; display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 6px; align-items: center; border: 0; border-radius: 9px; padding: 7px 8px; background: transparent; color: #cce4e3; text-align: left; }
.nav-lesson:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-lesson.active { background: rgba(45,212,191,.16); color: #fff; box-shadow: inset 2px 0 0 #5eead4; }
.nav-lesson > span { color: #73b5b1; font-size: 9px; font-weight: 800; }
.nav-lesson strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 650; }


/* YK 2 - Tìm kiếm bài ngay trong trang mục lục */
.toc-search-wrap { position: relative; width: min(330px, 36vw); flex: 0 1 330px; }
.toc-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--primary-dark); font-size: 18px; pointer-events: none; }
.toc-search { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px 11px 42px; background: #fff; color: var(--text); outline: 0; transition: .18s ease; }
.toc-search:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(13,148,136,.09); }
.toc-search-empty { margin-top: 16px; padding: 28px 20px; border: 1px dashed #cbdfe1; border-radius: 18px; background: #fff; text-align: center; color: var(--muted); }
.toc-search-empty strong, .toc-search-empty span { display: block; }
.toc-search-empty strong { margin-bottom: 6px; color: var(--text); }
@media (max-width: 960px) {
  .toc-search-wrap { width: 100%; flex: 1 1 100%; }
  .subject-index-actions { flex-wrap: wrap; }
}
@media (max-width: 620px) {
  .subject-index-actions { display: grid; grid-template-columns: 1fr; }
  .toc-search-wrap { width: 100%; }
}

/* YK 3 - AI theo bài + quản lý hội thoại */
.chat-head { gap: 14px; }
.chat-head-title { min-width: 0; display: grid; gap: 5px; }
.chat-context { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--primary-dark) !important; font-size: 10px !important; font-weight: 750; }
.chat-head-actions { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.clear-chat-btn { border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; background: #fff; color: var(--muted); font-size: 10px; font-weight: 700; }
.clear-chat-btn:hover { border-color: #b9dcda; background: #f5fbfa; color: var(--primary-dark); }

@media (max-width: 520px) {
  .chat-head { align-items: flex-start; }
  .chat-head-actions { gap: 7px; }
  .ai-status { display: none; }
  .chat-context { max-width: 190px; }
}

/* YK 4 - Công cụ AI theo bài + tìm case Google */
.google-chip { border-color: #b8dcd8; color: var(--primary-dark); background: #f0fdfa; font-weight: 750; }
.google-chip:hover { border-color: var(--primary); background: #e5faf6; }
@media (max-width: 620px) {
  .quick-questions { padding-bottom: 8px; }
  .chip { min-height: 34px; }
}
