/* ==========================================================================
   INDETOAN.VN - DESIGN SYSTEM & PRINT ENGINE (v2.0 Professional Studio)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=Itim&family=Lora:ital,wght@0,400;0,600;0,700;1,400&family=Nunito:wght@400;600;700;800&family=Roboto:wght@400;500;700&display=swap');

:root {
  /* Color Palette - Modern EdTech Tokens */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #f0f9ff;
  --primary-border: #bae6fd;
  
  --accent-pro: #f59e0b;
  --accent-pro-dark: #d97706;
  --accent-pro-gradient: linear-gradient(135deg, #f59e0b, #d97706);
  
  --neutral-bg: #f8fafc;
  --neutral-surface: #ffffff;
  --neutral-border: #e2e8f0;
  --neutral-border-subtle: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  
  /* Radii & Shadows */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-sheet: 0 8px 30px rgba(15, 23, 42, 0.08);

  /* Dimensions */
  --header-height: 62px;
  --sidebar-width: 350px;
}

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

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

/* ==========================================================================
   1. APP HEADER
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background: var(--neutral-surface);
  border-bottom: 1px solid var(--neutral-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.4px;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.logo-icon svg {
  width: 20px;
  height: 20px;
}

.logo-text-group {
  display: flex;
  flex-direction: column;
}

.logo-name {
  line-height: 1.1;
  color: #0369a1;
}

.logo-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #059669;
  letter-spacing: 0.4px;
}

.grade-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--neutral-bg);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-border);
}

.grade-tab {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.grade-tab:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.03);
}

.grade-tab.active {
  background: var(--neutral-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.grade-tab.tab-upcoming {
  opacity: 0.6;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mode Switcher */
