/* ==========================================================================
   DESIGN SYSTEM - CÂMARA DOS DEPUTADOS (COMUNICAÇÃO SOCIAL)
   Temas Específicos:
     - Light Mode: Azul e Branco (Institucional & Limpo)
     - Dark Mode: Cinza e Laranja (Grafite & Amber Focus)
   Totalmente sem Emojis | 100% Ícones Vetoriais
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

/* ==================== TEMA ESCURO (PADRÃO): CINZA E LARANJA ==================== */
:root, [data-theme="dark"] {
  --bg-page: #0f1115;
  --bg-card: #181b22;
  --bg-card-subtle: #20242e;
  --bg-hover: #262b37;

  --border-light: rgba(255, 255, 255, 0.08);
  --border-active: rgba(249, 115, 22, 0.4);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-main: #f97316;          /* Laranja vibrante */
  --accent-main-hover: #ea580c;
  --accent-main-soft: rgba(249, 115, 22, 0.12);
  --accent-pill-text: #fdba74;

  --accent-support: #e2e8f0;       /* Cinza claro de suporte */
  --accent-support-soft: rgba(255, 255, 255, 0.05);

  --progress-gradient: linear-gradient(90deg, #ea580c, #f97316, #fb923c);
  --badge-bg: rgba(249, 115, 22, 0.12);
  --badge-border: rgba(249, 115, 22, 0.35);
  --badge-text: #fdba74;

  --whatsapp-btn-bg: rgba(249, 115, 22, 0.12);
  --whatsapp-btn-border: rgba(249, 115, 22, 0.35);
  --whatsapp-btn-text: #fdba74;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ==================== TEMA CLARO: AZUL E BRANCO ==================== */
[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;

  --border-light: #e2e8f0;
  --border-active: rgba(29, 78, 216, 0.4);

  --text-primary: #0f172a;         /* Azul ardósia escuro */
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-main: #1d4ed8;          /* Azul Real Corporativo */
  --accent-main-hover: #1e40af;
  --accent-main-soft: rgba(29, 78, 216, 0.08);
  --accent-pill-text: #1e40af;

  --accent-support: #0284c7;       /* Azul ciano suave */
  --accent-support-soft: rgba(2, 132, 199, 0.08);

  --progress-gradient: linear-gradient(90deg, #1d4ed8, #2563eb, #38bdf8);
  --badge-bg: rgba(29, 78, 216, 0.08);
  --badge-border: rgba(29, 78, 216, 0.25);
  --badge-text: #1d4ed8;

  --whatsapp-btn-bg: rgba(29, 78, 216, 0.08);
  --whatsapp-btn-border: rgba(29, 78, 216, 0.25);
  --whatsapp-btn-text: #1d4ed8;

  --shadow-card: 0 4px 15px rgba(15, 23, 42, 0.06);
}

/* Reset Base & Transições Globais Suaves */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

/* Transição sedosa para todos os elementos estruturais no chaveamento de tema */
body, header, .progress-hero, .disciplina-card, .disc-head, .disc-body,
.topic-item, .security-panel, .cronograma-panel, .raio-x-box,
.btn-clean, .chip, .area-pill, .area-selector-bar, .streak-pill,
.countdown-pill, .snapshot-item, .search-input-wrapper input,
.status-pill-select, .rev-toggle, .questoes-box-clean, .btn-footer-link,
.btn-action-primary, .btn-action-whatsapp, .btn-action-restore,
.paste-restore-box, .paste-restore-box textarea, .theme-toggle-btn {
  transition: 
    background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.3s ease,
    box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 60px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-page);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 9999px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
header.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  padding: 18px 16px;
  position: sticky;
  top: 0;
  z-index: 90;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-container {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.header-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  margin-bottom: 4px;
}

.header-titles h1 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.header-titles p {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

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

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.theme-toggle-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-main);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

#theme-icon {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle-btn:hover #theme-icon {
  transform: rotate(45deg) scale(1.15);
}

/* Streak Pill */
.streak-pill {
  background: var(--accent-main-soft);
  border: 1px solid var(--border-active);
  padding: 8px 14px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-main);
}

.streak-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Countdown Pill */
.countdown-pill {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  padding: 8px 14px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.countdown-content {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.countdown-highlight {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-main);
}

.countdown-caption {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Área / Especialidade Selector */
.area-selector-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-card-subtle);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.area-selector-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.area-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.area-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: 9999px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.area-pill:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.area-pill.active {
  background: var(--accent-main);
  color: #ffffff;
  border-color: var(--accent-main);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   MAIN CONTAINER & PROGRESS HERO
   ========================================================================= */
.main-container {
  max-width: 1040px;
  margin: 20px auto 0;
  padding: 0 16px;
}

.progress-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.progress-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.progress-hero-text h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

.progress-hero-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.progress-hero-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent-main);
  line-height: 1;
}

.progress-track-lg {
  height: 10px;
  background: var(--bg-card-subtle);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-fill-lg {
  height: 100%;
  width: 0%;
  background: var(--progress-gradient);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.quick-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.quick-stat-item {
  display: flex;
  flex-direction: column;
}

.qs-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.qs-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   TOOLBAR & ACTIONS
   ========================================================================== */
.toolbar-clean {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-input-wrapper input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 12px 14px 12px 42px;
  border-radius: 10px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input-wrapper input:focus {
  border-color: var(--accent-main);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  color: var(--text-muted);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.chip.active {
  background: var(--accent-main);
  color: #ffffff;
  border-color: var(--accent-main);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-clean {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-clean:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.btn-clean.highlight-btn {
  border-color: var(--border-active);
  background: var(--accent-main-soft);
  color: var(--accent-main);
}

/* ==========================================================================
   PAINEL DE SEGURANÇA 24H & RESTAURAÇÃO
   ========================================================================== */
.security-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.panel-header-clean {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-header-clean h3 {
  font-size: 1.15rem;
  color: var(--text-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.btn-close-panel {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  padding: 4px;
  border-radius: 6px;
}
.btn-close-panel:hover {
  color: var(--text-primary);
}

.security-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.btn-action-primary {
  background: var(--accent-main);
  color: #ffffff;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 9px 15px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease;
}
.btn-action-primary:hover {
  background: var(--accent-main-hover);
}

.btn-action-whatsapp {
  background: var(--whatsapp-btn-bg);
  border: 1px solid var(--whatsapp-btn-border);
  color: var(--whatsapp-btn-text);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 9px 15px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-action-restore {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.paste-restore-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 18px;
}

.paste-restore-box label {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

.paste-restore-box textarea {
  width: 100%;
  height: 80px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 8px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  outline: none;
  resize: vertical;
}

.snapshots-section h4 {
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.snapshots-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.snapshot-item {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.snapshot-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-main);
}

.snapshot-details {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.btn-restore-snap {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--accent-main);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-restore-snap:hover {
  background: var(--accent-main);
  color: #ffffff;
}

/* ==========================================================================
   CRONOGRAMA PANEL
   ========================================================================== */
.cronograma-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 20px;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border-light);
}

.timeline-item {
  position: relative;
  font-size: 0.86rem;
}

.timeline-item::after {
  content: '';
  position: absolute;
  left: -18px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-main);
}

.timeline-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-main);
}

.timeline-text {
  color: var(--text-primary);
}

/* ==========================================================================
   DISCIPLINAS & TÓPICOS
   ========================================================================== */
.disciplinas-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.disciplina-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s ease;
  box-shadow: var(--shadow-card);
}

.disciplina-card:hover {
  border-color: var(--border-active);
}

.disc-head {
  padding: 16px 18px;
  background: var(--bg-card-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.disc-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.disc-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-p1 {
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
}

.badge-p2 {
  background: var(--accent-main-soft);
  color: var(--accent-main);
  border: 1px solid var(--border-active);
}

.disc-head h3 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.disc-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-main);
}

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

.disciplina-card.collapsed .disc-arrow {
  transform: rotate(-90deg);
}

.disciplina-card.collapsed .disc-body {
  display: none;
}

.disc-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Item de Tópico */
.topic-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.topic-item:hover {
  background: var(--bg-card-subtle);
  border-color: var(--border-active);
}

.topic-item.is-done {
  border-left: 4px solid var(--accent-main);
  background: var(--accent-main-soft);
}

.topic-main-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.topic-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
}

/* Custom Checkbox */
.custom-chk {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--text-muted);
  border-radius: 6px;
  background: var(--bg-card-subtle);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
}

.custom-chk:checked {
  background: var(--accent-main);
  border-color: var(--accent-main);
}

.custom-chk:checked::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg);
  margin-top: -2px;
}

.topic-title {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.45;
  font-weight: 500;
  transition: all 0.2s ease;
}

.topic-title.striked {
  color: var(--text-primary);
  opacity: 0.9;
  font-weight: 600;
}

.disc-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-main);
  background: var(--accent-main-soft);
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid var(--border-active);
  transition: all 0.2s ease;
}

.topic-right-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.status-pill-select {
  background: var(--bg-card-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.rev-toggle {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rev-toggle.active {
  background: var(--accent-main-soft);
  color: var(--accent-main);
  border-color: var(--accent-main);
}

/* Botão Raio-X Cebraspe */
.btn-raio-x {
  background: var(--accent-main-soft);
  border: 1px solid var(--border-active);
  color: var(--accent-main);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-raio-x:hover {
  background: var(--accent-main);
  color: #ffffff;
}

.btn-raio-x.active {
  background: var(--accent-main);
  color: #ffffff;
}

/* Caixa Expansível do Raio-X */
.raio-x-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-active);
  border-left: 4px solid var(--accent-main);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 8px;
  animation: fadeIn 0.2s ease;
}

.raio-x-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.raio-x-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 18px;
}

.raio-x-list li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.questoes-box-clean {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card-subtle);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.btn-q-counter {
  background: var(--bg-hover);
  border: none;
  color: var(--text-primary);
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.subtopics-container {
  margin-left: 22px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-left: 2px dashed var(--border-light);
  padding-left: 10px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-save-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.footer-backup-btns {
  display: flex;
  gap: 8px;
}

.btn-footer-link {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-footer-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Toast */
#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  color: var(--text-primary);
  border-left: 4px solid var(--accent-main);
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
  font-size: 0.85rem;
  font-weight: 600;
}

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

/* ==========================================================================
   RESPONSIVO MOBILE AVANÇADO (OTIMIZAÇÃO COMPLETA PARA SMARTPHONES)
   ========================================================================== */
@media (max-width: 768px) {
  /* Layout Base e Container */
  .main-container {
    padding: 0 10px;
    margin-top: 14px;
  }

  header.app-header {
    padding: 12px 10px;
    position: static;
  }

  .header-main-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-titles h1 {
    font-size: 1.3rem;
    line-height: 1.3;
  }

  .header-titles p {
    font-size: 0.82rem;
  }

  /* Linha de Badges do Topo */
  .header-right-badges {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .theme-toggle-btn {
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .streak-pill {
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .countdown-pill {
    grid-column: span 2;
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
  }

  /* Seletor de Cargo/Área (Desafogado, 1 por linha com toque confortável) */
  .area-selector-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }

  .area-pill-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }

  .area-pill {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    font-size: 0.84rem;
    padding: 10px 14px;
    border-radius: 8px;
  }

  /* Hero de Progresso */
  .progress-hero {
    padding: 16px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
  }

  .progress-hero-text h2 {
    font-size: 1.15rem;
  }

  .progress-hero-pct {
    font-size: 1.8rem;
  }

  .quick-stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 12px;
  }

  .quick-stat-item {
    background: var(--bg-card-subtle);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
  }

  .qs-label {
    font-size: 0.65rem;
  }

  .qs-val {
    font-size: 0.88rem;
  }

  /* Barra de Busca e Filtros */
  .toolbar-clean {
    gap: 10px;
    margin-bottom: 16px;
  }

  .search-input-wrapper input {
    padding: 10px 12px 10px 38px;
    font-size: 0.85rem;
  }

  .search-icon {
    width: 16px;
    left: 12px;
  }

  /* Chips de Filtro com Rolagem Horizontal Suave */
  .filter-chips {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 6px;
    scrollbar-width: none;
  }

  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 0.76rem;
  }

  /* Ações da Toolbar */
  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .toolbar-actions .highlight-btn {
    grid-column: span 2;
  }

  .btn-clean {
    justify-content: center;
    padding: 9px 10px;
    font-size: 0.78rem;
  }

  /* ==========================================================================
     DISCIPLINAS (CABEÇALHO DESAFOGADO)
     ========================================================================== */
  .disciplinas-wrapper {
    gap: 10px;
  }

  .disciplina-card {
    border-radius: 12px;
  }

  /* Header do card: Badge em cima à esquerda, Contador + Seta à direita, Título com largura total embaixo */
  .disc-head {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "badge meta"
      "title title";
    row-gap: 8px;
    column-gap: 10px;
    align-items: center;
    padding: 12px 14px;
  }

  .disc-title-wrap {
    display: contents; /* Desembrulha para o grid posicionar o badge e o título perfeitamente */
  }

  .disc-badge {
    grid-area: badge;
    justify-self: start;
    font-size: 0.68rem;
    padding: 3px 8px;
  }

  .disc-meta {
    grid-area: meta;
    justify-self: end;
    gap: 8px;
  }

  .disc-count {
    font-size: 0.76rem;
    padding: 2px 7px;
  }

  .disc-head h3 {
    grid-area: title;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
    margin: 0;
  }

  /* Corpo da Disciplina & Desafogamento dos Subtópicos */
  .disc-body {
    padding: 10px 8px;
    gap: 8px;
  }

  /* Reduz recuo excessivo de subitens para ganhar espaço de leitura */
  .subtopics-container {
    margin-left: 6px;
    margin-top: 6px;
    padding-left: 8px;
    border-left: 2px solid var(--border-active);
    gap: 6px;
  }

  /* ==========================================================================
     ITEM DE TÓPICO & BARRA DE CONTROLES MOBILE
     ========================================================================== */
  .topic-item {
    padding: 10px 10px;
    border-radius: 8px;
    gap: 8px;
  }

  .topic-main-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .topic-left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
  }

  .custom-chk {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 2px;
  }

  .topic-title {
    font-size: 0.88rem;
    line-height: 1.42;
    flex: 1;
  }

  /* Barra de Controles: Espaçosa, Limpa e Organizada */
  .topic-right-controls {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
  }

  .status-pill-select {
    flex: 1 1 auto;
    min-width: 110px;
    height: 32px;
    font-size: 0.78rem;
    padding: 4px 8px;
    border-radius: 6px;
  }

  .rev-toggle {
    min-width: 32px;
    height: 32px;
    font-size: 0.75rem;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
  }

  .questoes-box-clean {
    width: 100%;
    height: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-card-subtle);
    margin-top: 2px;
  }

  .btn-q-counter {
    width: 28px;
    height: 24px;
    font-size: 0.78rem;
  }

  /* Raio-X Cebraspe no Mobile */
  .raio-x-box {
    padding: 10px;
    margin-top: 6px;
    border-radius: 6px;
  }

  .raio-x-title {
    font-size: 0.82rem;
  }

  .raio-x-list {
    margin-left: 12px;
    gap: 6px;
  }

  .raio-x-list li {
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .btn-raio-x {
    padding: 5px 9px;
    font-size: 0.72rem;
  }

  /* Painel de Segurança e Rodapé */
  .security-actions-row {
    flex-direction: column;
    gap: 10px;
  }

  .btn-action-primary,
  .btn-action-whatsapp,
  .btn-action-restore {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
  }

  .app-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .footer-backup-btns {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .btn-footer-link {
    width: 100%;
    justify-content: center;
    padding: 9px 12px;
  }
}
