/* Grok Web Remote — Claude Warm Sand & Terracotta Design System */
:root {
  --bg: #181816;
  --bg-subtle: #1f1e1b;
  --bg2: #201f1c;
  --bg3: #2a2925;
  --card: #23221e;
  --card-hover: #2a2924;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(194, 103, 53, 0.25);
  --line-focus: rgba(218, 119, 86, 0.45);
  --text: #f5f3ed;
  --text-secondary: #c5c0b5;
  --muted: #8e8a80;
  --accent: #da7756;
  --accent2: #c26735;
  --accent-glow: rgba(218, 119, 86, 0.25);
  --ink-on-accent: #ffffff;
  --user: #2b2925;
  --user-text: #f5f3ed;
  --user-border: rgba(218, 119, 86, 0.25);
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: var(--font-sans);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

html.light {
  --bg: #faf9f5;
  --bg-subtle: #f5f2ea;
  --bg2: #f3f0e8;
  --bg3: #ebe5d8;
  --card: #ffffff;
  --card-hover: #f5f1e8;
  --line: #e4decb;
  --line-strong: #d4cebe;
  --line-focus: rgba(194, 103, 53, 0.45);
  --text: #1a1815;
  --text-secondary: #4a463e;
  --muted: #787367;
  --accent: #c26735;
  --accent2: #a85222;
  --accent-glow: rgba(194, 103, 53, 0.22);
  --ink-on-accent: #ffffff;
  --user: #f4ece1;
  --user-text: #1a1815;
  --user-border: rgba(194, 103, 53, 0.22);
  --ok: #16803d;
  --warn: #d97706;
  --bad: #dc2626;
  --shadow-sm: 0 2px 8px rgba(60, 50, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(60, 50, 40, 0.08);
  --shadow-lg: 0 16px 40px rgba(60, 50, 40, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: inherit;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, textarea, select {
  font-family: var(--font-sans);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  width: 100%;
}

/* Three-column layout: Left Sidebar - Main Stream - Right Sidebar */
.content-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.main-column {
  min-width: 0;
  width: 100%;
}

/* Sidebars */
.sidebar-left,
.sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 24px;
}

.sidebar-widget {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.sidebar-widget:hover {
  border-color: var(--line-strong);
}

.widget-title {
  font-size: 15.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

/* Tag Widget on Left Sidebar */
.btn-clear-tag {
  background: rgba(218, 119, 86, 0.15);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-size: 14px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}

.btn-clear-tag:hover {
  background: var(--accent);
  color: var(--ink-on-accent);
}

.tag-filter-wrapper {
  margin-bottom: 10px;
}

.tag-filter-search {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.15s ease;
}

.tag-filter-search:focus {
  border-color: var(--line-focus);
  background: var(--bg);
}

.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar-tags::-webkit-scrollbar {
  width: 4px;
}
.sidebar-tags::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}

.sidebar-tags .tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg2);
  color: var(--text-secondary);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  font-size: 14.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-family: var(--font-sans);
}

.sidebar-tags .tag-badge:hover {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--accent);
}

.sidebar-tags .tag-badge.active {
  background: var(--accent);
  color: var(--ink-on-accent);
  border-color: var(--accent);
  font-weight: 600;
}

.sidebar-tags .tag-badge.active small {
  opacity: 0.9 !important;
}

/* Quote Widget */
.quote-widget {
  background: linear-gradient(145deg, var(--card), var(--bg2));
  border-left: 3px solid var(--accent);
}

.daily-quote {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  font-style: italic;
  margin-bottom: 8px;
}

.quote-author {
  font-size: 15px;
  color: var(--accent);
  font-weight: 600;
  text-align: right;
  font-family: var(--font-sans);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-family: var(--font-sans);
}

.sidebar-nav-item:hover {
  background: var(--bg2);
  color: var(--accent);
}

.sidebar-nav-item.active {
  background: rgba(218, 119, 86, 0.15);
  color: var(--accent);
  font-weight: 700;
}

.sidebar-nav-item .pill-count {
  font-weight: 700;
  opacity: 0.95;
}

.sidebar-sources {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.source-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.source-item:hover {
  background: var(--bg2);
}

.source-vol {
  background: var(--bg2);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.source-name {
  font-size: 15.5px;
  color: var(--text);
  font-weight: 600;
}

.source-item:hover .source-name {
  color: var(--accent);
}

/* Responsive Layout */
@media (max-width: 1140px) {
  .content-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .sidebar-right {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    position: static;
  }
}

@media (max-width: 860px) {
  /* ẨN HOÀN TOÀN NÚT CHUYỂN GIAO DIỆN MOBILE TRÊN THIẾT BỊ DI ĐỘNG */
  .mobile-mode-btn,
  .floating-pc-exit-btn {
    display: none !important;
  }

  body.mobile-mode .container {
    max-width: 100% !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .content-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  .main-column {
    order: 1; /* NỘI DUNG CHÍNH (Vấn Đáp / Audio) LUÔN LÊN ĐẦU TIÊN TRÊN MOBILE */
    width: 100%;
  }
  .sidebar-left {
    order: 2; /* Thẻ từ khóa hiển thị phía dưới danh sách câu hỏi / audio */
    width: 100%;
    position: static;
  }
  .sidebar-right {
    order: 3; /* Chiêm nghiệm, trước tác */
    width: 100%;
    position: static;
    display: flex;
    flex-direction: column;
  }
}

/* Header */
header {
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s ease;
}

.brand:hover {
  opacity: 0.92;
}

.brand:hover .brand-text h1 {
  color: var(--accent);
}

.logo-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--ink-on-accent);
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 25px;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-text h1 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.brand-text p {
  font-size: 16px;
  color: var(--text-secondary);
}

.brand-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 2px;
}

.brand-stats .bstat-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.brand-stats .bstat-item strong {
  font-weight: 700;
  color: var(--text);
}

.brand-stats .bstat-sep {
  color: var(--muted);
  opacity: 0.6;
  font-size: 12px;
  user-select: none;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 16.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.btn:hover {
  background: var(--card-hover);
  border-color: var(--line-strong);
  color: var(--text);
}

.theme-toggle-btn,
.mobile-mode-btn {
  background: var(--card);
  color: var(--text-secondary);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 16.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  user-select: none;
}

.theme-toggle-btn:hover,
.mobile-mode-btn:hover {
  background: var(--card-hover);
  border-color: var(--line-strong);
  color: var(--text);
}

.mobile-mode-btn.active {
  background: var(--bg2);
  border-color: var(--accent);
  color: var(--accent);
}

/* Nút nổi thoát giao diện Mobile trên màn hình PC */
.floating-pc-exit-btn {
  display: none;
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 9999;
  background: var(--card);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  padding: 9px 18px;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  align-items: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.floating-pc-exit-btn:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-primary {
  background: var(--accent);
  color: var(--ink-on-accent);
  border: 1px solid var(--accent);
  box-shadow: 0 2px 10px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent2);
  border-color: var(--accent2);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 15px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

.btn-icon:hover {
  background: var(--bg3);
  color: var(--text);
}

/* Stats Pill */
.stats-banner {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 16px;
  color: var(--text-secondary);
}

.stats-items {
  display: flex;
  gap: 20px;
}

.stat-item strong {
  color: var(--accent);
  font-weight: 600;
}

/* Search Bar */
.search-container {
  position: relative;
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 13px 44px 13px 18px;
  border-radius: var(--radius-md);
  font-size: 18px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-subtle);
}

.search-input::placeholder {
  color: var(--muted);
}

.search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* Topic Filters */
#topicFilters {
  display: none !important;
}

.topic-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg3) transparent;
}

