
/* ============================================================
   EcoCertify — identidade visual
   As variáveis mantêm os nomes usados pela interface original.
   ============================================================ */

:root {
  --bg: #f5f7f2;
  --bg-2: #eef2e9;
  --panel: #ffffff;
  --panel-2: #f7faf3;
  --line: #e2e8dc;
  --text: #262c34;
  --muted: #5b6470;
  --indigo: #61944a;
  --indigo-2: #4c7a38;
  --cyan: #22857a;
  --violet: #62718a;
  --amber: #b3872b;
  --coral: #c96a4a;
  --red: #c25450;
  --shadow: 0 10px 30px rgba(38, 52, 32, 0.08);
  --radius: 18px;
}

/* Base e tipografia. */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: radial-gradient(
      900px 500px at 12% -5%,
      rgba(97, 148, 74, 0.1),
      transparent 55%
    ),
    radial-gradient(
      900px 500px at 95% 0%,
      rgba(98, 113, 138, 0.08),
      transparent 55%
    ),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #c9d3c2;
  border-radius: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* Navegação superior e marca. */

.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topnav-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 0 0 auto;
}

.brand h1 {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
}

.brand h1 .wm-o {
  width: 0.92em;
  height: 0.92em;
  margin: 0 1px;
  flex: 0 0 auto;
  transform: translateY(0.06em);
}

.brand h1 span {
  font-size: inherit;
  font-weight: 800;
}

.brand h1 .wm-green {
  color: #61944a;
}

.brand h1 .wm-dark {
  color: #262c34;
}

.brand span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: 8px;
  flex-wrap: wrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 11px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  transition: 0.15s;
  white-space: nowrap;
  border: 1px solid transparent;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  opacity: 0.8;
}

.nav-item:hover {
  background: var(--panel);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(
    135deg,
    rgba(97, 148, 74, 0.12),
    rgba(98, 113, 138, 0.1)
  );
  color: var(--text);
  border-color: rgba(97, 148, 74, 0.35);
}

.nav-item.active svg {
  opacity: 1;
  color: var(--indigo-2);
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px 13px;
  border-radius: 30px;
  font-size: 12.5px;
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(34, 133, 122, 0.18);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--cyan), var(--indigo));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}

/* Área principal e cabeçalhos das secções. */

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px 70px;
}

.hero {
  margin: 26px 0 22px;
  padding: 26px 30px;
  border-radius: 22px;
  background: linear-gradient(
    120deg,
    rgba(97, 148, 74, 0.1),
    rgba(98, 113, 138, 0.08) 45%,
    rgba(34, 133, 122, 0.08)
  );
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(98, 113, 138, 0.16),
    transparent 70%
  );
}

.hero h2 {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
  max-width: 640px;
  line-height: 1.55;
}

.view {
  display: none;
  animation: fade 0.35s ease;
}

.view.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Grelhas e cartões. */

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

.g4 {
  grid-template-columns: repeat(4, 1fr);
}

.g3 {
  grid-template-columns: repeat(3, 1fr);
}

.g2 {
  grid-template-columns: repeat(2, 1fr);
}

.g-1-2 {
  grid-template-columns: 1fr 2fr;
}

.g-2-1 {
  grid-template-columns: 2fr 1fr;
}

