/* =========================================================
   apps.css — estilos compartilhados dos aplicativos
   Dr. Álvaro Menezes · alvaro-menezes.com/apps
   Depende dos tokens definidos em ../../style.css (:root)
   ========================================================= */

:root {
  --amber-700: #b45309;
  --amber-600: #d97706;
  --amber-100: #fde9c8;
  --amber-50:  #fffaf0;

  --orange-700: #c2410c;
  --orange-50:  #fff5ef;

  --app-max: 720px;
}

/* O atributo hidden precisa vencer os display: grid/flex declarados
   abaixo — sem isto, um bloco .grid-2 escondido continua visível. */
[hidden] { display: none !important; }

body.app-body {
  background: var(--bg-alt);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===========================
   Barra superior do app
=========================== */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--neutral-200);
}
.app-bar-inner {
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  padding: 8px 12px 8px 8px;
  border-radius: 999px;
  transition: background var(--transition);
  white-space: nowrap;
}
.app-back:hover { background: var(--blue-50); }
.app-back svg { width: 16px; height: 16px; flex-shrink: 0; }
.app-back span { display: inline; }

.app-bar-spacer { flex: 1; }

.app-lang {
  display: inline-flex;
  border: 1px solid var(--neutral-200);
  background: var(--white);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.app-lang button {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.app-lang button.active {
  background: var(--accent);
  color: var(--on-accent);
}

/* ===========================
   Cabeçalho do app
=========================== */
.app-main {
  flex: 1;
  max-width: var(--app-max);
  width: 100%;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}
.app-header-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}
.app-header-icon img { width: 100%; height: 100%; display: block; }
.app-header-text h1 {
  font-family: var(--font-serif);
  font-size: clamp(23px, 6vw, 30px);
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 4px;
}
.app-header-text p {
  font-size: 13.5px;
  color: var(--ink-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ===========================
   Cartões
=========================== */
.app-card {
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 18px;
}
.app-card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

/* ===========================
   Formulário
=========================== */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}
.field-label .optional {
  font-weight: 500;
  color: var(--ink-muted);
  font-size: 12.5px;
}

/* Linha do rótulo com a etiqueta de modo (adulto / pediátrico) */
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.field-label-row .field-label { margin-bottom: 0; }

.mode-badge {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--blue-50);
  color: var(--accent-dark);
  border: 1px solid var(--blue-100);
  white-space: nowrap;
}
.mode-badge.is-ped {
  background: var(--green-50);
  color: var(--green-700);
  border-color: var(--green-100);
}

/* Aviso dentro do cartão de resultado (ex.: menores de 2 anos) */
.result-warn {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--blue-100);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  text-align: left;
}

/* Controle segmentado (sexo, unidade) */
.segmented {
  position: relative;
  display: flex;
  background: var(--neutral-100);
  border: 1px solid var(--neutral-200);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
/* O rádio fica invisível mas permanece no fluxo do controle (foco por teclado
   continua funcionando); sem 'position: relative' acima ele escaparia do cartão. */
.segmented input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}
.segmented label {
  flex: 1;
  text-align: center;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 10px 8px;
  border-radius: 9px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  user-select: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.segmented input:checked + label {
  background: var(--white);
  color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}
.segmented input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Campo numérico com sufixo */
.input-row { display: flex; gap: 10px; align-items: stretch; }
.input-wrap { position: relative; flex: 1; }
.input-wrap input {
  width: 100%;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: 12px;
  padding: 13px 60px 13px 14px;
  min-height: 48px;
  transition: border-color var(--transition), box-shadow var(--transition);
  -moz-appearance: textfield;
}
.input-wrap input::-webkit-outer-spin-button,
.input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-wrap input:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--blue-50);
}
.input-wrap input.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}
.input-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  pointer-events: none;
}
.unit-toggle { flex-shrink: 0; width: 168px; }
.unit-toggle .segmented label { font-size: 13px; padding: 8px 4px; }

