:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #68635e;
  --line: #ded8ce;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --bad: #b91c1c;
  --good: #15803d;
  --shadow: 0 12px 36px rgba(39, 35, 28, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.sidebar-toggle {
  position: fixed;
  z-index: 40;
  top: 14px;
  left: 14px;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-color: #c9d8d5;
  background: var(--panel);
  color: var(--accent-strong);
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(39, 35, 28, 0.12);
}

button.active {
  border-color: var(--accent);
  background: #dff5ef;
  color: var(--accent-strong);
}

.sidebar {
  grid-column: 1;
  grid-row: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 20px 24px 72px;
  border-right: 1px solid var(--line);
  background: #fbfaf7;
  transition: width 180ms ease, padding 180ms ease, transform 180ms ease;
}

.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

.sidebar-collapsed .sidebar {
  width: 64px;
  padding: 74px 8px 12px;
  overflow-x: hidden;
}

.sidebar-collapsed .sidebar > *:not(.brand) {
  display: none;
}

.sidebar-collapsed .brand {
  justify-content: center;
  margin-bottom: 0;
}

.sidebar-collapsed .brand div {
  display: none;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.1;
}

.auth-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.auth-status {
  display: grid;
  gap: 2px;
}

.auth-status span {
  color: var(--muted);
  font-size: 13px;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form input {
  min-height: 38px;
  padding: 9px 10px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-actions button,
.auth-panel > button {
  width: 100%;
}

.link-btn {
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #155e75;
  text-align: left;
}

.link-btn:hover {
  text-decoration: underline;
}

.brand p,
.topbar p,
.field span,
.stats span,
.tags span,
#positionLabel {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field span {
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.stats div {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stats strong {
  font-size: 20px;
}

.app {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 100vh;
  padding: 30px clamp(22px, 5vw, 72px);
}

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 24px;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab {
  min-height: 38px;
  padding: 0 8px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  font-size: 15px;
}

.tab.active {
  border-bottom-color: #155e75;
  background: transparent;
  color: #155e75;
}

.tab.admin-tab {
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
}

.tab.admin-tab.active {
  border-bottom-color: #8a6a2a;
  color: #8a6a2a;
}

.dashboard {
  margin-top: 8px;
}

.panel-section {
  padding-bottom: 4px;
}

.admin-tools {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.admin-tools button {
  width: 100%;
}

.study-section {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.study-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.study-section h3 {
  margin: 0;
  font-size: 16px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-line {
  margin: 0 0 14px;
  color: var(--muted);
}

.legend {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.dominated {
  background: #1d4ed8;
}

.consolidated {
  background: #39b92f;
}

.building {
  background: #f59e0b;
}

.fragile {
  background: #ef4444;
}

.unseen {
  background: #e5e7eb;
  border: 1px solid #cfd4dc;
}

.session-builder {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.compact-field {
  margin-bottom: 14px;
}

.session-builder > span {
  width: 100%;
}

.session-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.session-toggle input {
  width: auto;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active,
.primary-btn {
  background: #155e75;
  color: #fff;
}

.danger-lite {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff7f7;
}

.danger-lite:hover {
  background: #fee2e2;
}

.reset-section {
  border-top-color: #f3c6c6;
}

.reset-section .danger-lite {
  width: 100%;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.comments-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.comments-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.comments-head p,
.comment-meta,
.comment-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.comment-form {
  display: grid;
  gap: 10px;
}

.comment-form textarea {
  width: 100%;
  resize: vertical;
}

.comments-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.comment-body {
  line-height: 1.45;
}

.markdown-content {
  display: grid;
  gap: 12px;
}

.markdown-content p {
  margin: 0;
}

.markdown-content strong {
  font-weight: 800;
}

.markdown-content .markdown-heading {
  font-weight: 700;
}

.comment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.comment-delete {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff7f7;
}

.comment-edit-box textarea {
  width: 100%;
  resize: vertical;
}

.notes-list {
  display: grid;
  gap: 10px;
}

.saved-note-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.saved-note-item strong {
  font-size: 14px;
}

.saved-note-preview {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

.saved-note-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.saved-note-actions span {
  color: var(--muted);
  font-size: 12px;
}

.good-text {
  color: var(--good);
}

.bad-text {
  color: var(--bad);
}

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

.exam-timer {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent-strong);
  font-weight: 800;
}

.exam-result {
  display: grid;
  gap: 10px;
}

.topbar p,
.topbar h2 {
  margin: 0;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.1;
}

.actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  padding: 0;
  font-size: 21px;
}

.question-shell {
  display: grid;
  /* a coluna acompanha a largura da tela; sem isso o mapa de questões (21 colunas)
     alargava a página e empurrava "Próxima" para fora em notebooks */
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  max-width: 980px;
  margin: 0 auto;
}

.start-panel {
  display: grid;
  gap: 14px;
  padding: clamp(24px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.start-panel h2,
.start-panel p {
  margin: 0;
}

.start-panel p {
  color: var(--muted);
  line-height: 1.5;
  max-width: 650px;
}

.no-question-active .question-nav,
.no-question-active .question-map,
.no-question-active .question-card,
.no-question-active .editor-panel,
.no-question-active .notes {
  display: none;
}

.flashcard-active .question-nav,
.flashcard-active .question-map,
.flashcard-active .question-card,
.flashcard-active .editor-panel,
.flashcard-active .notes {
  display: none;
}

.question-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.question-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.map-item {
  min-height: 40px;
  padding: 0;
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
}

.map-item.active {
  border-color: #155e75;
  background: #155e75;
  color: #fff;
}

.map-item.selected:not(.active) {
  border-color: #9ca3af;
  background: #f1f2f3;
  color: var(--ink);
}

.map-item.correct:not(.active) {
  border-color: #86efac;
  background: #eefaf1;
  color: #166534;
}

.map-item.wrong:not(.active) {
  border-color: #fecaca;
  background: #fff1f1;
  color: #991b1b;
}

.question-card,
.editor-panel,
.notes {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.question-card {
  min-height: 56vh;
  padding: clamp(22px, 4vw, 46px);
}

.tags {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tags.visible {
  display: flex;
}

.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fbfaf7;
  font-size: 13px;
}

.question-text {
  margin: 0 0 22px;
  font-size: 21px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  width: 100%;
  min-height: 52px;
  padding: 12px;
  text-align: left;
}

.option.selected {
  border-color: #9ca3af;
  background: #f1f2f3;
}

.option.pending .option-letter {
  background: #d7dbe0;
  color: var(--ink);
}

.option.correct {
  border-color: var(--good);
  background: #eefaf1;
}

.option.wrong {
  border-color: var(--bad);
  background: #fff1f1;
}

.option.discarded {
  color: var(--muted);
  background: #fafafa;
}

.option.discarded .option-text {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.discard-toggle {
  align-self: center;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.discard-toggle:hover,
.discard-toggle.active {
  border-color: #9ca3af;
  background: #eef2f7;
  color: var(--ink);
}

.option-letter {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: #ebe7df;
  font-weight: 800;
}

.question-tools {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-tools #confirmAnswerBtn {
  min-width: 210px;
}

.tool-details {
  color: var(--muted);
}

.tool-details summary {
  width: fit-content;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.secondary-tools {
  margin-top: 10px;
}

#confirmPendingBtn {
  width: 100%;
  margin-top: 8px;
}

.pending-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.pending-summary button {
  display: grid;
  gap: 2px;
  height: auto;
  min-height: 62px;
  padding: 10px;
  text-align: left;
}

.pending-summary strong {
  font-size: 18px;
}

.pending-summary span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.error-type-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.error-type-panel > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.error-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.error-type-grid button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 14px;
}

.error-type-grid button.active {
  border-color: #155e75;
  background: #eaf6fb;
  color: #155e75;
  font-weight: 700;
}

.error-notebook {
  display: grid;
  gap: 8px;
}

.session-summary {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.summary-grid div,
.summary-focus,
.notebook-row {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.summary-grid strong {
  font-size: 18px;
}

.summary-grid span,
.summary-focus span,
.summary-focus small,
.notebook-row span,
.notebook-row small {
  color: var(--muted);
}

.summary-focus {
  gap: 8px;
}

.dangerous-list {
  display: grid;
  gap: 8px;
}

.summary-focus .primary-btn {
  width: 100%;
}

.notebook-row {
  width: 100%;
  min-height: auto;
  text-align: left;
}

.notebook-row:hover {
  border-color: var(--accent);
}

.notebook-row small {
  line-height: 1.35;
}

.editor-panel {
  padding: 18px;
}

.editor-head,
.editor-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.editor-head {
  margin-bottom: 16px;
}

.editor-head h3 {
  margin: 0;
  font-size: 20px;
}

.edit-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.editor-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.answer-field {
  width: 160px;
  margin-bottom: 0;
}

.answer-box {
  display: none;
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  color: var(--muted);
  font-weight: 700;
}

.answer-box.visible {
  display: block;
}

.pending-review-panel {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #d97706;
  border-radius: 8px;
  background: #fff7ed;
}

.pending-review-panel div {
  display: grid;
  gap: 4px;
}

.pending-review-panel span,
.editor-hint {
  color: var(--muted);
}

.pending-review-panel button {
  flex: 0 0 auto;
}

.editor-hint {
  margin: -6px 0 16px;
  line-height: 1.45;
}

#correctBtn.active {
  border-color: var(--good);
  color: var(--good);
}

#wrongBtn.active {
  border-color: var(--bad);
  color: var(--bad);
}

.notes {
  padding: 18px;
}

.notes .field {
  margin: 0;
}

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: min(86vw, 390px);
    height: 100vh;
    padding: 72px 18px 22px;
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateX(0);
  }

  .sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar-collapsed .sidebar {
    width: min(86vw, 390px);
    padding: 72px 18px 22px;
    transform: translateX(calc(-100% + 64px));
  }

  .sidebar-collapsed .sidebar > *:not(.brand) {
    display: none;
  }

  .sidebar-collapsed .brand div {
    display: none;
  }

  .app {
    grid-column: 1;
    grid-row: 1;
    padding: 78px 14px 24px 74px;
  }

  .topbar {
    align-items: flex-start;
  }

  .question-card {
    padding: 18px;
  }

  .question-text {
    font-size: 18px;
    line-height: 1.55;
  }

  .question-map {
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
  }

  .option {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .discard-toggle {
    grid-column: 2;
    justify-self: start;
  }

  .question-nav,
  .tool-row {
    align-items: stretch;
  }

  .edit-options {
    grid-template-columns: 1fr;
  }

  .pending-review-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .error-type-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Notion-inspired visual refresh */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eff6ff;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --good: #16a34a;
  --good-soft: #f0fdf4;
  --shadow: none;
  --radius: 12px;
  --radius-sm: 10px;
  --content-width: 1040px;
}

body.theme-dark {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #111827;
  --panel-soft: #1f2937;
  --ink: #f9fafb;
  --muted: #9ca3af;
  --line: #253244;
  --line-strong: #334155;
  --accent: #60a5fa;
  --accent-strong: #93c5fd;
  --accent-soft: #172554;
  --warn-soft: #2a1c08;
  --bad-soft: #2a1114;
  --good-soft: #082414;
}

html {
  background: var(--bg);
}

body {
  grid-template-columns: 360px minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Geist, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

button {
  min-height: 38px;
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font-weight: 520;
}

button:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 2px;
}

button.active,
.segmented button.active,
.primary-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-btn:hover,
.segmented button.active:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.link-btn {
  color: var(--accent);
}

input,
select,
textarea {
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

.sidebar {
  padding: 22px 18px 24px 68px;
  border-right-color: var(--line);
  background: var(--panel);
}

.sidebar-toggle {
  top: 16px;
  left: 14px;
  width: 40px;
  min-height: 40px;
  border-color: var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--muted);
  box-shadow: none;
}

.brand {
  margin-bottom: 20px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--ink);
  color: var(--panel);
  font-size: 14px;
}

.brand h1 {
  font-size: 20px;
  letter-spacing: 0;
}

.theme-toggle {
  width: 100%;
  justify-content: flex-start;
  margin: -4px 0 16px;
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
  text-align: left;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
  color: var(--ink);
}

body.theme-dark .theme-toggle {
  background: #1f2937;
  color: #d1d5db;
}

.brand p,
.topbar p,
.field span,
.stats span,
.tags span,
#positionLabel {
  color: var(--muted);
}

.auth-panel,
.stats div,
.admin-tools,
.session-toggle,
.history-item,
.comment-item,
.summary-grid div,
.summary-focus,
.notebook-row,
.question-map,
.question-card,
.editor-panel,
.notes,
.start-panel,
.pending-summary button,
.answer-box,
.pending-review-panel {
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: none;
}

.auth-panel {
  gap: 12px;
  padding: 14px;
}

.tabs {
  display: grid;
  gap: 4px;
  border-bottom: 0;
  margin-bottom: 18px;
  overflow: visible;
}

.tab {
  justify-content: flex-start;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  text-align: left;
}

.tab:hover {
  border-color: transparent;
  background: var(--panel-soft);
  color: var(--ink);
}

.tab.active,
.tab.admin-tab.active {
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tab.admin-tab {
  margin-left: 0;
  color: var(--muted);
}

.dashboard {
  display: grid;
  gap: 18px;
}

.study-section {
  gap: 12px;
  padding: 18px 0;
  border-top-color: var(--line);
}

.study-section h3,
.panel-section h3 {
  font-size: 15px;
  letter-spacing: 0;
}

.panel-line {
  color: var(--muted);
  line-height: 1.45;
}

.stats,
.summary-grid {
  gap: 10px;
}

.stats div,
.summary-grid div {
  padding: 14px;
}

.stats strong,
.summary-grid strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.1;
}

.legend {
  gap: 8px;
  font-size: 14px;
}

.dominated {
  background: #2563eb;
}

.consolidated {
  background: var(--good);
}

.building {
  background: #f59e0b;
}

.fragile {
  background: var(--bad);
}

.unseen {
  background: #e5e7eb;
  border-color: #d1d5db;
}

.admin-tools {
  background: var(--panel);
}

.app {
  padding: 28px clamp(18px, 4vw, 64px) 48px;
}

.topbar,
.question-shell {
  max-width: var(--content-width);
}

.topbar {
  margin-bottom: 18px;
}

.topbar h2 {
  margin-top: 2px;
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 680;
  letter-spacing: 0;
}

.topbar p {
  font-size: 13px;
}

.actions {
  gap: 6px;
}

.icon-btn {
  width: 40px;
  min-height: 40px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 18px;
}

.question-shell {
  gap: 14px;
}

.start-panel {
  padding: clamp(26px, 5vw, 48px);
}

.question-nav {
  padding: 2px 0;
}

.question-nav button {
  min-width: 104px;
}

.question-map {
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 7px;
  padding: 12px;
  background: var(--panel);
}

.map-item {
  min-height: 36px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 620;
}

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

.map-item.selected:not(.active) {
  border-color: var(--line-strong);
  background: #f3f4f6;
  color: var(--ink);
}

.map-item.correct:not(.active) {
  border-color: #bbf7d0;
  background: var(--good-soft);
  color: #15803d;
}

.map-item.wrong:not(.active) {
  border-color: #fecaca;
  background: var(--bad-soft);
  color: #b91c1c;
}

.question-card {
  min-height: 58vh;
  padding: clamp(26px, 4vw, 52px);
}

.tags {
  gap: 7px;
  margin-bottom: 20px;
}

.tags span {
  border-color: var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.question-text {
  max-width: 84ch;
  margin-bottom: 26px;
  color: var(--ink);
  font-size: clamp(18px, 1.5vw, 21px);
  line-height: 1.72;
}

.options {
  gap: 12px;
}

.option {
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 13px;
  min-height: 58px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  line-height: 1.48;
}

.option:hover {
  border-color: var(--line-strong);
  background: #fbfdff;
}

.option.selected {
  border-color: var(--line-strong);
  background: #f3f4f6;
}

.option.pending .option-letter {
  background: #e5e7eb;
  color: var(--ink);
}

.option.correct {
  border-color: #86efac;
  background: var(--good-soft);
}

.option.wrong {
  border-color: #fca5a5;
  background: var(--bad-soft);
}

.option.discarded {
  background: var(--panel-soft);
}

.option-letter {
  width: 28px;
  height: 28px;
  background: #f3f4f6;
  color: #374151;
  font-size: 14px;
}

.discard-toggle {
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.discard-toggle:hover,
.discard-toggle.active {
  border-color: var(--line-strong);
  background: #f3f4f6;
  color: var(--ink);
}

.question-tools,
.error-type-panel {
  border-top-color: var(--line);
}

.tool-row {
  gap: 8px;
}

.tool-details summary {
  color: var(--muted);
}

.answer-box {
  background: var(--panel-soft);
  color: var(--muted);
}

.pending-review-panel {
  border-color: #fcd34d;
  background: var(--warn-soft);
}

.error-type-grid button {
  border-radius: var(--radius-sm);
}

.error-type-grid button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.segmented {
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.segmented button {
  background: transparent;
}

.session-toggle {
  background: var(--panel);
}

.danger-lite {
  border-color: #fecaca;
  background: var(--bad-soft);
  color: #b91c1c;
}

.danger-lite:hover {
  border-color: #fca5a5;
  background: #fee2e2;
}

.comment-body,
.markdown-content,
.saved-note-preview {
  line-height: 1.6;
}

.notebook-row:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.exam-sidebar {
  display: grid;
  gap: 18px;
  padding-top: 0;
  border-top: 0;
}

.exam-panel-head {
  display: grid;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.exam-panel-head span,
.exam-sidebar h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.exam-panel-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 680;
}

.exam-sidebar .field {
  margin-bottom: 12px;
}

.exam-study-card,
.exam-progress-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.exam-study-card {
  background: linear-gradient(180deg, var(--panel) 0%, #fbfdff 100%);
}

.exam-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.exam-metrics div {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.exam-metrics strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.exam-metrics span,
.exam-progress-list span {
  color: var(--muted);
  font-size: 12px;
}

.exam-study-card .primary-btn {
  width: 100%;
}

.exam-study-card .tertiary-btn {
  width: 100%;
}

.tertiary-btn {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.tertiary-btn:hover {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

.exam-sidebar > .field:nth-of-type(3) {
  padding-top: 2px;
  border-top: 1px solid var(--line);
}

.exam-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.exam-actions .tertiary-btn {
  grid-column: 1 / -1;
}

.exam-timer {
  width: fit-content;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.exam-result {
  gap: 8px;
}

.exam-progress-list {
  display: grid;
  gap: 10px;
}

.exam-progress-list div {
  display: grid;
  gap: 2px;
}

.exam-progress-list strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

body.theme-dark .exam-study-card {
  background: var(--panel);
}

/* Student journey navigation and study planner */
.admin-nav-divider {
  margin: 12px 8px 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.study-planner-head {
  display: grid;
  gap: 5px;
  margin-bottom: 18px;
}

.study-planner-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.study-planner-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.study-planner-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

#activityPanel {
  display: none;
}

#activityPanel.active {
  display: grid;
  gap: 18px;
}

#activityPanel .session-builder {
  display: grid;
  gap: 12px;
  margin-bottom: 0;
}

#activityPanel .session-builder > span {
  width: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#activityPanel .segmented {
  width: fit-content;
  max-width: 100%;
  border-radius: 12px;
  background: var(--panel);
}

#activityPanel .segmented button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
}

#activityPanel .segmented button.active {
  color: #ffffff;
}

#activityPanel .session-toggle {
  width: fit-content;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

/* Imagem da questão no editor. */
.edit-image {
  display: grid;
  gap: 8px;
}

.edit-image img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.edit-image-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.edit-image-pick {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
}

/* Busca de questões (Estudo por temas). */
.question-search {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius, 12px);
  background: var(--panel-soft, var(--panel));
}

.question-search input {
  width: 100%;
  min-width: 0;
}

#questionSearchResults:empty {
  display: none;
}

#questionSearchResults .panel-line {
  margin: 0;
}

.search-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  font-size: 14px;
}

.search-summary .primary-btn {
  min-height: 36px;
  padding: 0 14px;
}

.search-previews {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.search-preview {
  padding: 8px 10px;
  border-left: 3px solid var(--line);
  background: var(--panel);
}

.search-preview small {
  color: var(--muted);
  font-size: 12px;
}

.search-preview p {
  margin: 2px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
}

.search-preview mark {
  padding: 0 2px;
  border-radius: 3px;
  background: var(--warn-soft, #fff3c4);
  color: inherit;
}

/* Caderno de erros para imprimir (Hoje > Outras revisões). */
.print-errors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.print-errors select {
  flex: 1 1 200px;
  min-width: 0;
}

.print-errors .outline-btn {
  min-height: 38px;
  padding: 0 14px;
}

/* Comparação com os outros usuários. */
#communityLine {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Simulado personalizado (aba Provas). */
.custom-sim {
  display: grid;
  gap: 10px;
}

.custom-sim .panel-line {
  margin: 0;
}

.custom-sim-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.custom-sim .segmented {
  width: fit-content;
  max-width: 100%;
}

/* Histórico de simulados (aba Provas). */
.sim-history {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.sim-history h4 {
  margin: 0;
}

.sim-list {
  display: grid;
  gap: 8px;
}

.sim-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  background: var(--panel);
}

.sim-item-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
}

.sim-item-head strong {
  font-size: 14px;
}

.sim-item-head span,
.sim-item-score span {
  color: var(--muted);
  font-size: 12.5px;
}

.sim-item-score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.sim-item-score strong {
  font-size: 20px;
}

.sim-delta {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.sim-delta.good { background: var(--good-soft, #f0fdf4); color: var(--good); }
.sim-delta.bad { background: var(--bad-soft, #fef2f2); color: var(--bad); }
.sim-delta.same { background: var(--panel-soft, #f4f4f5); color: var(--muted); }

.sim-item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.sim-item-actions .outline-btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

/* Enunciado: citação do livro recolhida e caso clínico da SES-DF num quadro. */
.question-citation {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  white-space: normal;
  cursor: help;
}

.question-case {
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  background: var(--panel-soft, var(--panel));
  font-size: 0.86em;
  line-height: 1.65;
}

.question-case > summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: normal;
}

.question-case-text {
  margin-top: 8px;
  white-space: pre-wrap;
}

.question-statement {
  display: block;
  font-weight: 600;
}

/* Comentário da questão, depois do gabarito. */
.explanation-panel {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm, 10px);
  background: var(--accent-soft, var(--panel));
}

.explanation-panel.empty {
  border-left-color: var(--line);
  background: var(--panel);
}

.explanation-panel h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.explanation-panel .markdown-content p {
  margin: 0 0 8px;
  line-height: 1.6;
}

.explanation-panel .markdown-content p:last-child {
  margin-bottom: 0;
}

.explanation-panel .link-btn {
  justify-self: start;
}

/* Botões do topo da questão (ícones). */
.icon-btn {
  display: inline-grid;
  place-items: center;
}

#favoriteBtn.active,
#reviewBtn.active {
  border-color: var(--accent);
  background: var(--accent-soft, transparent);
  color: var(--accent-strong);
}

#favoriteBtn.active svg {
  fill: currentColor;
}

#reviewBtn.active svg {
  fill: currentColor;
}

.icon-btn-danger {
  margin-left: 10px;
}

.icon-btn-danger:hover {
  border-color: var(--bad);
  color: var(--bad);
}

.kbd-hint {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
}

.kbd-hint kbd {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 11px;
}

@media (hover: none), (max-width: 860px) {
  .kbd-hint {
    display: none;
  }
}

/* Depois de responder: uma linha de 4 botões no acerto. */
.quick-grade-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-grade-hint {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 560px) {
  .quick-grade-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Estudo por temas: lista única de temas + montagem do bloco. */
.topic-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.topic-picker input {
  flex: 1 1 220px;
  min-width: 0;
}

.topic-picker-actions {
  display: flex;
  gap: 12px;
}

.topic-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.topic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  background: var(--panel);
}

.topic-row.selected {
  border-color: var(--accent);
  background: var(--accent-soft, var(--panel));
}

.topic-row-main {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 3px;
  align-items: center;
  min-width: 0;
  cursor: pointer;
}

.topic-row-main input {
  grid-row: 1 / span 3;
  align-self: start;
  margin-top: 2px;
}

.topic-row-name {
  font-weight: 650;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.topic-row-meta {
  color: var(--muted);
  font-size: 12.5px;
}

.topic-row-track {
  display: block;
  height: 5px;
  margin-top: 3px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
}

.topic-row-track i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.topic-row-continue {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.topic-row-continue:disabled {
  opacity: 0.55;
  cursor: default;
}

.topic-row-actions {
  display: grid;
  justify-items: stretch;
  gap: 2px;
}

.topic-row-all {
  min-height: 26px;
  padding: 0 6px;
  font-size: 12.5px;
  text-align: center;
}

.topic-subthemes {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.topic-subthemes > summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
}

.subtheme-rows {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.subtheme-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 0 6px 30px;
}

.subtheme-row + .subtheme-row {
  border-top: 1px dashed var(--line);
}

.subtheme-row-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.subtheme-row-text span {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.subtheme-row-text small {
  color: var(--muted);
  font-size: 12px;
}

.subtheme-row .topic-row-continue {
  min-height: 30px;
  font-size: 12.5px;
}

#activityPanel .block-builder {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius, 12px);
  background: var(--panel-soft, var(--panel));
}

.block-builder h4 {
  margin: 0;
  font-size: 16px;
}

.block-builder #topicModeLine {
  margin: -6px 0 0;
}

.block-builder #startSessionBtn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Telas largas: lista à esquerda, "Montar bloco" fixo à direita enquanto a lista rola. */
@media (min-width: 1100px) {
  #activityPanel.active {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
  }

  #activityPanel > .study-planner-head,
  #activityPanel > .question-search,
  #activityPanel > .topic-picker,
  #activityPanel > .topic-list {
    grid-column: 1;
  }

  #activityPanel > .block-builder {
    grid-column: 2;
    grid-row: 1 / span 4;
    position: sticky;
    top: 16px;
  }

  #activityPanel > .session-summary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .topic-row {
    gap: 8px;
    padding: 10px;
  }

  #activityPanel .topic-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #activityPanel .topic-row-continue,
  #activityPanel .topic-row-all {
    width: auto;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
  }

  #activityPanel .subtheme-row {
    padding-left: 12px;
  }
}

#activityPanel .session-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

#activityPanel .outline-btn {
  width: 100%;
}

.outline-btn {
  border-color: var(--line-strong);
  background: var(--panel);
  color: var(--ink);
}

.outline-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

#activityPanel #endSessionBtn,
#activityPanel #restoreExcludedBtn {
  width: fit-content;
  min-height: 32px;
  padding: 0 4px;
}

#activityPanel .reset-section {
  order: 99;
  gap: 10px;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
}

#activityPanel .reset-section h3 {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#activityPanel .reset-section .danger-lite {
  width: 100%;
  border-color: #fecaca;
  background: transparent;
  color: #b91c1c;
}

#activityPanel .reset-section .danger-lite:hover {
  background: var(--bad-soft);
}

.flashcard-study-panel {
  display: grid;
  gap: 18px;
  width: min(100%, 900px);
  min-height: 58vh;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  align-content: start;
}

.flashcard-study-head {
  display: grid;
  gap: 10px;
}

.flashcard-study-head p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.flashcard-study-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.25;
  letter-spacing: 0;
}

.flashcard-decks {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.flashcard-decks h3 {
  margin: 0;
  color: var(--ink);
}

.flashcard-priority-filter {
  display: grid;
  gap: 8px;
}

.flashcard-priority-filter > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.flashcard-priority-filter button {
  justify-content: flex-start;
  min-height: 34px;
  padding: 0 10px;
  text-align: left;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
}

.flashcard-back {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--ink);
  line-height: 1.65;
}

.flashcard-back p {
  margin: 0;
}

.flashcard-back div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.flashcard-back .flashcard-extras {
  display: grid;
  gap: 8px;
}

.flashcard-extras section {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.flashcard-extras strong {
  color: var(--ink);
  font-size: 13px;
}

.flashcard-extras span {
  color: var(--muted);
  line-height: 1.55;
}

.flashcard-back small {
  color: var(--muted);
}

.flashcard-actions,
.flashcard-grade {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.flashcard-actions button,
.flashcard-grade button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
}

.flashcard-actions .primary-btn {
  min-width: 180px;
}

.flashcard-grade button {
  border-color: var(--line-strong);
  background: var(--panel);
}

.flashcard-grade button:hover,
.flashcard-deck-row:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.flashcard-deck-row {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.flashcard-deck-row span {
  color: var(--muted);
  font-size: 13px;
}

.importance-badge {
  width: fit-content;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.flashcard-deck-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Focused question-reading experience */
:root {
  --content-width: 1160px;
}

.question-shell {
  max-width: var(--content-width);
  gap: 24px;
}

.question-nav {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 0 0;
}

.question-nav button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.question-nav button:hover {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

.question-map {
  max-width: 980px;
  width: 100%;
  margin: 0 auto 8px;
  padding: 0;
  border: 0;
  background: transparent;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
}

.map-item {
  border-color: var(--line);
  background: var(--panel);
}

.map-item.active {
  transform: translateY(-1px);
}

.question-card {
  max-width: 980px;
  width: 100%;
  min-height: auto;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) 0 clamp(34px, 6vw, 72px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tags {
  margin-bottom: 30px;
}

.question-text {
  max-width: 90ch;
  margin-bottom: 42px;
  font-size: clamp(20px, 1.65vw, 23px);
  line-height: 1.82;
}

.options {
  gap: 16px;
}

.option {
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 16px;
  min-height: 72px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  line-height: 1.6;
}

.option:hover {
  border-color: #cbd5e1;
  background: #ffffff;
  transform: translateY(-1px);
}

body.theme-dark .option:hover {
  background: #111827;
}

.option-letter {
  width: 32px;
  height: 32px;
}

.question-tools {
  margin-top: 34px;
  padding-top: 0;
  border-top: 0;
}

.primary-tools {
  justify-content: flex-start;
}

.primary-tools #confirmAnswerBtn {
  min-width: 220px;
  min-height: 44px;
}

.tool-details {
  margin-top: 10px;
}

.tool-details summary {
  padding: 8px 0;
  color: var(--muted);
}

.secondary-tools {
  gap: 8px;
  padding: 10px 0 0;
}

.secondary-tools button {
  min-height: 34px;
  color: var(--muted);
}

.error-type-panel {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.answer-box {
  margin-top: 24px;
  border-color: var(--line);
  background: var(--panel);
}

.notes {
  max-width: 980px;
  width: 100%;
  margin: 4px auto 0;
  padding: 0 0 56px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.study-accordion {
  border-top: 1px solid var(--line);
}

.study-accordion:last-child {
  border-bottom: 1px solid var(--line);
}

.study-accordion > summary {
  cursor: pointer;
  padding: 18px 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 680;
}

.comments-panel {
  margin-bottom: 0;
  padding: 0 0 22px;
  border-bottom: 0;
}

.comments-head h3 {
  display: none;
}

.comment-item,
.saved-note-item {
  border-radius: 12px;
}

.private-note-panel {
  display: grid;
  gap: 10px;
  padding-bottom: 22px;
}

.private-note-panel .field {
  margin-bottom: 0;
}

@media (max-width: 860px) {
  .question-shell,
  .question-nav,
  .question-map,
  .question-card,
  .notes {
    max-width: 100%;
  }

  .question-card {
    padding-top: 10px;
  }

  .question-text {
    margin-bottom: 30px;
    font-size: 18px;
    line-height: 1.72;
  }

  .option {
    min-height: 66px;
    padding: 15px;
  }
}

/* Clear neutral state for an option selected before confirmation */
.option.selected.pending {
  position: relative;
  border-color: #94a3b8;
  background: #f1f5f9;
}

.option.selected.pending:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
  transform: translateY(-1px);
}

.option.selected.pending::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 0;
  width: 4px;
  border-radius: 999px;
  background: #94a3b8;
}

.option.selected.pending .option-letter {
  background: #64748b;
  color: #ffffff;
}

.option.selected.pending .option-text {
  color: var(--ink);
  font-weight: 620;
}

body.theme-dark .option.selected.pending {
  border-color: #64748b;
  background: #1e293b;
}

body.theme-dark .option.selected.pending:hover {
  border-color: #64748b;
  background: #1e293b;
}

body.theme-dark .option.selected.pending::before {
  background: #94a3b8;
}

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: min(88vw, 360px);
    padding: 72px 16px 22px;
    background: var(--panel);
  }

  .sidebar-collapsed .sidebar {
    width: min(88vw, 360px);
  }

  .app {
    padding: 74px 12px 24px 70px;
  }

  .topbar {
    gap: 12px;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .question-card {
    padding: 20px;
  }

  .question-text {
    font-size: 18px;
    line-height: 1.62;
  }

  .question-map {
    max-height: 220px;
    padding: 10px;
  }

  .option {
    grid-template-columns: 32px minmax(0, 1fr);
    padding: 13px;
  }

  .discard-toggle {
    grid-column: 2;
  }

  .error-type-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stats,
  .summary-grid,
  .pending-summary {
    grid-template-columns: 1fr 1fr;
  }
}

/* Figura da questão (diagramas reproduzidos da prova) */
.question-image {
  display: block;
  max-width: min(100%, 720px);
  height: auto;
  margin: -6px 0 24px;
  padding: 8px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line, #dfe3e8);
}

/* Celular: fundo escurecido atrás da gaveta aberta; tocar nele fecha a gaveta. */
.sidebar-backdrop {
  display: none;
}

@media (max-width: 860px) {
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    background: rgba(15, 23, 42, 0.38);
  }

  .sidebar-collapsed .sidebar-backdrop {
    display: none;
  }
}

/* Contador "Banco completo" na barra lateral (segue o tema claro/escuro) */
#globalBankCounter {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft, #f8fafc);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

#globalBankCounter strong {
  color: var(--ink);
}

/* ===== Tela "Hoje" e plano de estudo (js/studyPlan.js) ===== */
.no-question-active .topbar .actions {
  display: none;
}

.start-panel.today-panel {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.today-panel p {
  max-width: none;
}

.today-toolbar {
  display: flex;
  justify-content: flex-end;
  min-height: 0;
}

.today-toolbar .link-btn {
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 600;
}

.today-dashboard,
.today-summary,
.plan-form {
  display: grid;
  gap: 16px;
}

.today-card {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.today-card h2,
.today-card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.today-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 12px;
}

.today-card-head span,
.today-muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.today-notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warn-soft);
  color: var(--ink);
  font-size: 14px;
}

/* bloco de destaque: prova e meta */
.today-hero {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 20px;
  background: #1d4ed8;
  color: #ffffff;
}

body.theme-dark .today-hero {
  background: #1e3a8a;
}

.today-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.today-hero-kicker {
  display: block;
  font-size: 13px;
  opacity: 0.9;
}

.today-hero-title {
  display: block;
  margin-top: 2px;
  font-size: 20px;
  font-weight: 700;
}

.today-hero-days {
  display: grid;
  justify-items: end;
  line-height: 1;
}

.today-hero-days strong {
  font-size: 34px;
  font-weight: 800;
}

.today-hero-days span {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.9;
}

.today-hero-goal {
  display: grid;
  gap: 8px;
}

.today-hero-goal-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.today-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.28);
}