.topic-filters::-webkit-scrollbar {
  height: 4px;
}
.topic-filters::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border-radius: 4px;
}

.filter-pill {
  background: var(--bg2);
  color: var(--text-secondary);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-pill:hover {
  background: var(--card-hover);
  color: var(--text);
  border-color: var(--line-strong);
}

.filter-pill.active {
  background: var(--accent);
  color: var(--ink-on-accent);
  border-color: var(--accent);
  font-weight: 500;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.pill-count {
  font-size: 14px;
  opacity: 0.8;
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 6px;
  border-radius: 10px;
}

/* QA Card */
.qa-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.qa-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.qa-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.qa-card.pinned {
  border-left: 3px solid var(--accent);
}

.qa-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.qa-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topic-badge {
  background: rgba(218, 119, 86, 0.15);
  color: var(--accent);
  border: 1px solid var(--line-strong);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.topic-badge:hover {
  background: var(--accent);
  color: var(--ink-on-accent);
}

.date-text {
  font-size: 15px;
  color: var(--muted);
}

.char-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg2);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 14.5px;
  font-weight: 500;
  user-select: none;
}

.char-count-badge svg {
  opacity: 0.75;
}

.pin-indicator {
  color: var(--accent);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.qa-question {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 12px;
  letter-spacing: -0.1px;
  cursor: pointer;
  transition: color 0.15s ease;
  user-select: text;
}

.qa-question:hover {
  color: var(--accent);
}

.qa-original-query {
  font-size: 15.5px;
  color: var(--text-secondary);
  background: var(--bg2);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 16px;
  display: block; /* Tránh dùng flexbox ép text bị co thành cột hẹp trên mobile */
  line-height: 1.6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.qa-original-query .orig-icon {
  font-size: 15px;
  display: inline-block;
  vertical-align: -1px;
  margin-right: 4px;
}

.qa-original-query .orig-label {
  font-weight: 600;
  color: var(--accent);
  font-size: 15px;
  display: inline;
  margin-right: 6px;
  white-space: normal;
}

.qa-original-query .orig-text {
  font-style: italic;
  color: var(--text);
  display: inline;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Audio Player Widget */
.qa-audio-player {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.qa-audio-player:hover {
  border-color: var(--line-strong);
}

.qa-audio-player.playing {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--bg2), rgba(218, 119, 86, 0.08));
}

.audio-btn-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink-on-accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.audio-btn-play:hover {
  transform: scale(1.05);
  background: var(--accent2);
}

.audio-btn-play svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.audio-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audio-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14.5px;
}

.audio-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-voice-badge {
  color: var(--accent);
  font-weight: 600;
}

.audio-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 14.5px;
  white-space: nowrap;
}

.audio-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--line);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.audio-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: var(--radius-full);
  transition: width 0.1s linear;
}

.audio-progress-bar:hover {
  height: 8px;
}

.audio-controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-speed {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 32px;
  text-align: center;
}

.btn-speed:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-audio-download {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.btn-audio-download:hover {
  color: var(--text);
}

/* Audio Status: Generating / Loading Placeholder */
.qa-audio-generating {
  background: var(--bg2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--accent);
}

.audio-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(218, 119, 86, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-trigger-audio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.15s ease;
}

.btn-trigger-audio:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg3);
}

/* Answer formatting (Markdown) */
.qa-answer {
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1.7;
}

.qa-answer h1, .qa-answer h2, .qa-answer h3, .qa-answer h4 {
  color: var(--text);
  margin: 18px 0 10px;
  font-weight: 600;
}

.qa-answer h1 {
  font-size: 25px;
}

.qa-answer h2 {
  font-size: 22px;
}

.qa-answer h3 {
  font-size: 20px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.qa-answer h4 {
  font-size: 18px;
}

.qa-answer p {
  margin-bottom: 14px;
}

.qa-answer ul, .qa-answer ol {
  margin: 10px 0 14px 22px;
}

.qa-answer li {
  margin-bottom: 6px;
}

.qa-answer blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg2);
  padding: 12px 18px;
  margin: 14px 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text);
  font-style: italic;
}

.qa-answer strong {
  color: var(--text);
  font-weight: 600;
}

.qa-answer hr {
  border: none;
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}

/* Card Expand / Collapse Accordion & Article Body */
.qa-expand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 12px;
  user-select: none;
}

.qa-expand-bar:hover {
  border-color: var(--line-focus);
  background: var(--card-hover);
}

.qa-expand-bar:hover .expand-bar-left .expand-bar-label {
  color: var(--accent);
}

.expand-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
  flex-wrap: wrap;
}

.expand-bar-icon {
  font-size: 16px;
  display: inline-flex;
}

.expand-bar-label {
  transition: color 0.15s ease;
}

.expand-bar-chars {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

.expand-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}

.expand-bar-action {
  font-size: 14px;
}

.expand-bar-chevron {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--accent);
}

/* Collapsed state: article body completely hidden */
.qa-card.collapsed .qa-article-body {
  display: none !important;
}

/* Expanded state: rotate chevron, style bar, animate in body */
.qa-card:not(.collapsed) .expand-bar-chevron {
  transform: rotate(180deg);
}

.qa-card:not(.collapsed) .qa-expand-bar {
  background: var(--bg3);
  border-color: var(--line-strong);
  margin-bottom: 20px;
}

.qa-card:not(.collapsed) .qa-article-body {
  display: block;
  animation: fadeInArticleBody 0.25s ease-out;
}

@keyframes fadeInArticleBody {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* QA Suggested Research Topics (4 Axes) */
.qa-suggestions {
  margin-top: 24px;
  padding: 16px 18px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease;
}

.qa-suggestions:hover {
  border-color: var(--line-strong);
}

.qa-suggestions-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}

.sug-header-icon {
  font-size: 16px;
  line-height: 1;
}

.sug-header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.qa-sug-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qa-sug-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.qa-sug-item:hover {
  border-color: var(--line-focus);
  background: var(--card-hover);
  transform: translateY(-1px);
}

.qa-sug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sug-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

/* 4 Axis Badge Colors */
.sug-pill-deep {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.25);
}
html.light .sug-pill-deep {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.2);
}

.sug-pill-era {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.25);
}
html.light .sug-pill-era {
  background: rgba(126, 34, 206, 0.1);
  color: #6b21a8;
  border-color: rgba(126, 34, 206, 0.2);
}

.sug-pill-practice {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}
html.light .sug-pill-practice {
  background: rgba(5, 150, 105, 0.1);
  color: #047857;
  border-color: rgba(5, 150, 105, 0.2);
}

.sug-pill-counter {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}
html.light .sug-pill-counter {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.2);
}

.sug-pill-default {
  background: var(--bg2);
  color: var(--muted);
  border-color: var(--line);
}

.qa-sug-text {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--text);
  font-style: normal;
}

.qa-sug-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.sug-meta-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.btn-generate-article {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #ffffff;
  border: 1px solid transparent;
  padding: 7px 15px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-generate-article:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-glow);
  filter: brightness(1.08);
}

.btn-generate-article:active {
  transform: translateY(0);
}

.btn-generate-article svg {
  flex-shrink: 0;
}