@media (max-width: 1080px) {
  .g4 {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .g2,
  .g-1-2,
  .g-2-1 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 3px;
}

.card .desc {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 16px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-head h3 {
  margin: 0;
}

/* Indicadores principais. */

.kpi {
  display: flex;
  align-items: center;
  gap: 16px;
}

.kpi .ico {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
}

.kpi .ico svg {
  width: 25px;
  height: 25px;
}

.kpi .val {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kpi .lbl {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 1px;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 20px;
}

.trend.down {
  color: var(--cyan);
  background: rgba(34, 133, 122, 0.12);
}

.trend.up {
  color: var(--coral);
  background: rgba(201, 106, 74, 0.12);
}

.ico.i {
  background: rgba(97, 148, 74, 0.12);
  color: var(--indigo-2);
}

.ico.c {
  background: rgba(34, 133, 122, 0.12);
  color: var(--cyan);
}

.ico.v {
  background: rgba(98, 113, 138, 0.12);
  color: var(--violet);
}

.ico.a {
  background: rgba(179, 135, 43, 0.14);
  color: var(--amber);
}

/* Etiquetas e estados. */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.b-indigo {
  background: rgba(97, 148, 74, 0.12);
  color: var(--indigo-2);
}

.b-cyan {
  background: rgba(34, 133, 122, 0.12);
  color: var(--cyan);
}

.b-violet {
  background: rgba(98, 113, 138, 0.12);
  color: var(--violet);
}

.b-amber {
  background: rgba(179, 135, 43, 0.14);
  color: var(--amber);
}

.b-coral {
  background: rgba(201, 106, 74, 0.12);
  color: var(--coral);
}

.b-grey {
  background: #edf1e8;
  color: var(--muted);
}

/* Barras de progresso e legendas dos gráficos. */

.bar {
  height: 9px;
  border-radius: 10px;
  background: #e9efe3;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--indigo), var(--cyan));
}

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

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
}

/* Tabelas. */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(38, 52, 32, 0.03);
}

/* Recomendações de eficiência. */

.rec {
  display: flex;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 12px;
  background: var(--bg-2);
}

.rec:last-child {
  margin-bottom: 0;
}

.rec .ric {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.rec h4 {
  font-size: 14px;
  margin-bottom: 3px;
}

.rec p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.rec .meta {
  display: flex;
  gap: 8px;
  margin-top: 9px;
  flex-wrap: wrap;
}

/* Indicadores ESG. */

.ring-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}

.esg-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.esg-item:last-child {
  border-bottom: none;
}

.esg-item .pc {
  font-size: 13px;
  font-weight: 800;
}

/* Cartões de formação. */

.course {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
}

.course .top {
  height: 96px;
  display: grid;
  place-items: center;
}

.course .top svg {
  width: 38px;
  height: 38px;
}

.course .body {
  padding: 16px;
}

.course h4 {
  font-size: 14.5px;
  margin-bottom: 6px;
}

.course p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.course .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

/* Assistente e mensagens. */

.chat-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 280px);
  min-height: 460px;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  display: flex;
  gap: 12px;
  max-width: 82%;
}

.msg .b {
  padding: 12px 15px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.55;
}

.msg.bot {
  align-self: flex-start;
}

.msg.bot .b {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-top-left-radius: 4px;
}

.msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg.user .b {
  background: linear-gradient(135deg, var(--indigo), var(--indigo-2));
  color: #fff;
  border-top-right-radius: 4px;
  font-weight: 500;
}

.msg .ai {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  flex: 0 0 34px;
  background: linear-gradient(135deg, var(--indigo), var(--indigo-2));
  display: grid;
  place-items: center;
}

.msg .ai svg {
  width: 18px;
  height: 18px;
}

.chat-bar {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.chat-bar input {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 13px 16px;
  border-radius: 13px;
  font-size: 14px;
  outline: none;
}

.chat-bar input:focus {
  border-color: var(--indigo);
}

.chat-bar button {
  background: linear-gradient(135deg, var(--indigo), var(--indigo-2));
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 0 22px;
  border-radius: 13px;
  cursor: pointer;
  font-size: 14px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 20px;
  font-size: 12.5px;
  cursor: pointer;
  transition: 0.15s;
}

.chip:hover {
  border-color: var(--indigo);
  color: var(--text);
}

.typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  margin: 0 1px;
  animation: blink 1.2s infinite;
}

.typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  60%,
  100% {
    opacity: 0.25;
  }

  30% {
    opacity: 1;
  }
}

/* Botões e classes utilitárias. */

.section-title {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 30px 0 14px;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 15px;
  border-radius: 11px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 700;
  transition: 0.15s;
}

.btn:hover {
  border-color: var(--indigo);
}

.btn.primary {
  background: linear-gradient(135deg, var(--indigo), var(--indigo-2));
  color: #fff;
  border: none;
}

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

.between {
  justify-content: space-between;
}

.mt {
  margin-top: 18px;
}

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

input[type="range"] {
  accent-color: var(--indigo);
}

/* Adaptação da navegação e margens a ecrãs intermédios. */

