/* ==============================================================================
   PapiroRaiz — Design System Completo
   Light (book) & Dark themes — 100% coerentes, sem hardcoded colors
   ============================================================================== */

/* ======= TEMA CLARO (padrao / "book" / "white" / "light") ======= */
:root,
html[data-theme="book"],
html[data-theme="white"],
html[data-theme="light"] {
  --font-ui: "Inter", "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Newsreader", Georgia, serif;
  --font-sans: "Outfit", "Inter", -apple-system, sans-serif;

  /* Backgrounds */
  --bg-main: #f5f2eb;
  --bg-card: #ffffff;
  --bg-elevated: #edeae0;
  --bg-component: #f9f7f3;
  --bg-toolbar: #f0ede5;
  --bg-input: #ffffff;
  --bg-table-head: #ede9df;
  --bg-table-row-hover: rgba(136, 19, 55, 0.04);
  --bg-footer: #1c1917;
  --bg-header: rgba(249, 247, 243, 0.95);

  /* Bordas */
  --border-subtle: #ddd8cc;
  --border-medium: #ccc6ba;
  --border-focus: #881337;

  /* Textos */
  --text-main: #1c1917;
  --text-sub: #44403c;
  --text-muted: #78716c;
  --text-faint: #a8a29e;
  --text-on-dark: #f5f2eb;

  /* Acentos */
  --accent-primary: #881337;
  --accent-secondary: #78350f;
  --accent-blue: #1d4ed8;
  --accent-green: #065f46;
  --accent-yellow: #92400e;
  --accent-purple: #6d28d9;
  --accent-red: #991b1b;
  --accent-teal: #0d9488;

  /* Sombras */
  --shadow-sm: 0 1px 4px rgba(28, 25, 23, 0.06);
  --shadow-md: 0 4px 16px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 8px 28px rgba(28, 25, 23, 0.10);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

/* ======= TEMA ESCURO ======= */
html[data-theme="dark"] {
  --font-ui: "Inter", "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Newsreader", Georgia, serif;
  --font-sans: "Outfit", "Inter", -apple-system, sans-serif;

  /* Backgrounds */
  --bg-main: #060911;
  --bg-card: #0c1121;
  --bg-elevated: #111827;
  --bg-component: #0f1729;
  --bg-toolbar: #090d16;
  --bg-input: #0f172a;
  --bg-table-head: #070b14;
  --bg-table-row-hover: rgba(59, 130, 246, 0.06);
  --bg-footer: #020408;
  --bg-header: rgba(6, 9, 17, 0.88);

  /* Bordas */
  --border-subtle: #1e2d45;
  --border-medium: #2a3a52;
  --border-focus: #3b82f6;

  /* Textos */
  --text-main: #f1f5f9;
  --text-sub: #94a3b8;
  --text-muted: #64748b;
  --text-faint: #475569;
  --text-on-dark: #f1f5f9;

  /* Acentos */
  --accent-primary: #6366f1;
  --accent-secondary: #818cf8;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-purple: #a277ff;
  --accent-red: #ef4444;
  --accent-teal: #14b8a6;

  /* Sombras */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

/* ======= RESET & BASE ======= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.55;
  font-size: 13px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  width: 100%;
}

/* ======= HEADER PÚBLICO UNIFICADO (BLOG & LEITOR DE ESTUDOS) ======= */
.blog-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.blog-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  user-select: none;
}

.brand-icon {
  font-size: 22px;
  background: rgba(136, 19, 55, 0.08);
  border: 1px solid rgba(136, 19, 55, 0.2);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: transform 0.2s ease;
}
html[data-theme="dark"] .brand-icon {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
}
.brand-group:hover .brand-icon {
  transform: scale(1.05);
}

.brand-text-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  font-family: var(--font-sans);
  line-height: 1.2;
}

.brand-text-sub {
  font-size: 10px;
  color: var(--accent-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 1px;
}
html[data-theme="dark"] .brand-text-sub {
  color: var(--accent-secondary);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-btn {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
}

.nav-btn:hover {
  color: var(--text-main);
  background: var(--bg-elevated);
}

.nav-btn-qss {
  background: rgba(136, 19, 55, 0.08);
  border: 1px solid rgba(136, 19, 55, 0.2);
  color: var(--accent-primary);
  font-weight: 600;
}
.nav-btn-qss:hover {
  background: rgba(136, 19, 55, 0.16);
  color: var(--accent-primary);
}
html[data-theme="dark"] .nav-btn-qss {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
}
html[data-theme="dark"] .nav-btn-qss:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #ffffff;
}

/* ======= HEADER ADMINISTRATIVO (QSS) ======= */
.app-header {
  background: var(--bg-header);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 10px 16px;
}

.app-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo { font-size: 24px; line-height: 1; }

.brand-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.badge-connected {
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  border-radius: 999px;
  font-weight: 600;
}

.badge-disconnected {
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--accent-red);
  border-radius: 999px;
  font-weight: 600;
}

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