.btn-copy-sug {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-sug:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.sug-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-refresh-sug {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-refresh-sug:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-refresh-sug:active {
  transform: scale(0.97);
}

.btn-generate-article.is-generating {
  opacity: 0.82;
  cursor: not-allowed;
  pointer-events: none;
}

@keyframes spinIconAnim {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-icon {
  animation: spinIconAnim 0.75s linear infinite;
  display: inline-block;
  transform-origin: center;
}

@keyframes sugPulseAnim {
  0% {
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.45);
    border-color: var(--accent);
    background: var(--card-hover);
  }
  40% {
    box-shadow: 0 0 0 7px rgba(217, 119, 6, 0.15);
    border-color: var(--accent);
  }
  100% {
    box-shadow: none;
    border-color: var(--line);
    background: var(--card);
  }
}

.qa-sug-item.sug-highlight-pulse {
  animation: sugPulseAnim 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Floating Agent Task Toast / Dock */
.agent-task-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--card);
  border: 1px solid var(--line-focus);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  padding: 16px;
  display: none;
  animation: slideUpFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.agent-task-toast.active {
  display: block;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.agent-task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.agent-task-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-task-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.agent-task-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.agent-task-close:hover {
  color: var(--text);
}

.agent-task-topic {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agent-task-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.agent-badge {
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.agent-badge-acc {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
html.light .agent-badge-acc {
  background: rgba(5, 150, 105, 0.1);
  color: #047857;
  border-color: rgba(5, 150, 105, 0.2);
}

.agent-badge-model {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}
html.light .agent-badge-model {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.2);
}

.agent-task-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

.agent-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent-glow);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.agent-btn-view-new {
  margin-top: 10px;
  width: 100%;
  padding: 8px 12px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s ease;
}

.agent-btn-view-new:hover {
  opacity: 0.9;
}

.footer-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* QA Card Footer */
.qa-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.tags-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-badge {
  background: var(--bg2);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-badge:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.tag-badge.active {
  background: var(--accent);
  color: var(--ink-on-accent);
  border-color: var(--accent);
  font-weight: 600;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-collapse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-collapse:hover {
  background: var(--accent);
  color: var(--ink-on-accent);
  border-color: var(--accent);
}

.btn-collapse svg {
  color: currentColor;
}

.char-count-sub {
  font-size: 14.5px;
  color: var(--muted);
}

/* QA List Controls & Header */
.qa-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 14px 0 16px;
  padding: 0 4px;
  gap: 12px;
}

.qa-list-heading-info {
  font-size: 15px;
  color: var(--muted);
  font-weight: 500;
}

.btn-toggle-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-toggle-all:hover {
  background: var(--bg3);
  border-color: var(--line-strong);
  color: var(--accent);
}

.qa-card-actions {
  display: flex;
  gap: 8px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlide {
  from { transform: translateY(20px) scale(0.97); }
  to { transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 22.5px;
  color: var(--text);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 17px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--accent);
}

textarea.form-control {
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--accent);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 17px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Live Search Modal Output */
.search-results-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-secondary);
  max-height: 350px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state svg {
  margin-bottom: 12px;
  stroke: var(--muted);
}

/* (Mobile styles are consolidated at the bottom of stylesheet) */

/* ========================================================
   MAIN NAVIGATION TABS (Vấn Đáp / Tuyển Tập Audio)
   ======================================================== */
.main-tabs-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 24px;
  padding: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.tabs-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.nav-tab-btn:hover {
  color: var(--text);
  background: var(--bg2);
  border-color: var(--line);
}

.nav-tab-btn.active {
  color: var(--ink-on-accent);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 3px 12px var(--accent-glow);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
}

.nav-tab-btn.active .tab-badge {
  background: rgba(255, 255, 255, 0.25);
}

.tab-badge-highlight {
  background: rgba(218, 119, 86, 0.2);
  color: var(--accent);
}

.tab-badge-sug {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}
html.light .tab-badge-sug {
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
}
.nav-tab-btn.active .tab-badge-sug {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.tabs-aux {
  display: flex;
  align-items: center;
  padding: 0 12px;
}

.voice-indicator {
  font-size: 15.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

/* ========================================================
   AUDIO AGGREGATOR VIEW (Kho Tuyển Tập Audio)
   ======================================================== */
.audio-hero-card {
  background: linear-gradient(145deg, var(--card), var(--bg-subtle));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.audio-hero-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.audio-hero-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: rgba(218, 119, 86, 0.15);
  color: var(--accent);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.audio-hero-info h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  letter-spacing: -0.3px;
}

.audio-hero-info p {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.audio-hero-metrics {
  display: flex;
  align-items: center;
  gap: 28px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 22px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.audio-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-val {
  font-size: 23.5px;
  font-weight: 700;
  color: var(--accent);
}

.metric-lbl {
  font-size: 14.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

.audio-metric-divider {
  width: 1px;
  height: 30px;
  background: var(--line);
}

.audio-hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-audio-play-all {
  background: var(--accent);
  color: var(--ink-on-accent);
  border: 1px solid var(--accent);
  padding: 11px 22px;
  border-radius: var(--radius-full);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-audio-play-all:hover {
  background: var(--accent2);
  border-color: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.btn-audio-shuffle-all {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--line-strong);
  padding: 11px 22px;
  border-radius: var(--radius-full);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-audio-shuffle-all:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--card-hover);
  transform: translateY(-1px);
}

/* Audio Filter Bar */
.audio-filter-bar {
  margin-bottom: 22px;
}

.audio-search-box {
  margin-bottom: 14px;
}

/* Audio Topic Sections */
.audio-topics-container {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.audio-topic-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.audio-topic-section:hover {
  border-color: var(--line-strong);
}

.topic-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}

.topic-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topic-title-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

.topic-count-pill {
  font-size: 15px;
  font-weight: 600;
  background: var(--bg2);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.topic-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-topic-action {
  font-size: 15.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-topic-play {
  background: rgba(218, 119, 86, 0.15);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-topic-play:hover {
  background: var(--accent);
  color: var(--ink-on-accent);
}

.btn-topic-shuffle {
  background: var(--bg2);
  color: var(--text-secondary);
  border: 1px solid var(--line);
}

.btn-topic-shuffle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--card-hover);
}

/* Audio Track Rows */
.audio-tracks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audio-track-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.audio-track-item:hover {
  background: var(--card-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.audio-track-item.playing {
  background: linear-gradient(90deg, rgba(218, 119, 86, 0.16), var(--bg2));
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(218, 119, 86, 0.2);
}

.track-card-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.btn-track-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink-on-accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.btn-track-play:hover {
  transform: scale(1.08);
  background: var(--accent2);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-track-play svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.track-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.track-title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  cursor: pointer;
  transition: color 0.15s ease;
  word-break: break-word;
}

.track-title:hover {
  color: var(--accent);
}

.audio-track-item.playing .track-title {
  color: var(--accent);
}

.track-sub-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--muted);
}

.track-index {
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
}

.track-meta-divider {
  opacity: 0.4;
  font-size: 11px;
}

.track-duration-pill {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
}

.track-sub-meta .tag-badge {
  font-size: 12px;
  padding: 1px 7px;
  background: var(--bg3);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--radius-sm);
}

.track-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-track-view-qa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-track-view-qa:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg3);
}

.btn-track-aux {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-track-aux:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--bg3);
}

/* ========================================================
   SUGGESTIONS AGGREGATOR VIEW (Kho Gợi Ý Viết Bài)
   ======================================================== */
.sug-hero-card {
  background: linear-gradient(145deg, var(--card), var(--bg-subtle));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.sug-hero-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.sug-hero-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

html.light .sug-hero-icon {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.25);
}

.sug-hero-info h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  letter-spacing: -0.3px;
}

.sug-hero-info p {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sug-hero-metrics {
  display: flex;
  align-items: center;
  gap: 28px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 22px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.sug-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sug-metric .metric-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.sug-metric .metric-lbl {
  font-size: 13.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sug-metric-divider {
  width: 1px;
  height: 36px;
  background: var(--line);
}

/* Suggestions Filters */
.sug-filter-bar {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sug-search-box {
  margin-bottom: 0;
}

/* Axis Filter Pills (4 Trục Nghiên Cứu) */
.axis-filters-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.axis-filter-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  margin-right: 4px;
}

.axis-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.axis-filter-pill:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--card-hover);
}

.axis-filter-pill.active {
  background: var(--accent);
  color: var(--ink-on-accent);
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.axis-filter-pill.pill-deep.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.axis-filter-pill.pill-era.active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.axis-filter-pill.pill-practice.active {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.4);
}

.axis-filter-pill.pill-counter.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

/* Suggestions Container & Feed Items */
.suggestions-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sug-badge-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.suggestions-container .qa-sug-item {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.suggestions-container .qa-sug-item:hover {
  border-color: var(--line-focus);
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.suggestions-container .qa-sug-text {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--text);
  margin: 4px 0 2px 0;
}

/* ========================================================
   FLOATING BOTTOM STICKY PLAYER
   ======================================================== */
body.has-bottom-player {
  padding-bottom: 104px;
}

.bottom-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1500;
  background: var(--card);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.38);
  padding: 10px 24px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.bottom-player-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 240px;
  align-items: center;
  gap: 20px;
}

.player-track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player-art {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(218, 119, 86, 0.15);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.player-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.player-track-title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-track-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-track-topic {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.player-separator {
  opacity: 0.5;
}

.player-mode-badge {
  font-size: 13.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text-secondary);
}

/* Center Controls */
.player-controls-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-player-ctl {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 7px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-player-ctl:hover {
  color: var(--text);
  background: var(--bg3);
}

.btn-player-ctl.active {
  color: var(--accent);
}

.btn-player-play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink-on-accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.btn-player-play:hover {
  transform: scale(1.06);
  background: var(--accent2);
}

.player-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font-size: 14.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.player-progress-bar {
  flex: 1;
  height: 5px;
  background: var(--line);
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: height 0.15s ease;
}

.player-progress-bar:hover {
  height: 8px;
}

.player-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: var(--radius-full);
  transition: width 0.1s linear;
}

/* Right Options */
.player-options-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-player-speed {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  min-width: 36px;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-player-speed:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-player-close {
  color: var(--muted);
  font-size: 16px;
}

.btn-player-close:hover {
  color: var(--bad);
}

/* Queue Drawer */
.player-queue-drawer {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  max-height: 440px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlide 0.2s ease;
  z-index: 1510;
}

.queue-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg2);
}

.queue-header h4 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.queue-list {
  overflow-y: auto;
  max-height: 360px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.queue-item:hover {
  background: var(--card-hover);
}

.queue-item.active {
  background: rgba(218, 119, 86, 0.15);
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
}

.queue-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.queue-item-dur {
  font-size: 14.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Soundwave Animation */
.player-soundwave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}

.player-soundwave span {
  width: 3px;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: soundwave 0.8s ease-in-out infinite alternate;
}

.player-soundwave span:nth-child(1) { animation-delay: 0.1s; height: 35%; }
.player-soundwave span:nth-child(2) { animation-delay: 0.3s; height: 90%; }
.player-soundwave span:nth-child(3) { animation-delay: 0.15s; height: 60%; }
.player-soundwave span:nth-child(4) { animation-delay: 0.4s; height: 40%; }

.player-soundwave.paused span {
  animation-play-state: paused;
  height: 4px !important;
}

@keyframes soundwave {
  0% { height: 4px; }
  100% { height: 18px; }
}

/* Highlight card animation when navigating from Audio tab */
.qa-card.highlight-card {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 25px var(--accent-glow);
  transform: scale(1.01);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Responsive Player */
@media (max-width: 960px) {
  .bottom-player-inner {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }
  .player-controls-center {
    grid-column: 1 / -1;
    order: 3;
    max-width: 100%;
  }
  .player-options-right {
    order: 2;
  }
}

@media (max-width: 640px) {
  /* Container & Layout */
  .container {
    padding: 12px 12px 90px;
  }

  /* Header & Top Bar */
  header {
    margin-bottom: 16px;
    gap: 12px;
  }
  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .brand {
    gap: 10px;
  }
  .logo-badge {
    width: 48px;
    height: 48px;
    font-size: 24.5px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
  }
  .brand-text h1 {
    font-size: 24.5px;
    line-height: 1.25;
    font-weight: 700;
  }
  .brand-text p {
    font-size: 15px;
    line-height: 1.35;
    color: var(--text-secondary);
  }
  .brand-stats {
    font-size: 13.5px;
    gap: 5px;
    line-height: 1.35;
  }
  .brand-stats .bstat-sep {
    font-size: 11px;
  }
  .header-actions {
    display: flex;
    width: 100%;
    gap: 8px;
  }
  .theme-toggle-btn {
    padding: 8px 12px;
    flex-shrink: 0;
    justify-content: center;
    font-size: 16.5px;
  }
  .theme-toggle-btn #themeLabel {
    display: none; /* Ẩn chữ trên mobile, chỉ hiển thị icon */
  }
  #btnOpenSearchModal,
  #btnOpenAddModal {
    flex: 1;
    justify-content: center;
    padding: 8px 8px;
    font-size: 15px;
    white-space: nowrap;
    gap: 5px;
  }
  #btnOpenSearchModal svg,
  #btnOpenAddModal svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }

  /* Stats Banner: 2x2 Grid Cards */
  .stats-banner {
    padding: 10px 12px;
    gap: 8px;
    border-radius: var(--radius-md);
  }
  .stats-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
  }
  .stat-item {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
  }
  .stat-item strong {
    font-size: 19.5px;
    color: var(--accent);
    order: 1;
    font-weight: 700;
    line-height: 1.2;
  }
  .stat-item .stat-label {
    font-size: 13.5px;
    color: var(--muted);
    order: 2;
    line-height: 1.3;
  }
  .stat-item.stat-update {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 6px 0 2px;
    background: transparent;
    border: none;
    font-size: 14px;
    border-top: 1px dashed var(--line);
    border-radius: 0;
  }
  .stat-item.stat-update .stat-label {
    order: 1;
    font-size: 14px;
    color: var(--muted);
  }
  .stat-item.stat-update span:last-child {
    order: 2;
    color: var(--text-secondary);
  }

  /* Navigation Tabs */
  .main-tabs-bar {
    padding: 4px;
    margin: 12px 0 16px;
    gap: 6px;
    flex-direction: column;
    align-items: stretch;
    border-radius: var(--radius-md);
  }
  .tabs-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
  .nav-tab-btn {
    padding: 8px 6px;
    font-size: 15.5px;
    justify-content: center;
    gap: 5px;
    border-radius: var(--radius-sm);
  }
  .nav-tab-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
  }
  .tab-badge {
    min-width: 24px;
    height: 22px;
    font-size: 13.5px;
    padding: 0 7px;
  }
  .tabs-aux {
    justify-content: center;
    padding: 2px 0 0;
  }
  .voice-indicator {
    font-size: 14px;
  }

  /* Search & Topic Filters */
  .search-container {
    margin-bottom: 12px;
  }
  .search-input {
    font-size: 17px; /* Ngăn Safari iOS zoom tự động */
    padding: 10px 38px 10px 14px;
    border-radius: var(--radius-sm);
  }
  .search-icon svg {
    width: 16px;
    height: 16px;
  }
  .topic-filters {
    gap: 6px;
    padding-bottom: 6px;
    margin-bottom: 14px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topic-filters::-webkit-scrollbar {
    display: none;
  }
  .filter-pill {
    padding: 5px 12px;
    font-size: 15px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* QA List Header */
  .qa-list-header {
    margin: 10px 0 12px;
    gap: 8px;
  }
  .qa-list-heading-info {
    font-size: 13.5px;
  }
  .btn-toggle-all {
    font-size: 12.5px;
    padding: 4px 10px;
  }

  /* QA Cards */
  .qa-card {
    padding: 14px 14px 16px;
    margin-bottom: 14px;
    border-radius: var(--radius-md);
  }
  .qa-expand-bar {
    padding: 9px 12px;
    margin-top: 10px;
  }
  .expand-bar-left {
    font-size: 14.5px;
    gap: 6px;
  }
  .expand-bar-right {
    font-size: 13.5px;
  }
  .qa-header {
    gap: 8px;
    margin-bottom: 8px;
  }
  .qa-meta {
    gap: 6px;
    flex-wrap: wrap;
  }
  .topic-badge {
    font-size: 14px;
    padding: 2px 8px;
  }
  .date-text {
    font-size: 14px;
  }
  .char-count-badge {
    font-size: 13.5px;
    padding: 1px 6px;
  }
  .pin-indicator {
    font-size: 14px;
  }
  .qa-card-actions {
    gap: 4px;
  }
  .qa-card-actions .btn-icon {
    padding: 6px;
  }
  .qa-question {
    font-size: 16px;
    line-height: 1.45;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: -0.1px;
  }
  .qa-original-query {
    padding: 8px 12px;
    font-size: 16px;
    line-height: 1.55;
    margin-bottom: 12px;
    border-left-width: 3px;
  }
  .qa-original-query .orig-label {
    font-size: 15.5px;
  }
  .qa-original-query .orig-text {
    font-size: 16px;
  }
  .qa-answer {
    font-size: 18px;
    line-height: 1.65;
  }
  .qa-answer p {
    margin-bottom: 12px;
  }
  .qa-answer h1 { font-size: 23.5px; margin: 14px 0 8px; }
  .qa-answer h2 { font-size: 21px; margin: 13px 0 7px; }
  .qa-answer h3 { font-size: 19px; margin: 12px 0 6px; }
  .qa-answer h4 { font-size: 16.5px; margin: 10px 0 4px; }
  .qa-answer blockquote {
    padding: 10px 12px;
    margin: 12px 0;
    font-size: 17.5px;
    line-height: 1.6;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  }
  .qa-answer ul, .qa-answer ol {
    margin: 8px 0 12px 18px;
  }
  .qa-answer li {
    margin-bottom: 5px;
  }
  .qa-footer {
    margin-top: 12px;
    padding-top: 10px;
    gap: 8px;
  }
  .tags-list {
    gap: 5px;
  }
  .tag-badge {
    font-size: 14px;
    padding: 2px 7px;
  }
  .char-count-sub {
    font-size: 14px;
  }

  /* Audio Widget in QA Card */
  .qa-audio-player {
    padding: 8px 10px;
    gap: 8px;
    margin-bottom: 12px;
  }
  .audio-btn-play {
    width: 32px;
    height: 32px;
  }
  .audio-btn-play svg {
    width: 12px;
    height: 12px;
  }
  .audio-top-row {
    font-size: 14.5px;
  }
  .audio-time {
    font-size: 14px;
  }
  .btn-speed {
    padding: 2px 5px;
    font-size: 13.5px;
    min-width: 28px;
  }
  .btn-audio-download {
    padding: 3px;
  }
  .qa-audio-generating {
    padding: 8px 10px;
    font-size: 15px;
    gap: 8px;
  }
  .btn-trigger-audio {
    padding: 6px 10px;
    font-size: 15px;
    margin-bottom: 12px;
  }

  /* Sidebar Left (Thẻ từ khóa ở dưới) */
  .sidebar-left {
    margin-top: 6px;
  }
  .sidebar-widget {
    padding: 14px;
    border-radius: var(--radius-md);
  }
  .widget-title {
    font-size: 16px;
    margin-bottom: 10px;
    padding-bottom: 6px;
  }
  .tag-filter-search {
    font-size: 17px; /* Ngăn zoom iOS */
    padding: 8px 10px;
  }
  .sidebar-tags {
    max-height: 200px;
    gap: 5px;
  }
  .sidebar-tags .tag-badge {
    font-size: 14.5px;
    padding: 3px 8px;
  }

  /* Sidebar Right (Chiêm nghiệm, trước tác) */
  .daily-quote {
    font-size: 16.5px;
    line-height: 1.55;
  }
  .quote-author {
    font-size: 14.5px;
  }
  .source-item {
    padding: 6px 8px;
    font-size: 15px;
  }
  .source-vol {
    font-size: 13.5px;
  }

  /* Kho Tuyển Tập Audio Tab */
  .audio-hero-card {
    padding: 16px 14px;
    border-radius: var(--radius-md);
  }
  .audio-hero-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .audio-hero-info h2 {
    font-size: 22px;
    line-height: 1.3;
  }
  .audio-hero-info p {
    font-size: 15px;
    line-height: 1.45;
  }
  .audio-hero-metrics {
    gap: 8px;
    width: 100%;
    justify-content: space-between;
  }
  .audio-metric {
    flex: 1;
    text-align: center;
  }
  .metric-val {
    font-size: 19.5px;
  }
  .metric-lbl {
    font-size: 13px;
  }
  .audio-hero-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .btn-audio-play-all,
  .btn-audio-shuffle-all {
    width: 100%;
    justify-content: center;
    font-size: 15.5px;
    padding: 9px 12px;
  }
  /* Topic Section Header on Mobile */
  .topic-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
  }
  .topic-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
  }
  .topic-title-text {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
  }
  .topic-count-pill {
    font-size: 13px;
    padding: 3px 10px;
  }
  .topic-header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .btn-topic-action {
    font-size: 13.5px;
    padding: 9px 8px;
    border-radius: var(--radius-md);
    justify-content: center;
    white-space: nowrap;
    text-align: center;
  }

  /* Audio Track Cards on Mobile */
  .audio-tracks-list {
    gap: 10px;
  }

  .audio-track-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 14px;
    border-radius: var(--radius-md);
  }

  .track-card-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
  }

  .btn-track-play {
    width: 38px;
    height: 38px;
    margin-top: 2px;
    flex-shrink: 0;
  }

  .btn-track-play svg {
    width: 14px;
    height: 14px;
  }

  .track-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .track-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text);
    display: block;
    word-break: break-word;
  }

  .track-sub-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--muted);
  }

  .track-sub-meta .tag-badge {
    font-size: 12px;
    padding: 1px 6px;
  }

  .track-actions-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
  }

  .btn-track-view-qa {
    display: inline-flex;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
  }

  .btn-track-aux {
    display: inline-flex;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
  }

  /* Floating Bottom Player on Mobile */
  .bottom-player {
    padding: 8px 10px;
  }
  .bottom-player-inner {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  .player-track-info {
    max-width: calc(100vw - 110px);
    gap: 8px;
  }
  .player-art {
    width: 34px;
    height: 34px;
  }
  .player-track-title {
    font-size: 15px;
  }
  .player-track-meta {
    font-size: 13px;
  }
  .player-controls-center {
    grid-column: 1 / -1;
    order: 3;
    width: 100%;
    gap: 6px;
  }
  .player-buttons {
    gap: 8px;
  }
  .btn-player-play {
    width: 36px;
    height: 36px;
  }
  .player-progress-row {
    gap: 6px;
  }
  .player-time-current,
  .player-time-total {
    font-size: 12.5px;
  }
  .player-options-right {
    order: 2;
    gap: 4px;
  }
  .btn-player-speed {
    font-size: 13.5px;
    padding: 2px 4px;
    min-width: 26px;
  }

  /* Modals */
  .modal-overlay {
    padding: 10px;
  }
  .modal-content {
    max-width: 100%;
    max-height: 94vh;
    border-radius: var(--radius-md);
  }
  .modal-header {
    padding: 14px 16px;
  }
  .modal-header h3 {
    font-size: 21px;
  }
  .modal-body {
    padding: 14px 16px;
    gap: 12px;
  }
  .form-group label {
    font-size: 15.5px;
  }
  .form-control {
    font-size: 17px; /* Ngăn zoom iOS */
    padding: 9px 12px;
  }
  .modal-footer {
    padding: 12px 16px;
  }

  /* Suggestions on Mobile */
  .qa-suggestions {
    padding: 12px 14px;
    margin-top: 18px;
  }
  .sug-header-title {
    font-size: 15.5px;
  }
  .qa-sug-item {
    padding: 12px 14px;
  }
  .qa-sug-text {
    font-size: 15.5px;
    line-height: 1.55;
  }
  .sug-pill {
    font-size: 12.5px;
  }
  .btn-generate-article {
    font-size: 13.5px;
    padding: 6px 12px;
  }
  .btn-copy-sug,
  .btn-refresh-sug {
    font-size: 12.5px;
    padding: 3px 8px;
  }

  /* Suggestions Aggregator Tab Mobile */
  .sug-hero-card {
    padding: 16px 14px;
    border-radius: var(--radius-md);
  }
  .sug-hero-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .sug-hero-info h2 {
    font-size: 22px;
  }
  .sug-hero-info p {
    font-size: 15px;
  }
  .sug-hero-metrics {
    gap: 14px;
    padding: 12px 14px;
  }
  .sug-metric .metric-val {
    font-size: 20px;
  }
  .suggestions-container .qa-sug-item {
    padding: 14px 14px;
  }
  .suggestions-container .qa-sug-text {
    font-size: 15.5px;
  }
  .axis-filters-bar {
    padding: 8px 10px;
    gap: 6px;
  }
  .axis-filter-pill {
    font-size: 12.5px;
    padding: 4px 9px;
  }
}