@media (max-width: 820px) {
  .topnav-inner {
    flex-wrap: wrap;
    gap: 12px;
  }

  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .page {
    padding: 0 16px 50px;
  }

  .hero {
    padding: 20px;
  }
}

/* Comportamentos comuns e acessibilidade. */

[hidden] {
  display: none !important;
}

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

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-item:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

button.nav-item {
  background: transparent;
}

/* Ajustes da navegação usados pela interface funcional.
   A ordem destas regras mantém a apresentação original. */

.topnav-inner {
  flex-wrap: wrap;
  gap: 12px;
}

.nav {
  margin-left: auto;
}

.nav-right {
  width: 100%;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* Filtros e campos de formulário. */

.filters {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding: 16px 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--text);
  min-width: 0;
}

.field textarea {
  min-height: 90px;
}

.field.grow {
  flex: 1;
}

.status {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 2px;
  line-height: 1.6;
}

.notice {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 13px;
  line-height: 1.6;
}

.error {
  color: #913b34;
  background: #fff0ed;
  border-color: #e1afa8;
}

/* Ecrã de entrada. */

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  max-width: 460px;
  width: 100%;
  padding: 36px;
}

.login-card h2 {
  margin: 26px 0 8px;
  font-size: 27px;
}

.login-card p {
  line-height: 1.7;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
}

.login-card form {
  display: grid;
  gap: 18px;
}

.login-card .btn {
  justify-content: center;
  padding: 13px;
}

/* Estados vazios, gráficos e unidades dos indicadores. */

.table-wrap {
  overflow: auto;
}

.empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}

.chart {
  min-height: 160px;
}

.hero small {
  display: block;
  color: var(--indigo-2);
  margin-bottom: 9px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.metric-unit {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.metric-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 7px;
}

.val {
  font-variant-numeric: tabular-nums;
}

/* Conteúdo dos módulos de formação. */

.course .body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.course .body .btn {
  margin-top: auto;
  justify-content: center;
}

.course .top {
  font-size: 30px;
  color: var(--indigo-2);
  background: linear-gradient(120deg, #e9f1e1, #e7efec);
}

.course-detail {
  line-height: 1.85;
  font-size: 15px;
  white-space: pre-line;
  margin: 20px 0;
}

.radio-choice {
  display: flex;
  gap: 10px;
  align-items: start;
  padding: 12px;
  background: var(--bg-2);
  border-radius: 10px;
  margin: 8px 0;
}

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

/* Controlos do simulador de medidas de eficiência. */

.scenario-row {
  margin: 17px 0;
}

.scenario-row label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.scenario-row input {
  width: 100%;
  margin-top: 9px;
}

/* Relatórios. */

.report-preview {
  background: white;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  line-height: 1.8;
}

.report-preview h2 {
  margin-bottom: 12px;
}

.report-preview p {
  margin: 14px 0;
}

.report-preview table {
  margin-top: 20px;
}

/* Janelas de detalhe e formulários. */

dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  max-width: 620px;
  width: calc(100% - 32px);
  max-height: 90vh;
  color: var(--text);
  margin: auto;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(25, 39, 28, 0.45);
  backdrop-filter: blur(3px);
}

dialog h2 {
  font-size: 22px;
  margin-bottom: 10px;
}

dialog form {
  display: grid;
  gap: 16px;
}

dialog .actions {
  justify-content: flex-end;
  margin-top: 12px;
}

dialog pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--bg-2);
  padding: 18px;
  border-radius: 12px;
  line-height: 1.9;
}

/* Rodapé e ajustes de conteúdo. */

.footer {
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-top: 32px;
  line-height: 1.7;
}

.badge {
  white-space: normal;
}

.msg .b {
  white-space: pre-wrap;
}

.grid .card {
  min-width: 0;
}

.btn-link {
  text-decoration: none;
}

#reportPreview .grid {
  margin: 20px 0;
}

.ring-wrap {
  flex-wrap: wrap;
}

/* Adaptação a telemóveis. */