.field-hint {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 7px;
  line-height: 1.5;
}
.field-hint.error { color: var(--red); font-weight: 600; }

.optional-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.optional-divider::before,
.optional-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--neutral-200);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn-clear {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--neutral-200);
  border-radius: 999px;
  padding: 9px 16px;
  margin-top: 20px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.btn-clear:hover { color: var(--ink); border-color: var(--neutral-400); background: var(--neutral-50); }
.btn-clear svg { width: 14px; height: 14px; }

/* ===========================
   Resultado principal
=========================== */
.result-card {
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  margin-bottom: 18px;
  text-align: center;
  border: 1px solid var(--blue-100);
  background: linear-gradient(160deg, var(--blue-50), var(--white) 70%);
  box-shadow: var(--shadow-sm);
}
.result-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.result-value {
  font-family: var(--font-serif);
  font-size: clamp(52px, 16vw, 72px);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.result-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 8px;
}
.result-stage {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.result-stage .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.tone-green  { color: var(--green-700); background: var(--green-50);  border-color: var(--green-100); }
.tone-amber  { color: var(--amber-700); background: var(--amber-50);  border-color: var(--amber-100); }
.tone-orange { color: var(--orange-700); background: var(--orange-50); border-color: #fcd9c4; }
.tone-red    { color: var(--red);       background: var(--red-soft);  border-color: #f8d4d4; }

/* ===========================
   Cartão de conduta (contraste)
=========================== */
.advice-card {
  border-radius: var(--radius-lg);
  border: 1px solid;
  padding: 22px;
  margin-bottom: 18px;
}
.advice-card.tone-green  { background: var(--green-50);  border-color: var(--green-100); }
.advice-card.tone-amber  { background: var(--amber-50);  border-color: var(--amber-100); }
.advice-card.tone-orange { background: var(--orange-50); border-color: #fcd9c4; }
.advice-card.tone-red    { background: var(--red-soft);  border-color: #f8d4d4; }

.advice-head {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 14px;
}
.advice-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.advice-icon svg { width: 19px; height: 19px; }
.advice-head > span { min-width: 0; }
.advice-title {
  display: block;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}
.advice-kicker {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.advice-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.advice-list li {
  position: relative;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.advice-list li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}
.advice-list li strong { color: var(--ink); font-weight: 650; }
.advice-source {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.55;
}

/* ===========================
   Resultados secundários
=========================== */
.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.mini-card {
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius);
  padding: 17px 18px;
  box-shadow: var(--shadow-sm);
}
.mini-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 7px;
}
.mini-value {
  font-size: 27px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.mini-value span { font-size: 13px; font-weight: 600; color: var(--ink-muted); margin-left: 4px; }
.mini-note { font-size: 12px; color: var(--ink-muted); margin-top: 8px; line-height: 1.5; }

/* ===========================
   Estado vazio
=========================== */
.empty-state {
  text-align: center;
  padding: 34px 20px;
  border: 1px dashed var(--neutral-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  margin-bottom: 18px;
}
.empty-state svg { width: 32px; height: 32px; color: var(--blue-300); margin-bottom: 12px; }
.empty-state p { font-size: 14px; color: var(--ink-muted); line-height: 1.6; }
.empty-title { font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.empty-body { max-width: 46ch; margin: 0 auto; }

/* ===========================
   Notas / referências (accordion)
=========================== */
.app-details {
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.app-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 18px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background var(--transition);
  min-height: 48px;
}
.app-details > summary::-webkit-details-marker { display: none; }
.app-details > summary:hover { background: var(--neutral-50); }
.app-details > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-muted);
  border-bottom: 2px solid var(--ink-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--transition);
  flex-shrink: 0;
}
.app-details[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.app-details-body {
  padding: 4px 18px 18px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.app-details-body p { margin-bottom: 11px; }
.app-details-body p:last-child { margin-bottom: 0; }
.app-details-body strong { color: var(--ink); font-weight: 650; }
.app-details-body a { color: var(--accent); font-weight: 600; }
.app-details-body a:hover { text-decoration: underline; }
.app-details-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--neutral-100);
  border: 1px solid var(--neutral-200);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--ink);
  white-space: nowrap;
}

/* Tabela de estágios */
.stage-table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 13px; }
.stage-table th, .stage-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--neutral-200);
}
.stage-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); font-weight: 700; }
.stage-table td:first-child { font-weight: 700; color: var(--ink); white-space: nowrap; }
.stage-table tr:last-child td { border-bottom: 0; }
.stage-table tr.is-current td { background: var(--blue-50); }