.header-metric {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.header-metric-val {
  font-weight: 800;
  color: var(--accent-green);
  font-size: 12px;
}

/* ======= BOTOES ======= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: var(--font-ui);
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}
.btn-primary:hover { filter: brightness(1.15); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-main);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: var(--bg-toolbar);
  border-color: var(--border-medium);
}

.btn-sync {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
  border-color: rgba(59, 130, 246, 0.25);
}
.btn-sync:hover { background: rgba(59, 130, 246, 0.22); }

.btn-sync.spinning span {
  display: inline-block;
  animation: spin 1s linear infinite;
}

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

.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-xl);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  transition: all 0.2s ease;
  user-select: none;
  font-family: var(--font-ui);
}
.btn-theme-toggle:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ======= TOOLBAR DO QSS ======= */
.qss-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.qss-category-select-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.qss-filter-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qss-filter-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.qss-category-select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: border-color 0.2s;
  max-width: 220px;
}
.qss-category-select:focus { border-color: var(--border-focus); }

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

.qss-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.qss-search-icon {
  position: absolute;
  left: 9px;
  font-size: 12px;
  color: var(--text-faint);
  pointer-events: none;
}

.qss-search-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px 6px 28px;
  font-size: 11px;
  color: var(--text-main);
  outline: none;
  width: 190px;
  transition: border-color 0.2s;
  font-family: var(--font-ui);
}
.qss-search-input::placeholder { color: var(--text-faint); }
.qss-search-input:focus { border-color: var(--border-focus); }

.qss-layout-modes-group {
  display: flex;
  align-items: center;
  background: var(--bg-component);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.qss-layout-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui);
}
.qss-layout-mode-btn.active {
  background: var(--bg-elevated);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}
.qss-layout-mode-btn:hover:not(.active) { color: var(--text-sub); }

/* ======= CAPSULAS GRID ======= */
.qss-capsules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.qss-capsule-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.qss-capsule-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

html[data-theme="dark"] .qss-capsule-card {
  background: linear-gradient(145deg, #0c1121, #0e1630);
}

.qss-capsule-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qss-capsule-category {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: var(--accent-blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.qss-capsule-category:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.45);
  transform: translateY(-1px);
}

.qss-capsule-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qss-capsule-hours {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-yellow);
}

.qss-capsule-pct {
  font-size: 12px;
  font-weight: 800;
}

.qss-capsule-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.qss-capsule-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qss-capsule-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.qss-capsule-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.qss-capsule-stages-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.qss-capsule-active-task {
  background: var(--bg-component);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.qss-capsule-active-task:hover { background: var(--bg-elevated); }

.qss-capsule-task-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-sub);
}

.qss-capsule-task-highlight {
  font-weight: 600;
  color: var(--accent-yellow);
}

.qss-capsule-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ======= TABELA DENSA ======= */
.qss-dense-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

.qss-dense-table th {
  background: var(--bg-table-head);
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.qss-dense-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-main);
}

.qss-dense-table tr:hover td { background: var(--bg-table-row-hover); }

.qss-done-today-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border-medium);
  background: var(--bg-component);
  color: var(--text-faint);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  transition: all 0.15s;
}
.qss-done-today-btn.active {
  background: var(--accent-green);
  color: #fff;
  border-color: var(--accent-green);
}

/* ======= DRAWER ======= */
.qss-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.qss-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.qss-project-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 90vw;
  background: var(--bg-card);
  border-left: 1px solid var(--border-subtle);
  z-index: 51;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.qss-project-drawer.active { transform: translateX(0); }

.qss-drawer-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-component);
}

.qss-drawer-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-card);
}

.qss-drawer-card {
  background: var(--bg-component);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qss-drawer-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-component);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qss-quick-log-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.qss-drawer-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
}
.qss-drawer-close-btn:hover { color: var(--text-main); }

