/* Guia de Toxicidade — Código Onco
   Identidade visual padrão Código Onco (slate/sky, Inter, JetBrains Mono, suporte dark/light mode com contraste AA) */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273548;
  --line: #3b4a60;
  --line-soft: #2c3a4f;
  --text: #f1f5f9;
  --muted: #cbd5e1;
  --faint: #94a3b8;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --fav: #facc15;
  --on-accent: #0f172a;

  /* Cores semânticas */
  --c-imuno: #38bdf8;
  --c-imuno-bg: rgba(56, 189, 248, 0.14);
  --c-adc: #c084fc;
  --c-adc-bg: rgba(192, 132, 252, 0.14);
  --c-g1: #34d399;
  --c-g1-bg: rgba(52, 211, 153, 0.14);
  --c-g2: #fbbf24;
  --c-g2-bg: rgba(251, 191, 36, 0.14);
  --c-g3: #f87171;
  --c-g3-bg: rgba(248, 113, 113, 0.16);
  --c-alert: #fca5a5;
  --c-alert-bg: rgba(239, 68, 68, 0.16);

  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 12px;
  --shadow: 0 1px 3px rgba(2, 6, 23, 0.4);
  color-scheme: dark;
}

:root[data-mode="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --line: #cbd5e1;
  --line-soft: #e2e8f0;
  --text: #0f172a;
  --muted: #334155;
  --faint: #64748b;
  --accent: #0284c7;
  --accent-soft: rgba(2, 132, 199, 0.10);
  --on-accent: #ffffff;

  --c-imuno: #0284c7;
  --c-imuno-bg: #e0f2fe;
  --c-adc: #7e22ce;
  --c-adc-bg: #f3e8ff;
  --c-g1: #047857;
  --c-g1-bg: #ecfdf5;
  --c-g2: #b45309;
  --c-g2-bg: #fef3c7;
  --c-g3: #b91c1c;
  --c-g3-bg: #fef2f2;
  --c-alert: #991b1b;
  --c-alert-bg: #fef2f2;

  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; }
@media (min-width: 980px) { html { font-size: 17px; } }

body {
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; text-wrap: balance; }
.mono { font-family: var(--f-mono); }