/* ==========================================================================
   CHẾ ĐỘ MÔ PHỎNG GIAO DIỆN MOBILE TRÊN MÀN HÌNH PC (MOBILE EMULATION ON PC)
   ========================================================================== */
@media (min-width: 861px) {
  :is(html, body).mobile-mode {
    background-color: var(--bg-subtle) !important;
  }

  :is(html, body).mobile-mode .container {
    max-width: 480px !important;
    margin: 20px auto 40px !important;
    padding: 14px 14px 90px !important;
    background-color: var(--bg) !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: 28px !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45) !important;
    min-height: calc(100vh - 40px) !important;
    position: relative !important;
    transition: max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease !important;
  }

  html.light:is(.mobile-mode, body.mobile-mode) .container,
  html.light.mobile-mode .container,
  html.light body.mobile-mode .container {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1) !important;
  }

  /* Bố cục 3 cột chuyển thành 1 cột xếp dọc chuẩn Mobile */
  :is(html, body).mobile-mode .content-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }
  :is(html, body).mobile-mode .main-column {
    order: 1 !important;
    width: 100% !important;
  }
  :is(html, body).mobile-mode .sidebar-left {
    order: 2 !important;
    width: 100% !important;
    position: static !important;
    margin-top: 6px !important;
  }
  :is(html, body).mobile-mode .sidebar-right {
    order: 3 !important;
    width: 100% !important;
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Header & Top Bar */
  :is(html, body).mobile-mode header {
    margin-bottom: 16px !important;
    gap: 12px !important;
  }
  :is(html, body).mobile-mode .top-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  :is(html, body).mobile-mode .brand {
    gap: 10px !important;
  }
  :is(html, body).mobile-mode .logo-badge {
    width: 48px !important;
    height: 48px !important;
    font-size: 24.5px !important;
    border-radius: var(--radius-sm) !important;
    flex-shrink: 0 !important;
  }
  :is(html, body).mobile-mode .brand-text h1 {
    font-size: 24.5px !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
  }
  :is(html, body).mobile-mode .brand-text p {
    font-size: 15px !important;
    line-height: 1.35 !important;
    color: var(--text-secondary) !important;
  }
  :is(html, body).mobile-mode .brand-stats {
    font-size: 13.5px !important;
    gap: 5px !important;
    line-height: 1.35 !important;
  }
  :is(html, body).mobile-mode .brand-stats .bstat-sep {
    font-size: 11px !important;
  }
  :is(html, body).mobile-mode .header-actions {
    display: flex !important;
    width: 100% !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }
  :is(html, body).mobile-mode .mobile-mode-btn,
  :is(html, body).mobile-mode .theme-toggle-btn {
    padding: 8px 12px !important;
    font-size: 15px !important;
  }
  :is(html, body).mobile-mode #btnOpenSearchModal,
  :is(html, body).mobile-mode #btnOpenAddModal {
    flex: 1 !important;
    justify-content: center !important;
    padding: 8px 8px !important;
    font-size: 15px !important;
    white-space: nowrap !important;
    gap: 5px !important;
  }
  :is(html, body).mobile-mode #btnOpenSearchModal svg,
  :is(html, body).mobile-mode #btnOpenAddModal svg {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
  }

  /* Stats Banner 2x2 Grid */
  :is(html, body).mobile-mode .stats-banner {
    padding: 10px 12px !important;
    gap: 8px !important;
    border-radius: var(--radius-md) !important;
  }
  :is(html, body).mobile-mode .stats-items {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    width: 100% !important;
  }
  :is(html, body).mobile-mode .stat-item {
    background: var(--bg2) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius-sm) !important;
    padding: 8px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 2px !important;
  }
  :is(html, body).mobile-mode .stat-item strong {
    font-size: 19.5px !important;
    color: var(--accent) !important;
    order: 1 !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
  }
  :is(html, body).mobile-mode .stat-item .stat-label {
    font-size: 13.5px !important;
    color: var(--muted) !important;
    order: 2 !important;
    line-height: 1.3 !important;
  }
  :is(html, body).mobile-mode .stat-item.stat-update {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 0 2px !important;
    background: transparent !important;
    border: none !important;
    font-size: 14px !important;
    border-top: 1px dashed var(--line) !important;
    border-radius: 0 !important;
  }
  :is(html, body).mobile-mode .stat-item.stat-update .stat-label {
    order: 1 !important;
    font-size: 14px !important;
    color: var(--muted) !important;
  }
  :is(html, body).mobile-mode .stat-item.stat-update span:last-child {
    order: 2 !important;
    color: var(--text-secondary) !important;
  }

  /* Navigation Tabs */
  :is(html, body).mobile-mode .main-tabs-bar {
    padding: 4px !important;
    margin: 12px 0 16px !important;
    gap: 6px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    border-radius: var(--radius-md) !important;
  }
  :is(html, body).mobile-mode .tabs-nav {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    width: 100% !important;
  }
  :is(html, body).mobile-mode .nav-tab-btn {
    padding: 8px 6px !important;
    font-size: 15.5px !important;
    justify-content: center !important;
    gap: 5px !important;
    border-radius: var(--radius-sm) !important;
  }
  :is(html, body).mobile-mode .nav-tab-btn svg {
    width: 15px !important;
    height: 15px !important;
    flex-shrink: 0 !important;
  }
  :is(html, body).mobile-mode .tab-badge {
    min-width: 24px !important;
    height: 22px !important;
    font-size: 13.5px !important;
    padding: 0 7px !important;
  }
  :is(html, body).mobile-mode .tabs-aux {
    justify-content: center !important;
    padding: 2px 0 0 !important;
  }

  /* Search & Topic Filters */
  :is(html, body).mobile-mode .search-container {
    margin-bottom: 12px !important;
  }
  :is(html, body).mobile-mode .search-input {
    font-size: 16.5px !important;
    padding: 10px 38px 10px 14px !important;
    border-radius: var(--radius-sm) !important;
  }
  :is(html, body).mobile-mode .topic-filters {
    gap: 6px !important;
    padding-bottom: 6px !important;
    margin-bottom: 14px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  :is(html, body).mobile-mode .topic-filters::-webkit-scrollbar {
    display: none !important;
  }
  :is(html, body).mobile-mode .filter-pill {
    padding: 5px 12px !important;
    font-size: 14.5px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* QA Cards */
  :is(html, body).mobile-mode .qa-card {
    padding: 14px 14px 16px !important;
    margin-bottom: 14px !important;
    border-radius: var(--radius-md) !important;
  }
  :is(html, body).mobile-mode .qa-expand-bar {
    padding: 9px 12px !important;
    margin-top: 10px !important;
  }
  :is(html, body).mobile-mode .expand-bar-left {
    font-size: 14.5px !important;
    gap: 6px !important;
  }
  :is(html, body).mobile-mode .expand-bar-right {
    font-size: 13.5px !important;
  }
  :is(html, body).mobile-mode .qa-header {
    gap: 8px !important;
    margin-bottom: 8px !important;
  }
  :is(html, body).mobile-mode .qa-meta {
    gap: 6px !important;
    flex-wrap: wrap !important;
  }
  :is(html, body).mobile-mode .topic-badge {
    font-size: 14px !important;
    padding: 2px 8px !important;
  }
  :is(html, body).mobile-mode .date-text {
    font-size: 14px !important;
  }
  :is(html, body).mobile-mode .char-count-badge {
    font-size: 13.5px !important;
    padding: 1px 6px !important;
  }
  :is(html, body).mobile-mode .pin-indicator {
    font-size: 14px !important;
  }
  :is(html, body).mobile-mode .qa-card-actions {
    gap: 4px !important;
  }
  :is(html, body).mobile-mode .qa-card-actions .btn-icon {
    padding: 6px !important;
  }
  :is(html, body).mobile-mode .qa-question {
    font-size: 16px !important;
    line-height: 1.45 !important;
    margin-bottom: 10px !important;
    font-weight: 600 !important;
    letter-spacing: -0.1px !important;
  }
  :is(html, body).mobile-mode .qa-original-query {
    padding: 8px 12px !important;
    font-size: 16px !important;
    line-height: 1.55 !important;
    margin-bottom: 12px !important;
    border-left-width: 3px !important;
  }
  :is(html, body).mobile-mode .qa-answer {
    font-size: 17.5px !important;
    line-height: 1.65 !important;
  }
  :is(html, body).mobile-mode .qa-answer p {
    margin-bottom: 12px !important;
  }
  :is(html, body).mobile-mode .qa-answer h1 { font-size: 22px !important; margin: 14px 0 8px !important; }
  :is(html, body).mobile-mode .qa-answer h2 { font-size: 20px !important; margin: 13px 0 7px !important; }
  :is(html, body).mobile-mode .qa-answer h3 { font-size: 18px !important; margin: 12px 0 6px !important; }
  :is(html, body).mobile-mode .qa-answer h4 { font-size: 16px !important; margin: 10px 0 4px !important; }
  :is(html, body).mobile-mode .qa-answer blockquote {
    padding: 10px 12px !important;
    margin: 12px 0 !important;
    font-size: 17px !important;
    line-height: 1.6 !important;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
  }
  :is(html, body).mobile-mode .qa-answer ul,
  :is(html, body).mobile-mode .qa-answer ol {
    margin: 8px 0 12px 18px !important;
  }
  :is(html, body).mobile-mode .qa-footer {
    margin-top: 12px !important;
    padding-top: 10px !important;
    gap: 8px !important;
  }
  :is(html, body).mobile-mode .tags-list {
    gap: 5px !important;
  }
  :is(html, body).mobile-mode .tag-badge {
    font-size: 14px !important;
    padding: 2px 7px !important;
  }

  /* Audio Widget trong QA Card */
  :is(html, body).mobile-mode .qa-audio-player {
    padding: 8px 10px !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }
  :is(html, body).mobile-mode .audio-btn-play {
    width: 32px !important;
    height: 32px !important;
  }
  :is(html, body).mobile-mode .audio-top-row {
    font-size: 14.5px !important;
  }
  :is(html, body).mobile-mode .audio-time {
    font-size: 14px !important;
  }
  :is(html, body).mobile-mode .btn-speed {
    padding: 2px 5px !important;
    font-size: 13.5px !important;
    min-width: 28px !important;
  }

  /* Sidebar Trái & Phải */
  :is(html, body).mobile-mode .sidebar-widget {
    padding: 14px !important;
    border-radius: var(--radius-md) !important;
  }
  :is(html, body).mobile-mode .widget-title {
    font-size: 16px !important;
    margin-bottom: 10px !important;
    padding-bottom: 6px !important;
  }
  :is(html, body).mobile-mode .tag-filter-search {
    font-size: 16.5px !important;
    padding: 8px 10px !important;
  }
  :is(html, body).mobile-mode .sidebar-tags {
    max-height: 200px !important;
    gap: 5px !important;
  }
  :is(html, body).mobile-mode .daily-quote {
    font-size: 16.5px !important;
    line-height: 1.55 !important;
  }

  /* Kho Tuyển Tập Audio */
  :is(html, body).mobile-mode .audio-hero-card {
    padding: 16px 14px !important;
    border-radius: var(--radius-md) !important;
  }
  :is(html, body).mobile-mode .audio-hero-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  :is(html, body).mobile-mode .audio-hero-info h2 {
    font-size: 22px !important;
    line-height: 1.3 !important;
  }
  :is(html, body).mobile-mode .audio-hero-info p {
    font-size: 15px !important;
    line-height: 1.45 !important;
  }
  :is(html, body).mobile-mode .audio-hero-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }
  :is(html, body).mobile-mode .btn-audio-play-all,
  :is(html, body).mobile-mode .btn-audio-shuffle-all {
    width: 100% !important;
    justify-content: center !important;
    font-size: 15.5px !important;
    padding: 9px 12px !important;
  }
  :is(html, body).mobile-mode .topic-section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
    padding-bottom: 12px !important;
  }
  :is(html, body).mobile-mode .topic-header-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }
  :is(html, body).mobile-mode .audio-track-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 14px 14px !important;
    border-radius: var(--radius-md) !important;
  }
  :is(html, body).mobile-mode .track-actions-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    width: 100% !important;
    padding-top: 8px !important;
    border-top: 1px dashed var(--line) !important;
  }

  /* Floating Bottom Player canh giữa theo khung điện thoại */
  :is(html, body).mobile-mode .bottom-player {
    max-width: 480px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    padding: 8px 10px !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    border: 1px solid var(--line-strong) !important;
    border-bottom: none !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4) !important;
  }
  :is(html, body).mobile-mode .bottom-player-inner {
    grid-template-columns: 1fr auto !important;
    gap: 8px !important;
  }
  :is(html, body).mobile-mode .player-track-info {
    max-width: 260px !important;
    gap: 8px !important;
  }
  :is(html, body).mobile-mode .player-controls-center {
    grid-column: 1 / -1 !important;
    order: 3 !important;
    width: 100% !important;
    gap: 6px !important;
  }
  :is(html, body).mobile-mode .player-options-right {
    order: 2 !important;
    gap: 4px !important;
  }

  /* Tab Gợi Ý Viết Bài */
  :is(html, body).mobile-mode .sug-hero-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  :is(html, body).mobile-mode .axis-filters-bar {
    padding: 8px 10px !important;
    gap: 6px !important;
  }
  :is(html, body).mobile-mode .qa-sug-item {
    padding: 12px 14px !important;
  }
  :is(html, body).mobile-mode .qa-sug-text {
    font-size: 15.5px !important;
  }
}