/* ======= ANALYTICS ======= */
.qss-analytics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 860px) {
  .qss-analytics-grid { grid-template-columns: 1fr 1fr; }
}

.qss-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-md);
}

.qss-chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.qss-chart-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.qss-chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 280px;
}

.qss-chart-filter-group {
  display: inline-flex;
  background: var(--bg-component);
  border: 1px solid var(--border-medium);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.qss-chart-period-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: var(--font-ui);
}
.qss-chart-period-btn:hover {
  color: var(--text-main);
  background: var(--bg-elevated);
}
.qss-chart-period-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* ======= MODAIS ======= */
.qss-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.qss-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 95%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.qss-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.qss-modal-close:hover { color: var(--text-main); }

.qss-modal-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* ======= SWITCH TOGGLE ======= */
.qss-switch-wrap { user-select: none; }
.qss-toggle-switch {
  width: 34px;
  height: 18px;
  background: var(--bg-elevated);
  border-radius: 10px;
  position: relative;
  transition: all 0.2s ease;
  display: inline-block;
  border: 1px solid var(--border-medium);
  flex-shrink: 0;
}
.qss-toggle-switch::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-faint);
  top: 1px;
  left: 2px;
  transition: transform 0.2s ease, background 0.2s ease;
}
.qss-toggle-switch.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-green);
}
.qss-toggle-switch.active::after {
  transform: translateX(15px);
  background: var(--accent-green);
}

/* ======= COLOR PICKER ======= */
.qss-queue-color-picker-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.qss-modal-queue-color-input {
  position: absolute;
  opacity: 0;
  width: 24px;
  height: 24px;
  cursor: pointer;
}
.qss-color-preview-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border-medium);
  display: inline-block;
  flex-shrink: 0;
}
.qss-color-hex-text {
  font-size: 10px;
  font-family: monospace;
  color: var(--text-muted);
}

/* ======= TABELA DENSA — DONE & DRAG ======= */
.qss-dense-table-row.done-today td {
  opacity: 0.45;
  text-decoration: line-through;
}
.qss-dense-table-row.done-today td.col-done-actions,
.qss-dense-table-row.done-today td.col-drag,
.qss-dense-table-row.done-today td.col-pos {
  opacity: 1;
  text-decoration: none;
}

.qss-dense-table-row.is-dragging {
  opacity: 0.4;
  background: var(--bg-table-row-hover);
}

.qss-dense-table-row.drag-over-top td {
  border-top: 2px solid var(--accent-primary) !important;
}

.qss-dense-table-row.drag-over-bottom td {
  border-bottom: 2px solid var(--accent-primary) !important;
}

.qss-drag-handle {
  color: var(--text-faint);
  cursor: grab;
  user-select: none;
  display: inline-block;
  padding: 3px 6px;
  border-radius: var(--radius-sm, 4px);
  transition: color 0.15s ease, background-color 0.15s ease;
  font-size: 13px;
  line-height: 1;
}
.qss-drag-handle:hover {
  color: var(--text-main);
  background: var(--bg-elevated);
}
.qss-drag-handle:active {
  cursor: grabbing;
}

.qss-study-queue-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-component);
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* ======= RESPONSIVIDADE MOBILE ======= */
@media (max-width: 640px) {
  .app-header-inner { flex-direction: column; align-items: flex-start; }
  .header-actions { width: 100%; justify-content: space-between; }
  .qss-capsules-grid { grid-template-columns: 1fr; }
  .qss-project-drawer { width: 100vw; max-width: 100vw; }
}

/* ======= MARCA-TEXTO / GRIFO / SUBLINHADO ======= */
.doc-highlight, mark {
  background: #fef08a;
  color: #1c1917;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
}
html[data-theme="dark"] .doc-highlight,
html[data-theme="dark"] mark {
  background: rgba(234, 179, 8, 0.28);
  color: #fef08a;
  border: 1px solid rgba(234, 179, 8, 0.35);
}
.doc-underline {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ======= TACHADO / RISCADO & CITAÇÕES ======= */
.doc-strike, s, strike, del {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.85;
}

.doc-quote, blockquote {
  border-left: 3px solid var(--accent-primary, #6366f1);
  padding: 8px 16px;
  margin: 12px 0;
  font-style: italic;
  background: var(--bg-card);
  border-radius: 0 8px 8px 0;
  color: var(--text-main);
}