@media (max-width: 650px) {
  .g4 {
    grid-template-columns: 1fr;
  }

  .topnav-inner {
    padding: 12px 16px;
  }

  .nav {
    flex-wrap: nowrap;
    width: 100%;
    overflow: auto;
  }

  .nav-item {
    font-size: 12px;
    padding: 8px 10px;
  }

  .nav-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .filters .field {
    flex: 1 1 130px;
  }

  .hero h2 {
    font-size: 23px;
  }

  .ring-wrap {
    justify-content: center;
  }

  .chat-bar {
    flex-wrap: wrap;
  }

  .chat-bar input {
    min-width: 150px;
  }

  .kpi .val {
    font-size: 23px;
  }

  .login-card {
    padding: 25px;
  }

  .msg {
    max-width: 95%;
  }

  .report-preview {
    padding: 16px;
  }
}

/* Impressão dos relatórios. */

@media print {
  body {
    background: white;
  }

  .topnav,
  .filters,
  .status,
  .footer,
  .no-print,
  dialog {
    display: none !important;
  }

  .page {
    padding: 0;
    max-width: none;
  }

  section.view {
    display: none !important;
  }

  #relatorios {
    display: block !important;
  }

  #relatorios > .hero,
  #relatorios > .actions {
    display: none !important;
  }

  .report-preview {
    border: 0;
    padding: 0;
  }

  .card {
    box-shadow: none;
    break-inside: avoid;
  }

  #app {
    display: block !important;
  }
}

/* Detalhe da origem da energia. */

.energy-amounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.energy-amounts div {
  background: var(--bg-2);
  padding: 12px;
  border-radius: 12px;
}

.energy-amounts b,
.energy-amounts span {
  display: block;
  font-size: 13px;
}

.energy-amounts span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
}

/* Documentos de orientação. */

.guidance-btn {
  font-size: 12px;
  padding: 6px 12px;
}

.guidance-document {
  line-height: 1.75;
}

.guidance-document h3 {
  margin: 24px 0 10px;
  font-size: 17px;
}

.guidance-document ul {
  padding-left: 22px;
}

.guidance-document li {
  margin: 10px 0;
}

dialog:has(.guidance-document),
dialog:has(#trainingHistoryChart) {
  max-width: 880px;
}

/* Histórico e progresso dos questionários. */

.history-card {
  cursor: pointer;
  transition:
    transform 0.15s,
    border-color 0.15s;
}

.history-card:hover,
.history-card:focus-visible {
  border-color: var(--indigo);
  transform: translateY(-2px);
  outline: 2px solid var(--indigo);
}

.quiz-progress {
  padding: 16px;
  background: var(--bg-2);
  border-radius: 14px;
  margin: 20px 0;
}

.quiz-progress .bar {
  margin: 12px 0;
}

.quiz-steps {
  display: flex;
  gap: 10px;
}

.quiz-steps span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.quiz-steps .right {
  background: #d8ebcb;
  color: #365d27;
}

.quiz-steps .wrong {
  background: #f5d8ce;
  color: #7e3027;
}

.quiz-question {
  font-size: 19px;
  line-height: 1.6;
}

.quiz-result {
  text-align: center;
  padding: 22px;
  background: var(--bg-2);
  border-radius: 14px;
  margin-bottom: 20px;
}

.quiz-result strong {
  font-size: 44px;
  color: var(--indigo-2);
}

.success {
  background: #edf6e8;
  border-color: #bed7ad;
  color: #315329;
}