/* ==========================================================================
   TAB HIỆU ĐÍNH (EDITOR TAB) & ĐIỀU PHỐI AGY REVISION
   100% Sans-serif, giao diện kính mờ hiện đại, responsive hoàn hảo
   ========================================================================== */

/* Badge Tab Hiệu Đính */
.tab-badge-editor {
  background: rgba(139, 92, 246, 0.22);
  color: #c4b5fd;
}
html.light .tab-badge-editor {
  background: rgba(124, 58, 237, 0.15);
  color: #7c3aed;
}
.nav-tab-btn.active .tab-badge-editor {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Nút Chuyển Sang Hiệu Đính trong Tab Vấn Đáp Toàn Văn */
.btn-to-editor {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg2);
  color: var(--text-muted);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}
.btn-to-editor:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateY(-1px);
}
html.light .btn-to-editor:hover {
  background: rgba(124, 58, 237, 0.1);
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.3);
}
.btn-to-editor svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.btn-to-editor-header {
  background: rgba(139, 92, 246, 0.16);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.45);
  font-size: 13.5px;
  font-weight: 600;
  padding: 5px 12px;
  white-space: nowrap;
}
html.light .btn-to-editor-header {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.35);
}
.btn-to-editor-header:hover {
  background: rgba(139, 92, 246, 0.28);
  color: #ffffff;
  border-color: rgba(139, 92, 246, 0.65);
}
html.light .btn-to-editor-header:hover {
  background: rgba(124, 58, 237, 0.2);
  color: #5b21b6;
  border-color: rgba(124, 58, 237, 0.5);
}
.btn-to-editor.btn-in-editor {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}
html.light .btn-to-editor.btn-in-editor {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.3);
}
.btn-send-editor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.btn-send-editor:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.4);
}
.btn-send-editor.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