/* ===========================
   Rodapé do app
=========================== */
.app-footer {
  max-width: var(--app-max);
  width: 100%;
  margin: 0 auto;
  padding: 8px 16px 40px;
  text-align: center;
}
.store-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--neutral-200);
  background: var(--white);
  color: var(--ink-muted);
  cursor: default;
  opacity: 0.75;
  min-width: 168px;
  text-align: left;
}
.store-badge svg { width: 22px; height: 22px; flex-shrink: 0; }
.store-badge-text { display: flex; flex-direction: column; line-height: 1.25; }
.store-badge-text .small { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700; }
.store-badge-text .big { font-size: 14px; font-weight: 700; color: var(--ink-soft); }

.app-disclaimer {
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-muted);
  max-width: 560px;
  margin: 0 auto 16px;
}
.app-copyright { font-size: 12px; color: var(--ink-muted); }
.app-copyright a { color: var(--accent); font-weight: 600; }

/* ===========================
   Responsivo
=========================== */
@media (max-width: 560px) {
  .app-main { padding: 22px 14px 32px; }
  .app-card { padding: 18px; border-radius: 16px; }
  .app-header { gap: 13px; margin-bottom: 22px; }
  .app-header-icon { width: 54px; height: 54px; border-radius: 14px; }
  .input-row { flex-direction: column; gap: 8px; }
  .unit-toggle { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; gap: 16px; }
  .result-card { padding: 22px 18px; }
  .advice-card { padding: 18px; }
  .app-back span { display: none; }
  .app-back { padding: 8px; }
  .store-badge { min-width: 0; flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* =========================================================
   Blocos de seleção de achados (usado pelo TI-RADS e afins)
   ========================================================= */
.opt-group { margin-bottom: 24px; }
.opt-group:last-child { margin-bottom: 0; }

.opt-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.opt-group-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.opt-group-rule {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--neutral-100);
  border: 1px solid var(--neutral-200);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.opt-group-rule.is-multi { color: var(--accent-dark); background: var(--blue-50); border-color: var(--blue-100); }

.opt-list { display: flex; flex-direction: column; gap: 8px; }

.opt {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--neutral-200);
  border-radius: 12px;
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  min-height: 48px;
}
.opt:hover { border-color: var(--blue-300); background: var(--neutral-50); }
.opt input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; pointer-events: none; }
.opt input:focus-visible ~ .opt-mark { outline: 2px solid var(--accent); outline-offset: 2px; }

.opt-mark {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  margin-top: 1px;
  border: 2px solid var(--neutral-400);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), background var(--transition);
}
.opt-mark--radio { border-radius: 50%; }
.opt-mark--check { border-radius: 6px; }
.opt-mark svg { width: 11px; height: 11px; color: var(--on-accent); opacity: 0; transition: opacity var(--transition); }
.opt-mark::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--white);
  opacity: 0;
  transition: opacity var(--transition);
}
.opt-mark--check::after { display: none; }

/* Esquema do descritor, à esquerda do texto. É decorativo: quem usa
   leitor de tela recebe o nome e a descrição, que dizem a mesma coisa. */
.opt-fig {
  width: 58px;
  height: 43px;
  flex-shrink: 0;
  display: block;
  border-radius: 5px;
  margin-top: 1px;
}

.opt-body { flex: 1; min-width: 0; }
/* São <span> por estarem dentro de um <label>: precisam de display:block
   explícito, senão nome e descrição saem colados na mesma linha. */