/* Topo / Header */
.top {
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 40;
}
.top-in {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brandrow { display: flex; align-items: center; gap: 12px; min-width: 0; }
.homelink { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo-box {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #0369a1;
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(3, 105, 161, 0.3);
}
.brandmeta { min-width: 0; }
.brandmeta .title { font-size: 1.05rem; font-weight: 700; line-height: 1.2; display: flex; align-items: center; gap: 6px; }
.brandmeta .subt { font-size: 0.78rem; color: var(--faint); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.iconbtn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.iconbtn:hover { border-color: var(--accent); color: var(--accent); }

/* Main layout */
.main-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

/* Hero Section */
.hero {
  margin-bottom: 24px;
}
.hero h1 {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 820px;
  margin: 0 0 16px;
  line-height: 1.5;
}

/* Abas de Navegação (Sem corte à direita!) */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--line-soft);
  padding-bottom: 10px;
}
.tab-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.tab-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

/* Barra de Busca */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 20px;
  transition: border-color 0.15s ease;
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-input {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.98rem;
  width: 100%;
  outline: none;
}
.search-input::placeholder { color: var(--faint); }

/* Filtros por tags */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.chip-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip-btn:hover { border-color: var(--accent); color: var(--text); }
.chip-btn.active {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

/* Painéis de Calculadora e Cards */
.calc-panel, .result-card, .guide-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.panel-header {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.panel-header h2 {
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-header p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 4px 0 0;
}

/* Grid Layout 2 Colunas */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 900px) {
  .calc-layout {
    grid-template-columns: 1fr 1fr;
  }
}

/* Formulários */
.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
}

.weight-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.weight-btn {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.weight-btn:hover { border-color: var(--accent); color: var(--text); }

/* QUADRO DE ESPECIFICAÇÕES VERTICALIZADO (REQUISITO ESTRITO DO GABRIEL) */
.spec-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.spec-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
}
.spec-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 10px;
}
.spec-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.spec-label {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.spec-val {
  font-size: 0.98rem;
  color: var(--text);
  line-height: 1.45;
  margin: 0;
}
.spec-val.highlight {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
}

/* Badges */
.badge {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-imuno { background: var(--c-imuno-bg); color: var(--c-imuno); border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-adc { background: var(--c-adc-bg); color: var(--c-adc); border: 1px solid rgba(192, 132, 252, 0.3); }
.badge-g1 { background: var(--c-g1-bg); color: var(--c-g1); }
.badge-g2 { background: var(--c-g2-bg); color: var(--c-g2); }
.badge-g3 { background: var(--c-g3-bg); color: var(--c-g3); }

/* Tabela de Cronograma Semanal de Desmame */
.tapering-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 10px;
}
.tapering-table th {
  background: var(--surface);
  color: var(--faint);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
}
.tapering-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
}
.tapering-table tr:last-child td { border-bottom: none; }

/* Alertas Clínicos */
.alert-box {
  background: var(--c-alert-bg);
  border-left: 4px solid #ef4444;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 14px 0;
}
.alert-box strong { color: #f87171; }
:root[data-mode="light"] .alert-box strong { color: #b91c1c; }

.warn-box {
  background: rgba(245, 158, 11, 0.12);
  border-left: 4px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 14px 0;
}
.warn-box strong { color: #fbbf24; }
:root[data-mode="light"] .warn-box strong { color: #b45309; }

.info-box {
  background: rgba(56, 189, 248, 0.12);
  border-left: 4px solid #0284c7;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 14px 0;
}
.info-box strong { color: #38bdf8; }
:root[data-mode="light"] .info-box strong { color: #0284c7; }

/* Grid de Cards de Toxicidade */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 840px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  }
}
.tox-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.tox-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.tox-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.tox-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.tox-sub {
  font-size: 0.82rem;
  color: var(--faint);
  margin-top: 2px;
}

/* LISTAS NUMERADAS COM CONTADORES NATIVOS (SEM NÚMEROS DUPLICADOS) */
.step-list {
  counter-reset: step-cnt;
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step-list li {
  counter-increment: step-cnt;
  position: relative;
  padding-left: 36px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}
.step-list li::before {
  content: counter(step-cnt);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.76rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Prescrições com botão de copiar */
.presc-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.presc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.presc-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
}
.copy-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.copy-btn.copied {
  background: #047857;
  border-color: #047857;
  color: #ffffff;
}
.presc-text {
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 12px;
  font-family: var(--f-mono);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  margin: 0;
}

/* Rodapé */
.foot {
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 32px 16px;
  color: var(--faint);
  font-size: 0.84rem;
  text-align: center;
}

/* ===== Padrão v2: busca por voz, favoritos, recentes, copiar/compartilhar, toast ===== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.brandmeta h1.title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.brandmeta .title { font-size: 1.1rem; }
.search-actions { display: flex; align-items: center; gap: 4px; }
.mic-btn, .clear-btn { width: 44px; height: 44px; border: 0; background: transparent; color: var(--faint); border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.mic-btn:hover, .clear-btn:hover { color: var(--accent); background: var(--accent-soft); }
.mic-btn.listening { color: #f43f5e; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.search-meta { font-size: .85rem; color: var(--faint); margin: 0 0 14px; }
.tab-btn, .chip-btn, .copy-btn, .weight-btn, .act-btn { min-height: 44px; }
.chip-btn { padding: 0 14px; }

.recentes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.recentes[hidden] { display: none; }
.rec-tit { font-size: .8rem; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.rec-chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .9rem; text-decoration: none; }
.rec-chip:hover { border-color: var(--accent); }

.card-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.act-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 10px; font-size: .86rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.act-btn:hover { color: var(--text); border-color: var(--faint); }
.act-btn svg { width: 17px; height: 17px; }
.fav-btn.on { color: var(--fav); border-color: var(--fav); }
.fav-btn.on svg { fill: var(--fav); }

.fonte-linha { font-size: .8rem; color: var(--faint); margin-top: 10px; line-height: 1.5; }
.fonte-linha a { color: var(--accent); }
.outras { font-size: .86rem; color: var(--muted); margin-top: 8px; }

/* busca e favoritos mostram os três catálogos juntos */
body.mostra-tudo #viewIraes, body.mostra-tudo #viewAdcs, body.mostra-tudo #viewSegundaLinha { display: block !important; }
body.mostra-tudo #viewCalc, body.mostra-tudo #viewPresc { display: none !important; }
body.mostra-tudo .tab-btn.active { background: var(--surface); border-color: var(--line); color: var(--muted); font-weight: 600; }
body.mostra-tudo .intro-aba { display: none; }

.calc-erro { color: var(--c-g3); font-weight: 600; }
.dose-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.dose-opts label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 600; }
.dose-opts input:checked + span { color: var(--accent); }
.dose-opts label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 100; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.foot a { color: var(--accent); }