.mode-switcher {
  display: flex;
  background: #f1f5f9;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  position: relative;
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.mode-sparkle {
  font-size: 9px;
  font-weight: 800;
  background: #ec4899;
  color: white;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

/* Nút nâng cấp Pro */
.btn-upgrade-pro {
  background: var(--accent-pro-gradient);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-upgrade-pro:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.45);
}

.saved-count-pill {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.btn-header-ghost {
  border: 1px solid var(--neutral-border);
  background: var(--neutral-surface);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-header-ghost:hover {
  background: var(--neutral-bg);
  border-color: #cbd5e1;
}

/* User Profile Widget */
.user-profile-widget {
  display: flex;
  align-items: center;
}

.btn-login-trigger {
  background: var(--neutral-surface);
  border: 1px solid var(--neutral-border);
  color: var(--text-main);
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-login-trigger:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.user-avatar-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: white;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-badge-role {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.user-badge-role.pro {
  background: #fef3c7;
  color: #b45309;
}

.user-badge-role.free {
  background: #e2e8f0;
  color: #475569;
}

/* ==========================================================================
   2. APP CONTAINER & SIDEBAR
   ========================================================================== */
.app-container {
  display: flex;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--neutral-surface);
  border-right: 1px solid var(--neutral-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

.sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.sidebar-header-box {
  margin-bottom: 18px;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.sidebar-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.section-subtext {
  font-weight: 400;
  text-transform: none;
  font-size: 11px;
}

/* Exercise Cards */
.exercise-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.ex-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  background: var(--neutral-surface);
  border: 1.5px solid var(--neutral-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.ex-card:hover {
  border-color: #cbd5e1;
  background: #fbfcfe;
}

.ex-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.ex-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ex-card-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ex-card.selected .ex-card-checkbox {
  background: var(--primary);
  border-color: var(--primary);
}

.ex-card-checkbox svg {
  width: 12px;
  height: 12px;
  color: white;
  display: none;
}

.ex-card.selected .ex-card-checkbox svg {
  display: block;
}

.ex-card-info {
  display: flex;
  flex-direction: column;
}

.ex-card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}

.ex-card.selected .ex-card-name {
  color: var(--primary-hover);
}

.ex-card-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Card Counter */
.ex-card-counter {
  display: flex;
  align-items: center;
  gap: 3px;
  background: white;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-full);
  padding: 2px 4px;
}

.counter-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: #f1f5f9;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.counter-btn:hover:not(:disabled) {
  background: #e2e8f0;
}

.counter-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.counter-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  min-width: 44px;
  text-align: center;
  cursor: text;
  padding: 0 2px;
}

/* Settings Group */
.settings-group {
  margin-bottom: 20px;
  border-top: 1px solid var(--neutral-border-subtle);
  padding-top: 16px;
}

.setting-item {
  margin-bottom: 14px;
}

.setting-item-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 8px;
}

.font-size-picker {
  display: flex;
  background: var(--neutral-bg);
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 4px;
}

.font-btn {
  flex: 1;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.font-btn:hover {
  color: var(--text-main);
}

.font-btn.active {
  background: var(--neutral-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.font-family-select-wrapper {
  position: relative;
  width: 100%;
}

.font-family-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--neutral-bg);
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.font-family-select:hover {
  border-color: #cbd5e1;
  background: white;
}

.font-family-select:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.setting-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  cursor: pointer;
}

.setting-toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-switch {
  width: 38px;
  height: 22px;
  background: #cbd5e1;
  border-radius: var(--radius-full);
  position: relative;
  transition: background 0.2s ease;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-sm);
}

input[type="checkbox"]:checked + .toggle-switch {
  background: var(--primary);
}

input[type="checkbox"]:checked + .toggle-switch::after {
  transform: translateX(16px);
}

/* Sidebar Pro Card */
.pro-feature-card {
  margin-top: 16px;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 12px;
}

.pro-badge-mini {
  display: inline-block;
  background: #d97706;
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
}

.pro-feature-text {
  font-size: 12px;
  color: #78350f;
  line-height: 1.4;
  margin-bottom: 10px;
}

.pro-action-row {
  display: flex;
  gap: 8px;
}

.btn-sidebar-pro {
  flex: 1;
  background: white;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-sidebar-pro:hover {
  background: #fef9c3;
  border-color: #f59e0b;
}

/* Sidebar Footer Actions */
.sidebar-footer {
  padding: 16px 20px;
  background: var(--neutral-surface);
  border-top: 1px solid var(--neutral-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-main {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  width: 100%;
}

.btn-main:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-main:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-main-badge {
  background: rgba(255, 255, 255, 0.25);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.action-row {
  display: flex;
  gap: 8px;
}

.btn-secondary {
  flex: 1;
  background: var(--neutral-surface);
  border: 1.5px solid var(--neutral-border);
  color: var(--text-main);
  padding: 9px 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--neutral-bg);
  border-color: #cbd5e1;
}

/* ==========================================================================
   3. PREVIEW & STUDIO WORKSPACE
   ========================================================================== */
.preview-wrap {
  flex: 1;
  background: #f1f5f9;
  overflow-y: auto;
  padding: 20px 24px 80px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Studio Toolbar & Smart Budget Meter */
.studio-toolbar {
  width: 210mm;
  background: white;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  gap: 16px;
  flex-wrap: wrap;
}

.studio-toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.budget-meter-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
}

.budget-meter-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.budget-meter-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.badge-success {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-danger {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.budget-progress-track {
  width: 100%;
  height: 7px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.budget-progress-bar {
  height: 100%;
  background: var(--success);
  border-radius: var(--radius-full);
  transition: width 0.3s ease, background-color 0.3s ease;
}

.studio-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-compact-tool {
  background: #f8fafc;
  border: 1px solid var(--neutral-border);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-compact-tool:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.studio-hint-badge {
  font-size: 11.5px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* ==========================================================================
   4. SIMULATED PHYSICAL A4 SHEET & MULTI-PAGE CONTAINER
   ========================================================================== */
.sheets-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
}

.a4-sheet {
  width: 210mm;
  min-height: 297mm;
  background: white;
  border-radius: 4px;
  padding: 10mm 14mm 10mm 14mm;
  box-shadow: var(--shadow-sheet);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: opacity 0.15s ease;

  /* Typography Scales */
  --ex-font-size: 14px;
  --ex-title-size: 13.5px;
  --vertical-calc-size: 15px;
  --grid-row-gap: 12px;
}

.page-number-tag {
  position: absolute;
  top: -12px;
  left: 20px;
  background: #334155;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  z-index: 5;
}

/* Header cho Trang 2 trở đi */
.sheet-header-page-2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #0f172a;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.header-page-2-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: -0.2px;
}

.header-page-2-meta {
  font-size: 11.5px;
  color: #475569;
  font-style: italic;
}

.a4-sheet.font-size-sm {
  --ex-font-size: 12.5px;
  --ex-title-size: 12.5px;
  --vertical-calc-size: 13.5px;
  --grid-row-gap: 8px;
}

.a4-sheet.font-size-md {
  --ex-font-size: 14px;
  --ex-title-size: 13.5px;
  --vertical-calc-size: 15px;
  --grid-row-gap: 12px;
}

.a4-sheet.font-size-lg {
  --ex-font-size: 16px;
  --ex-title-size: 15px;
  --vertical-calc-size: 17.5px;
  --grid-row-gap: 16px;
}

/* Font Families cho tờ A4 */
.a4-sheet.font-family-be-vietnam {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.a4-sheet.font-family-nunito {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.a4-sheet.font-family-lora {
  font-family: 'Lora', 'Times New Roman', Georgia, serif;
}

.a4-sheet.font-family-roboto {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.a4-sheet.font-family-itim {
  font-family: 'Itim', cursive, -apple-system, sans-serif;
}

.a4-sheet.updating {
  opacity: 0.6;
}

/* Sheet Header */
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
  gap: 12px;
}

.school-brand-row {
  flex: 1.2;
  display: flex;
  align-items: center;
  gap: 12px;
}

.school-logo-slot {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1px dashed var(--neutral-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.school-logo-slot img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.school-logo-slot.hidden {
  display: none;
}

.btn-remove-logo {
  position: absolute;
  top: 1px;
  right: 1px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-meta-box {
  font-size: 12.5px;
  line-height: 1.7;
  color: #1e293b;
}

.meta-line {
  margin-bottom: 2px;
}

.editable-meta {
  border-bottom: 1px dotted #94a3b8;
  display: inline-block;
  min-width: 120px;
  outline: none;
}

.editable-meta:focus {
  border-bottom-color: var(--primary);
  background: #f0fdf4;
}

.sheet-title-center {
  flex: 1.3;
  text-align: center;
}

.sheet-title-center h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #0f172a;
  text-transform: uppercase;
  outline: none;
}

.sheet-title-center h1:focus {
  background: #f8fafc;
  outline: 1px dashed var(--primary);
}

.sheet-title-center p {
  font-size: 11.5px;
  color: #475569;
  font-style: italic;
  margin-top: 2px;
  outline: none;
}

.header-right-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qr-box {
  flex: 0 0 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.qr-box.hidden {
  display: none;
}

#qrcode-canvas {
  width: 60px !important;
  height: 60px !important;
  display: block;
}

.qr-label {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
  text-align: center;
}

/* Grading Box */
.grading-box {
  display: flex;
  border: 1px solid #0f172a;
  border-radius: 3px;
  overflow: hidden;
  font-size: 10px;
}

.grading-box.hidden {
  display: none;
}

.grading-col {
  width: 44px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #0f172a;
}

.grading-col-wide {
  width: 90px;
  border-right: none;
}

.grading-head {
  background: #f1f5f9;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
  border-bottom: 1px solid #0f172a;
}

.grading-body {
  height: 38px;
  outline: none;
}

.sheet-divider {
  border: none;
  border-top: 1.5px solid #0f172a;
  margin-bottom: 12px;
}

/* ==========================================================================
   5. EXERCISES SECTION & INTERACTIVE STUDIO NODES
   ========================================================================== */
.exercises-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--grid-row-gap);
}

.exercise-block {
  position: relative;
  break-inside: avoid;
  page-break-inside: avoid;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

/* Hover highlight in Studio Mode */
body.mode-studio .exercise-block:hover {
  background: #f8fafc;
  outline: 1.5px dashed var(--primary-border);
}

.exercise-title {
  font-size: var(--ex-title-size);
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  outline: none;
}

.exercise-title:focus {
  background: white;
  outline: 1px dashed var(--primary);
}

/* Floating actions per exercise block (Studio Mode) */
.floating-ex-actions {
  position: absolute;
  top: -12px;
  right: 8px;
  background: white;
  border: 1px solid var(--neutral-border);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-full);
  padding: 2px 6px;
  display: none;
  align-items: center;
  gap: 4px;
  z-index: 10;
}

body.mode-studio .exercise-block:hover .floating-ex-actions {
  display: flex;
}

.btn-float-act {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 6px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 3px;
  transition: all 0.1s ease;
}

.btn-float-act:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.btn-float-act.danger:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* Grid Layouts for Math */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 14px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 24px;
}

.grid-cols-1 {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 18px;
}

/* Bài toán có lời văn Lớp 1 */
.word-problem-item {
  font-size: var(--ex-font-size);
  color: #000000;
  line-height: 1.6;
  padding: 4px 0;
}

.wp-text {
  font-weight: 500;
  margin-bottom: 8px;
}

.wp-calc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: calc(var(--ex-font-size) * 0.95);
}

.wp-boxes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calc-input-box {
  display: inline-block;
  width: 36px;
  height: 28px;
  border: 1px solid #1e293b;
  border-radius: 4px;
}

.wp-op-box {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 1px dashed #64748b;
  border-radius: 4px;
}

.wp-eq {
  font-weight: 700;
  padding: 0 2px;
}

.wp-ans-row {
  font-size: calc(var(--ex-font-size) * 0.95);
  color: #1e293b;
}

/* Badge Học kỳ cho thẻ dạng bài */
.term-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.term-hk1 {
  background: #e0f2fe;
  color: #0369a1;
}
.term-hk2 {
  background: #fef3c7;
  color: #b45309;
}


.math-item {
  font-size: var(--ex-font-size);
  color: #000000;
  letter-spacing: 0.2px;
  outline: none;
}

.math-item:focus {
  background: #f0fdf4;
  outline: 1px dashed var(--primary);
}

/* Vertical Math */
.vertical-calc {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: inherit;
  font-size: var(--vertical-calc-size);
  font-weight: 500;
  width: 58px;
  letter-spacing: 2px;
  line-height: 1.35;
  color: #000000;
  margin: 0 auto;
}

.calc-line {
  border-bottom: 1.5px solid #000000;
  width: 100%;
  text-align: right;
  padding-bottom: 2px;
}

.calc-box {
  height: 24px;
  width: 100%;
}

/* Sheet Footer */
.sheet-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: var(--text-muted);
}

.footer-brand {
  font-weight: 500;
}

.footer-brand.hidden {
  visibility: hidden;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: #cbd5e1;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 13px;
  max-width: 320px;
}

/* ==========================================================================
   6. MODALS SYSTEM
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(10px);
  transition: transform 0.2s ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

/* Modal Auth Specifics */
.modal-auth-card {
  max-width: 420px;
}

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

.auth-tab {
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.social-login-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--neutral-border);
  background: white;
  transition: all 0.15s ease;
}

.btn-social:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.zalo-badge {
  background: #0068ff;
  color: white;
  font-weight: 800;
  font-size: 12px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-subtle);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--neutral-border);
}

.auth-divider span {
  padding: 0 10px;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--neutral-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  border-color: var(--primary);
}

.btn-full {
  width: 100%;
  margin-top: 6px;
}

/* Modal Pricing & VietQR Specifics */
.modal-pricing-card {
  max-width: 680px;
}

.pricing-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pricing-crown {
  font-size: 26px;
}

.pricing-header-title h3 {
  font-size: 18px;
  font-weight: 800;
  color: #92400e;
}

.pricing-header-title p {
  font-size: 12px;
  color: var(--text-muted);
}

.pricing-plans-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 14px;
  margin-bottom: 20px;
}

.plan-card {
  border: 1.5px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  background: white;
}

.plan-card:hover {
  border-color: #cbd5e1;
}

.plan-card.active {
  border-color: var(--accent-pro);
  background: #fffdf5;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.15);
}

.plan-badge-save {
  position: absolute;
  top: -10px;
  right: 14px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.plan-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.plan-price {
  font-size: 22px;
  font-weight: 800;
  color: #0369a1;
  margin-bottom: 6px;
}

.plan-price span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.plan-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.plan-features {
  list-style: none;
  font-size: 11.5px;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vietqr-checkout-box {
  background: #f8fafc;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  gap: 20px;
}

.vietqr-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.qr-payment-frame {
  width: 160px;
  height: 160px;
  background: white;
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

#vietqr-canvas {
  width: 144px !important;
  height: 144px !important;
}

.qr-scan-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}

.vietqr-right {
  flex: 1;
}

.checkout-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

.bank-details-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

.bank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.highlight-acc {
  font-family: monospace;
  font-size: 14px;
  color: var(--primary-hover);
}

.highlight-price {
  font-size: 15px;
  font-weight: 800;
  color: #059669;
}

.highlight-code {
  font-family: monospace;
  font-weight: 700;
  color: #dc2626;
  background: #fef2f2;
  padding: 1px 6px;
  border-radius: 4px;
}

.btn-copy-inline {
  background: #e2e8f0;
  border: none;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 6px;
}

.demo-payment-action {
  margin-top: 10px;
}

.payment-guarantee {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.3;
}

/* Modal Saved Sheets */
.modal-saved-card {
  max-width: 600px;
}

.saved-sheets-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.saved-sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.saved-sheet-item:hover {
  background: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.saved-sheet-meta {
  display: flex;
  flex-direction: column;
}

.saved-sheet-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.saved-sheet-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.saved-sheet-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Modal Multi-Code */
.modal-multicode-card {
  max-width: 680px;
}

.modal-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.multicode-count-selector {
  margin-bottom: 16px;
  background: #f8fafc;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.count-selector-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.count-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.count-choice-btn {
  background: white;
  border: 1.5px solid var(--neutral-border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.count-choice-btn:hover {
  border-color: var(--primary);
  background: #f0f9ff;
}

.count-choice-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.count-choice-btn .tag-free {
  font-size: 10px;
  background: #ecfdf5;
  color: #065f46;
  padding: 1px 5px;
  border-radius: var(--radius-full);
}

.count-choice-btn.active .tag-free {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

.count-choice-btn .tag-pro {
  font-size: 10px;
  background: #fef3c7;
  color: #b45309;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  font-weight: 800;
}

.count-choice-btn.active .tag-pro {
  background: #f59e0b;
  color: white;
}

.multicode-preview-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--neutral-border);
  padding-bottom: 8px;
  overflow-x: auto;
  max-width: 100%;
}

.mcode-tab {
  background: #f1f5f9;
  border: 1px solid var(--neutral-border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.mcode-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-mini-tag {
  font-size: 9.5px;
  font-weight: 800;
  background: #ecfdf5;
  color: #065f46;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  margin-left: 3px;
}

/* Banner chế độ hiển thị trọn bộ nhiều mã đề */
.multicode-active-banner {
  width: 210mm;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: white;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.multicode-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 700;
}

.multicode-banner-left .sparkle-icon {
  font-size: 18px;
}

.btn-exit-multicode {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-exit-multicode:hover {
  background: white;
  color: var(--primary-hover);
}

/* Huy hiệu mã đề lớn trên đầu tờ A4 */
.sheet-multicode-badge {
  display: inline-block;
  background: #0f172a;
  color: white;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.multicode-sheet-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1.5px dashed var(--neutral-border);
}

.multicode-sheet-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

.multicode-sheet {
  position: relative;
  page-break-after: always;
  break-after: page;
}

/* Khung xem trước trực tiếp trong Modal Multi-Code */
.multicode-modal-preview-box {
  background: white;
  border: 1.5px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
}

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

.modal-preview-title {
  font-size: 14px;
  font-weight: 800;
  color: #0369a1;
}

.modal-preview-items {
  font-size: 12.5px;
  line-height: 1.6;
  color: #334155;
}

.modal-preview-sec-title {
  font-weight: 700;
  color: #0f172a;
  margin-top: 8px;
  margin-bottom: 2px;
}

.multicode-info-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 12.5px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

/* Modal Print Help Steps */
.modal-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 13.5px;
}

.modal-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ==========================================================================
   7. TOAST NOTIFICATIONS & RESPONSIVE
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toastIn 0.2s ease forwards;
}

.toast-success {
  background: #065f46;
}

.toast-warning {
  background: #92400e;
}

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

.mobile-action-bar {
  display: none;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--neutral-border);
    height: auto;
  }

  .sidebar-scrollable {
    padding: 16px;
  }

  .preview-wrap {
    padding: 16px 12px 100px 12px;
    height: auto;
    overflow: visible;
  }

  .studio-toolbar {
    width: 100%;
  }

  .a4-sheet {
    width: 100%;
    min-height: auto;
    padding: 16px;
    box-shadow: var(--shadow-sm);
  }

  .desktop-only {
    display: none;
  }

  /* Fixed bottom bar on Mobile */
  .mobile-action-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--neutral-border);
    padding: 10px 16px;
    gap: 10px;
    z-index: 40;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .mobile-action-bar .btn-secondary {
    flex: 1;
    height: 44px;
  }

  .mobile-action-bar .btn-main {
    flex: 2;
    height: 44px;
  }

  .sidebar-footer {
    display: none;
  }

  .grade-tabs {
    overflow-x: auto;
    max-width: 200px;
  }

  .pricing-plans-grid {
    grid-template-columns: 1fr;
  }

  .vietqr-checkout-box {
    flex-direction: column;
    align-items: center;
  }
}

/* ==========================================================================
   8. PRINT ENGINE (@page & @media print)
   ========================================================================== */
@page {
  size: A4 portrait;
  margin: 10mm 12mm 10mm 12mm;
}

@media print {
  html, body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    margin: 0 !important;
    padding: 0 !important;
  }

  .no-print,
  .app-header,
  .sidebar,
  .studio-toolbar,
  .floating-ex-actions,
  .btn-remove-logo,
  .toast-container,
  .modal-overlay,
  .mobile-action-bar {
    display: none !important;
  }

  .app-container {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .preview-wrap {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    background: white !important;
  }

  .sheets-container {
    display: block !important;
    gap: 0 !important;
  }

  #multicode-sheets-container:not([style*="display: none"]) {
    display: block !important;
  }

  .a4-sheet {
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    min-height: 297mm !important;
    height: auto !important;
    padding: 10mm 12mm !important;
    margin: 0 !important;
    page-break-after: always !important;
    break-after: page !important;
  }

  .a4-sheet:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .page-number-tag {
    display: none !important;
  }

  .exercise-block {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    outline: none !important;
    background: transparent !important;
  }

  .editable-meta {
    border-bottom: none !important;
  }

  .sheet-title-center h1,
  .exercise-title,
  .math-item {
    outline: none !important;
    background: transparent !important;
  }
}

/* ==========================================================================
   9. LEGAL & POLICY PAGES STYLES (.legal-page)
   ========================================================================== */
.legal-page-body {
  background-color: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.legal-header {
  height: 64px;
  background: white;
  border-bottom: 1px solid var(--neutral-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.legal-main {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 32px auto;
  padding: 0 20px;
}

.legal-card {
  background: white;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.legal-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
  letter-spacing: -0.4px;
}

.legal-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--neutral-border-subtle);
}

.legal-section {
  margin-bottom: 28px;
}

.legal-section h2 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: #334155;
  margin: 14px 0 8px 0;
}

.legal-section p {
  font-size: 14.5px;
  line-height: 1.7;
  color: #334155;
  margin-bottom: 12px;
}

.legal-section ul {
  list-style-type: disc;
  padding-left: 24px;
  margin-bottom: 14px;
}

.legal-section li {
  font-size: 14.5px;
  line-height: 1.7;
  color: #334155;
  margin-bottom: 6px;
}

.legal-highlight-box {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0;
  font-size: 14px;
  color: #0369a1;
  line-height: 1.6;
}

.legal-footer {
  background: white;
  border-top: 1px solid var(--neutral-border);
  padding: 24px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: auto;
}

.legal-footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}

.legal-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.legal-footer-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Sidebar Legal Links in Main App */
.sidebar-legal-links {
  padding: 12px 20px;
  background: #f8fafc;
  border-top: 1px solid var(--neutral-border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 11.5px;
}

.sidebar-legal-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.sidebar-legal-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .legal-card {
    padding: 24px 20px;
  }
  .legal-title {
    font-size: 22px;
  }
}

/* ==========================================================================
   10. COMMERCIAL & SOCIAL PROOF EXTENSIONS
   ========================================================================== */
.btn-order-delivery {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-order-delivery:hover {
  background: #d1fae5;
  border-color: #34d399;
}

.btn-testimonials-trigger {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 6px 11px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-testimonials-trigger:hover {
  background: #fef3c7;
  border-color: #f59e0b;
}

/* Tabs chuyển đổi Cá nhân vs Doanh nghiệp B2B trong Modal Bảng Giá */
.pricing-type-tabs {
  display: flex;
  background: #f1f5f9;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 4px;
  margin-bottom: 16px;
}

.pricing-type-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  text-align: center;
}

.pricing-type-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Bảng ROI: So sánh giá trị đầu tư */
.roi-table-box {
  background: #f8fafc;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 18px;
}

.roi-table-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.roi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.roi-table th {
  background: #e2e8f0;
  padding: 6px 10px;
  text-align: left;
  font-weight: 700;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.roi-table td {
  padding: 6px 10px;
  border: 1px solid var(--neutral-border);
}

.roi-table td.highlight-pro {
  background: #f0fdf4;
  color: #166534;
  font-weight: 700;
}

/* FAQ Accordion trong Modal */
.pricing-faq-box {
  margin-top: 18px;
  border-top: 1px solid var(--neutral-border);
  padding-top: 14px;
}

.faq-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

.faq-item {
  margin-bottom: 8px;
  background: #f8fafc;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.faq-question {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.faq-answer {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}

/* Modal Testimonials Styling */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.testimonial-card {
  background: #f8fafc;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.testimonial-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.testimonial-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.testimonial-author {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.testimonial-role {
  font-size: 11.5px;
  color: var(--text-muted);
}

.testimonial-stars {
  color: #f59e0b;
  font-size: 12px;
  margin-bottom: 8px;
}

.testimonial-quote {
  font-size: 12.5px;
  color: #334155;
  line-height: 1.6;
  font-style: italic;
  flex: 1;
}

/* Modal Print & Delivery Packages */
.delivery-packages-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.delivery-pkg-card {
  border: 1.5px solid var(--neutral-border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  background: white;
  transition: all 0.15s ease;
}

.delivery-pkg-card.active {
  border-color: #059669;
  background: #f0fdf4;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
}

.pkg-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.pkg-price {
  font-size: 20px;
  font-weight: 800;
  color: #059669;
  margin-bottom: 6px;
}

.pkg-details {
  font-size: 11.5px;
  color: #475569;
  line-height: 1.5;
}


/* ==========================================================================
   11. COMMUNITY & BLOG SYSTEM (Header Buttons, Floating Widget, Zalo Modal, Blog)
   ========================================================================== */

/* --- A. Header Zalo & Blog Buttons --- */
.btn-header-zalo {
  background: linear-gradient(135deg, #0080ff 0%, #0056d6 100%);
  color: white;
  border: none;
  padding: 6px 13px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.28);
  transition: all 0.2s ease;
  position: relative;
}

.btn-header-zalo:hover {
  background: linear-gradient(135deg, #0a8aff 0%, #004ac2 100%);
  box-shadow: 0 4px 14px rgba(0, 102, 255, 0.42);
  transform: translateY(-1px);
  color: white;
}

.zalo-icon-badge {
  background: white;
  color: #0068ff;
  font-weight: 900;
  font-size: 10.5px;
  letter-spacing: -0.3px;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1;
}

.zalo-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: zaloDotPulse 1.8s infinite;
}

@keyframes zaloDotPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(74, 222, 128, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

.btn-header-blog {
  border: 1px solid var(--neutral-border);
  background: var(--neutral-surface);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-header-blog:hover {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.blog-badge-sparkle {
  background: #fef3c7;
  color: #b45309;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
}

/* --- B. Floating Community & Blog Widget --- */
.floating-community-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  pointer-events: auto;
}

.floating-btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  color: white;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  white-space: nowrap;
}

.floating-btn:hover {
  transform: translateY(-3px) scale(1.02);
  color: white;
}

.floating-btn-zalo {
  background: linear-gradient(135deg, #0084ff 0%, #0052cc 100%);
  box-shadow: 0 8px 24px rgba(0, 102, 255, 0.38);
}

.floating-btn-zalo:hover {
  background: linear-gradient(135deg, #1a8fff 0%, #0045ab 100%);
  box-shadow: 0 10px 28px rgba(0, 102, 255, 0.5);
}

.floating-zalo-glow {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: var(--radius-full);
  background: rgba(0, 132, 255, 0.4);
  z-index: -1;
  animation: zaloWaveGlow 2.5s infinite;
}

@keyframes zaloWaveGlow {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  70% {
    transform: scale(1.22);
    opacity: 0;
  }
  100% {
    transform: scale(1.22);
    opacity: 0;
  }
}

.floating-btn-blog {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.32);
}

.floating-btn-blog:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #d946ef 100%);
  box-shadow: 0 10px 26px rgba(234, 88, 12, 0.45);
}

.floating-icon-wrap {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  flex-shrink: 0;
}

.floating-btn-zalo .floating-icon-wrap {
  background: white;
  color: #0068ff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -0.4px;
}

.floating-tag {
  background: rgba(255, 255, 255, 0.25);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 800;
}

/* Tooltip on Desktop hover */
.floating-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.floating-tooltip::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent transparent #0f172a;
}

.floating-btn:hover .floating-tooltip {
  opacity: 1;
  visibility: visible;
}

/* --- C. Modal Zalo Community --- */
.modal-zalo-card {
  max-width: 580px;
  width: 100%;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25);
}

.zalo-modal-banner {
  background: linear-gradient(135deg, #0080ff 0%, #004cb8 100%);
  color: white;
  padding: 24px 24px 20px 24px;
  position: relative;
}

.zalo-modal-banner h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.zalo-modal-banner p {
  font-size: 13.5px;
  opacity: 0.92;
  line-height: 1.5;
}

.zalo-verified-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  margin-top: 10px;
}

.zalo-modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(85vh - 120px);
  overflow-y: auto;
}

/* Primary Direct Button */
.btn-zalo-join-primary {
  width: 100%;
  background: linear-gradient(135deg, #0084ff 0%, #0056d6 100%);
  color: white;
  border: none;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 102, 255, 0.35);
  transition: all 0.2s ease;
}

.btn-zalo-join-primary:hover {
  background: linear-gradient(135deg, #1490ff 0%, #0045ab 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 102, 255, 0.45);
  color: white;
}

/* Danh sách nhóm con */
.zalo-groups-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.zalo-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.zalo-group-row:hover {
  background: #f0f7ff;
  border-color: #bae0fd;
}

.zalo-group-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zalo-group-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: white;
  border: 1px solid var(--neutral-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.zalo-group-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.zalo-group-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

.btn-zalo-subjoin {
  background: white;
  color: #0068ff;
  border: 1.5px solid #0068ff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-zalo-subjoin:hover {
  background: #0068ff;
  color: white;
}

/* Khung hiển thị QR Zalo */
.zalo-qr-section {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 1px dashed #cbd5e1;
}

.zalo-qr-canvas-box {
  background: white;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--neutral-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.zalo-qr-instruction {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.zalo-qr-instruction strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

/* Khung chuyển tiếp sang Blog */
.modal-blog-teaser {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
}

.modal-blog-teaser-text {
  font-size: 12.5px;
  color: #92400e;
}

.modal-blog-teaser-text strong {
  display: block;
  font-size: 13px;
  color: #78350f;
  margin-bottom: 2px;
}

.btn-teaser-blog {
  background: #f59e0b;
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-teaser-blog:hover {
  background: #d97706;
  color: white;
}

/* --- D. Sidebar Community Mini Box --- */
.sidebar-community-box {
  margin: 16px 0 10px 0;
  padding: 14px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.sidebar-community-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.sidebar-community-box-title {
  font-size: 13px;
  font-weight: 700;
  color: #0369a1;
}

.sidebar-community-box-desc {
  font-size: 11.5px;
  color: #075985;
  line-height: 1.45;
  margin-bottom: 10px;
}

.sidebar-community-actions {
  display: flex;
  gap: 8px;
}

.btn-sidebar-zalo {
  flex: 1.3;
  background: #0068ff;
  color: white;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s ease;
}

.btn-sidebar-zalo:hover {
  background: #0056d6;
  color: white;
}

.btn-sidebar-blog {
  flex: 1;
  background: white;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-sidebar-blog:hover {
  background: #fffbeb;
  border-color: #f59e0b;
}

/* --- E. Blog Page Layout & Styles --- */
.blog-hero {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #1e3a8a 100%);
  color: white;
  padding: 48px 24px 40px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}

.blog-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
  backdrop-filter: blur(4px);
}

.blog-hero-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 12px;
  max-width: 680px;
}

.blog-hero-subtitle {
  font-size: 15px;
  opacity: 0.92;
  max-width: 620px;
  line-height: 1.6;
  margin-bottom: 22px;
}

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

.btn-hero-zalo {
  background: #0068ff;
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 104, 255, 0.4);
  transition: all 0.2s ease;
}

.btn-hero-zalo:hover {
  background: #0056d6;
  transform: translateY(-2px);
  color: white;
}

.btn-hero-outline {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}

.btn-hero-outline:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Category Filter Bar */
.blog-categories-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 26px;
  scrollbar-width: thin;
}

.blog-cat-btn {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: white;
  border: 1px solid var(--neutral-border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.blog-cat-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.blog-cat-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Article Cards Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.blog-card {
  background: white;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.blog-card-cover {
  height: 180px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.blog-card-category-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(15, 23, 42, 0.75);
  color: white;
  backdrop-filter: blur(4px);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  z-index: 2;
}

.blog-card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-subtle);
  margin-bottom: 8px;
}

.blog-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 10px;
  cursor: pointer;
}

.blog-card-title:hover {
  color: var(--primary);
}

.blog-card-summary {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
}

.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--neutral-border-subtle);
}

.blog-author-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blog-author-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.blog-author-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.btn-read-article {
  background: #f0f9ff;
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-read-article:hover {
  background: var(--primary);
  color: white;
}

/* Call to Action Banner on Blog */
.blog-cta-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  padding: 32px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
}

.blog-cta-content h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}

.blog-cta-content p {
  font-size: 13.5px;
  opacity: 0.85;
  line-height: 1.5;
}

.blog-cta-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

/* Mobile responsive for floating & blog */
@media (max-width: 1024px) {
  .floating-community-widget {
    bottom: 76px;
    right: 14px;
  }
  
  .floating-btn {
    padding: 8px 13px;
    font-size: 12.5px;
  }
  
  .floating-icon-wrap {
    width: 22px;
    height: 22px;
  }
  
  .blog-hero {
    padding: 32px 18px;
  }
  
  .blog-hero-title {
    font-size: 22px;
  }
  
  .blog-cta-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .blog-cta-actions {
    width: 100%;
    flex-direction: column;
  }
  
  .blog-cta-actions .btn-zalo-join-primary,
  .blog-cta-actions .btn-main {
    width: 100%;
  }
}

@media print {
  .floating-community-widget,
  .btn-header-zalo,
  .btn-header-blog,
  .sidebar-community-box {
    display: none !important;
  }
}


/* ==========================================================================
   12. HEADER DROPDOWNS & RESPONSIVE COMPACT NAVIGATION
   ========================================================================== */

/* --- A. Tối ưu khu vực chọn Lớp (Grade Tabs) chống tràn --- */
.grade-tabs {
  max-width: min(100%, 540px);
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  flex-shrink: 1;
}

.grade-tabs::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* --- B. Dropdown Menu Container & Buttons --- */
.header-dropdown {
  position: relative;
  display: inline-flex;
}

.btn-header-dropdown {
  border: 1px solid var(--neutral-border);
  background: var(--neutral-surface);
  color: var(--text-main);
  padding: 6px 11px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  white-space: nowrap;
}

.btn-header-dropdown:hover {
  background: var(--neutral-bg);
  border-color: #cbd5e1;
}

.header-dropdown.active .btn-header-dropdown {
  background: var(--neutral-bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.dropdown-arrow {
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.header-dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Biến thể Zalo Dropdown Button */
.btn-dropdown-zalo {
  background: #f0f7ff;
  border-color: #bae0fd;
  color: #0369a1;
}

.btn-dropdown-zalo:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0284c7;
}

.header-dropdown.active .btn-dropdown-zalo {
  background: #e0f2fe;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(0, 104, 255, 0.15);
}

/* Biến thể Services / Tiện ích Dropdown Button */
.btn-dropdown-services {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.btn-dropdown-services:hover {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.header-dropdown.active .btn-dropdown-services {
  background: #fef3c7;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* --- C. Dropdown Menu Flyout Panel --- */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 330px;
  max-width: 380px;
  background: white;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: 8px;
  z-index: 9999;
  display: none;
}

.header-dropdown.active .dropdown-menu {
  display: block;
  animation: dropdownFlyoutIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.dropdown-header {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 8px 12px 6px 12px;
}

.dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.15s ease;
  cursor: pointer;
}

.dropdown-item:hover {
  background: #f8fafc;
  transform: translateX(2px);
}

.dropdown-item-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.icon-zalo {
  background: #0068ff;
  color: white;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: -0.5px;
}

.icon-qr {
  background: #eff6ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.icon-blog {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}

.icon-delivery {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.icon-star {
  background: #fefce8;
  border: 1px solid #fef08a;
}

.icon-help {
  background: #f8fafc;
  color: #475569;
  border: 1px solid var(--neutral-border);
}

.icon-hotline, .icon-info {
  background: #f1f5f9;
}

.dropdown-item-body {
  flex: 1;
  min-width: 0;
}

.dropdown-item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.dropdown-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.dropdown-item:hover .dropdown-item-title {
  color: var(--primary);
}

.dropdown-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.dropdown-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge-blue {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-amber {
  background: #fef3c7;
  color: #b45309;
}

.dropdown-divider {
  height: 1px;
  background: var(--neutral-border-subtle);
  margin: 6px 0;
}

.dropdown-item-subtle {
  padding: 8px 12px;
}

.dropdown-item-subtle .dropdown-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

/* --- D. Responsive Layout Tối Ưu Đa Màn Hình --- */

/* Màn hình Laptop nhỏ & Trung bình (<= 1366px) */
@media (max-width: 1366px) {
  .header-left {
    gap: 12px;
  }

  .grade-tab {
    padding: 5px 8px;
    font-size: 12.5px;
  }

  .header-right {
    gap: 8px;
  }

  .btn-header-dropdown {
    padding: 6px 9px;
    font-size: 12.5px;
  }

  .mode-btn {
    padding: 6px 9px;
    font-size: 12.5px;
  }

  .btn-upgrade-pro {
    padding: 6px 11px;
    font-size: 12.5px;
  }
}

/* Màn hình Laptop hẹp (<= 1200px) */
@media (max-width: 1200px) {
  .grade-tabs {
    max-width: 320px;
  }

  /* Ẩn chữ dài của nút Mode Switcher, chỉ giữ text ngắn */
  .mode-btn-text-full {
    display: none;
  }

  /* Ẩn chữ 'Kho đề', chỉ giữ icon + số lượng */
  .saved-label {
    display: none;
  }

  .btn-header-saved {
    padding: 6px 8px;
  }

  .dropdown-menu {
    min-width: 300px;
  }
}

/* Tablet & Mobile (<= 1024px) */
@media (max-width: 1024px) {
  .dropdown-menu {
    position: fixed;
    top: calc(var(--header-height) + 6px);
    right: 12px;
    left: 12px;
    max-width: none;
    min-width: 0;
  }
}


/* ==========================================================================
   13. GRADE SELECTOR DROPBOX (To, rõ ràng, đẹp mắt, chuẩn GDPT 1-9)
   ========================================================================== */

.grade-dropdown-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Nút kích hoạt Dropdown to rõ trên Header */
.btn-grade-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: white;
  border: 1.5px solid var(--primary-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  user-select: none;
}

.btn-grade-dropdown-trigger:hover {
  background: #f0f9ff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
  transform: translateY(-1px);
}

.grade-dropdown-wrapper.active .btn-grade-dropdown-trigger {
  background: #f0f9ff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
}

.grade-trigger-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #e0f2fe;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-grade-dropdown-trigger:hover .grade-trigger-icon {
  background: var(--primary);
  color: white;
}

.grade-trigger-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.grade-trigger-label {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.2px;
}

.grade-trigger-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.2;
}

.grade-trigger-arrow {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 2px;
}

.grade-dropdown-wrapper.active .grade-trigger-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Panel Menu Dropdown to rộng, rõ nét */
.grade-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 480px;
  max-width: 92vw;
  background: white;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.25), 0 6px 18px rgba(0, 0, 0, 0.08);
  padding: 16px;
  z-index: 9999;
  display: none;
}

.grade-dropdown-wrapper.active .grade-dropdown-panel {
  display: block;
  animation: dropdownFlyoutIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.grade-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--neutral-border);
}

.grade-panel-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.grade-panel-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.btn-close-grade-panel {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-close-grade-panel:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.grade-panel-scrollable {
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.grade-group-section {
  margin-bottom: 16px;
}

.grade-group-section:last-child {
  margin-bottom: 4px;
}

.grade-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
  padding: 0 4px;
}

.grade-group-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary);
  background: #f0f9ff;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.grade-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* Thẻ Chọn Khối Lớp */
.grade-card-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1.5px solid var(--neutral-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.grade-card-item:hover {
  background: #f0f9ff;
  border-color: #bae6fd;
  transform: translateY(-1px);
}

.grade-card-item.active {
  background: #ecfdf5;
  border-color: #10b981;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.16);
}

.grade-card-item.upcoming {
  opacity: 0.72;
}

.grade-card-item.upcoming:hover {
  background: #fefce8;
  border-color: #fde68a;
  opacity: 1;
}

.grade-number-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  border: 1.5px solid;
  flex-shrink: 0;
}

.grade-card-body {
  flex: 1;
  min-width: 0;
}

.grade-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.grade-card-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.grade-card-item.active .grade-card-title {
  color: #065f46;
}

.grade-card-summary {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.grade-card-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-active {
  background: #10b981;
  color: white;
}

.badge-ready {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-upcoming {
  background: #f1f5f9;
  color: #64748b;
}

/* Responsive cho Grade Dropdown */
@media (max-width: 1024px) {
  .grade-dropdown-panel {
    position: fixed;
    top: calc(var(--header-height) + 6px);
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}


/* ==========================================================================
   14. DUAL-COLUMN SIDEBAR CONTROLS (Tách riêng Thiết Lập In & Nội Dung Đề)
   ========================================================================== */

/* Cột 1: Thiết lập phiếu in */
.sidebar.sidebar-settings {
  width: 275px;
  flex-shrink: 0;
  background: var(--neutral-surface);
  border-right: 1px solid var(--neutral-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.02);
  z-index: 10;
}

.sidebar.sidebar-settings .sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  scrollbar-width: thin;
}

.sidebar.sidebar-settings .sidebar-footer {
  flex-shrink: 0;
  padding: 12px 14px;
  background: var(--neutral-surface);
  border-top: 1px solid var(--neutral-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar.sidebar-settings .action-row {
  display: flex;
  gap: 5px;
}

.sidebar.sidebar-settings .action-row .btn-secondary {
  flex: 1;
  padding: 7px 4px;
  font-size: 11.5px;
  font-weight: 600;
  gap: 4px;
  white-space: nowrap;
}

.sidebar.sidebar-settings .sidebar-community-box {
  margin-top: 4px;
  padding: 10px 12px;
}

.sidebar.sidebar-settings .sidebar-legal-links {
  margin-top: 2px;
  font-size: 10.5px;
}

/* Cột 2: Chọn nội dung đề thi (Dọc riêng bên phải của Thiết lập phiếu in) */
.sidebar.sidebar-topics {
  width: 340px;
  flex-shrink: 0;
  background: #fbfcfd;
  border-right: 1px solid var(--neutral-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 9;
}

.topics-panel-header {
  padding: 14px 16px 10px 16px;
  background: white;
  border-bottom: 1px solid var(--neutral-border);
  flex-shrink: 0;
}

.topics-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 24px 14px;
  scrollbar-width: thin;
}

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

.panel-icon {
  font-size: 17px;
  line-height: 1;
}

.topics-quick-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.btn-topics-quick {
  background: #f1f5f9;
  border: 1px solid var(--neutral-border);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-topics-quick:hover {
  background: #e2e8f0;
  color: var(--primary);
  border-color: #cbd5e1;
}

.topics-count-badge {
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Responsive cho Dual-Column Sidebar */
@media (max-width: 1400px) {
  .sidebar.sidebar-settings {
    width: 260px;
  }
  .sidebar.sidebar-topics {
    width: 320px;
  }
}

@media (max-width: 1240px) {
  .sidebar.sidebar-settings {
    width: 240px;
  }
  .sidebar.sidebar-topics {
    width: 290px;
  }
}

@media (max-width: 1024px) {
  .sidebar.sidebar-settings,
  .sidebar.sidebar-topics {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--neutral-border);
  }
}


/* Khung Chọn Đề Thi Định Kỳ & Đề Ngẫu Nhiên (Chuẩn GDPT 2018 - Thông tư 27) */
.exam-presets-bar {
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--neutral-border);
}

.preset-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.preset-title-tag {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.3px;
}

.preset-sub-tag {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.preset-buttons-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.btn-preset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-preset:hover {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-preset.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.btn-preset-random {
  background: #fefce8;
  border-color: #fef08a;
  color: #854d0e;
}

.btn-preset-random:hover {
  background: #fef9c3;
  border-color: #eab308;
  color: #713f12;
}

.btn-preset-random.active {
  background: #eab308;
  border-color: #ca8a04;
  color: white;
}