.opt-name { display: block; font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.opt-desc { display: block; font-size: 12.5px; color: var(--ink-muted); line-height: 1.5; margin-top: 3px; }

.opt-pts {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  background: var(--neutral-100);
  border: 1px solid var(--neutral-200);
  border-radius: 8px;
  padding: 3px 9px;
  margin-top: 1px;
  white-space: nowrap;
}

.opt.is-on { border-color: var(--accent); background: var(--blue-50); box-shadow: 0 0 0 1px var(--accent); }
.opt.is-on .opt-mark { border-color: var(--accent); background: var(--accent); }
.opt.is-on .opt-mark::after,
.opt.is-on .opt-mark svg { opacity: 1; }
.opt.is-on .opt-pts { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.opt.is-dim { opacity: 0.45; }

/* Aviso dentro do cartão do formulário */
.inline-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  color: var(--ink-soft);
}
.inline-note.is-warn { background: var(--amber-50); border-color: var(--amber-100); }
.inline-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.inline-note.is-warn svg { color: var(--amber-700); }

/* =========================================================
   Abas de nódulos
   ========================================================= */
.nodule-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.nodule-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  min-height: 42px;
}
.nodule-tab:hover { border-color: var(--blue-300); }
.nodule-tab.is-active { border-color: var(--accent); background: var(--blue-50); color: var(--accent-dark); box-shadow: 0 0 0 1px var(--accent); }
.nodule-tab .tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--neutral-100);
  color: var(--ink-muted);
}
.nodule-tab.is-active .tag { background: var(--white); }
.nodule-tab .tag.tr-1, .nodule-tab .tag.tr-2 { background: var(--green-50); color: var(--green-700); }
.nodule-tab .tag.tr-3 { background: var(--amber-50); color: var(--amber-700); }
.nodule-tab .tag.tr-4 { background: var(--orange-50); color: var(--orange-700); }
.nodule-tab .tag.tr-5 { background: var(--red-soft); color: var(--red); }
.nodule-tab .x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  color: var(--ink-muted);
  transition: background var(--transition), color var(--transition);
}
.nodule-tab .x:hover { background: var(--red-soft); color: var(--red); }
.nodule-tab .x svg { width: 10px; height: 10px; }

.nodule-add {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px dashed var(--blue-300);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  min-height: 42px;
  transition: background var(--transition);
}
.nodule-add:hover { background: var(--blue-50); }

/* =========================================================
   Resultado TI-RADS
   ========================================================= */
.tr-card {
  border-radius: var(--radius-lg);
  border: 1px solid;
  padding: 24px 22px;
  margin-bottom: 18px;
  text-align: center;
}
/* Categoria 0 (exame inadequado / avaliação incompleta): sem cor de risco,
   porque não há risco estratificado — só ausência de informação. */
