/* ================================================================
   MDS v1.0 — MEMORIZZA DESIGN SYSTEM — Official Design Tokens
   Source of truth for all interface components.
   docs/design-system/README.md | /design-system (visual catalog)
   ================================================================ */
:root {
  /* ── PRIMARY (Azul Principal) ───────────────────────────────── */
  --mz-primary-50:  #eff6ff;
  --mz-primary-100: #dbeafe;
  --mz-primary-200: #bfdbfe;
  --mz-primary-300: #93c5fd;
  --mz-primary-400: #60a5fa;
  --mz-primary-500: #3b82f6;
  --mz-primary-600: #2563eb;
  --mz-primary-700: #1d4ed8;
  --mz-primary-800: #1e40af;
  --mz-primary-900: #1e3a8a;

  /* ── SECONDARY (Roxo) ───────────────────────────────────────── */
  --mz-secondary-50:  #f5f3ff;
  --mz-secondary-100: #ede9fe;
  --mz-secondary-200: #ddd6fe;
  --mz-secondary-300: #c4b5fd;
  --mz-secondary-400: #a78bfa;
  --mz-secondary-500: #8b5cf6;
  --mz-secondary-600: #7c3aed;
  --mz-secondary-700: #6d28d9;
  --mz-secondary-800: #5b21b6;
  --mz-secondary-900: #4c1d95;

  /* ── SUCCESS ────────────────────────────────────────────────── */
  --mz-success-light: #dcfce7;
  --mz-success:       #22c55e;
  --mz-success-dark:  #15803d;

  /* ── WARNING ────────────────────────────────────────────────── */
  --mz-warning-light: #fef3c7;
  --mz-warning:       #f59e0b;
  --mz-warning-dark:  #b45309;

  /* ── DANGER ─────────────────────────────────────────────────── */
  --mz-danger-light:  #fee2e2;
  --mz-danger:        #ef4444;
  --mz-danger-dark:   #b91c1c;

  /* ── INFO ───────────────────────────────────────────────────── */
  --mz-info-light:    #e0f2fe;
  --mz-info:          #0ea5e9;
  --mz-info-dark:     #0369a1;

  /* ── ACCENT (Amarelo) ───────────────────────────────────────── */
  --mz-accent:        #facc15;
  --mz-accent-dark:   #ca8a04;

  /* ── NEUTRAL ────────────────────────────────────────────────── */
  --mz-neutral-0:   #ffffff;
  --mz-neutral-50:  #f8fafc;
  --mz-neutral-100: #f1f5f9;
  --mz-neutral-200: #e2e8f0;
  --mz-neutral-300: #cbd5e1;
  --mz-neutral-400: #94a3b8;
  --mz-neutral-500: #64748b;
  --mz-neutral-600: #475569;
  --mz-neutral-700: #334155;
  --mz-neutral-800: #1e293b;
  --mz-neutral-900: #0f172a;

  /* ── SURFACE & BACKGROUND ───────────────────────────────────── */
  --mz-bg:            #f5f7fc;
  --mz-bg-subtle:     var(--mz-neutral-100);
  --mz-surface:       #ffffff;
  --mz-surface-2:     var(--mz-neutral-50);
  --mz-border:        var(--mz-neutral-200);
  --mz-border-subtle: rgba(15, 23, 42, 0.07);

  /* ── TEXT ────────────────────────────────────────────────────── */
  --mz-text:          var(--mz-neutral-800);
  --mz-text-subtle:   var(--mz-neutral-500);
  --mz-text-muted:    var(--mz-neutral-400);
  --mz-text-inverse:  #ffffff;
  --mz-text-link:     var(--mz-primary-600);

  /* ── ALIASES ─────────────────────────────────────────────────────
     --mz-text-primary/--mz-text-secondary/--mz-bg-elevated/--mz-bg-secondary
     nunca foram tokens "oficiais" deste arquivo, mas varias views e o
     polish.css passaram a usa-los como se fossem (marketplace/subscription.php,
     cart.php, orders.php, detail.php, admin/index.php, ai/index.php,
     learning_pack/dashboard.php) — sem nenhuma definicao, "color:
     var(--mz-text-primary)" virava invalido e caia no valor herdado, quase
     ilegivel no dark mode. Mantidos como alias pros tokens reais em vez de
     editar cada uso individualmente. */
  --mz-text-primary:   var(--mz-text);
  --mz-text-secondary: var(--mz-text-subtle);
  --mz-bg-elevated:    var(--mz-surface);
  --mz-bg-secondary:   var(--mz-bg-subtle);

  /* ── TYPOGRAPHY ─────────────────────────────────────────────── */
  --mz-font-family:    'Manrope', system-ui, -apple-system, sans-serif;
  --mz-font-mono:      'Fira Code', 'Consolas', monospace;

  --mz-text-xs:   0.67rem;
  --mz-text-sm:   0.75rem;
  --mz-text-base: 0.875rem;
  --mz-text-md:   1rem;
  --mz-text-lg:   1.125rem;
  --mz-text-xl:   1.25rem;
  --mz-text-2xl:  1.5rem;
  --mz-text-3xl:  1.875rem;
  --mz-text-4xl:  2.25rem;

  --mz-font-normal:    400;
  --mz-font-medium:    500;
  --mz-font-semibold:  600;
  --mz-font-bold:      700;
  --mz-font-extrabold: 800;

  --mz-leading-tight:   1.1;
  --mz-leading-snug:    1.25;
  --mz-leading-normal:  1.5;
  --mz-leading-relaxed: 1.625;

  /* ── SPACING ─────────────────────────────────────────────────── */
  --mz-space-1:  0.25rem;
  --mz-space-2:  0.5rem;
  --mz-space-3:  0.75rem;
  --mz-space-4:  1rem;
  --mz-space-5:  1.25rem;
  --mz-space-6:  1.5rem;
  --mz-space-8:  2rem;
  --mz-space-10: 2.5rem;
  --mz-space-12: 3rem;
  --mz-space-16: 4rem;

  /* ── RADIUS ──────────────────────────────────────────────────── */
  --mz-radius-sm:   4px;
  --mz-radius-md:   8px;
  --mz-radius-lg:   12px;
  --mz-radius-xl:   16px;
  --mz-radius-2xl:  24px;
  --mz-radius-full: 9999px;

  /* ── SHADOWS ─────────────────────────────────────────────────── */
  --mz-shadow-xs: 0 1px 2px rgba(15,23,42,0.05);
  --mz-shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 4px 16px rgba(15,23,42,0.04);
  --mz-shadow-md: 0 4px 12px rgba(15,23,42,0.08), 0 16px 32px rgba(15,23,42,0.05);
  --mz-shadow-lg: 0 8px 24px rgba(15,23,42,0.12), 0 24px 48px rgba(15,23,42,0.07);
  --mz-shadow-xl: 0 16px 40px rgba(15,23,42,0.16), 0 40px 80px rgba(15,23,42,0.10);

  /* ── Z-INDEX ──────────────────────────────────────────────────── */
  --mz-z-base:    0;
  --mz-z-raised:  10;
  --mz-z-sticky:  20;
  --mz-z-overlay: 30;
  --mz-z-modal:   40;
  --mz-z-toast:   50;
  --mz-z-tooltip: 60;

  /* ── MOTION ──────────────────────────────────────────────────── */
  --mz-ease-in:     cubic-bezier(0.4, 0, 1, 1);
  --mz-ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --mz-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --mz-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --mz-duration-fast:   150ms;
  --mz-duration-normal: 200ms;
  --mz-duration-slow:   300ms;

  /* ── LAYOUT ──────────────────────────────────────────────────── */
  --mz-sidebar-width:   260px;
  --mz-sidebar-compact: 64px;
  --mz-topbar-height:   56px;
  --mz-content-max:     1200px;
  --mz-panel-gap:       1.5rem;
}

/* MDS Dark Mode Overrides ───────────────────────────────────── */
html[data-theme='dark'] {
  --mz-bg:            #0d1628;
  --mz-bg-subtle:     #111c31;
  --mz-surface:       var(--mz-neutral-800);
  --mz-surface-2:     #1a2740;
  --mz-border:        rgba(255, 255, 255, 0.08);
  --mz-border-subtle: rgba(255, 255, 255, 0.05);
  --mz-text:          var(--mz-neutral-100);
  --mz-text-subtle:   var(--mz-neutral-400);
  --mz-text-muted:    var(--mz-neutral-600);
  --mz-text-link:     var(--mz-primary-400);

  --mz-text-primary:   var(--mz-text);
  --mz-text-secondary: var(--mz-text-subtle);
  --mz-bg-elevated:    var(--mz-surface);
  --mz-bg-secondary:   var(--mz-bg-subtle);
}

/* MDS Utility Aliases ───────────────────────────────────────── */
.mds-surface { background: var(--mz-surface); border: 1px solid var(--mz-border-subtle); border-radius: var(--mz-radius-lg); box-shadow: var(--mz-shadow-sm); }

:root {
  --bg: #f8fafc;
  --bg-2: #e5e7eb;
  --text: #1e293b;
  --muted: #64748b;
  --brand: #2563eb;
  --brand-2: #7c3aed;
  --brand-soft: #dbeafe;
  --accent: #facc15;
  --success: #22c55e;
  --danger: #ef4444;
  --card: #ffffff;
  --panel-topbar-bg: rgba(255, 255, 255, 0.75);
  --panel-topbar-text: #1e293b;
  --panel-topbar-border: rgba(37, 99, 235, 0.12);
  --panel-topbar-tag-bg: #fef9c3;
  --panel-topbar-tag-text: #92400e;
}

html[data-theme='dark'] {
  --bg: #0b1220;
  --bg-2: #111c31;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --brand-soft: rgba(37, 99, 235, 0.2);
  --card: #18243b;
  --panel-topbar-bg: rgba(15, 23, 42, 0.96);
  --panel-topbar-text: #f8fafc;
  --panel-topbar-border: rgba(148, 163, 184, 0.16);
  --panel-topbar-tag-bg: rgba(250, 204, 21, 0.16);
  --panel-topbar-tag-text: #fde68a;
}

* {
  font-family: 'Manrope', sans-serif;
}

.app-body,
.site-standard-shell {
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 90% -100px, rgba(37, 99, 235, 0.22) 0%, transparent 45%),
    radial-gradient(900px 550px at -10% 110%, rgba(124, 58, 237, 0.18) 0%, transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  padding: 0.4rem 0.65rem;
  margin-bottom: 0.75rem;
  gap: 0.45rem;
  background:
    radial-gradient(500px 400px at 10% 20%, rgba(37, 99, 235, 0.2), transparent 65%),
    radial-gradient(600px 300px at 90% 80%, rgba(124, 58, 237, 0.18), transparent 70%);
}

.site-standard-shell .card,
.site-standard-shell .auth-card {
  border-radius: 1rem;
  border: 1px solid rgba(37, 99, 235, 0.1);
  box-shadow: 0 16px 38px rgba(30, 41, 59, 0.08);
}

.auth-card {
  width: 100%;
  max-width: 480px;
  border-radius: 1rem;
  border: 1px solid rgba(37, 99, 235, 0.12) !important;
  box-shadow: 0 24px 60px rgba(30, 41, 59, 0.14) !important;
}

.auth-logo {
  width: 210px;
  max-width: 100%;
  height: auto;
  display: block;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--mz-text-subtle, #94a3b8);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--mz-border, #e2e8f0);
}

.btn-google-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 0.6rem;
  border: 1px solid var(--mz-border, #dadce0);
  background: var(--mz-surface, #ffffff);
  color: var(--mz-text, #3c4043);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.btn-google-oauth:hover {
  background: var(--mz-bg-subtle, #f8f9fa);
  color: var(--mz-text, #3c4043);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html[data-theme='dark'] .btn-google-oauth {
  background: var(--mz-surface);
  border-color: var(--mz-border);
  color: var(--mz-text);
}

html[data-theme='dark'] .btn-google-oauth:hover {
  background: var(--mz-bg-subtle);
}

.hero-panel {
  background:
    radial-gradient(500px 280px at 100% 0%, rgba(250, 204, 21, 0.24) 0%, transparent 70%),
    linear-gradient(130deg, #1e293b 0%, #2563eb 48%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 22px 50px rgba(30, 41, 59, 0.3);
}

.hero-logo {
  width: 260px;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.18));
}

.hero-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: #fef08a;
}

.hero-slogan {
  font-weight: 600;
  font-size: 1.05rem;
  color: #e2e8f0;
}

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

.btn-primary:hover,
.btn-primary:focus {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.site-standard-shell .btn {
  border-radius: 0.7rem;
  font-weight: 700;
}

.site-standard-shell .btn-primary {
  background: linear-gradient(135deg, var(--brand), #1d4ed8);
  border-color: var(--brand);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.site-standard-shell .btn-primary:hover,
.site-standard-shell .btn-primary:focus {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  border-color: #1d4ed8;
}

.site-standard-shell .btn-outline-primary {
  border-color: #9ec5fe;
  color: #2563eb;
  background: #eff6ff;
}

.site-standard-shell .btn-outline-primary:hover {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1d4ed8;
}

.site-standard-shell .btn-outline-secondary {
  border-color: #cbd5e1;
  color: #64748b;
}

.site-standard-shell .btn-outline-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #334155;
}

.site-standard-shell .btn-outline-danger {
  border-color: #fecaca;
  color: #dc2626;
}

.site-standard-shell .btn-outline-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* Dark mode — estes botoes outline sao usados em varias telas via .site-standard-shell
   (layout base), com cores pastel fixas que ficam como caixas claras em cima de fundo
   escuro. */
html[data-theme='dark'] .site-standard-shell .btn-outline-primary {
  border-color: rgba(96, 165, 250, 0.45);
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
}

html[data-theme='dark'] .site-standard-shell .btn-outline-primary:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(96, 165, 250, 0.6);
  color: #bfdbfe;
}

html[data-theme='dark'] .site-standard-shell .btn-outline-secondary {
  border-color: var(--mz-border);
  color: var(--mz-text-subtle);
}

html[data-theme='dark'] .site-standard-shell .btn-outline-secondary:hover {
  background: var(--mz-bg-subtle);
  border-color: var(--mz-text-muted);
  color: var(--mz-text);
}

html[data-theme='dark'] .site-standard-shell .btn-outline-danger {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

html[data-theme='dark'] .site-standard-shell .btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(248, 113, 113, 0.6);
  color: #fecaca;
}

.site-standard-shell .form-control,
.site-standard-shell .form-select,
.site-standard-shell .input-group .btn {
  border-radius: 0.75rem;
  border-color: #d5dceb;
}

.site-standard-shell .form-control:focus,
.site-standard-shell .form-select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 0.15rem rgba(59, 130, 246, 0.12);
}

.btn-outline-light:hover {
  color: #1e293b;
  background-color: #f8fafc;
}

.metric-card {
  background: var(--card);
  border-radius: 1rem;
  padding: 1rem;
  border: 1px solid rgba(37, 99, 235, 0.08);
  box-shadow: 0 10px 24px rgba(30, 41, 59, 0.08);
}

.metric-card h6 {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.metric-card strong {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 1.25rem;
}

.dashboard-pro-shell {
  display: grid;
  gap: 0.75rem;
}

.dashboard-pro-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 0.85rem;
}

.dashboard-pro-hero-copy,
.dashboard-pro-hero-actions,
.dashboard-pro-panel,
.dashboard-pro-metric-card {
  background: #ffffff;
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 1rem;
  box-shadow: 0 16px 38px rgba(30, 41, 59, 0.08);
}

.dashboard-pro-hero-copy {
  padding: 1rem 1.05rem;
}

.dashboard-pro-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4f46e5;
}

.dashboard-pro-title {
  margin: 0.35rem 0 0.4rem;
  font-size: clamp(1.25rem, 1.8vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.dashboard-pro-subtitle {
  color: #64748b;
  font-size: 0.9rem;
}

.dashboard-pro-hero-actions {
  padding: 0.85rem;
  display: grid;
  align-content: center;
  gap: 0.55rem;
}

.dashboard-pro-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.6rem;
}

.dashboard-pro-metric-card {
  padding: 0.72rem 0.8rem;
}

.dashboard-pro-metric-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  font-weight: 700;
}

.dashboard-pro-metric-value {
  display: block;
  margin-top: 0.22rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
}

.dashboard-pro-panel {
  padding: 0.95rem;
}

.dashboard-pro-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.dashboard-pro-panel-head .h6 {
  color: #334155;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.dashboard-pro-panel-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.52rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}

.dashboard-pro-chart-wrap {
  min-height: 220px;
}

.dashboard-pro-quick-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.42rem;
}

.dashboard-pro-quick-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 0.32rem;
  color: #64748b;
  font-size: 0.84rem;
}

.dashboard-pro-quick-list li strong {
  color: #0f172a;
  font-weight: 800;
}

.stats-pro-page {
  --stats-surface: #ffffff;
  --stats-border: rgba(15, 23, 42, 0.08);
  --stats-ink: #0f172a;
  --stats-muted: #64748b;
  --stats-accent: #0ea5e9;
  --stats-glow: rgba(14, 165, 233, 0.14);
}

/* Dark mode — .stats-pro-page tem seu proprio conjunto de tokens (--stats-*) em vez
   de reaproveitar --mz-*, entao precisa da propria variante escura. Redefinir os 4
   tokens aqui ja resolve a maior parte do modulo (kpi cards, paineis, textos), que
   ja consome var(--stats-surface/border/ink/muted); as regras que usam cor fixa
   direto (sem passar pelos tokens) ganham override individual logo abaixo. */
html[data-theme='dark'] .stats-pro-page {
  --stats-surface: var(--mz-surface);
  --stats-border: var(--mz-border);
  --stats-ink: var(--mz-text);
  --stats-muted: var(--mz-text-muted);
}

html[data-theme='dark'] .stats-panel-header .h6 {
  color: var(--mz-text);
}

html[data-theme='dark'] .stats-list li,
html[data-theme='dark'] .stats-ranking-list li {
  border-bottom-color: var(--mz-border);
  color: var(--mz-text-subtle);
}

html[data-theme='dark'] .stats-list li:hover,
html[data-theme='dark'] .stats-ranking-list li:hover {
  background: var(--mz-bg-subtle);
}

html[data-theme='dark'] .stats-list li strong,
html[data-theme='dark'] .stats-ranking-list li strong {
  color: var(--mz-text);
}

html[data-theme='dark'] .stats-heatmap-cell {
  background: var(--mz-bg-subtle);
  border-color: var(--mz-border);
}

html[data-theme='dark'] .stats-heatmap-cell.level-1 { background: #1e3a5f; }
html[data-theme='dark'] .stats-heatmap-cell.level-2 { background: #1d4ed8; }
html[data-theme='dark'] .stats-heatmap-cell.level-3 { background: #3b82f6; }
html[data-theme='dark'] .stats-heatmap-cell.level-4 { background: #60a5fa; }

html[data-theme='dark'] .stats-ranking-card {
  background: linear-gradient(155deg, rgba(37, 99, 235, 0.18), rgba(255, 255, 255, 0.03));
  border-color: rgba(96, 165, 250, 0.28);
  color: var(--mz-text);
}

html[data-theme='dark'] .stats-ranking-position {
  color: var(--mz-text);
}

html[data-theme='dark'] .stats-ranking-meta {
  color: var(--mz-text-subtle);
}

.stats-pro-topheader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.stats-pro-title {
  font-size: clamp(1.15rem, 1.85vw, 1.58rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--stats-ink);
  font-weight: 800;
}

.stats-pro-subtitle {
  color: var(--stats-muted);
  max-width: 66ch;
  font-size: 0.9rem;
}

.stats-pro-filterbar {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.stats-pro-filterbox {
  background: var(--stats-surface);
  border: 1px solid var(--stats-border);
  border-radius: 0.9rem;
  padding: 0.6rem 0.75rem;
  min-width: 160px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.stats-pro-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.stats-pro-actions .btn {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.stats-pro-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-radius: 1.1rem;
  padding: 1.15rem 1.3rem;
  color: #fff;
  background: linear-gradient(135deg, var(--mz-secondary-600) 0%, var(--mz-primary-600) 100%);
  box-shadow: 0 18px 40px rgba(124, 58, 237, 0.22);
  overflow: hidden;
}

.stats-pro-banner-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.stats-pro-banner-text { flex: 1; min-width: 0; }
.stats-pro-banner-text h2 { margin: 0 0 0.15rem; font-size: 1.1rem; font-weight: 800; color: #fff; }
.stats-pro-banner-text p { margin: 0; font-size: 0.84rem; color: rgba(255, 255, 255, 0.86); }

.stats-pro-banner-art {
  flex-shrink: 0;
  width: 140px;
  height: 64px;
  display: block;
}

.stats-pro-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.stats-kpi-card {
  background: var(--stats-surface);
  border: 1px solid var(--stats-border);
  border-radius: 1rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
  padding: 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stats-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 165, 233, 0.32);
  box-shadow: 0 18px 34px var(--stats-glow);
}

.stats-kpi-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.stats-kpi-icon.blue   { background: var(--mz-primary-100, #dbeafe); color: var(--mz-primary-600); }
.stats-kpi-icon.red    { background: var(--mz-danger-light, #fee2e2); color: var(--mz-danger-dark, #b91c1c); }
.stats-kpi-icon.orange { background: var(--mz-warning-light, #ffedd5); color: var(--mz-warning-dark, #c2410c); }
.stats-kpi-icon.purple { background: var(--mz-secondary-100, #ede9fe); color: var(--mz-secondary-600); }
.stats-kpi-icon.teal   { background: #ccfbf1; color: #0f766e; }

.stats-kpi-body { display: grid; gap: 0.18rem; min-width: 0; }

.stats-kpi-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stats-muted);
  font-weight: 700;
}

.stats-kpi-card strong {
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  color: var(--stats-ink);
  letter-spacing: -0.02em;
}

.stats-kpi-delta {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  min-height: 1em;
}
.stats-kpi-delta.is-positive { color: var(--mz-success-dark, #15803d); }
.stats-kpi-delta.is-negative { color: var(--mz-danger-dark, #b91c1c); }

.stats-weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}

.stats-weekday-card {
  background: var(--stats-surface);
  border: 1px solid var(--stats-border);
  border-radius: 0.8rem;
  padding: 0.6rem 0.5rem;
  text-align: center;
  display: grid;
  gap: 0.2rem;
}

.stats-weekday-name { margin: 0; font-size: 0.72rem; font-weight: 700; color: var(--stats-muted); }
.stats-weekday-sessions { font-size: 0.88rem; color: var(--stats-ink); }
.stats-weekday-hours { font-size: 0.72rem; color: var(--stats-muted); }

.stats-weekday-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.18rem;
  height: 22px;
  margin-top: 0.2rem;
}
.stats-weekday-bars span {
  width: 5px;
  border-radius: 2px 2px 0 0;
  background: var(--mz-secondary-600);
  opacity: 0.75;
}

.stats-insights-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.stats-insight-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  border: 1px solid var(--stats-border);
  border-radius: 0.9rem;
  padding: 0.7rem;
}

.stats-insight-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--mz-secondary-100, #ede9fe);
  color: var(--mz-secondary-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.stats-insight-title { margin: 0; font-size: 0.82rem; font-weight: 700; color: var(--stats-ink); }
.stats-insight-desc { margin: 0.1rem 0 0; font-size: 0.76rem; color: var(--stats-muted); }

.stats-pro-grid {
  display: grid;
  gap: 0.85rem;
}

.stats-pro-grid-main {
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
}

.stats-pro-grid-secondary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-panel {
  background:
    radial-gradient(500px 180px at 100% 0%, rgba(14, 165, 233, 0.06), transparent 72%),
    var(--stats-surface);
  border: 1px solid var(--stats-border);
  border-radius: 1rem;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.07);
  padding: 0.82rem;
  min-height: 250px;
  animation: stats-fade-up 0.42s ease both;
}

.stats-panel-wide {
  min-height: 320px;
}

.stats-panel-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.58rem;
}

.stats-panel-header .h6 {
  color: #1e293b;
  font-weight: 800;
}

#statsEvolutionChart,
#statsDistributionChart {
  width: 100%;
  min-height: 220px;
  max-height: 320px;
}

.stats-list,
.stats-ranking-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.34rem;
}

.stats-list li,
.stats-ranking-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 0.84rem;
  color: #334155;
}

.stats-list li:hover,
.stats-ranking-list li:hover {
  background: rgba(226, 232, 240, 0.3);
  border-radius: 0.45rem;
  padding-left: 0.28rem;
  padding-right: 0.28rem;
}

.stats-list li strong,
.stats-ranking-list li strong {
  color: #0f172a;
  font-weight: 800;
}

.stats-list-empty {
  color: var(--stats-muted);
  font-style: italic;
}

.stats-heatmap {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 0.24rem;
}

.stats-heatmap-cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 0.24rem;
  background: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.stats-heatmap-cell:hover {
  transform: scale(1.12);
  filter: brightness(0.95);
}

.stats-heatmap-cell.level-1 {
  background: #dbeafe;
}

.stats-heatmap-cell.level-2 {
  background: #93c5fd;
}

.stats-heatmap-cell.level-3 {
  background: #60a5fa;
}

.stats-heatmap-cell.level-4 {
  background: #2563eb;
}

.stats-ranking-card {
  background: linear-gradient(155deg, rgba(37, 99, 235, 0.09), rgba(15, 23, 42, 0.04));
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 0.92rem;
  padding: 0.76rem;
  color: #1e293b;
}

.stats-ranking-position {
  margin: 0;
  font-size: clamp(1.42rem, 2.1vw, 1.9rem);
  letter-spacing: -0.03em;
  color: #0f172a;
}

.stats-ranking-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  font-size: 0.82rem;
  color: #475569;
}

@keyframes stats-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1200px) {
  .dashboard-pro-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-pro-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-pro-grid-main {
    grid-template-columns: 1fr;
  }

  .stats-insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .dashboard-pro-hero {
    grid-template-columns: 1fr;
  }

  .stats-pro-topheader,
  .stats-pro-grid-secondary {
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .stats-pro-actions {
    grid-template-columns: 1fr;
  }

  .stats-heatmap {
    grid-template-columns: repeat(14, minmax(0, 1fr));
  }

  .stats-weekday-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-pro-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-pro-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-panel {
    min-height: 220px;
  }

  .stats-heatmap {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .stats-weekday-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-insights-grid {
    grid-template-columns: 1fr;
  }

  .stats-pro-banner {
    flex-wrap: wrap;
  }

  .stats-pro-banner-art {
    display: none;
  }
}

.library-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.library-pane-row {
  width: 100%;
}

.library-workspace-tabs-root {
  margin-bottom: 0.9rem;
}

/* A barra de abas do Editor Inteligente (Editor/Materiais IA/Highlights/...)
   usa as mesmas classes .dbv3-tabs/.dbv3-tab de Flashcards/Questões/Revisões
   (ver public/assets/js/pages/library.js:initializeLibraryWorkspaceTabs) —
   só o badge de contagem (Highlights/Flashcards/Questões) é específico daqui. */
.library-workspace-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.32rem;
  border-radius: 999px;
  background: var(--mz-secondary-100, #ede9fe);
  color: var(--mz-secondary-600);
  font-size: 0.68rem;
  font-weight: 800;
  margin-left: 0.15rem;
}

.dbv3-tab.active .library-workspace-tab-count {
  background: var(--mz-secondary-600);
  color: #ffffff;
}

.library-workspace-panels > section {
  min-height: 240px;
}

.library-tab-toolbar {
  margin-bottom: 0.65rem;
}

.library-workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.72rem;
}

.library-rel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.72rem;
}

.library-workspace-card {
  border: 1px solid var(--mz-border);
  border-radius: 0.9rem;
  padding: 0.72rem;
  background: var(--mz-surface);
  min-height: 120px;
}

.library-workspace-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.42rem;
  color: var(--mz-text);
}

.library-workspace-card p {
  margin: 0;
  color: var(--mz-text-subtle);
  font-size: 0.84rem;
  line-height: 1.5;
}

.library-workspace-empty {
  border: 1px dashed var(--mz-border);
  border-radius: 0.9rem;
  padding: 0.95rem;
  background: var(--mz-bg-subtle);
}

.library-workspace-empty h4 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--mz-text);
}

.library-workspace-empty p {
  margin: 0;
  color: var(--mz-text-subtle);
  font-size: 0.84rem;
}

.library-workspace-skeleton {
  display: grid;
  gap: 0.55rem;
}

.library-workspace-skeleton span {
  display: block;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eff4fb 0%, #dde8f8 48%, #eff4fb 100%);
  background-size: 240% 100%;
  animation: library-skeleton 1.2s ease-in-out infinite;
}

@keyframes library-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.library-workspace-ia-output {
  margin-top: 0.7rem;
  padding: 0.7rem;
  border-radius: 0.72rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  white-space: pre-wrap;
  color: #334155;
  font-size: 0.83rem;
  max-height: 380px;
  overflow: auto;
}

.library-workspace-footer {
  grid-column: 1 / -1;
  position: sticky;
  bottom: 0.5rem;
  z-index: 9;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #d9e4f4;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.library-workspace-footer span {
  font-size: 0.74rem;
  color: #334155;
  font-weight: 600;
}

.library-workspace-footer-spacer {
  flex: 1 1 auto;
}

.library-workspace-footer-zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.library-workspace-footer-zoom span {
  min-width: 2.6rem;
  text-align: center;
}

.library-workspace-footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid #d9e4f4;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #475569;
  font-size: 0.78rem;
  padding: 0;
  line-height: 1;
}

.library-workspace-footer-btn:hover {
  background: #eef2ff;
  color: #312e81;
  border-color: rgba(79, 70, 229, 0.3);
}

.library-workspace-footer-btn.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
}

.library-page-shell {
  position: relative;
}

.library-page-shell::before {
  content: '';
  position: absolute;
  inset: -1rem -1rem auto;
  height: 280px;
  border-radius: 2rem;
  background:
    radial-gradient(600px 220px at 10% 35%, rgba(37, 99, 235, 0.34) 0%, transparent 70%),
    radial-gradient(520px 260px at 85% 10%, rgba(124, 58, 237, 0.28) 0%, transparent 72%),
    radial-gradient(420px 220px at 78% 72%, rgba(250, 204, 21, 0.14) 0%, transparent 70%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.08) 0%, rgba(15, 23, 42, 0.01) 100%);
  pointer-events: none;
  z-index: 0;
}

.library-page-shell > * {
  position: relative;
  z-index: 1;
}

.library-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 0.85rem;
  align-items: start;
}

.library-hero-copy,
.library-hero-metrics {
  border-radius: 1.25rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.84)),
    rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
  color: #f8fafc;
}

.library-hero-copy {
  padding: 0.75rem 0.85rem 0.78rem;
}

.library-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: #fde68a;
}

.library-hero-eyebrow::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.08);
}

.library-hero-title {
  font-size: clamp(1.15rem, 1.45vw, 1.55rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #ffffff;
}

.library-hero-text {
  max-width: 62ch;
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.85rem;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
}

.library-hero-metrics {
  display: grid;
  gap: 0.3rem;
  padding: 0.48rem;
  align-content: start;
}

.library-hero-chip {
  padding: 0.38rem 0.52rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.library-hero-chip-accent {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.22), rgba(124, 58, 237, 0.22));
}

.library-hero-chip-label {
  display: block;
  margin-bottom: 0.03rem;
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(226, 232, 240, 0.72);
}

.library-hero-chip strong {
  font-size: 0.72rem;
  line-height: 1.05;
  font-weight: 800;
  color: #fff;
}

html[data-theme='dark'] .library-hero-copy,
html[data-theme='dark'] .library-hero-metrics {
  color: #f8fafc;
}

html[data-theme='dark'] .library-hero-title {
  color: #ffffff;
}

html[data-theme='dark'] .library-hero-text {
  color: rgba(226, 232, 240, 0.94);
}

html[data-theme='dark'] .library-hero-chip-label {
  color: rgba(226, 232, 240, 0.72);
}

.library-pane {
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
  color: #e2e8f0;
}

.library-pane-header {
  gap: 0.5rem;
}

.library-pane-header:not(.d-flex) {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.library-pane-toggle-btn {
  border: none;
  background: transparent;
  color: var(--mz-text-muted, #94a3b8);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-left: auto;
  transition: transform 0.15s ease;
}

.library-pane-toggle-btn:hover {
  background: rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
}

.library-pane.is-collapsed .library-pane-toggle-btn i {
  transform: rotate(180deg);
}

.library-pane.is-collapsed .library-pane-body {
  display: none;
}

.library-pane-left,
.library-pane-right {
  position: static;
  top: auto;
  height: auto;
  overflow: visible;
}

.library-tree-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 0.7rem;
  align-items: start;
}

.library-tree-panel-main,
.library-tree-panel-side {
  min-width: 0;
}

.library-tree-panel-side {
  display: grid;
  gap: 0.6rem;
}

.library-tree-summary,
.library-tree-shortcuts {
  border-radius: 1rem;
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  padding: 0.75rem;
}

.library-tree-summary-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.library-tree-summary-value {
  display: block;
  font-size: 1rem;
  color: var(--text);
}

.library-tree-summary-note {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
}

.library-tree-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.library-tree-shortcut {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand);
  border: 1px solid rgba(37, 99, 235, 0.12);
  font-size: 0.7rem;
  font-weight: 700;
}

.library-tree {
  display: grid;
  gap: 0.5rem;
}

.library-tree-item {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 0.85rem;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.92) 0%, rgba(15, 23, 42, 0.92) 100%);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #e2e8f0;
  width: 100%;
  box-sizing: border-box;
}

.library-tree-item-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  flex: 1;
}

.library-tree-item-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
  flex: 0 0 auto;
}

.library-tree-chip,
.library-content-chip,
.library-tag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
  color: #bfdbfe;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.library-tag-chip {
  background: rgba(124, 58, 237, 0.14);
  color: #ddd6fe;
  border-color: rgba(124, 58, 237, 0.18);
}

button.library-tag-chip {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  gap: 0.3rem;
}

.library-tag-chip.is-muted {
  background: rgba(100, 116, 139, 0.12);
  color: rgba(226, 232, 240, 0.72);
  border-color: rgba(148, 163, 184, 0.14);
}

.library-tag-chip.is-active {
  background: rgba(96, 165, 250, 0.18);
  color: #dbeafe;
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.18) inset;
}

.library-tag-chip-count {
  font-size: 0.58rem;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.8;
}

.library-tree-item.active {
  border-color: rgba(96, 165, 250, 0.75);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(124, 58, 237, 0.24));
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.library-tree-item:hover,
.library-content-item:hover,
.library-version-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.08);
}

.library-content-item {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  padding: 1rem 1rem 1rem 4.6rem;
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(17, 24, 39, 0.95) 100%),
    rgba(15, 23, 42, 0.92);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  color: #e2e8f0;
}

.library-content-item:hover {
  border-color: rgba(96, 165, 250, 0.5);
}

.library-content-item::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 1rem;
  bottom: 1rem;
  width: 3rem;
  border-radius: 0.9rem;
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.95), rgba(124, 58, 237, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.library-content-cover {
  position: absolute;
  left: 1rem;
  top: 1rem;
  bottom: 1rem;
  width: 3rem;
  border-radius: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 1;
}

.library-content-cover-label {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.library-content-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.library-content-description {
  color: rgba(226, 232, 240, 0.76);
  font-size: 0.92rem;
  line-height: 1.45;
}

.library-content-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  color: rgba(226, 232, 240, 0.7);
  font-size: 0.78rem;
}

.library-content-preview {
  margin-top: 0.75rem;
  font-size: 0.92rem;
  color: rgba(241, 245, 249, 0.9);
  line-height: 1.6;
}

.library-content-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.library-version-item {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 0.85rem;
  padding: 0.75rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(30, 41, 59, 0.88) 100%);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  color: #e2e8f0;
}

.library-pane-center .card,
.library-pane-center .card-body {
  background: transparent;
}

.library-pane-left .h6,
.library-pane-right .h6,
.library-pane-center .h6,
.library-pane-center h3 {
  letter-spacing: -0.02em;
}

.library-pane-left,
.library-pane-right {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.library-pane-center .card {
  border: 1px solid rgba(148, 163, 184, 0.14) !important;
  border-radius: 1.25rem;
  background: rgba(15, 23, 42, 0.76) !important;
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14) !important;
}

.library-pane-center .form-control,
.library-pane-center .form-select,
.library-pane-center .input-group .form-control,
.library-pane-center .input-group .btn,
.library-pane-center .ql-toolbar,
.library-pane-center .ql-container {
  border-radius: 0.85rem;
}

.library-pane-center .form-control,
.library-pane-center .form-select,
.library-pane-center .input-group .form-control,
.library-pane-center .input-group .btn {
  background-color: rgba(15, 23, 42, 0.82);
  border-color: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

.library-pane-center .form-control::placeholder {
  color: rgba(226, 232, 240, 0.5);
}

.library-pane-center .form-control:focus,
.library-pane-center .form-select:focus {
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.2);
}

.library-pane-center .ql-toolbar {
  border-color: rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.9));
}

.library-pane-center .ql-container {
  border-color: rgba(148, 163, 184, 0.16);
  min-height: 400px;
  background: rgba(15, 23, 42, 0.96);
}

.library-pane-center .ql-editor {
  min-height: 400px;
  font-size: 0.98rem;
  line-height: 1.65;
  color: #e2e8f0;
}

.library-pane-center .ql-editor.ql-blank::before {
  color: rgba(226, 232, 240, 0.45);
  font-style: normal;
}

html[data-theme='light'] .library-page-shell::before {
  background:
    radial-gradient(600px 220px at 10% 35%, rgba(37, 99, 235, 0.24) 0%, transparent 70%),
    radial-gradient(520px 260px at 85% 10%, rgba(124, 58, 237, 0.18) 0%, transparent 72%),
    radial-gradient(420px 220px at 78% 72%, rgba(250, 204, 21, 0.12) 0%, transparent 70%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.04) 0%, rgba(15, 23, 42, 0.01) 100%);
}

html[data-theme='light'] .library-hero-copy,
html[data-theme='light'] .library-hero-metrics {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94));
  color: var(--text);
  border-color: rgba(37, 99, 235, 0.12);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

html[data-theme='light'] .library-hero-title,
html[data-theme='light'] .library-hero-text,
html[data-theme='light'] .library-hero-chip strong {
  color: var(--text);
}

html[data-theme='light'] .library-hero-copy {
  text-shadow: none;
}

html[data-theme='light'] .library-hero-eyebrow,
html[data-theme='light'] .library-hero-chip-label {
  color: var(--muted);
}

html[data-theme='light'] .library-hero-chip,
html[data-theme='light'] .library-pane,
html[data-theme='light'] .library-pane-center .card {
  background: rgba(255, 255, 255, 0.88) !important;
  color: var(--text);
}

html[data-theme='light'] .library-pane {
  border-color: rgba(37, 99, 235, 0.12);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

html[data-theme='light'] .library-pane-left,
html[data-theme='light'] .library-pane-right {
  background: rgba(255, 255, 255, 0.9);
}

html[data-theme='light'] .library-tree-summary,
html[data-theme='light'] .library-tree-shortcuts {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(37, 99, 235, 0.12);
}

html[data-theme='dark'] .library-tree-summary,
html[data-theme='dark'] .library-tree-shortcuts {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme='dark'] .library-tree-shortcut {
  background: rgba(255, 255, 255, 0.08);
  color: #bfdbfe;
  border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 1199.98px) {
  .library-tree-panel {
    grid-template-columns: 1fr;
  }

  .library-tree-panel-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1399.98px) {
  .library-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}

html[data-theme='light'] .library-tree-item {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%);
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme='light'] .library-tree-chip,
html[data-theme='light'] .library-content-chip,
html[data-theme='light'] .library-tag-chip {
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand);
  border-color: rgba(37, 99, 235, 0.12);
}

html[data-theme='light'] .library-tag-chip {
  background: rgba(124, 58, 237, 0.08);
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.12);
}

html[data-theme='light'] .library-tag-chip.is-muted {
  background: rgba(100, 116, 139, 0.08);
  color: var(--muted);
  border-color: rgba(100, 116, 139, 0.12);
}

html[data-theme='light'] .library-content-item,
html[data-theme='light'] .library-version-item {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%);
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme='light'] .library-content-description,
html[data-theme='light'] .library-content-meta,
html[data-theme='light'] .library-content-preview {
  color: var(--muted);
}

html[data-theme='light'] .library-content-item::before {
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.95), rgba(124, 58, 237, 0.95));
}

html[data-theme='light'] .library-pane-center .card {
  border-color: rgba(37, 99, 235, 0.12) !important;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08) !important;
}

html[data-theme='light'] .library-pane-center .form-control,
html[data-theme='light'] .library-pane-center .form-select,
html[data-theme='light'] .library-pane-center .input-group .form-control,
html[data-theme='light'] .library-pane-center .input-group .btn {
  background-color: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  color: var(--text);
}

html[data-theme='light'] .library-pane-center .form-control::placeholder {
  color: var(--muted);
}

html[data-theme='light'] .library-pane-center .ql-toolbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme='light'] .library-pane-center .ql-container {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme='light'] .library-pane-center .ql-editor {
  color: var(--text);
}

html[data-theme='light'] .library-pane-center .ql-editor.ql-blank::before {
  color: var(--muted);
}

.library-pane-center .btn-primary,
.library-pane-center .btn-success {
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.library-pane-center .btn-outline-secondary,
.library-pane-center .btn-outline-danger,
.library-pane-center .btn-outline-primary {
  border-width: 1.5px;
}

@media (max-width: 1199px) {
  .library-workspace {
    grid-template-columns: 1fr;
  }

  .library-pane-left,
  .library-pane-right {
    position: static;
    height: auto;
  }
}

/* library-pro fidelity overrides */
.library-pro-shell {
  background: #f5f7fc !important;
}

.library-pro-shell .panel-sidebar {
  width: 260px;
  min-width: 260px;
  background: #ffffff;
  border-right: 1px solid #e6ebf5;
}

.library-pro-shell .sidebar-nav .nav-link {
  color: #4b5563;
  font-weight: 600;
}

.library-pro-shell .sidebar-nav-pro .nav-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: flex-start;
  color: #475569;
  background: transparent;
  border: 1px solid transparent;
}

.library-pro-shell .sidebar-nav-pro .nav-link.active {
  background: #eef2ff;
  color: #3358e6;
}

.library-pro-shell .sidebar-nav-pro .nav-link i {
  font-size: 0.92rem;
}

.library-pro-shell .sidebar-nav-pro .nav-link.active i {
  color: #3358e6;
}

.library-pro-shell .sidebar-nav-pro .icon-home { color: #0ea5e9; }
.library-pro-shell .sidebar-nav-pro .icon-library { color: #4f46e5; }
.library-pro-shell .sidebar-nav-pro .icon-review { color: #f59e0b; }
.library-pro-shell .sidebar-nav-pro .icon-flash { color: #16a34a; }
.library-pro-shell .sidebar-nav-pro .icon-question { color: #dc2626; }
.library-pro-shell .sidebar-nav-pro .icon-mind { color: #7c3aed; }
.library-pro-shell .sidebar-nav-pro .icon-bookmark { color: #2563eb; }
.library-pro-shell .sidebar-nav-pro .icon-note { color: #db2777; }
.library-pro-shell .sidebar-nav-pro .icon-trash { color: #ef4444; }

.library-pro-new-btn {
  border: none;
  border-radius: 0.72rem;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #ffffff;
  font-weight: 700;
  padding: 0.52rem 0.7rem;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.24);
}

.library-pro-new-btn:hover {
  color: #ffffff;
  filter: brightness(1.02);
}

.sidebar-nav-badge {
  margin-left: auto;
  background: #ede9fe;
  color: #6d28d9;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.08rem 0.42rem;
}

.library-pro-shell .sidebar-account-card {
  display: none;
}

.library-pro-shell .library-pro-side-tree h6 {
  color: #94a3b8;
  letter-spacing: 0.08em;
}

.library-pro-shell .library-pro-side-tree .library-tree-item {
  background: transparent;
  border: 1px solid #e2e8f0;
  box-shadow: none;
  border-radius: 0.62rem;
  padding: 0.38rem 0.45rem;
  color: #334155;
}

.library-pro-shell .library-pro-side-tree .library-tree-item:hover,
.library-pro-shell .library-pro-side-tree .library-tree-item.active {
  background: #eef2ff;
  border-color: #c7d2fe;
  transform: none;
}

.library-pro-storage-card {
  margin-top: auto;
  border: 1px solid #e6ebf5;
  background: #ffffff;
  border-radius: 0.65rem;
  padding: 0.65rem;
}

.library-pro-storage-card .progress {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
}

.library-pro-storage-card .progress-bar {
  background: linear-gradient(90deg, #4f46e5, #2563eb);
}

.library-pro-shell .library-pro-side-tree .library-tree-item-icon {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
}

.library-pro-shell .library-pro-side-tree .library-tree-item-icon.subject { background: #dbeafe; color: #1d4ed8; }
.library-pro-shell .library-pro-side-tree .library-tree-item-icon.discipline { background: #ede9fe; color: #6d28d9; }
.library-pro-shell .library-pro-side-tree .library-tree-item-icon.topic { background: #fef3c7; color: #b45309; }
.library-pro-shell .library-pro-side-tree .library-tree-item-icon.subtopic { background: #dcfce7; color: #15803d; }
.library-pro-shell .library-pro-side-tree .library-tree-item-icon.folder { background: #e0f2fe; color: #0369a1; }
.library-pro-shell .library-pro-side-tree .library-tree-item-icon.collection { background: #ffe4e6; color: #be123c; }
.library-pro-shell .library-pro-side-tree .library-tree-item-icon.default { background: #e2e8f0; color: #475569; }

.library-pro-shell .library-pro-side-tree .library-tree-chip {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #dbe3ff;
  letter-spacing: 0.03em;
  text-transform: none;
}

.library-pro-shell .panel-topbar.library-pro-topbar {
  background: #ffffff;
  border-bottom: 1px solid #e6ebf5;
}

.library-pro-shell .library-pro-search-wrap {
  background: #f8fafc;
  border-color: #e5eaf3;
  border-radius: 0.65rem;
  height: 40px;
}

.library-pro-shell .panel-content {
  padding: 0.9rem 1.1rem 1.2rem;
}

.library-pro-shell .library-pro-breadcrumb {
  font-size: 0.78rem;
  color: #94a3b8;
}

.library-pro-shell .library-workspace {
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
}

.library-pro-shell .library-pro-filter-row,
.library-pro-shell .library-pro-list-row {
  display: none;
}

.library-pro-shell .library-pro-editor-row {
  display: block !important;
}

/* List-first behavior in library mode */
.library-pro-shell .library-pro-list-row {
  display: block !important;
}

.library-pro-shell #libraryWorkspace.library-content-focused .library-pro-filter-row,
.library-pro-shell #libraryWorkspace.library-content-focused .library-pro-list-row {
  display: none !important;
}

.library-pro-shell #libraryWorkspace.library-content-focused .library-pro-editor-row {
  display: block !important;
}

.library-pro-shell #libraryWorkspace:not(.library-content-focused) .library-pro-doc {
  display: none !important;
}

.library-pro-shell #libraryWorkspace.library-content-focused .library-pro-doc {
  display: block !important;
}

.library-pro-shell #libraryEditorSection.d-none {
  display: none !important;
}

.library-pro-shell .library-pane,
.library-pro-shell .library-pane-center .card,
.library-pro-shell .library-pane-center .card-body,
.library-pro-shell .library-pro-doc {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e6ebf5 !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05) !important;
}

.library-pro-shell .library-pro-doc-title {
  color: #1e293b;
  font-weight: 800;
}

.library-pro-shell .library-top-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: #1e293b;
  border-color: #e7ecf6;
}

.library-pro-shell .library-top-tags {
  font-size: 0.92rem;
  border-color: #e7ecf6;
}

.library-pro-shell .library-top-title::placeholder,
.library-pro-shell .library-top-tags::placeholder {
  color: #94a3b8;
}

.library-pro-shell .library-pro-chip {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #dbe3ff;
}

.library-pro-shell .library-pro-meta-row {
  color: #64748b;
}

.library-pro-shell .library-content-item,
.library-pro-shell .library-version-item {
  background: #ffffff;
  border: 1px solid #e6ebf5;
  color: #1e293b;
}

.library-pro-shell .library-content-item::before,
.library-pro-shell .library-content-cover {
  opacity: 0.9;
}

.library-pro-shell .library-content-description,
.library-pro-shell .library-content-meta,
.library-pro-shell .library-content-preview {
  color: #64748b;
}

.library-pro-shell .library-pane-center .form-control,
.library-pro-shell .library-pane-center .form-select,
.library-pro-shell .library-pane-center .input-group .form-control,
.library-pro-shell .library-pane-center .input-group .btn {
  background: #ffffff;
  border-color: #dbe3ef;
  color: #1e293b;
}

.library-pro-shell .library-pane-center .ql-toolbar,
.library-pro-shell .library-pane-center .ql-container {
  background: #ffffff;
  border-color: #dbe3ef;
}

.library-pro-shell .library-pane-center .ql-editor {
  color: #1e293b;
}

.library-pro-shell .library-pro-right .library-pane h2 {
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.library-pro-card-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 800;
}

.library-pro-card-title i {
  font-size: 0.85rem;
}

.library-pro-shell .library-pane:nth-child(1) .library-pro-card-title i { color: #4f46e5; }
.library-pro-shell .library-pane:nth-child(2) .library-pro-card-title i { color: #0ea5e9; }
.library-pro-shell .library-pane:nth-child(3) .library-pro-card-title i { color: #8b5cf6; }
.library-pro-shell .library-pane:nth-child(4) .library-pro-card-title i { color: #f59e0b; }

.library-pro-shell .library-pro-editor-row h3.h6 {
  font-size: 1.02rem;
  font-weight: 700;
  color: #223148;
}

.library-pro-shell .library-pro-editor-row .form-control,
.library-pro-shell .library-pro-editor-row .form-select {
  font-size: 0.93rem;
}

.library-pro-shell .library-pro-editor-row .form-control::placeholder {
  color: #94a3b8;
}

.library-pro-stat-item span {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.library-pro-stat-item span i {
  color: #6366f1;
  font-size: 0.78rem;
}

.library-pro-shell .library-pane .small i {
  color: #0ea5e9;
}

.library-pro-shell .library-version-item {
  border-radius: 0.7rem;
  border-color: #e2e8f0;
}

.library-version-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.library-version-icon {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.library-version-content {
  min-width: 0;
  display: grid;
  gap: 0.08rem;
}

.library-version-reason {
  display: inline-flex;
  width: fit-content;
  font-size: 0.66rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.08rem 0.42rem;
  border: 1px solid transparent;
}

.library-version-reason.autosave { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.library-version-reason.update { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.library-version-reason.create { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.library-version-reason.ai-format { background: #fef3c7; color: #92400e; border-color: #fde68a; }

.library-versions-toggle {
  padding: 0.1rem 0;
  color: #4f46e5;
  font-weight: 700;
  text-decoration: none;
}

.library-versions-toggle:hover {
  color: #3730a3;
  text-decoration: underline;
}

.library-editor-footer {
  border-top: 1px solid #e2e8f0;
  padding-top: 0.8rem;
}

.library-editor-footer-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.42rem;
}

.library-editor-footer-title i {
  color: #4f46e5;
}

.library-editor-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.34rem;
}

.library-editor-action-btn i {
  font-size: 0.9rem;
  line-height: 1;
}

#libraryManualSaveBtn i {
  color: #4f46e5;
}

#librarySaveBtn i {
  color: rgba(255, 255, 255, 0.96);
}

#libraryFavoriteBtn i {
  color: #f59e0b;
}

#libraryDeleteBtn i {
  color: #dc2626;
}

.library-editor-footer .input-group .btn.library-editor-action-btn i {
  color: currentColor;
}

.library-highlight-editor-wrap {
  position: relative;
}

.library-highlight-toolbar {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 0.7rem;
  box-shadow: var(--mz-shadow-lg);
  padding: 0.35rem;
}

.library-highlight-tool {
  border: 1px solid var(--mz-border);
  background: var(--mz-bg-subtle);
  color: var(--mz-text-subtle);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.48rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.library-highlight-tool .swatch {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  display: inline-block;
}

.library-highlight-tool .swatch.yellow { background: #fef08a; }
.library-highlight-tool .swatch.green { background: #86efac; }
.library-highlight-tool .swatch.blue { background: #93c5fd; }
.library-highlight-tool .swatch.red { background: #fca5a5; }
.library-highlight-tool .swatch.purple { background: #d8b4fe; }

.library-highlight-tool:hover {
  border-color: rgba(79, 70, 229, 0.55);
  background: #eef2ff;
  color: #312e81;
}

html[data-theme='dark'] .library-highlight-tool:hover {
  background: rgba(79, 70, 229, 0.22);
  color: #c7d2fe;
}

.library-highlight-tool.is-disabled,
.library-highlight-tool:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.library-attachment-preview {
  display: grid;
  gap: 0.75rem;
}

.library-attachment-preview-head {
  gap: 0.75rem;
}

.library-attachment-preview-text {
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.85rem;
  color: #0f172a;
  line-height: 1.75;
  max-height: 340px;
  overflow: auto;
  padding: 1rem;
  white-space: pre-wrap;
}

.library-attachment-pdf-frame {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.85rem;
  width: 100%;
  min-height: 420px;
  background: #fff;
}

/* Toolbar sub-panels */
.lht-main,
.lht-ai {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.lht-divider {
  width: 1px;
  height: 1.1rem;
  background: rgba(148, 163, 184, 0.4);
  flex-shrink: 0;
}

.lht-ai-trigger {
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.3);
  background: #f5f3ff;
}

.lht-ai-trigger:hover {
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.55);
  background: #ede9fe;
}

html[data-theme='dark'] .lht-ai-trigger {
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.16);
}

html[data-theme='dark'] .lht-ai-trigger:hover {
  color: #ddd6fe;
  background: rgba(139, 92, 246, 0.26);
}

.lht-ai-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #7c3aed;
  letter-spacing: 0.04em;
  padding: 0 0.15rem;
  white-space: nowrap;
}

html[data-theme='dark'] .lht-ai-label {
  color: #c4b5fd;
}

.lht-back {
  border-color: var(--mz-border);
  padding: 0.2rem 0.4rem;
}

.lht-ai-btn {
  border-color: rgba(124, 58, 237, 0.28);
  background: #f5f3ff;
  color: #4c1d95;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.lht-ai-btn:hover {
  background: #ede9fe;
  border-color: rgba(124, 58, 237, 0.55);
  color: #4c1d95;
}

html[data-theme='dark'] .lht-ai-btn {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.16);
  color: #ddd6fe;
}

html[data-theme='dark'] .lht-ai-btn:hover {
  background: rgba(139, 92, 246, 0.28);
  border-color: rgba(139, 92, 246, 0.6);
  color: #ede9fe;
}


.library-highlight-controls {
  display: grid;
  gap: 0.45rem;
}

.library-highlight-control-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

#libraryHighlightClearPrefs {
  border-color: #cbd5e1;
  color: #64748b;
}

#libraryHighlightClearPrefs:hover {
  background: #f8fafc;
  color: #475569;
}

.library-highlight-stats {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.library-highlight-stats .stat-chip {
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  font-size: 0.66rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-weight: 700;
}

.library-highlight-export {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.library-highlight-list {
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 0.45rem;
}

.library-highlight-color-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex: 0 0 auto;
}

.library-highlight-color-dot.yellow { background: #facc15; }
.library-highlight-color-dot.green { background: #22c55e; }
.library-highlight-color-dot.blue { background: #3b82f6; }
.library-highlight-color-dot.red { background: #ef4444; }
.library-highlight-color-dot.purple { background: #a855f7; }

/* Linha ativa da tabela .dbv3-table de destaques (ver renderHighlightList em
   public/assets/js/pages/library.js) — mesma semantica visual do antigo
   .library-highlight-item.active, agora aplicada a &lt;tr&gt;. */
#libraryHighlightList tr[data-highlight-id] { cursor: pointer; }
#libraryHighlightList tr[data-highlight-id].active {
  background: var(--mz-bg-subtle);
  box-shadow: inset 2px 0 0 var(--mz-secondary-600, #7c3aed);
}

.library-highlight-detail-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1080;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.library-highlight-detail-modal.is-open {
  display: flex;
}

.library-highlight-detail-modal-card {
  background: var(--mz-surface);
  color: var(--mz-text);
  border-radius: 1rem;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  box-shadow: var(--mz-shadow-xl);
}

.library-highlight-detail-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--mz-border);
  position: sticky;
  top: 0;
  background: var(--mz-surface);
}

.library-highlight-detail-modal-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--mz-text);
}

.library-highlight-detail-modal-body {
  padding: 1rem;
}

.library-ai-generate-modal-card {
  max-width: 560px;
}

.library-ai-gen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.4rem 0.75rem;
}

.library-ai-gen-grid label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--mz-text);
  cursor: pointer;
}

.library-ai-quick-item-primary {
  background: var(--mz-primary, #4f46e5);
  color: #ffffff;
  font-weight: 700;
}

.library-structure-preview {
  max-height: 45vh;
  overflow: auto;
  padding: 0.75rem 1rem;
  border: 1px solid var(--mz-border);
  border-radius: 0.5rem;
  background: var(--mz-surface-muted, var(--mz-bg));
  color: var(--mz-text);
  font-size: 0.85rem;
}

.library-structure-preview h1,
.library-structure-preview h2,
.library-structure-preview h3,
.library-structure-preview h4 {
  color: var(--mz-text);
}

.library-structure-preview mark {
  background: #fff59d;
  color: #1f2937;
}

.library-ai-quick-item-primary .library-ai-quick-icon {
  color: #ffffff;
}

.library-ai-gen-progress-list {
  display: grid;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
}

.library-ai-gen-progress-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.6rem;
  background: var(--mz-bg-subtle);
  border: 1px solid var(--mz-border);
}

.library-ai-gen-progress-item .library-ai-gen-progress-icon {
  width: 1.1rem;
  text-align: center;
}

.library-ai-gen-progress-item[data-status="completed"] .library-ai-gen-progress-icon { color: #16a34a; }
.library-ai-gen-progress-item[data-status="processing"] .library-ai-gen-progress-icon { color: #f59e0b; }
.library-ai-gen-progress-item[data-status="failed"] .library-ai-gen-progress-icon { color: #dc2626; }
.library-ai-gen-progress-item[data-status="pending"] .library-ai-gen-progress-icon,
.library-ai-gen-progress-item[data-status="skipped"] .library-ai-gen-progress-icon { color: var(--mz-text-muted); }

.library-ai-generations-list {
  display: grid;
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}

.library-ai-generation-item {
  border: 1px solid var(--mz-border);
  border-radius: 0.7rem;
  padding: 0.55rem 0.65rem;
  background: var(--mz-bg-subtle);
}

.library-ai-generation-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.library-ai-generation-materials {
  color: var(--mz-text-muted);
  font-size: 0.72rem;
  margin-top: 0.15rem;
}

.library-ai-generation-error {
  color: #dc2626;
  font-size: 0.72rem;
  margin-top: 0.3rem;
  word-break: break-word;
}

.library-ai-generation-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.library-highlight-detail-box {
  border: 1px solid var(--mz-border);
  border-radius: 0.7rem;
  padding: 0.55rem;
  background: var(--mz-bg-subtle);
  color: var(--mz-text);
}

.library-highlight-detail-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.library-highlight-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.library-highlight-pagination .btn[disabled] {
  opacity: 0.45;
}

.library-highlight-pagination #libraryHighlightPerPage {
  width: 84px;
  min-width: 84px;
}

.library-highlight-pagination #libraryHighlightCursorToggle {
  min-width: 96px;
}

.library-highlight-perf-hint {
  min-height: 1.25rem;
  font-size: 0.7rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.library-highlight-perf-hint .hint-badge {
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  padding: 0.05rem 0.4rem;
  background: #f8fafc;
  font-weight: 700;
}

.library-editor-footer .input-group .btn {
  border-color: #c7d2fe;
  color: #4338ca;
}

.library-editor-footer .input-group .btn:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
  color: #3730a3;
}

.library-pro-shell .library-pro-doc .btn-outline-secondary {
  border-color: #cbd5e1;
  color: #64748b;
}

#libraryNewContentBtn {
  border-radius: 0.62rem;
  border-color: #c7d2fe;
  color: #4338ca;
  background: #eef2ff;
  font-weight: 700;
}

#libraryNewContentBtnSecondary {
  border-radius: 0.62rem;
  border-color: #c7d2fe;
  color: #4338ca;
  background: #eef2ff;
  font-weight: 700;
  padding-inline: 0.9rem;
}

#libraryNewContentBtn:hover {
  border-color: #a5b4fc;
  background: #e0e7ff;
  color: #3730a3;
}

#libraryNewContentBtnSecondary:hover {
  border-color: #a5b4fc;
  background: #e0e7ff;
  color: #3730a3;
}

#libraryManualSaveBtn {
  border-radius: 0.62rem;
  border-color: #c7d2fe;
  color: #4338ca;
  background: #eef2ff;
  font-weight: 700;
  padding-inline: 0.9rem;
}

#libraryManualSaveBtn:hover,
#libraryManualSaveBtn:focus,
#libraryManualSaveBtn:active {
  border-color: #a5b4fc;
  background: #e0e7ff;
  color: #3730a3;
}

.library-pro-shell .library-pro-doc .btn-outline-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #334155;
}

.panel-shell:not(.library-pro-shell) {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.panel-sidebar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: nowrap;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
  padding: 0.7rem 0.95rem;
  position: sticky;
  top: 0;
  z-index: 20;
  overflow-x: auto;
}

html[data-theme='dark'] .panel-sidebar {
  background: rgba(22, 34, 53, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .sidebar-user-card {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme='dark'] .sidebar-user-meta strong,
html[data-theme='dark'] .sidebar-user-meta span {
  color: #e2e8f0;
}

.panel-sidebar .sidebar-brand {
  margin-bottom: 0 !important;
  flex: 0 0 auto;
}

.panel-sidebar .sidebar-brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.4rem;
  white-space: nowrap;
}

.sidebar-nav .nav-link {
  color: var(--text);
  border-radius: 0.7rem;
  padding: 0.6rem 0.75rem;
}

.sidebar-nav {
  flex-direction: row !important;
  flex-wrap: nowrap;
  gap: 0.3rem !important;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-nav .nav-link {
  padding: 0.5rem 0.65rem;
  white-space: nowrap;
  font-size: 0.94rem;
}

.sidebar-nav .nav-link:hover {
  background: var(--brand-soft);
}

.sidebar-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
  color: #fff;
  background: linear-gradient(140deg, var(--brand) 0%, var(--brand-2) 100%);
}

.sidebar-logo {
  width: 48px;
  max-width: 100%;
  height: auto;
  display: block;
}

.sidebar-brand-wrap {
  padding: 0.32rem 0.42rem;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.08) 0%, rgba(124, 58, 237, 0.06) 100%);
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.sidebar-brand-sub {
  display: none;
}

.sidebar-account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  margin-left: 0.25rem;
  border-radius: 0.95rem;
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: rgba(37, 99, 235, 0.06);
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.sidebar-user-card-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.sidebar-user-avatar {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
  flex: 0 0 auto;
}

.sidebar-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-meta strong {
  font-size: 0.88rem;
  line-height: 1.1;
}

.sidebar-user-meta span {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.sidebar-user-badges .badge {
  padding: 0.32rem 0.48rem;
  font-size: 0.67rem;
}

.sidebar-account-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex: 0 0 auto;
}

.sidebar-logout-form {
  margin: 0;
}

.sidebar-account-actions .btn {
  white-space: nowrap;
}

@media (max-width: 992px) {
  .sidebar-account-card {
    align-items: flex-start;
  }

  .sidebar-account-actions {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }

  .sidebar-account-actions .btn,
  .sidebar-logout-form {
    width: 100%;
  }
}

.panel-topbar-title {
  min-width: 0;
  flex: 1 1 auto;
}

.panel-topbar-user-inline {
  margin-left: 0.45rem;
  padding: 0.32rem 0.5rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.12);
  flex-wrap: nowrap;
}

.panel-topbar-user-inline .panel-topbar-user-info strong {
  font-size: 0.88rem;
}

.panel-topbar-user-inline .panel-topbar-user-info span {
  font-size: 0.72rem;
  max-width: 16rem;
}

.panel-topbar-user-inline .panel-topbar-badges {
  flex-wrap: nowrap;
}

.panel-topbar-user-inline .panel-topbar-badges .badge {
  padding: 0.3rem 0.5rem;
  font-size: 0.67rem;
}

.panel-main {
  padding: 1rem 1.2rem 1.2rem;
  min-width: 0;
}

.panel-topbar {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 0.9rem;
  padding: 0.42rem 0.68rem;
  margin-bottom: 0.7rem;
  gap: 0.45rem;
}

.panel-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.panel-topbar-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
  flex: 0 0 auto;
}

.panel-topbar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-topbar-user-info strong {
  font-size: 0.95rem;
  line-height: 1.1;
}

.panel-topbar-user-info span {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}

.panel-topbar-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.panel-topbar-badges .badge {
  letter-spacing: 0.03em;
  padding: 0.45rem 0.7rem;
}

.memorizza-tag {
  background: #fef9c3;
  color: #92400e;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  flex: 0 0 auto;
}

.panel-topbar-title {
  min-width: 0;
  flex: 1 1 auto;
}

.panel-topbar-title .d-flex {
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap !important;
}

.panel-topbar-title h1,
.panel-topbar-title h1.h5 {
  font-size: 1.12rem !important;
  line-height: 1.1 !important;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme='dark'] .panel-topbar {
  background: rgba(15, 23, 42, 0.96) !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
  color: #f8fafc !important;
}

html[data-theme='dark'] .panel-topbar,
html[data-theme='dark'] .panel-topbar-title,
html[data-theme='dark'] .panel-topbar-title h1 {
  color: #f8fafc !important;
}

html[data-theme='dark'] .memorizza-tag {
  background: rgba(250, 204, 21, 0.16);
  color: #fde68a;
}

html[data-theme='dark'] .panel-topbar .btn-outline-secondary {
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.35);
}

html[data-theme='dark'] .panel-topbar .btn-outline-secondary:hover {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(96, 165, 250, 0.5);
}

html[data-theme='dark'] .panel-topbar-user-info strong,
html[data-theme='dark'] .panel-topbar-user-info span {
  color: #e2e8f0;
}

.panel-content {
  animation: fadeUp 350ms ease;
}

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

/* Library Pro layout (reference-like) */
.library-pro-shell {
  display: grid;
  background: #ffffff;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-rows: 1fr;
  min-height: 100vh;
}

.library-pro-shell,
.library-pro-shell .panel-main,
.library-pro-shell .panel-content,
.library-pro-shell .library-page-shell {
  background: #ffffff !important;
}

.library-pro-shell .panel-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  padding: 1rem 0.85rem;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  border-bottom: none;
  background: #ffffff;
}

.sidebar-brand-head {
  position: relative;
  width: 100%;
}

.sidebar-collapse-btn {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border: 1px solid #dbe5f7;
  border-radius: 8px;
  background: #f8fbff;
  color: #5870de;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sidebar-collapse-btn:hover {
  background: #eef3ff;
  border-color: #c9d8fb;
}

@media (min-width: 1200px) {
  .library-pro-shell.sidebar-collapsed {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .library-pro-shell.sidebar-collapsed .panel-sidebar {
    width: 88px;
    min-width: 88px;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    align-items: center;
  }

  .library-pro-shell.sidebar-collapsed .sidebar-brand-wrap {
    justify-content: center;
    width: 100%;
    gap: 0;
    padding: 0.28rem 0.2rem;
  }

  .library-pro-shell.sidebar-collapsed .sidebar-brand-sub,
  .library-pro-shell.sidebar-collapsed .sidebar-brand-text,
  .library-pro-shell.sidebar-collapsed .sidebar-group-title,
  .library-pro-shell.sidebar-collapsed .sidebar-plan-card {
    display: none !important;
  }

  .library-pro-shell.sidebar-collapsed .sidebar-collapse-btn {
    position: absolute;
    right: -12px;
    top: 8px;
    z-index: 3;
    border-radius: 999px;
    width: 28px;
    height: 28px;
    background: #f2f5ff;
    box-shadow: 0 6px 16px rgba(79, 108, 247, 0.18);
  }

  .library-pro-shell.sidebar-collapsed .sidebar-nav {
    width: 100%;
    align-items: center;
    gap: 0.45rem !important;
  }

  .library-pro-shell.sidebar-collapsed .sidebar-nav .nav-link {
    width: 44px;
    min-width: 44px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0;
    border-radius: 10px;
  }

  .library-pro-shell.sidebar-collapsed .sidebar-nav .nav-link i {
    margin: 0;
    font-size: 1rem;
  }
}

.library-pro-shell .panel-main {
  padding: 0;
  background: transparent;
}

.library-pro-shell .panel-content {
  padding: 0 1rem 1rem;
}

.library-pro-shell .panel-topbar.library-pro-topbar {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 0.9rem;
  padding: 0.54rem 0.9rem;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.library-pro-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.7rem;
  padding: 0.32rem 0.58rem;
  width: min(100%, 560px);
}

.library-pro-search-wrap > i {
  color: #64748b;
}

.library-pro-search-input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 0.88rem;
  color: #1e293b;
}

.library-pro-shortcut {
  font-size: 0.72rem;
  color: #94a3b8;
}

.library-pro-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.library-pro-icon-btn {
  color: #64748b;
  padding: 0.2rem 0.35rem;
}

.library-pro-icon-btn:hover {
  color: #1e293b;
}

.library-pro-user-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-left: 0.35rem;
}

.library-pro-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #4f46e5, #2563eb);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.library-pro-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.library-pro-user-meta strong {
  font-size: 0.83rem;
  color: #1e293b;
}

.library-pro-user-meta small {
  font-size: 0.72rem;
  color: #64748b;
}

.library-pro-shell .sidebar-brand {
  margin-bottom: 0.7rem !important;
  display: flex;
  justify-content: flex-start;
}

.library-pro-shell .sidebar-brand-wrap {
  width: auto;
  height: auto;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.library-pro-shell .sidebar-logo {
  width: 146px;
  max-width: 100%;
  max-height: 46px;
  object-fit: contain;
}

.library-pro-shell .sidebar-brand-sub {
  display: none;
}

.library-pro-shell .sidebar-nav {
  flex-direction: column !important;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.2rem !important;
}

.library-pro-shell .sidebar-nav .nav-link {
  font-size: 0.89rem;
  padding: 0.43rem 0.58rem;
  border-radius: 0.55rem;
}

.library-pro-shell .library-pro-side-tree {
  margin-top: 0.35rem;
}

.library-pro-shell .library-pro-side-tree .library-tree {
  max-height: 320px;
  overflow: auto;
  overflow-x: hidden;
  padding-right: 0.2rem;
}

.library-pro-shell .library-pro-side-tree .library-tree-item {
  white-space: normal;
  word-break: break-word;
}

.library-pro-shell .sidebar-account-card {
  margin-top: auto;
  width: 100%;
  margin-left: 0;
}

.library-pro-shell .library-hero {
  display: none;
}

.library-pro-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  color: #7b8ba1;
  flex-wrap: wrap;
}

.library-pro-breadcrumb-current {
  color: #1e293b;
  font-weight: 700;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-pro-breadcrumb-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.library-pro-applied-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-left: 0.2rem;
}

.library-pro-applied-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 700;
}

.library-pro-applied-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  border-radius: 999px;
  padding: 0.12rem 0.46rem;
  font-size: 0.66rem;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}

.library-pro-applied-chip strong {
  font-weight: 800;
}

.library-pro-applied-chip.is-muted {
  color: #64748b;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.library-pro-breadcrumb i {
  font-size: 0.65rem;
}

.library-pro-shell .library-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 286px;
  gap: 0.85rem;
}

.library-pro-main,
.library-pro-right {
  min-width: 0;
}

.library-pro-doc-title {
  font-size: clamp(1.28rem, 1.58vw, 1.78rem);
  letter-spacing: -0.03em;
  color: #0f172a;
}

.library-pro-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.library-pro-chip {
  border-radius: 999px;
  font-size: 0.7rem;
  padding: 0.2rem 0.52rem;
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid rgba(79, 70, 229, 0.2);
  font-weight: 700;
}

.library-pro-chip-action {
  border: 1px dashed rgba(79, 70, 229, 0.28);
  background: #f8faff;
  cursor: pointer;
}

.library-pro-chip-action:hover {
  background: #eef2ff;
  color: #312e81;
}

.library-pro-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: #64748b;
  font-size: 0.73rem;
}

.library-pro-meta-row i {
  margin-right: 0.22rem;
}

.library-pro-stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.42rem 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.22);
  font-size: 0.83rem;
}

.library-pro-stat-item:last-child {
  border-bottom: none;
}

.library-pro-stat-item strong {
  color: #2563eb;
}

.library-outline-list {
  display: grid;
  gap: 0.15rem;
  max-height: 900px;
  overflow-y: auto;
}

.library-outline-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #334155;
  padding: 0.32rem 0.4rem;
  border-radius: 0.5rem;
  font-size: 0.82rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-outline-item:hover {
  background: #eef2ff;
  color: #312e81;
}

.library-outline-item[data-outline-level="1"] {
  font-weight: 700;
}

.library-outline-item[data-outline-level="2"] {
  padding-left: 1rem;
}

.library-outline-item[data-outline-level="3"] {
  padding-left: 1.7rem;
  color: #64748b;
  font-weight: 400;
}

.library-ai-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.library-ai-quick-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #334155;
  padding: 0.42rem 0.4rem;
  border-radius: 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.library-ai-quick-item:hover {
  background: #f5f3ff;
  color: #4c1d95;
}

.library-ai-quick-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 0.5rem;
  background: #f5f3ff;
  color: #7c3aed;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.library-ai-quick-item:hover .library-ai-quick-icon {
  background: #ede9fe;
}

.library-pane-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.35rem;
  border-radius: 0.4rem;
}

.library-pane-edit-btn:hover {
  color: #312e81;
  background: #eef2ff;
}

@media (max-width: 1199px) {
  .library-pro-shell {
    grid-template-columns: 1fr;
  }

  .library-pro-shell .panel-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  }

  .library-pro-shell .library-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991.98px) {
  .panel-sidebar {
    gap: 0.6rem;
    padding: 0.65rem 0.8rem;
  }

  .panel-sidebar .sidebar-brand-sub {
    display: none;
  }

  .sidebar-nav {
    gap: 0.2rem !important;
  }

  .sidebar-nav .nav-link {
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
  }

  .panel-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .panel-sidebar {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }

  .panel-topbar {
    align-items: flex-start !important;
    flex-wrap: wrap;
  }

  .panel-topbar-user {
    width: 100%;
    margin-right: 0 !important;
    flex-wrap: wrap;
  }

  .panel-topbar-user-inline {
    margin-left: 0;
    width: 100%;
    border-radius: 0.9rem;
  }

  .panel-topbar-user-info span {
    max-width: 100%;
  }

  .panel-topbar-badges {
    width: 100%;
    flex-wrap: wrap;
  }

  .panel-topbar > #themeToggle {
    justify-self: start;
  }

  .panel-sidebar .btn {
    flex: 0 0 auto;
  }
}

/* Biblioteca fidelity pass */
.library-pro-shell .panel-sidebar {
  width: 260px;
  min-width: 260px;
  padding: 0.7rem 0.65rem 0.6rem;
  background: #ffffff;
  border-right: 1px solid #e8edf6;
}

.library-pro-shell .sidebar-brand {
  margin-bottom: 0.5rem !important;
}

.library-pro-shell .sidebar-brand-wrap {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  border: 2px solid #4f46e5;
  background: #ffffff;
  padding: 0.25rem;
}

.library-pro-shell .sidebar-logo.sidebar-logo-pro {
  width: 34px;
  height: 34px;
  max-width: 34px;
  max-height: 34px;
  object-fit: contain;
}

.library-pro-shell .sidebar-nav .nav-link {
  border-radius: 0.62rem;
  padding: 0.48rem 0.62rem;
  font-size: 0.89rem;
}

.library-pro-shell .sidebar-nav-pro .nav-link {
  font-size: 0.88rem;
}

.library-pro-shell .sidebar-nav-pro .nav-link i {
  width: 1rem;
  text-align: center;
}

.library-pro-shell .panel-content {
  padding: 0.7rem 0.85rem 0.95rem;
}

.library-pro-shell .library-workspace {
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: 0.7rem;
}

.library-pro-shell .library-pro-doc,
.library-pro-shell .library-pane,
.library-pro-shell .library-pane-center .card {
  border-radius: 0.88rem;
  border-color: #e5ebf5 !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.07) !important;
}

.library-pro-shell .library-pro-doc .card-body,
.library-pro-shell .library-pane .card-body {
  padding: 0.88rem;
}

.library-pro-shell .library-pro-side-tree .library-tree-item {
  border-radius: 0.78rem;
  padding: 0.42rem 0.5rem;
}

.library-pro-shell .library-pro-side-tree .library-tree-item .fw-semibold {
  font-size: 0.96rem;
}

.library-pro-shell .library-pro-side-tree .library-tree-item small {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.library-pro-shell .library-pro-editor-row .form-control,
.library-pro-shell .library-pro-editor-row .form-select {
  min-height: 2.15rem;
  border-radius: 0.66rem;
}

.library-pro-shell .ql-toolbar {
  border-top-left-radius: 0.72rem;
  border-top-right-radius: 0.72rem;
}

.library-pro-shell .ql-container {
  border-bottom-left-radius: 0.72rem;
  border-bottom-right-radius: 0.72rem;
}

.library-pro-shell .library-pro-right .library-pane {
  padding: 0.15rem;
}

.library-pro-shell .library-pro-right .library-pane .small {
  line-height: 1.35;
}

.library-pro-shell .library-pro-doc-title {
  font-size: clamp(1.18rem, 1.4vw, 1.58rem);
  letter-spacing: -0.02em;
}

.library-pro-shell .library-pro-chip {
  font-size: 0.68rem;
  padding: 0.18rem 0.48rem;
}

.library-pro-shell .library-pro-meta-row {
  font-size: 0.71rem;
  gap: 0.45rem;
}

/* Editor Inteligente: altura FIXA de 800px (nao cresce com o conteudo, nao
   depende mais da viewport) — usa a rolagem propria do editor (.ql-editor
   com overflow-y:auto) pra conteudos maiores do que isso. Antes a altura era
   calc(100vh - 240px) aplicada em .library-pro-main, com uma cadeia inteira
   de flex+min-height:0 propagando essa restricao pra baixo ate o .ql-editor;
   trocado por um valor fixo direto no proprio .ql-editor porque e mais
   previsivel e nao depende mais do cabecalho do documento (.library-pro-doc)
   ser irmao de #libraryEditorSection — ele agora fica DENTRO do mesmo card
   (ver initializeLibraryWorkspaceTabs em library.js), entao nao ha mais uma
   altura "resto da tela" simples pra calcular.

   IMPORTANTE sobre o DOM real do Quill: como o toolbar e passado como array
   (nao como seletor de container), o Quill transforma o proprio #quillEditor
   na .ql-container (adiciona as classes NELE, nao cria uma .ql-container
   filha) e insere a .ql-toolbar gerada como IRMA anterior de #quillEditor
   dentro de #libraryHighlightEditorWrap. Por isso os seletores certos sao
   ">.ql-toolbar" (filho direto do wrap) e ".library-quill-editor" direto
   (que E a .ql-container) — nunca ".library-quill-editor .ql-toolbar" ou
   ".library-quill-editor .ql-container" como descendentes, que nunca
   combinam com nada no DOM real. */

.library-pro-shell #libraryWorkspace.library-content-focused #libraryEditorSection {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  /* !important necessario: ".library-pro-shell #libraryWorkspace.library-content-focused
     .library-pro-editor-row { display: block !important }" (linha ~2244) tambem bate
     nesse mesmo elemento (#libraryEditorSection tem a classe library-pro-editor-row) e,
     sendo !important, vencia um "display: flex" normal aqui independente de especificidade
     — foi exatamente isso que quebrava a cadeia flex inteira (tudo virava bloco normal,
     sem containment nenhum, e o editor crescia pro tamanho literal do conteudo). */
  display: flex !important;
  flex-direction: column;
}

.library-pro-shell #libraryWorkspace.library-content-focused #libraryEditorSection > .card {
  flex: 1 1 auto;
  min-height: 0;
}

.library-pro-shell #libraryWorkspace.library-content-focused #libraryEditorSection > .card > .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* #libraryHighlightEditorWrap NAO e filho direto de .card-body — o JS
   (initializeLibraryWorkspaceTabs, library.js) move tudo que estava depois
   da barra de autosave pra dentro de um sistema de abas (Editor/Materiais
   IA/Destaques/Flashcards/Questoes/Estatisticas/Historico) criado em
   runtime: .card-body > #libraryWorkspaceTabsRoot > .library-workspace-panels
   > [data-workspace-panel="editor"] > #libraryHighlightEditorWrap. Esses 3
   niveis intermediarios tambem precisam entrar na cadeia flex (flex:1 1 auto
   + min-height:0), senao a cadeia quebra bem antes de chegar no editor. */
.library-pro-shell #libraryWorkspace.library-content-focused #libraryWorkspaceTabsRoot {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.library-pro-shell #libraryWorkspace.library-content-focused #libraryWorkspaceTabsRoot > .dbv3-tabs {
  flex: 0 0 auto;
}

.library-pro-shell #libraryWorkspace.library-content-focused #libraryWorkspaceTabsRoot > .library-workspace-panels {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* Todas as abas do workspace (Editor/Materiais IA/Destaques/Flashcards/
   Questoes/Estatisticas/Historico) sao paineis irmaos dentro do mesmo
   .library-workspace-panels — cada uma precisa da mesma contencao flex,
   senao conteudo extenso em QUALQUER aba (nao so o Editor) quebra a caixa.
   A aba "editor" e a unica com overflow-y:visible aqui porque ela ja rola
   mais fundo, dentro do proprio .ql-editor (toolbar fixo + texto rola) —
   as demais rolam o painel inteiro (overflow-y:auto), pois nao tem essa
   subdivisao interna de toolbar-fixo/corpo-rolavel. */
.library-pro-shell #libraryWorkspace.library-content-focused #libraryWorkspaceTabsRoot > .library-workspace-panels > [data-workspace-panel] {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.library-pro-shell #libraryWorkspace.library-content-focused #libraryWorkspaceTabsRoot > .library-workspace-panels > [data-workspace-panel='editor'] {
  overflow-y: visible;
}

.library-pro-shell #libraryWorkspace.library-content-focused #libraryHighlightEditorWrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.library-pro-shell #libraryWorkspace.library-content-focused #libraryHighlightEditorWrap > .ql-toolbar {
  flex: 0 0 auto;
}

.library-pro-shell #libraryWorkspace.library-content-focused .library-quill-editor {
  display: flex;
  flex-direction: column;
}

.library-pro-shell #libraryWorkspace.library-content-focused .library-quill-editor .ql-editor {
  height: 800px;
  overflow-y: auto;
}

/* .library-pro-doc (titulo/tags/meta/botoes Voltar-Historico-Salvar) e movido via JS
   (initializeLibraryWorkspaceTabs, library.js) pra dentro do card do Editor Inteligente,
   acima das abas — deixa de ser um card proprio (fora do card-body) e vira so o cabecalho
   do MESMO card, entao a borda/sombra/padding de card que ele tem por padrao (regra
   ".library-pro-shell .library-pro-doc" mais acima) precisa ser removida aqui pra nao
   parecer um card dentro do outro; uma borda inferior simples substitui a sombra pra
   separar visualmente o cabecalho das abas logo abaixo. */
.library-pro-shell #libraryWorkspace.library-content-focused #libraryEditorSection .library-pro-doc {
  box-shadow: none !important;
  border-bottom: 1px solid var(--mz-border);
  border-radius: 0;
  margin-bottom: 0.85rem !important;
}

.library-pro-shell #libraryWorkspace.library-content-focused #libraryEditorSection .library-pro-doc .card-body {
  padding: 0 0 0.85rem;
}

.library-pro-shell .panel-topbar.library-pro-topbar {
  padding: 0.48rem 0.82rem;
  gap: 0.65rem;
}

.library-pro-shell .library-pro-search-wrap {
  height: 36px;
  border-radius: 0.62rem;
}

.library-pro-shell .library-pro-search-input {
  font-size: 0.85rem;
}

.library-pro-shell .sidebar-nav-pro .nav-link {
  font-size: 0.86rem;
  padding: 0.45rem 0.56rem;
}

.library-pro-shell .library-pro-stat-item {
  font-size: 0.81rem;
  padding: 0.37rem 0;
}

.library-pro-shell #libraryVersions .library-version-item {
  border-radius: 0.74rem;
}

/* Biblioteca print parity v2 */
.library-pro-shell .sidebar-brand-wrap {
  gap: 0.55rem;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0.05rem 0.2rem;
  width: 100%;
  white-space: nowrap;
}

.library-pro-shell .sidebar-logo.sidebar-logo-pro {
  width: 38px;
  height: 38px;
  max-width: 38px;
  max-height: 38px;
  border: 2px solid #4f46e5;
  border-radius: 0.8rem;
  padding: 0.18rem;
  background: #ffffff;
}

.sidebar-brand-text {
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 800;
  color: #4f46e5;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.library-pro-new-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.library-tree-action-btn {
  color: #64748b;
}

.library-tree-action-btn:hover {
  color: #4f46e5;
}

.library-tree-action-btn.is-disabled,
.library-tree-action-btn:disabled {
  color: #cbd5e1;
  pointer-events: none;
}

.library-node-editor-modal {
  border-radius: 1.1rem !important;
  padding: 1.15rem 1.15rem 1rem !important;
  border: 1px solid var(--mz-border) !important;
  background: var(--mz-surface) !important;
  box-shadow: var(--mz-shadow-xl) !important;
}

.library-node-editor-title {
  text-align: left !important;
  font-size: 1.1rem !important;
  font-weight: 800 !important;
  color: var(--mz-text) !important;
  padding: 0 0 0.35rem !important;
}

.library-node-editor-html {
  margin: 0 !important;
  padding: 0 !important;
}

.library-node-editor-shell {
  display: grid;
  gap: 0.9rem;
}

.library-node-editor-hero {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: 0.95rem;
  background: var(--mz-bg-subtle);
  border: 1px solid var(--mz-border);
}

.library-node-editor-icon {
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.8rem;
  background: #4f46e5;
  color: #ffffff;
  flex: 0 0 auto;
}

.library-node-editor-subtitle {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--mz-text-subtle);
}

.library-node-editor-note {
  font-size: 0.8rem;
  color: var(--mz-text-muted);
  margin-top: 0.12rem;
}

.library-node-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 0.9rem;
}

.library-node-editor-field {
  display: grid;
  gap: 0.35rem;
}

.library-node-editor-field-wide {
  grid-column: 1 / -1;
}

.library-node-editor-field .form-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mz-text-muted);
}

.library-node-editor-input.swal2-input,
.library-node-editor-input.swal2-select {
  width: 100% !important;
  height: 2.75rem !important;
  margin: 0 !important;
  border-radius: 0.85rem !important;
  border: 1px solid var(--mz-border) !important;
  background: var(--mz-surface) !important;
  color: var(--mz-text) !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03) !important;
  padding: 0.75rem 0.9rem !important;
  font-size: 0.92rem !important;
}

.library-node-editor-input.swal2-input:focus,
.library-node-editor-input.swal2-select:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12) !important;
}

.library-node-editor-help {
  font-size: 0.76rem;
  color: var(--mz-text-muted);
}

.library-node-editor-actions {
  margin: 1rem 0 0 !important;
  padding: 0 !important;
  justify-content: flex-end !important;
  gap: 0.55rem !important;
}

.library-node-editor-actions .btn {
  min-width: 108px;
  border-radius: 0.8rem;
  font-weight: 700;
  padding: 0.65rem 1rem;
}

.library-flashcard-editor-modal {
  border-radius: 1.35rem !important;
  padding: 1rem 1rem 0.25rem !important;
  border: 1px solid var(--mz-border) !important;
  background: var(--mz-surface) !important;
  box-shadow: var(--mz-shadow-xl) !important;
}

.library-flashcard-editor {
  padding-top: 0.25rem;
}

.library-flashcard-editor-head {
  margin-bottom: 0.9rem;
}

.library-flashcard-editor-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html[data-theme='dark'] .library-flashcard-editor-kicker {
  background: rgba(37, 99, 235, 0.18);
  color: #93c5fd;
}

.library-flashcard-editor-copy {
  margin: 0.65rem 0 0;
  color: var(--mz-text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.library-flashcard-editor-status {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border-radius: 0.95rem;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.95rem;
  font-size: 0.86rem;
  line-height: 1.45;
}

.library-flashcard-editor-status i {
  font-size: 0.95rem;
  margin-top: 0.1rem;
}

.library-flashcard-editor-status-detail {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.74rem;
  opacity: 0.9;
}

.library-flashcard-editor-status.is-ai {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

html[data-theme='dark'] .library-flashcard-editor-status.is-ai {
  background: rgba(37, 99, 235, 0.16);
  color: #93c5fd;
  border-color: rgba(37, 99, 235, 0.4);
}

.library-flashcard-editor-status.is-fallback {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}

html[data-theme='dark'] .library-flashcard-editor-status.is-fallback {
  background: rgba(249, 115, 22, 0.16);
  color: #fdba74;
  border-color: rgba(249, 115, 22, 0.4);
}

.library-flashcard-editor-status.is-unavailable {
  background: var(--mz-bg-subtle);
  color: var(--mz-text-subtle);
  border: 1px solid var(--mz-border);
}

.library-flashcard-suggestion-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.95rem;
}

.library-flashcard-suggestion-wrap {
  margin-bottom: 0.95rem;
}

.library-flashcard-suggestion-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.55rem;
}

.library-flashcard-suggestion-head strong {
  font-size: 0.88rem;
  color: var(--mz-text);
}

.library-flashcard-suggestion-head small {
  font-size: 0.74rem;
  color: var(--mz-text-muted);
}

.library-flashcard-suggestion-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  width: 100%;
  border: 1px solid var(--mz-border);
  border-radius: 0.95rem;
  background: var(--mz-surface);
  color: var(--mz-text);
  padding: 0.8rem 0.9rem;
  text-align: left;
  transition: all 150ms ease;
}

.library-flashcard-suggestion-check {
  width: 1rem;
  height: 1rem;
  margin-bottom: 0.25rem;
  accent-color: #2563eb;
}

.library-flashcard-suggestion-btn strong {
  font-size: 0.88rem;
  line-height: 1.35;
}

.library-flashcard-suggestion-btn:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

html[data-theme='dark'] .library-flashcard-suggestion-btn:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.12);
}

.library-flashcard-suggestion-btn.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

html[data-theme='dark'] .library-flashcard-suggestion-btn.is-active {
  background: rgba(59, 130, 246, 0.16);
}

.library-flashcard-suggestion-btn.is-selected:not(.is-active) {
  border-color: #93c5fd;
  background: #f0f7ff;
}

html[data-theme='dark'] .library-flashcard-suggestion-btn.is-selected:not(.is-active) {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.1);
}

.library-question-suggestion-list {
  grid-template-columns: 1fr;
}

.library-question-suggestion-options {
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
  width: 100%;
}

.library-question-suggestion-options li {
  font-size: 0.8rem;
  color: var(--mz-text-subtle);
  padding: 0.3rem 0.5rem;
  border-radius: 0.5rem;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
}

.library-question-suggestion-options li.is-correct {
  color: #15803d;
  background: #f0fdf4;
  border-color: #bbf7d0;
  font-weight: 700;
}

html[data-theme='dark'] .library-question-suggestion-options li.is-correct {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
}

.library-question-suggestion-options li.is-correct i {
  margin-left: 0.2rem;
}

.library-question-suggestion-type {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6d28d9;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
}

html[data-theme='dark'] .library-question-suggestion-type {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.16);
  border-color: rgba(139, 92, 246, 0.4);
}

.library-question-suggestion-answer {
  font-size: 0.8rem;
  color: #15803d;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0.5rem;
  padding: 0.3rem 0.5rem;
  font-weight: 600;
}

html[data-theme='dark'] .library-question-suggestion-answer {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
}

.library-flashcard-suggestion-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

html[data-theme='dark'] .library-flashcard-suggestion-badge {
  background: rgba(37, 99, 235, 0.18);
  color: #93c5fd;
}

.library-flashcard-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.library-flashcard-editor-field {
  min-width: 0;
}

.library-flashcard-editor-field.is-wide {
  grid-column: 1 / -1;
}

.library-node-editor-input.library-flashcard-editor-textarea.swal2-textarea {
  width: 100% !important;
  min-height: 8rem !important;
  height: 8rem !important;
  margin: 0 !important;
  border-radius: 0.95rem !important;
  border: 1px solid var(--mz-border) !important;
  background: var(--mz-surface) !important;
  color: var(--mz-text) !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03) !important;
  padding: 0.9rem 1rem !important;
  font-size: 0.96rem !important;
  line-height: 1.5 !important;
  resize: vertical !important;
}

.library-node-editor-input.library-flashcard-editor-textarea.swal2-textarea.is-answer {
  min-height: 9.5rem !important;
  height: 9.5rem !important;
}

.library-node-editor-input.library-flashcard-editor-textarea.swal2-textarea:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12) !important;
}

@media (max-width: 768px) {
  .library-flashcard-editor-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.library-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.library-pro-doc-title-wrap {
  min-width: 0;
}

.library-pro-doc-title-edit-btn {
  border: none;
  background: transparent;
  color: var(--mz-text-muted);
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.library-pro-doc-title-edit-btn:hover {
  background: var(--mz-bg-subtle);
  color: var(--mz-secondary-600);
}

.library-pro-doc-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.library-header-actions-dropdown .dropdown-menu {
  min-width: 13rem;
  border-radius: 0.7rem;
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  padding: 0.4rem;
}

.library-header-actions-dropdown .dropdown-item {
  border-radius: 0.5rem;
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  display: flex;
  align-items: center;
}

.library-pro-meta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  background: transparent;
  color: #64748b;
  padding: 0;
}

.library-pro-meta-button.is-active {
  color: #d97706;
}

.library-pro-meta-button:hover {
  color: #4f46e5;
}

.library-header-favorite-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #dbe3ff;
  border-radius: 0.85rem;
  background: #ffffff;
  color: #334155;
  font-size: 0.92rem;
}

.library-header-favorite-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: #4f46e5;
}

@media (max-width: 640px) {
  .library-node-editor-grid {
    grid-template-columns: 1fr;
  }

  .library-node-editor-actions {
    justify-content: stretch !important;
  }

  .library-node-editor-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
}

.library-pro-shell .library-pro-side-tree .library-tree-item {
  border: none;
  border-radius: 0.45rem;
  padding: 0.25rem 0.32rem;
  margin-bottom: 0.08rem;
  background: transparent;
  box-shadow: none !important;
  width: auto;
  position: relative;
  cursor: grab;
}

.library-pro-shell .library-pro-side-tree .library-tree-item:hover,
.library-pro-shell .library-pro-side-tree .library-tree-item.active {
  background: #eef2ff;
  border-color: transparent;
}

.library-pro-shell .library-pro-side-tree .library-tree-item.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.library-pro-shell .library-pro-side-tree .library-tree-item.drag-over-inside {
  background: #dbeafe;
}

.library-pro-shell .library-pro-side-tree .library-tree-item.drag-over-before::before,
.library-pro-shell .library-pro-side-tree .library-tree-item.drag-over-after::after {
  content: '';
  position: absolute;
  left: 0.18rem;
  right: 0.18rem;
  height: 2px;
  border-radius: 999px;
  background: #2563eb;
}

.library-pro-shell .library-pro-side-tree .library-tree-item.drag-over-before::before {
  top: -1px;
}

.library-pro-shell .library-pro-side-tree .library-tree-item.drag-over-after::after {
  bottom: -1px;
}

.library-pro-shell .library-pro-side-tree .library-tree-item .fw-semibold {
  font-size: 0.82rem;
  font-weight: 600 !important;
}

.library-pro-shell .library-pro-side-tree .library-tree-item-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.library-pro-shell .library-pro-side-tree .library-tree-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-pro-shell .library-pro-side-tree .library-tree-type-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.04rem 0.32rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
  background: #eef2ff;
  border: 1px solid #dbe3ff;
  flex: 0 0 auto;
}

.library-pro-shell .library-pro-side-tree .library-tree-item small {
  font-size: 0.64rem;
}

.library-pro-shell .library-pro-side-tree .library-tree-item-icon {
  width: 1.02rem;
  height: 1.02rem;
  border-radius: 0.32rem;
  font-size: 0.64rem;
}

.library-pro-shell .library-pro-side-tree .library-tree-chip {
  font-size: 0.61rem;
  width: 1.5rem;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  line-height: 1;
  flex: 0 0 1.5rem;
}

.library-pro-shell .library-pro-side-tree .library-tree-chip i {
  font-size: 0.68rem;
  display: block;
  line-height: 1;
}

.library-pro-shell .library-editor-fields {
  display: none;
}

.library-pro-shell .library-pro-editor-row .ql-toolbar {
  margin-top: 0.22rem;
  /* Mantem a barra de formatacao visivel durante a rolagem do documento — a
     pagina inteira rola no nivel do documento (.mz-topbar ja usa o mesmo
     padrao de position:sticky), entao gruda logo abaixo do topbar fixo em
     vez de sumir junto com o texto rolado. */
  position: sticky;
  top: var(--mz-topbar-h, 56px);
  z-index: 15;
}

.library-pro-shell .library-pro-right .library-pane h2,
.library-pro-shell .library-pro-right .library-pane .h6 {
  font-size: 0.73rem;
  letter-spacing: 0.08em;
}

.library-version-row {
  cursor: pointer;
}

.library-version-author {
  font-size: 0.72rem;
  color: #475569;
  white-space: nowrap;
}

/* Right column card parity */
.library-pro-shell .library-pro-right {
  display: grid;
  gap: 0.72rem;
  align-content: start;
}

.library-pro-shell .library-pro-right .library-pane {
  background: #ffffff !important;
  border: 1px solid #e7ecf6 !important;
  border-radius: 1rem !important;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.06) !important;
  padding: 0.86rem 0.9rem !important;
}

.library-pro-shell .library-pro-right .library-pane h2,
.library-pro-shell .library-pro-right .library-pane .h6 {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a96aa;
  margin-bottom: 0.65rem !important;
}

.library-pro-shell .library-pro-right .library-pane .small,
.library-pro-shell .library-pro-right .library-pane p.small {
  font-size: 0.79rem;
  color: #5d6b82;
}

.library-pro-shell .library-pro-right .library-pro-stat-item {
  padding: 0.46rem 0;
  border-bottom: 1px dashed #e6ebf5;
  font-size: 0.84rem;
}

.library-pro-shell .library-pro-right .library-pro-stat-item:last-of-type {
  border-bottom: none;
}

.library-pro-shell .library-pro-right .library-pro-stat-item strong {
  color: #2563eb;
  font-weight: 700;
}

.library-pro-shell .library-pro-right .btn-outline-primary {
  border-color: #9ec5fe;
  color: #2563eb;
  border-radius: 0.56rem;
  font-weight: 600;
}

.library-pro-shell .library-pro-right .btn-outline-primary:hover {
  background: #eff6ff;
  border-color: #60a5fa;
  color: #1d4ed8;
}

.library-pro-shell .library-pro-right .library-content-tags {
  gap: 0.35rem;
}

.library-pro-shell .library-pro-right .library-tag-chip {
  font-size: 0.67rem;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
}

.library-pro-shell .library-pro-right #libraryVersions {
  gap: 0.5rem !important;
}

.library-pro-shell .library-pro-right .library-version-item {
  border: 1px solid #e7ecf6;
  border-radius: 0.86rem;
  padding: 0.62rem 0.65rem;
  box-shadow: none;
}

.library-pro-shell .library-pro-right .library-version-content strong {
  font-size: 0.82rem;
}

.library-pro-shell .library-pro-right .library-version-content small {
  font-size: 0.72rem;
}

.library-pro-shell .library-pro-right .library-version-author {
  font-size: 0.74rem;
  color: #6b7280;
}

/* Remove decorative background to match reference */
.library-pro-shell .library-page-shell::before {
  content: none !important;
  display: none !important;
  background: none !important;
}

/* Center content: remove visible borders to match reference */
.library-pro-shell .library-pro-main .library-pro-doc,
.library-pro-shell .library-pro-main .library-pane,
.library-pro-shell .library-pro-main .library-pane-center .card,
.library-pro-shell .library-pro-main .library-pane-center .card-body {
  border: none !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04) !important;
}

.library-pro-shell .library-pro-main .ql-toolbar,
.library-pro-shell .library-pro-main .ql-container {
  border-color: #eef2f7 !important;
}

/* Single center panel like reference */
.library-pro-shell .library-pro-main {
  background: #ffffff;
  border: 1px solid #e7ecf6;
  border-radius: 1rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  padding: 0.8rem 0.9rem;
}

.library-pro-shell .library-pro-main .library-pro-doc,
.library-pro-shell .library-pro-main .library-pro-editor-row,
.library-pro-shell .library-pro-main .library-pro-editor-row .card,
.library-pro-shell .library-pro-main .library-pro-editor-row .card-body {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.library-pro-shell .library-pro-main .library-pro-doc {
  margin-bottom: 0.6rem !important;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #eef2f7 !important;
}

.library-pro-shell .library-pro-main .library-pro-editor-row {
  margin-bottom: 0 !important;
}

.library-pro-shell .library-pro-main .library-editor-footer {
  border-top: 1px solid #eef2f7;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
}

.library-content-table-wrap {
  overflow: hidden;
  border-radius: 0.9rem;
  border: 1px solid #e7ecf6;
}

.library-content-table {
  margin: 0;
  background: #ffffff;
}

.library-content-table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid #e7ecf6;
  padding: 0.45rem 0.65rem;
}

.library-content-row {
  cursor: pointer;
}

.library-content-row td {
  padding: 0.32rem 0.65rem;
  vertical-align: middle;
  border-color: #eef2f7;
  line-height: 1.05;
}

.library-content-row:hover {
  background: #f8fafc;
}

.library-content-title-cell {
  min-width: 0;
}

.library-content-row-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-content-node,
.library-content-status,
.library-content-visibility {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.08rem 0.35rem;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.library-content-node {
  background: #eef2ff;
  color: #4f46e5;
  border: 1px solid #dbe3ff;
}

.library-content-status {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.library-content-visibility {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  min-width: 28px;
  justify-content: center;
}

.library-content-visibility i,
.library-pro-meta-row #libraryVisibilityDisplay i {
  font-size: 0.72rem;
}

.library-content-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.library-table-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.05rem 0.32rem;
  font-size: 0.58rem;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #dbe3ff;
}

.library-content-table tbody tr {
  height: 30px;
}

.library-table-tag.is-muted {
  color: #64748b;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.review-layout-grid {
  align-items: start;
}

.library-pro-shell .flashcards-page .library-workspace.review-layout-grid {
  grid-template-columns: minmax(0, 1fr) 280px;
}

@media (max-width: 1500px) {
  .library-pro-shell .flashcards-page .library-workspace.review-layout-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.review-session-box .progress {
  height: 10px;
}

.review-card {
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 0.9rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.72);
}

html[data-theme='dark'] .review-card {
  background: rgba(18, 30, 48, 0.82);
  border-color: rgba(148, 163, 184, 0.2);
}

.review-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--text);
  font-size: 0.75rem;
  padding: 0.22rem 0.58rem;
  margin-right: 0.35rem;
}

.review-highlight-text {
  font-size: 1.02rem;
  line-height: 1.6;
  margin: 0 0 0.8rem;
  padding-left: 0.8rem;
  border-left: 4px solid #f59e0b;
}

.review-context-box {
  border: 1px dashed rgba(100, 116, 139, 0.45);
  border-radius: 0.7rem;
  padding: 0.75rem;
  background: rgba(241, 245, 249, 0.75);
  margin-bottom: 0.9rem;
  white-space: pre-wrap;
}

html[data-theme='dark'] .review-context-box {
  background: rgba(15, 23, 42, 0.65);
}

.review-feedback-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.review-feedback-grid button:last-child {
  grid-column: span 2;
}

.flashcards-page #flashcardFocusToggleBtn {
  --bs-btn-color: #64748b;
  --bs-btn-border-color: #cbd5e1;
  --bs-btn-hover-color: #334155;
  --bs-btn-hover-bg: #f1f5f9;
  --bs-btn-hover-border-color: #94a3b8;
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: #334155;
  --bs-btn-active-border-color: #334155;
}

.flashcards-page #flashcardFocusToggleBtn.active {
  color: #ffffff;
  background-color: #334155;
  border-color: #334155;
}

.admin-enterprise-page {
  display: grid;
  gap: 0.9rem;
}

.admin-enterprise-hero {
  background: linear-gradient(135deg, #102a43, #1d4ed8 54%, #0ea5e9);
  color: #ffffff;
  border-radius: 1rem;
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 0.8rem;
  align-items: end;
}

.admin-enterprise-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #dbeafe;
  font-weight: 700;
}

.admin-enterprise-hero h1 {
  margin: 0;
  font-size: 1.45rem;
}

.admin-enterprise-hero p {
  margin: 0.25rem 0 0;
  color: rgba(255, 255, 255, 0.88);
}

.admin-enterprise-hero-actions {
  display: grid;
  gap: 0.5rem;
}

.admin-enterprise-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 0.8rem;
}

.admin-enterprise-sidebar {
  background: #ffffff;
  border: 1px solid #dbe6f3;
  border-radius: 1rem;
  padding: 0.7rem;
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.admin-enterprise-sidebar header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-enterprise-sidebar h2 {
  font-size: 0.9rem;
  margin: 0;
}

.admin-enterprise-module-nav {
  display: grid;
  gap: 0.35rem;
  max-height: 64vh;
  overflow: auto;
}

.admin-module-link {
  border: 1px solid #d5dfed;
  background: #f8fbff;
  color: #1e3a5f;
  border-radius: 0.7rem;
  text-align: left;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.admin-module-link.is-active {
  background: #dbeafe;
  border-color: #93c5fd;
}

.admin-enterprise-sidebar-foot {
  border-top: 1px dashed #dbe6f3;
  padding-top: 0.5rem;
  display: grid;
  gap: 0.3rem;
  color: #5f6c80;
}

.admin-favorite-modules {
  font-size: 0.75rem;
}

.admin-enterprise-content {
  display: grid;
  gap: 0.75rem;
}

.admin-pane-card {
  background: #ffffff;
  border: 1px solid #dbe6f3;
  border-radius: 1rem;
  padding: 0.85rem;
}

.admin-pane-card.is-hidden {
  display: none;
}

.admin-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.admin-pane-head h2 {
  margin: 0;
  font-size: 1rem;
}

.admin-inline-actions {
  display: flex;
  gap: 0.45rem;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.admin-kpi-card {
  border: 1px solid #dbe6f3;
  border-radius: 0.8rem;
  padding: 0.55rem;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  display: grid;
  gap: 0.1rem;
}

.admin-kpi-card strong {
  font-size: 1rem;
  color: #0f172a;
}

.admin-kpi-card span {
  color: #64748b;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-settings-accordion,
.admin-providers-grid,
.admin-templates-grid,
.admin-maintenance-grid,
.admin-audit-list {
  display: grid;
  gap: 0.5rem;
}

.admin-setting-group {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.5rem;
}

.admin-setting-group summary {
  cursor: pointer;
  font-weight: 700;
  color: #0f172a;
}

.admin-setting-body {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.5rem;
}

.admin-setting-row {
  display: grid;
  gap: 0.2rem;
}

.admin-setting-row span {
  font-size: 0.74rem;
  color: #64748b;
}

.admin-providers-grid,
.admin-templates-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-provider-card,
.admin-template-card {
  border: 1px solid #dbe6f3;
  border-radius: 0.75rem;
  padding: 0.6rem;
  background: #f8fbff;
}

.admin-provider-card h3,
.admin-template-card h3 {
  margin: 0;
  font-size: 0.86rem;
}

.admin-provider-card p,
.admin-template-card p {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.75rem;
}

.admin-template-card small {
  color: #5f6c80;
  display: block;
  margin-top: 0.25rem;
}

.admin-maintenance-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-maintenance-grid h3 {
  font-size: 0.84rem;
  margin: 0 0 0.3rem;
}

.admin-simple-list,
.admin-audit-list {
  margin: 0;
  padding-left: 1rem;
  color: #334155;
  font-size: 0.8rem;
}

.admin-enterprise-page.is-collapsed .admin-enterprise-shell {
  grid-template-columns: 82px minmax(0, 1fr);
}

.admin-enterprise-page.is-collapsed .admin-module-link {
  text-indent: -999px;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

.admin-enterprise-page.is-collapsed .admin-module-link::after {
  content: '\2022';
  text-indent: 0;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
}

@media (max-width: 1200px) {
  .admin-enterprise-hero {
    grid-template-columns: 1fr;
  }

  .admin-enterprise-shell {
    grid-template-columns: 1fr;
  }

  .admin-kpi-grid,
  .admin-providers-grid,
  .admin-templates-grid,
  .admin-maintenance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .admin-inline-actions {
    flex-wrap: wrap;
  }

  .admin-kpi-grid,
  .admin-providers-grid,
  .admin-templates-grid,
  .admin-maintenance-grid {
    grid-template-columns: 1fr;
  }
}

.flashcards-page #flashcardFocusToggleBtn.active:hover {
  color: #ffffff;
  background-color: #1e293b;
  border-color: #1e293b;
}

.reviews-page #reviewFocusToggleBtn {
  --bs-btn-color: #64748b;
  --bs-btn-border-color: #cbd5e1;
  --bs-btn-hover-color: #334155;
  --bs-btn-hover-bg: #f1f5f9;
  --bs-btn-hover-border-color: #94a3b8;
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: #334155;
  --bs-btn-active-border-color: #334155;
}

.reviews-page #reviewFocusToggleBtn.active {
  color: #ffffff;
  background-color: #334155;
  border-color: #334155;
}

.reviews-page #reviewFocusToggleBtn.active:hover {
  color: #ffffff;
  background-color: #1e293b;
  border-color: #1e293b;
}

body.review-focus-mode .reviews-page #reviewFocusToggleBtn {
  color: #ffffff !important;
  background-color: #334155 !important;
  border-color: #334155 !important;
}

body.review-focus-mode .reviews-page #reviewFocusToggleBtn:hover {
  color: #ffffff !important;
  background-color: #1e293b !important;
  border-color: #1e293b !important;
}

.review-memory-map {
  display: grid;
  gap: 0.4rem;
}

.review-memory-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0.6rem;
  padding: 0.38rem 0.52rem;
}

.review-memory-item.safe {
  background: rgba(34, 197, 94, 0.18);
}

.review-memory-item.warn {
  background: rgba(245, 158, 11, 0.2);
}

.review-memory-item.risk {
  background: rgba(239, 68, 68, 0.18);
}

.review-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 0.26rem;
}

.review-heat-cell {
  width: 100%;
  padding-top: 100%;
  border-radius: 3px;
  display: block;
  background: rgba(148, 163, 184, 0.2);
}

.review-heat-cell.l1 { background: #d1fae5; }
.review-heat-cell.l2 { background: #86efac; }
.review-heat-cell.l3 { background: #22c55e; }
.review-heat-cell.l4 { background: #15803d; }

html[data-theme='dark'] .review-heat-cell.l1 { background: #14532d; }
html[data-theme='dark'] .review-heat-cell.l2 { background: #166534; }
html[data-theme='dark'] .review-heat-cell.l3 { background: #15803d; }
html[data-theme='dark'] .review-heat-cell.l4 { background: #22c55e; }

.review-achievement-list {
  padding-left: 1.1rem;
}

body.review-focus-mode .panel-sidebar,
body.review-focus-mode #reviewRightPanel,
body.review-focus-mode .panel-topbar,
body.review-focus-mode .library-pro-breadcrumb,
body.library-focus-mode .panel-sidebar,
body.library-focus-mode .library-pro-right,
body.library-focus-mode .panel-topbar,
body.library-focus-mode .library-pro-breadcrumb-wrap {
  display: none !important;
}

body.review-focus-mode.library-pro-shell,
body.library-focus-mode.library-pro-shell {
  grid-template-columns: 1fr !important;
}

body.library-focus-mode .library-workspace {
  grid-template-columns: 1fr !important;
}

body.review-focus-mode .flashcards-page .review-right-panel {
  display: none !important;
}

body.review-focus-mode .flashcards-page .library-workspace.review-layout-grid {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* ===== FLASHCARD STUDY SYSTEM (fc-*) ===== */

@keyframes fc-in {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fc-bar-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fc-footer-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fc-answer-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fc-mem-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Session Bar */
.fc-session-bar {
  display: none;
  align-items: center;
  gap: 1rem;
  background: #ffffff;
  border-bottom: 1.5px solid #e6ebf5;
  box-shadow: 0 2px 16px rgba(15, 23, 42, 0.07);
  padding: 0.72rem 1.25rem;
  position: fixed;
  top: 0;
  left: 260px;
  right: 0;
  z-index: 300;
  animation: fc-bar-in 0.3s ease;
}

.fc-sb-left { flex: 0 0 auto; }
.fc-sb-deck-info { display: grid; gap: 0.1rem; }
.fc-sb-meta-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}
.fc-sb-deck-name { font-size: 0.95rem; font-weight: 800; color: #0f172a; line-height: 1.2; }
.fc-sb-subject { font-size: 0.75rem; color: #64748b; }

.fc-sb-center { flex: 1; min-width: 0; max-width: 300px; }
.fc-sb-progress-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}
.fc-sb-progress-text { white-space: nowrap; }
.fc-sb-bar-track {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.fc-sb-bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  transition: width 450ms cubic-bezier(0.4, 0, 0.2, 1);
}
.fc-sb-percent { font-size: 0.8rem; font-weight: 700; color: #2563eb; white-space: nowrap; }

.fc-sb-metrics { display: flex; align-items: center; gap: 1.2rem; flex: 0 0 auto; }
.fc-sb-metric {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}
.fc-sb-metric i { color: #94a3b8; font-size: 0.88rem; }
.fc-sb-metric--xp { color: #d97706; }
.fc-sb-metric--xp i { color: #f59e0b; }
.fc-sb-delta {
  display: inline-flex;
  align-items: center;
  background: #dcfce7;
  color: #15803d;
  border-radius: 999px;
  padding: 0.08rem 0.38rem;
  font-size: 0.67rem;
  font-weight: 800;
  margin-left: 0.2rem;
}
.fc-end-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.65rem;
  padding: 0.42rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms ease;
  flex-shrink: 0;
}
.fc-end-btn:hover { border-color: #fca5a5; color: #dc2626; background: #fef2f2; }

/* Tools Shell */
.fc-tools-shell { padding: 0.6rem 0; margin-bottom: 0.8rem; }
.fc-tools-row { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.55rem; }
.fc-tools-search { display: flex; align-items: center; gap: 0.45rem; flex: 1; min-width: 0; flex-wrap: wrap; }

.fc-search-input,
.fc-select {
  border: 1.5px solid #e2e8f0;
  border-radius: 0.65rem;
  padding: 0.4rem 0.72rem;
  font-size: 0.84rem;
  background: #ffffff;
  color: #334155;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  outline: none;
  font-family: inherit;
}
.fc-search-input { flex: 1; min-width: 180px; }
.fc-select { min-width: 130px; cursor: pointer; }
.fc-search-input:focus,
.fc-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.fc-tools-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.fc-tools-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.65rem;
  padding: 0.4rem 0.78rem;
  font-size: 0.82rem;
  font-weight: 600;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
  text-decoration: none;
  font-family: inherit;
}
.fc-tools-btn:hover { border-color: #cbd5e1; background: #f8fafc; color: #0f172a; }
.fc-tools-btn--primary { background: #2563eb; border-color: #2563eb; color: #ffffff; }
.fc-tools-btn--primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #ffffff; }
.fc-tools-btn .spin,
.fc-start-btn .spin {
  animation: memorizza-spin 0.9s linear infinite;
}
.fc-tools-export-group { display: flex; border: 1.5px solid #e2e8f0; border-radius: 0.65rem; overflow: hidden; }
.fc-tools-export-group .fc-tools-btn { border: none; border-radius: 0; border-right: 1px solid #e2e8f0; }
.fc-tools-export-group .fc-tools-btn:last-child { border-right: none; }
.fc-stats-strip { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.fc-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
  font-size: 0.76rem;
  background: #f1f5f9;
  color: #475569;
}
.fc-stat-pill--pending { background: #eff6ff; color: #1d4ed8; }
.fc-stat-pill--mastered { background: #f0fdf4; color: #15803d; }
.fc-stat-pill--hard { background: #fff7ed; color: #c2410c; }

@keyframes memorizza-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Study Main Layout */
.fc-study-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.fc-card-column { display: grid; gap: 0; }

/* Intro Card */
.fc-intro-card {
  background: #ffffff;
  border: 1px solid #e6ebf5;
  border-radius: 1.5rem;
  padding: 3.5rem 2rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.05);
  animation: fc-in 0.4s ease;
}
.fc-intro-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7c3aed;
  margin-bottom: 0.6rem;
}
.fc-intro-title { font-size: clamp(2rem, 4vw, 3rem); font-weight: 900; color: #0f172a; margin-bottom: 0.5rem; line-height: 1.15; }
.fc-intro-copy { color: #64748b; font-size: 0.95rem; margin-bottom: 2rem; line-height: 1.6; }
.fc-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #ffffff;
  border: none;
  border-radius: 1rem;
  padding: 0.9rem 2.2rem;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
  font-family: inherit;
}
.fc-start-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(37, 99, 235, 0.4); }
.fc-start-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

/* Flashcard */
.fc-card {
  background: #ffffff;
  border: 1px solid #e6ebf5;
  border-radius: 1.5rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.06);
  padding: 2rem;
  animation: fc-in 0.35s ease;
  display: grid;
  gap: 1.5rem;
}
.fc-card-nav { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.fc-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 150ms ease;
  flex-shrink: 0;
  font-family: inherit;
}
.fc-nav-btn:hover:not(:disabled) { border-color: #2563eb; color: #2563eb; background: #eff6ff; }
.fc-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.fc-card-position { font-size: 0.82rem; font-weight: 700; color: #64748b; white-space: nowrap; }

.fc-card-face { min-height: 280px; display: grid; align-content: start; gap: 1.5rem; }
.fc-card-badges { display: flex; align-items: center; justify-content: center; }
.fc-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.32rem 0.95rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
}
.fc-card-question {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 800;
  color: #0f172a;
  line-height: 1.55;
  text-align: center;
  padding: 0 0.5rem;
}
.fc-card-answer { animation: fc-answer-in 0.35s cubic-bezier(0.4, 0, 0.2, 1); }
.fc-answer-divider { height: 1px; background: linear-gradient(90deg, transparent, #e2e8f0, transparent); margin-bottom: 1.25rem; }
.fc-answer-label { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: #94a3b8; text-align: center; margin-bottom: 0.7rem; }
.fc-card-answer-text {
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 700;
  color: #1e3a8a;
  line-height: 1.6;
  text-align: center;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(124, 58, 237, 0.06));
  border-radius: 1rem;
  border: 1px solid rgba(37, 99, 235, 0.12);
}

/* Show Answer Button */
.fc-card-cta { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.fc-show-answer-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #ffffff;
  border: none;
  border-radius: 1rem;
  padding: 0.88rem 2.5rem;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.28);
  position: relative;
  overflow: hidden;
  font-family: inherit;
}
.fc-show-answer-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}
.fc-show-answer-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(37, 99, 235, 0.38); }
.fc-shortcut-label { font-size: 0.72rem; color: #94a3b8; margin: 0; }

/* Memory Buttons */
.fc-memory-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.55rem; animation: fc-mem-in 0.4s ease; }
.fc-mem-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  border: 1.5px solid transparent;
  border-radius: 1.1rem;
  padding: 1rem 0.45rem;
  cursor: pointer;
  background: #ffffff;
  transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 180ms ease;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  font-family: inherit;
}
.fc-mem-btn:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12); }
.fc-mem-btn:active { transform: translateY(-1px); }
.fc-mem-emoji { font-size: 1.5rem; line-height: 1; display: block; }
.fc-mem-num { font-size: 0.62rem; font-weight: 900; opacity: 0.55; margin-top: -0.1rem; }
.fc-mem-label { font-size: 0.72rem; font-weight: 800; text-align: center; line-height: 1.25; }
.fc-mem-sub { font-size: 0.62rem; font-weight: 500; text-align: center; opacity: 0.7; line-height: 1.3; }
.fc-mem-very-easy { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.fc-mem-easy      { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.fc-mem-medium    { background: #f8fafc; border-color: #e2e8f0; color: #334155; }
.fc-mem-hard      { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.fc-mem-forgot    { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.fc-mem-very-easy:hover { box-shadow: 0 12px 26px rgba(22, 101, 52, 0.15); }
.fc-mem-easy:hover      { box-shadow: 0 12px 26px rgba(30, 64, 175, 0.15); }
.fc-mem-hard:hover      { box-shadow: 0 12px 26px rgba(146, 64, 14, 0.15); }
.fc-mem-forgot:hover    { box-shadow: 0 12px 26px rgba(153, 27, 27, 0.15); }

/* Card Footer Nav */
.fc-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 0.6rem; border-top: 1px solid #f1f5f9; }
.fc-footer-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 0.55rem;
  transition: all 150ms ease;
  font-family: inherit;
}
.fc-footer-nav-btn:hover:not(:disabled) { color: #2563eb; background: #eff6ff; }
.fc-footer-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.fc-keyboard-hint { font-size: 0.7rem; color: #94a3b8; text-align: center; }

/* Session Summary */
.fc-summary-card {
  background: #ffffff;
  border: 1px solid #e6ebf5;
  border-radius: 1.5rem;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.05);
  animation: fc-in 0.4s ease;
}
.fc-summary-icon { font-size: 3.5rem; line-height: 1; margin-bottom: 1rem; }
.fc-summary-title { font-size: 1.8rem; font-weight: 900; color: #0f172a; margin-bottom: 0.5rem; }
.fc-summary-text { color: #64748b; margin-bottom: 1.5rem; font-size: 0.95rem; }
.fc-summary-meta { color: #64748b; font-size: 0.88rem; margin-bottom: 1.5rem; }
.fc-summary-actions { display: flex; align-items: center; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }

/* Context Sidebar */
.fc-context-sidebar {
  display: grid;
  gap: 0.8rem;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
.fc-context-sidebar::-webkit-scrollbar { width: 4px; }
.fc-context-sidebar::-webkit-scrollbar-track { background: transparent; }
.fc-context-sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 999px; }

.fc-ctx-section,
.fc-ai-section {
  background: #ffffff;
  border: 1px solid #e6ebf5;
  border-radius: 1.15rem;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.fc-ctx-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.82rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.8rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.01em;
}
.fc-ctx-header > i { color: #2563eb; font-size: 0.92rem; }
.fc-ctx-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: #f1f5f9;
  border-radius: 0.4rem;
  cursor: pointer;
  color: #64748b;
  transition: all 150ms ease;
  flex-shrink: 0;
  font-family: inherit;
}
.fc-ctx-toggle:hover { background: #e2e8f0; color: #334155; }
.fc-ctx-toggle i { transition: transform 220ms ease; }
.fc-ctx-toggle[aria-expanded="false"] i { transform: rotate(180deg); }

.fc-ctx-body { padding: 0.9rem; display: grid; gap: 0.75rem; }
.fc-ctx-source-row,
.fc-ctx-highlight-row { display: grid; gap: 0.35rem; }
.fc-ctx-row-label { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: #94a3b8; }
.fc-ctx-source-item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem;
  background: #f8fafc;
  border-radius: 0.7rem;
  border: 1px solid #f1f5f9;
}
.fc-ctx-source-item > i { color: #2563eb; font-size: 0.82rem; margin-top: 0.12rem; flex-shrink: 0; }
.fc-ctx-source-item strong { display: block; font-size: 0.8rem; font-weight: 700; color: #0f172a; line-height: 1.3; }
.fc-ctx-source-item small { display: block; font-size: 0.72rem; color: #64748b; margin-top: 0.08rem; }
.fc-ctx-highlight-text {
  font-size: 0.8rem;
  line-height: 1.7;
  color: #334155;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(124, 58, 237, 0.04));
  border-radius: 0.7rem;
  border: 1px solid rgba(37, 99, 235, 0.1);
  padding: 0.65rem 0.82rem;
  margin: 0;
}
.fc-ctx-value { font-size: 0.8rem; color: #475569; margin: 0; }
.fc-ctx-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.58rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
  border-radius: 0.7rem;
  border: 1px solid rgba(37, 99, 235, 0.12);
  text-decoration: none;
  transition: all 150ms ease;
}
.fc-ctx-link-btn:hover { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; text-decoration: none; }

/* AI Actions */
.fc-ai-body { padding: 0.82rem; display: grid; gap: 0.6rem; }
.fc-ai-actions-list { display: grid; gap: 0.35rem; }
.fc-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.52rem 0.72rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  cursor: pointer;
  transition: all 150ms ease;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.fc-ai-btn:hover { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.fc-ai-btn > i { color: #7c3aed; font-size: 0.82rem; flex-shrink: 0; }
.fc-ai-output {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.7rem 0.82rem;
  font-size: 0.8rem;
  line-height: 1.68;
  color: #334155;
  min-height: 2.5rem;
  white-space: pre-wrap;
}
.fc-ai-output:empty { display: none; }

/* Dark mode — os componentes .fc-* (card/intro/resumo/filtros/contexto/IA) foram
   construidos com cores fixas (fundo branco, texto escuro), sem variantes de tema.
   Agora que o card de estudo/intro/resumo vivem dentro do modal de sessao (que ja e
   dark-mode aware via var(--mz-*)), o contraste ficava quebrado em modo escuro —
   este bloco resolve reaproveitando as mesmas variaveis do resto do app. */
html[data-theme='dark'] .fc-intro-card,
html[data-theme='dark'] .fc-card,
html[data-theme='dark'] .fc-summary-card {
  background: var(--mz-surface);
  border-color: var(--mz-border);
  box-shadow: none;
}
html[data-theme='dark'] .fc-intro-title,
html[data-theme='dark'] .fc-card-question,
html[data-theme='dark'] .fc-summary-title,
html[data-theme='dark'] #flashcardStudySummary h2 {
  color: var(--mz-text);
}
html[data-theme='dark'] .fc-intro-copy,
html[data-theme='dark'] .fc-summary-text,
html[data-theme='dark'] .fc-card-position,
html[data-theme='dark'] .fc-shortcut-label,
html[data-theme='dark'] .fc-keyboard-hint,
html[data-theme='dark'] .fc-answer-label {
  color: var(--mz-text-muted);
}
html[data-theme='dark'] .fc-nav-btn,
html[data-theme='dark'] .fc-footer-nav-btn {
  background: var(--mz-bg-subtle);
  border-color: var(--mz-border);
  color: var(--mz-text-subtle);
}
html[data-theme='dark'] .fc-card-answer-text {
  color: var(--mz-text);
  background: var(--mz-bg-subtle);
  border-color: var(--mz-border);
}
html[data-theme='dark'] .fc-answer-divider,
html[data-theme='dark'] .fc-card-footer {
  background: var(--mz-border);
  border-color: var(--mz-border);
}
html[data-theme='dark'] .fc-badge {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
}
html[data-theme='dark'] .fc-search-input,
html[data-theme='dark'] .fc-select,
html[data-theme='dark'] .fc-tools-btn {
  background: var(--mz-surface);
  border-color: var(--mz-border);
  color: var(--mz-text);
}
html[data-theme='dark'] .fc-ctx-section,
html[data-theme='dark'] .fc-ai-section {
  background: var(--mz-surface);
  border-color: var(--mz-border);
  box-shadow: none;
}
html[data-theme='dark'] .fc-ctx-header {
  color: var(--mz-text);
  border-color: var(--mz-border);
}
html[data-theme='dark'] .fc-ctx-toggle {
  background: var(--mz-bg-subtle);
  color: var(--mz-text-muted);
}
html[data-theme='dark'] .fc-ctx-source-item,
html[data-theme='dark'] .fc-ai-btn,
html[data-theme='dark'] .fc-ai-output {
  background: var(--mz-bg-subtle);
  border-color: var(--mz-border);
  color: var(--mz-text-subtle);
}
html[data-theme='dark'] .fc-ctx-source-item strong,
html[data-theme='dark'] .fc-ctx-value {
  color: var(--mz-text);
}

/* Session Footer */
.fc-session-footer {
  position: fixed;
  bottom: 0;
  left: 260px;
  right: 0;
  z-index: 200;
  display: none;
  align-items: center;
  gap: 1.5rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1.5px solid #e6ebf5;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
  padding: 0.6rem 1.5rem;
  animation: fc-footer-in 0.3s ease;
}
.fc-sf-brand {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  flex-shrink: 0;
}
.fc-sf-brand i { color: #2563eb; }
.fc-sf-stats { display: flex; align-items: center; gap: 1.2rem; flex: 1; flex-wrap: wrap; }
.fc-sf-stat { display: flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: #475569; white-space: nowrap; }
.fc-sf-stat strong { color: #0f172a; }
.fc-sf-xp { color: #d97706; font-weight: 800; }
.fc-sf-icon-success { color: #16a34a; }
.fc-timeline-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #2563eb;
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  padding: 0.3rem 0;
  transition: color 150ms ease;
  flex-shrink: 0;
  font-family: inherit;
}
.fc-timeline-btn:hover { color: #1d4ed8; }

/* State-driven visibility */
body.fc-session-active .fc-tools-shell { display: none !important; }
body.fc-session-active .library-pro-topbar { display: none !important; }
body.fc-session-active .fc-session-bar { display: flex !important; }
body.fc-session-active .fc-session-footer { display: flex !important; }
body.fc-session-active .panel-content { padding-top: 72px !important; padding-bottom: 64px !important; }

/* Focus Mode */
body.flashcards-focus-mode .panel-sidebar { display: none !important; }
body.flashcards-focus-mode .fc-tools-shell { display: none !important; }
body.flashcards-focus-mode .fc-context-sidebar { display: none !important; }
body.flashcards-focus-mode .fc-session-bar { left: 0 !important; }
body.flashcards-focus-mode .fc-session-footer { left: 0 !important; }
body.flashcards-focus-mode .fc-study-main { grid-template-columns: minmax(0, 1fr) !important; }
body.flashcards-focus-mode .fc-card-column { max-width: 820px; margin: 0 auto; width: 100%; }

/* Responsive */
@media (max-width: 1100px) {
  .fc-study-main { grid-template-columns: minmax(0, 1fr); }
  .fc-context-sidebar { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; overflow-y: visible; }
}
@media (max-width: 900px) {
  .fc-session-footer { left: 0; }
  .fc-session-bar { left: 0; }
}
@media (max-width: 800px) {
  .fc-session-bar { flex-wrap: wrap; gap: 0.55rem; padding: 0.6rem 1rem; }
  .fc-sb-center { order: 4; flex: 0 0 100%; max-width: 100%; }
  .fc-sb-metrics { gap: 0.7rem; }
  .fc-memory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fc-context-sidebar { grid-template-columns: minmax(0, 1fr); }
  .fc-session-footer { flex-wrap: wrap; gap: 0.45rem; padding: 0.5rem 1rem; }
  .fc-sf-stats { gap: 0.65rem; }
}
@media (max-width: 600px) {
  .fc-session-bar { padding: 0.55rem 0.85rem; }
  .fc-sb-metrics { display: none; }
  .fc-card { padding: 1.25rem; gap: 1.2rem; }
  .fc-card-question { font-size: 1.2rem; padding: 0; }
  .fc-memory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fc-intro-card, .fc-summary-card { padding: 2rem 1.25rem; }
  .fc-tools-row { flex-direction: column; align-items: stretch; }
  .fc-tools-search { flex-direction: column; }
  .fc-tools-export-group { width: 100%; }
}


.knowledge-page {
  display: grid;
  gap: 1rem;
}

.knowledge-page > * {
  min-width: 0;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0.72rem;
}

.knowledge-main {
  border-radius: 0.95rem;
  border: 1px solid var(--mz-border);
  background: var(--mz-surface);
  color: var(--mz-text);
}

.knowledge-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.knowledge-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.knowledge-toolbar-subtitle {
  color: var(--mz-text-muted);
  font-size: 0.83rem;
}

.knowledge-toolbar-right {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.knowledge-canvas-wrap {
  margin-top: 0.7rem;
  border: 1px solid var(--mz-border);
  border-radius: 0.9rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.08), transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(34, 197, 94, 0.08), transparent 45%),
    var(--mz-bg-subtle);
}

#knowledgeCanvas {
  width: 100%;
  min-height: 560px;
  display: block;
  cursor: grab;
}

#knowledgeCanvas:active {
  cursor: grabbing;
}

.knowledge-edge-label {
  font-size: 11px;
  fill: var(--mz-text-subtle);
  pointer-events: none;
  font-weight: 600;
  paint-order: stroke;
  stroke: var(--mz-surface);
  stroke-width: 2px;
  stroke-opacity: 0.85;
}

.knowledge-node-title {
  font-size: 12px;
  fill: var(--mz-text);
  font-weight: 700;
  pointer-events: none;
}

.knowledge-node-circle {
  transition: transform 140ms ease, stroke-width 140ms ease;
}

.knowledge-node-ring {
  transition: opacity 160ms ease;
}

.knowledge-node.is-selected .knowledge-node-circle {
  filter: drop-shadow(0 8px 12px rgba(37, 99, 235, 0.28));
}

.knowledge-side-section {
  padding-bottom: 0.78rem;
  margin-bottom: 0.78rem;
  border-bottom: 1px dashed var(--mz-border);
}

.knowledge-side-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.knowledge-status-legend {
  display: grid;
  gap: 0.35rem;
}

.knowledge-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  padding: 0.22rem 0.48rem;
  border-radius: 999px;
  border: 1px solid var(--mz-border);
  width: fit-content;
}

.knowledge-status-chip strong {
  background: rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  padding: 0.02rem 0.4rem;
  font-size: 0.68rem;
  line-height: 1.2;
}

.knowledge-status-chip.dominated {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.knowledge-status-chip.evolving {
  color: #92400e;
  background: #fef3c7;
  border-color: #fcd34d;
}

.knowledge-status-chip.needs-review {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fca5a5;
}

.knowledge-node-info {
  display: grid;
  gap: 0.42rem;
}

.knowledge-status-pill {
  width: fit-content;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 999px;
  padding: 0.16rem 0.52rem;
  border: 1px solid transparent;
}

.knowledge-status-pill.dominated {
  color: #166534;
  border-color: #86efac;
  background: #dcfce7;
}

.knowledge-status-pill.evolving {
  color: #92400e;
  border-color: #fcd34d;
  background: #fef3c7;
}

.knowledge-status-pill.needs-review {
  color: #991b1b;
  border-color: #fca5a5;
  background: #fee2e2;
}

html[data-theme='dark'] .knowledge-status-chip.dominated,
html[data-theme='dark'] .knowledge-status-pill.dominated {
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.4);
  background: rgba(22, 101, 52, 0.35);
}

html[data-theme='dark'] .knowledge-status-chip.evolving,
html[data-theme='dark'] .knowledge-status-pill.evolving {
  color: #fcd34d;
  border-color: rgba(252, 211, 77, 0.4);
  background: rgba(146, 64, 14, 0.35);
}

html[data-theme='dark'] .knowledge-status-chip.needs-review,
html[data-theme='dark'] .knowledge-status-pill.needs-review {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.4);
  background: rgba(153, 27, 27, 0.35);
}

.knowledge-node-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.36rem;
}

.knowledge-node-kpis span {
  border: 1px solid var(--mz-border);
  background: var(--mz-bg-subtle);
  border-radius: 0.55rem;
  padding: 0.26rem 0.42rem;
  font-size: 0.72rem;
  color: var(--mz-text);
}

.knowledge-node-title-row {
  display: flex;
  align-items: center;
  gap: 0.42rem;
}

.knowledge-node-dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 999px;
  display: inline-block;
}

.knowledge-node-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.knowledge-node-meta span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.68rem;
  color: var(--mz-text-subtle);
  border: 1px solid var(--mz-border);
  background: var(--mz-bg-subtle);
}

.knowledge-search-results {
  display: grid;
  gap: 0.4rem;
  max-height: 210px;
  overflow: auto;
}

.knowledge-search-item {
  text-align: left;
  border: 1px solid var(--mz-border);
  border-radius: 0.62rem;
  background: var(--mz-surface);
  padding: 0.44rem 0.5rem;
  font-size: 0.78rem;
  color: var(--mz-text);
}

.knowledge-search-item:hover {
  border-color: var(--mz-secondary-300);
  background: var(--mz-secondary-50);
}

html[data-theme='dark'] .knowledge-search-item:hover {
  background: rgba(139, 92, 246, 0.14);
}

.knowledge-search-item.is-static {
  background: var(--mz-bg-subtle);
  border-style: dashed;
}

/* Barra superior (Disciplina/Matéria/Profundidade + Filtros) */
.knowledge-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.knowledge-toolbar-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 0.7rem;
  padding: 0 0.7rem;
  min-width: 200px;
}

.knowledge-toolbar-select > i {
  color: var(--mz-text-subtle);
  flex-shrink: 0;
}

.knowledge-toolbar-select .form-select,
.knowledge-toolbar-select .form-control {
  border: none;
  background: transparent;
  box-shadow: none;
  padding-left: 0;
  color: var(--mz-text);
}

.knowledge-toolbar-select .form-select option {
  color: initial;
}

.knowledge-toolbar-select .form-select:focus,
.knowledge-toolbar-select .form-control:focus {
  box-shadow: none;
}

/* Legenda abaixo do grafo (categorias + estilo de linha) */
.knowledge-legend-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--mz-border);
}

.knowledge-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--mz-text-subtle);
  font-weight: 600;
}

.knowledge-legend-line {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top: 2px solid var(--mz-text-subtle);
}

.knowledge-legend-line.dashed {
  border-top-style: dashed;
}

/* Sidebar: "Sua compreensão" (usa .dbv3-ring-wrap ja existente pro anel) */
#knowledgeComprehensionLegend li strong {
  color: var(--mz-text);
}

/* Sidebar: "Conceitos críticos para você" */
.knowledge-critical-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--mz-border);
  cursor: pointer;
}

.knowledge-critical-item:last-child {
  border-bottom: none;
}

.knowledge-critical-icon {
  width: 34px;
  height: 34px;
  border-radius: 0.6rem;
  background: var(--mz-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mz-primary-600);
  flex-shrink: 0;
}

.knowledge-critical-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mz-text);
}

.knowledge-critical-meta {
  font-size: 0.72rem;
  color: var(--mz-text-subtle);
}

.knowledge-critical-review-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--mz-primary-600);
  font-weight: 700;
  cursor: pointer;
}

.knowledge-critical-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--mz-warning-light);
  color: var(--mz-warning-dark);
  white-space: nowrap;
}

/* Sidebar: "Conexões recentes" */
.knowledge-recent-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--mz-border);
}

.knowledge-recent-item:last-child {
  border-bottom: none;
}

.knowledge-recent-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--mz-text);
}

.knowledge-recent-meta {
  font-size: 0.72rem;
  color: var(--mz-text-subtle);
}

/* Sidebar: "Atalhos" */
.knowledge-shortcut-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  border-radius: 0.7rem;
  border: 1px solid var(--mz-border);
  background: var(--mz-bg-subtle);
  color: var(--mz-text);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.knowledge-shortcut-btn:hover {
  border-color: var(--mz-secondary-300);
  background: var(--mz-secondary-50);
  color: var(--mz-text);
}

html[data-theme='dark'] .knowledge-shortcut-btn:hover {
  background: rgba(139, 92, 246, 0.14);
}

.knowledge-shortcut-btn > i {
  font-size: 1.05rem;
  color: var(--mz-primary-600);
  flex-shrink: 0;
}

.knowledge-shortcut-btn span {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.knowledge-shortcut-btn strong {
  font-size: 0.82rem;
}

.knowledge-shortcut-btn small {
  font-size: 0.72rem;
  color: var(--mz-text-subtle);
}

/* Rodape: "Explorar a partir de um conceito" + "Sugestões populares" */
.knowledge-suggestion-chip {
  background: var(--mz-bg-subtle);
  border: 1px solid var(--mz-border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--mz-text);
  cursor: pointer;
}

.knowledge-suggestion-chip:hover {
  border-color: var(--mz-secondary-300);
  color: var(--mz-secondary-600);
}

@media (max-width: 1100px) {
  .knowledge-layout {
    grid-template-columns: 1fr;
  }

  #knowledgeCanvas {
    min-height: 460px;
  }

  .knowledge-node-kpis {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════ Comunidade — sub-páginas (perfil/grupo/compartilhamento/discussão) ══════════════════════ */
.community-hero {
  border-radius: 18px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  box-shadow: 0 16px 36px rgba(79, 70, 229, 0.28);
  color: #fff;
  overflow: hidden;
}

.community-hero-body {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.5rem;
}

.community-hero-kicker {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
  opacity: 0.85;
  margin-bottom: 0.3rem;
}

.community-hero-title {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.5rem;
}

.community-hero-copy {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.88rem;
}

.community-hero-highlight {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  min-width: 200px;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.community-hero-highlight strong {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
  margin-bottom: 0.2rem;
}

.community-hero-highlight span {
  display: block;
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.community-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.7rem;
}

.community-stat-card {
  border-radius: 14px;
  border: 1px solid var(--mz-border);
  background: var(--mz-surface);
  padding: 0.75rem;
  text-align: center;
}

.community-stat-card span { display: block; font-size: 0.72rem; color: var(--mz-text-subtle); margin-bottom: 0.2rem; }
.community-stat-card strong { font-size: 1.15rem; font-weight: 800; color: var(--mz-text); }

.community-main-column,
.community-side-column {
  min-width: 0;
}

.community-discover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.community-discover-column h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--mz-text);
  margin-bottom: 0.6rem;
}

.community-discover-card {
  border: 1px solid var(--mz-border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.5rem;
  display: grid;
  gap: 0.15rem;
}

.community-discover-card strong { font-size: 0.82rem; color: var(--mz-text); }
.community-discover-card small { color: var(--mz-text-muted); font-size: 0.72rem; }

.community-filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.community-filter-bar .form-control,
.community-filter-bar .form-select,
.community-filter-search {
  max-width: 220px;
}

.community-stack-list { display: grid; gap: 0.6rem; }
.community-stack-list.compact { gap: 0.45rem; }

.community-list-card {
  border: 1px solid var(--mz-border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: var(--mz-surface);
}

.community-list-card[hidden] { display: none; }
.community-list-card p { color: var(--mz-text-subtle); font-size: 0.83rem; margin: 0 0 0.2rem; }

.community-list-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}

.community-inline-badge {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--mz-secondary-50);
  color: var(--mz-secondary-600);
  white-space: nowrap;
}

html[data-theme='dark'] .community-inline-badge {
  background: rgba(139, 92, 246, 0.16);
}

.community-inline-link {
  color: var(--mz-text);
  text-decoration: none;
  font-weight: 600;
}

.community-inline-link:hover { color: var(--mz-secondary-600); text-decoration: underline; }

.community-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.community-comment-compose textarea { resize: vertical; }

.community-comment-card {
  border: 1px solid var(--mz-border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: var(--mz-surface);
}

.community-comment-card[hidden] { display: none; }

.community-comment-card.is-reply {
  margin-left: 1.5rem;
  background: var(--mz-bg-subtle);
}

.community-comment-card p { color: var(--mz-text-subtle); font-size: 0.85rem; margin: 0; }

.community-comment-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.community-comments-thread { display: grid; gap: 0.6rem; }

/* Dentro de .library-pane (a "ilha clara" fixa da sidebar — sempre branca
   independente do tema, ver Bloco 1) as cores dos componentes acima
   precisam ser fixas, não var(--mz-*), senão viram cartão escuro dentro
   de painel sempre-claro no dark mode. */
.library-pro-shell .library-pane .community-list-card,
.library-pro-shell .library-pane .community-comment-card {
  border-color: #dbe6f3;
  background: #f8fafc;
}

.library-pro-shell .library-pane .community-list-card p,
.library-pro-shell .library-pane .community-comment-card p {
  color: #334155;
}

.library-pro-shell .library-pane .community-inline-link {
  color: #0f172a;
}

.library-pro-shell .library-pane .community-inline-badge {
  background: #ede9fe;
  color: #5b21b6;
}

@media (max-width: 640px) {
  .community-hero-body { flex-direction: column; }
  .community-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

body.review-focus-mode .panel-shell,
body.library-focus-mode .panel-shell {
  grid-template-columns: 1fr;
}

body.review-focus-mode .panel-main,
body.library-focus-mode .panel-main {
  padding: 0;
}

body.review-focus-mode .panel-content,
body.library-focus-mode .panel-content {
  padding: 1.2rem;
}

@media (max-width: 991.98px) {
  .review-feedback-grid {
    grid-template-columns: 1fr;
  }

  .review-feedback-grid button:last-child {
    grid-column: auto;
  }
}

/* Dashboard phase 10 inspired layout */
.dashboard-v10-shell {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: dashboardV10In 260ms ease-out;
}

.dashboard-v10-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  background: linear-gradient(120deg, #f9f5eb 0%, #fff9ef 50%, #f4efe2 100%);
  border: 1px solid #eadfcb;
  border-radius: 20px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 1px 0 rgba(19, 31, 23, 0.04);
}

.dashboard-v10-head h1 {
  margin: 0;
  color: #1f2f24;
  font-size: 1.55rem;
  font-weight: 700;
}

.dashboard-v10-head p {
  margin: 0.35rem 0 0;
  color: #52614f;
}

.dashboard-v10-head-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 0.7rem;
}

.dashboard-v10-head-stats article {
  background: #fff;
  border: 1px solid #e6ddcc;
  border-radius: 14px;
  padding: 0.65rem 0.8rem;
  text-align: center;
  min-width: 95px;
}

.dashboard-v10-head-stats strong {
  display: block;
  color: #24352a;
  font-size: 1.42rem;
  line-height: 1.05;
  font-weight: 800;
}

.dashboard-v10-head-stats span {
  color: #6f7a70;
  font-size: 0.92rem;
}

.dashboard-v10-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 1rem;
}

.dashboard-v10-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-v10-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 1rem;
  background: #fff;
  border: 1px solid #e9e0d0;
  border-radius: 20px;
  padding: 1.1rem;
  box-shadow: 0 1px 0 rgba(19, 31, 23, 0.04);
}

.dashboard-v10-hero .kicker {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  color: #8a7757;
}

.dashboard-v10-hero h2 {
  margin: 0;
  color: #1f3026;
  font-size: 2rem;
  line-height: 1.05;
}

.dashboard-v10-hero p {
  margin: 0.45rem 0;
  color: #4e5f50;
  font-size: 1.07rem;
}

.dashboard-v10-hero-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.dashboard-v10-hero-chips span {
  display: block;
  background: #f6f1e5;
  border: 1px solid #e8ddca;
  border-radius: 10px;
  padding: 0.48rem 0.55rem;
  color: #5f6f60;
  font-size: 1rem;
}

.dashboard-v10-hero-cta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: linear-gradient(145deg, #f1f8f0 0%, #eff6ea 100%);
  border: 1px solid #d8e4d3;
  border-radius: 14px;
  padding: 0.8rem;
  justify-content: flex-start;
}

.dashboard-v10-hero-cta p {
  margin: 0;
  font-size: 0.95rem;
  color: #6a7469;
}

.dashboard-v10-hero-cta a:not(.btn) {
  font-size: 0.84rem;
  color: #2c5f33;
  text-decoration: none;
  font-weight: 600;
}

.dashboard-v10-hero-cta .btn,
.side-plan-card .btn {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(92deg, #1f4fd8 0%, #3566f1 100%);
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.01em;
  padding: 0.62rem 0.8rem;
  box-shadow: 0 5px 14px rgba(45, 92, 230, 0.28);
}

.dashboard-v10-hero-cta .btn:hover,
.side-plan-card .btn:hover {
  filter: brightness(1.03);
  color: #ffffff;
}

.dashboard-v10-prioridades,
.dashboard-v10-progresso,
.dashboard-v10-atividades,
.dashboard-v10-semana,
.side-plan-card,
.side-list-card {
  background: #fff;
  border: 1px solid #eadfcf;
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 1px 0 rgba(19, 31, 23, 0.04);
}

.dashboard-v10-prioridades h3,
.dashboard-v10-progresso h3,
.dashboard-v10-atividades h3,
.dashboard-v10-semana h3,
.side-plan-card h3,
.side-list-card h3 {
  margin: 0 0 0.75rem;
  color: #2a3a2f;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dashboard-v10-prioridades-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.prio-card {
  border: 1px solid #e7ddcc;
  border-radius: 14px;
  padding: 0.75rem;
  background: #fffdf7;
}

.prio-card .tag {
  display: inline-block;
  border-radius: 999px;
  font-size: 0.68rem;
  padding: 0.16rem 0.45rem;
  margin-bottom: 0.45rem;
  font-weight: 700;
}

.prio-card h4 {
  margin: 0 0 0.15rem;
  color: #26372c;
  font-size: 2rem;
  line-height: 1;
}

.prio-card p {
  margin: 0;
  color: #4f6153;
  font-size: 1.32rem;
}

.prio-card small {
  display: block;
  margin: 0.3rem 0 0.45rem;
  color: #7a857b;
  font-size: 1rem;
}

.prio-card a {
  text-decoration: none;
  font-weight: 600;
  color: #1f5f2e;
  font-size: 1.15rem;
}

.prio-card.urgente .tag {
  background: #ffe5e3;
  color: #b73f3a;
}

.prio-card.atencao .tag {
  background: #fff2dc;
  color: #ad6b19;
}

.prio-card.em-dia .tag {
  background: #e7f8ea;
  color: #2f8546;
}

.prio-card.plano .tag {
  background: #ececfc;
  color: #4b4cb8;
}

.dashboard-v10-progresso-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.dashboard-v10-progresso-grid article {
  border: 1px solid #e6dece;
  border-radius: 12px;
  padding: 0.75rem;
}

.dashboard-v10-progresso-grid span {
  display: block;
  color: #6d766d;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.dashboard-v10-progresso-grid strong {
  display: block;
  color: #223428;
  font-size: 1.65rem;
}

.dashboard-v10-progresso-grid small {
  color: #6e7d6f;
  font-size: 0.95rem;
}

.dashboard-v10-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 265px;
  gap: 1rem;
}

.dashboard-v10-atividades ul,
.side-plan-card ul,
.side-list-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dashboard-v10-atividades li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px dashed #ece3d4;
  padding-bottom: 0.45rem;
}

.dashboard-v10-atividades li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.dashboard-v10-atividades li span {
  color: #7f8a80;
  font-size: 0.78rem;
}

.dashboard-v10-atividades li p {
  margin: 0;
  color: #2d3d32;
  font-size: 0.95rem;
}

.dashboard-v10-atividades li strong {
  color: #2f7c3f;
  font-size: 0.9rem;
}

.dashboard-v10-atividades > a,
.dashboard-v10-semana > a,
.side-list-card > a {
  display: inline-block;
  margin-top: 0.55rem;
  color: #2a6f35;
  font-size: 0.82rem;
  text-decoration: none;
  font-weight: 600;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
}

.heat {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: #edf2ec;
}

.heat.l1 { background: #e8f2e6; }
.heat.l2 { background: #d9ebd6; }
.heat.l3 { background: #b9dcba; }
.heat.l4 { background: #8dc695; }
.heat.l5 { background: #61a86d; }

.dashboard-v10-side {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.side-plan-card li,
.side-list-card li {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  border-bottom: 1px dashed #ebe1d1;
  padding-bottom: 0.45rem;
}

.side-plan-card li:last-child,
.side-list-card li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.side-plan-card li span,
.side-list-card li span {
  color: #324238;
  font-size: 0.97rem;
}

.side-plan-card li small,
.side-list-card li small {
  color: #7a847b;
  font-size: 0.9rem;
}

.side-plan-card .total {
  margin: 0.65rem 0;
  color: #5b675c;
  font-size: 1rem;
}

.side-plan-card .total strong {
  color: #1f3226;
}

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

@media (max-width: 1080px) {
  .dashboard-v10-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-v10-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .dashboard-v10-head,
  .dashboard-v10-hero,
  .dashboard-v10-bottom-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .dashboard-v10-head {
    display: flex;
    flex-direction: column;
  }

  .dashboard-v10-head-stats,
  .dashboard-v10-prioridades-grid,
  .dashboard-v10-progresso-grid,
  .dashboard-v10-side {
    grid-template-columns: 1fr;
  }
}

/* Dashboard v10 final fidelity pass (colors, cards, icons, fonts) */
.dashboard-v10-shell {
  --v10-bg-soft: #f8f4eb;
  --v10-border: #ebe2d2;
  --v10-text: #1f2f24;
  --v10-muted: #667267;
  --v10-link: #2e6b3f;
  --v10-link-hover: #1f5330;
  --v10-blue-a: #1f4fd8;
  --v10-blue-b: #3f70f2;
  font-family: "Manrope", "Segoe UI", sans-serif;
  animation: none;
}

.dashboard-v10-head,
.dashboard-v10-hero,
.dashboard-v10-prioridades,
.dashboard-v10-progresso,
.dashboard-v10-atividades,
.dashboard-v10-semana,
.side-plan-card,
.side-list-card {
  border-color: var(--v10-border);
  box-shadow: 0 1px 0 rgba(18, 30, 22, 0.04), 0 8px 18px rgba(31, 44, 33, 0.03);
}

.dashboard-v10-head {
  background: linear-gradient(128deg, #faf6ed 0%, #f7f1e4 58%, #f5efdf 100%);
}

.dashboard-v10-head h1 {
  color: var(--v10-text);
  font-size: 2.6rem;
  line-height: 1.04;
  font-weight: 800;
}

.dashboard-v10-head p {
  color: #435345;
  font-size: 1.1rem;
}

.dashboard-v10-head-stats article {
  border-color: #e4d9c5;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 #ffffff;
}

.dashboard-v10-head-stats strong {
  font-size: 2.2rem;
  letter-spacing: -0.02em;
}

.dashboard-v10-head-stats span {
  font-size: 1.05rem;
}

.dashboard-v10-hero .kicker {
  color: #756649;
  font-size: 0.92rem;
}

.dashboard-v10-hero h2 {
  font-size: 3.2rem;
  letter-spacing: -0.015em;
}

.dashboard-v10-hero p {
  font-size: 1.2rem;
  color: #3f4f42;
}

.dashboard-v10-hero-copy p strong {
  color: #24382a;
}

.dashboard-v10-hero-chips span {
  background: #f8f2e7;
  border-color: #e9e0d0;
  color: #495a4d;
  font-size: 1.02rem;
}

.dashboard-v10-hero-cta {
  background: linear-gradient(150deg, #eef8ed 0%, #e8f3e5 100%);
}

.dashboard-v10-hero-cta .btn,
.side-plan-card .btn {
  background: linear-gradient(92deg, var(--v10-blue-a) 0%, var(--v10-blue-b) 100%);
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(45, 92, 230, 0.34);
}

.dashboard-v10-hero-cta .btn:focus,
.side-plan-card .btn:focus {
  box-shadow: 0 8px 20px rgba(45, 92, 230, 0.34), 0 0 0 0.18rem rgba(58, 105, 245, 0.24);
}

.dashboard-v10-hero-cta a:not(.btn),
.dashboard-v10-atividades > a,
.dashboard-v10-semana > a,
.side-list-card > a,
.prio-card a {
  color: var(--v10-link);
}

.dashboard-v10-hero-cta a:not(.btn):hover,
.dashboard-v10-atividades > a:hover,
.dashboard-v10-semana > a:hover,
.side-list-card > a:hover,
.prio-card a:hover {
  color: var(--v10-link-hover);
}

.dashboard-v10-prioridades h3,
.dashboard-v10-progresso h3,
.dashboard-v10-atividades h3,
.dashboard-v10-semana h3,
.side-plan-card h3,
.side-list-card h3 {
  color: #223429;
  font-size: 1.28rem;
  font-weight: 800;
}

.prio-card {
  background: #fffef9;
}

.prio-card h4 {
  font-size: 3rem;
}

.prio-card p {
  font-size: 1.55rem;
}

.dashboard-v10-progresso-grid article {
  background: #fffefb;
}

.dashboard-v10-progresso-grid strong {
  font-size: 2rem;
}

.dashboard-v10-progresso-grid span,
.dashboard-v10-progresso-grid small,
.side-plan-card li span,
.side-plan-card li small,
.side-list-card li span,
.side-list-card li small {
  font-size: 1rem;
  color: #49594c;
}

.dashboard-v10-atividades li p,
.dashboard-v10-atividades li strong,
.prio-card p,
.prio-card small,
.side-list-card h3,
.side-plan-card h3 {
  color: #26362a;
}

.sidebar-nav-pro .nav-link i {
  width: 1rem;
}

.sidebar-nav-pro .icon-home,
.sidebar-nav-pro .icon-library {
  color: #536be5;
}

.sidebar-nav-pro .icon-review {
  color: #e4b13b;
}

.sidebar-nav-pro .icon-flash {
  color: #40a574;
}

.sidebar-nav-pro .icon-question {
  color: #d76a5c;
}

.sidebar-nav-pro .icon-mind {
  color: #8f6adf;
}

.sidebar-nav-pro .icon-bookmark {
  color: #5f7ce6;
}

.sidebar-nav-pro .icon-note {
  color: #d8568f;
}

.sidebar-nav-pro .icon-trash {
  color: #d36a6a;
}

@media (max-width: 1450px) {
  .dashboard-v10-head h1 {
    font-size: 2.15rem;
  }

  .dashboard-v10-hero h2 {
    font-size: 2.35rem;
  }

  .prio-card h4 {
    font-size: 2.35rem;
  }

  .prio-card p {
    font-size: 1.3rem;
  }
}

/* Sidebar + typography fidelity tweaks */
.library-pro-shell .panel-sidebar {
  background: #ffffff;
  border-right: 1px solid #e7ebf4;
}

.sidebar-brand-text {
  color: #4d63de;
  font-weight: 800;
}

.sidebar-nav-pro .nav-link {
  border-radius: 12px;
  color: #2f3f56;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  padding: 0.68rem 0.78rem;
}

.sidebar-nav-pro .nav-link i {
  margin-right: 0.45rem;
  font-size: 0.92rem;
}

.sidebar-nav-pro .nav-link:hover {
  background: #eef2ff;
  color: #3c4fc0;
}

.sidebar-nav-pro .nav-link.active {
  background: #e4ebff;
  color: #3d54c9;
  box-shadow: inset 0 0 0 1px #d8e2ff;
}

.sidebar-nav-pro .nav-link[href*='dashboard'] i { color: #6a7bf0; }
.sidebar-nav-pro .nav-link[href*='library'] i { color: #6073ea; }
.sidebar-nav-pro .nav-link[href*='knowledge'] i { color: #6b7280; }
.sidebar-nav-pro .nav-link[href*='community'] i { color: #374151; }
.sidebar-nav-pro .nav-link[href*='marketplace'] i { color: #6b7280; }
.sidebar-nav-pro .nav-link[href*='stats'] i { color: #6b7280; }
.sidebar-nav-pro .nav-link[href*='admin'] i { color: #6b7280; }
.sidebar-nav-pro .nav-link[href*='reviews'] i { color: #f0b33c; }
.sidebar-nav-pro .nav-link[href*='flashcards'] i { color: #48a677; }
.sidebar-nav-pro .nav-link[href*='questions'] i { color: #e06c5e; }
.sidebar-nav-pro .nav-link[href*='ai'] i { color: #6c73e9; }

.sidebar-nav-pro .nav-link[href='#'] i {
  color: #8a6be0;
}

.sidebar-nav-pro .nav-link:nth-last-child(3) i { color: #6e83ef; }
.sidebar-nav-pro .nav-link:nth-last-child(2) i { color: #d95e93; }
.sidebar-nav-pro .nav-link:last-child i { color: #db7373; }

.dashboard-v10-head h1,
.dashboard-v10-hero h2,
.prio-card h4,
.prio-card p {
  text-rendering: geometricPrecision;
}

/* Reference dashboard layout */
.dashboard-ref-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-ref-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.4rem 0.2rem;
}

.dashboard-ref-top h1 {
  margin: 0;
  font-size: 2.05rem;
  font-weight: 800;
  color: #1f2f47;
}

.dashboard-ref-top p {
  margin: 0.25rem 0 0;
  color: #5f6e86;
  font-size: 0.98rem;
}

.dashboard-ref-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 0.65rem;
}

.dashboard-ref-kpis article {
  border: 1px solid #e5eaf5;
  border-radius: 15px;
  padding: 0.52rem 0.7rem;
  text-align: center;
  background: #fff;
}

.dashboard-ref-kpis i {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.12rem;
}

.dashboard-ref-kpis article:nth-child(1) i { color: #ef4444; }
.dashboard-ref-kpis article:nth-child(2) i { color: #6366f1; }
.dashboard-ref-kpis article:nth-child(3) i { color: #475569; }

.dashboard-ref-kpis strong {
  display: block;
  color: #243449;
  font-size: 1.85rem;
  line-height: 1;
}

.dashboard-ref-kpis span {
  color: #6f7b8f;
  font-size: 0.92rem;
}

.dashboard-ref-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0.9rem;
}

.dashboard-ref-main {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.dashboard-ref-card,
.dashboard-ref-hero {
  border: 1px solid #e6ebf5;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(31, 47, 71, 0.04);
}

.dashboard-ref-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 228px;
  gap: 0.85rem;
  padding: 1rem;
  background-image:
    radial-gradient(circle at 72% -10%, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 36%),
    linear-gradient(126deg, #322ca7 0%, #3a2fb6 40%, #28208f 100%);
  background-repeat: no-repeat;
  background-size: auto, auto;
  background-position: left top, left top;
  color: #ffffff;
}

.dashboard-ref-hero .hero-kicker {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
}

.dashboard-ref-hero h2 {
  margin: 0.2rem 0;
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.06;
}

.dashboard-ref-hero p {
  margin: 0.2rem 0;
  color: rgba(236, 239, 255, 0.94);
  font-size: 1.04rem;
}

.dashboard-ref-hero p strong {
  color: #ffd84d;
}

.hero-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.42rem;
  margin-top: 0.58rem;
}

.hero-chips span {
  display: flex;
  align-items: center;
  gap: 0.33rem;
  font-size: 0.8rem;
  color: #d8defd;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 0.35rem 0.48rem;
  background: rgba(8, 12, 51, 0.22);
}

.hero-side {
  border-radius: 13px;
  background: linear-gradient(155deg, #eef8ed 0%, #e3f1e0 100%);
  border: 1px solid #d6e7d1;
  padding: 0.62rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hero-side .btn,
.side-plan .btn {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(92deg, #4f6cf7 0%, #5a49de 100%);
  color: #fff;
  font-weight: 800;
  padding: 0.58rem 0.7rem;
}

.hero-side p {
  margin: 0;
  color: #4e6070;
  font-size: 0.93rem;
}

.hero-side a:not(.btn) {
  color: #365eaa;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.93rem;
}

.dashboard-ref-card {
  padding: 0.9rem;
}

.dashboard-ref-card h3 {
  margin: 0 0 0.72rem;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  color: #2e3f58;
  font-weight: 800;
}

.prioridades-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.prio-item {
  border: 1px solid #e7ecf7;
  border-radius: 13px;
  padding: 0.72rem;
  text-align: center;
  background: #fff;
}

.prio-item .badge {
  margin: 0;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
}

.prio-item .badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 4px;
}

.prio-item .prio-icon {
  width: 50px;
  height: 50px;
  margin: 0.5rem auto;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}

.prio-item h4 {
  margin: 0;
  color: #28384e;
  font-size: 2.05rem;
  line-height: 1.03;
}

.prio-item .sub {
  margin: 0.2rem 0;
  color: #5f6d84;
  font-size: 0.92rem;
}

.prio-item small {
  display: block;
  color: #7e8ca1;
  margin-bottom: 0.45rem;
}

.prio-item a {
  display: block;
  border: 1px solid #d9e2f3;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  padding: 0.34rem;
}

.prio-item.urgente .badge,
.prio-item.urgente a { color: #ef4444; }
.prio-item.urgente .badge .dot { background: #ef4444; }
.prio-item.urgente .prio-icon { background: #fff1f2; color: #ef4444; }

.prio-item.atencao .badge,
.prio-item.atencao a { color: #f59e0b; }
.prio-item.atencao .badge .dot { background: #f59e0b; }
.prio-item.atencao .prio-icon { background: #fff7e8; color: #f59e0b; }

.prio-item.emdia .badge,
.prio-item.emdia a { color: #22c55e; }
.prio-item.emdia .badge .dot { background: #22c55e; }
.prio-item.emdia .prio-icon { background: #ecfdf3; color: #22c55e; }

.prio-item.plano .badge,
.prio-item.plano a { color: #4f46e5; }
.prio-item.plano .badge .dot { background: #4f46e5; }
.prio-item.plano .prio-icon { background: #eef2ff; color: #4f46e5; }

.progresso-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.progresso-grid article {
  border: 1px solid #e8edf8;
  border-radius: 12px;
  padding: 0.66rem;
}

.progresso-grid span { color: #6f7e95; font-size: 0.72rem; display: block; }
.progresso-grid strong { color: #26374d; font-size: 2rem; line-height: 1.05; display: block; }
.progresso-grid small { color: #72849c; font-size: 0.8rem; }

.bar {
  height: 6px;
  border-radius: 999px;
  background: #ebeff9;
  margin-top: 0.42rem;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.bar-blue span { background: #5c6ef5; }
.bar-purple span { background: #7c3aed; }
.bar-orange span { background: #f59e0b; }
.bar-green span { background: #22c55e; }

.dashboard-ref-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 0.7rem;
}

.atividade ul,
.side-plan ul,
.side-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.atividade li {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  border-bottom: 1px dashed #e8edf8;
  padding: 0.28rem 0;
}

.atividade li:last-child { border-bottom: 0; }
.atividade li span { color: #6e7d93; }
.atividade li p { margin: 0; color: #2f4058; }
.atividade li strong { color: #5a52db; font-size: 0.84rem; }

.atividade > a,
.semana > a,
.side-list > a {
  display: inline-block;
  margin-top: 0.5rem;
  color: #4e58d8;
  text-decoration: none;
  font-weight: 700;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.38rem;
}

.week-grid span {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
}

.week-grid .lv1 { background: #eff7ef; }
.week-grid .lv2 { background: #dbf1dc; }
.week-grid .lv3 { background: #b8e5bc; }
.week-grid .lv4 { background: #89d494; }
.week-grid .lv5 { background: #4dbf6b; }

.dashboard-ref-side {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.side-plan li,
.side-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.28rem 0;
  border-bottom: 1px dashed #e8edf8;
}

.side-plan li:last-child,
.side-list li:last-child { border-bottom: 0; }

.side-plan li span,
.side-list li span { color: #34455e; }
.side-plan li small,
.side-list li small { color: #75839a; }

.side-plan .ok { color: #22c55e; margin-right: 0.26rem; }
.side-plan .atn { color: #f59e0b; margin-right: 0.26rem; }
.side-plan .pen { color: #94a3b8; margin-right: 0.26rem; }

.side-plan .total {
  margin: 0.55rem 0;
  color: #64748b;
}

.side-plan .total strong { color: #26364c; }

.sidebar-nav-ref .sidebar-group-title {
  margin: 0.34rem 0 0.12rem;
  color: #8a95a9;
  font-size: 0.69rem;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.sidebar-plan-card {
  margin-top: 0.8rem;
  border: 1px solid #e5ebf9;
  border-radius: 12px;
  padding: 0.58rem;
  background: #f8faff;
}

.sidebar-plan-card .plan-title {
  margin: 0;
  color: #8a95a9;
  font-size: 0.75rem;
}

.sidebar-plan-card strong {
  display: block;
  color: #f59e0b;
  margin-top: 0.1rem;
}

.sidebar-plan-card > a {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.84rem;
}

.sidebar-plan-logout {
  margin-top: 0.3rem;
}

.sidebar-plan-logout .btn {
  padding: 0;
  font-size: 0.8rem;
  color: #64748b;
  text-decoration: none;
}

@media (max-width: 1360px) {
  .dashboard-ref-hero h2 { font-size: 2rem; }
  .prioridades-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .dashboard-ref-grid,
  .dashboard-ref-bottom {
    grid-template-columns: 1fr;
  }

  .dashboard-ref-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .progresso-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .dashboard-ref-top {
    flex-direction: column;
  }

  .dashboard-ref-hero {
    grid-template-columns: 1fr;
  }

  .hero-chips,
  .progresso-grid,
  .prioridades-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Dashboard v11 – topbar, icons, heatmap, fidelity ───────────────────── */

/* Fix: prio-item h4 was inflated */
.prio-item h4 { font-size: 1.05rem !important; font-weight: 800 !important; line-height: 1.2 !important; margin: 0 0 0.1rem !important; }
.prio-item .sub { font-size: 0.84rem !important; }
.prio-item .prio-status { font-size: 0.78rem; display: block; margin-bottom: 0.35rem; }
.prio-btn { display: block; border: 1.5px solid currentColor; border-radius: 7px; padding: 0.3rem 0.5rem; font-size: 0.82rem; font-weight: 600; text-decoration: none; text-align: center; margin-top: auto; }
.prio-item.urgente .prio-btn { color: #ef4444; }
.prio-item.atencao .prio-btn { color: #f59e0b; }
.prio-item.emdia  .prio-btn { color: #22c55e; }
.prio-item.plano  .prio-btn { color: #6366f1; }
.prio-item.urgente .prio-btn:hover { background: #fff1f2; }
.prio-item.atencao .prio-btn:hover { background: #fff7e8; }
.prio-item.emdia  .prio-btn:hover { background: #ecfdf3; }
.prio-item.plano  .prio-btn:hover { background: #eef2ff; }

/* Dashboard custom topbar */
.db-topbar-shell { display: flex !important; align-items: center; gap: 1rem; padding: 0.6rem 1.2rem !important; min-height: 66px; background: #fff !important; }
.db-tb-greeting { flex: 0 0 auto; }
.db-tb-greeting h1 { margin: 0; font-size: 1.38rem; font-weight: 800; color: #1f2f47; line-height: 1.15; }
.db-tb-greeting p  { margin: 0; color: #6e7d93; font-size: 0.82rem; }
.db-tb-kpis { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.db-tb-kpis article { display: flex; align-items: center; gap: 0.38rem; border: 1px solid #e5eaf5; border-radius: 12px; padding: 0.28rem 0.6rem; background: #fafbff; }
.db-tb-kpis .bi-fire { color: #ef4444; font-size: 1rem; }
.db-tb-kpis .bi-gem  { color: #6366f1; font-size: 1rem; }
.db-tb-kpis .bi-clock { color: #64748b; font-size: 1rem; }
.db-tb-kpis strong { display: block; font-size: 1.28rem; font-weight: 800; color: #1f2f47; line-height: 1; }
.db-tb-kpis span   { display: block; font-size: 0.68rem; color: #8a96a8; }
.db-tb-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 0.6rem; }
.db-tb-bell-btn { position: relative; background: none; border: none; padding: 0.25rem 0.4rem; cursor: pointer; color: #475569; font-size: 1rem; line-height: 1; }
.db-tb-badge { position: absolute; top: 0; right: 0; background: #ef4444; color: #fff; border-radius: 999px; font-size: 0.52rem; font-weight: 800; min-width: 13px; height: 13px; display: flex; align-items: center; justify-content: center; padding: 0 2px; }
.db-tb-userpill { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; text-decoration: none; color: inherit; }
.db-tb-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg,#3b5bdb,#5c7cfa); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.74rem; font-weight: 800; flex-shrink: 0; }
.db-tb-userinfo strong { display: block; font-size: 0.86rem; font-weight: 700; color: #1e293b; }
.db-tb-userinfo small  { display: block; color: #64748b; font-size: 0.69rem; }
.db-tb-chevron { color: #94a3b8; font-size: 0.66rem; }

/* Progresso value row */
.prog-val { display: flex; align-items: baseline; gap: 0.35rem; margin-bottom: 0.1rem; }
.prog-val strong { font-size: 1.82rem; font-weight: 800; color: #1f2f47; line-height: 1; }

/* Hero CTA panel */
.hero-side { background: rgba(255,255,255,0.96) !important; border: 1px solid rgba(255,255,255,0.85) !important; border-radius: 14px !important; padding: 1.1rem !important; display: flex !important; flex-direction: column !important; gap: 0.55rem !important; align-items: stretch !important; }
.hero-cta-btn { font-weight: 800 !important; letter-spacing: 0.03em; border-radius: 10px !important; }
.hero-cta-sub  { margin: 0; font-size: 0.8rem; color: #475569; text-align: center; }
.hero-cta-link { font-size: 0.8rem; color: #4f46e5; text-decoration: none; text-align: center; }
.hero-pct-goal { color: #fbbf24 !important; }

/* Activity icons */
.atividade ul li { display: grid !important; grid-template-columns: 40px 26px minmax(0,1fr) auto !important; gap: 0 0.4rem !important; align-items: center; padding: 0.32rem 0; border-bottom: 1px solid #f0f3fa; }
.atividade ul li:last-child { border-bottom: 0; }
.act-time { font-size: 0.77rem; color: #6e7d93; }
.act-ico { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.88rem; flex-shrink: 0; }
.act-ico-green { color: #22c55e; }
.act-ico-purple { background: #7c3aed; color: #fff; }
.act-ico-blue   { background: #3b82f6; color: #fff; }
.act-ico-avatar { font-size: 0.57rem; font-weight: 800; }

/* Week heatmap with labels */
.week-table { display: grid; grid-template-columns: 44px repeat(7,1fr); gap: 4px; margin-bottom: 0.4rem; }
.wt-head, .wt-row { display: contents; }
.wt-head span { text-align: center; font-size: 0.67rem; color: #8a96a8; font-weight: 700; padding-bottom: 2px; }
.wt-lbl { font-size: 0.69rem; color: #8a96a8; font-weight: 600; display: flex; align-items: center; }
.wt-row span:not(.wt-lbl) { aspect-ratio: 1; border-radius: 5px; min-height: 20px; }
.wt-row .lv1 { background: #f0faf1; }
.wt-row .lv2 { background: #d4edda; }
.wt-row .lv3 { background: #a5d6ae; }
.wt-row .lv4 { background: #6abe7a; }
.wt-row .lv5 { background: #3da657; }
.wt-legend { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.wt-legend > span:first-child, .wt-legend > span:last-child { font-size: 0.69rem; color: #94a3b8; }
.wt-lv { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Proximas revisoes / Conquistas items */
.side-list ul li { display: flex !important; justify-content: space-between; align-items: flex-start; gap: 0.4rem; padding: 0.42rem 0; border-bottom: 1px solid #f3f5fa; }
.side-list ul li:last-child { border-bottom: 0; }
.ritem-left { display: flex; align-items: flex-start; gap: 0.42rem; flex: 1; min-width: 0; }
.prio-dot { font-size: 1.05rem; flex-shrink: 0; margin-top: 2px; }
.prio-danger { color: #ef4444; }
.prio-warning { color: #f59e0b; }
.prio-success { color: #22c55e; }
.ritem-wrap { display: flex; flex-direction: column; gap: 1px; line-height: 1.3; font-size: 0.86rem; font-weight: 500; color: #28384e; }
.ritem-tag { font-style: normal; font-size: 0.7rem; font-weight: 700; }
.tag-danger  { color: #ef4444; }
.tag-warning { color: #f59e0b; }
.tag-success { color: #22c55e; }
.ritem-sub { font-style: normal; font-size: 0.71rem; color: #8a96a8; }
.conq-ico { width: 30px; min-width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.84rem; }
.conq-blue   { background: #dbeafe; color: #2563eb; }
.conq-yellow { background: #fef3c7; color: #d97706; }
.conq-purple { background: #ede9fe; color: #7c3aed; }

/* Dashboard UX 2.0 */
.dashboard-ref-shell {
  --ux-space-1: 4px;
  --ux-space-2: 8px;
  --ux-space-3: 12px;
  --ux-space-4: 16px;
  --ux-space-5: 24px;
  --ux-space-6: 32px;
  --ux-space-7: 48px;
  --ux-r-sm: 10px;
  --ux-r-md: 14px;
  --ux-r-lg: 18px;
  --ux-card-border: #e8edf7;
  --ux-card-bg: #ffffff;
  --ux-text-strong: #1f2f47;
  --ux-text: #314257;
  --ux-muted: #7c8ca2;
  --ux-shadow-1: 0 10px 28px rgba(19, 38, 74, 0.06);
  --ux-shadow-2: 0 14px 34px rgba(34, 52, 92, 0.11);
  --ux-fast: 150ms;
  --ux-mid: 250ms;
  --ux-slow: 300ms;
}

.dashboard-ref-shell a,
.dashboard-ref-shell button,
.dashboard-ref-shell article,
.dashboard-ref-shell .bar span,
.sidebar-nav-ref .nav-link {
  transition: transform var(--ux-fast) ease, box-shadow var(--ux-mid) ease, background-color var(--ux-mid) ease, color var(--ux-fast) ease, border-color var(--ux-mid) ease, opacity var(--ux-fast) ease;
}

.dashboard-ref-shell .dashboard-ref-card,
.dashboard-ref-shell .dashboard-ref-hero,
.dashboard-ref-shell .side-plan,
.dashboard-ref-shell .side-list {
  border-radius: var(--ux-r-lg);
  border-color: var(--ux-card-border);
  box-shadow: var(--ux-shadow-1);
}

.dashboard-ref-shell .dashboard-ref-card:hover,
.dashboard-ref-shell .side-plan:hover,
.dashboard-ref-shell .side-list:hover,
.dashboard-ref-shell .prio-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--ux-shadow-2);
}

.dashboard-ref-shell .dashboard-ref-card:focus-within,
.dashboard-ref-shell .prio-item:focus-visible,
.dashboard-ref-shell .timeline-item:focus-visible,
.dashboard-ref-shell .plan-open:focus-visible,
.dashboard-ref-shell .hero-cta-btn:focus-visible,
.db-topbar-shell .db-tb-userpill:focus-visible,
.db-topbar-shell .db-tb-bell-btn:focus-visible,
.sidebar-nav-ref .nav-link:focus-visible {
  outline: 2px solid #4f6cf7;
  outline-offset: 2px;
}

.dashboard-ref-grid {
  gap: var(--ux-space-4);
}

/* Hero as true mission center */
.dashboard-ref-hero.mission-hero {
  position: relative;
  overflow: hidden;
  min-height: 240px;
  padding: var(--ux-space-5);
  grid-template-columns: minmax(0, 1fr) 250px;
  border: 1px solid #dbe6f3;
  border-radius: 18px;
  background:
    radial-gradient(900px 500px at 0% -40%, rgba(14, 165, 233, 0.18) 0%, transparent 54%),
    radial-gradient(900px 480px at 100% 120%, rgba(37, 99, 235, 0.16) 0%, transparent 56%),
    linear-gradient(140deg, #f8fbff 0%, #eef5ff 100%);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
}

.dashboard-ref-hero.mission-hero::after {
  content: '';
  position: absolute;
  right: -48px;
  top: -56px;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  filter: none;
  opacity: 1;
  pointer-events: none;
}

.focus-pill {
  position: absolute;
  right: var(--ux-space-4);
  top: var(--ux-space-4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #1d4ed8;
  background: #eff6ff;
}

.dashboard-ref-hero .hero-kicker {
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  opacity: 1;
  color: #0369a1;
  font-weight: 800;
}

.dashboard-ref-hero h2 {
  font-size: clamp(1.7rem, 2.4vw, 2.8rem);
  margin: 0 0 var(--ux-space-2);
  color: #0f172a;
}

.hero-evolution {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 var(--ux-space-3);
  font-weight: 800;
}

.hero-evolution .ev-from,
.hero-evolution .ev-to {
  font-size: 1.35rem;
  color: #0f172a;
}

.hero-evolution .ev-arrow,
.hero-evolution .ev-delta {
  color: #1d4ed8;
  font-size: 0.95rem;
}

.hero-chips {
  gap: var(--ux-space-2);
}

.hero-chips span {
  min-height: 34px;
  font-size: 0.79rem;
  background: #ffffff;
  border: 1px solid #dbe6f3;
  color: #1e293b;
}

.hero-side {
  position: relative;
  z-index: 1;
  padding: var(--ux-space-4) !important;
  background: rgba(255, 255, 255, 0.97) !important;
}

.hero-cta-btn {
  min-height: 60px;
  font-size: 1.02rem;
  box-shadow: 0 10px 26px rgba(68, 83, 225, 0.35);
}

.hero-cta-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 16px 30px rgba(68, 83, 225, 0.42);
}

/* Visual hierarchy blocks */
.dashboard-priorities,
.dashboard-progress {
  padding: var(--ux-space-4);
}

.dashboard-priorities h3,
.dashboard-progress h3,
.timeline-card h3,
.contrib-card h3,
.mission-plan h3,
.side-list h3 {
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6f7f95;
}

.prioridades-grid {
  gap: var(--ux-space-3);
}

.prio-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 240px;
  border-radius: var(--ux-r-md);
  padding: var(--ux-space-4);
  text-align: left;
}

.prio-item .prio-icon {
  margin: 0;
  width: 44px;
  height: 44px;
}

.prio-item h4 {
  font-size: 1.06rem !important;
  color: var(--ux-text-strong);
}

.prio-item .sub,
.prio-item .prio-status {
  font-size: 0.82rem !important;
}

.prio-item .badge {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.prio-item.urgente {
  background: #fff6f7;
  border-color: #ffdfe3;
}

.prio-item.atencao {
  background: #fffaf1;
  border-color: #ffeccc;
}

.prio-item.emdia {
  background: #f4fcf7;
  border-color: #d8f0e0;
}

.prio-item.plano {
  background: #f5f8ff;
  border-color: #dfe8ff;
}

.prio-btn {
  margin-top: auto;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Larger progress bars + subtle fill animation */
.progresso-grid {
  gap: var(--ux-space-3);
}

.progresso-grid article {
  padding: 14px;
}

.progresso-grid .bar {
  margin-top: 10px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
}

.progresso-grid .bar span {
  animation: uxProgressFill var(--ux-slow) ease both;
}

.trend-up {
  color: #16a34a;
  font-weight: 700;
  font-size: 0.78rem;
}

.trend-down {
  color: #f59e0b;
  font-weight: 700;
  font-size: 0.78rem;
}

/* Timeline */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 46px 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid #eef2f8;
  padding: 8px 0;
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-time {
  color: var(--ux-muted);
  font-size: 0.78rem;
}

.timeline-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #16a34a;
  background: #ebf9ef;
}

.timeline-content {
  min-width: 0;
}

.timeline-title,
.timeline-desc {
  margin: 0;
}

.timeline-title {
  color: var(--ux-text-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

.timeline-desc {
  color: var(--ux-muted);
  font-size: 0.76rem;
  margin-top: 2px;
}

.timeline-xp {
  color: #4f46e5;
  font-size: 0.78rem;
}

/* Contribution heatmap */
.contrib-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-columns: 12px;
  gap: 4px;
  margin-bottom: 10px;
}

.contrib-day {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #edf2f7;
}

.contrib-day.lv1 { background: #d9f0df; }
.contrib-day.lv2 { background: #9dd8ac; }
.contrib-day.lv3 { background: #5ebf78; }
.contrib-day.lv4 { background: #2f9f53; }

.contrib-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.contrib-summary span {
  font-size: 0.74rem;
  color: var(--ux-muted);
}

.contrib-summary strong {
  display: block;
  color: var(--ux-text-strong);
  font-size: 1rem;
}

/* Today plan with quick actions */
.plan-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f3f5fa;
  border-radius: 0;
  padding: 0.42rem 0;
  background: transparent;
}

.plan-row:last-child {
  border-bottom: 0;
}

.mission-plan .plan-row {
  border-bottom: 1px solid #f3f5fa;
  padding: 0.42rem 0;
}

.plan-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.plan-main strong,
.plan-main small,
.plan-status {
  display: block;
}

.plan-main strong {
  font-size: 0.88rem;
  color: var(--ux-text-strong);
}

.plan-main small {
  font-size: 0.74rem;
  color: var(--ux-muted);
}

.plan-status {
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.plan-status.ok { color: #16a34a; }
.plan-status.warn { color: #d97706; }

.plan-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid #d8e1f6;
  color: #3e55c7;
  background: #f6f9ff;
  text-decoration: none;
  font-size: 0.77rem;
  font-weight: 700;
}

.plan-open:hover {
  transform: translateY(-1px);
  background: #edf3ff;
}

.mission-plan .plan-list {
  margin-bottom: 0.85rem;
}

.mission-plan .total {
  margin: 0.85rem 0 0.8rem;
  padding-top: 0.65rem;
  border-top: 1px dashed #e3eaf6;
  line-height: 1.35;
}

.mission-plan .btn.w-100 {
  margin-top: 0 !important;
}

/* Dark mode overrides for Dashboard UX 2.0 — this whole component family
   (dashboard-ref-card/prio-item/plan-list/side-list/timeline/contrib) was
   built with hardcoded light-mode hex values instead of the --mz-* tokens,
   so it never picked up dark mode. Patched here without touching any of
   the existing light-mode rules above. */
html[data-theme='dark'] .dashboard-ref-shell {
  --ux-card-border: var(--mz-border);
  --ux-card-bg: var(--mz-surface);
  --ux-text-strong: var(--mz-text);
  --ux-text: var(--mz-text);
  --ux-muted: var(--mz-text-subtle);
}

html[data-theme='dark'] .dashboard-ref-card,
html[data-theme='dark'] .dashboard-ref-hero,
html[data-theme='dark'] .side-plan-card,
html[data-theme='dark'] .side-list-card {
  background: var(--mz-surface);
  border-color: var(--mz-border);
}

html[data-theme='dark'] .dashboard-ref-card h3,
html[data-theme='dark'] .prio-item h4,
html[data-theme='dark'] .progresso-grid strong,
html[data-theme='dark'] .plan-main strong,
html[data-theme='dark'] .side-plan li span,
html[data-theme='dark'] .side-list li span,
html[data-theme='dark'] .ritem-wrap,
html[data-theme='dark'] .timeline-title,
html[data-theme='dark'] .contrib-summary strong {
  color: var(--mz-text);
}

html[data-theme='dark'] .prio-item.urgente { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.25); }
html[data-theme='dark'] .prio-item.atencao { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.25); }
html[data-theme='dark'] .prio-item.emdia { background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.25); }
html[data-theme='dark'] .prio-item.plano { background: rgba(79, 70, 229, 0.12); border-color: rgba(79, 70, 229, 0.28); }

html[data-theme='dark'] .hero-side {
  background: rgba(15, 23, 42, 0.85) !important;
  border-color: var(--mz-border);
}

html[data-theme='dark'] .hero-side p { color: var(--mz-text-subtle); }

html[data-theme='dark'] .hero-chips span {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--mz-text);
}

html[data-theme='dark'] .bar,
html[data-theme='dark'] .progresso-grid .bar {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .progresso-grid article,
html[data-theme='dark'] .prio-item a,
html[data-theme='dark'] .plan-row,
html[data-theme='dark'] .side-plan li,
html[data-theme='dark'] .side-list li,
html[data-theme='dark'] .atividade li,
html[data-theme='dark'] .timeline-item {
  border-color: var(--mz-border);
}

html[data-theme='dark'] .plan-open {
  background: rgba(79, 70, 229, 0.14);
  border-color: rgba(79, 70, 229, 0.3);
  color: var(--mz-primary-400, #818cf8);
}

html[data-theme='dark'] .plan-open:hover {
  background: rgba(79, 70, 229, 0.22);
}

html[data-theme='dark'] .timeline-icon {
  background: rgba(34, 197, 94, 0.14);
}

html[data-theme='dark'] .contrib-day {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme='dark'] .sidebar-plan-card {
  background: var(--mz-surface-2);
  border-color: var(--mz-border);
}

html[data-theme='dark'] .conq-blue   { background: rgba(37, 99, 235, 0.18); color: #93c5fd; }
html[data-theme='dark'] .conq-yellow { background: rgba(217, 119, 6, 0.18); color: #fcd34d; }
html[data-theme='dark'] .conq-purple { background: rgba(124, 58, 237, 0.18); color: #c4b5fd; }

/* Sidebar micro interactions */
.sidebar-nav-ref .nav-link:hover {
  transform: translateX(2px);
}

/* Focus mode: hide secondary information and amplify mission + progress */
.dashboard-focus-mode .dashboard-priorities,
.dashboard-focus-mode .timeline-card,
.dashboard-focus-mode .contrib-card,
.dashboard-focus-mode .side-list {
  display: none;
}

.dashboard-focus-mode .dashboard-ref-grid {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.dashboard-focus-mode .mission-hero {
  min-height: 280px;
}

.dashboard-focus-mode .dashboard-progress {
  border: 1px solid #d9e3ff;
}

/* Responsive */
@media (max-width: 1280px) {
  .dashboard-ref-hero.mission-hero {
    background-size: auto, auto, 30% auto;
    background-position: left top, left top, right 8% center;
  }

  .prioridades-grid,
  .progresso-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .db-topbar-shell {
    flex-wrap: wrap;
    gap: 10px;
  }

  .db-tb-kpis {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .dashboard-ref-grid,
  .dashboard-ref-bottom,
  .dashboard-focus-mode .dashboard-ref-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-ref-hero.mission-hero {
    grid-template-columns: 1fr;
    background-size: auto, auto, 40% auto;
    background-position: left top, left top, right 12px top 12px;
  }

  .hero-side {
    margin-top: 10px;
  }
}

@media (max-width: 640px) {
  .prioridades-grid,
  .progresso-grid,
  .contrib-summary {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 42px 22px minmax(0, 1fr);
  }

  .timeline-xp {
    grid-column: 3;
    justify-self: start;
  }
}

@keyframes uxProgressFill {
  from { transform: scaleX(0); transform-origin: left center; opacity: 0.6; }
  to { transform: scaleX(1); transform-origin: left center; opacity: 1; }
}

/* Study session page 2.0 */
.study-session-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0.9rem;
}

.study-session-main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.study-session-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
}

.study-session-head h1 {
  margin: 0;
  font-size: 2rem;
  color: #1f2f47;
  font-weight: 800;
}

.study-session-head p {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.9rem;
}

.study-session-head-actions {
  display: inline-flex;
  gap: 0.45rem;
}

.study-hero-card {
  border: 1px solid #dfe7fa;
  border-radius: 16px;
  padding: 1rem;
  background:
    radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.22), transparent 40%),
    linear-gradient(122deg, #463ab8 0%, #4f45d0 55%, #3d34a3 100%);
  color: #ffffff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 0.9rem;
  position: relative;
  overflow: hidden;
}

.study-hero-card::after {
  content: '';
  position: absolute;
  right: 9%;
  top: 20%;
  width: 26%;
  height: 62%;
  background: url('../img/dashboard-hero-mountain.svg') no-repeat center / contain;
  opacity: 0.55;
  pointer-events: none;
}

.study-hero-copy,
.study-hero-cta {
  position: relative;
  z-index: 1;
}

.study-hero-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.82);
}

.study-hero-card h2 {
  margin: 0.22rem 0;
  font-size: 2.35rem;
  line-height: 1.05;
  font-weight: 800;
}

.study-hero-card p {
  margin: 0 0 0.35rem;
  color: #e6e9ff;
}

.study-hero-card.mz-module-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: stretch;
  border: 1px solid #dbe6f3;
  background:
    radial-gradient(900px 500px at 0% -40%, rgba(14, 165, 233, 0.18) 0%, transparent 54%),
    radial-gradient(900px 480px at 100% 120%, rgba(37, 99, 235, 0.16) 0%, transparent 56%),
    linear-gradient(140deg, #f8fbff 0%, #eef5ff 100%);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
}

.study-hero-card.mz-module-hero::after {
  content: none;
}

.study-hero-card.mz-module-hero .study-hero-kicker {
  color: #0369a1;
}

.study-hero-card.mz-module-hero h2 {
  color: #0f172a;
}

.study-hero-card.mz-module-hero p {
  color: #475569;
}

.study-hero-card.mz-module-hero .study-hero-goal {
  color: #1d4ed8;
}

.study-hero-card.mz-module-hero .study-hero-stats span {
  border: 1px solid #dbe6f3;
  background: #ffffff;
  color: #1e293b;
}

.study-hero-goal {
  color: #f7da56;
}

.study-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.study-hero-stats span {
  display: flex;
  align-items: center;
  gap: 0.34rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(18, 20, 68, 0.26);
  padding: 0.38rem 0.5rem;
  font-size: 0.82rem;
}

.study-hero-cta {
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e7ecf7;
  padding: 0.9rem;
  color: #475569;
}

.study-hero-cta .btn {
  font-weight: 800;
  border-radius: 10px;
  min-height: 54px;
}

.study-hero-cta small {
  margin-top: 0.45rem;
  display: block;
  text-align: center;
  font-size: 0.83rem;
}

.study-plan-card,
.study-progress-card,
.study-activity-card,
.study-performance-card,
.study-side-card {
  border: 1px solid #e6ebf6;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.study-plan-card,
.study-progress-card,
.study-activity-card,
.study-performance-card {
  padding: 0.82rem;
}

.study-plan-head,
.study-bottom-head,
.study-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
}

.study-plan-head h3,
.study-bottom-head h3,
.study-progress-head h3,
.study-side-card h4 {
  margin: 0;
  color: #2b3d57;
  font-size: 1rem;
  font-weight: 800;
}

.study-plan-head a,
.study-bottom-head a {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
}

.study-plan-list {
  margin: 0.52rem 0 0;
  padding: 0;
  list-style: none;
}

.study-plan-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 90px auto;
  align-items: center;
  gap: 0.58rem;
  padding: 0.62rem 0;
  border-bottom: 1px dashed #e7ebf3;
}

.study-plan-list li:last-child {
  border-bottom: 0;
}

.study-plan-item-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.study-plan-item-icon.red {
  color: #ef4444;
  background: #fff1f2;
}

.study-plan-item-icon.yellow {
  color: #f59e0b;
  background: #fff7e8;
}

.study-plan-item-icon.green {
  color: #22c55e;
  background: #ecfdf3;
}

.study-plan-item-copy strong {
  display: block;
  color: #2a3b53;
}

.study-plan-item-copy small {
  display: block;
  color: #73839a;
  font-size: 0.78rem;
}

.study-plan-item-time {
  color: #607088;
  font-size: 0.82rem;
  white-space: nowrap;
}

.study-plan-item-time i {
  margin-right: 2px;
}

.study-progress-head span {
  font-size: 0.83rem;
  color: #64748b;
}

.study-progress-card .progress {
  margin-top: 0.28rem;
  height: 10px;
}

.study-metrics-grid {
  margin-top: 0.62rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.study-metric-item {
  border: 1px solid #ebeff6;
  border-radius: 10px;
  padding: 0.45rem;
}

.study-metric-item span {
  display: block;
  color: #76869e;
  font-size: 0.73rem;
}

.study-metric-item strong {
  display: block;
  color: #23344c;
  font-size: 1.55rem;
  line-height: 1.03;
}

.study-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.72rem;
}

.study-history-list {
  list-style: none;
  margin: 0.55rem 0 0.7rem;
  padding: 0;
}

.study-history-list li {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 72px;
  gap: 0.5rem;
  align-items: center;
  border-bottom: 1px dashed #e8edf6;
  padding: 0.45rem 0;
}

.study-history-list li:last-child {
  border-bottom: 0;
}

.history-time {
  color: #7a8aa0;
  font-size: 0.78rem;
}

.history-copy strong {
  display: block;
  color: #2a3b53;
  font-size: 0.86rem;
  line-height: 1.25;
}

.history-copy small {
  display: block;
  color: #7a8aa0;
  font-size: 0.75rem;
}

.history-result {
  color: #4f46e5;
  font-weight: 700;
  font-size: 0.78rem;
  text-align: right;
}

html[data-theme='dark'] .history-time,
html[data-theme='dark'] .history-copy small {
  color: var(--mz-text-muted);
}

html[data-theme='dark'] .history-copy strong {
  color: var(--mz-text);
}

html[data-theme='dark'] .history-result {
  color: #a5b4fc;
}

.study-session-side {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.study-side-card {
  padding: 0.82rem;
}

.study-side-card h4 {
  margin-bottom: 0.62rem;
}

.study-side-card .review-achievement-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.study-side-card .review-achievement-list li {
  border: 1px solid #edf1f8;
  border-radius: 10px;
  padding: 0.42rem 0.5rem;
  background: #fafcff;
  color: #41556f;
}

.study-side-card .review-achievement-list li strong {
  color: #2b3d57;
  font-size: 0.84rem;
}

.study-side-card .review-achievement-list li small {
  color: #7b8ca2;
  font-size: 0.74rem;
}

.study-side-card .review-memory-map,
.study-side-card .review-heatmap-grid {
  margin-top: 0.15rem;
}

/* Library page aligned with study session layout */
.library-page-shell--study-like .library-workspace {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0.9rem;
  align-items: start;
}

.library-page-shell--study-like .library-pro-main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.library-page-shell--study-like .library-pro-main .card,
.library-page-shell--study-like .library-pro-main .library-pane,
.library-page-shell--study-like .library-pro-doc {
  border: 1px solid #e6ebf6 !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04) !important;
}

.library-page-shell--study-like .library-pro-right {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.library-page-shell--study-like .library-pro-right .library-pane {
  border: 1px solid #e6ebf6 !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04) !important;
  padding: 0.82rem;
  overflow: hidden;
}

.library-page-shell--study-like .library-pro-right .library-pane h2,
.library-page-shell--study-like .library-pro-right .library-pane .h6 {
  margin: 0 0 0.62rem;
  color: #2b3d57;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.library-page-shell--study-like .library-pro-right .library-highlight-detail-box {
  border-color: #d9e3f2;
  background: #f3f7fe;
}

.library-page-shell--study-like .library-pro-right .library-highlight-perf-hint,
.library-page-shell--study-like .library-pro-right .library-highlight-page-info,
.library-page-shell--study-like .library-pro-right .library-highlight-empty {
  color: #4e627d;
}

.library-right-tree-pane #libraryTree {
  display: grid;
  gap: 2px;
}

.library-right-tree-pane .library-tree-item {
  background: transparent;
  border: 0;
  color: #1f2f47;
  border-radius: 6px;
  padding: 0.34rem 0.5rem;
  align-items: center;
}

.library-right-tree-pane .library-tree-item:hover {
  background: #eef2f6;
  box-shadow: none;
  transform: none;
}

.library-right-tree-pane .library-tree-item.active {
  background: #e7ecf3;
  box-shadow: inset 0 0 0 1px #d4dde8;
  transform: none;
}

.library-right-tree-pane .library-tree-chip {
  background: transparent;
  color: #6a7890;
  border-color: transparent;
}

.library-right-tree-pane .library-tree-item .fw-semibold {
  font-size: 0.82rem;
  font-weight: 600 !important;
}

.library-right-tree-pane .library-tree-item-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 auto;
}

.library-right-tree-pane .library-tree-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-right-tree-pane .library-tree-type-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 0;
  padding: 0;
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #8a96aa;
  background: transparent;
  border: 0;
  flex: 0 0 auto;
}

.library-right-tree-pane .library-tree-item small {
  font-size: 0.64rem;
}

.library-right-tree-pane .library-tree-item-icon {
  width: 0.86rem;
  height: 0.86rem;
  border-radius: 0.2rem;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5b6b86;
  line-height: 1;
  flex: 0 0 auto;
}

.library-right-tree-pane .library-tree-item-icon i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.library-right-tree-pane .library-tree-chip {
  font-size: 0.7rem;
  width: 1.28rem;
  min-width: 1.28rem;
  height: 1.28rem;
  padding: 0;
  margin-left: 0.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: visible;
  background: #f3f4f6;
  border: 1px solid #d5dbe3;
  color: #334155;
}

.library-right-tree-pane .library-tree-chip i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.72rem;
  line-height: 1;
  color: #334155 !important;
  opacity: 1;
  visibility: visible;
  font-family: "bootstrap-icons" !important;
}

.library-right-tree-pane .library-tree-chip i::before {
  color: #334155 !important;
  font-size: 0.72rem !important;
}

.library-right-tree-pane .library-tree-item-head {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.library-right-tree-pane .library-tree-item {
  overflow: visible;
}

.library-right-tree-pane .library-tree-action-btn {
  color: #4b5e7c;
}

.library-right-tree-pane .library-tree-action-btn:hover {
  color: #31455f;
}

.library-page-shell--study-like .library-content-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
}

.library-page-shell--study-like .library-pro-list-row > .card {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.library-page-shell--study-like .library-pro-list-row {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0;
}

.library-page-shell--study-like .library-pro-main .library-pro-list-row {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.library-page-shell--study-like .library-pro-list-row > .card > .card-body {
  padding: 0;
}

.library-page-shell--study-like .library-pro-main .library-pro-list-row > .card {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  border-radius: 0 !important;
}

.library-page-shell--study-like .library-pro-main .library-pro-list-row > .card > .card-body {
  background: transparent !important;
}

.library-page-shell--study-like .library-pro-list-row .library-content-table-wrap {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.library-page-shell--study-like .library-pro-list-row .card,
.library-page-shell--study-like .library-pro-list-row .card-body,
.library-page-shell--study-like .library-pro-list-row .library-content-table,
.library-page-shell--study-like .library-pro-list-row .library-content-table thead,
.library-page-shell--study-like .library-pro-list-row .library-content-table tbody,
.library-page-shell--study-like .library-pro-list-row .library-content-table tr,
.library-page-shell--study-like .library-pro-list-row .library-content-table th,
.library-page-shell--study-like .library-pro-list-row .library-content-table td {
  border: 0 !important;
  box-shadow: none !important;
}

.library-page-shell--study-like .library-content-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.library-page-shell--study-like .library-content-table thead th {
  border-bottom: 0;
}

.library-page-shell--study-like .library-content-row td {
  border-top: 0;
  border-bottom: 0;
}

.library-page-shell--study-like .library-content-table th:nth-child(1),
.library-page-shell--study-like .library-content-table td:nth-child(1) {
  width: 49%;
}

.library-page-shell--study-like .library-content-table th:nth-child(2),
.library-page-shell--study-like .library-content-table td:nth-child(2) {
  width: 14%;
}

.library-page-shell--study-like .library-content-table th:nth-child(3),
.library-page-shell--study-like .library-content-table td:nth-child(3) {
  width: 18%;
}

.library-page-shell--study-like .library-content-table th:nth-child(4),
.library-page-shell--study-like .library-content-table td:nth-child(4),
.library-page-shell--study-like .library-content-table th:nth-child(5),
.library-page-shell--study-like .library-content-table td:nth-child(5) {
  width: 9.5%;
}

.library-page-shell--study-like .library-content-table thead th:nth-child(4),
.library-page-shell--study-like .library-content-table thead th:nth-child(5) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.64rem;
  letter-spacing: 0.03em;
}

.library-page-shell--study-like .library-content-node {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-page-shell--study-like #libraryTagsSidebar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.library-page-shell--study-like #libraryTagsSidebar .library-tag-chip {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.15;
}

.library-page-shell--study-like .library-content-tag-row .library-table-tag {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1430px) {
  .library-page-shell--study-like .library-workspace {
    grid-template-columns: minmax(0, 1fr) 290px;
  }
}

@media (max-width: 1200px) {
  .library-page-shell--study-like .library-workspace {
    grid-template-columns: 1fr;
  }

  .library-page-shell--study-like .library-pro-right {
    order: -1;
  }
}

.reviews-page #reviewStartSessionBtn,
.reviews-page #reviewStartSessionCta {
  transition: transform 150ms ease, box-shadow 250ms ease;
}

.reviews-page #reviewStartSessionBtn:hover,
.reviews-page #reviewStartSessionCta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.25);
}

@media (max-width: 1430px) {
  .study-session-shell {
    grid-template-columns: minmax(0, 1fr) 290px;
  }

  .study-hero-card h2 {
    font-size: 2rem;
  }
}

@media (max-width: 1200px) {
  .study-session-shell,
  .study-bottom-grid {
    grid-template-columns: 1fr;
  }

  /* Sem min-width:0, um item de grid nao encolhe abaixo do tamanho intrinseco
     do conteudo — um <canvas> do Chart.js com width/height fixados via atributo
     HTML (ex.: reviewRetentionChart) forcava a coluna inteira a ficar larga,
     estourando o layout no mobile mesmo com grid-template-columns: 1fr. */
  .study-session-shell > *,
  .study-bottom-grid > * {
    min-width: 0;
  }

  .study-session-side {
    order: -1;
  }
}

@media (max-width: 920px) {
  .study-session-head {
    flex-direction: column;
  }

  .study-hero-card,
  .study-hero-card.mz-module-hero {
    grid-template-columns: 1fr;
  }

  .study-hero-stats {
    grid-template-columns: 1fr;
  }

  .study-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .study-plan-list li {
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-areas:
      'icon copy'
      'icon time'
      'icon action';
  }

  .study-plan-list li .study-plan-item-icon { grid-area: icon; }
  .study-plan-list li .study-plan-item-copy { grid-area: copy; }
  .study-plan-list li .study-plan-item-time { grid-area: time; }
  .study-plan-list li .btn { grid-area: action; justify-self: start; }
}

.highlights-central-page {
  display: grid;
  gap: 1rem;
}

.mz-module-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-radius: 18px;
  border: 1px solid #dbe6f3;
  background:
    radial-gradient(900px 500px at 0% -40%, rgba(14, 165, 233, 0.16) 0%, transparent 54%),
    radial-gradient(900px 480px at 100% 120%, rgba(37, 99, 235, 0.14) 0%, transparent 56%),
    linear-gradient(140deg, #f8fbff 0%, #eef5ff 100%);
  padding: 1.15rem;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.mz-module-hero .mz-hero-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0369a1;
  font-weight: 800;
}

.mz-module-hero .mz-hero-title {
  margin: 0.2rem 0 0.42rem;
  color: #0f172a;
  font-weight: 800;
  font-size: clamp(1.35rem, 2.1vw, 1.95rem);
}

.mz-module-hero .mz-hero-subtitle {
  margin: 0;
  color: #475569;
}

.mz-module-hero .mz-hero-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.highlights-central-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.15rem;
  border-radius: 18px;
  border: 1px solid rgba(14, 165, 233, 0.2);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(34, 197, 94, 0.08));
}

.highlights-central-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #0369a1;
  font-weight: 700;
}

.highlights-central-hero h1 {
  margin: 0.15rem 0 0.4rem;
  font-size: 1.65rem;
}

.highlights-central-hero p {
  margin: 0;
  color: #475569;
}

.highlights-central-hero-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.highlights-central-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 0.7rem;
}

.highlights-kpi-card {
  border: 1px solid #dbe6f3;
  border-radius: 14px;
  background: #fff;
  padding: 0.75rem 0.85rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.highlights-kpi-card span {
  display: block;
  font-size: 0.76rem;
  color: #64748b;
}

.highlights-kpi-card strong {
  font-size: 1.2rem;
  color: #0f172a;
}

.highlights-central-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 1rem;
}

.highlights-central-column {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.highlights-panel-card {
  border: 1px solid #dbe6f3;
  border-radius: 16px;
  padding: 1rem;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.highlights-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.highlights-panel-head h2 {
  margin: 0;
  font-size: 1rem;
}

.highlights-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 0.7rem;
}

.highlights-filter-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.55rem;
}

.highlights-central-list {
  display: grid;
  gap: 0.7rem;
}

.highlights-list-empty,
.highlights-empty-block {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 0.8rem;
  color: #64748b;
  font-size: 0.92rem;
}

.highlight-central-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.85rem;
  display: grid;
  gap: 0.6rem;
  background: #ffffff;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.highlight-central-card:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.12);
}

.highlight-central-card.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25), 0 12px 26px rgba(37, 99, 235, 0.16);
}

.highlight-central-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.highlight-central-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.highlight-central-card p {
  margin: 0;
  color: #0f172a;
}

.highlight-central-card footer {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
}

.highlight-central-meta {
  font-size: 0.85rem;
  color: #334155;
}

.highlight-central-actions {
  display: flex;
  gap: 0.45rem;
}

.highlight-central-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.highlight-central-tags span {
  font-size: 0.72rem;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.15rem 0.46rem;
  color: #1e3a8a;
}

.highlights-load-more-wrap {
  margin-top: 0.7rem;
}

.highlights-coverage-score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.7rem;
  background: #eff6ff;
}

.highlights-coverage-score strong {
  font-size: 1.15rem;
  color: #1d4ed8;
}

.highlights-coverage-signals {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.highlights-coverage-signals span {
  font-size: 0.86rem;
  color: #334155;
}

.highlights-mini-list-wrap h3 {
  font-size: 0.86rem;
  margin: 0.45rem 0;
}

.highlights-mini-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
}

.highlights-mini-list li small {
  display: block;
  color: #64748b;
}

.highlights-timeline-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.55rem;
}

.highlights-timeline-list li {
  display: grid;
  gap: 0.15rem;
}

.highlights-timeline-list span,
.highlights-timeline-list small {
  color: #64748b;
}

.highlights-recommendation-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.highlights-recommendation-list li {
  border: 1px solid #dbe6f3;
  border-radius: 10px;
  padding: 0.6rem;
}

.highlights-recommendation-list button {
  text-decoration: none;
}

.highlights-recommendation-list small {
  display: block;
  color: #64748b;
}

/* Dark mode — .mz-module-hero (compartilhado por Estatísticas e Central de Destaques)
   e todo o modulo highlights (.highlights-central-page e .highlight-central-card)
   foram construidos com cores claras fixas (fundo branco, tons pastel), sem
   nenhuma variante escura. */
html[data-theme='dark'] .mz-module-hero {
  border-color: var(--mz-border);
  background:
    radial-gradient(900px 500px at 0% -40%, rgba(14, 165, 233, 0.12) 0%, transparent 54%),
    radial-gradient(900px 480px at 100% 120%, rgba(37, 99, 235, 0.12) 0%, transparent 56%),
    var(--mz-surface);
}

html[data-theme='dark'] .mz-module-hero .mz-hero-kicker {
  color: #7dd3fc;
}

html[data-theme='dark'] .mz-module-hero .mz-hero-title {
  color: var(--mz-text);
}

html[data-theme='dark'] .mz-module-hero .mz-hero-subtitle {
  color: var(--mz-text-subtle);
}

html[data-theme='dark'] .highlights-central-hero {
  border-color: rgba(14, 165, 233, 0.28);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(34, 197, 94, 0.1));
}

html[data-theme='dark'] .highlights-central-kicker {
  color: #7dd3fc;
}

html[data-theme='dark'] .highlights-central-hero h1 {
  color: var(--mz-text);
}

html[data-theme='dark'] .highlights-central-hero p {
  color: var(--mz-text-subtle);
}

html[data-theme='dark'] .highlights-kpi-card,
html[data-theme='dark'] .highlights-panel-card,
html[data-theme='dark'] .highlight-central-card,
html[data-theme='dark'] .highlights-recommendation-list li {
  background: var(--mz-surface);
  border-color: var(--mz-border);
}

html[data-theme='dark'] .highlights-kpi-card span {
  color: var(--mz-text-muted);
}

html[data-theme='dark'] .highlights-kpi-card strong,
html[data-theme='dark'] .highlight-central-card p {
  color: var(--mz-text);
}

html[data-theme='dark'] .highlights-list-empty,
html[data-theme='dark'] .highlights-empty-block {
  border-color: var(--mz-border);
  color: var(--mz-text-muted);
}

html[data-theme='dark'] .highlight-central-card:hover {
  border-color: rgba(96, 165, 250, 0.45);
}

html[data-theme='dark'] .highlight-central-card.is-active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35), 0 12px 26px rgba(59, 130, 246, 0.18);
}

html[data-theme='dark'] .highlight-central-chip {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

html[data-theme='dark'] .highlight-central-meta {
  color: var(--mz-text-subtle);
}

html[data-theme='dark'] .highlight-central-tags span {
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd;
}

html[data-theme='dark'] .highlights-coverage-score {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(59, 130, 246, 0.12);
}

html[data-theme='dark'] .highlights-coverage-score strong {
  color: #93c5fd;
}

html[data-theme='dark'] .highlights-coverage-signals span,
html[data-theme='dark'] .highlights-mini-list li small,
html[data-theme='dark'] .highlights-timeline-list span,
html[data-theme='dark'] .highlights-timeline-list small,
html[data-theme='dark'] .highlights-recommendation-list small {
  color: var(--mz-text-muted);
}

@media (max-width: 1200px) {
  .highlights-central-kpis {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .highlights-central-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mz-module-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .highlights-central-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .highlights-central-kpis {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .highlights-filter-grid {
    grid-template-columns: 1fr;
  }

  .highlight-central-card footer {
    flex-direction: column;
  }
}

.achievements-page {
  display: grid;
  gap: 1rem;
}

.achievements-page > * {
  min-width: 0;
}

/* ── Hero: fixed purple gradient, white text (same "always-on" pattern
   as other module heroes — intentionally not theme-reactive). ── */
.ac-hero {
  border-radius: 18px;
  background:
    radial-gradient(900px 500px at 0% -40%, rgba(255, 255, 255, 0.12) 0%, transparent 54%),
    linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  box-shadow: 0 16px 36px rgba(79, 70, 229, 0.28);
  padding: 1.35rem 1.5rem;
  color: #ffffff;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: space-between;
  align-items: center;
}

.ac-hero-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1 1 320px;
}

.ac-hero-level-badge {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.ac-hero-level-badge strong { font-size: 1.3rem; font-weight: 800; }
.ac-hero-level-badge span { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; }

.ac-hero-copy { min-width: 0; flex: 1 1 auto; }

.ac-hero-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
  opacity: 0.85;
}

.ac-hero-copy h1 {
  margin: 0.2rem 0 0.55rem;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  font-weight: 800;
  color: #fff;
}

.ac-hero-xp-row {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  font-size: 0.78rem;
  opacity: 0.92;
  margin-bottom: 0.3rem;
}

.ac-hero-xpbar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
  max-width: 320px;
}

.ac-hero-xpbar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #fff;
  transition: width 0.25s ease;
}

.ac-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 0.6rem;
  flex: 0 0 auto;
}

.ac-hero-stat {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 0.5rem 0.75rem;
  display: grid;
  gap: 0.1rem;
  min-width: 90px;
}

.ac-hero-stat strong { font-size: 1.15rem; font-weight: 800; color: #fff; }
.ac-hero-stat span { font-size: 0.68rem; opacity: 0.85; }

/* ── Toolbar: tabs + secondary filters ── */
.ac-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ac-toolbar-extra {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ac-toolbar-extra .form-select {
  min-width: 160px;
}

.ac-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 0.9rem;
}

.ac-main-column,
.ac-side-column {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.ac-count-label {
  color: var(--mz-text-subtle);
  font-size: 0.8rem;
}

.ac-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.7rem;
}

.ac-card {
  border-radius: 14px;
  border: 1px solid var(--mz-border);
  background: var(--mz-surface);
  padding: 0.85rem;
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

.ac-card.is-unlocked {
  border-color: var(--mz-success);
}

.ac-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.ac-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.ac-card-check {
  color: var(--mz-success);
  font-size: 1.1rem;
}

.ac-card h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--mz-text);
}

.ac-card p {
  margin: 0;
  color: var(--mz-text-subtle);
  font-size: 0.82rem;
}

.ac-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  color: var(--mz-text-muted);
  font-size: 0.74rem;
}

.ac-card-progress {
  width: 100%;
  height: 7px;
  background: var(--mz-bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.ac-card-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.2s ease;
}

.ac-card small {
  color: var(--mz-text-muted);
  font-size: 0.72rem;
}

.ac-badge-rarity {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rarity-common  .ac-badge-rarity { color: #64748b; }
.rarity-common  .ac-card-icon,  .rarity-common  .ac-card-progress span { background: #94a3b8; color: #fff; }
.rarity-uncommon .ac-badge-rarity { color: #15803d; }
.rarity-uncommon .ac-card-icon, .rarity-uncommon .ac-card-progress span { background: #22c55e; color: #fff; }
.rarity-rare    .ac-badge-rarity { color: #1d4ed8; }
.rarity-rare    .ac-card-icon,  .rarity-rare    .ac-card-progress span { background: #3b82f6; color: #fff; }
.rarity-epic    .ac-badge-rarity { color: #be185d; }
.rarity-epic    .ac-card-icon,  .rarity-epic    .ac-card-progress span { background: #ec4899; color: #fff; }
.rarity-legendary .ac-badge-rarity { color: #b45309; }
.rarity-legendary .ac-card-icon { background: linear-gradient(135deg, #f59e0b, #eab308); color: #fff; }
.rarity-legendary .ac-card-progress span { background: linear-gradient(90deg, #f59e0b 0%, #eab308 100%); }

.ac-empty {
  color: var(--mz-text-muted);
  font-size: 0.82rem;
  padding: 0.5rem 0;
}

/* ── Sidebar ── */
.ac-side-card {
  border-radius: 14px;
  border: 1px solid var(--mz-border);
  background: var(--mz-surface);
  padding: 0.9rem;
}

.ac-side-title {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--mz-text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ac-ring-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ac-ring-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--mz-text-subtle);
}

.ac-mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.ac-mini-list li {
  border: 1px solid var(--mz-border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  display: grid;
  gap: 0.2rem;
}

.ac-mini-list li strong {
  font-size: 0.84rem;
  color: var(--mz-text);
}

.ac-mini-list li small {
  color: var(--mz-text-muted);
  font-size: 0.74rem;
}

.ac-mini-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--mz-bg-subtle);
  overflow: hidden;
}

.ac-mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mz-secondary-600);
}

.ac-rank-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--mz-border);
  font-size: 0.85rem;
}

.ac-rank-row:last-child { border-bottom: none; }

.ac-rank-pos {
  width: 22px;
  flex-shrink: 0;
  font-weight: 800;
  color: var(--mz-text-muted);
  text-align: center;
}

.ac-rank-row:nth-child(1) .ac-rank-pos { color: #eab308; }
.ac-rank-row:nth-child(2) .ac-rank-pos { color: #94a3b8; }
.ac-rank-row:nth-child(3) .ac-rank-pos { color: #b45309; }

.ac-rank-name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--mz-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-rank-xp {
  color: var(--mz-text-subtle);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.ac-rank-you {
  background: var(--mz-secondary-50);
  border-radius: 8px;
  margin: 0.3rem -0.4rem 0;
  padding: 0.45rem 0.65rem;
  border-bottom: none;
}

html[data-theme='dark'] .ac-rank-you { background: rgba(99, 102, 241, 0.14); }

@media (max-width: 1200px) {
  .ac-hero-stats { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
  .ac-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .ac-hero { flex-direction: column; align-items: stretch; }
  .ac-hero-xpbar { max-width: none; }
  .ac-hero-stats { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
  .ac-list { grid-template-columns: 1fr; }
  .ac-toolbar { flex-direction: column; align-items: stretch; }
}

/* ══════════════════════ Meu Perfil ══════════════════════ */
.profile-page {
  display: grid;
  gap: 1rem;
}

.profile-page > * {
  min-width: 0;
}

.pf-hero {
  border-radius: 18px;
  background:
    radial-gradient(900px 500px at 100% -40%, rgba(255, 255, 255, 0.08) 0%, transparent 54%),
    linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #312e81 100%);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.25);
  padding: 1.35rem 1.5rem;
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: space-between;
  align-items: center;
}

.pf-hero-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1 1 340px;
}

.pf-hero-avatar {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  border: 3px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.pf-hero-avatar img { width: 100%; height: 100%; object-fit: cover; }

.pf-hero-copy { min-width: 0; }

.pf-hero-name-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.pf-hero-copy h1 {
  margin: 0;
  font-size: clamp(1.2rem, 1.9vw, 1.55rem);
  font-weight: 800;
  color: #fff;
}

.pf-hero-plan-badge {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

.pf-hero-bio {
  margin: 0.35rem 0 0.5rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.85rem;
  max-width: 480px;
}

.pf-hero-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
}

.pf-hero-meta-row span { display: inline-flex; align-items: center; gap: 0.3rem; }

.pf-hero-actions { flex-shrink: 0; }

.pf-stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.7rem;
}

.pf-stat-card {
  border-radius: 14px;
  border: 1px solid var(--mz-border);
  background: var(--mz-surface);
  padding: 0.8rem;
  text-align: center;
}

.pf-stat-card strong { display: block; font-size: 1.3rem; font-weight: 800; color: var(--mz-text); }
.pf-stat-card span { font-size: 0.72rem; color: var(--mz-text-subtle); }

.pf-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 0.9rem;
}

.pf-main-column,
.pf-side-column {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.pf-card {
  border-radius: 14px;
  border: 1px solid var(--mz-border);
  background: var(--mz-surface);
  padding: 0.9rem;
}

.pf-card-title {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--mz-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.pf-card-title i { color: var(--mz-secondary-600); margin-right: 0.35rem; }

.pf-chart-wrap { min-width: 0; height: 160px; }

.pf-empty { color: var(--mz-text-muted); font-size: 0.82rem; padding: 0.3rem 0; }

.pf-achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.6rem;
}

.pf-achievement-card {
  border: 1px solid var(--mz-border);
  border-radius: 12px;
  padding: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.pf-achievement-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pf-achievement-card strong { display: block; font-size: 0.82rem; color: var(--mz-text); }
.pf-achievement-card small { color: var(--mz-text-muted); font-size: 0.72rem; }

.pf-activity-list, .pf-mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.pf-activity-list li, .pf-mini-list li {
  border: 1px solid var(--mz-border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
}

.pf-activity-list li strong, .pf-mini-list li strong { display: block; font-size: 0.83rem; color: var(--mz-text); }
.pf-activity-list li small, .pf-mini-list li small { color: var(--mz-text-muted); font-size: 0.73rem; }

.pf-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--mz-border);
}

.pf-pref-row:last-child { border-bottom: none; }
.pf-pref-label { font-size: 0.78rem; color: var(--mz-text-subtle); }
.pf-pref-value { font-size: 0.85rem; color: var(--mz-text); font-weight: 600; }
.pf-pref-value.is-empty { color: var(--mz-text-muted); font-weight: 400; font-style: italic; }

.pf-general-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  font-size: 0.83rem;
}

.pf-general-stats li { display: flex; justify-content: space-between; color: var(--mz-text-subtle); }
.pf-general-stats li strong { color: var(--mz-text); }

.pf-quick-actions { display: grid; gap: 0.5rem; }

.pf-quick-actions .btn { text-align: left; justify-content: flex-start; }

.pf-danger-btn {
  color: var(--mz-danger-dark);
  border-color: var(--mz-danger-light);
}

html[data-theme='dark'] .pf-danger-btn { border-color: rgba(248, 113, 113, 0.4); }

/* Contas conectadas (login social) */
.pf-provider-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--mz-border);
}

.pf-provider-row:last-child { border-bottom: none; }

.pf-provider-row.is-disabled { opacity: 0.55; }

.pf-provider-icon {
  width: 34px;
  height: 34px;
  border-radius: 0.6rem;
  background: var(--mz-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.05rem;
  color: var(--mz-text-subtle);
}

.pf-provider-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.pf-provider-info strong { font-size: 0.86rem; color: var(--mz-text); }

.pf-provider-info small { font-size: 0.72rem; color: var(--mz-text-subtle); }

.pf-provider-status {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--mz-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.pf-provider-status.connected { color: var(--mz-success-dark); }

.pf-google-only-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--mz-secondary-50, #f5f3ff);
  border: 1px solid var(--mz-secondary-200, #ddd6fe);
  border-radius: 0.9rem;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
}

.pf-google-only-banner strong { display: block; font-size: 0.9rem; color: var(--mz-text); }

.pf-google-only-banner p { font-size: 0.8rem; color: var(--mz-text-subtle); }

html[data-theme='dark'] .pf-google-only-banner {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.28);
}

@media (max-width: 1200px) {
  .pf-stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pf-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .pf-hero { flex-direction: column; align-items: stretch; }
  .pf-stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Bootstrap 5 does not ship a min-width utility out of the box. */
.min-width-0 { min-width: 0; }

/* ══════════════════════ Meus Dados (/meusdados) ══════════════════════ */

/* Badges genericos do Design System (ate agora so existiam na pagina de
   showcase design-system/index.php) — trazidos pro app.css global pra
   ficarem disponiveis em qualquer tela, com os mesmos tokens de cor. */
.mds-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--mz-radius-full);
  font-size: var(--mz-text-xs);
  font-weight: var(--mz-font-bold);
  letter-spacing: 0.02em;
}

.mds-badge-success { background: var(--mz-success-light); color: var(--mz-success-dark); }
.mds-badge-warning  { background: var(--mz-warning-light); color: var(--mz-warning-dark); }
.mds-badge-danger   { background: var(--mz-danger-light); color: var(--mz-danger-dark); }

.ac-unverified {
  font-size: 0.7rem;
  color: var(--mz-warning-dark);
  font-weight: 600;
}

.pf-hero-avatar { position: relative; }

.ac-avatar-edit-btn {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--mz-surface);
  border: 2px solid var(--mz-secondary-600);
  color: var(--mz-secondary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
}

.ac-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.ac-field-full { grid-column: 1 / -1; }

.ac-field label { font-size: 0.78rem; color: var(--mz-text-subtle); margin-bottom: 0.25rem; }

.ac-switch-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.ac-security-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--mz-border);
  flex-wrap: wrap;
}

.ac-security-row:last-of-type { border-bottom: none; }

.ac-security-sub { font-size: 0.78rem; color: var(--mz-text-subtle); margin: 0.15rem 0 0; }

.ac-sessions-block { margin-top: 0.5rem; }

.ac-sessions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.ac-session-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--mz-border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

.ac-session-row.is-current { border-color: var(--mz-success-dark); }

.ac-session-icon {
  width: 32px;
  height: 32px;
  border-radius: 0.55rem;
  background: var(--mz-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mz-text-subtle);
  flex-shrink: 0;
}

.ac-session-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.ac-session-info strong { font-size: 0.82rem; color: var(--mz-text); }
.ac-session-info small { font-size: 0.72rem; color: var(--mz-text-subtle); }

.ac-plan-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.ac-plan-name-row strong { font-size: 1rem; color: var(--mz-text); }

.ac-plan-details {
  list-style: none;
  margin: 0 0 0.8rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.ac-plan-details li { display: flex; justify-content: space-between; color: var(--mz-text-subtle); }
.ac-plan-details li strong { color: var(--mz-text); }

.ac-plan-actions { display: grid; gap: 0.5rem; }

.ac-google-connected {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.ac-google-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.ac-google-connected strong { display: block; font-size: 0.85rem; color: var(--mz-text); }
.ac-google-connected small { display: block; font-size: 0.72rem; color: var(--mz-text-subtle); }

.ac-danger-card { border-color: var(--mz-danger-light); }
html[data-theme='dark'] .ac-danger-card { border-color: rgba(248, 113, 113, 0.35); }

.ac-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1080;
  padding: 1rem;
}

.ac-modal {
  background: var(--mz-surface);
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.ac-qr-canvas {
  display: block;
  margin: 0.6rem auto;
  max-width: 220px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--mz-border);
}

.ac-backup-codes {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  font-family: monospace;
  font-size: 0.85rem;
}

.ac-backup-codes li {
  background: var(--mz-bg-subtle);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  text-align: center;
}

@media (max-width: 768px) {
  .ac-form-grid { grid-template-columns: 1fr; }
  .ac-backup-codes { grid-template-columns: 1fr; }
}

/* Campos nativos do Bootstrap (.form-control/.form-select/.form-check-input)
   nunca tinham sido usados soltos no corpo de uma pagina do painel antes —
   so dentro de modais SweetAlert (que tem seu proprio tema). Sem isso, os
   campos ficam brancos mesmo com o resto da tela em modo escuro. */
html[data-theme='dark'] .form-control,
html[data-theme='dark'] .form-select {
  background-color: var(--mz-bg-subtle);
  border-color: var(--mz-border);
  color: var(--mz-text);
}

html[data-theme='dark'] .form-control:focus,
html[data-theme='dark'] .form-select:focus {
  background-color: var(--mz-bg-subtle);
  color: var(--mz-text);
  border-color: var(--mz-secondary-600);
  box-shadow: 0 0 0 0.2rem rgba(139, 92, 246, 0.25);
}

html[data-theme='dark'] .form-control::placeholder { color: var(--mz-text-muted); }
html[data-theme='dark'] .form-control:disabled { background-color: var(--mz-border); opacity: 0.7; }
html[data-theme='dark'] .form-select { color-scheme: dark; }
html[data-theme='dark'] .form-control[type='date'] { color-scheme: dark; }

/* ══════════════════════ Comunidade ══════════════════════ */
.cm-page {
  display: grid;
  gap: 1rem;
}

.cm-page > * {
  min-width: 0;
}

.cm-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.cm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 0.9rem;
}

.cm-main-column,
.cm-side-column {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.cm-card {
  border-radius: 14px;
  border: 1px solid var(--mz-border);
  background: var(--mz-surface);
  overflow: hidden;
}

.cm-card-toolbar {
  padding: 0.6rem 1rem 0;
}

.cm-composer {
  padding: 1rem;
  border-bottom: 1px solid var(--mz-border);
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.cm-composer-body { flex: 1 1 auto; min-width: 0; }

.cm-composer textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--mz-border);
  border-radius: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--mz-bg-subtle);
  color: var(--mz-text);
  font-family: inherit;
  font-size: 0.85rem;
  box-sizing: border-box;
}

.cm-composer textarea:focus {
  outline: none;
  border-color: var(--mz-secondary-600);
  box-shadow: 0 0 0 3px var(--mz-secondary-50);
}

.cm-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
}

.cm-avatar img { width: 100%; height: 100%; object-fit: cover; }

.cm-avatar.sm { width: 24px; height: 24px; font-size: 0.65rem; }

.cm-post {
  padding: 1rem;
  border-bottom: 1px solid var(--mz-border);
}

.cm-post:last-child { border-bottom: none; }

.cm-post-head {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 0.6rem;
}

.cm-post-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cm-post-name { font-size: 0.85rem; font-weight: 700; color: var(--mz-text); }
.cm-post-headline { font-size: 0.72rem; color: var(--mz-text-muted); }
.cm-post-time { font-size: 0.68rem; color: var(--mz-text-muted); margin-left: auto; white-space: nowrap; }
.cm-post-body { font-size: 0.85rem; color: var(--mz-text-subtle); line-height: 1.55; margin-bottom: 0.6rem; white-space: pre-wrap; }

.cm-post-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.cm-post-btn {
  background: none;
  border: 1px solid var(--mz-border);
  color: var(--mz-text-muted);
  border-radius: 0.5rem;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s;
}

.cm-post-btn:hover,
.cm-post-btn.active {
  background: var(--mz-secondary-50);
  border-color: var(--mz-secondary-600);
  color: var(--mz-secondary-600);
}

html[data-theme='dark'] .cm-post-btn:hover,
html[data-theme='dark'] .cm-post-btn.active {
  background: rgba(99, 102, 241, 0.14);
}

.cm-comments {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--mz-border);
}

.cm-comment-row { display: flex; gap: 0.5rem; padding: 0.35rem 0; }
.cm-comment-row strong { font-size: 0.75rem; color: var(--mz-text); display: block; }
.cm-comment-row p { margin: 0; font-size: 0.78rem; color: var(--mz-text-subtle); }

.cm-comment-compose { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

.cm-comment-compose input {
  flex: 1;
  height: 2.2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--mz-border);
  border-radius: 0.5rem;
  font-size: 0.8rem;
  color: var(--mz-text);
  background: var(--mz-bg-subtle);
}

.cm-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--mz-text-muted);
  font-size: 0.85rem;
}

.cm-side-title {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--mz-text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cm-group-row,
.cm-suggest-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--mz-border);
}

.cm-group-row:last-child,
.cm-suggest-row:last-child { border-bottom: none; }

.cm-group-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.cm-row-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mz-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cm-row-meta { font-size: 0.68rem; color: var(--mz-text-muted); }

.cm-challenge {
  padding: 0.65rem;
  border-radius: 10px;
  background: var(--mz-bg-subtle);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cm-challenge-bar {
  height: 5px;
  background: var(--mz-border);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.3rem 0;
}

.cm-challenge-fill { height: 100%; background: var(--mz-secondary-600); border-radius: 999px; }

@media (max-width: 1200px) {
  .cm-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .cm-post-time { margin-left: 0; }
}

/* ══════════════════════ Marketplace ══════════════════════ */
.mk-page {
  display: grid;
  gap: 1rem;
}

.mk-page > * {
  min-width: 0;
}

.mk-hero-search {
  display: flex;
  gap: 0.6rem;
  width: 100%;
  max-width: 480px;
  margin-top: 0.75rem;
}

.mk-hero-search input {
  flex: 1;
  min-width: 0;
  height: 2.6rem;
  padding: 0 1rem;
  border-radius: 0.75rem;
  border: none;
  font-size: 0.85rem;
  color: #1e293b;
}

.mk-hero-search button {
  flex-shrink: 0;
  height: 2.6rem;
  padding: 0 1.1rem;
  border-radius: 0.75rem;
  background: #fff;
  color: #4f46e5;
  border: none;
  font-weight: 800;
  cursor: pointer;
  font-size: 0.82rem;
}

.mk-section-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--mz-text);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mk-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}

.mk-plan-card {
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 14px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: relative;
}

.mk-plan-card.recommended {
  border-color: var(--mz-secondary-600);
  box-shadow: 0 0 0 2px var(--mz-secondary-600) inset;
}

.mk-plan-badge {
  position: absolute;
  top: -0.6rem;
  right: 1rem;
  background: var(--mz-secondary-600);
  color: #fff;
  font-size: 0.63rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.mk-plan-name { font-size: 1.02rem; font-weight: 800; color: var(--mz-text); }
.mk-plan-desc { font-size: 0.78rem; color: var(--mz-text-muted); min-height: 1.4em; }
.mk-plan-price { font-size: 1.5rem; font-weight: 900; color: var(--mz-text); }
.mk-plan-price small { font-size: 0.68rem; font-weight: 600; color: var(--mz-text-muted); }
.mk-plan-old-price { font-size: 0.82rem; font-weight: 600; color: var(--mz-text-muted); text-decoration: line-through; margin-right: 0.35rem; }

.mk-plan-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; font-size: 0.76rem; color: var(--mz-text-subtle); }
.mk-plan-features li::before { content: '\2713 '; color: var(--mz-success); font-weight: 800; }

.mk-plan-btn {
  margin-top: auto;
  border: none;
  border-radius: 0.7rem;
  padding: 0.65rem 1rem;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  background: var(--mz-secondary-600);
  color: #fff;
}

.mk-plan-btn:hover { filter: brightness(1.08); }
.mk-plan-btn[disabled] { opacity: 0.6; cursor: default; }
.mk-plan-btn.renew { background: var(--mz-warning); }

.mk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mk-chip-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.mk-chip {
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--mz-border);
  background: transparent;
  color: var(--mz-text-subtle);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.mk-chip:hover,
.mk-chip.active {
  background: var(--mz-secondary-600);
  color: #fff;
  border-color: var(--mz-secondary-600);
}

.mk-advanced-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  align-items: end;
  padding: 1rem 1.1rem;
  margin: -0.5rem 0 1rem;
  border: 1px solid var(--mz-border);
  border-radius: 0.9rem;
  background: var(--mz-bg-subtle, var(--mz-surface));
}

.mk-advanced-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.mk-advanced-filter-field label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mz-text-muted);
}

.mk-advanced-filter-field input,
.mk-advanced-filter-field select {
  height: 2.35rem;
  padding: 0 0.6rem;
  border: 1px solid var(--mz-border);
  border-radius: 0.55rem;
  background: var(--mz-surface);
  color: var(--mz-text);
  font-size: 0.82rem;
  min-width: 0;
}

.mk-advanced-filter-range {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mk-advanced-filter-range input {
  width: 0;
  flex: 1 1 auto;
}

.mk-advanced-filter-range span {
  color: var(--mz-text-muted);
  font-size: 0.78rem;
}

.mk-advanced-filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.mk-results-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1rem;
  align-items: start;
}

.mk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.mk-card {
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.mk-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12); }
.mk-card.is-featured { border: 2px solid var(--mz-secondary-300); }

.mk-cover {
  height: 120px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mk-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mk-cover-icon { font-size: 1.7rem; color: rgba(255, 255, 255, 0.5); }

.mk-badge-free {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  background: var(--mz-success);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.mk-badge-difficulty {
  position: absolute;
  bottom: 0.4rem;
  right: 0.4rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.6rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
}

.mk-body { padding: 0.9rem; }
.mk-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--mz-text);
  margin: 0 0 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mk-desc {
  font-size: 0.74rem;
  color: var(--mz-text-muted);
  margin: 0 0 0.65rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mk-material-badges { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.55rem; }
.mk-material-badge {
  font-size: 0.64rem;
  background: var(--mz-bg-subtle);
  padding: 0.14rem 0.42rem;
  border-radius: 0.35rem;
  color: var(--mz-text-muted);
  white-space: nowrap;
}

.mk-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: var(--mz-text-muted); }
.mk-price { font-size: 0.95rem; font-weight: 800; color: var(--mz-secondary-600); }
.mk-price.free { color: var(--mz-success); }

.mk-featured-side {
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 14px;
  padding: 0.9rem;
  position: sticky;
  top: 84px;
}

.mk-featured-list { display: grid; gap: 0.8rem; }
.mk-featured-side .mk-cover { height: 110px; }

.mk-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--mz-text-muted);
}

@keyframes mkFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mk-card { animation: mkFadeIn 0.3s ease-out; }

@media (max-width: 1200px) {
  .mk-results-layout { grid-template-columns: minmax(0, 1fr); }
  .mk-featured-side { position: static; }
}

@media (max-width: 768px) {
  .mk-toolbar { flex-direction: column; align-items: stretch; }
  .mk-hero-search { max-width: none; }
}

/* ================================================================
   MEMORIZZA DESIGN SYSTEM v2 — Sidebar · Topbar · Dashboard · DS
   ================================================================ */

/* ── DS v2 Tokens ─────────────────────────────────────────────── */
:root {
  --mz-sidebar-w:          260px;
  --mz-sidebar-collapsed:  64px;
  --mz-sidebar-bg:         #ffffff;
  --mz-sidebar-border:     rgba(15, 23, 42, 0.07);
  --mz-sidebar-radius:     0;
  --mz-sidebar-pad-h:      0.75rem;

  --mz-nav-item-h:         36px;
  --mz-nav-item-radius:    8px;
  --mz-nav-item-color:     #475569;
  --mz-nav-item-hover-bg:  #f1f5f9;
  --mz-nav-item-active-bg: #eef2ff;
  --mz-nav-item-active-fg: #4f46e5;
  --mz-nav-accent:         #4f46e5;

  --mz-topbar-h:           56px;
  --mz-topbar-bg:          #ffffff;
  --mz-topbar-border:      rgba(15, 23, 42, 0.07);

  --mz-card-radius:        12px;
  --mz-card-bg:            #ffffff;
  --mz-card-border:        rgba(15, 23, 42, 0.07);
  --mz-card-shadow:        0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
  --mz-card-shadow-hover:  0 4px 12px rgba(15, 23, 42, 0.10), 0 16px 32px rgba(15, 23, 42, 0.06);

  --mz-transition:         0.18s cubic-bezier(0.4, 0, 0.2, 1);

  --mz-font-label:         0.67rem;
  --mz-font-body:          0.875rem;
  --mz-font-title:         1rem;
}

html[data-theme='dark'] {
  --mz-sidebar-bg:         #0f172a;
  --mz-sidebar-border:     rgba(255, 255, 255, 0.06);
  --mz-nav-item-color:     #94a3b8;
  --mz-nav-item-hover-bg:  #1e293b;
  --mz-nav-item-active-bg: rgba(99, 102, 241, 0.14);
  --mz-nav-item-active-fg: #818cf8;
  --mz-nav-accent:         #6366f1;
  --mz-topbar-bg:          #0f172a;
  --mz-topbar-border:      rgba(255, 255, 255, 0.06);
  --mz-card-bg:            #1e293b;
  --mz-card-border:        rgba(255, 255, 255, 0.06);
  --mz-card-shadow:        0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
}

/* ── Override: library-pro-shell layout ──────────────────────── */
.library-pro-shell {
  display: grid;
  grid-template-columns: var(--mz-sidebar-w) minmax(0, 1fr);
  grid-template-rows: 100vh;
  background: #f5f7fc !important;
  overflow: hidden;
}

html[data-theme='dark'] .library-pro-shell {
  background: #0d1628 !important;
}

/* Sidebar panel container */
.library-pro-shell .panel-sidebar {
  width: var(--mz-sidebar-w);
  min-width: var(--mz-sidebar-w);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  background: var(--mz-sidebar-bg);
  border-right: 1px solid var(--mz-sidebar-border);
  display: flex;
  flex-direction: column;
  transition: width var(--mz-transition), min-width var(--mz-transition);
  z-index: 30;
  padding: 0;
}

/* Panel main */
.library-pro-shell .panel-main {
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
  padding: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
}

/* Collapsed state */
@media (min-width: 1200px) {
  .library-pro-shell.sidebar-collapsed {
    grid-template-columns: var(--mz-sidebar-collapsed) minmax(0, 1fr);
  }
  .library-pro-shell.sidebar-collapsed .panel-sidebar {
    width: var(--mz-sidebar-collapsed);
    min-width: var(--mz-sidebar-collapsed);
    overflow: visible;
  }
  .library-pro-shell.sidebar-collapsed .mz-brand-wordmark,
  .library-pro-shell.sidebar-collapsed .mz-search-trigger span,
  .library-pro-shell.sidebar-collapsed .mz-search-trigger kbd,
  .library-pro-shell.sidebar-collapsed .mz-nav-group-label,
  .library-pro-shell.sidebar-collapsed .mz-nav-label,
  .library-pro-shell.sidebar-collapsed .mz-nav-badge,
  .library-pro-shell.sidebar-collapsed .mz-user-info,
  .library-pro-shell.sidebar-collapsed .mz-user-badges,
  .library-pro-shell.sidebar-collapsed .mz-user-stat-val,
  .library-pro-shell.sidebar-collapsed .mz-user-actions-spacer {
    display: none !important;
  }
  .library-pro-shell.sidebar-collapsed .mz-sidebar-header {
    padding: 0.875rem 0;
    justify-content: center;
  }
  .library-pro-shell.sidebar-collapsed .mz-brand {
    display: none;
  }
  .library-pro-shell.sidebar-collapsed .mz-collapse-btn {
    margin: 0 auto;
  }
  .library-pro-shell.sidebar-collapsed .mz-sidebar-search {
    padding: 0 0.5rem 0.5rem;
  }
  .library-pro-shell.sidebar-collapsed .mz-search-trigger {
    justify-content: center;
    padding: 0.45rem;
  }
  .library-pro-shell.sidebar-collapsed .mz-nav-item {
    justify-content: center;
    padding: 0.5rem;
  }
  .library-pro-shell.sidebar-collapsed .mz-nav-item::before {
    display: none;
  }
  .library-pro-shell.sidebar-collapsed .mz-sidebar-footer {
    padding: 0.5rem;
  }
  .library-pro-shell.sidebar-collapsed .mz-user-card {
    justify-content: center;
  }
  .library-pro-shell.sidebar-collapsed .mz-user-actions {
    justify-content: center;
  }
}

/* ── MZ SIDEBAR HEADER ───────────────────────────────────────── */
.mz-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem var(--mz-sidebar-pad-h) 0.5rem;
  flex-shrink: 0;
  gap: 0.5rem;
}

.mz-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  min-width: 0;
}

.mz-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.mz-brand-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.mz-brand-wordmark {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--mz-transition), max-width var(--mz-transition);
}

html[data-theme='dark'] .mz-brand-wordmark {
  color: #f1f5f9;
}

.mz-collapse-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--mz-sidebar-border);
  background: transparent;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--mz-transition);
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 0;
}

.mz-collapse-btn:hover {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

html[data-theme='dark'] .mz-collapse-btn {
  border-color: rgba(255,255,255,0.08);
  color: #475569;
}
html[data-theme='dark'] .mz-collapse-btn:hover {
  background: #1e293b;
  color: #94a3b8;
}

/* ── MZ SIDEBAR SEARCH ───────────────────────────────────────── */
.mz-sidebar-search {
  padding: 0 var(--mz-sidebar-pad-h) 0.375rem;
  flex-shrink: 0;
}

.mz-search-trigger {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.42rem 0.6rem;
  border: 1px solid var(--mz-sidebar-border);
  border-radius: 8px;
  background: #f8fafc;
  color: #94a3b8;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--mz-transition);
  text-align: left;
  min-width: 0;
}

.mz-search-trigger:hover {
  border-color: #c7d2fe;
  background: #f5f3ff;
  color: #6366f1;
}

.mz-search-placeholder {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mz-search-kbd {
  font-size: 0.65rem;
  font-family: monospace;
  background: #e2e8f0;
  color: #64748b;
  border-radius: 4px;
  padding: 0.08rem 0.32rem;
  border: none;
  flex-shrink: 0;
}

html[data-theme='dark'] .mz-search-trigger {
  background: #1e293b;
  border-color: rgba(255,255,255,0.06);
  color: #475569;
}
html[data-theme='dark'] .mz-search-trigger:hover {
  border-color: #4f46e5;
  background: rgba(99,102,241,0.08);
  color: #818cf8;
}
html[data-theme='dark'] .mz-search-kbd {
  background: #334155;
  color: #64748b;
}

/* ── MZ SIDEBAR NAV ──────────────────────────────────────────── */
.mz-sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}

.mz-sidebar-nav::-webkit-scrollbar {
  width: 3px;
}
.mz-sidebar-nav::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 3px;
}
html[data-theme='dark'] .mz-sidebar-nav::-webkit-scrollbar-thumb {
  background: #1e293b;
}

.mz-nav-group {
  padding-top: 0.125rem;
  margin-bottom: 0.125rem;
}

.mz-nav-group-label {
  font-size: var(--mz-font-label);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 0.625rem 0.5rem 0.25rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
}

html[data-theme='dark'] .mz-nav-group-label {
  color: #334155;
}

.mz-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.42rem 0.5rem;
  border-radius: var(--mz-nav-item-radius);
  color: var(--mz-nav-item-color);
  font-size: var(--mz-font-body);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--mz-transition), color var(--mz-transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  min-height: var(--mz-nav-item-h);
}

.mz-nav-item:hover {
  background: var(--mz-nav-item-hover-bg);
  color: #1e293b;
  text-decoration: none;
}

html[data-theme='dark'] .mz-nav-item:hover {
  color: #e2e8f0;
}

.mz-nav-item.active {
  background: var(--mz-nav-item-active-bg);
  color: var(--mz-nav-item-active-fg);
  font-weight: 600;
}

.mz-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  background: var(--mz-nav-accent);
  border-radius: 0 3px 3px 0;
}

.mz-nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.mz-nav-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mz-nav-badge {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  background: #ede9fe;
  color: #6d28d9;
  border-radius: 999px;
  padding: 0.1rem 0.38rem;
  flex-shrink: 0;
}

html[data-theme='dark'] .mz-nav-badge {
  background: rgba(109,40,217,0.2);
  color: #a78bfa;
}

/* ── MZ SIDEBAR FOOTER ───────────────────────────────────────── */
.mz-sidebar-footer {
  flex-shrink: 0;
  padding: 0.625rem var(--mz-sidebar-pad-h);
  border-top: 1px solid var(--mz-sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.mz-user-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.5rem;
  border-radius: 8px;
  transition: background var(--mz-transition);
  cursor: pointer;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.mz-user-card:hover {
  background: var(--mz-nav-item-hover-bg);
}

.mz-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.mz-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mz-user-info {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.mz-user-info strong {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.mz-user-info span {
  display: block;
  font-size: 0.68rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mz-user-token-label {
  margin-top: 0.14rem;
  font-size: 0.62rem;
  color: #64748b;
  line-height: 1.2;
}

.mz-user-token-unlimited {
  color: #16a34a;
}

.mz-user-token-bar {
  margin-top: 0.15rem;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.mz-user-token-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

html[data-theme='dark'] .mz-user-info strong { color: #e2e8f0; }
html[data-theme='dark'] .mz-user-info span   { color: #475569; }

.mz-user-badges {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.mz-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mz-badge-plan {
  background: #dbeafe;
  color: #1e40af;
}

html[data-theme='dark'] .mz-badge-plan {
  background: rgba(37,99,235,0.18);
  color: #60a5fa;
}

/* Actions row */
.mz-user-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.5rem;
}

.mz-user-stat {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  padding: 0.22rem 0.3rem;
}

.mz-user-stat i {
  font-size: 0.78rem;
}

.mz-user-stat-val {
  font-size: 0.72rem;
}

.mz-user-actions-spacer {
  flex: 1 1 auto;
}

.mz-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--mz-sidebar-border);
  background: transparent;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--mz-transition);
  flex-shrink: 0;
  text-decoration: none;
  padding: 0;
}

.mz-icon-btn:hover {
  background: var(--mz-nav-item-hover-bg);
  color: #475569;
  border-color: #cbd5e1;
}

.mz-logout-btn:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

html[data-theme='dark'] .mz-icon-btn {
  border-color: rgba(255,255,255,0.06);
  color: #475569;
}
html[data-theme='dark'] .mz-icon-btn:hover {
  background: #1e293b;
  color: #94a3b8;
}
html[data-theme='dark'] .mz-logout-btn:hover {
  background: rgba(239,68,68,0.12);
  color: #f87171;
}

.mz-logout-form {
  margin: 0;
  line-height: 0;
}

/* ── MZ TOPBAR ───────────────────────────────────────────────── */
.mz-topbar {
  height: var(--mz-topbar-h);
  min-height: var(--mz-topbar-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem;
  background: var(--mz-topbar-bg);
  border-bottom: 1px solid var(--mz-topbar-border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Dashboard topbar with custom greeting */
.mz-topbar.mz-topbar-dashboard {
  padding: 0 1.25rem;
  gap: 1rem;
}

.mz-topbar-left {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mz-topbar-center {
  flex: 0 1 400px;
}

.mz-topbar-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Breadcrumb */
.mz-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
}

.mz-breadcrumb-root {
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
  transition: color var(--mz-transition);
}

.mz-breadcrumb-root:hover {
  color: #475569;
  text-decoration: none;
}

.mz-breadcrumb-sep {
  color: #cbd5e1;
  font-size: 0.65rem;
}

.mz-breadcrumb-current {
  color: #1e293b;
  font-weight: 600;
}

html[data-theme='dark'] .mz-breadcrumb-root   { color: #475569; }
html[data-theme='dark'] .mz-breadcrumb-root:hover { color: #94a3b8; }
html[data-theme='dark'] .mz-breadcrumb-current { color: #e2e8f0; }

/* Topbar search */
.mz-topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.38rem 0.65rem;
  border: 1px solid var(--mz-topbar-border);
  border-radius: 8px;
  background: #f8fafc;
  color: #94a3b8;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--mz-transition);
  text-align: left;
}

.mz-topbar-search span {
  flex: 1 1 auto;
}

.mz-topbar-search kbd {
  font-size: 0.65rem;
  background: #e2e8f0;
  color: #64748b;
  border-radius: 4px;
  padding: 0.08rem 0.3rem;
  border: none;
  font-family: monospace;
}

.mz-topbar-search:hover {
  border-color: #c7d2fe;
  background: #f5f3ff;
  color: #6366f1;
}

html[data-theme='dark'] .mz-topbar-search {
  background: #1e293b;
  border-color: rgba(255,255,255,0.06);
  color: #475569;
}
html[data-theme='dark'] .mz-topbar-search:hover {
  border-color: #4f46e5;
  background: rgba(99,102,241,0.08);
  color: #818cf8;
}

/* Topbar icon buttons */
.mz-topbar-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--mz-topbar-border);
  background: transparent;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--mz-transition);
  padding: 0;
}

.mz-topbar-btn:hover {
  background: #f1f5f9;
  color: #475569;
}

html[data-theme='dark'] .mz-topbar-btn {
  border-color: rgba(255,255,255,0.06);
  color: #475569;
}
html[data-theme='dark'] .mz-topbar-btn:hover {
  background: #1e293b;
  color: #94a3b8;
}

/* ─── Sino de notificações (compartilhado entre panel.php e o topbar do dashboard) ─── */
.mz-notif-anchor { position: relative; }

.mz-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--mz-danger);
  color: #fff;
  border-radius: var(--mz-radius-full);
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.mz-notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 2rem);
  max-height: 420px;
  overflow-y: auto;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: var(--mz-radius-lg);
  box-shadow: var(--mz-shadow-md);
  z-index: 1200;
}

.mz-notif-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--mz-border);
}

.mz-notif-dropdown-head strong { font-size: 0.85rem; color: var(--mz-text); }

.mz-notif-mark-all {
  background: none;
  border: none;
  color: var(--mz-text-link);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.mz-notif-list { padding: 0.4rem; }

.mz-notif-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--mz-radius-md);
  cursor: pointer;
  text-align: left;
  width: 100%;
  background: none;
  border: none;
}

.mz-notif-item:hover,
.mz-notif-item.unread { background: var(--mz-bg-subtle); }

.mz-notif-item-title { font-size: 0.78rem; font-weight: 700; color: var(--mz-text); }
.mz-notif-item-body { font-size: 0.72rem; color: var(--mz-text-subtle); }
.mz-notif-item-time { font-size: 0.65rem; color: var(--mz-text-muted); margin-top: 0.1rem; }

.mz-notif-empty { padding: 1.2rem; text-align: center; font-size: 0.78rem; color: var(--mz-text-subtle); margin: 0; }

/* Mobile sidebar drawer trigger + backdrop — hidden on desktop, shown only
   once .library-pro-shell .panel-sidebar becomes an off-canvas drawer (see
   the max-width:640px block below). Toggled via [data-mz-mobile-menu]
   (common.js), same pattern as .adm-mobile-menu-btn/.adm-sidebar-backdrop. */
.mz-mobile-menu-btn { display: none; }
.mz-sidebar-backdrop { display: none; }

/* Topbar user pill */
.mz-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem 0.3rem 0.3rem;
  border-radius: 8px;
  border: 1px solid var(--mz-topbar-border);
  cursor: pointer;
  transition: background var(--mz-transition);
  text-decoration: none;
  color: inherit;
}

.mz-topbar-user:hover {
  background: #f1f5f9;
}

html[data-theme='dark'] .mz-topbar-user {
  border-color: rgba(255,255,255,0.06);
}
html[data-theme='dark'] .mz-topbar-user:hover {
  background: #1e293b;
}

.mz-topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mz-topbar-userinfo {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.mz-topbar-userinfo strong {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
}

.mz-topbar-userinfo small {
  font-size: 0.68rem;
  color: #94a3b8;
}

html[data-theme='dark'] .mz-topbar-userinfo strong { color: #e2e8f0; }
html[data-theme='dark'] .mz-topbar-userinfo small  { color: #475569; }

/* Topbar title (non-library-pro) */
.mz-topbar-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0;
}

html[data-theme='dark'] .mz-topbar-title { color: #f1f5f9; }

/* Dashboard topbar (greeting layout) */
.mz-topbar-dashboard .db-tb-greeting {
  flex: 1 1 auto;
  min-width: 0;
}

.mz-topbar-dashboard .db-tb-greeting h1 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0 0 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme='dark'] .mz-topbar-dashboard .db-tb-greeting h1 { color: #f1f5f9; }

.mz-topbar-dashboard .db-tb-greeting p {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mz-topbar-dashboard .db-tb-kpis {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  flex-shrink: 0;
}

.mz-topbar-dashboard .db-tb-kpis article {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.65rem;
  border-radius: 8px;
  transition: background var(--mz-transition);
}

.mz-topbar-dashboard .db-tb-kpis article:hover {
  background: #f1f5f9;
}

html[data-theme='dark'] .mz-topbar-dashboard .db-tb-kpis article:hover {
  background: #1e293b;
}

.mz-topbar-dashboard .db-tb-kpis article i {
  font-size: 0.9rem;
  color: #94a3b8;
}

.mz-topbar-dashboard .db-tb-kpis article strong {
  font-size: 0.88rem;
  font-weight: 800;
  color: #1e293b;
  display: block;
  line-height: 1;
}

html[data-theme='dark'] .mz-topbar-dashboard .db-tb-kpis article strong { color: #e2e8f0; }

.mz-topbar-dashboard .db-tb-kpis article span {
  font-size: 0.65rem;
  color: #94a3b8;
  display: block;
  line-height: 1;
}

.mz-topbar-dashboard .db-tb-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.mz-topbar-dashboard .db-tb-bell-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--mz-topbar-border);
  background: transparent;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--mz-transition);
  padding: 0;
}

.mz-topbar-dashboard .db-tb-bell-btn:hover {
  background: #f1f5f9;
  color: #475569;
}

.mz-topbar-dashboard .db-tb-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mz-topbar-dashboard .db-tb-userpill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem 0.3rem 0.3rem;
  border-radius: 8px;
  border: 1px solid var(--mz-topbar-border);
  cursor: pointer;
  transition: background var(--mz-transition);
}

.mz-topbar-dashboard .db-tb-userpill:hover {
  background: #f1f5f9;
}

.mz-topbar-dashboard .db-tb-avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mz-topbar-dashboard .db-tb-userinfo {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.mz-topbar-dashboard .db-tb-userinfo strong {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
}

.mz-topbar-dashboard .db-tb-userinfo small {
  font-size: 0.68rem;
  color: #94a3b8;
}

html[data-theme='dark'] .mz-topbar-dashboard .db-tb-userpill:hover { background: #1e293b; }
html[data-theme='dark'] .mz-topbar-dashboard .db-tb-userinfo strong { color: #e2e8f0; }

.mz-topbar-dashboard .db-tb-chevron {
  font-size: 0.68rem;
  color: #94a3b8;
}

/* ── MZ PANEL CONTENT ────────────────────────────────────────── */
.mz-panel-content {
  flex: 1 1 auto;
  padding: 1.25rem 1.5rem 2rem;
}

/* ── DS v2: CARD ─────────────────────────────────────────────── */
.mz-card {
  background: var(--mz-card-bg);
  border: 1px solid var(--mz-card-border);
  border-radius: var(--mz-card-radius);
  box-shadow: var(--mz-card-shadow);
  transition: box-shadow var(--mz-transition);
}

.mz-card:hover {
  box-shadow: var(--mz-card-shadow-hover);
}

/* Override dashboard-ref-card for v2 polish */
.library-pro-shell .dashboard-ref-card {
  background: var(--mz-card-bg);
  border: 1px solid var(--mz-card-border);
  border-radius: var(--mz-card-radius);
  box-shadow: var(--mz-card-shadow);
}

.library-pro-shell .dashboard-ref-hero {
  border-radius: var(--mz-card-radius);
}

.library-pro-shell .prio-item {
  border-radius: var(--mz-card-radius) !important;
  border: 1px solid var(--mz-card-border) !important;
  box-shadow: var(--mz-card-shadow) !important;
  transition: box-shadow var(--mz-transition), transform var(--mz-transition) !important;
}

.library-pro-shell .prio-item:hover {
  box-shadow: var(--mz-card-shadow-hover) !important;
  transform: translateY(-2px);
}

/* ── DS v2: SCROLLBAR ────────────────────────────────────────── */
/* .panel-main (nao a janela) e quem realmente rola nesse layout —
   overflow-y:auto + height:100vh (ver regra ".library-pro-shell .panel-main"
   mais acima). Barra mais larga e com fallback pro Firefox
   (scrollbar-width/-color) pra ficar visivel mesmo com scrollbar overlay
   do SO (ex.: macOS esconde a barra padrao ate o usuario rolar). */
.library-pro-shell .panel-main {
  scrollbar-width: auto;
  scrollbar-color: #cbd5e1 transparent;
}

.library-pro-shell .panel-main::-webkit-scrollbar {
  width: 10px;
}

.library-pro-shell .panel-main::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 5px;
}

.library-pro-shell .panel-main::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

html[data-theme='dark'] .library-pro-shell .panel-main {
  scrollbar-color: #334155 transparent;
}

html[data-theme='dark'] .library-pro-shell .panel-main::-webkit-scrollbar-thumb {
  background: #334155;
}

/* ── DS v2: RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .library-pro-shell {
    grid-template-columns: var(--mz-sidebar-collapsed) minmax(0, 1fr);
  }
  .library-pro-shell .panel-sidebar {
    width: var(--mz-sidebar-collapsed);
    min-width: var(--mz-sidebar-collapsed);
  }
  .library-pro-shell .mz-brand-wordmark,
  .library-pro-shell .mz-search-placeholder,
  .library-pro-shell .mz-search-kbd,
  .library-pro-shell .mz-nav-group-label,
  .library-pro-shell .mz-nav-label,
  .library-pro-shell .mz-nav-badge,
  .library-pro-shell .mz-user-info,
  .library-pro-shell .mz-user-badges,
  .library-pro-shell .mz-user-stat-val {
    display: none !important;
  }
  .library-pro-shell .mz-sidebar-header {
    justify-content: center;
    padding: 0.875rem 0;
  }
  .library-pro-shell .mz-brand { display: none; }
  .library-pro-shell .mz-collapse-btn { margin: 0 auto; }
  .library-pro-shell .mz-search-trigger {
    justify-content: center;
    padding: 0.45rem;
  }
  .library-pro-shell .mz-nav-item {
    justify-content: center;
    padding: 0.5rem;
  }
  .library-pro-shell .mz-nav-item.active::before { display: none; }
  .library-pro-shell .mz-user-card { justify-content: center; }
  .library-pro-shell .mz-user-actions { justify-content: center; flex-wrap: wrap; }
  .library-pro-shell .mz-user-actions-spacer { display: none; }
  .mz-topbar-center { display: none; }
}

@media (max-width: 640px) {
  .library-pro-shell {
    grid-template-columns: 0 minmax(0, 1fr);
  }
  /* Fixed-position elements are pulled out of grid flow, so .panel-main would
     otherwise auto-place into the vacated first (0-width) column and collapse
     the entire page to nothing visible — pin it to the real content column. */
  .library-pro-shell .panel-main {
    grid-column: 2 / -1;
  }
  /* .library-pro-shell .library-workspace (used by social/highlights/knowledge/etc.)
     always reserves a fixed ~270-300px right column, unconditionally, which never
     left room for the main column on phones (36px of usable width, text wrapping
     one character per line). Collapse to a single stacked column here. */
  .library-pro-shell .library-workspace {
    grid-template-columns: 1fr;
  }
  .library-pro-shell .panel-sidebar {
    position: fixed;
    left: -260px;
    z-index: 100;
    transition: left var(--mz-transition), width var(--mz-transition);
    width: var(--mz-sidebar-w) !important;
    min-width: var(--mz-sidebar-w) !important;
  }
  .library-pro-shell .mz-brand-wordmark,
  .library-pro-shell .mz-nav-group-label,
  .library-pro-shell .mz-nav-label,
  .library-pro-shell .mz-user-info,
  .library-pro-shell .mz-user-badges,
  .library-pro-shell .mz-user-stat-val {
    display: block !important;
  }
  .library-pro-shell.sidebar-mobile-open .panel-sidebar {
    left: 0;
  }
  .mz-topbar-right .mz-topbar-userinfo {
    display: none;
  }
  .mz-mobile-menu-btn {
    display: inline-flex;
  }
  body.sidebar-mobile-open .mz-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 90;
  }
}

/* ── DS v2: ANIMATIONS ───────────────────────────────────────── */
@keyframes mz-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mz-panel-content > * {
  animation: mz-fade-in 0.22s ease both;
}

/* ── DS v2: FOCUS / A11Y ─────────────────────────────────────── */
.mz-nav-item:focus-visible,
.mz-collapse-btn:focus-visible,
.mz-icon-btn:focus-visible,
.mz-topbar-btn:focus-visible,
.mz-search-trigger:focus-visible,
.mz-topbar-search:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

/* ── Dark mode: panel background ────────────────────────────── */
/* .library-pro-shell, .panel-main, .panel-content e .library-page-shell levam
   "background:#ffffff !important" (regra de app.css:3254-3259) — pensada pra
   sempre-branco no modo claro, mas sem estar restrita a ele, entao vence
   qualquer override sem !important em dark mode (ja houve pelo menos 3
   tentativas anteriores disso — app.css:3364, 3369, 11367 — nenhuma com
   !important, todas perdendo pra regra original). Precisa de !important aqui
   tambem; a maior especificidade do seletor com html[data-theme='dark'] resolve
   o empate a favor deste, sem tocar no comportamento do modo claro. */
html[data-theme='dark'] .library-pro-shell .panel-main,
html[data-theme='dark'] .library-pro-shell .panel-content,
html[data-theme='dark'] .library-pro-shell .library-page-shell {
  background: transparent !important;
}

/* ================================================================
   ADMIN CENTER ENTERPRISE v2 — Component Library
   Prefix: adm-*  |  Uses MDS tokens (--mz-*)
   ================================================================ */

/* ── Shell layout ────────────────────────────────────────────── */
.adm-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  height: calc(100vh - var(--mz-topbar-height));
  overflow: hidden;
}

.adm-sidebar {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--mz-surface);
  border-right: 1px solid var(--mz-border);
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--mz-neutral-200) transparent;
  flex-shrink: 0;
  transition: width 0.2s var(--mz-ease-in-out);
}

.adm-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  background: var(--mz-bg);
}

/* ── Admin Sidebar ───────────────────────────────────────────── */
.adm-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.875rem 0.875rem 0.75rem;
  border-bottom: 1px solid var(--mz-border);
}

.adm-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, #1e40af, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.adm-brand-title { font-size: 0.82rem; font-weight: 800; color: var(--mz-text); line-height: 1.1; }
.adm-brand-sub   { font-size: 0.62rem; color: var(--mz-text-muted); font-weight: 500; }

.adm-sidebar-search {
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--mz-border);
}

.adm-search-input {
  width: 100%;
  padding: 0.35rem 0.6rem;
  background: var(--mz-bg-subtle);
  border: 1px solid var(--mz-border);
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: var(--mz-font-family);
  color: var(--mz-text);
  outline: none;
  transition: border-color 150ms;
}
.adm-search-input:focus { border-color: var(--mz-primary-400); }
.adm-search-input::placeholder { color: var(--mz-text-muted); }

.adm-sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.375rem 0.5rem;
}

.adm-nav-group { margin-bottom: 0.125rem; }

.adm-nav-group-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--mz-text-muted);
  padding: 0.5rem 0.5rem 0.2rem;
}

.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.38rem 0.5rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: var(--mz-font-family);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mz-text-subtle);
  cursor: pointer;
  text-align: left;
  transition: all 150ms;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.adm-nav-item i { font-size: 0.85rem; flex-shrink: 0; }
.adm-nav-item:hover { background: var(--mz-bg-subtle); color: var(--mz-text); }
.adm-nav-item.is-active { background: var(--mz-primary-50); color: var(--mz-primary-700); font-weight: 600; }
.adm-nav-item.is-active::before { content:''; position:absolute; left:0; top:18%; bottom:18%; width:3px; background:var(--mz-primary-600); border-radius:0 3px 3px 0; }
.adm-nav-badge { margin-left: auto; font-size: 0.6rem; font-weight: 700; background: var(--mz-neutral-100); color: var(--mz-text-muted); border-radius: 999px; padding: 0.08rem 0.32rem; flex-shrink: 0; }
.adm-nav-item.is-active .adm-nav-badge { background: var(--mz-primary-100); color: var(--mz-primary-700); }

.adm-sidebar-footer {
  padding: 0.625rem;
  border-top: 1px solid var(--mz-border);
}
.adm-fav-section-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mz-text-muted); margin-bottom: 0.375rem; }
.adm-fav-hint { font-size: 0.72rem; color: var(--mz-text-muted); }
.adm-fav-item { display: flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0; font-size: 0.75rem; color: var(--mz-text-subtle); cursor: pointer; }
.adm-fav-item:hover { color: var(--mz-text); }

/* ── Admin Topbar ────────────────────────────────────────────── */
.adm-topbar {
  height: var(--mz-topbar-height);
  min-height: var(--mz-topbar-height);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background: var(--mz-surface);
  border-bottom: 1px solid var(--mz-border);
  flex-shrink: 0;
}

.adm-breadcrumb { display: flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; }
.adm-breadcrumb-root { color: var(--mz-text-muted); font-weight: 500; }
.adm-breadcrumb-sep  { color: var(--mz-neutral-300); font-size: 0.6rem; }
.adm-breadcrumb-current { color: var(--mz-text); font-weight: 700; }

.adm-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.adm-topbar-btn {
  width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--mz-border);
  background: transparent; color: var(--mz-text-subtle); display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 0.85rem; transition: all 150ms; padding: 0;
}
.adm-topbar-btn:hover { background: var(--mz-bg-subtle); color: var(--mz-text); }
.adm-mobile-menu-btn { display: none; }
.adm-sidebar-backdrop { display: none; }

/* ── Admin Content ───────────────────────────────────────────── */
.adm-content { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 1.25rem 1.5rem 2rem; }

/* ── Module Pane ─────────────────────────────────────────────── */
.adm-pane { animation: mz-fade-in 0.2s ease both; }
.adm-pane-hidden { display: none !important; }

.adm-page-header { margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--mz-border); display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.adm-page-title { font-size: var(--mz-text-2xl); font-weight: var(--mz-font-extrabold); letter-spacing: -0.02em; color: var(--mz-text); margin: 0 0 0.2rem; }
.adm-page-desc  { font-size: var(--mz-text-base); color: var(--mz-text-subtle); margin: 0; }
.adm-page-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ── Metric Grid ─────────────────────────────────────────────── */
.adm-metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.adm-metric-group { margin-bottom: 1.5rem; }
.adm-metric-group-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--mz-text-muted); margin-bottom: 0.625rem; display: flex; align-items: center; gap: 0.35rem; }

.adm-metric {
  background: var(--mz-surface);
  border: 1px solid var(--mz-border-subtle);
  border-radius: var(--mz-radius-lg);
  padding: 0.875rem;
  box-shadow: var(--mz-shadow-xs);
  cursor: default;
  transition: box-shadow 180ms, transform 180ms;
  text-decoration: none;
  display: block;
}
.adm-metric:hover { box-shadow: var(--mz-shadow-sm); transform: translateY(-1px); }
.adm-metric-icon { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; margin-bottom: 0.625rem; }
.adm-metric-value { font-size: var(--mz-text-2xl); font-weight: var(--mz-font-extrabold); letter-spacing: -0.02em; color: var(--mz-text); line-height: 1; margin-bottom: 0.2rem; }
.adm-metric-label { font-size: var(--mz-text-xs); font-weight: var(--mz-font-semibold); color: var(--mz-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.adm-metric-trend { display: flex; align-items: center; gap: 0.2rem; font-size: var(--mz-text-xs); font-weight: var(--mz-font-semibold); margin-top: 0.375rem; }
.adm-metric-trend.up   { color: var(--mz-success); }
.adm-metric-trend.down { color: var(--mz-danger); }
.adm-metric-trend.flat { color: var(--mz-text-muted); }

/* Metric color variants */
.adm-metric-icon.blue   { background: var(--mz-primary-50); color: var(--mz-primary-600); }
.adm-metric-icon.purple { background: var(--mz-secondary-100); color: var(--mz-secondary-600); }
.adm-metric-icon.green  { background: var(--mz-success-light); color: var(--mz-success-dark); }
.adm-metric-icon.yellow { background: var(--mz-warning-light); color: var(--mz-warning-dark); }
.adm-metric-icon.red    { background: var(--mz-danger-light); color: var(--mz-danger); }
.adm-metric-icon.sky    { background: var(--mz-info-light); color: var(--mz-info-dark); }
.adm-metric-icon.gray   { background: var(--mz-neutral-100); color: var(--mz-neutral-600); }

/* ── Admin Card ──────────────────────────────────────────────── */
.adm-card { background: var(--mz-surface); border: 1px solid var(--mz-border-subtle); border-radius: var(--mz-radius-lg); box-shadow: var(--mz-shadow-xs); overflow: hidden; margin-bottom: 1rem; }
.adm-card-header { padding: 0.875rem 1rem 0; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.adm-card-title  { font-size: 0.82rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mz-text); margin: 0; }
.adm-card-body   { padding: 0.875rem 1rem; }
.adm-card-footer { padding: 0.625rem 1rem; background: var(--mz-bg-subtle); border-top: 1px solid var(--mz-border); display: flex; align-items: center; gap: 0.5rem; }

/* ── Admin Table ─────────────────────────────────────────────── */
.adm-table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.adm-table th { text-align: left; padding: 0.5rem 0.75rem; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mz-text-muted); border-bottom: 2px solid var(--mz-border); white-space: nowrap; background: var(--mz-bg-subtle); }
.adm-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--mz-border); vertical-align: middle; color: var(--mz-text); }
.adm-table tr:hover td { background: var(--mz-bg-subtle); }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table .adm-table-actions { display: flex; gap: 0.25rem; }

/* ── Admin Badge ─────────────────────────────────────────────── */
.adm-badge { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.18rem 0.45rem; border-radius: var(--mz-radius-full); font-size: 0.65rem; font-weight: 700; white-space: nowrap; }
.adm-badge-primary { background: var(--mz-primary-100); color: var(--mz-primary-700); }
.adm-badge-success { background: var(--mz-success-light); color: var(--mz-success-dark); }
.adm-badge-warning { background: var(--mz-warning-light); color: var(--mz-warning-dark); }
.adm-badge-danger  { background: var(--mz-danger-light); color: var(--mz-danger); }
.adm-badge-info    { background: var(--mz-info-light); color: var(--mz-info-dark); }
.adm-badge-neutral { background: var(--mz-neutral-100); color: var(--mz-neutral-600); }

/* ── Admin Section ───────────────────────────────────────────── */
.adm-section { margin-bottom: 1.5rem; }
.adm-section-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mz-text-muted); margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.35rem; }
.adm-section-title::after { content:''; flex:1; height:1px; background:var(--mz-border); }

/* ── Admin Filter Bar ────────────────────────────────────────── */
.adm-filter-bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.adm-filter-input { padding: 0.38rem 0.65rem; border: 1px solid var(--mz-border); border-radius: 7px; font-family: var(--mz-font-family); font-size: 0.8rem; color: var(--mz-text); background: var(--mz-surface); outline: none; }
.adm-filter-input:focus { border-color: var(--mz-primary-400); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.adm-filter-select { padding: 0.38rem 0.65rem; border: 1px solid var(--mz-border); border-radius: 7px; font-family: var(--mz-font-family); font-size: 0.8rem; color: var(--mz-text); background: var(--mz-surface); outline: none; cursor: pointer; }
.adm-filter-spacer { flex: 1; }

/* ── Admin Button ────────────────────────────────────────────── */
.adm-btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.42rem 0.875rem; border-radius: 7px; font-family: var(--mz-font-family); font-size: 0.8rem; font-weight: 600; cursor: pointer; border: none; transition: all 150ms; text-decoration: none; white-space: nowrap; }
.adm-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.adm-btn-sm { padding: 0.28rem 0.6rem; font-size: 0.72rem; }
.adm-btn-primary { background: var(--mz-primary-600); color: #fff; }
.adm-btn-primary:hover { background: var(--mz-primary-700); }
.adm-btn-outline { background: transparent; color: var(--mz-text-subtle); border: 1px solid var(--mz-border); }
.adm-btn-outline:hover { background: var(--mz-bg-subtle); color: var(--mz-text); }
.adm-btn-danger { background: var(--mz-danger-light); color: var(--mz-danger-dark); border: 1px solid #fecaca; }
.adm-btn-danger:hover { background: var(--mz-danger); color: #fff; }

/* ── Admin Status ────────────────────────────────────────────── */
.adm-status-online  { color: var(--mz-success); }
.adm-status-warning { color: var(--mz-warning); }
.adm-status-offline { color: var(--mz-danger); }

/* ── Admin Empty State ───────────────────────────────────────── */
.adm-empty { text-align: center; padding: 3rem 2rem; }
.adm-empty-icon  { font-size: 2rem; color: var(--mz-neutral-300); margin-bottom: 0.75rem; }
.adm-empty-title { font-size: 0.9rem; font-weight: 700; color: var(--mz-text); margin-bottom: 0.375rem; }
.adm-empty-desc  { font-size: 0.8rem; color: var(--mz-text-subtle); }

/* ── Admin Log Entry ─────────────────────────────────────────── */
.adm-log { padding: 0.5rem 0; border-bottom: 1px solid var(--mz-border); display: flex; align-items: flex-start; gap: 0.75rem; font-size: 0.78rem; }
.adm-log:last-child { border-bottom: none; }
.adm-log-time  { color: var(--mz-text-muted); font-family: var(--mz-font-mono); font-size: 0.68rem; flex-shrink: 0; white-space: nowrap; }
.adm-log-event { color: var(--mz-text); flex: 1; }
.adm-log-user  { color: var(--mz-text-muted); font-size: 0.68rem; white-space: nowrap; }
.adm-log-error { background: var(--mz-danger-light); border-radius: 4px; padding: 0 0.25rem; }

/* ── Admin Settings Form ─────────────────────────────────────── */
.adm-settings-group { margin-bottom: 1.5rem; }
.adm-settings-group-title { font-size: 0.75rem; font-weight: 700; color: var(--mz-text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.75rem; padding-bottom: 0.375rem; border-bottom: 1px solid var(--mz-border); }
.adm-settings-row { display: grid; grid-template-columns: 200px minmax(0,1fr) 180px; gap: 0.75rem; align-items: start; padding: 0.5rem 0; border-bottom: 1px solid var(--mz-border); }
.adm-settings-label { font-size: 0.8rem; font-weight: 600; color: var(--mz-text); padding-top: 0.35rem; }
.adm-settings-hint  { font-size: 0.7rem; color: var(--mz-text-muted); margin-top: 0.2rem; }
.adm-settings-input { padding: 0.38rem 0.65rem; border: 1px solid var(--mz-border); border-radius: 7px; font-family: var(--mz-font-family); font-size: 0.8rem; color: var(--mz-text); background: var(--mz-surface); width: 100%; outline: none; }
.adm-settings-input:focus { border-color: var(--mz-primary-400); }
.adm-settings-meta { font-size: 0.7rem; color: var(--mz-text-muted); padding-top: 0.35rem; }

/* ── Admin Health Card ───────────────────────────────────────── */
.adm-health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.adm-health-card { background: var(--mz-surface); border: 1px solid var(--mz-border-subtle); border-radius: var(--mz-radius-lg); padding: 1rem; display: flex; align-items: center; gap: 0.75rem; }
.adm-health-indicator { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.adm-health-ok      { background: var(--mz-success); box-shadow: 0 0 0 3px rgba(34,197,94,0.15); }
.adm-health-warn    { background: var(--mz-warning); box-shadow: 0 0 0 3px rgba(245,158,11,0.15); }
.adm-health-error   { background: var(--mz-danger); box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }
.adm-health-label   { font-size: 0.8rem; font-weight: 600; color: var(--mz-text); }
.adm-health-sub     { font-size: 0.7rem; color: var(--mz-text-muted); }

/* ── Admin Tabs ──────────────────────────────────────────────── */
.adm-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--mz-border); margin-bottom: 1rem; overflow-x: auto; }
.adm-tab { padding: 0.5rem 0.875rem; font-size: 0.8rem; font-weight: 600; color: var(--mz-text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: none; border-left: none; border-right: none; font-family: var(--mz-font-family); white-space: nowrap; transition: all 150ms; }
.adm-tab:hover { color: var(--mz-text); }
.adm-tab.is-active { color: var(--mz-primary-600); border-bottom-color: var(--mz-primary-600); }
.adm-tab-panel { display: none; }
.adm-tab-panel.is-active { display: block; }

/* ── Admin Stat Row (compact table-like) ─────────────────────── */
.adm-stat-row { display: flex; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--mz-border); gap: 0.75rem; font-size: 0.78rem; }
.adm-stat-row:last-child { border-bottom: none; }
.adm-stat-key   { color: var(--mz-text-subtle); flex: 1; }
.adm-stat-value { font-weight: 700; color: var(--mz-text); white-space: nowrap; }

/* ── Dark mode overrides ─────────────────────────────────────── */
html[data-theme='dark'] .adm-sidebar,
html[data-theme='dark'] .adm-topbar,
html[data-theme='dark'] .adm-card { background: var(--mz-surface); border-color: var(--mz-border); }
html[data-theme='dark'] .adm-nav-item.is-active { background: rgba(99,102,241,0.12); color: var(--mz-primary-400); }
html[data-theme='dark'] .adm-metric { background: var(--mz-surface); border-color: var(--mz-border); }
html[data-theme='dark'] .adm-table th { background: var(--mz-bg-subtle); }
html[data-theme='dark'] .adm-filter-input,
html[data-theme='dark'] .adm-filter-select,
html[data-theme='dark'] .adm-settings-input { background: var(--mz-surface); border-color: var(--mz-border); color: var(--mz-text); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .adm-shell { grid-template-columns: 48px minmax(0, 1fr); }
  .adm-sidebar { width: 48px; overflow: visible; }
  .adm-brand-title, .adm-brand-sub, .adm-nav-group-label,
  .adm-nav-item span:not(.adm-nav-badge), .adm-sidebar-footer,
  .adm-sidebar-search { display: none; }
  .adm-nav-item { justify-content: center; padding: 0.5rem; }
  .adm-nav-item.is-active::before { display: none; }
  .adm-settings-row { grid-template-columns: 1fr; }
}

/* Phones: the 48px icon-only rail above still crams label-less items and their
   badges into too little space to be usable. Replace it with an off-canvas
   drawer (same pattern as .library-pro-shell .panel-sidebar) toggled by
   .adm-mobile-menu-btn, instead of a permanently visible rail. */
@media (max-width: 640px) {
  .adm-shell { grid-template-columns: 0 minmax(0, 1fr); }
  .adm-main { grid-column: 2 / -1; }
  .adm-mobile-menu-btn { display: inline-flex; }
  .adm-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -280px;
    width: 280px !important;
    min-width: 280px !important;
    z-index: 300;
    overflow-y: auto;
    transition: left var(--mz-transition);
  }
  .adm-brand-title, .adm-brand-sub, .adm-nav-group-label,
  .adm-nav-item span:not(.adm-nav-badge), .adm-sidebar-footer,
  .adm-sidebar-search { display: block !important; }
  .adm-nav-item { justify-content: flex-start; padding: 0.55rem 0.75rem; }
  .adm-nav-item.is-active::before { display: block; }
  body.adm-sidebar-mobile-open .adm-sidebar { left: 0; }
  body.adm-sidebar-mobile-open .adm-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 290;
  }
}

/* ══════════════════════════════════════════════════════════════
   ADMIN CENTER PHASE 3 — Advanced Components
   Health Center, Observability, Feature Flags, Config, Jobs, Logs
═══════════════════════════════════════════════════════════════ */

/* ── Health Indicator ────────────────────────────────────────── */
.adm-health-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.adm-health-status.ok      { background: var(--mz-success-light); color: var(--mz-success-dark); }
.adm-health-status.warning { background: var(--mz-warning-light); color: var(--mz-warning-dark); }
.adm-health-status.error   { background: var(--mz-danger-light); color: var(--mz-danger); }
.adm-health-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.adm-health-status.ok::before      { background: var(--mz-success); animation: pulse-green 2s infinite; }
.adm-health-status.warning::before { background: var(--mz-warning); animation: pulse-yellow 2s infinite; }
.adm-health-status.error::before   { background: var(--mz-danger); animation: pulse-red 2s infinite; }

@keyframes pulse-green  { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes pulse-yellow { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes pulse-red    { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── Health Monitor Card ─────────────────────────────────────── */
.adm-health-monitor {
  background: var(--mz-surface);
  border: 1px solid var(--mz-border-subtle);
  border-radius: var(--mz-radius-lg);
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  align-items: center;
}
.adm-health-monitor-left { display: flex; flex-direction: column; gap: 0.35rem; }
.adm-health-monitor-label { font-size: 0.78rem; font-weight: 600; color: var(--mz-text); }
.adm-health-monitor-meta { display: flex; gap: 1rem; font-size: 0.68rem; color: var(--mz-text-muted); }
.adm-health-monitor-value { font-family: var(--mz-font-mono); font-weight: 600; }
.adm-health-monitor-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }

/* ── Feature Flag Toggle ─────────────────────────────────────── */
.adm-flag-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--mz-border);
  border-radius: 8px;
  background: var(--mz-surface);
  transition: background 150ms;
}
.adm-flag-item:hover { background: var(--mz-bg-subtle); }
.adm-flag-content { flex: 1; min-width: 0; }
.adm-flag-name { font-size: 0.8rem; font-weight: 700; color: var(--mz-text); margin-bottom: 0.15rem; }
.adm-flag-desc { font-size: 0.72rem; color: var(--mz-text-subtle); margin-bottom: 0.3rem; }
.adm-flag-meta { display: flex; gap: 0.5rem; font-size: 0.65rem; }
.adm-flag-meta-item { display: flex; align-items: center; gap: 0.2rem; color: var(--mz-text-muted); }
.adm-flag-toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--mz-neutral-200);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 150ms;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.adm-flag-toggle::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 10px;
  top: 2px;
  left: 2px;
  transition: left 150ms;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.adm-flag-toggle.enabled { background: var(--mz-primary-600); }
.adm-flag-toggle.enabled::after { left: 22px; }

/* ── Config Group ────────────────────────────────────────────── */
.adm-config-group { margin-bottom: 1.5rem; }
.adm-config-group-title { font-size: 0.78rem; font-weight: 700; color: var(--mz-text); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--mz-border); }
.adm-config-row { display: grid; grid-template-columns: 160px minmax(0,1fr) 140px; gap: 0.75rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--mz-border); }
.adm-config-row:last-child { border-bottom: none; }
.adm-config-label { font-size: 0.78rem; font-weight: 600; color: var(--mz-text); }
.adm-config-input { padding: 0.35rem 0.6rem; border: 1px solid var(--mz-border); border-radius: 6px; font-family: var(--mz-font-family); font-size: 0.78rem; color: var(--mz-text); background: var(--mz-surface); outline: none; }
.adm-config-input:focus { border-color: var(--mz-primary-400); }
.adm-config-note { font-size: 0.65rem; color: var(--mz-text-muted); text-align: right; }

/* ── Job Queue ──────────────────────────────────────────────── */
.adm-job-item {
  padding: 0.65rem;
  border: 1px solid var(--mz-border);
  border-radius: 7px;
  background: var(--mz-surface);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 150ms;
}
.adm-job-item:hover { box-shadow: var(--mz-shadow-xs); }
.adm-job-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.adm-job-status-dot.pending   { background: var(--mz-warning); }
.adm-job-status-dot.running   { background: var(--mz-primary); animation: pulse-green 1.5s infinite; }
.adm-job-status-dot.success   { background: var(--mz-success); }
.adm-job-status-dot.failed    { background: var(--mz-danger); }
.adm-job-info { flex: 1; min-width: 0; }
.adm-job-name { font-size: 0.8rem; font-weight: 600; color: var(--mz-text); }
.adm-job-meta { font-size: 0.68rem; color: var(--mz-text-muted); }
.adm-job-time { font-size: 0.68rem; color: var(--mz-text-muted); white-space: nowrap; }
.adm-job-actions { display: flex; gap: 0.3rem; }

/* ── Timeline ────────────────────────────────────────────────── */
.adm-timeline {
  position: relative;
  padding-left: 1.5rem;
}
.adm-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--mz-border);
}
.adm-timeline-item {
  position: relative;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--mz-border);
}
.adm-timeline-item:last-child { border-bottom: none; padding-bottom: 0; }
.adm-timeline-dot {
  position: absolute;
  left: -10px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--mz-primary-500);
  border: 2px solid var(--mz-surface);
}
.adm-timeline-dot.success { background: var(--mz-success); }
.adm-timeline-dot.warning { background: var(--mz-warning); }
.adm-timeline-dot.error   { background: var(--mz-danger); }
.adm-timeline-content { font-size: 0.78rem; }
.adm-timeline-label { font-weight: 600; color: var(--mz-text); margin-bottom: 0.15rem; }
.adm-timeline-time  { font-size: 0.65rem; color: var(--mz-text-muted); }

/* ── Advanced Filters ────────────────────────────────────────── */
.adm-filter-advanced {
  padding: 0.75rem;
  background: var(--mz-bg-subtle);
  border-radius: 8px;
  border: 1px solid var(--mz-border);
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
}
.adm-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.adm-filter-label { font-size: 0.65rem; font-weight: 700; color: var(--mz-text-muted); text-transform: uppercase; }
.adm-filter-input, .adm-filter-select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--mz-border);
  border-radius: 6px;
  font-family: var(--mz-font-family);
  font-size: 0.75rem;
  color: var(--mz-text);
  background: var(--mz-surface);
  outline: none;
}
.adm-filter-input:focus, .adm-filter-select:focus { border-color: var(--mz-primary-400); }

/* ── Metrics Chart ──────────────────────────────────────────── */
.adm-metric-chart {
  background: var(--mz-surface);
  border: 1px solid var(--mz-border-subtle);
  border-radius: var(--mz-radius-lg);
  padding: 1rem;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--mz-text-muted);
  font-size: 0.8rem;
}
.adm-metric-chart-placeholder { text-align: center; }
.adm-metric-chart-placeholder i { font-size: 1.5rem; margin-bottom: 0.5rem; opacity: 0.5; }

/* ── Alert Card ────────────────────────────────────────────── */
.adm-alert-card {
  background: var(--mz-danger-light);
  border: 1px solid #fecaca;
  border-radius: var(--mz-radius-lg);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.adm-alert-card.warning { background: var(--mz-warning-light); border-color: #fcd34d; }
.adm-alert-card.info    { background: var(--mz-info-light); border-color: #93c5fd; }
.adm-alert-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: rgba(239, 68, 68, 0.2);
  color: var(--mz-danger);
}
.adm-alert-card.warning .adm-alert-card-icon { background: rgba(245, 158, 11, 0.2); color: var(--mz-warning); }
.adm-alert-card.info .adm-alert-card-icon    { background: rgba(59, 130, 246, 0.2); color: var(--mz-info); }
.adm-alert-card-content { flex: 1; }
.adm-alert-card-title { font-size: 0.78rem; font-weight: 700; color: var(--mz-text); margin-bottom: 0.15rem; }
.adm-alert-card-desc  { font-size: 0.75rem; color: var(--mz-text-subtle); }

/* ── Notification Center ────────────────────────────────────── */
.adm-notif-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.adm-notif-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.adm-notif-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--mz-text);
}
.adm-notif-hint {
  font-size: 0.68rem;
  color: var(--mz-text-muted);
}
.adm-notif-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--mz-border);
  border-radius: 7px;
  font-family: var(--mz-font-family);
  font-size: 0.8rem;
  color: var(--mz-text);
  background: var(--mz-surface);
  outline: none;
  resize: vertical;
  min-height: 80px;
}
.adm-notif-input:focus {
  border-color: var(--mz-primary-400);
}
.adm-notif-channels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
}
.adm-notif-channel {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--mz-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 150ms;
  font-size: 0.75rem;
}
.adm-notif-channel:hover { background: var(--mz-bg-subtle); }
.adm-notif-channel input[type="checkbox"] { cursor: pointer; }

/* ── Command Palette ────────────────────────────────────────── */
.adm-command-palette {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: var(--mz-radius-xl);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  z-index: 10000;
  display: none;
  flex-direction: column;
  max-height: 80vh;
  overflow: hidden;
}
.adm-command-palette.is-open { display: flex; }
.adm-command-input {
  padding: 0.875rem 1rem;
  border: none;
  border-bottom: 1px solid var(--mz-border);
  font-family: var(--mz-font-family);
  font-size: 0.9rem;
  color: var(--mz-text);
  background: transparent;
  outline: none;
}
.adm-command-input::placeholder { color: var(--mz-text-muted); }
.adm-command-results {
  flex: 1;
  overflow-y: auto;
  max-height: calc(80vh - 50px);
}
.adm-command-result-group { padding: 0.5rem 0; }
.adm-command-result-group-label {
  padding: 0.5rem 1rem 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--mz-text-muted);
  text-transform: uppercase;
}
.adm-command-result-item {
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 150ms;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--mz-border-subtle);
}
.adm-command-result-item:hover { background: var(--mz-bg-subtle); }
.adm-command-result-item-label { font-weight: 600; color: var(--mz-text); margin-bottom: 0.1rem; }
.adm-command-result-item-desc  { font-size: 0.7rem; color: var(--mz-text-muted); }

/* ── AI Chat Interface ──────────────────────────────────────── */
.adm-ai-chat {
  display: flex;
  flex-direction: column;
  height: 500px;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border-subtle);
  border-radius: var(--mz-radius-lg);
  overflow: hidden;
}
.adm-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.adm-ai-message {
  display: flex;
  gap: 0.5rem;
  max-width: 85%;
}
.adm-ai-message.user { align-self: flex-end; flex-direction: row-reverse; }
.adm-ai-message.assistant { align-self: flex-start; }
.adm-ai-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  flex-shrink: 0;
  background: var(--mz-primary-100);
  color: var(--mz-primary-600);
}
.adm-ai-message.user .adm-ai-avatar { background: var(--mz-neutral-200); color: var(--mz-text); }
.adm-ai-bubble {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  background: var(--mz-bg-subtle);
  color: var(--mz-text);
  word-break: break-word;
}
.adm-ai-message.user .adm-ai-bubble { background: var(--mz-primary-600); color: white; }
.adm-ai-input-area {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--mz-border);
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.adm-ai-input {
  flex: 1;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--mz-border);
  border-radius: 6px;
  font-family: var(--mz-font-family);
  font-size: 0.78rem;
  color: var(--mz-text);
  background: var(--mz-surface);
  outline: none;
  resize: none;
  min-height: 32px;
  max-height: 100px;
}
.adm-ai-input:focus { border-color: var(--mz-primary-400); }
.adm-ai-send {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--mz-primary-600);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: background 150ms;
}
.adm-ai-send:hover { background: var(--mz-primary-700); }
.adm-ai-loading {
  display: flex;
  gap: 0.2rem;
  align-items: center;
}
.adm-ai-loading-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--mz-text-muted);
  animation: bounce 1.4s infinite;
}
.adm-ai-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.adm-ai-loading-dot:nth-child(3) { animation-delay: 0.4s; }

.ai-thinking-text {
  animation: ai-thinking-pulse 1.3s ease-in-out infinite;
}

@keyframes ai-thinking-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* ── Responsive adjustments ────────────────────────────────── */
@media (max-width: 1024px) {
  .adm-config-row { grid-template-columns: 1fr; }
  .adm-health-monitor { grid-template-columns: 1fr; }
  .adm-command-palette { width: 95%; max-width: 90vw; }
  .adm-ai-chat { height: 400px; }
}

/* ══════════════════════════════════════════════════════════════
   Dashboard V3 — card grid, progress rings, banner.
   All colors via --mz-* tokens so dark mode works for free (no
   separate html[data-theme='dark'] block needed, unlike the older
   dashboard-ref-* family which hardcoded hex and had to be patched).
   ══════════════════════════════════════════════════════════════ */

.dbv3-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dbv3-row {
  display: grid;
  gap: 1rem;
  align-items: stretch;
  min-width: 0;
}

.dbv3-row > * { min-width: 0; }

.dbv3-row-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.dbv3-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dbv3-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dbv3-row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dbv3-row-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dbv3-row-main-side { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }

@media (max-width: 1280px) {
  .dbv3-row-4,
  .dbv3-row-5,
  .dbv3-row-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .dbv3-row-2,
  .dbv3-row-3,
  .dbv3-row-main-side { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .dbv3-row-4,
  .dbv3-row-5,
  .dbv3-row-6 { grid-template-columns: 1fr; }
}

.dbv3-card {
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 18px;
  padding: 1.15rem;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.dbv3-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.dbv3-card-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--mz-secondary-100, #ede9fe);
  color: var(--mz-secondary-600);
}

.dbv3-card-icon.blue    { background: var(--mz-primary-100); color: var(--mz-primary-600); }
.dbv3-card-icon.green   { background: var(--mz-success-light); color: var(--mz-success-dark); }
.dbv3-card-icon.orange  { background: var(--mz-warning-light); color: var(--mz-warning-dark); }
.dbv3-card-icon.red     { background: var(--mz-danger-light); color: var(--mz-danger-dark); }
.dbv3-card-icon.purple  { background: var(--mz-secondary-100, #ede9fe); color: var(--mz-secondary-600); }

.dbv3-card-headings { flex: 1; min-width: 0; }

.dbv3-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--mz-text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dbv3-card-subtitle {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--mz-text-subtle);
}

.dbv3-card-link {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--mz-primary-600);
  text-decoration: none;
  white-space: nowrap;
}

.dbv3-card-link:hover { text-decoration: underline; }

.dbv3-beta-badge {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--mz-secondary-600);
  background: var(--mz-secondary-100, #ede9fe);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

/* Two-zone layout: content on the left, ring/illustration on the right */
.dbv3-split {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.dbv3-split-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.dbv3-split-side { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }

/* Circular progress ring (inline SVG, stroke-dashoffset set per-instance via style attr) */
.dbv3-ring-wrap { position: relative; width: 110px; height: 110px; display: flex; align-items: center; justify-content: center; }
.dbv3-ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dbv3-ring-track { fill: none; stroke: var(--mz-border); stroke-width: 10; }
.dbv3-ring-fill { fill: none; stroke: var(--mz-secondary-600); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.dbv3-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dbv3-ring-pct { font-size: 1.3rem; font-weight: 800; color: var(--mz-text); line-height: 1; }
.dbv3-ring-caption { font-size: 0.65rem; color: var(--mz-text-subtle); margin-top: 0.15rem; }
.dbv3-ring-foot { font-size: 0.72rem; color: var(--mz-text-subtle); text-align: center; }
.dbv3-ring-foot strong { color: var(--mz-secondary-600); }

/* Compact checklist (Missão do Dia) */
.dbv3-checklist { display: flex; flex-direction: column; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.dbv3-checklist li { display: flex; align-items: center; gap: 0.6rem; }
.dbv3-check-dot {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  border: 2px solid var(--mz-border);
  color: transparent;
}
.dbv3-check-dot.done { background: var(--mz-success); border-color: var(--mz-success); color: #fff; }
.dbv3-check-dot.current { background: var(--mz-secondary-100, #ede9fe); border-color: var(--mz-secondary-600); color: var(--mz-secondary-600); }
.dbv3-checklist span.dbv3-check-label { flex: 1; font-size: 0.84rem; color: var(--mz-text); }
.dbv3-checklist small.dbv3-check-count { font-size: 0.76rem; color: var(--mz-text-subtle); font-weight: 700; }

/* Generic icon+text+meta+action row list (Revisões Prioritárias / Atividade Recente / Próximos Concursos) */
.dbv3-list { display: flex; flex-direction: column; gap: 0.7rem; margin: 0; padding: 0; list-style: none; }
.dbv3-list-row { display: flex; align-items: center; gap: 0.7rem; }
.dbv3-list-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: var(--mz-danger-light);
  color: var(--mz-danger-dark);
}
.dbv3-list-icon.warn  { background: var(--mz-warning-light); color: var(--mz-warning-dark); }
.dbv3-list-icon.info  { background: var(--mz-info-light); color: var(--mz-info-dark); }
.dbv3-list-icon.ok    { background: var(--mz-success-light); color: var(--mz-success-dark); }
.dbv3-list-icon.muted { background: var(--mz-bg-subtle); color: var(--mz-text-subtle); }

.dbv3-list-body { flex: 1; min-width: 0; }
.dbv3-list-title { font-size: 0.84rem; font-weight: 700; color: var(--mz-text); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dbv3-list-sub { font-size: 0.72rem; color: var(--mz-text-subtle); margin: 0.1rem 0 0; }

.dbv3-list-meta { flex-shrink: 0; font-size: 0.72rem; color: var(--mz-text-subtle); text-align: right; }
.dbv3-list-xp { flex-shrink: 0; font-size: 0.76rem; font-weight: 700; color: var(--mz-secondary-600); }

.dbv3-pill-btn {
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.32rem 0.8rem;
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  background: var(--mz-danger-light);
  color: var(--mz-danger-dark);
}
.dbv3-pill-btn.warn { background: var(--mz-warning-light); color: var(--mz-warning-dark); }
.dbv3-pill-btn.info { background: var(--mz-info-light); color: var(--mz-info-dark); }
.dbv3-pill-btn:hover { filter: brightness(0.96); text-decoration: none; }

.dbv3-days-badge {
  flex-shrink: 0;
  background: var(--mz-secondary-600);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  white-space: nowrap;
}

/* Metric list with inline progress bars (Meta Diária) */
.dbv3-metric-list { display: flex; flex-direction: column; gap: 0.6rem; margin: 0; padding: 0; list-style: none; flex: 1; }
.dbv3-metric-row { display: flex; flex-direction: column; gap: 0.3rem; }
.dbv3-metric-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.78rem; }
.dbv3-metric-top span:first-child { color: var(--mz-text-subtle); }
.dbv3-metric-top span:last-child { color: var(--mz-text); font-weight: 700; }
.dbv3-metric-bar { height: 6px; border-radius: 999px; background: var(--mz-border); overflow: hidden; }
.dbv3-metric-bar span { display: block; height: 100%; background: var(--mz-secondary-600); border-radius: inherit; }

/* Weekly streak calendar (Seg..Dom) */
.dbv3-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4rem; margin: 0.2rem 0; }
.dbv3-week-day { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.dbv3-week-day span.dbv3-week-letter { font-size: 0.65rem; color: var(--mz-text-subtle); font-weight: 700; }
.dbv3-week-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  background: var(--mz-bg-subtle);
  color: var(--mz-text-muted);
  border: 1px solid var(--mz-border);
}
.dbv3-week-dot.done { background: var(--mz-success); border-color: var(--mz-success); color: #fff; }
.dbv3-week-dot.today { background: var(--mz-warning-light); border-color: var(--mz-warning); color: var(--mz-warning-dark); }

.dbv3-unlock-box {
  background: var(--mz-bg-subtle);
  border: 1px dashed var(--mz-border);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  font-size: 0.78rem;
  color: var(--mz-text-subtle);
}
.dbv3-unlock-box strong { color: var(--mz-text); display: block; margin-top: 0.15rem; }

/* Level badge + achievements row (Nível e XP) */
.dbv3-level-badge {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--mz-secondary-600), var(--mz-primary-600));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}
.dbv3-level-badge strong { font-size: 1.05rem; }
.dbv3-level-badge small { font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; }

.dbv3-achv-row { display: flex; align-items: center; gap: 0.4rem; }
.dbv3-achv-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--mz-secondary-100, #ede9fe);
  color: var(--mz-secondary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.dbv3-achv-more {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--mz-bg-subtle);
  color: var(--mz-text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
}

/* Full-width "Sessão Inteligente" banner */
.dbv3-banner {
  border-radius: 18px;
  padding: 1.15rem 1.4rem;
  background: linear-gradient(120deg, #4338ca 0%, #4f46e5 45%, #6d28d9 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dbv3-banner-copy { display: flex; flex-direction: column; gap: 0.15rem; }
.dbv3-banner-kicker { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.85); margin: 0; }
.dbv3-banner-sub { font-size: 0.8rem; color: rgba(255, 255, 255, 0.82); margin: 0; }

.dbv3-banner-stats { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.dbv3-banner-stat { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: rgba(255, 255, 255, 0.92); }
.dbv3-banner-stat i { font-size: 1rem; opacity: 0.85; }
.dbv3-banner-stat strong { display: block; font-size: 0.86rem; }
.dbv3-banner-stat span.dbv3-banner-stat-label { display: block; font-size: 0.68rem; color: rgba(255, 255, 255, 0.7); }

.dbv3-banner-btn {
  flex-shrink: 0;
  background: #fff;
  color: #4338ca;
  border: none;
  border-radius: 12px;
  padding: 0.7rem 1.3rem;
  font-weight: 800;
  font-size: 0.85rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.dbv3-banner-btn:hover { filter: brightness(0.97); text-decoration: none; color: #4338ca; }

@media (max-width: 860px) {
  .dbv3-banner { flex-direction: column; align-items: flex-start; }
  .dbv3-banner-btn { width: 100%; justify-content: center; }
}

.dbv3-empty { font-size: 0.82rem; color: var(--mz-text-subtle); margin: 0; }

/* ══════════════════════════════════════════════════════════════
   Dashboard V3 extensions — Biblioteca Inteligente (tabs, toolbar,
   view toggle, folder cards, data table, tag pills). Same rule as
   the rest of dbv3-*: colors via --mz-* tokens only, dark mode free.
   ══════════════════════════════════════════════════════════════ */

.dbv3-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.dbv3-page-title { margin: 0; font-size: 1.4rem; font-weight: 800; color: var(--mz-text); }
.dbv3-page-subtitle { margin: .25rem 0 0; font-size: .85rem; color: var(--mz-text-subtle); }

.dbv3-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dbv3-toolbar-search { flex: 1; min-width: 220px; position: relative; }
.dbv3-toolbar-search input {
  width: 100%;
  height: 2.6rem;
  padding: 0 .9rem 0 2.3rem;
  border-radius: .7rem;
  border: 1px solid var(--mz-border);
  background: var(--mz-surface);
  color: var(--mz-text);
  font-size: .85rem;
}
.dbv3-toolbar-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--mz-text-subtle); }
.dbv3-toolbar-search kbd { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); font-size: .68rem; color: var(--mz-text-subtle); background: var(--mz-bg-subtle); border: 1px solid var(--mz-border); border-radius: .35rem; padding: .1rem .35rem; }

.dbv3-toolbar-btn {
  height: 2.6rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: 0 .9rem;
  border-radius: .7rem;
  border: 1px solid var(--mz-border);
  background: var(--mz-surface);
  color: var(--mz-text);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.dbv3-toolbar-btn:hover { background: var(--mz-bg-subtle); }

.dbv3-view-toggle { display: inline-flex; border: 1px solid var(--mz-border); border-radius: .7rem; overflow: hidden; }
.dbv3-view-toggle button {
  width: 2.6rem;
  height: 2.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--mz-surface);
  color: var(--mz-text-subtle);
  cursor: pointer;
  border-left: 1px solid var(--mz-border);
}
.dbv3-view-toggle button:first-child { border-left: none; }
.dbv3-view-toggle button.active { background: var(--mz-secondary-100, #ede9fe); color: var(--mz-secondary-600); }

.dbv3-cta-btn {
  height: 2.6rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: 0 1.1rem;
  border-radius: .7rem;
  border: none;
  background: var(--mz-secondary-600);
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}
.dbv3-cta-btn:hover { filter: brightness(1.05); color: #fff; text-decoration: none; }

.dbv3-card-cta {
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dbv3-card-cta:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.09);
  border-color: var(--mz-secondary-600);
}
.dbv3-card-cta .dbv3-card-title { color: var(--mz-secondary-600); }

/* Tabs */
.dbv3-tabs { display: flex; gap: 1.4rem; border-bottom: 1px solid var(--mz-border); overflow-x: auto; min-width: 0; width: 100%; }
.dbv3-tab {
  background: none;
  border: none;
  padding: .7rem .1rem;
  font-size: .85rem;
  font-weight: 700;
  color: var(--mz-text-subtle);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}
.dbv3-tab.active { color: var(--mz-secondary-600); border-bottom-color: var(--mz-secondary-600); }
.dbv3-tab-panel { display: none; }
.dbv3-tab-panel.active { display: block; }

/* Folder cards */
.dbv3-folder-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 1280px) { .dbv3-folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dbv3-folder-grid { grid-template-columns: 1fr; } }

.dbv3-folder-card {
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  text-decoration: none;
  cursor: pointer;
}
.dbv3-folder-card:hover { border-color: var(--mz-secondary-300, #c4b5fd); }
.dbv3-folder-card-new {
  align-items: center;
  justify-content: center;
  border-style: dashed;
  color: var(--mz-text-subtle);
  min-height: 118px;
}
.dbv3-folder-card-new:hover { color: var(--mz-secondary-600); border-color: var(--mz-secondary-600); }
.dbv3-folder-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.dbv3-folder-icon.c-blue    { background: var(--mz-primary-100); color: var(--mz-primary-600); }
.dbv3-folder-icon.c-green   { background: var(--mz-success-light); color: var(--mz-success-dark); }
.dbv3-folder-icon.c-purple  { background: var(--mz-secondary-100, #ede9fe); color: var(--mz-secondary-600); }
.dbv3-folder-icon.c-yellow  { background: var(--mz-warning-light); color: var(--mz-warning-dark); }
.dbv3-folder-icon.c-pink    { background: #fce7f3; color: #db2777; }
.dbv3-folder-icon.c-orange  { background: #ffedd5; color: #c2410c; }
.dbv3-folder-icon.c-teal    { background: #ccfbf1; color: #0f766e; }
.dbv3-folder-menu { margin-left: auto; color: var(--mz-text-subtle); background: none; border: none; cursor: pointer; }
.dbv3-folder-name { font-size: .92rem; font-weight: 800; color: var(--mz-text); margin: 0; }
.dbv3-folder-count { font-size: .74rem; color: var(--mz-text-subtle); margin: 0; }

/* Nova pasta é um <button>, não um <a> — remove os defaults de UA (fonte,
   cor, largura) pra herdar o mesmo visual que o .dbv3-folder-card sempre teve. */
button.dbv3-folder-card { font-family: inherit; width: 100%; }

/* Grid compacto (Fase 1 — "reduzir o tamanho dos cards e permitir listar todas") */
.dbv3-folder-grid-compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dbv3-folder-grid-compact .dbv3-folder-card { padding: .7rem; gap: .4rem; }
.dbv3-folder-grid-compact .dbv3-folder-card-new { min-height: 92px; }
.dbv3-folder-grid-compact .dbv3-folder-icon { width: 32px; height: 32px; font-size: .95rem; }
.dbv3-folder-grid-compact .dbv3-folder-name { font-size: .82rem; }
@media (max-width: 1280px) { .dbv3-folder-grid-compact { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dbv3-folder-grid-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Cards de Caderno Digital (Biblioteca > aba Cadernos/Recentes/Favoritos/Lixeira) */
.dbv3-notebook-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.1rem; }
@media (max-width: 1440px) { .dbv3-notebook-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .dbv3-notebook-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dbv3-notebook-grid { grid-template-columns: 1fr; } }

.dbv3-view-list .dbv3-notebook-grid { grid-template-columns: 1fr; }
.dbv3-view-list .dbv3-notebook-card { flex-direction: row; align-items: stretch; }
.dbv3-view-list .dbv3-notebook-cover { width: 130px; flex-shrink: 0; aspect-ratio: auto; }
.dbv3-view-list .dbv3-notebook-body { flex: 1; }
.dbv3-view-list .dbv3-notebook-card-new { flex-direction: row; align-items: center; justify-content: flex-start; gap: .8rem; min-height: 0; padding: 1rem 1.2rem; }

.dbv3-notebook-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dbv3-notebook-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.09);
  border-color: var(--mz-secondary-300, #c4b5fd);
}

.dbv3-notebook-cover {
  position: relative;
  display: flex;
  align-items: flex-end;
  aspect-ratio: 16 / 10;
  padding: .85rem;
  text-decoration: none;
  overflow: hidden;
}
.dbv3-notebook-cover-label {
  font-size: .92rem;
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .01em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dbv3-notebook-cover-icon { position: absolute; left: .85rem; bottom: .7rem; font-size: 1.3rem; color: rgba(255, 255, 255, .35); }

.dbv3-notebook-cover.cover-navy   { background: linear-gradient(160deg, #1e3a5f, #0f2440); }
.dbv3-notebook-cover.cover-green  { background: linear-gradient(160deg, #14532d, #0a3319); }
.dbv3-notebook-cover.cover-maroon { background: linear-gradient(160deg, #7f1d1d, #4c1414); }
.dbv3-notebook-cover.cover-purple { background: linear-gradient(160deg, #4c1d95, #2e1065); }
.dbv3-notebook-cover.cover-teal   { background: linear-gradient(160deg, #164e63, #0c2f3a); }
.dbv3-notebook-cover.cover-brown  { background: linear-gradient(160deg, #78350f, #451a03); }

.dbv3-notebook-fav {
  position: absolute;
  top: .6rem;
  right: .6rem;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, .35);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(2px);
}
.dbv3-notebook-fav:hover { background: rgba(15, 23, 42, .55); }
.dbv3-notebook-fav.active { color: var(--mz-warning); }

.dbv3-notebook-body { display: flex; flex-direction: column; gap: .55rem; padding: .9rem 1rem 1rem; min-width: 0; }
.dbv3-notebook-title {
  margin: 0;
  font-size: .92rem;
  font-weight: 800;
  color: var(--mz-text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dbv3-notebook-title:hover { color: var(--mz-secondary-600); }
.dbv3-notebook-sub { margin: 0; font-size: .74rem; color: var(--mz-text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dbv3-notebook-progress { display: flex; align-items: center; gap: .5rem; }
.dbv3-notebook-progress .dbv3-metric-bar { flex: 1; }
.dbv3-notebook-progress small { font-size: .72rem; font-weight: 700; color: var(--mz-text-subtle); }

.dbv3-notebook-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .8rem;
  font-size: .72rem;
  font-weight: 700;
  color: var(--mz-text-subtle);
}
.dbv3-notebook-stats span { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }

.dbv3-notebook-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  font-size: .72rem;
  color: var(--mz-text-subtle);
  border-top: 1px dashed var(--mz-border);
  padding-top: .6rem;
  margin-top: .1rem;
}
.dbv3-notebook-footer span { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dbv3-notebook-card-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-height: 220px;
  border: 1.5px dashed var(--mz-border);
  border-radius: 16px;
  text-align: center;
  color: var(--mz-text-subtle);
  padding: 1rem;
}
.dbv3-notebook-card-new:hover { border-color: var(--mz-secondary-600); color: var(--mz-secondary-600); }
.dbv3-notebook-new-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--mz-secondary-100, #ede9fe);
  color: var(--mz-secondary-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: .3rem;
}
.dbv3-notebook-new-title { margin: 0; font-size: .88rem; font-weight: 800; color: var(--mz-text); }
.dbv3-notebook-new-sub { margin: 0; font-size: .72rem; color: var(--mz-text-subtle); }

.dbv3-notebook-more { display: flex; justify-content: center; margin-top: .3rem; }

/* Cabeçalho da Biblioteca (título + Filtros + Novo Caderno) */
.dbv3-page-header-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dbv3-filters-wrap { position: relative; }
.dbv3-filters-popover {
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  z-index: 40;
  width: 260px;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  padding: .9rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.dbv3-filters-field label { color: var(--mz-text-subtle); font-weight: 700; }
.dbv3-filters-check { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--mz-text); margin: 0; }
.dbv3-filters-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* Sidebar da Biblioteca — lista compacta de pastas */
.dbv3-sidebar-folder-list { display: flex; flex-direction: column; gap: .15rem; margin: 0 0 .5rem; padding: 0; list-style: none; }
.dbv3-sidebar-folder-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .4rem .3rem;
  border-radius: 10px;
  cursor: pointer;
}
.dbv3-sidebar-folder-row:hover { background: var(--mz-bg-subtle); }
.dbv3-sidebar-folder-name { flex: 1; min-width: 0; font-size: .82rem; font-weight: 700; color: var(--mz-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbv3-sidebar-folder-count { flex-shrink: 0; font-size: .7rem; color: var(--mz-text-subtle); }
.dbv3-sidebar-add-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: none;
  background: none;
  color: var(--mz-secondary-600);
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  padding: .3rem;
}
.dbv3-sidebar-add-link:hover { text-decoration: underline; }

.dbv3-stat-delta { color: var(--mz-success-dark); font-weight: 700; }
.dbv3-stat-delta.is-negative { color: var(--mz-danger-dark, #b91c1c); }

.dbv3-tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--mz-border); }
.dbv3-tabs-row .dbv3-tabs { border-bottom: none; flex: 1; min-width: 0; }
.dbv3-tabs-controls { display: flex; align-items: center; gap: .5rem; padding-bottom: .5rem; flex-shrink: 0; }
.dbv3-tabs-controls .form-select { width: auto; font-size: .78rem; }

/* Menu de contexto flutuante (kebab de pasta / conteúdo recente) */
.dbv3-mini-menu {
  position: fixed;
  z-index: 3000;
  min-width: 170px;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: .6rem;
  box-shadow: var(--mz-shadow-lg);
  padding: .35rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.dbv3-mini-menu button {
  display: flex;
  align-items: center;
  gap: .55rem;
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  padding: .5rem .6rem;
  border-radius: .4rem;
  font-size: .82rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--mz-text);
  cursor: pointer;
}
.dbv3-mini-menu button:hover { background: var(--mz-bg-subtle); }
.dbv3-mini-menu button.danger { color: var(--mz-danger); }
.dbv3-mini-menu button.danger:hover { background: var(--mz-danger-light); }

/* Prévia somente-leitura (flashcard/questão) dentro dos modais de "Conteúdos recentes" */
.dbv3-preview-box {
  background: var(--mz-bg-subtle);
  border: 1px solid var(--mz-border);
  border-radius: .6rem;
  padding: .65rem .8rem;
  font-size: .88rem;
  color: var(--mz-text);
  white-space: pre-wrap;
}

/* Data table (Conteúdos recentes) */
.dbv3-table-wrap { overflow-x: auto; }
.dbv3-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.dbv3-table thead th {
  text-align: left;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--mz-text-subtle);
  padding: 0 .6rem .6rem;
  border-bottom: 1px solid var(--mz-border);
  white-space: nowrap;
}
.dbv3-table tbody td { padding: .6rem; border-bottom: 1px solid var(--mz-border-subtle, var(--mz-border)); vertical-align: middle; }
.dbv3-table tbody tr:last-child td { border-bottom: none; }
.dbv3-table tbody tr:hover { background: var(--mz-bg-subtle); }
.dbv3-table-title-cell { display: flex; align-items: center; gap: .6rem; min-width: 220px; }
.dbv3-table-star { background: none; border: none; color: var(--mz-text-muted); cursor: pointer; font-size: .95rem; flex-shrink: 0; }
.dbv3-table-star.active { color: var(--mz-warning); }
.dbv3-table-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--mz-bg-subtle); color: var(--mz-text-subtle); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dbv3-table-title { font-weight: 700; color: var(--mz-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.dbv3-table-subtitle { font-size: .72rem; color: var(--mz-text-subtle); }
.dbv3-type-badge { display: inline-block; font-size: .65rem; font-weight: 800; letter-spacing: .03em; padding: .18rem .5rem; border-radius: 999px; background: var(--mz-bg-subtle); color: var(--mz-text-subtle); white-space: nowrap; }
.dbv3-type-badge.content   { background: var(--mz-primary-100); color: var(--mz-primary-600); }
.dbv3-type-badge.flashcard { background: var(--mz-secondary-100, #ede9fe); color: var(--mz-secondary-600); }
.dbv3-type-badge.question  { background: var(--mz-warning-light); color: var(--mz-warning-dark); }
.dbv3-table-progress { display: flex; align-items: center; gap: .5rem; min-width: 110px; }
.dbv3-table-progress .dbv3-metric-bar { flex: 1; }
.dbv3-table-actions { display: flex; align-items: center; gap: .3rem; white-space: nowrap; }
.dbv3-icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--mz-border); background: var(--mz-surface); color: var(--mz-text-subtle); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.dbv3-icon-btn:hover { background: var(--mz-bg-subtle); color: var(--mz-text); }
.dbv3-icon-btn.primary { background: var(--mz-secondary-600); border-color: var(--mz-secondary-600); color: #fff; }
.dbv3-icon-btn.primary:hover { filter: brightness(1.05); color: #fff; }

/* Tags */
.dbv3-tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }
.dbv3-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .74rem;
  font-weight: 700;
  padding: .3rem .7rem;
  border-radius: 999px;
  background: var(--mz-bg-subtle);
  color: var(--mz-text);
  border: 1px solid var(--mz-border);
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.dbv3-tag-pill span { color: var(--mz-text-subtle); font-weight: 600; }

/* AI recommendation card (Biblioteca) */
.dbv3-ai-rec-item { border: 1px solid var(--mz-border); border-radius: 12px; padding: .75rem; display: flex; flex-direction: column; gap: .4rem; }
.dbv3-ai-rec-title { font-size: .85rem; font-weight: 800; color: var(--mz-text); margin: 0; }
.dbv3-ai-rec-sub { font-size: .74rem; color: var(--mz-text-subtle); margin: 0; }
.dbv3-ai-rec-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .2rem; }
.dbv3-ai-rec-retention { font-size: .72rem; color: var(--mz-success-dark); font-weight: 700; }

/* ===== Navigation Context Engine — banner + step-complete bar ===== */
.mz-nav-session-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.18);
}

.mz-nav-session-banner-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mz-nav-banner-sep {
  opacity: 0.6;
  font-weight: 400;
}

.mz-nav-session-banner-close {
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
}

.mz-nav-session-banner-close:hover {
  background: rgba(255, 255, 255, 0.32);
}

body.mz-nav-session-active {
  padding-top: 2.5rem;
}

.mz-nav-step-complete {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.7rem 0.6rem 1rem;
  border-radius: 999px;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  box-shadow: var(--mz-shadow-lg);
  color: var(--mz-text);
  font-size: 0.82rem;
  font-weight: 700;
}

.mz-nav-step-complete-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--mz-primary-600);
  color: #ffffff;
  font-weight: 800;
  white-space: nowrap;
}

.mz-nav-step-complete-btn:hover {
  background: var(--mz-primary-500);
  color: #ffffff;
}

@media (max-width: 640px) {
  .mz-nav-session-banner-inner {
    font-size: 0.74rem;
  }

  .mz-nav-step-complete {
    left: 0.6rem;
    right: 0.6rem;
    transform: none;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ===== Study pages (Flashcards/Questões/Revisões) — componentes compartilhados ===== */

.study-stats-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.study-stat-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  min-width: 0;
}

.study-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--mz-text);
  line-height: 1.1;
}

.study-stat-label {
  font-size: 0.74rem;
  color: var(--mz-text-subtle);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.study-stat-card--cta {
  background: linear-gradient(135deg, var(--mz-secondary-600, #7c3aed), var(--mz-secondary-700, #6d28d9));
  border-color: transparent;
  flex-wrap: wrap;
  justify-content: space-between;
}

.study-stat-card--cta .dbv3-card-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.study-stat-card--cta .study-stat-cta-body {
  min-width: 0;
  flex: 1;
}

.study-stat-card--cta .study-stat-label {
  color: #fff;
  font-weight: 700;
  overflow: visible;
  white-space: normal;
}

.study-stat-card--cta .study-stat-sublabel {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 0.1rem;
}

.study-stat-card--cta .study-stat-value {
  color: #fff;
  font-size: 1.1rem;
}

.study-stat-cta-btn {
  background: #fff;
  color: var(--mz-secondary-700, #6d28d9);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  flex-shrink: 0;
}

.study-stat-cta-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
}

.study-stat-cta-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.study-stat-card--action {
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: border-color .15s ease, transform .15s ease;
}

.study-stat-card--action:hover {
  border-color: var(--mz-secondary-600, #7c3aed);
  transform: translateY(-1px);
}

.study-stat-card--action .study-stat-value {
  color: var(--mz-secondary-600, #7c3aed);
}

@media (max-width: 1100px) {
  .study-stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .study-stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .study-stats-row { grid-template-columns: 1fr; }
}

.study-deck-selector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  background: var(--mz-surface);
  border: 1px solid var(--mz-border);
  border-radius: 14px;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--mz-text);
}

.study-deck-selector-row .study-deck-current {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  min-width: 0;
}

.study-deck-selector-row .study-deck-current small {
  font-weight: 400;
  color: var(--mz-text-subtle);
  margin-right: 0.3rem;
}

.study-deck-selector-row select {
  border: 1px solid var(--mz-border);
  background: transparent;
  color: var(--mz-text);
  border-radius: 8px;
  font-size: 0.82rem;
  padding: 0.25rem 0.5rem;
}

.study-settings-panel {
  display: grid;
  gap: 0.6rem;
}

.study-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.82rem;
  /* Cor fixa (nao var(--mz-text)): este componente so aparece dentro de
     .library-pane/.study-side-card, que o .library-pro-shell forca sempre
     branco independente do tema — ver app.css:2055. Usar cor reativa ao tema
     deixava o texto quase invisivel (branco sobre branco) no modo escuro. */
  color: #334155;
}

.study-toggle {
  position: relative;
  display: inline-block;
  width: 2.3rem;
  height: 1.3rem;
  flex-shrink: 0;
}

.study-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.study-toggle-slider {
  position: absolute;
  inset: 0;
  /* Cor fixa pelo mesmo motivo do .study-toggle-row acima — var(--mz-border)
     fica quase invisivel sobre o card sempre-branco no modo escuro. */
  background: #cbd5e1;
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms ease;
}

.study-toggle-slider::before {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  left: 0.15rem;
  top: 0.15rem;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 150ms ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

.study-toggle input:checked + .study-toggle-slider {
  background: var(--mz-primary-600);
}

.study-toggle input:checked + .study-toggle-slider::before {
  transform: translateX(1rem);
}

.study-toggle input:focus-visible + .study-toggle-slider {
  outline: 2px solid var(--mz-primary-400, var(--mz-primary-600));
  outline-offset: 2px;
}

.study-ai-tip-card {
  background: linear-gradient(135deg, var(--mz-secondary-50, #f5f3ff) 0%, var(--mz-primary-50, #eff6ff) 100%);
  border: 1px solid var(--mz-secondary-100, #ede9fe);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}

html[data-theme='dark'] .study-ai-tip-card {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.14) 0%, rgba(59, 130, 246, 0.1) 100%);
  border-color: rgba(124, 58, 237, 0.28);
}

.study-ai-tip-card .study-ai-tip-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--mz-text);
  margin-bottom: 0.4rem;
}

.study-ai-tip-card p {
  font-size: 0.82rem;
  color: var(--mz-text-subtle);
  margin: 0 0 0.6rem;
}

.study-ai-tip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  justify-content: center;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--mz-secondary-200, #ddd6fe);
  background: var(--mz-surface);
  color: var(--mz-secondary-600, #7c3aed);
  font-weight: 700;
  font-size: 0.82rem;
}

.study-ai-tip-btn:hover {
  background: var(--mz-secondary-50, #f5f3ff);
}

.study-rating-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.6rem;
}

.study-rating-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 0.5rem;
  font-weight: 700;
  font-size: 0.82rem;
  text-align: center;
}

.study-rating-card small {
  font-weight: 600;
  font-size: 0.7rem;
  opacity: 0.85;
}

.study-rating-card .study-rating-icon {
  font-size: 1.1rem;
}

.study-rating-card.forgot  { background: var(--mz-danger-light);  color: var(--mz-danger-dark); }
.study-rating-card.hard    { background: var(--mz-warning-light); color: var(--mz-warning-dark); }
.study-rating-card.medium  { background: var(--mz-warning-light); color: var(--mz-warning-dark); opacity: 0.85; }
.study-rating-card.easy    { background: var(--mz-success-light); color: var(--mz-success-dark); }
.study-rating-card.very_easy { background: var(--mz-success-light); color: var(--mz-success-dark); }

.study-rating-card:hover {
  filter: brightness(0.97);
}

/* .library-pro-shell forca .library-pane sempre branco, independente do tema
   (app.css ~2055) — widgets dbv3-* (ring/metric-bar) usados dentro dessas
   cards nas paginas de estudo (Flashcards/Questoes/Revisoes) precisam de
   cor fixa em vez de var(--mz-*), senao ficam quase invisiveis (texto claro
   sobre card sempre-branco) quando o tema do site esta no modo escuro. */
.library-pro-shell .library-pane .dbv3-ring-track,
.library-pro-shell .library-pane .dbv3-metric-bar {
  stroke: #e2e8f0;
  background: #e2e8f0;
}

.library-pro-shell .library-pane .dbv3-ring-pct {
  color: #0f172a;
}

.library-pro-shell .library-pane .dbv3-ring-caption {
  color: #64748b;
}

.library-pro-shell .library-pane canvas,
.study-side-card canvas {
  max-width: 100%;
  height: auto !important;
}

.library-pro-shell .library-pane .dbv3-table-title {
  color: #0f172a;
}

.library-pro-shell .library-pane .dbv3-table-subtitle,
.library-pro-shell .library-pane .dbv3-table thead th {
  color: #64748b;
}

/* ══════════════════════ Modal — componente canônico (Memorizza Design System) ══════════════════════
   Todo modal "overlay" próprio do app deve usar essas classes em vez de style="" repetido.
   Abertura/fechamento continua via JS (elemento.style.display = 'flex'/'none' ou
   classList.add/remove('is-open')) — essas classes só definem a aparência. */
@keyframes mzSlideIn {
  from { transform: scale(0.96) translateY(-8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.mz-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 1rem;
}

.mz-modal-overlay.is-open {
  display: flex;
}

.mz-modal-card {
  background: var(--mz-surface);
  color: var(--mz-text);
  border: 1px solid var(--mz-border);
  border-radius: 1.1rem;
  box-shadow: var(--mz-shadow-xl);
  width: 100%;
  animation: mzSlideIn 0.22s ease-out;
}

.mz-modal-card--sm { max-width: 440px; }
.mz-modal-card--md { max-width: 520px; }
.mz-modal-card--lg { max-width: 680px; }

.mz-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--mz-border);
}

.mz-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--mz-text);
}

.mz-modal-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--mz-text-muted);
}

.mz-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--mz-text-muted);
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.mz-modal-close:hover {
  background: var(--mz-bg-subtle);
}

.mz-modal-body {
  padding: 1.5rem;
}

.mz-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--mz-border);
  flex-wrap: wrap;
}

.mz-modal-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mz-text-muted);
  margin-bottom: 0.35rem;
}

.mz-modal-input {
  width: 100%;
  height: 2.6rem;
  padding: 0 0.9rem;
  border: 1px solid var(--mz-border);
  border-radius: 0.75rem;
  background: var(--mz-surface);
  color: var(--mz-text);
  font-size: 0.9rem;
  box-sizing: border-box;
}

.mz-modal-input:focus {
  border-color: var(--mz-secondary-500);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
  outline: none;
}

@media (max-width: 640px) {
  .mz-modal-card { max-height: 90vh; overflow-y: auto; }
  .mz-modal-body { padding: 1.1rem; }
  .mz-modal-head, .mz-modal-actions { padding-left: 1.1rem; padding-right: 1.1rem; }
}

/* ══════════════════════ Sessão de Revisão Inteligente — modal fullscreen ══════════════════════ */
.mz-modal-overlay--fullscreen {
  padding: 1.25rem;
}

body.review-session-open,
body.question-session-open,
body.flashcard-session-open {
  overflow: hidden;
}

.mz-session-modal-card {
  width: 100%;
  max-width: 1100px;
  height: 92vh;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mz-session-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--mz-border);
  flex-shrink: 0;
}

.mz-session-modal-head-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1rem;
  color: var(--mz-text);
}

.mz-session-modal-head-title i {
  color: var(--mz-secondary-500);
}

.mz-session-modal-head-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mz-session-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--mz-bg-subtle);
  border: 1px solid var(--mz-border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--mz-text-subtle);
  font-variant-numeric: tabular-nums;
}

.mz-session-progress-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--mz-border);
  font-size: 0.78rem;
  color: var(--mz-text-muted);
  flex-shrink: 0;
}

.mz-session-progress-bar-wrap {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--mz-bg-subtle);
  overflow: hidden;
}

.mz-session-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mz-secondary-500), var(--mz-secondary-600));
  transition: width 250ms ease;
}

.mz-session-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

.mz-session-main {
  padding: 1.75rem 2rem;
  overflow-y: auto;
  min-width: 0;
}

.mz-session-type-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--mz-secondary-100, #ede9fe);
  color: var(--mz-secondary-600);
  margin-bottom: 0.75rem;
}

html[data-theme='dark'] .mz-session-type-badge {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
}

.mz-session-card-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--mz-text);
  margin: 0 0 0.5rem;
}

.mz-session-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.82rem;
  color: var(--mz-text-subtle);
  margin: 0 0 1rem;
}

.mz-session-card-preview {
  margin: 0 0 1rem;
  background: var(--mz-bg-subtle);
  border: 1px solid var(--mz-border);
  border-radius: 0.85rem;
  padding: 1.1rem;
  color: var(--mz-text);
  font-size: 1rem;
  line-height: 1.6;
  max-height: 260px;
  overflow-y: auto;
}

#reviewSessionCardAnswerWrap {
  margin-bottom: 1rem;
}

.mz-session-already-done {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--mz-bg-subtle);
  border: 1px solid var(--mz-border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--mz-text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.mz-session-feedback-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.mz-session-feedback-flash {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--mz-surface);
  animation: mzSessionFlashIn 180ms ease-out;
  z-index: 5;
}

@keyframes mzSessionFlashIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.mz-session-feedback-flash #reviewSessionFlashIcon {
  font-size: 2.75rem;
  line-height: 1;
}

.mz-session-feedback-flash #reviewSessionFlashLabel {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--mz-text);
}

.mz-session-feedback-flash #reviewSessionFlashXp {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mz-secondary-500);
}

#reviewSessionItemView {
  position: relative;
}

.mz-session-complete-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem auto 1rem;
}

#reviewSessionCompleteView {
  text-align: center;
  padding: 2rem 1rem;
}

#reviewSessionCompleteView h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--mz-text);
  margin: 0 0 0.35rem;
}

#reviewSessionCompleteView > p {
  color: var(--mz-text-muted);
  margin: 0 0 1.5rem;
}

.mz-session-complete-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  max-width: 560px;
  margin: 0 auto 1.75rem;
}

.mz-session-complete-stats > div {
  background: var(--mz-bg-subtle);
  border: 1px solid var(--mz-border);
  border-radius: 0.85rem;
  padding: 0.9rem;
}

.mz-session-complete-stats span {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mz-text-muted);
  margin-bottom: 0.25rem;
}

.mz-session-complete-stats strong {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--mz-text);
}

.mz-session-complete-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.mz-session-side {
  background: var(--mz-bg-subtle);
  border-left: 1px solid var(--mz-border);
  padding: 1.5rem 1.25rem;
  overflow-y: auto;
  min-width: 0;
}

.mz-session-side h3 {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mz-text-muted);
  margin: 0 0 1rem;
}

.mz-session-stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--mz-border);
  font-size: 0.82rem;
}

.mz-session-stat-item:last-child {
  border-bottom: none;
}

.mz-session-stat-item span {
  color: var(--mz-text-subtle);
}

.mz-session-stat-item strong {
  color: var(--mz-text);
  font-weight: 800;
}

.mz-session-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--mz-border);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.mz-session-footer-right {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .mz-session-modal-card { height: 96vh; max-height: none; }
  .mz-session-body { grid-template-columns: 1fr; overflow-y: auto; }
  .mz-session-side { border-left: none; border-top: 1px solid var(--mz-border); }
  .mz-session-main { padding: 1.25rem 1.25rem 0; }
}

@media (max-width: 640px) {
  .mz-modal-overlay--fullscreen { padding: 0; }
  .mz-session-modal-card { height: 100vh; max-height: none; border-radius: 0; }
  .mz-session-modal-head { padding: 0.85rem 1rem; }
  .mz-session-progress-row { padding: 0.6rem 1rem; }
  .mz-session-main { padding: 1rem; }
  .mz-session-footer { padding: 0.85rem 1rem; }
  .mz-session-feedback-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ══════════════════════ SweetAlert2 — tema global (claro/escuro) ══════════════════════
   O SweetAlert2 é carregado via CDN sem nenhum tema — por padrão todo Swal.fire() aparece
   como um popup branco, quebrando a consistência no modo escuro. Este bloco cobre todos os
   usos do app (confirmações, prompts, formulários) de uma vez, sem precisar tocar no JS. */
.swal2-popup {
  background: var(--mz-surface) !important;
  color: var(--mz-text) !important;
  border-radius: 1.1rem !important;
  box-shadow: var(--mz-shadow-xl) !important;
}

.swal2-title {
  color: var(--mz-text) !important;
}

.swal2-html-container {
  color: var(--mz-text-subtle) !important;
}

.swal2-input,
.swal2-textarea,
.swal2-select {
  background: var(--mz-surface) !important;
  color: var(--mz-text) !important;
  border: 1px solid var(--mz-border) !important;
}

.swal2-input:focus,
.swal2-textarea:focus,
.swal2-select:focus {
  border-color: var(--mz-secondary-500) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15) !important;
}

.swal2-actions .swal2-confirm {
  background: #4f46e5 !important;
}

.swal2-cancel {
  background: var(--mz-bg-subtle) !important;
  color: var(--mz-text) !important;
}

.swal2-deny {
  background: #dc2626 !important;
}

.swal2-close {
  color: var(--mz-text-muted) !important;
}

.swal2-close:hover {
  color: var(--mz-text) !important;
}

.swal2-icon.swal2-question,
.swal2-icon.swal2-info {
  color: #4f46e5 !important;
  border-color: #4f46e5 !important;
}

/* Labeled Swal2 form modals (Criar grupo, Criar Evento, etc.) — the bare
   swal2-input/select/textarea defaults stack with no labels or spacing,
   which reads as "sem estilo". Wrap the html string in .mz-swal-form to
   get labels + consistent spacing without touching the base swal2 theme
   above (still shared by every plain confirm/alert in the app). */
.mz-swal-form {
  text-align: left;
}

.mz-swal-form .mz-swal-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mz-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0.9rem 0 0.35rem;
}

.mz-swal-form .mz-swal-label:first-child {
  margin-top: 0;
}

.mz-swal-form .mz-swal-row {
  display: flex;
  gap: 0.75rem;
}

.mz-swal-form .mz-swal-row > div {
  flex: 1;
  min-width: 0;
}

.mz-swal-form .swal2-input,
.mz-swal-form .swal2-select,
.mz-swal-form .swal2-textarea {
  margin: 0 !important;
  width: 100% !important;
}