dialog details {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

dialog summary {
  cursor: pointer;
  font-weight: 600;
}

dialog details p {
  line-height: 1.7;
  margin-top: 12px;
}

.close-modal {
  font-size: 23px;
  line-height: 1;
}

.quiz-result p {
  margin-top: 8px;
}

/* Impressão de um documento de orientação aberto. */

@media print {
  body[data-print="guidance"] #app,
  body[data-print="guidance"] #login {
    display: none !important;
  }

  body[data-print="guidance"] dialog[open] {
    display: block !important;
    position: static !important;
    max-width: none;
    max-height: none;
    width: 100%;
    overflow: visible;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  body[data-print="guidance"] dialog::backdrop {
    display: none;
  }

  body[data-print="guidance"] .no-print {
    display: none !important;
  }
}

/* Relatórios: separação clara entre geração, exportação e histórico. */
.report-toolbar { display:flex; flex-wrap:wrap; align-items:flex-end; gap:18px; }
.report-toolbar > .field { flex:1 1 230px; }
.report-toolbar .actions, .report-downloads .actions { display:flex; flex-wrap:wrap; gap:10px; }
.report-downloads { display:flex; flex-wrap:wrap; gap:12px 20px; align-items:center; justify-content:space-between; border-top:1px solid var(--line); padding-top:20px; margin-top:22px; }
.report-downloads > span { color:var(--muted); font-size:14px; }
.report-controls #reportMessage { margin:16px 0; min-height:20px; }
.report-list { display:grid; gap:10px; margin-top:16px; }
.report-list-item { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px; border:1px solid var(--line); border-radius:12px; }
.report-list-item strong, .report-list-item span, .report-list-item small { display:block; }
.report-list-item span { margin-top:5px; }
.report-list-item small { margin-top:5px; color:var(--muted); }
.report-pagination { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-top:20px; }
.report-pagination span { color:var(--muted); font-size:13px; }
.report-controls button:disabled { cursor:not-allowed; transform:none; }
.report-preview td { overflow-wrap:anywhere; vertical-align:top; }
@media (max-width:650px) {
  .report-toolbar > .field, .report-toolbar > .actions { flex-basis:100%; }
  .report-list-item { align-items:flex-start; }
}

/* Janela de pré-visualização e impressão exclusiva do documento aberto. */
dialog:has(.report-preview-dialog) { width: min(1100px, 94vw); max-width:1100px; }
.report-preview-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:14px; margin-bottom:20px; }
.report-preview-actions .actions { display:flex; flex-wrap:wrap; gap:10px; }
.report-preview-dialog .report-preview { padding:20px; }
@media print {
  body[data-print="report-preview"] #app,
  body[data-print="report-preview"] #login { display:none !important; }
  body[data-print="report-preview"] dialog[open] {
    display:block !important; position:static !important; width:100%;
    max-width:none; max-height:none; height:auto; overflow:visible;
    margin:0; padding:0; border:0; box-shadow:none;
  }
  body[data-print="report-preview"] dialog::backdrop { display:none; }
  body[data-print="report-preview"] #modalContent,
  body[data-print="report-preview"] .table-wrap { overflow:visible !important; max-height:none; }
  body[data-print="report-preview"] .report-preview { padding:0; }
  body[data-print="report-preview"] thead { display:table-header-group; }
  body[data-print="report-preview"] tr { break-inside:avoid; }
}

/* Simulação: espaçamento dos campos e comparação independente. */
#serviceScenario > .field { display:flex; gap:8px; margin:18px 0; }
#serviceScenario select, #serviceScenario > .field input {
  display:block; width:100%; min-height:44px; box-sizing:border-box;
  padding:10px 12px; border:1px solid var(--line); border-radius:9px; background:white;
}
#serviceFields { margin-top:22px; }
#serviceFields input { width:100%; min-height:40px; padding:8px; box-sizing:border-box; border:1px solid var(--line); border-radius:8px; }
#serviceScenario > .actions { margin-top:20px; }
#serviceResult[hidden] { display:none !important; }
.scenario-comparison-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; }
.scenario-snapshot { margin-top:18px; padding:16px; border:1px solid var(--line); border-radius:14px; }
.scenario-snapshot > p { margin:12px 0; }
.scenario-snapshot table { width:100%; }
.scenario-snapshot td, .scenario-snapshot th { overflow-wrap:anywhere; }
.scenario-comparison-table { margin:18px 0; overflow-x:auto; }
.scenario-comparison-table th:not(:first-child) { min-width:140px; }
#scenarioComparisonPanel { min-width:0; }

/* Formulários independentes empilhados apenas na coluna direita. */
.scenario-draft { margin-top:22px; padding:20px 0; border-top:1px solid var(--line); }
.scenario-draft .field { display:flex; gap:8px; margin:18px 0; }
.scenario-draft input, .scenario-draft select { box-sizing:border-box; width:100%; min-height:42px; padding:9px 10px; border:1px solid var(--line); border-radius:8px; background:white; }
.scenario-draft td input { min-width:80px; }
.scenario-analysis-controls .actions { display:flex; gap:12px; flex-wrap:wrap; margin-top:16px; }
.scenario-analysis-controls .field { display:flex; gap:8px; }
#scenarioAnalysis .notice p { margin:12px 0; }
