:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #182230;
  --muted: #667085;
  --line: #dce3ec;
  --primary: #3155d9;
  --primary-dark: #203da6;
  --soft: #eef2ff;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 12px 30px rgba(16, 24, 40, .07);
  --radius: 18px;
  --legend-sidebar-width: 430px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
button, input, select { font: inherit; }
.topbar { display: flex; justify-content: space-between; gap: 24px; padding: 26px max(24px, calc((100vw - 1380px)/2)); background: #101828; color: white; }
h1, h2, h3, p { margin-top: 0; }
.topbar h1 { margin-bottom: 6px; font-size: clamp(24px, 3vw, 36px); }
.subtitle { margin-bottom: 0; color: #cfd6e3; }
.eyebrow { margin-bottom: 6px; font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--primary); }
.topbar .eyebrow { color: #9fb0ff; }
.db-status { align-self: center; white-space: nowrap; padding: 10px 14px; border: 1px solid #344054; border-radius: 999px; color: #e4e7ec; font-size: 14px; }
.status-dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 4px rgba(50, 213, 131, .12); }
.tabs { display: flex; gap: 10px; padding: 12px max(24px, calc((100vw - 1380px)/2)); background: white; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 10px 15px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.tab.active { background: var(--soft); color: var(--primary-dark); }
main { max-width: 1380px; margin: 0 auto; padding: 24px 24px 70px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 20px; }
.section-heading h2 { margin-bottom: 6px; font-size: 29px; }
.section-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.compact-heading { margin-bottom: 14px; }

.answer-sheet { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.sheet-section-title { display: flex; align-items: center; gap: 9px; padding: 9px 14px; background: #f5f7ff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #344054; font-size: 13px; font-weight: 850; }
.sheet-section-title:first-of-type { border-top: 0; }
.sheet-section-title span { color: var(--primary); text-transform: uppercase; letter-spacing: .07em; font-size: 10px; }
.compact-question { display: grid; grid-template-columns: minmax(190px, 270px) minmax(0, 1fr); gap: 14px; align-items: center; padding: 9px 12px; border-bottom: 1px solid #edf0f4; }
.question-label { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.question-label p { margin: 2px 0 0; color: #344054; font-size: 13px; font-weight: 750; line-height: 1.3; }
.question-label small { display: inline; color: var(--muted); font-weight: 600; white-space: nowrap; }
.question-number { display: grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px; background: var(--soft); color: var(--primary-dark); font-size: 12px; font-weight: 900; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 6px; min-width: 0; }
.long-options .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.option { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 7px; min-height: 35px; padding: 6px 8px; border: 1px solid #e1e7ef; border-radius: 8px; background: #fbfcfe; color: #344054; font-size: 12px; font-weight: 600; line-height: 1.25; cursor: pointer; transition: .15s ease; }
.option:hover { border-color: #aebcf3; background: #f7f8ff; }
.option:has(input:checked) { border-color: var(--primary); background: var(--soft); box-shadow: inset 0 0 0 1px var(--primary); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-letter { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid #cbd5e1; border-radius: 50%; background: white; color: #475467; font-size: 10px; font-weight: 900; }
.option:has(input:checked) .option-letter { border-color: var(--primary); background: var(--primary); color: white; }
.option-text { min-width: 0; }
.other-field { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
input[type="text"], select { width: 100%; min-height: 38px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; background: white; color: var(--text); }
input:focus, select:focus { outline: 3px solid rgba(49, 85, 217, .15); border-color: var(--primary); }
.form-actions, .toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 10; justify-content: flex-end; padding: 11px 13px; background: rgba(255, 255, 255, .95); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 41px; padding: 9px 15px; border-radius: 9px; border: 1px solid transparent; text-decoration: none; font-weight: 800; cursor: pointer; }
.button.primary { color: white; background: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { color: #344054; background: white; border-color: #cfd7e3; }
.button.danger { color: var(--danger); background: #fff; border-color: #f2b8b5; padding: 7px 10px; min-height: 34px; }
.button.small { padding: 7px 10px; min-height: 34px; }
.message { margin: 12px; padding: 12px 14px; border-radius: 9px; font-weight: 700; }
.message.error { background: #fef3f2; color: var(--danger); border: 1px solid #fecdca; }
.message.success { background: #ecfdf3; color: var(--success); border: 1px solid #abefc6; }
.hidden { display: none !important; }
.card-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.card-title-row h3 { margin-bottom: 0; font-size: 19px; }
.bar-chart { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1.4fr) minmax(130px, 3fr) 58px; gap: 10px; align-items: center; }
.bar-label { font-size: 13px; line-height: 1.25; color: #344054; }
.bar-track { height: 22px; border-radius: 999px; background: #eef1f5; overflow: hidden; }
.bar-fill { height: 100%; min-width: 2px; border-radius: 999px; background: linear-gradient(90deg, #3155d9, #6b82ed); }
.bar-value { text-align: right; font-size: 12px; font-weight: 800; color: #475467; }
.badge { padding: 5px 9px; border-radius: 999px; background: var(--soft); color: var(--primary-dark); font-size: 12px; font-weight: 800; }
.note { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
footer { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }
.print-only { display: none; }

@media (max-width: 980px) {
  .topbar, .section-heading { flex-direction: column; }
  .db-status { align-self: flex-start; }
  .compact-question { grid-template-columns: 1fr; gap: 7px; }
  .long-options .options { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .bar-row { grid-template-columns: minmax(100px, 1fr) minmax(100px, 2fr) 50px; }
}
@media (max-width: 560px) {
  main { padding-inline: 10px; }
  .tabs { padding-inline: 10px; overflow-x: auto; }
  .topbar { padding-inline: 16px; }
  .compact-question { padding: 9px; }
  .options, .long-options .options { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; gap: 5px; }
  .bar-value { text-align: left; }
  .sticky-actions { justify-content: stretch; }
  .sticky-actions .button { flex: 1; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: white; color: #111827; font-size: 10pt; }
  .no-print, footer { display: none !important; }
  .print-only { display: block !important; }
  main { max-width: none; padding: 0; }
  .tab-panel { display: none !important; }
  #dashboard-section { display: block !important; }
  .report-header { margin-bottom: 14mm; border-bottom: 2px solid #111827; padding-bottom: 6mm; }
  .report-header h1 { margin-bottom: 4px; }
  .section-heading { margin-bottom: 8mm; }
  .section-heading h2 { font-size: 20pt; }
  .bar-fill { background: #3155d9 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Versão 2.1 — cartão de resposta realmente compacto */
.status-stack { display: grid; justify-items: end; gap: 8px; align-self: center; }
.version-badge { padding: 7px 10px; border-radius: 999px; background: #d1fadf; color: #05603a; font-size: 11px; font-weight: 900; letter-spacing: .04em; }
.answer-sheet-banner { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 14px; background: #101828; color: white; }
.answer-sheet-banner div { display: flex; align-items: baseline; gap: 10px; }
.answer-sheet-banner strong { font-size: 14px; }
.answer-sheet-banner span { color: #cfd6e3; font-size: 12px; }
.answer-sheet-banner .sheet-version { padding: 5px 8px; border: 1px solid #475467; border-radius: 999px; color: #e4e7ec; font-size: 10px; font-weight: 800; white-space: nowrap; }
.sheet-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; background: #eef2f6; }
.sheet-column { display: grid; align-content: start; gap: 10px; min-width: 0; }
.answer-block { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white; }
.answer-block .sheet-section-title { border-top: 0; }
.answer-block .compact-question:last-child { border-bottom: 0; }
.compact-question { grid-template-columns: minmax(145px, 1fr) auto; gap: 8px; min-height: 46px; padding: 7px 9px; }
.question-label { align-items: center; }
.question-label p { margin: 0; font-size: 12px; line-height: 1.15; }
.question-number { width: 25px; height: 25px; border-radius: 50%; }
.options { display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: 5px; }
.option { display: block; min-width: 0; width: 31px; height: 31px; min-height: 31px; padding: 0; border-radius: 50%; }
.option-letter { width: 100%; height: 100%; border: 0; border-radius: 50%; font-size: 11px; }
.option:has(input:checked) { border-radius: 50%; }
.question-with-other { align-items: start; }
.question-with-other .other-field { grid-template-columns: 45px minmax(0, 1fr); margin-top: 6px; }
.question-with-other input[type="text"] { min-height: 31px; padding: 5px 8px; }
.answer-legend { margin: 0; border: 1px solid var(--line); border-radius: 12px; background: white; overflow: hidden; }
.answer-legend summary { cursor: pointer; padding: 10px 12px; color: #344054; font-size: 12px; font-weight: 850; background: #f8fafc; }
#answer-legend-content { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; max-height: 360px; overflow: auto; }
.legend-question { display: grid; gap: 3px; padding: 8px; border: 1px solid #edf0f4; border-radius: 8px; font-size: 10px; color: #475467; }
.legend-question strong { color: #182230; font-size: 11px; }
.legend-question span { line-height: 1.25; }
.legend-question b { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 3px; border-radius: 50%; background: var(--soft); color: var(--primary-dark); font-size: 9px; }
.saved-counter { margin-right: auto; align-self: center; color: var(--muted); font-size: 12px; font-weight: 750; }
@media (max-width: 980px) {
  .status-stack { justify-items: start; }
  .sheet-columns { grid-template-columns: 1fr; }
  .compact-question { grid-template-columns: minmax(140px, 1fr) auto; }
}
@media (max-width: 560px) {
  .answer-sheet-banner { align-items: flex-start; flex-direction: column; }
  .answer-sheet-banner div { display: grid; gap: 2px; }
  .compact-question { grid-template-columns: 1fr; }
  .options { justify-content: flex-start; }
  #answer-legend-content { grid-template-columns: 1fr; }
  .saved-counter { width: 100%; }
}

/* Versão 3.0: configuração central revisada */

/* Versão 3.1: legenda interativa para conferência */
.legend-question.has-selection {
  border-color: #aabaf7;
  box-shadow: 0 0 0 1px rgba(49, 85, 217, .08);
}
.legend-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 4px;
  padding: 4px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  line-height: 1.25;
}
.legend-option > span { min-width: 0; }
.legend-option.selected {
  border-color: #3155d9;
  background: #e8edff;
  color: #17328f;
  font-weight: 800;
}
.legend-option.selected b {
  background: #3155d9;
  color: #fff;
}

/* Versão 3.2: marcação livre em todas as perguntas e acesso visível aos gráficos */
.tab-graphs { display: inline-flex; align-items: center; gap: 7px; }
.tab-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #e4e7ec; color: #344054; font-size: 11px; font-weight: 900; }
.tab-graphs.active .tab-count { background: #3155d9; color: #fff; }
.button.charts-button { color: #fff; background: #17328f; border-color: #17328f; }
.button.charts-button:hover { background: #10256f; }
.charts-location { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 13px 15px; border: 1px solid #aabaf7; border-radius: 12px; background: #eef2ff; color: #17328f; }
.charts-location span { color: #475467; font-size: 13px; }
.question:has(input:checked) { background: #fbfcff; }
@media (max-width: 700px) {
  .charts-location { align-items: flex-start; flex-direction: column; gap: 3px; }
}


/* Versão 3.4: gráficos pastel e legenda em sidebar persistente */
.legend-sidebar {
  position: fixed;
  z-index: 80;
  top: 92px;
  right: 0;
  bottom: 18px;
  width: min(var(--legend-sidebar-width), calc(100vw - 56px));
  transform: translateX(100%);
  transition: transform .24s ease;
  filter: drop-shadow(-10px 14px 28px rgba(16, 24, 40, .14));
}
.legend-sidebar.open { transform: translateX(0); }
.legend-sidebar-toggle {
  position: absolute;
  top: 90px;
  left: -48px;
  width: 48px;
  min-height: 180px;
  padding: 10px 7px;
  border: 1px solid #aabaf7;
  border-right: 0;
  border-radius: 14px 0 0 14px;
  background: #fff;
  color: #17328f;
  box-shadow: -6px 10px 22px rgba(16, 24, 40, .10);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 900;
}
.legend-sidebar.open .legend-sidebar-toggle { background: #e8edff; }
.legend-toggle-icon { font-size: 9px; letter-spacing: .06em; white-space: nowrap; }
.legend-toggle-text { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; letter-spacing: .03em; }
.legend-sidebar-panel {
  height: 100%;
  overflow: hidden;
  border: 1px solid #d6deea;
  border-right: 0;
  border-radius: 18px 0 0 18px;
  background: #fff;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.legend-sidebar-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #e5eaf1;
  background: #f8faff;
}
.legend-sidebar-header h2 { margin-bottom: 4px; font-size: 20px; }
.legend-sidebar-header p:last-child { margin: 0; color: #667085; font-size: 12px; }
.legend-sidebar-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid #cfd7e3;
  border-radius: 9px;
  background: #fff;
  color: #344054;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}
.legend-sidebar #answer-legend-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  max-height: none;
  padding: 13px;
  overflow: auto;
}
.legend-sidebar .legend-question { font-size: 11px; }
.legend-sidebar .legend-question strong { font-size: 12px; }

/* Em telas de trabalho, a legenda ocupa uma coluna própria em vez de cobrir o formulário. */
@media (min-width: 901px) {
  .topbar,
  .tabs,
  main,
  footer {
    transition: margin-right .24s ease, padding-left .24s ease, padding-right .24s ease;
  }

  main {
    max-width: none;
    padding-inline: max(24px, calc((100vw - 1380px) / 2));
  }

  body.legend-sidebar-open .topbar,
  body.legend-sidebar-open .tabs,
  body.legend-sidebar-open main,
  body.legend-sidebar-open footer {
    margin-right: var(--legend-sidebar-width);
  }

  body.legend-sidebar-open .topbar,
  body.legend-sidebar-open .tabs,
  body.legend-sidebar-open main {
    padding-inline: max(24px, calc((100vw - var(--legend-sidebar-width) - 1380px) / 2));
  }
}

@media (min-width: 901px) and (max-width: 1500px) {
  body.legend-sidebar-open .sheet-columns,
  body.legend-sidebar-open .charts-grid,
  body.legend-sidebar-open .dual-charts {
    grid-template-columns: 1fr;
  }

  body.legend-sidebar-open .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.question-chart-card { grid-column: 1 / -1; }
.dual-charts { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; }
.chart-panel { min-width: 0; padding: 15px; border: 1px solid #e6ebf2; border-radius: 14px; background: #fbfcfe; }
.chart-panel h4 { margin: 0 0 3px; font-size: 14px; }
.chart-subtitle { margin: 0 0 14px; color: #667085; font-size: 11px; }
.pie-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 17px; }
.pie-chart { width: 190px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(16,24,40,.06); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.pie-chart::after { display: none; }
.pie-chart > span { z-index: 1; grid-area: 1 / 1; display: grid; text-align: center; padding: 8px 10px; border-radius: 999px; background: rgba(255,255,255,.90); box-shadow: 0 2px 8px rgba(16,24,40,.12); font-size: 20px; font-weight: 900; color: #344054; }
.pie-chart small { display: block; color: #667085; font-size: 9px; font-weight: 750; }
.chart-key { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.chart-key li { display: grid; grid-template-columns: 10px 17px minmax(0, 1fr) auto; align-items: center; gap: 6px; color: #475467; font-size: 10px; line-height: 1.2; }
.chart-key li strong { color: #344054; white-space: nowrap; font-size: 10px; }
.chart-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--swatch); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.column-chart { height: 260px; display: flex; align-items: stretch; justify-content: space-around; gap: 9px; padding: 8px 4px 0; border-bottom: 1px solid #aeb7c5; }
.column-item { flex: 1 1 0; min-width: 40px; display: grid; grid-template-rows: 20px minmax(0, 1fr) 19px 17px; justify-items: center; align-items: end; }
.column-value { align-self: center; color: #344054; font-size: 11px; font-weight: 900; }
.column-track { width: min(48px, 75%); height: 100%; display: flex; align-items: flex-end; border-radius: 7px 7px 0 0; background: linear-gradient(to top, rgba(226,232,240,.45), rgba(248,250,252,.3)); overflow: hidden; }
.column-fill { width: 100%; min-height: 0; border-radius: 7px 7px 0 0; background: var(--column-color); transition: height .35s ease; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.column-letter { align-self: center; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #eef2ff; color: #17328f; font-size: 10px; }
.column-percent { align-self: start; color: #667085; font-size: 9px; font-weight: 750; }

@media (max-width: 900px) {
  .dual-charts { grid-template-columns: 1fr; }
  .pie-layout { grid-template-columns: 170px minmax(0, 1fr); }
  .pie-chart { width: 170px; }
}
@media (max-width: 560px) {
  .legend-sidebar { top: 74px; bottom: 8px; width: calc(100vw - 50px); }
  .legend-sidebar-toggle { top: 70px; left: -42px; width: 42px; }
  .pie-layout { grid-template-columns: 1fr; justify-items: center; }
  .chart-key { width: 100%; }
  .column-chart { gap: 4px; height: 225px; }
  .column-item { min-width: 28px; }
  .column-track { width: min(34px, 78%); }
}
@media print {
  .question-chart-card { grid-column: 1 / -1; }
  .dual-charts { grid-template-columns: .9fr 1.1fr; gap: 4mm; }
  .chart-panel { padding: 3mm; }
  .pie-layout { grid-template-columns: 38mm minmax(0, 1fr); gap: 3mm; }
  .pie-chart { width: 38mm; }
  .column-chart { height: 52mm; }
  .chart-key li { font-size: 7.5pt; }
}

/* Versão 4.0 — Material Design 3 adaptativo */
:root {
  --md-primary: #405f91;
  --md-on-primary: #ffffff;
  --md-primary-container: #d6e3ff;
  --md-on-primary-container: #0b1b32;
  --md-secondary: #565f71;
  --md-secondary-container: #dae2f9;
  --md-on-secondary-container: #131c2b;
  --md-tertiary-container: #fbd8f1;
  --md-surface: #f9f9ff;
  --md-surface-dim: #d9d9e0;
  --md-surface-container-lowest: #ffffff;
  --md-surface-container-low: #f3f3fa;
  --md-surface-container: #ededf4;
  --md-surface-container-high: #e7e8ee;
  --md-surface-container-highest: #e1e2e8;
  --md-on-surface: #1a1b20;
  --md-on-surface-variant: #44474f;
  --md-outline: #74777f;
  --md-outline-variant: #c4c6d0;
  --md-error: #ba1a1a;
  --md-error-container: #ffdad6;
  --md-success: #2f6548;
  --md-success-container: #b5f1ca;
  --bg: var(--md-surface);
  --card: var(--md-surface-container-lowest);
  --text: var(--md-on-surface);
  --muted: var(--md-on-surface-variant);
  --line: var(--md-outline-variant);
  --primary: var(--md-primary);
  --primary-dark: #294777;
  --soft: var(--md-primary-container);
  --danger: var(--md-error);
  --success: var(--md-success);
  --radius: 24px;
  --shadow: 0 1px 2px rgba(27, 28, 32, .10), 0 2px 6px rgba(27, 28, 32, .06);
  --legend-sidebar-width: 360px;
}

html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--md-on-surface);
  background: var(--md-surface);
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  padding: 12px 18px;
  border-radius: 999px;
  color: var(--md-on-primary);
  background: var(--md-primary);
  font-weight: 700;
  transition: transform .2s ease;
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  min-height: 104px;
  align-items: center;
  padding-block: 20px;
  color: var(--md-on-surface);
  background: var(--md-surface-container-lowest);
  border-bottom: 1px solid color-mix(in srgb, var(--md-outline-variant) 55%, transparent);
}
.brand-lockup { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-mark {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--md-primary-container);
}
.brand-mark span { position: absolute; width: 6px; border-radius: 99px; background: var(--md-primary); }
.brand-mark span:nth-child(1) { height: 16px; transform: translateX(-12px); }
.brand-mark span:nth-child(2) { height: 30px; }
.brand-mark span:nth-child(3) { height: 22px; transform: translateX(12px); }
.topbar h1 {
  margin: 0;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.12;
  letter-spacing: -.025em;
  font-weight: 600;
  text-wrap: balance;
}
.subtitle { margin: 4px 0 0; color: var(--md-on-surface-variant); font-size: 14px; }
.eyebrow {
  margin-bottom: 4px;
  color: var(--md-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: none;
}
.topbar .eyebrow { color: var(--md-primary); }
.status-stack { display: flex; align-items: center; gap: 10px; justify-items: initial; }
.version-badge,
.db-status {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}
.version-badge { color: var(--md-on-secondary-container); background: var(--md-secondary-container); letter-spacing: 0; }
.db-status { color: var(--md-on-surface-variant); background: var(--md-surface-container-low); }
.status-dot { width: 8px; height: 8px; background: #3f825c; box-shadow: none; }

.tabs {
  z-index: 30;
  justify-content: center;
  gap: 8px;
  padding-block: 10px;
  background: color-mix(in srgb, var(--md-surface) 92%, transparent);
  border-bottom: 0;
  backdrop-filter: blur(16px);
}
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  color: var(--md-on-surface-variant);
  font-size: 14px;
  font-weight: 600;
  transition: background-color .2s ease, color .2s ease, transform .15s ease;
}
.tab:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.tab:active { transform: scale(.98); }
.tab.active { color: var(--md-on-secondary-container); background: var(--md-secondary-container); }
.tab-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 24px;
  line-height: 1;
  font-weight: 400;
}
.chart-icon { display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding-bottom: 4px; }
.chart-icon i { display: block; width: 4px; border-radius: 3px 3px 0 0; background: currentColor; }
.chart-icon i:nth-child(1) { height: 8px; }
.chart-icon i:nth-child(2) { height: 15px; }
.chart-icon i:nth-child(3) { height: 11px; }
.tab-count { min-width: 22px; height: 22px; color: var(--md-on-surface-variant); background: var(--md-surface-container-highest); font-variant-numeric: tabular-nums; }
.tab-graphs.active .tab-count { color: var(--md-on-primary); background: var(--md-primary); }
#save-button .save-count {
  position: absolute;
  top: 1px;
  right: 1px;
  left: auto;
  display: inline-grid;
  place-items: center;
  width: 17px;
  min-width: 17px;
  height: 17px;
  padding: 0;
  border-radius: 50%;
  color: #fff;
  background: #68b78d;
  box-shadow: 0 0 0 2px var(--nav-bar-surface, var(--md-surface));
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  opacity: 0;
  transform: scale(.65);
  transition: opacity .16s ease, transform .16s ease, color .16s ease, background-color .16s ease;
  pointer-events: none;
}
#save-button.has-progress .save-count { opacity: 1; transform: scale(1); }
#save-button .save-count.complete {
  color: #fff;
  background: #4f9d73;
}

/* Validação do cartão: toast discreto e pendências em vermelho pastel. */
.message {
  position: fixed;
  z-index: 1200;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  margin: 0;
  padding: 13px 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  color: #fff;
  background: rgba(35, 36, 42, .88);
  box-shadow: 0 8px 24px rgba(25, 26, 31, .18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  animation: message-enter .2s ease-out both;
}
.message::before {
  content: '';
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.message.error,
.message.success { color: #fff; background: rgba(35, 36, 42, .88); }
.message.error::before { background: #ee9da3; }
.message.success::before { background: #68b78d; }
@keyframes message-enter {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.compact-question.missing-answer {
  background: #fdebed;
  box-shadow: inset 3px 0 0 #e98f97;
}
.compact-question.missing-answer .question-number {
  color: #7c343b;
  background: #f5bcc1;
}

@media (max-width: 599px) {
  .message { top: 12px; right: 12px; width: calc(100vw - 24px); }
}

main {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: 32px 32px 104px;
}
.section-heading { align-items: end; margin-bottom: 24px; }
.section-heading > div:first-child { max-width: 720px; }
.section-heading h2 { margin-bottom: 6px; font-size: clamp(28px, 3vw, 40px); line-height: 1.1; letter-spacing: -.025em; font-weight: 500; text-wrap: balance; }
.section-heading p:last-child { max-width: 64ch; line-height: 1.5; }

.answer-sheet {
  overflow: clip;
  border: 0;
  border-radius: 28px;
  background: var(--md-surface-container-low);
  box-shadow: none;
}
.answer-sheet-banner {
  justify-content: flex-start;
  min-height: 72px;
  padding: 12px 20px;
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
}
.answer-sheet-banner div { display: grid; align-items: initial; gap: 2px; }
.answer-sheet-banner strong { font-size: 15px; font-weight: 700; }
.answer-sheet-banner span { color: var(--md-on-surface-variant); font-size: 13px; }
.answer-sheet-banner .banner-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  color: var(--md-on-primary);
  background: var(--md-primary);
  font-size: 20px;
  font-weight: 700;
}
.sheet-columns { gap: 20px; padding: 20px; background: transparent; }
.sheet-column { gap: 20px; }
.answer-block {
  border: 0;
  border-radius: 24px;
  background: var(--md-surface-container-lowest);
  box-shadow: var(--shadow);
}
.sheet-section-title,
.answer-block .sheet-section-title {
  min-height: 52px;
  padding: 12px 16px;
  border: 0;
  color: var(--md-on-surface);
  background: transparent;
  font-size: 16px;
  font-weight: 600;
}
.sheet-section-title span {
  min-width: 54px;
  padding: 5px 9px;
  border-radius: 9px;
  color: var(--md-primary);
  background: var(--md-primary-container);
  font-size: 10px;
  letter-spacing: .03em;
}
.compact-question {
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 12px;
  min-height: 60px;
  padding: 8px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--md-outline-variant) 55%, transparent);
  background: transparent;
  transition: background-color .2s ease;
}
.compact-question:hover,
.question:has(input:checked) { background: color-mix(in srgb, var(--md-primary) 4%, transparent); }
.question-label { align-items: center; gap: 10px; }
.question-label p { margin: 0; color: var(--md-on-surface); font-size: 12px; line-height: 1.3; font-weight: 600; }
.question-number {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  color: var(--md-on-secondary-container);
  background: var(--md-secondary-container);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.options { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.option {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--md-outline);
  border-radius: 14px;
  color: var(--md-on-surface-variant);
  background: transparent;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .15s ease;
}
.option:hover { border-color: var(--md-primary); background: color-mix(in srgb, var(--md-primary) 8%, transparent); }
.option:active { transform: scale(.95); }
.option:has(input:checked) {
  border-color: var(--md-primary);
  border-radius: 14px;
  color: var(--md-on-primary);
  background: var(--md-primary);
  box-shadow: none;
}
.option-letter {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  color: inherit;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}
.option:has(input:checked) .option-letter { color: var(--md-on-primary); background: transparent; }
.option-text { display: none; }
.other-field { grid-template-columns: 52px minmax(0, 1fr); gap: 8px; color: var(--md-on-surface-variant); }
.platforms-response { display: grid; gap: 8px; }
.platforms-choice-row { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.platforms-choice-row .options { width: auto; }
.other-platforms-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  color: var(--md-on-surface-variant);
  background: transparent;
  cursor: pointer;
  transition: color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.other-platforms-toggle .ui-icon { width: 18px; height: 18px; transition: transform .2s ease; }
.other-platforms-toggle:hover,
.other-platforms-toggle:focus-visible {
  outline: 0;
  color: var(--md-on-surface);
  background: var(--md-surface-container-lowest);
  box-shadow: 0 4px 10px rgba(48, 62, 83, .12);
}
.other-platforms-toggle[aria-expanded="true"] .ui-icon { transform: rotate(180deg); }
input[type="text"], select {
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--md-outline);
  border-radius: 12px;
  color: var(--md-on-surface);
  background: var(--md-surface-container-lowest);
}
input:focus, select:focus { border-color: var(--md-primary); outline: 3px solid color-mix(in srgb, var(--md-primary) 18%, transparent); }

.form-actions, .toolbar { gap: 8px; }
.sticky-actions {
  bottom: 0;
  min-height: 80px;
  padding: 14px 18px;
  border-top: 0;
  background: color-mix(in srgb, var(--md-surface-container-lowest) 94%, transparent);
  box-shadow: 0 -1px 0 color-mix(in srgb, var(--md-outline-variant) 55%, transparent);
  backdrop-filter: blur(18px);
}
.button {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  transition: background-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.button:hover { box-shadow: 0 1px 3px rgba(26, 27, 32, .18); }
.button:active { transform: scale(.98); box-shadow: none; }
.button.primary { color: var(--md-on-primary); background: var(--md-primary); }
.button.primary:hover { background: #345381; }
.button.secondary { color: var(--md-primary); border-color: var(--md-outline); background: transparent; }
.button.charts-button { color: var(--md-on-secondary-container); border-color: transparent; background: var(--md-secondary-container); }
.button.charts-button:hover { background: color-mix(in srgb, var(--md-secondary-container) 86%, var(--md-secondary)); }
.button.danger { color: var(--md-error); border-color: transparent; background: var(--md-error-container); }
.saved-counter { color: var(--md-on-surface-variant); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.message { border: 0; border-radius: 14px; }
.message.error { color: var(--md-error); background: var(--md-error-container); }
.message.success { color: var(--md-success); background: var(--md-success-container); }

.toolbar { align-items: center; justify-content: flex-end; }
.toolbar select { width: auto; min-width: 230px; }
.bar-track { background: var(--md-surface-container-highest); }
.bar-fill { background: var(--md-primary); }
table { min-width: 680px; font-variant-numeric: tabular-nums; }
.badge { color: var(--md-on-secondary-container); background: var(--md-secondary-container); }
footer { color: var(--md-on-surface-variant); }

.legend-sidebar { filter: drop-shadow(-2px 0 10px rgba(26, 27, 32, .12)); }
.legend-sidebar-panel { border: 0; border-radius: 28px 0 0 28px; background: var(--md-surface-container-lowest); }
.legend-sidebar-header { padding: 24px 20px 16px; border-bottom: 0; background: var(--md-surface-container-low); }
.legend-sidebar-header h2 { font-size: 24px; font-weight: 500; letter-spacing: -.02em; }
.legend-sidebar-toggle {
  min-height: 160px;
  border: 0;
  border-radius: 20px 0 0 20px;
  color: var(--md-on-secondary-container);
  background: var(--md-secondary-container);
  box-shadow: var(--shadow);
}
.legend-sidebar.open .legend-sidebar-toggle { background: var(--md-primary-container); }
.legend-sidebar-close {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  color: var(--md-on-surface-variant);
  background: transparent;
}
.legend-sidebar-close:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.legend-sidebar #answer-legend-content { gap: 8px; padding: 12px; }
.legend-question { padding: 12px; border: 0; border-radius: 16px; color: var(--md-on-surface-variant); background: var(--md-surface-container-low); }
.legend-question strong { color: var(--md-on-surface); font-size: 13px; }
.legend-option { padding: 7px 8px; border-radius: 10px; }
.legend-option.selected { border-color: transparent; color: var(--md-on-primary-container); background: var(--md-primary-container); }
.legend-option.selected b { color: var(--md-on-primary); background: var(--md-primary); }

:where(button, input, select, a):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--md-primary) 35%, transparent);
  outline-offset: 2px;
}

@media (min-width: 1200px) {
  main { max-width: none; padding-inline: max(32px, calc((100vw - 1440px) / 2)); }
  body.legend-sidebar-open .topbar,
  body.legend-sidebar-open .tabs,
  body.legend-sidebar-open main,
  body.legend-sidebar-open footer { margin-right: var(--legend-sidebar-width); }
  body.legend-sidebar-open .topbar,
  body.legend-sidebar-open .tabs,
  body.legend-sidebar-open main { padding-inline: max(32px, calc((100vw - var(--legend-sidebar-width) - 1440px) / 2)); }
}

@media (min-width: 600px) and (max-width: 1199px) {
  body.legend-sidebar-open .topbar,
  body.legend-sidebar-open .tabs,
  body.legend-sidebar-open main,
  body.legend-sidebar-open footer { margin-right: 0; }
  body.legend-sidebar-open .topbar,
  body.legend-sidebar-open .tabs,
  body.legend-sidebar-open main { padding-inline: 24px; }
  .topbar { padding-inline: 24px; }
  main { padding-inline: 24px; }
  .sheet-columns { grid-template-columns: 1fr; }
  .dual-charts { grid-template-columns: 1fr; }
}

@media (max-width: 599px) {
  body { padding-bottom: 80px; }
  body.legend-sidebar-open::after {
    content: '';
    position: fixed;
    z-index: 70;
    inset: 0;
    background: rgba(27, 28, 32, .32);
  }
  .topbar {
    min-height: 88px;
    padding: 14px 16px;
    border-bottom: 0;
  }
  .brand-lockup { gap: 12px; }
  .brand-mark { width: 48px; height: 48px; border-radius: 16px; }
  .brand-mark span:nth-child(1) { transform: translateX(-10px); }
  .brand-mark span:nth-child(3) { transform: translateX(10px); }
  .topbar h1 { font-size: 20px; white-space: normal; }
  .subtitle { display: none; }
  .topbar .eyebrow { margin-bottom: 2px; font-size: 11px; }
  .status-stack { margin-left: auto; }
  .version-badge { display: none; }
  .db-status { width: 40px; min-height: 40px; padding: 0; justify-content: center; font-size: 0; }
  .status-dot { margin: 0; }

  .tabs {
    position: fixed;
    z-index: 100;
    inset: auto 0 0;
    height: 80px;
    justify-content: stretch;
    gap: 0;
    padding: 8px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-top: 1px solid var(--md-outline-variant);
    background: var(--md-surface-container);
    backdrop-filter: none;
  }
  .tab {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    align-content: center;
    gap: 2px;
    min-height: 64px;
    padding: 0 8px;
    border-radius: 0;
    font-size: 12px;
  }
  .tab:hover, .tab.active { background: transparent; }
  .tab-icon { width: 64px; height: 32px; border-radius: 999px; }
  .tab.active .tab-icon { background: var(--md-secondary-container); }
  .tab-count { position: absolute; top: 5px; left: calc(50% + 16px); height: 18px; min-width: 18px; padding-inline: 5px; font-size: 10px; }

  main { max-width: none; padding: 24px 16px 120px; }
  .section-heading { align-items: flex-start; gap: 14px; margin-bottom: 20px; }
  .section-heading h2 { font-size: 30px; }
  .section-heading p:last-child { font-size: 14px; }
  .compact-heading .button { width: auto; }

  .answer-sheet { overflow: visible; border-radius: 0; background: transparent; }
  .answer-sheet-banner { min-height: 68px; margin-bottom: 16px; padding: 12px 14px; border-radius: 20px; }
  .answer-sheet-banner div { display: grid; }
  .answer-sheet-banner .banner-icon { width: 40px; }
  .sheet-columns { grid-template-columns: 1fr; gap: 16px; padding: 0; }
  .sheet-column { gap: 16px; }
  .answer-block { border-radius: 24px; }
  .sheet-section-title, .answer-block .sheet-section-title { min-height: 58px; padding: 14px 16px 10px; }
  .compact-question {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    padding: 14px 16px 16px;
  }
  .question-label p { font-size: 15px; }
  .question-number { width: 34px; height: 34px; }
  .options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    justify-content: stretch;
  }
  .option {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    place-items: center start;
    gap: 12px;
    width: 100%;
    height: auto;
    min-height: 56px;
    padding: 10px 14px;
    border-color: var(--md-outline-variant);
    border-radius: 16px;
    text-align: left;
  }
  .option:has(input:checked) { border-radius: 16px; }
  .option-letter {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--md-surface-container-high);
  }
  .option:has(input:checked) .option-letter { background: color-mix(in srgb, var(--md-on-primary) 18%, transparent); }
  .option-text { display: block; min-width: 0; color: inherit; font-size: 14px; line-height: 1.35; font-weight: 500; }
  .question-with-other .other-field { grid-template-columns: 1fr; margin-top: 10px; }
  .question-with-other input[type="text"] { min-height: 52px; }

  .sticky-actions {
    bottom: 92px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 16px 0 0;
    padding: 12px;
    border-radius: 24px;
    box-shadow: 0 4px 16px rgba(26, 27, 32, .14);
  }
  .saved-counter { grid-column: 1 / -1; width: 100%; margin: 0; padding: 0 4px 4px; }
  #save-button { grid-column: 1 / -1; grid-row: 2; }
  #view-charts, #clear-button { width: 100%; padding-inline: 10px; font-size: 12px; }

  .toolbar { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .toolbar select { grid-column: 1 / -1; width: 100%; min-width: 0; }
  .toolbar .button { width: 100%; padding-inline: 10px; font-size: 12px; }
  .dual-charts { grid-template-columns: 1fr; gap: 12px; }
  .chart-panel { padding: 14px; }
  .pie-layout { grid-template-columns: 1fr; justify-items: center; }
  .pie-chart { width: min(180px, 64vw); }
  .chart-key { width: 100%; }
  .column-chart { min-width: 340px; }
  .column-panel { overflow-x: auto; }
  .card-title-row { align-items: center; }

  .legend-sidebar {
    top: auto;
    right: 0;
    bottom: 80px;
    left: 0;
    width: 100%;
    height: min(72dvh, 680px);
    transform: translateY(100%);
    filter: drop-shadow(0 -6px 24px rgba(26, 27, 32, .16));
  }
  .legend-sidebar.open { transform: translateY(0); }
  .legend-sidebar-toggle {
    top: -56px;
    right: 16px;
    left: auto;
    width: auto;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 16px 16px 0 0;
    flex-direction: row;
    gap: 8px;
  }
  .legend-toggle-text { writing-mode: initial; transform: none; font-size: 12px; }
  .legend-sidebar-panel { border-radius: 28px 28px 0 0; }
  .legend-sidebar-header { padding: 20px 20px 12px; }
  .legend-sidebar #answer-legend-content { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  footer { padding: 16px 16px 32px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
  body { padding-bottom: 0; background: #fff; }
  main { padding: 0; }
  .chart-panel { box-shadow: none; }
}

/* Versão 4.1 — painel de legenda sempre integrado ao fluxo, sem sobreposição */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  align-items: start;
  width: 100%;
  transition: grid-template-columns .24s ease;
}
body.legend-sidebar-open .workspace {
  grid-template-columns: minmax(0, 1fr) var(--legend-sidebar-width);
}

body.legend-sidebar-open .topbar,
body.legend-sidebar-open .tabs,
body.legend-sidebar-open main,
body.legend-sidebar-open footer {
  margin-right: 0;
}

.legend-sidebar,
.legend-sidebar.open {
  position: sticky;
  z-index: 10;
  top: 76px;
  right: auto;
  bottom: auto;
  left: auto;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: start;
  width: 100%;
  height: calc(100dvh - 92px);
  padding: 16px 16px 16px 0;
  overflow: hidden;
  transform: none;
  filter: none;
  transition: none;
}
.legend-sidebar:not(.open) .legend-sidebar-panel { display: none; }
.legend-sidebar-toggle,
.legend-sidebar.open .legend-sidebar-toggle {
  position: relative;
  top: 72px;
  right: auto;
  left: auto;
  align-self: start;
  width: 48px;
  min-height: 160px;
  margin: 0;
  border-radius: 18px 0 0 18px;
  background: var(--md-secondary-container);
  box-shadow: none;
}
.legend-sidebar-panel {
  height: 100%;
  min-width: 0;
  border: 1px solid var(--md-outline-variant);
  border-radius: 24px;
  box-shadow: none;
}
.legend-sidebar-header { border-radius: 24px 24px 0 0; }
.legend-sidebar #answer-legend-content { min-height: 0; }
body.legend-sidebar-open::after { display: none; }

@media (min-width: 1200px) {
  main,
  body.legend-sidebar-open main {
    max-width: 1440px;
    margin-inline: auto;
    padding-inline: 32px;
  }
  body.legend-sidebar-open .topbar,
  body.legend-sidebar-open .tabs {
    padding-inline: max(24px, calc((100vw - 1380px) / 2));
  }
}

@media (max-width: 1199px) {
  .workspace,
  body.legend-sidebar-open .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .workspace main { grid-row: 2; }
  .workspace .legend-sidebar {
    grid-row: 1;
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    display: block;
    width: 100%;
    height: auto;
    padding: 16px 24px 0;
    overflow: visible;
    transform: none;
  }
  .legend-sidebar-toggle,
  .legend-sidebar.open .legend-sidebar-toggle {
    top: auto;
    right: auto;
    left: auto;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 16px;
    flex-direction: row;
    gap: 8px;
  }
  .legend-toggle-text {
    writing-mode: initial;
    transform: none;
    font-size: 12px;
  }
  .legend-sidebar-panel {
    height: auto;
    max-height: none;
    margin-top: 8px;
    border-radius: 24px;
  }
  .legend-sidebar #answer-legend-content { max-height: 54dvh; }
  body.legend-sidebar-open .topbar,
  body.legend-sidebar-open .tabs,
  body.legend-sidebar-open main { padding-inline: 24px; }
}

@media (max-width: 599px) {
  .workspace .legend-sidebar {
    bottom: auto;
    padding: 12px 16px 0;
  }
  .legend-sidebar-panel { border-radius: 20px; }
  .legend-sidebar-header { border-radius: 20px 20px 0 0; }
  .legend-sidebar #answer-legend-content { max-height: 58dvh; }
  body.legend-sidebar-open main { padding-inline: 16px; }
}

@media print {
  .workspace { display: block; }
}

/* Versão 4.2 — ações icon-only integradas à superfície */
.ui-icon {
  display: block;
  width: 24px;
  height: 24px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action,
.button.icon-action,
.legend-sidebar-toggle.icon-action,
.legend-sidebar-close.icon-action,
.tab {
  --icon-surface: var(--md-surface-container-lowest);
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 15px;
  color: var(--md-on-surface-variant);
  background: transparent;
  box-shadow: none;
  text-decoration: none;
  transition: color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .15s ease;
}
.icon-action:hover,
.button.icon-action:hover,
.legend-sidebar-toggle.icon-action:hover,
.legend-sidebar-close.icon-action:hover,
.tab:hover {
  color: var(--md-on-surface);
  background: var(--icon-surface);
  box-shadow: 0 2px 5px rgba(26, 27, 32, .14), 0 1px 2px rgba(26, 27, 32, .10);
}
.icon-action:active,
.button.icon-action:active,
.tab:active {
  transform: translateY(1px) scale(.97);
  box-shadow: 0 1px 2px rgba(26, 27, 32, .12);
}
.icon-action.primary-action { color: var(--md-primary); }
.icon-action.danger-action { color: var(--md-error); }

.icon-action[data-tooltip]::after,
.tab[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 220;
  bottom: calc(100% + 9px);
  left: 50%;
  width: max-content;
  max-width: min(240px, 72vw);
  padding: 7px 10px;
  border-radius: 8px;
  color: #fff;
  background: #303138;
  box-shadow: 0 2px 6px rgba(26, 27, 32, .20);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity .14s ease, transform .14s ease;
}
.icon-action[data-tooltip]:hover::after,
.icon-action[data-tooltip]:focus-visible::after,
.tab[data-tooltip]:hover::after,
.tab[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tabs { --icon-surface: var(--md-surface); }
.tabs .tab { --icon-surface: var(--md-surface); }
.tab.active,
.tab.active:hover {
  color: var(--md-primary);
  background: transparent;
}
.tab.active:hover { background: var(--icon-surface); }
.tab .tab-count {
  position: absolute;
  top: 2px;
  right: 0;
  height: 18px;
  min-width: 18px;
  padding: 0 5px;
  font-size: 10px;
}
.tab-graphs.active .tab-count { color: var(--md-on-primary); background: var(--md-primary); }

.section-heading .icon-action,
.toolbar .icon-action { --icon-surface: var(--md-surface); }
.sticky-actions { --icon-surface: var(--md-surface-container-lowest); }
.toolbar { align-items: center; }
.toolbar select { margin-right: 4px; }
.row-actions { white-space: nowrap; }
.row-actions .table-action { --icon-surface: var(--md-surface-container-lowest); width: 40px; height: 40px; min-width: 40px; min-height: 40px; border-radius: 13px; }
.row-actions .table-action + .table-action { margin-left: 2px; }

.legend-sidebar,
.legend-sidebar.open { overflow: visible; }
.legend-sidebar-toggle.icon-action,
.legend-sidebar.open .legend-sidebar-toggle.icon-action {
  --icon-surface: var(--md-surface);
  top: 72px;
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 15px;
  background: transparent;
  box-shadow: none;
}
.legend-sidebar-close.icon-action { --icon-surface: var(--md-surface-container-low); }

@media (max-width: 1199px) {
  .workspace .legend-sidebar { display: flex; flex-wrap: wrap; justify-content: flex-end; }
  .legend-sidebar-toggle.icon-action,
  .legend-sidebar.open .legend-sidebar-toggle.icon-action {
    top: auto;
    width: 48px;
    min-height: 48px;
    margin-left: auto;
    padding: 0;
    border-radius: 15px;
  }
  .legend-sidebar-panel { flex: 0 0 100%; width: 100%; }
}

@media (max-width: 599px) {
  .tabs { justify-content: center; gap: 32px; }
  .tab { flex: 0 0 56px; width: 56px; border-radius: 16px; }
  .tab-icon { background: transparent; }
  .tab.active .tab-icon { background: transparent; }
  .tab[data-tooltip]::after {
    top: auto;
    bottom: calc(100% + 8px);
  }
  .sticky-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
  }
  .saved-counter { flex: 1 1 auto; grid-column: auto; width: auto; margin-right: auto; padding: 0 4px; }
  #save-button { grid-column: auto; grid-row: auto; }
  #view-charts, #clear-button { width: 48px; padding: 0; font-size: inherit; }
  .toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; }
  .toolbar select { flex: 1 0 100%; width: 100%; }
  .toolbar .button { width: 48px; padding: 0; font-size: inherit; }
}

/* Versão 4.3 — tooltip global fora dos containers com overflow */
.icon-action[data-tooltip]::after,
.tab[data-tooltip]::after {
  display: none !important;
  content: none !important;
}
.app-tooltip {
  position: fixed;
  z-index: 1000;
  width: max-content;
  max-width: min(240px, calc(100vw - 16px));
  padding: 7px 10px;
  border-radius: 8px;
  color: #fff;
  background: #303138;
  box-shadow: 0 2px 6px rgba(26, 27, 32, .20);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  pointer-events: none;
}
.app-tooltip[hidden] { display: none; }

.answer-sheet-banner #cancel-edit {
  --icon-surface: var(--md-primary-container);
  margin-left: auto;
  color: var(--md-on-primary-container);
}

body,
button,
input,
select {
  font-family: "Google Sans", "Segoe UI", system-ui, sans-serif;
}

.topbar h1,
.section-heading h2,
.report-header h1 {
  font-family: "Unbounded", "Google Sans", sans-serif;
}

.topbar h1 { font-weight: 520; }
.section-heading h2 { font-weight: 500; }
.report-header h1 { font-weight: 600; }

.topbar {
  min-height: 84px;
  justify-content: flex-start;
  padding-block: 14px;
}

@media (max-width: 599px) {
  .topbar { min-height: 72px; }
}

/* Sidebar aberta: o acionador desaparece e o painel usa toda a coluna. */
.legend-sidebar.open {
  grid-template-columns: minmax(0, 1fr);
}
.legend-sidebar.open .legend-sidebar-toggle {
  display: none;
}

/* Navegação principal como barra tonal sutil. */
.tabs {
  --nav-bar-surface: color-mix(in srgb, var(--md-surface-container-low) 72%, var(--md-surface));
  --icon-surface: var(--nav-bar-surface);
  background: var(--nav-bar-surface);
  border-top: 1px solid color-mix(in srgb, var(--md-outline-variant) 22%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--md-outline-variant) 32%, transparent);
}
.tabs .tab { --icon-surface: var(--nav-bar-surface); }

@media (max-width: 599px) {
  .tabs {
    --nav-bar-surface: color-mix(in srgb, var(--md-surface-container) 82%, var(--md-surface));
  }
}

.nav-brand {
  position: absolute;
  left: max(24px, calc((100vw - 1380px) / 2));
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--md-on-surface);
}
.nav-brand .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
}
.nav-brand .brand-mark span:nth-child(1) { height: 12px; transform: translateX(-8px); }
.nav-brand .brand-mark span:nth-child(2) { height: 22px; }
.nav-brand .brand-mark span:nth-child(3) { height: 16px; transform: translateX(8px); }
.nav-brand strong {
  font-family: "Unbounded", "Google Sans", sans-serif;
  font-size: 19px;
  font-weight: 620;
  letter-spacing: -.04em;
}

@media (max-width: 599px) {
  .tabs { gap: 6px; }
  .nav-brand {
    position: static;
    width: 38px;
    justify-content: center;
  }
  .nav-brand .brand-mark { display: none; }
  .nav-brand strong { font-size: 13px; }
  .tab { flex-basis: 48px; width: 48px; min-width: 48px; }
  .nav-actions { margin-left: 0; padding-left: 7px; }
  .nav-actions .icon-action { width: 44px; min-width: 44px; }
}


@media print {
  .report-header .report-label {
    margin-bottom: 4mm;
    color: #475467;
    font-size: 10pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
  }
  .report-header h1 { margin-bottom: 2mm; font-size: 21pt; }
  .report-header h2 { max-width: 165mm; margin-bottom: 5mm; font-size: 13pt; line-height: 1.35; font-weight: 500; }
}

/* Ações integradas ao formulário, sem aparência de barra de rodapé. */
.sticky-actions {
  position: static;
  min-height: 0;
  margin: 0;
  padding: 12px 18px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

@media (max-width: 599px) {
  .sticky-actions {
    bottom: auto;
    margin: 0;
    padding: 12px 4px 4px;
    border-radius: 0;
    box-shadow: none;
  }
}

/* Ações do cartão integradas à navegação principal. */
.nav-actions {
  position: static;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid color-mix(in srgb, var(--md-outline-variant) 52%, transparent);
}
.nav-actions .icon-action { --icon-surface: var(--nav-bar-surface); }
body.dashboard-active .nav-actions { display: none; }

@media (max-width: 599px) {
  .tabs { gap: 12px; }
  .nav-actions {
    position: static;
    gap: 4px;
    margin-left: 4px;
    padding-left: 10px;
  }
}

.event-strip {
  display: grid;
  place-items: center;
  min-height: 26px;
  padding: 4px 16px;
  color: var(--md-on-surface-variant);
  background: var(--md-surface-container-low);
  border-bottom: 1px solid color-mix(in srgb, var(--md-outline-variant) 28%, transparent);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Cartão de resposta integrado ao topo, sem ocupar um cartão separado. */
.response-nav {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 6px max(16px, calc((100vw - 1440px) / 2 + 32px));
  border: 0;
  border-bottom: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
}
.response-nav div { display: block; }
.response-nav strong { font-size: 14px; font-weight: 650; }
.response-nav .banner-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--md-on-primary);
  background: var(--md-primary);
  font-size: 15px;
  line-height: 1;
}
.response-nav #cancel-edit { margin-left: auto; }
body.dashboard-active .response-nav { display: none; }

@media (max-width: 599px) {
  .event-strip { min-height: 22px; padding-block: 3px; font-size: 8px; }
  .response-nav { padding: 6px 16px; }
}

/* Acionador da legenda no menu; nenhuma coluna é reservada quando o painel fecha. */
.workspace { grid-template-columns: minmax(0, 1fr) 0; }
.legend-sidebar:not(.open) { display: none; }
body.legend-sidebar-open .workspace { grid-template-columns: minmax(0, 1fr) var(--legend-sidebar-width); }
.legend-sidebar.open { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 1199px) {
  .workspace,
  body.legend-sidebar-open .workspace { grid-template-columns: minmax(0, 1fr); }
}

/* Toggle persistente do painel: panel-right-open / panel-right-close. */
#legend-sidebar-toggle .icon-panel-close { display: none; }
body.legend-sidebar-open #legend-sidebar-toggle {
  color: var(--md-primary);
  background: color-mix(in srgb, var(--nav-bar-surface) 82%, var(--md-primary) 18%);
}
body.legend-sidebar-open #legend-sidebar-toggle .icon-panel-open { display: none; }
body.legend-sidebar-open #legend-sidebar-toggle .icon-panel-close { display: block; }

/* Mantém a validação acima das camadas históricas do tema. */
.message.error,
.message.success {
  color: #fff;
  background: rgba(35, 36, 42, .88);
}
.compact-question.missing-answer,
.compact-question.missing-answer:hover {
  background: #fdebed;
  box-shadow: inset 3px 0 0 #e98f97;
}
.compact-question.missing-answer .question-number {
  color: #7c343b;
  background: #f5bcc1;
}
.compact-question .question-number {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: #6d7580;
  background: #f9f9f9;
  font-size: 11px;
  font-weight: 650;
}

/* Regra definitiva das alternativas: sem bordas e letras centralizadas. */
.question:has(input:checked) {
  background: transparent;
}
.nav-brand .brand-mark span { background: #FFFFFF; box-shadow: 0 1px 3px rgba(16, 24, 40, .22); }
.option,
.option:hover,
.option:has(input:checked) {
  border: 0;
  text-align: center;
  box-shadow: none;
  transition: color .18s ease, background-color .18s ease, box-shadow .2s ease, transform .2s ease;
}
.option:hover {
  color: #20242c;
  background: #fff;
  box-shadow: 0 6px 14px rgba(62, 76, 98, .16), 0 2px 5px rgba(62, 76, 98, .10);
  transform: translateY(-2px);
}
.option:has(input:checked) {
  border: 1px solid rgba(255, 255, 255, .95);
  color: #2f6847;
  background: #cfead9;
  box-shadow: 0 5px 12px rgba(58, 125, 88, .18), 0 2px 4px rgba(58, 125, 88, .12);
  transform: translateY(-1px);
}
.option:focus-within {
  outline: 0;
}
.option-letter,
.option:has(input:checked) .option-letter {
  display: grid;
  place-items: center;
  text-align: center;
  color: inherit;
  background: transparent;
}
@media (min-width: 600px) {
  .options {
    width: 294px;
    justify-content: flex-end;
  }
  .option {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    gap: 0;
  }
  .option-letter { margin: auto; }
}

@media (max-width: 599px) {
  .compact-question {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
    padding: 10px 16px 12px;
  }
  .compact-question.question-with-other { position: relative; align-items: start; }
  .question-with-other .question-label { align-self: start; padding-right: 48px; }
  .question-label { min-width: 0; gap: 8px; }
  .question-label p { font-size: 12px; line-height: 1.2; }
  .question-number { width: 28px; height: 28px; font-size: 10px; }
  .options {
    display: flex;
    flex-wrap: nowrap;
    justify-content: stretch;
    gap: 4px;
    width: 100%;
  }
  .option,
  .option:hover,
  .option:has(input:checked) {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    flex: 1 1 0;
    width: auto;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 14px;
    gap: 0;
    text-align: center;
  }
  .option-letter,
  .option:has(input:checked) .option-letter {
    width: auto;
    height: auto;
    margin: auto;
    border-radius: 0;
    background: transparent;
  }
  .option-text { display: none; }
  .question-with-other .platforms-response { width: 100%; }
  .question-with-other .platforms-choice-row { position: static; width: 100%; gap: 4px; }
  .question-with-other .platforms-choice-row .options { flex: 1 1 auto; width: 100%; }
  .question-with-other .option,
  .question-with-other .option:hover,
  .question-with-other .option:has(input:checked) {
    flex: 1 1 0;
    width: auto;
    height: 40px;
    min-height: 40px;
  }
  .question-with-other .other-platforms-toggle {
    position: absolute;
    top: 10px;
    right: 16px;
    width: 32px;
    height: 32px;
  }
  .question-with-other .other-field { grid-template-columns: 1fr; margin-top: 4px; font-size: 11px; }
  .question-with-other input[type="text"] { min-height: 40px; padding: 0 12px; font-size: 13px; }
}

/* No desktop, as perguntas seguem a mesma leitura vertical limpa do mobile. */
@media (min-width: 600px) {
  .compact-question {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
    padding: 10px 16px 12px;
  }
  .question-label { min-width: 0; gap: 8px; }
  .question-label p { font-size: 12px; line-height: 1.2; }
  .question-number { width: 28px; height: 28px; font-size: 10px; }
  .options,
  .platforms-choice-row .options {
    display: flex;
    flex-wrap: nowrap;
    justify-content: stretch;
    gap: 4px;
    width: 100%;
  }
  .platforms-choice-row { justify-content: stretch; }
  .platforms-choice-row .options { width: auto; flex: 1 1 auto; }
  .option,
  .option:hover,
  .option:has(input:checked) {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    flex: 1 1 0;
    width: auto;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 14px;
    gap: 0;
    text-align: center;
  }
  .option-letter,
  .option:has(input:checked) .option-letter {
    width: auto;
    height: auto;
    margin: auto;
    border-radius: 0;
    background: transparent;
  }
}

.part-tabs { display: none; }

@media (max-width: 599px) {
  .answer-sheet-banner,
  .answer-sheet-banner:not(:has(#cancel-edit.hidden)) {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 56px;
    margin: 0 0 12px;
    padding: 8px 10px;
    border-radius: 18px;
    background: var(--md-primary-container);
  }
  .answer-sheet-banner .banner-icon,
  .answer-sheet-banner:not(:has(#cancel-edit.hidden)) .banner-icon {
    display: grid;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 18px;
  }
  .answer-sheet-banner div { display: block; }
  .answer-sheet-banner strong { font-size: 15px; }
  .part-tabs {
    display: flex;
    justify-content: stretch;
    gap: 2px;
    width: 100%;
    margin: 14px 0 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .part-tab {
    position: relative;
    display: grid;
    place-items: center;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    color: var(--md-on-surface-variant);
    background: #e5e4f2;
    font-family: "Google Sans", "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
  }
  .part-tab:first-child { border-radius: 22px 3px 3px 22px; }
  .part-tab:last-child { border-radius: 3px 22px 22px 3px; }
  .part-tab span { font-size: 14px; font-weight: 700; line-height: 1; }
  .part-tab:focus,
  .part-tab:focus-visible { outline: 0; }
  .part-tab:hover {
    color: var(--md-on-surface);
    background: #f0eff8;
    box-shadow: inset 0 0 0 1px rgba(83, 82, 105, .08);
    transform: none;
  }
  .part-tab.active {
    border: 0;
    color: #31547f;
    background: #cfdef5;
    box-shadow: inset 0 2px 5px rgba(49, 84, 127, .20), inset 0 0 0 1px rgba(49, 84, 127, .08);
    transform: none;
  }
  .part-tab.complete,
  .part-tab.complete:hover,
  .part-tab.complete.active {
    border: 1px solid rgba(255, 255, 255, .95);
    color: #2f6847;
    background: #cfead9;
    box-shadow: inset 0 2px 5px rgba(39, 91, 62, .20), inset 0 0 0 1px rgba(47, 104, 71, .08);
    transform: none;
  }
  .part-tab:disabled,
  .part-tab:disabled:hover {
    border: 0;
    color: #9999a8;
    background: #ecebf5;
    box-shadow: none;
    opacity: .62;
    transform: none;
    cursor: not-allowed;
  }
  .part-tab.has-missing::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e98f97;
  }
  .sheet-columns { display: block; }
  .sheet-column { display: contents; }
  .answer-block[data-part] { display: none; }
  .answer-block[data-part].mobile-part-active { display: block; }
  .answer-block[data-part] .sheet-section-title { display: none; }
}

/* O cabeçalho virou uma barra global e não deve herdar o espaçamento do cartão mobile. */
@media (max-width: 599px) {
  .response-nav {
    min-height: 48px;
    margin: 0;
    padding: 6px 16px;
    border-radius: 0;
  }
  .response-nav .banner-icon { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
  .response-nav strong { font-size: 14px; }
}

/* Tabs de partes compartilhadas entre mobile e desktop. */
@media (min-width: 600px) {
  .answer-sheet {
    overflow: visible;
    border-radius: 0;
    background: transparent;
  }
  .sheet-columns {
    display: block;
    padding: 0;
    background: transparent;
  }
  .sheet-column { display: contents; }
  .answer-block[data-part] { display: none; }
  .answer-block[data-part].mobile-part-active { display: block; }
  .answer-block[data-part] .sheet-section-title { display: none; }
  .part-tabs {
    display: flex;
    justify-content: stretch;
    gap: 2px;
    width: 100%;
    margin: 14px 0 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .part-tab {
    position: relative;
    display: grid;
    place-items: center;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    color: var(--md-on-surface-variant);
    background: #e5e4f2;
    font-family: "Google Sans", "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
  }
  .part-tab:first-child { border-radius: 22px 3px 3px 22px; }
  .part-tab:last-child { border-radius: 3px 22px 22px 3px; }
  .part-tab span { font-size: 14px; font-weight: 700; line-height: 1; }
  .part-tab:focus,
  .part-tab:focus-visible { outline: 0; }
  .part-tab:hover {
    color: var(--md-on-surface);
    background: #f0eff8;
    box-shadow: inset 0 0 0 1px rgba(83, 82, 105, .08);
  }
  .part-tab.active {
    color: #31547f;
    background: #cfdef5;
    box-shadow: inset 0 2px 5px rgba(49, 84, 127, .20), inset 0 0 0 1px rgba(49, 84, 127, .08);
  }
  .part-tab.complete,
  .part-tab.complete:hover,
  .part-tab.complete.active {
    border: 1px solid rgba(255, 255, 255, .95);
    color: #2f6847;
    background: #cfead9;
    box-shadow: inset 0 2px 5px rgba(39, 91, 62, .20), inset 0 0 0 1px rgba(47, 104, 71, .08);
  }
  .part-tab:disabled,
  .part-tab:disabled:hover {
    border: 0;
    color: #9999a8;
    background: #ecebf5;
    box-shadow: none;
    opacity: .62;
    cursor: not-allowed;
  }
  .part-tab.has-missing::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e98f97;
  }
}

/* Azul-base unificado da interface. */
:root {
  --md-primary: #344054;
  --md-primary-container: #CFE6FF;
  --md-on-primary-container: #344054;
  --md-secondary-container: #CFE6FF;
  --md-on-secondary-container: #344054;
  --primary: #344054;
  --primary-dark: #1f2937;
  --soft: #CFE6FF;
}
.part-tab.active,
.part-tab.active:hover {
  color: #344054;
  background: #CFE6FF;
  box-shadow: inset 0 2px 5px rgba(52, 64, 84, .16), inset 0 0 0 1px rgba(52, 64, 84, .08);
}
.charts-location {
  border-color: #CFE6FF;
  background: #CFE6FF;
  color: #344054;
}
.response-nav .banner-icon {
  width: 24px;
  height: 24px;
  border-radius: 0;
  color: #344054;
  background: transparent;
}

/* Alternativas em grupos contínuos, com a mesma base clara dos números. */
.options,
.platforms-choice-row .options {
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 0;
  width: 100%;
  padding: 2px;
  border-radius: 16px;
  background: #f9f9f9;
}
.platforms-choice-row .options { width: auto; flex: 1 1 auto; }
.option,
.option:hover,
.option:has(input:checked) {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
}
.option:first-child { border-radius: 14px 5px 5px 14px; }
.option:last-child { border-radius: 5px 14px 14px 5px; }
.option:hover {
  color: #20242c;
  background: #fff;
  box-shadow: 0 4px 10px rgba(62, 76, 98, .14);
  transform: translateY(-1px);
}
.option:has(input:checked) {
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 12px;
  color: #2f6847;
  background: #cfead9;
  box-shadow: 0 5px 12px rgba(58, 125, 88, .18), 0 2px 4px rgba(58, 125, 88, .12);
  transform: translateY(-1px);
}

/* Button group no estilo lilás do referencial, com seleção em roxo profundo. */
.options,
.platforms-choice-row .options {
  gap: 2px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
}
.option,
.option:hover,
.option:has(input:checked) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  color: #4a4a4a;
  background: #f4f4f4;
  box-shadow: none;
  transform: none;
  transition: color .34s cubic-bezier(.2, .7, .2, 1), background-color .34s cubic-bezier(.2, .7, .2, 1), box-shadow .38s cubic-bezier(.2, .7, .2, 1), border-radius .34s cubic-bezier(.2, .7, .2, 1), transform .34s cubic-bezier(.2, .7, .2, 1), gap .34s cubic-bezier(.2, .7, .2, 1);
}
.option:first-child { border-radius: 999px 7px 7px 999px; }
.option:last-child { border-radius: 7px 999px 999px 7px; }
.option:hover {
  color: #343434;
  background: #fafafa;
  box-shadow: none;
  transform: none;
}
.option:has(input:checked) {
  gap: 7px;
  border-radius: 999px;
  color: #275449;
  background: #b5ddd1;
  box-shadow: 0 5px 12px rgba(67, 126, 112, .18);
  transform: scale(1.003);
}
.option::before {
  content: '✓';
  display: block;
  width: 0;
  overflow: hidden;
  opacity: 0;
  transform: scale(.84);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  transition: width .34s cubic-bezier(.2, .7, .2, 1), opacity .26s ease, transform .34s cubic-bezier(.2, .7, .2, 1);
}
.option:has(input:checked)::before {
  width: 1em;
  opacity: .92;
  transform: scale(1);
}
.option .option-letter,
.option:has(input:checked) .option-letter { margin: 0; }

/* A interação fica somente no grupo de respostas, sem pintar a linha inteira. */
.compact-question:hover:not(.missing-answer),
.compact-question:focus-within:not(.missing-answer) {
  background: transparent;
  box-shadow: none;
}
.compact-question { border-bottom: 0; }

/* Tabs ligeiramente mais estreitas, com o topo reto e base arredondada. */
.part-tabs {
  width: 100%;
  margin-top: 0;
  margin-left: auto;
  margin-right: auto;
  border-radius: 0 0 24px 24px;
  background: var(--md-surface-container-lowest);
  box-shadow: 0 12px 30px rgba(16, 24, 40, .07);
}
.answer-block[data-part].mobile-part-active { border-radius: 24px 24px 0 0; }
.answer-block[data-part].mobile-part-active {
  position: relative;
  z-index: 2;
  padding-bottom: 7px;
  box-shadow: 0 14px 30px rgba(16, 24, 40, .14);
}
.part-tabs { position: relative; z-index: 1; }
.part-tab:first-child { border-radius: 0 3px 3px 22px; }
.part-tab:last-child { border-radius: 3px 0 22px 3px; }
.part-tab:not(:first-child):not(:last-child) { border-radius: 0; }
.part-tab span.part-tab-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.part-tab-action {
  display: flex;
  flex-direction: row;
  gap: 6px;
  color: #2f6759;
  background: #edf7f4;
}
.part-tab-action:hover {
  color: #244f44;
  background: #dff0eb;
}
.part-tab-action .ui-icon { width: 18px; height: 18px; }
.part-tab-action .save-count {
  position: static;
  display: inline-grid;
  place-items: center;
  width: 17px;
  min-width: 17px;
  height: 17px;
  padding: 0;
  border-radius: 50%;
  color: #fff;
  background: #68b78d;
  box-shadow: none;
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  opacity: 0;
  transform: scale(.65);
  transition: opacity .16s ease, transform .16s ease, color .16s ease, background-color .16s ease;
  pointer-events: none;
}
.part-tab-action.has-progress .save-count { opacity: 1; transform: scale(1); }
.part-tab-action .save-count.complete { color: #fff; background: #4f9d73; }
.part-tab-action {
  display: grid;
  place-items: center;
  gap: 0;
}
.part-tab-action .save-count {
  top: 50%;
  right: auto;
  left: calc(50% + 10px);
  transform: translateY(-50%) scale(.65);
}
.part-tab-action.has-progress .save-count { transform: translateY(-50%) scale(1); }
.response-nav div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.response-nav .save-count {
  position: static;
  display: inline-grid;
  place-items: center;
  width: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  color: #fff;
  background: #68b78d;
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  opacity: 0;
  transform: scale(.65);
  transition: opacity .16s ease, transform .16s ease, background-color .16s ease;
}
.response-nav .save-count.has-progress { opacity: 1; transform: scale(1); }
.response-nav .save-count.complete { background: #4f9d73; }

/* As tabs permanecem planas; a elevação fica somente no card de respostas. */
.part-tabs,
.part-tab,
.part-tab:hover,
.part-tab.active,
.part-tab.active:hover,
.part-tab.complete,
.part-tab.complete:hover,
.part-tab.complete.active,
.part-tab:disabled,
.part-tab:disabled:hover {
  box-shadow: none !important;
}

/* O envio continua desativado, mas o ícone precisa permanecer visível. */
.part-tab-action,
.part-tab-action:disabled,
.part-tab-action:disabled:hover {
  color: #667085 !important;
  opacity: 1;
}
.part-tab-action .ui-icon {
  display: block;
  width: 22px;
  height: 22px;
  color: inherit;
  stroke: currentColor;
  stroke-width: 2.2;
}
.part-tab-action:disabled .ui-icon { color: #667085; opacity: 1; }
#send-tab .ui-icon path:first-child { d: path("m22 2-7 20-4-9-9-4Z"); }
#send-tab .ui-icon path:last-child { d: path("M22 2 11 13"); }
.part-tab-action,
.part-tab-action:disabled,
.part-tab-action:disabled:hover {
  background: #f4f4f4 !important;
}
.part-tab-action:hover:not(:disabled) { background: #fafafa !important; }
.part-tab-action:disabled,
.part-tab-action:disabled:hover {
  background: var(--md-surface-container-lowest) !important;
  border: 0 !important;
}
.part-tab-action:disabled,
.part-tab-action:disabled:hover {
  color: #9999a8 !important;
  background: #ecebf5 !important;
  opacity: .62;
  cursor: not-allowed;
}
#form-title,
.part-tab-label {
  text-transform: uppercase;
}
.part-tab.active,
.part-tab.active:hover {
  color: #344054;
  background: #fff !important;
}
.response-nav {
  color: #344054;
  background: #fff !important;
}
.part-tabs .part-tab.active,
.part-tabs .part-tab.active:hover {
  color: #344054;
  background: #fff !important;
}
.part-tabs .part-tab.complete,
.part-tabs .part-tab.complete:hover,
.part-tabs .part-tab.complete.active {
  color: #39705e;
  background: #edf7f2 !important;
}
@keyframes next-tab-hint {
  0%, 100% { outline-color: rgba(52, 64, 84, .22); outline-offset: 0; }
  50% { outline-color: rgba(82, 126, 171, .72); outline-offset: 2px; }
}
.part-tabs .part-tab.next-tab {
  outline: 1px solid rgba(52, 64, 84, .22);
  outline-offset: 0;
  animation: next-tab-hint 1.8s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .part-tabs .part-tab.next-tab { animation: none; }
}
.part-tabs .part-tab.next-tab {
  outline: 0;
  animation: none;
}
.part-tabs .part-tab.next-tab::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: -2px;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, transparent 0 28%, #9fc4e6 42%, #b5ddd1 54%, transparent 68% 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: next-tab-gradient-spin 2.6s linear infinite;
  pointer-events: none;
}
@keyframes next-tab-gradient-spin {
  to { transform: rotate(360deg); }
}
.part-tabs .part-tab.next-tab > * {
  position: relative;
  z-index: 1;
}
@media (prefers-reduced-motion: reduce) {
  .part-tabs .part-tab.next-tab::before { animation: none; }
}
@property --next-tab-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
.part-tabs .part-tab.next-tab {
  border: 2px solid transparent !important;
  background:
    linear-gradient(#f4f4f4, #f4f4f4) padding-box,
    conic-gradient(from var(--next-tab-angle), transparent 0 28%, #9fc4e6 42%, #b5ddd1 54%, transparent 68% 100%) border-box !important;
  animation: next-tab-gradient-spin 2.6s linear infinite;
}
.part-tabs .part-tab.next-tab::before { display: none; }
@keyframes next-tab-gradient-spin {
  to { --next-tab-angle: 360deg; }
}
@media (prefers-reduced-motion: reduce) {
  .part-tabs .part-tab.next-tab { animation: none; }
}
.part-tabs {
  margin-top: -7px;
  z-index: 3;
}
.part-tabs .part-tab.active,
.part-tabs .part-tab.active:hover {
  position: relative;
  z-index: 4;
}
.answer-block,
.answer-block[data-part].mobile-part-active {
  padding-bottom: 16px;
}
.response-nav {
  background: var(--md-primary-container) !important;
}
.response-nav {
  min-height: 96px;
  margin-bottom: -40px;
}
@media (max-width: 599px) {
  .response-nav {
    min-height: 82px;
    margin-bottom: -34px;
  }
}
.response-nav {
  margin-bottom: -24px;
}
.answer-sheet {
  border-radius: 18px;
}
.answer-block[data-part].mobile-part-active {
  border-radius: 18px 18px 0 0;
}
.option,
.option:hover {
  border: 0;
  background: #fff;
  box-shadow: 0 1px 4px rgba(62, 76, 98, .10);
}
.option:hover {
  box-shadow: 0 3px 8px rgba(62, 76, 98, .14);
}
.option:has(input:checked),
.option:has(input:checked):hover {
  border: 0;
  color: #275449;
  background: #b5ddd1;
  box-shadow: 0 5px 12px rgba(67, 126, 112, .18);
}
.options {
  gap: 0;
}
.option:not(:first-child):not(:last-child) {
  border-radius: 0;
}
.part-tabs {
  gap: 0;
}
.part-tabs .part-tab:not(.next-tab) {
  border: 0 !important;
}
.part-tabs .part-tab.active {
  box-shadow: none !important;
}
@media (max-width: 599px) {
  .response-nav { margin-bottom: -20px; }
}

/* Painel de estatísticas — mesma linguagem do cartão de respostas. */
.dashboard-panel {
  padding-top: 10px;
  color: #344054;
}
.dashboard-panel .dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 24px;
  margin-bottom: 18px;
  padding: 22px 24px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(52, 64, 84, .08);
}
.dashboard-panel .dashboard-hero > div:first-child {
  align-self: center;
  padding-left: 16px;
  border-left: 5px solid #CFE6FF;
}
.dashboard-panel .dashboard-hero .eyebrow {
  margin-bottom: 7px;
  color: #527eab;
  font-size: 10px;
  letter-spacing: .14em;
}
.dashboard-panel .dashboard-hero h2 {
  margin-bottom: 5px;
  color: #20242c;
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 650;
  letter-spacing: -.055em;
  line-height: 1;
  text-transform: uppercase;
  text-wrap: balance;
}
.dashboard-panel .dashboard-hero p:last-child {
  max-width: 58ch;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}
.dashboard-panel .dashboard-hero .toolbar {
  align-items: center;
  align-self: stretch;
  padding-left: 20px;
  border-left: 1px solid #eef0f4;
}
.dashboard-panel .dashboard-hero .toolbar select {
  min-width: 210px;
  min-height: 44px;
  border: 0;
  border-radius: 13px;
  color: #344054;
  background: #f4f4f4;
  box-shadow: inset 0 0 0 1px rgba(52, 64, 84, .06);
}
.dashboard-panel .dashboard-hero .toolbar .icon-action {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 13px;
  color: #667085;
  background: #f4f4f4;
}
.dashboard-panel .dashboard-hero .toolbar .icon-action:hover {
  color: #344054;
  background: #fff;
}
/* Achados em destaque — substituem os KPIs soltos por uma leitura já pronta. */
.dashboard-panel .findings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.dashboard-panel .finding-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 0;
  border-radius: 22px;
  background: #f4f4f4;
  box-shadow: none;
}
.dashboard-panel .finding-card::after {
  content: '';
  position: absolute;
  right: -25px;
  bottom: -34px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .42);
}
.dashboard-panel .finding-card.tone-accent { background: #CFE6FF; }
.dashboard-panel .finding-card.tone-alert { background: #ffe4d9; }
.dashboard-panel .finding-card .eyebrow {
  position: relative;
  z-index: 1;
  margin-bottom: 8px;
  color: #527eab;
  font-size: 10px;
  letter-spacing: .14em;
}
.dashboard-panel .finding-card.tone-alert .eyebrow { color: #a34a26; }
.dashboard-panel .finding-card .value {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-size: clamp(32px, 3.4vw, 44px);
  font-weight: 650;
  letter-spacing: -.045em;
  line-height: .95;
  font-variant-numeric: tabular-nums;
}
.dashboard-panel .finding-card .desc {
  position: relative;
  z-index: 1;
  max-width: 32ch;
  color: #667085;
  font-size: 13px;
  line-height: 1.4;
}
.dashboard-panel .finding-card.tone-accent .desc { color: #344054; opacity: .78; }

/* Grupos temáticos — cada parte do questionário vira uma seção própria. */
.question-part-group { margin-bottom: 22px; }
.question-part-group:last-child { margin-bottom: 0; }
.part-group-title {
  margin: 0 0 12px 4px;
  color: #20242c;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.dashboard-panel .charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}
.dashboard-panel .report-card {
  min-width: 0;
  margin-top: 0;
  padding: 22px;
  border: 0;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(52, 64, 84, .075);
}
.dashboard-panel .card-title-row { margin-bottom: 15px; }
.dashboard-panel .card-title-row h3,
.dashboard-panel .report-card.full-width h3 {
  color: #20242c;
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -.02em;
}
.dashboard-panel .eyebrow,
.dashboard-panel .report-card.full-width .eyebrow {
  margin-bottom: 6px;
  color: #527eab;
  font-size: 10px;
  letter-spacing: .14em;
}

/* Barra horizontal ranqueada — uma pergunta, uma leitura, sem letras. */
.ranked-bars { display: flex; flex-direction: column; gap: 2px; }
.rank-row {
  display: grid;
  grid-template-columns: 22px minmax(90px, 1.4fr) minmax(0, 2.2fr) 52px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}
.rank-row .rank-num { font-size: 11px; font-weight: 700; color: #98a2b3; font-variant-numeric: tabular-nums; }
.rank-row .rank-label { font-size: 12.5px; color: #344054; font-weight: 550; line-height: 1.3; }
.rank-track { position: relative; height: 20px; background: #eef0f4; border-radius: 4px; overflow: hidden; }
.rank-fill {
  position: absolute; inset: 0 auto 0 0;
  height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, #9FC4E6, #6ea4d6);
  transition: width .9s cubic-bezier(.16,.84,.29,.99);
}
.rank-row .rank-value { font-size: 12.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; color: #344054; }
.rank-row.rank-lead .rank-label,
.rank-row.rank-lead .rank-value { font-weight: 750; }
.rank-row.rank-lead .rank-fill { background: linear-gradient(90deg, #CFE6FF, #7fb2e6); }

.dashboard-panel .note {
  margin-top: 14px;
  color: #98a2b3;
  font-size: 10.5px;
  line-height: 1.4;
}
.dashboard-panel .report-card.full-width {
  margin-top: 14px;
}
.dashboard-panel .table-wrap {
  border: 0;
  border-radius: 17px;
  background: #f8f8fc;
  padding: 4px;
}
.dashboard-panel table { min-width: 680px; }
.dashboard-panel th,
.dashboard-panel td {
  padding: 11px 12px;
  border-bottom-color: #e9edf2;
}
.dashboard-panel th {
  color: #667085;
  background: #f4f4f4;
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.dashboard-panel td { color: #475467; font-size: 12px; }
.dashboard-panel .method-note {
  margin-top: 14px;
  padding: 17px 19px;
  border: 0;
  border-radius: 20px;
  color: #39705e;
  background: #edf7f2;
}
.dashboard-panel .method-note h3 { font-size: 14px; }
.dashboard-panel .method-note p { color: #39705e; font-size: 12px; }
.dashboard-panel .empty-state {
  padding: 72px 24px;
  border: 0;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(52,64,84,.075);
}
.dashboard-panel .badge {
  color: #344054;
  background: #CFE6FF;
}
.dashboard-panel .bar-track { background: #e9edf2; }
.dashboard-panel .bar-fill { background: linear-gradient(90deg, #9FC4E6, #6ea4d6); }

@media (max-width: 980px) {
  .dashboard-panel .dashboard-hero { grid-template-columns: 1fr; }
  .dashboard-panel .dashboard-hero .toolbar {
    align-items: center;
    padding-top: 14px;
    padding-left: 0;
    border-top: 1px solid #eef0f4;
    border-left: 0;
  }
  .dashboard-panel .findings-grid { grid-template-columns: 1fr; }
  .dashboard-panel .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 599px) {
  .dashboard-panel { padding-top: 4px; }
  .dashboard-panel .dashboard-hero { gap: 14px; padding: 18px 16px; border-radius: 22px; }
  .dashboard-panel .dashboard-hero > div:first-child { padding-left: 12px; border-left-width: 4px; }
  .dashboard-panel .dashboard-hero h2 { font-size: 25px; }
  .dashboard-panel .dashboard-hero .toolbar { flex-wrap: wrap; }
  .dashboard-panel .dashboard-hero .toolbar select { width: 100%; min-width: 0; }
  .dashboard-panel .report-card { padding: 16px; border-radius: 21px; }
  .rank-row { grid-template-columns: 18px minmax(70px, 1fr) minmax(0, 1.6fr) 44px; gap: 7px; }
  .dashboard-panel .table-wrap { margin-inline: -4px; }
}
@media print {
  .dashboard-panel .dashboard-hero,
  .dashboard-panel .finding-card,
  .dashboard-panel .report-card,
  .dashboard-panel .empty-state { box-shadow: none; }
  .question-part-group { break-inside: avoid; }
  .dashboard-panel .report-card { break-inside: avoid; }
}

/* A faixa azul funciona como uma folha recuada atrás do card de respostas. */
.response-nav {
  z-index: 1;
  width: min(calc(100% - 64px), 1376px);
  min-height: 64px;
  margin: 16px auto -40px;
  padding: 12px 20px;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 10px 22px rgba(16, 24, 40, .08);
}
.workspace {
  position: relative;
  z-index: 2;
}
@media (max-width: 599px) {
  .response-nav {
    width: calc(100% - 32px);
    min-height: 58px;
    margin: 12px auto -34px;
    padding: 10px 16px;
    border-radius: 20px 20px 0 0;
  }
}

/* Correções de continuidade: a página de estatísticas usa o mesmo menu e a mesma tipografia do cartão. */
body.dashboard-active .nav-actions {
  display: flex;
}
body.dashboard-active .nav-actions #clear-button {
  display: none;
}
.nav-actions .dashboard-action {
  display: none;
}
body.dashboard-active .nav-actions .dashboard-action {
  display: inline-grid;
}
.dashboard-panel .dashboard-hero h2 {
  font-family: "Google Sans", "Segoe UI", system-ui, sans-serif;
  font-weight: 650;
  letter-spacing: -.045em;
}
.dashboard-panel .dashboard-hero p:last-child,
.dashboard-panel .chart-panel h4,
.dashboard-panel .chart-subtitle,
.dashboard-panel .question-chart-card > .note {
  display: none;
}
.dashboard-panel .dashboard-hero .toolbar {
  justify-content: flex-end;
}
.dashboard-panel .dashboard-hero .toolbar select {
  min-width: 220px;
}
@media (min-width: 981px) {
  .dashboard-panel .dashboard-hero {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* Versão 6.0 — autenticação persistente Material Design 3 */
body:not(.authenticated) { overflow: hidden; }
.application-shell[hidden] { display: none !important; }
.auth-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(480px, 1.1fr);
  min-height: 100dvh;
  overflow: auto;
  background: #eef1ff;
  color: #1a1b20;
  opacity: 1;
  visibility: visible;
  transition: opacity .28s ease, visibility .28s ease;
}
.auth-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding: clamp(32px, 5vw, 72px);
  overflow: hidden;
  background: #dfe5ff;
  color: #202b5f;
}
.auth-visual::before {
  content: "";
  position: absolute;
  inset: 8% auto auto 54%;
  width: min(42vw, 540px);
  aspect-ratio: 1;
  border: 1px solid rgba(48, 70, 170, .18);
  border-radius: 50%;
  box-shadow: 0 0 0 64px rgba(255, 255, 255, .12), 0 0 0 128px rgba(255, 255, 255, .09);
}
.auth-visual-copy,
.auth-visual > p,
.response-orbit { position: relative; z-index: 1; }
.auth-system-name {
  display: block;
  margin-bottom: 18px;
  font: 650 13px/1.2 "Google Sans", "Segoe UI", sans-serif;
  letter-spacing: .02em;
}
.auth-visual-copy strong {
  display: block;
  max-width: 560px;
  font: 520 clamp(38px, 5.2vw, 74px)/.98 "Google Sans", "Segoe UI", sans-serif;
  letter-spacing: -.055em;
}
.auth-visual > p {
  margin: 0;
  font: 600 13px/1.4 "Google Sans", "Segoe UI", sans-serif;
  color: #44507c;
}
.response-orbit {
  align-self: center;
  display: grid;
  place-items: center;
  width: clamp(220px, 25vw, 360px);
  aspect-ratio: 1;
  margin: 48px 0;
  border: 1px solid rgba(48, 70, 170, .28);
  border-radius: 50%;
}
.response-orbit::before {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1px dashed rgba(48, 70, 170, .3);
  border-radius: 50%;
}
.orbit-core {
  display: grid;
  place-items: center;
  width: 100px;
  height: 100px;
  border-radius: 32px;
  background: #3046aa;
  color: white;
  font: 700 24px/1 "Google Sans", "Segoe UI", sans-serif;
  box-shadow: 0 18px 40px rgba(48, 70, 170, .2);
}
.response-dot {
  position: absolute;
  width: 17px;
  height: 17px;
  border: 4px solid #dfe5ff;
  border-radius: 50%;
  background: #3046aa;
  box-sizing: content-box;
}
.dot-1 { top: -10px; left: 48%; }
.dot-2 { top: 12%; right: 10%; }
.dot-3 { top: 48%; right: -10px; }
.dot-4 { right: 11%; bottom: 10%; }
.dot-5 { bottom: -10px; left: 48%; }
.dot-6 { bottom: 11%; left: 10%; }
.dot-7 { top: 48%; left: -10px; }
.dot-8 { top: 11%; left: 11%; }
.auth-surface {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: clamp(28px, 6vw, 96px);
  border-radius: 42px 0 0 42px;
  background: #fdfbff;
  box-shadow: -24px 0 70px rgba(47, 55, 90, .08);
}
.auth-card { width: min(100%, 440px); }
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(52px, 8vh, 92px);
  color: #202b5f;
}
.auth-brand strong { font: 750 18px/1 "Google Sans", "Segoe UI", sans-serif; letter-spacing: .02em; }
.auth-screen .auth-brand .brand-mark {
  display: inline-grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  gap: 3px;
  width: 23px;
  height: 23px;
}
.auth-screen .auth-brand .brand-mark span { display: block; width: 5px; border-radius: 5px; background: #3046aa; }
.auth-screen .auth-brand .brand-mark span:nth-child(1) { height: 12px; }
.auth-screen .auth-brand .brand-mark span:nth-child(2) { height: 21px; }
.auth-screen .auth-brand .brand-mark span:nth-child(3) { height: 16px; }
.auth-heading { margin-bottom: 32px; }
.auth-overline {
  margin: 0 0 10px;
  color: #4b5fb8;
  font: 700 12px/1.2 "Google Sans", "Segoe UI", sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.auth-heading h1 {
  margin: 0 0 12px;
  color: #1b1b1f;
  font: 560 clamp(34px, 4vw, 48px)/1.04 "Google Sans", "Segoe UI", sans-serif;
  letter-spacing: -.045em;
}
.auth-heading p:last-child { max-width: 380px; margin: 0; color: #5f6068; font-size: 15px; line-height: 1.55; }
.auth-form { display: grid; gap: 18px; }
.md-field { position: relative; display: grid; gap: 7px; color: #42434a; font-size: 13px; font-weight: 650; }
.md-field > span { padding-left: 4px; }
.md-field input {
  width: 100%;
  height: 56px;
  padding: 0 17px;
  border: 1px solid #777882;
  border-radius: 16px;
  outline: 0;
  background: #fdfbff;
  color: #1b1b1f;
  font: 500 16px/1 "Google Sans", "Segoe UI", sans-serif;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.md-field input:hover { background: #f7f5fa; border-color: #43444c; }
.md-field input:focus { border-color: #3046aa; box-shadow: 0 0 0 3px rgba(48, 70, 170, .13); }
.auth-field-support { margin: -10px 4px 0; color: #686971; font-size: 12px; line-height: 1.4; }
.md-password-field input { padding-right: 56px; }
.password-visibility {
  position: absolute;
  right: 8px;
  bottom: 7px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #55565f;
  cursor: pointer;
}
.password-visibility:hover,
.password-visibility:focus-visible { background: #eeedf2; outline: 0; }
.password-visibility .ui-icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-visibility .icon-password-hidden { display: none; }
.password-visibility.is-visible .icon-password-visible { display: none; }
.password-visibility.is-visible .icon-password-hidden { display: block; }
.remember-device {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 4px;
  color: #303038;
  cursor: pointer;
}
.remember-device input { position: absolute; opacity: 0; pointer-events: none; }
.remember-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 2px solid #777882;
  border-radius: 7px;
  color: white;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.remember-check svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; opacity: 0; }
.remember-device input:checked + .remember-check { border-color: #3046aa; background: #3046aa; }
.remember-device input:checked + .remember-check svg { opacity: 1; }
.remember-device input:focus-visible + .remember-check { box-shadow: 0 0 0 4px rgba(48, 70, 170, .14); }
.remember-device strong,
.remember-device small { display: block; }
.remember-device strong { font-size: 14px; line-height: 1.35; }
.remember-device small { margin-top: 2px; color: #686971; font-size: 12px; line-height: 1.4; }
.auth-message { padding: 12px 14px; border-radius: 14px; font-size: 13px; font-weight: 650; line-height: 1.4; }
.auth-message.error { background: #ffedea; color: #8c1d18; }
.auth-message.success { background: #e6f5eb; color: #145c35; }
.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 56px;
  margin-top: 2px;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  background: #3046aa;
  color: white;
  font: 700 15px/1 "Google Sans", "Segoe UI", sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(48, 70, 170, .2);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.auth-submit:hover { background: #22368f; box-shadow: 0 10px 24px rgba(48, 70, 170, .26); transform: translateY(-1px); }
.auth-submit:focus-visible { outline: 3px solid rgba(48, 70, 170, .28); outline-offset: 3px; }
.auth-submit:disabled { opacity: .7; cursor: wait; transform: none; }
.auth-submit .ui-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-submit.is-loading .ui-icon { animation: auth-pulse .9s ease-in-out infinite alternate; }
.auth-privacy { display: flex; align-items: center; gap: 8px; margin: 24px 0 0; color: #6a6b73; font-size: 12px; }
.auth-privacy .ui-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@keyframes auth-pulse { to { transform: translateX(4px); opacity: .55; } }
@media (max-width: 900px) {
  .auth-screen { grid-template-columns: 1fr; background: #fdfbff; }
  .auth-visual { display: none; }
  .auth-surface { min-height: 100dvh; padding: 32px 24px; border-radius: 0; box-shadow: none; }
  .auth-brand { margin-bottom: 56px; }
}
@media (max-width: 480px) {
  .auth-surface { align-items: start; padding: 26px 20px 38px; }
  .auth-brand { margin-bottom: 48px; }
  .auth-heading h1 { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-screen,
  .auth-submit,
  .md-field input,
  .remember-check { transition: none; }
  .auth-submit.is-loading .ui-icon { animation: none; }
}
@media print {
  .auth-screen { display: none !important; }
}