/* Hero Banner của Tab Hiệu Đính */
.editor-hero-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(218, 119, 86, 0.08) 100%), var(--card-bg);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.editor-hero-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.editor-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
html.light .editor-hero-icon {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.25);
}
.editor-hero-info h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: var(--text);
  letter-spacing: -0.3px;
}
.editor-hero-info p {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}
.editor-hero-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}
.editor-metric {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.editor-metric .metric-val {
  font-size: 22px;
  font-weight: 800;
  color: #c4b5fd;
  font-family: inherit;
}
html.light .editor-metric .metric-val {
  color: #7c3aed;
}
.editor-metric .metric-lbl {
  font-size: 14px;
  color: var(--text-muted);
}
.btn-outline-danger {
  background: transparent;
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-outline-danger:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: #f87171;
}

/* Global Prompt Card */
.editor-prompt-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.editor-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.prompt-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}
.prompt-header-hints {
  font-size: 12.5px;
  color: var(--text-muted);
}
.editor-prompt-input {
  width: 100%;
  min-height: 80px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14.5px;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.editor-prompt-input:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.editor-prompt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-primary-light {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.4);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary-light:hover {
  background: rgba(139, 92, 246, 0.35);
  border-color: rgba(139, 92, 246, 0.6);
}
html.light .btn-primary-light {
  background: rgba(124, 58, 237, 0.1);
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.3);
}
html.light .btn-primary-light:hover {
  background: rgba(124, 58, 237, 0.2);
}