.today-bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: #ffffff;
}

/* estudo de hoje */
.today-rows {
  display: grid;
  gap: 12px;
}

.today-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.today-row-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.today-row-icon.warn { background: var(--warn-soft); color: #b45309; }
.today-row-icon.good { background: var(--good-soft); color: #15803d; }
.today-row-icon.info { background: var(--accent-soft); color: var(--accent-strong); }
body.theme-dark .today-row-icon.warn { color: #fbbf24; }
body.theme-dark .today-row-icon.good { color: #4ade80; }

.today-row-text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.today-row-text strong {
  font-size: 15px;
}

.today-row-text span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.today-row-btn {
  flex-shrink: 0;
  min-height: 40px;
}

.today-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
}

.today-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
  align-items: start;
}

/* sequência */
.today-streak-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.today-flame {
  display: flex;
  color: #c2410c;
}

body.theme-dark .today-flame {
  color: #fb923c;
}

.today-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.today-day {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.today-day span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--line);
}

.today-day.studied span {
  background: var(--accent);
}

.today-day.is-today span {
  box-sizing: border-box;
  border: 2px dashed var(--accent);
  background: var(--accent-soft);
}

.today-day.is-today.studied span {
  border-style: solid;
  background: var(--accent);
}

.today-day small {
  color: var(--muted);
  font-size: 12px;
}

.today-day.is-today small {
  color: var(--ink);
  font-weight: 700;
}

/* temas para reforçar */
.today-weak-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.today-weak-text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.today-weak-text strong {
  font-size: 14px;
}

.today-weak-text span {
  color: var(--muted);
  font-size: 12px;
}

.today-weak-row .outline-btn {
  flex-shrink: 0;
  min-height: 40px;
}

.today-chip {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.today-chip.weak { background: #fdf0e1; color: #9a3412; }
.today-chip.mid { background: #fef9c3; color: #854d0e; }
.today-chip.good { background: var(--good-soft); color: #166534; }
body.theme-dark .today-chip.weak { background: #431407; color: #fdba74; }
body.theme-dark .today-chip.mid { background: #422006; color: #fde68a; }
body.theme-dark .today-chip.good { background: #052e16; color: #86efac; }

/* outras formas de estudar */
.today-more {
  display: grid;
  gap: 10px;
}

.today-more-title {
  margin: 4px 4px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.today-more-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.today-more-grid button {
  min-height: 56px;
  border-radius: 14px;
  font-weight: 600;
}

/* "Só revisar agora" abaixo do Começar e o bloco "Outras revisões" (antiga aba Revisão). */
.today-review-only {
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  font-weight: 600;
}

/* Hoje mostra só a prova e o estudo do dia; o resto fica na subtela "Outras revisões". */
.today-panel:not(.show-more) .today-more-only,
.today-panel.show-more .today-main-only {
  display: none !important;
}

.today-reviews-title {
  margin: 0;
}

.today-more-link {
  width: 100%;
  min-height: 60px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  font-size: 22px;
  text-align: left;
  cursor: pointer;
}

.today-more-link > span {
  flex: 1;
  display: grid;
  gap: 2px;
}

.today-more-link strong {
  font-size: 15px;
}

.today-more-link small {
  color: var(--muted);
  font-size: 13px;
}

.today-more-link:hover {
  border-color: var(--accent);
}

.today-more-head {
  display: grid;
  gap: 4px;
}

.today-more-head .link-btn {
  justify-self: start;
}

.today-more-head h2 {
  margin: 0;
}

.today-reviews-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.today-reviews-grid button {
  min-height: 48px;
  border-radius: 12px;
  font-weight: 600;
}

.today-reviews-section {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.today-reviews-section h4 {
  margin: 0;
  font-size: 15px;
}

.today-reviews-section h4 small {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 600;
}

.today-reviews-section .panel-line {
  margin: 0;
}

.today-reviews-section > .outline-btn {
  justify-self: start;
}

/* resumo do fim do estudo */
.today-summary-head {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding-top: 8px;
  text-align: center;
}

.today-summary-head h2 {
  margin: 0;
  font-size: 24px;
}

.today-summary-head p {
  margin: 0;
  color: var(--muted);
}

.today-summary-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
}

.today-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 1100px) {
  .today-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.today-stat {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.today-stat span {
  color: var(--muted);
  font-size: 13px;
}

.today-stat strong {
  font-size: clamp(19px, 5.4vw, 26px);
  font-weight: 800;
}

.today-stat small {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.today-accent-text {
  color: var(--accent-strong);
}

.today-improvement,
.today-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.today-improvement {
  border-color: transparent;
  background: var(--good-soft);
  color: #166534;
}

body.theme-dark .today-improvement {
  color: #86efac;
}

.today-improvement div,
.today-inline div {
  display: grid;
  gap: 2px;
}

.today-improvement span,
.today-inline span {
  font-size: 13px;
  opacity: 0.9;
}

.today-row-split {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.today-actions-stack {
  display: grid;
  gap: 10px;
}

.today-actions-stack .outline-btn {
  min-height: 50px;
  border-radius: 14px;
  font-weight: 600;
}

/* plano de estudo */
.plan-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.plan-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.plan-field {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.plan-field legend,
.plan-field > label {
  margin-bottom: 10px;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
}

.plan-optional {
  color: var(--muted);
  font-weight: 500;
}

.plan-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.plan-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.plan-chip {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 600;
}

.plan-chip[aria-pressed="true"] {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.plan-segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

#planExamDate {
  height: 50px;
  max-width: 280px;
  box-sizing: border-box;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.plan-preview {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.plan-preview-kicker {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-preview-goal {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.plan-preview-goal strong {
  font-size: 30px;
  font-weight: 800;
}

.plan-preview-goal span,
.plan-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

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

.plan-actions .today-cta {
  flex: 1 1 240px;
  width: auto;
}

.plan-actions .outline-btn {
  min-height: 52px;
  border-radius: 14px;
}

@media (max-width: 860px) {
  .today-more-grid button {
    min-height: 64px;
    font-size: 13px;
  }

  .plan-actions .outline-btn {
    flex: 1 1 100%;
  }
}

/* ===== Progresso do bloco e "Revisar o conceito" (js/studyPlan.js, js/questionCards.js) ===== */
.run-progress {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.run-progress-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.run-progress-line span {
  color: var(--muted);
}

.run-progress-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--line);
}

.run-progress-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 200ms ease;
}

.concept-panel {
  display: grid;
  gap: 14px;
  margin-top: 6px;
}

.concept-block {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--accent-soft);
}

.concept-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--accent-strong);
}

.concept-head strong {
  font-size: 15px;
}

.concept-head span {
  font-size: 13px;
  color: var(--muted);
}

.concept-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  background: var(--panel);
}

.concept-card-topic {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.concept-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

.concept-card-back {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

.concept-grades {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.concept-btn {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 600;
}

.concept-btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

body.theme-dark .concept-btn.primary {
  color: #0f172a;
}

.concept-done,
.concept-made {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.concept-make {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.concept-make span {
  flex: 1 1 220px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 860px) {
  .concept-grades {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ===== Painel de Desempenho (js/performance.js) ===== */
.performance-panel {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

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

.perf-periods {
  display: grid;
  flex: 1 1 320px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  max-width: 460px;
  padding: 4px;
  border-radius: 12px;
  background: var(--line);
}

.perf-periods button {
  min-height: 40px;
  padding: 0 4px;
  white-space: nowrap;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-weight: 600;
}

.perf-periods button[aria-pressed="true"] {
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-weight: 700;
}

.perf-exam {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.perf-exam select {
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.perf-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 1100px) {
  .perf-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.perf-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.perf-card span {
  color: var(--muted);
  font-size: 13px;
}

.perf-card strong {
  font-size: clamp(20px, 5.4vw, 26px);
  font-weight: 800;
}

.perf-card small {
  color: var(--muted);
  font-size: 12px;
}

.perf-accent {
  color: var(--accent-strong);
}

.perf-chart {
  display: grid;
  align-items: end;
  gap: 6px;
  height: 190px;
}

.perf-col {
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  align-content: end;
  gap: 4px;
  height: 100%;
}

.perf-col-acc {
  min-height: 15px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.perf-col-acc.current {
  color: var(--accent-strong);
}

.perf-bar {
  width: 100%;
  max-width: 56px;
  border-radius: 6px 6px 2px 2px;
  background: #bfdbfe;
}

body.theme-dark .perf-bar {
  background: #1e3a8a;
}

.perf-bar.current {
  background: var(--accent);
  box-shadow: none;
}

.perf-col-label {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.perf-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 118px), 1fr));
  gap: 8px;
}

.perf-tile {
  display: grid;
  justify-items: start;
  gap: 2px;
  min-height: 72px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  text-align: left;
}

.perf-tile span {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.perf-tile strong {
  font-size: 18px;
  font-weight: 800;
}

.perf-tile small {
  font-size: 11px;
  opacity: 0.85;
}

.perf-tile.strong { background: #1d4ed8; color: #ffffff; }
.perf-tile.mid { background: #dbeafe; color: #1e3a8a; }
.perf-tile.weak { border: 2px solid #c2410c; background: #fdf0e1; color: #7c2d12; }
.perf-tile:hover { filter: brightness(0.97); }
body.theme-dark .perf-tile.strong { background: #2563eb; }
body.theme-dark .perf-tile.mid { background: #1e3a8a; color: #dbeafe; }
body.theme-dark .perf-tile.weak { border-color: #fb923c; background: #431407; color: #fed7aa; }

.perf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.perf-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.perf-legend i {
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border-radius: 3px;
}

.perf-legend i.strong { background: #1d4ed8; }
.perf-legend i.mid { background: #dbeafe; }
.perf-legend i.weak { border: 2px solid #c2410c; background: #fdf0e1; }

.perf-reason {
  display: grid;
  gap: 6px;
}

.perf-reason-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.perf-reason-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line);
}

.perf-reason-bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--ink);
}

.perf-reason-bar.muted i {
  background: var(--muted);
}

.perf-next {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 18px;
  background: #111827;
  color: #ffffff;
}

body.theme-dark .perf-next {
  border: 1px solid var(--line-strong);
  background: #0b1220;
}

.perf-next-kicker {
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.perf-next strong {
  font-size: 16px;
  line-height: 1.45;
}

.perf-next button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: #ffffff;
  color: #111827;
  font-weight: 700;
}

@media (max-width: 860px) {
  .perf-periods button {
    font-size: 13px;
  }

  .perf-exam {
    flex: 1 1 100%;
  }

  .perf-exam select {
    flex: 1;
  }
}

/* ===== Botão de encerrar na barra de progresso ===== */
.run-progress-line {
  align-items: center;
}

.run-progress-line span {
  margin-right: auto;
}

.run-finish {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}

.run-progress-line {
  flex-wrap: wrap;
}

.run-finish.run-pause {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.run-finish.run-pause:hover {
  border-color: var(--line);
  color: var(--ink);
}

.run-finish.armed {
  border-color: #c2410c;
  background: #fdf0e1;
  color: #7c2d12;
}

body.theme-dark .run-finish.armed {
  border-color: #fb923c;
  background: #431407;
  color: #fed7aa;
}

/* ===== Barra de navegação inferior no celular (js/mobileNav.js) ===== */
.bottom-nav {
  display: none;
}

@media (max-width: 860px) {
  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--panel);
  }

  .bottom-nav button {
    display: grid;
    justify-items: center;
    gap: 3px;
    min-height: 52px;
    padding: 4px 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
  }

  .bottom-nav button.active {
    color: var(--accent-strong);
    font-weight: 700;
  }

  .bottom-nav button:hover {
    background: transparent;
  }

  /* com a barra inferior, a gaveta fechada some por completo e o ☰ só aparece para fechá-la */
  .sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-collapsed .sidebar-toggle {
    display: none;
  }

  .app {
    padding: 18px 14px calc(88px + env(safe-area-inset-bottom));
  }
}

/* ===== Barra lateral só de navegação; conteúdo das abas na área principal ===== */
body {
  grid-template-columns: 264px minmax(0, 1fr);
}

body.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
}

.sidebar .tabs {
  margin-bottom: 16px;
}

.sidebar .tab {
  min-height: 40px;
  font-size: 15px;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-footer .auth-panel {
  gap: 8px;
  margin: 0;
  padding: 12px;
}

.sidebar-footer .auth-status strong {
  font-size: 14px;
}

.sidebar-footer .auth-status span,
.sidebar-footer #syncStatus {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.sidebar-footer #syncStatus {
  margin: 0;
}

.auth-details summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 650;
  list-style: none;
}

.auth-details summary::-webkit-details-marker {
  display: none;
}

.auth-details summary::after {
  content: " ▾";
}

.auth-details[open] summary::after {
  content: " ▴";
}

.auth-details[open] summary {
  margin-bottom: 10px;
}

.auth-details .auth-actions {
  grid-template-columns: 1fr;
}

.sidebar-footer .theme-toggle {
  margin: 0;
  min-height: 36px;
  font-size: 14px;
}

.tab-view,
.tab-view-back {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  box-sizing: border-box;
}

.tab-view {
  display: grid;
  gap: 18px;
}

.tab-view .legend {
  margin-bottom: 8px;
}

.tab-view[hidden] {
  display: none;
}

.tab-view > .tab-panel.active {
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.tab-view .study-planner-head h3,
.tab-view .exam-panel-head h3 {
  font-size: clamp(22px, 2.2vw, 28px);
}

.tab-view .study-section:first-of-type {
  padding-top: 0;
}

.tab-view-active .topbar {
  display: none;
}

.tab-view-back {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.tab-view-back[hidden] {
  display: none;
}

.flashcard-active .flashcard-study-panel {
  order: 1;
}

.flashcard-active #tabView {
  order: 2;
}

.flashcard-deck-row.active {
  color: var(--ink);
}

/* Com espaço de sobra, as listas e grades dos painéis usam a largura da tela */
@media (min-width: 861px) {

  .tab-view .session-builder {
    max-width: 760px;
  }

  .tab-view .exam-sidebar {
    max-width: 760px;
  }

  .tab-view #flashcardDeckList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 8px;
  }

  .sidebar {
    position: sticky;
    top: 0;
  }

  .tab-view .flashcard-priority-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 860px) {
  body,
  body.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .tab-view > .tab-panel.active {
    padding: 16px;
  }
}

/* ===== Reportar erro, etiquetas, anotação, relógio e relatório do simulado ===== */
.question-report {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  justify-items: start;
}

.question-report > .link-btn {
  color: var(--muted);
  font-size: 13px;
}

.report-form {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

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

.reports-admin {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  font-size: 14px;
}

.reports-admin ul {
  margin: 6px 0 10px;
  padding-left: 18px;
}

.reports-admin small {
  display: block;
  color: var(--muted);
}

.question-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.question-labels > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-right: 2px;
}

.question-labels button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

.question-labels button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.my-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--warn);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--warn-soft);
}

.my-note-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.my-note-text {
  margin-top: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.label-reviews,
.error-cards-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.label-reviews small {
  margin-left: 4px;
  color: var(--muted);
}

.sim-countdown-toggle {
  margin: 4px 0 8px;
}

.sim-clock {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  font-size: 13px;
  color: var(--muted);
}

.sim-clock strong {
  color: var(--ink);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.sim-clock.warning strong,
.sim-clock.warning em {
  color: var(--bad);
}

.sim-clock em {
  font-style: normal;
  font-weight: 600;
}

#simReport {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.sim-report {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.sim-report summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
}

.sim-report summary span {
  color: var(--muted);
  font-size: 12px;
}

.sim-report[open] summary {
  margin-bottom: 10px;
}

.sim-timeup {
  margin: 0 0 10px;
  color: var(--bad);
  font-weight: 600;
}

.sim-report-block {
  margin-top: 16px;
}

.sim-report-block h4 {
  margin: 0 0 8px;
}

.sim-report-block .panel-line {
  margin: 0 0 6px;
}

.sim-topics {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sim-topics li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  font-size: 14px;
}

.sim-topics li i {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--bar) var(--w), var(--line) var(--w));
}

.sim-topics li.good { --bar: var(--good); }
.sim-topics li.mid { --bar: var(--warn); }
.sim-topics li.bad { --bar: var(--bad); }

.sim-evolution {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 120px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sim-evolution li {
  display: grid;
  grid-template-rows: 1fr auto auto;
  justify-items: center;
  flex: 1 1 0;
  max-width: 70px;
  height: 100%;
  font-size: 12px;
}

.sim-evolution li i {
  align-self: end;
  width: 70%;
  height: var(--h);
  border-radius: 4px 4px 0 0;
  background: var(--line-strong);
}

.sim-evolution li.current i {
  background: var(--accent);
}

.sim-evolution li span {
  color: var(--muted);
}

.sim-slowest {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.sim-slowest li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.sim-slowest em {
  font-style: normal;
  font-size: 12px;
}

.sim-slowest em.good { color: var(--good); }
.sim-slowest em.bad { color: var(--bad); }

/* ===== Só questões inéditas e ranking de temas por banca ===== */
.unseen-mode {
  display: grid;
  gap: 4px;
  margin: 4px 0 14px;
}

.unseen-mode .panel-line,
.exam-study-card [data-unseen-line] {
  margin: 0;
}

.ranking-card summary {
  cursor: pointer;
  list-style: revert;
}

.ranking-card summary h4 {
  display: inline;
  margin: 0;
}

.ranking-card[open] summary {
  margin-bottom: 10px;
}

.ranking-list {
  display: grid;
  gap: 12px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.ranking-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ranking-head strong {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}

.ranking-pos {
  min-width: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ranking-bar {
  display: block;
  height: 6px;
  margin: 4px 0;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--w), var(--line) var(--w));
}

.ranking-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  color: var(--muted);
  font-size: 12px;
}

.ranking-meta .good { color: var(--good); }
.ranking-meta .mid { color: var(--warn); }
.ranking-meta .bad { color: var(--bad); }

.ranking-meta .link-btn {
  margin-left: auto;
  font-size: 13px;
}

.ranking-subthemes {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* ===== Questões parecidas ao errar (js/similarQuestions.js) ===== */
.similar-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}

.similar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.similar-head strong {
  font-size: 15px;
}

.similar-head span {
  color: var(--muted);
  font-size: 13px;
}

.similar-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.similar-list li {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel);
}

.similar-list small {
  color: var(--muted);
  font-size: 12px;
}

.similar-list em {
  font-style: normal;
  font-weight: 600;
}

.similar-list em.new { color: var(--accent-strong); }
.similar-list em.good { color: var(--good); }
.similar-list em.bad { color: var(--bad); }

.similar-list p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.45;
}

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

.similar-actions .concept-btn {
  padding: 0 16px;
}

.similar-actions span,
.similar-done {
  flex: 1 1 200px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ===== Ajuste de leitura (js/readingSettings.js) ===== */
body {
  --reading-zoom: 1;
}

.question-text,
#optionsList,
#answerBox,
.explanation-panel .markdown-content,
.my-note-text,
.similar-list,
.concept-card {
  zoom: var(--reading-zoom);
}

body.reading-airy .question-text,
body.reading-airy .option-text,
body.reading-airy .explanation-panel .markdown-content p,
body.reading-airy .my-note-text {
  line-height: 1.95 !important;
}

body.reading-airy .option-text {
  display: block;
}

body.reading-serif .question-text,
body.reading-serif .option-text,
body.reading-serif .explanation-panel .markdown-content,
body.reading-serif .my-note-text,
.reading-serif-sample {
  font-family: Georgia, "Times New Roman", serif !important;
}

.topbar .actions {
  position: relative;
}

.reading-btn {
  font-weight: 700;
  font-size: 15px;
}

.reading-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  gap: 8px;
  width: min(280px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.reading-panel[hidden] {
  display: none;
}

.reading-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.reading-size {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.reading-size button {
  min-height: 40px;
  font-weight: 700;
}

.reading-size strong {
  font-size: 14px;
}

.reading-panel .segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.reading-panel .link-btn {
  justify-self: start;
  font-size: 13px;
}

/* Contador de reportes abertos no menu (js/questionReports.js). */
.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bad);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.nav-badge[hidden] {
  display: none;
}

#bottomNav [data-nav="more"] {
  position: relative;
}

#bottomNav .nav-badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
  margin: 0;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
}

/* Listas nos comentários em Markdown (renderSafeMarkdown). */
.markdown-content ul,
.markdown-content ol {
  margin: 0;
  padding-left: 22px;
}

.markdown-content li {
  margin: 3px 0;
  line-height: 1.55;
}

.markdown-content li::marker {
  color: var(--muted);
}

/* Flashcards de hoje (js/flashcardDaily.js). */
.flashcard-daily {
  display: grid;
  gap: 10px;
  margin: 4px 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.flashcard-daily h4 {
  margin: 0 0 2px;
}

.flashcard-daily .panel-line {
  margin: 0;
}

.flashcard-daily-limit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.flashcard-daily-limit > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.flashcard-daily .primary-btn {
  justify-self: start;
}

.flashcard-session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 14px;
}

.flashcard-session-bar span {
  color: var(--muted);
  font-size: 13px;
}

.flashcard-session-bar .link-btn {
  margin-left: auto;
}

/* Flashcards por tema (js/flashcardTopics.js). */
.flashcard-view-toggle {
  margin: 0 0 12px;
}

.flashcard-topics {
  display: grid;
  gap: 8px;
}

.flashcard-topic {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.flashcard-topic summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.flashcard-topic summary::-webkit-details-marker {
  display: none;
}

.flashcard-topic-text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.flashcard-topic-text strong {
  font-size: 15px;
}

.flashcard-topic-text span,
.flashcard-topic.empty span {
  color: var(--muted);
  font-size: 13px;
}

.flashcard-topic summary .outline-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
}

.flashcard-topic.empty {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  opacity: 0.7;
}

.flashcard-subtopics {
  display: grid;
  gap: 2px;
  padding: 0 14px 10px;
  border-top: 1px solid var(--line);
}

.flashcard-subtopic {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.flashcard-subtopic:last-child {
  border-bottom: 0;
}

.flashcard-subtopic span {
  flex: 1 1 180px;
  font-size: 14px;
}

.flashcard-subtopic small {
  color: var(--muted);
  font-size: 12px;
}

.flashcard-topic-notice {
  margin: 0 0 4px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--good-soft);
  color: var(--good);
  font-weight: 600;
}

/* "Até a prova" no Desempenho (js/examReadiness.js). */
.readiness-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 8px;
}

.readiness-summary div {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.readiness-summary strong {
  font-size: 18px;
}

.readiness-summary span {
  color: var(--muted);
  font-size: 12px;
}

.readiness-summary .good strong { color: var(--good); }
.readiness-summary .bad strong { color: var(--bad); }

.readiness-list {
  display: grid;
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.readiness-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.readiness-head strong {
  font-size: 14px;
}

.readiness-status {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.readiness-status.bad { background: var(--bad-soft); color: var(--bad); }
.readiness-status.mid { background: var(--warn-soft); color: var(--warn); }
.readiness-status.good { background: var(--good-soft); color: var(--good); }

.readiness-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.readiness-meta .link-btn {
  margin-left: auto;
  font-size: 13px;
}

.readiness-bar {
  display: block;
  height: 5px;
  margin-top: 4px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--w), var(--line) var(--w));
}

@media (max-width: 640px) {
  .readiness-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Gabarito suspeito: distribuição das respostas (js/suspiciousAnswers.js). */
.answer-stats-admin {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  font-size: 14px;
}

.answer-stats {
  display: grid;
  gap: 4px;
  margin: 8px 0 4px;
}

.answer-stat {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 110px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.answer-stat i {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--line-strong) var(--w), var(--line) var(--w));
}

.answer-stat.key i {
  background: linear-gradient(to right, var(--good) var(--w), var(--line) var(--w));
}

.answer-stat.warn i {
  background: linear-gradient(to right, var(--bad) var(--w), var(--line) var(--w));
}

.answer-stat span {
  color: var(--muted);
}

/* Revisão de véspera (js/vesperaReview.js). */
.vespera {
  display: grid;
  gap: 8px;
}

.vespera .panel-line {
  margin: 0;
}

.vespera-title {
  font-size: 16px;
}

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

#vesperaCard {
  margin-bottom: 14px;
  border-color: var(--warn);
  background: var(--warn-soft);
}

/* Confirmar tema com um clique (js/topicConfirm.js). */
.topic-confirm {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.topic-confirm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.topic-confirm-head span,
.topic-confirm .panel-line {
  color: var(--muted);
  font-size: 13px;
}

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

.topic-confirm-actions button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.topic-confirm-actions select {
  width: auto;
  min-width: 160px;
  max-width: 100%;
}

/* Painel de uso (js/adminUsage.js). */
.admin-usage h4 {
  margin: 14px 0 6px;
}

.usage-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.usage-cards div {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.usage-cards strong {
  font-size: 20px;
}

.usage-cards span {
  color: var(--muted);
  font-size: 12px;
}

.usage-chart {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  grid-template-rows: 80px;
  align-items: end;
  gap: 2px;
}

.usage-chart i {
  height: max(2px, var(--h));
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}

.usage-themes {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.usage-themes li {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.usage-themes span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-themes i {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--w), var(--line) var(--w));
}

/* Boas-vindas e convite (js/welcomeInvite.js). */
.welcome-card {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  border-color: var(--accent);
}

.welcome-card h2 {
  margin: 0;
  font-size: 20px;
}

.welcome-card > p {
  margin: 0;
  color: var(--muted);
}

.welcome-kicker {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.welcome-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.welcome-steps li {
  padding-left: 4px;
}

.welcome-steps strong {
  display: block;
}

.welcome-steps span {
  color: var(--muted);
  font-size: 14px;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.invite-btn {
  margin-top: 6px;
}

.invite-status {
  display: block;
  min-height: 1em;
  color: var(--muted);
  font-size: 12px;
}

/* ===== Visual "Psiquiatria em Questão" (direção A: petróleo clínico) =====
   Petróleo como cor principal, âmbar só para destaque, Manrope nos títulos e Inter no texto. */
:root {
  --bg: #f3f6f6;
  --panel: #ffffff;
  --panel-soft: #f6f9f9;
  --ink: #10262d;
  --muted: #4f6469;
  --line: #dce5e6;
  --line-strong: #c4d3d5;
  --accent: #0b6b70;
  --accent-strong: #084e52;
  --accent-soft: #e3f0f0;
  --highlight: #f2b544;
  --hero: #0b3b40;
  --font-display: Manrope, Inter, ui-sans-serif, system-ui, sans-serif;
}

body.theme-dark {
  --bg: #0b1517;
  --panel: #112024;
  --panel-soft: #172a2f;
  --ink: #e6f0f0;
  --muted: #9cb2b5;
  --line: #22383d;
  --line-strong: #2f4b51;
  --accent: #5cc0bb;
  --accent-strong: #8ad6d1;
  --accent-soft: #10383a;
  --hero: #0e3236;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1,
h2,
h3,
.brand h1,
.topbar h2,
.today-hero-title,
.today-hero-days strong,
.today-card-head h2 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

/* No tema escuro o petróleo é claro: texto escuro nos botões cheios para manter o contraste. */
body.theme-dark .segmented button.active,
body.theme-dark #activityPanel .segmented button.active,
body.theme-dark .primary-btn {
  color: #062124;
}

/* Símbolo: "p" e "q" espelhados, a haste do q em âmbar. Mesmo petróleo nos dois temas. */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0b6b70;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  font-size: 13px;
}

.today-hero,
body.theme-dark .today-hero {
  background: var(--hero);
}

.today-hero-days strong {
  color: var(--highlight);
}

.today-hero .today-bar i {
  background: var(--highlight);
}

.dominated,
.perf-tile.strong,
.perf-legend i.strong,
body.theme-dark .perf-tile.strong {
  background: var(--accent);
}

.perf-tile.mid,
.perf-legend i.mid {
  background: #cfe6e6;
  color: #0a3a3e;
}

body.theme-dark .perf-tile.mid {
  background: #164447;
  color: #d4ecec;
}
/* Aviso de mudança de endereço (js/domainMove.js), só no endereço antigo. */
.domain-move {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--accent-soft);
}

.domain-move p {
  display: grid;
  gap: 4px;
  margin: 0;
}

.domain-move span {
  color: var(--muted);
  font-size: 14px;
}

.domain-move-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.domain-move-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  text-decoration: none;
}
/* Simulador de psicofarmacologia (js/pharmaSim.js). */
.pharma-panel.active {
  display: grid;
  gap: 16px;
}

.pharma-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.pharma-head h2 {
  margin: 0;
}

.pharma-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.pharma-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pharma-chip {
  min-height: 38px;
  border-radius: 19px;
  font-size: 14px;
}

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

body.theme-dark .pharma-chip.on {
  color: #062124;
}

.pharma-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 16px;
  align-items: start;
}

.pharma-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.pharma-card h3,
.pharma-card h4 {
  margin: 0;
}

.pharma-card h4 {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.pharma-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.pharma-card-head span {
  color: var(--muted);
  font-size: 13px;
}

.pharma-brain {
  width: 100%;
  max-width: 560px;
  height: auto;
  justify-self: center;
}

.pharma-brain-outline {
  fill: var(--panel-soft);
  stroke: var(--line-strong);
  stroke-width: 2;
}

.pharma-brain-cerebellum {
  fill: var(--bg);
  stroke: var(--line-strong);
  stroke-width: 2;
}

.pharma-brain-stem {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 26;
  stroke-linecap: round;
}

.pharma-path {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke 0.25s ease;
}

.pharma-node {
  fill: var(--panel);
  stroke-width: 3;
  transition: stroke 0.25s ease;
}

.pharma-node-origin {
  fill: var(--ink);
}

.pharma-label {
  fill: var(--ink);
  font: 700 13px Inter, sans-serif;
}

.pharma-label.small {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.pharma-paths {
  display: grid;
  gap: 8px;
}

.pharma-path-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-soft);
  font-size: 14px;
  line-height: 1.4;
}

.pharma-path-row i {
  flex-shrink: 0;
  width: 16px;
  height: 5px;
  margin-top: 8px;
  border-radius: 3px;
}

.pharma-receptors {
  display: grid;
  gap: 10px;
}

.pharma-receptor {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 150px;
  align-items: center;
  gap: 10px;
}

.pharma-receptor small {
  color: var(--muted);
  font-size: 12px;
}

.pharma-bar {
  display: block;
  height: 10px;
  border-radius: 5px;
  background: var(--accent-soft);
  overflow: hidden;
}

.pharma-bar i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.pharma-bar.b i {
  background: #d99a1e;
}

.pharma-bar i.partial {
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0 4px, transparent 4px 8px);
}

.pharma-extra {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.pharma-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pharma-effect {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--panel-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: help;
}

.pharma-effect.level-3,
.pharma-table td.level-3 {
  background: #fde8dd;
  color: #8a2c08;
}

.pharma-effect.level-2,
.pharma-table td.level-2 {
  background: #fdf1d8;
  color: #6b4300;
}

.pharma-study {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--highlight, #f2b544);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  font-weight: 600;
}

.pharma-study span:nth-child(2) {
  flex: 1;
}

.pharma-study:disabled {
  opacity: 0.6;
  cursor: default;
}

.pharma-study-tag {
  padding: 3px 8px;
  border-radius: 6px;
  background: #fdf1d8;
  color: #6b4300;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pharma-compare-pick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pharma-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  background: var(--panel);
}

.pharma-pick.b {
  border-color: #d99a1e;
}

.pharma-pick i {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 6px;
  background: var(--accent);
}

.pharma-pick.b i {
  border-radius: 2px;
  background: #d99a1e;
}

.pharma-pick select {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

.pharma-compare-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pharma-compare-legend .a::before,
.pharma-compare-legend .b::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 5px;
  background: var(--accent);
}

.pharma-compare-legend .b::before {
  border-radius: 2px;
  background: #d99a1e;
}

.pharma-compare-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.pharma-compare-row > div {
  display: grid;
  gap: 4px;
}

.pharma-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.pharma-table th,
.pharma-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.pharma-table thead th {
  border-top: 0;
  color: var(--muted);
  font-size: 12px;
}

.pharma-why {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 14px;
}

.pharma-why ul {
  margin: 6px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.pharma-disclaimer {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .pharma-receptor {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .pharma-receptor strong,
  .pharma-compare-row strong {
    white-space: nowrap;
  }

  .pharma-receptor small {
    grid-column: 2;
    margin-top: -6px;
  }
}