.tr-card.tr-0 { background: var(--neutral-50); border-color: var(--neutral-200); }
.tr-card.tr-1, .tr-card.tr-2 { background: var(--green-50); border-color: var(--green-100); }
.tr-card.tr-3 { background: var(--amber-50); border-color: var(--amber-100); }
.tr-card.tr-4 { background: var(--orange-50); border-color: #fcd9c4; }
.tr-card.tr-5 { background: var(--red-soft); border-color: #f8d4d4; }

.tr-points { font-size: 12px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 12px; }
.tr-points strong { color: var(--ink); font-size: 15px; }
.tr-level {
  font-family: var(--font-serif);
  font-size: clamp(44px, 13vw, 60px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
}
/* Quando o rótulo da categoria é textual ("O-RADS 3") e não um número
   isolado ("TR3"), o tamanho do TI-RADS estoura a largura no celular. */
.tr-card.is-wide .tr-level { font-size: clamp(29px, 8vw, 44px); }
.tr-card.tr-0 .tr-level { color: var(--ink-muted); }
.tr-card.tr-1 .tr-level, .tr-card.tr-2 .tr-level { color: var(--green-700); }
.tr-card.tr-3 .tr-level { color: var(--amber-700); }
.tr-card.tr-4 .tr-level { color: var(--orange-700); }
.tr-card.tr-5 .tr-level { color: var(--red); }
.tr-name { font-size: 16px; font-weight: 700; color: var(--ink); margin-top: 8px; }
.tr-risk { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }

.rec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.rec-card {
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius);
  padding: 17px 18px;
  box-shadow: var(--shadow-sm);
}
.rec-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 8px; }
.rec-value { font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.rec-value.is-yes { color: var(--red); }
.rec-value.is-no { color: var(--green-700); }
.rec-note { font-size: 12.5px; color: var(--ink-muted); margin-top: 7px; line-height: 1.55; }

/* Resumo de múltiplos nódulos */
.summary-list { list-style: none; display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.summary-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 13.5px;
  color: var(--ink-soft);
  padding: 10px 12px;
  border: 1px solid var(--neutral-200);
  border-radius: 10px;
  background: var(--white);
}
.summary-list .rank {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--neutral-100);
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.summary-list .grow { flex: 1; min-width: 0; }
.summary-list .act { font-size: 12px; font-weight: 700; white-space: nowrap; }
.summary-list .act.fna { color: var(--red); }
.summary-list .act.fu { color: var(--amber-700); }
.summary-list .act.none { color: var(--ink-muted); }

/* =========================================================
   Gerador de laudo
   ========================================================= */
.report-box {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: 12px;
  padding: 14px;
  min-height: 190px;
  resize: vertical;
}
.report-box:focus { outline: none; border-color: var(--accent-light); box-shadow: 0 0 0 3px var(--blue-50); }
.report-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-app {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  min-height: 44px;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn-app svg { width: 15px; height: 15px; }
.btn-app--primary { background: var(--accent); color: var(--on-accent); }
.btn-app--primary:hover { background: var(--accent-dark); }
.btn-app--ghost { background: var(--white); color: var(--ink-soft); border-color: var(--neutral-200); }
.btn-app--ghost:hover { border-color: var(--neutral-400); background: var(--neutral-50); }
.btn-app--ok { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }

@media (max-width: 560px) {
  .rec-grid { grid-template-columns: 1fr; }
  .opt { padding: 11px 12px; gap: 10px; }
  .opt-pts { font-size: 11.5px; padding: 2px 7px; }
  .opt-fig { width: 48px; height: 36px; }
  .report-actions .btn-app { flex: 1; justify-content: center; }
}

/* Select estilizado */
.select-wrap { position: relative; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: 12px;
  padding: 13px 38px 13px 14px;
  min-height: 48px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.select-wrap select:focus { outline: none; border-color: var(--accent-light); box-shadow: 0 0 0 3px var(--blue-50); }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 16px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--ink-muted);
  border-bottom: 2px solid var(--ink-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* =========================================================
   Tabela de ecos (relaxometria)
   ========================================================= */
.echo-table { width: 100%; border-collapse: collapse; }
.echo-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: left;
  padding: 0 8px 8px;
}
.echo-table th:first-child { padding-left: 0; width: 34px; }
.echo-table th:last-child { text-align: center; width: 54px; padding-right: 0; }
.echo-table td { padding: 3px 8px; vertical-align: middle; }
.echo-table td:first-child { padding-left: 0; }
.echo-table td:last-child { padding-right: 0; text-align: center; }

.echo-n {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--neutral-100);
  display: flex; align-items: center; justify-content: center;
}
.echo-row.is-off .echo-n { background: var(--red-soft); color: var(--red); }
.echo-row.is-off input { opacity: 0.5; text-decoration: line-through; }

.echo-table input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: 9px;
  padding: 9px 11px;
  min-height: 42px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.echo-table input:focus { outline: none; border-color: var(--accent-light); box-shadow: 0 0 0 3px var(--blue-50); }

.echo-toggle {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 2px solid var(--neutral-400);
  background: var(--white);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  padding: 0;
}
.echo-toggle svg { width: 13px; height: 13px; color: var(--on-accent); opacity: 0; }
.echo-row.is-on .echo-toggle { background: var(--accent); border-color: var(--accent); }
.echo-row.is-on .echo-toggle svg { opacity: 1; }

.echo-fill {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px dashed var(--blue-300);
  border-radius: 12px;
  background: var(--blue-50);
  margin-bottom: 18px;
}
.echo-fill .f { flex: 1; min-width: 110px; }
.echo-fill label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-dark); margin-bottom: 6px; }
.echo-fill input {
  width: 100%;
  font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink);
  background: var(--white); border: 1px solid var(--blue-100);
  border-radius: 9px; padding: 9px 11px; min-height: 42px;
}
.echo-fill input:focus { outline: none; border-color: var(--accent-light); box-shadow: 0 0 0 3px var(--white); }
.echo-fill button {
  flex-shrink: 0;
  font-family: inherit; font-size: 13.5px; font-weight: 650;
  color: var(--on-accent); background: var(--accent);
  border: 0; border-radius: 9px; padding: 0 16px; min-height: 42px; cursor: pointer;
  transition: background var(--transition);
}
.echo-fill button:hover { background: var(--accent-dark); }