/* Editor Filter Bar */
.editor-filter-bar {
  margin-bottom: 16px;
}
.editor-search-box {
  width: 100%;
}

/* Khối Hiệu Đính bên trong thẻ Card bài viết ở Tab Hiệu Đính */
.qa-editor-box {
  margin-top: 14px;
  margin-bottom: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, var(--bg2) 0%, rgba(139, 92, 246, 0.05) 100%);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-md);
}
.qa-editor-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.qa-editor-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}
.qa-editor-label .editor-badge {
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  font-weight: 600;
}
html.light .qa-editor-label .editor-badge {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}
.card-prompt-input {
  width: 100%;
  min-height: 70px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.card-prompt-input:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.qa-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.qa-editor-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.qa-editor-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-run-revision {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #7c3aed 0%, #da7756 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(124, 58, 237, 0.3);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-run-revision:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(124, 58, 237, 0.45);
}
.btn-run-revision:active {
  transform: translateY(0);
}
.btn-run-revision:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-run-revision svg {
  width: 15px;
  height: 15px;
}
.btn-remove-editor {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-remove-editor:hover {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.08);
}
.btn-restore-orig {
  background: rgba(218, 119, 86, 0.12);
  color: var(--accent);
  border: 1px solid rgba(218, 119, 86, 0.3);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-restore-orig:hover {
  background: rgba(218, 119, 86, 0.22);
}

/* Tiến trình AGY đang hiệu đính */
.qa-editor-running {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px dashed rgba(139, 92, 246, 0.4);
  border-radius: var(--radius-sm);
  margin-top: 10px;
}
.editor-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-top-color: #c4b5fd;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
html.light .editor-spinner {
  border-top-color: #7c3aed;
}
.editor-running-text {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.4;
}

/* Banner hoàn tất hiệu đính */
.qa-editor-success-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  margin-top: 10px;
  font-size: 13px;
  color: #34d399;
}
html.light .qa-editor-success-banner {
  color: #059669;
}

/* Responsive Mobile cho Tab Hiệu Đính */
@media (max-width: 768px) {
  .editor-hero-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .editor-hero-metrics {
    flex-direction: column;
    align-items: flex-start;
  }
  .editor-prompt-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .qa-editor-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .qa-editor-actions-left,
  .qa-editor-actions-right {
    width: 100%;
    justify-content: stretch;
  }
  .btn-run-revision,
  .btn-remove-editor,
  .btn-restore-orig {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================================
   GUEST / READ-ONLY MODE (Chế độ xem công khai cho khách)
   ======================================================== */
body.is-guest #btnOpenAddModal,
body.is-guest #btnOpenSearchModal,
body.is-guest #tabBtnEditor,
body.is-guest #editorView,
body.is-guest .btn-to-editor,
body.is-guest .btn-to-editor-header,
body.is-guest .btn-pin,
body.is-guest .btn-trigger-audio,
body.is-guest .btn-refresh-sug,
body.is-guest .btn-generate-article,
body.is-guest .sug-meta-hint,
body.is-guest .qa-sug-footer,
body.is-guest .admin-only-text {
  display: none !important;
}

/* Đảm bảo modal quản trị không kích hoạt ở chế độ khách */
body.is-guest #addModal,
body.is-guest #searchModal {
  display: none !important;
}

/* Nút sao chép liên kết riêng của bài viết */
.btn-copy-link:hover {
  color: var(--accent);
  background: var(--bg3);
}

.btn-copy-link-footer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-color: var(--line);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-link-footer:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg3);
}