/* =========================================================
   Gráfico do decaimento
   ========================================================= */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: var(--neutral-200); stroke-width: 1; }
.chart-axis line { stroke: var(--neutral-400); stroke-width: 1; }
.chart-axis text { font-size: 10.5px; fill: var(--ink-muted); font-family: var(--font-sans); }
.chart-label { font-size: 11px; fill: var(--ink-muted); font-family: var(--font-sans); font-weight: 600; }
.chart-fit { stroke: var(--accent); stroke-width: 2; fill: none; }
.chart-pt { cursor: pointer; }
.chart-pt circle { stroke-width: 2; transition: r var(--transition); }
.chart-pt.on circle { fill: var(--accent); stroke: var(--white); }
.chart-pt.off circle { fill: var(--white); stroke: var(--ink-muted); stroke-dasharray: 2.5 2; }
.chart-pt:hover circle { r: 7; }
.chart-hit { fill: transparent; }
.chart-caption {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 12px; font-size: 12.5px; color: var(--ink-muted);
}
.chart-caption b { color: var(--ink); font-weight: 700; }
.chart-hint { font-size: 12.5px; color: var(--ink-muted); margin-top: 10px; line-height: 1.55; }

@media (max-width: 560px) {
  .echo-table input { font-size: 14px; padding: 8px 9px; min-height: 40px; }
  .echo-table td { padding: 3px 5px; }
  .echo-table th { padding: 0 5px 8px; }
  .echo-fill button { width: 100%; }
}


/* ===========================
   Botão de tema, na barra do app
=========================== */
.app-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 32px;
  flex-shrink: 0;
  border: 1px solid var(--neutral-200);
  background: var(--white);
  color: var(--ink-muted);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition), border-color var(--transition);
}
.app-theme:hover { color: var(--accent); border-color: var(--blue-300); }
.app-theme svg { width: 15px; height: 15px; }
.app-theme .icon-sun { display: none; }
:root[data-theme="dark"] .app-theme .icon-sun { display: block; }
:root[data-theme="dark"] .app-theme .icon-moon { display: none; }

/* ===========================
   Tema escuro — tokens próprios dos aplicativos
   Os demais vêm de ../../style.css.
=========================== */
:root[data-theme="dark"] {
  --amber-700: #f0b556;
  --amber-600: #e0a040;
  --amber-100: #4a3a18;
  --amber-50:  #2a2211;

  --orange-700: #ff9e63;
  --orange-50:  #332014;
}

/* Os esquemas das opções já são desenhados em janela de pulmão ou em
   escala de cinza: no tema escuro basta tirar o excesso de brilho. */
:root[data-theme="dark"] .opt-fig { filter: brightness(0.92); }
