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

:root {
  --verde: #2d7a3a;
  --verde-claro: #e8f5ea;
  --verde-medio: #4caf50;
  --vermelho: #c0392b;
  --amarelo: #e67e22;
  --cinza: #6b7280;
  --cinza-claro: #f3f4f6;
  --borda: #d1d5db;
  --texto: #1a1a1a;
  --radius: 10px;
  --sombra: 0 1px 4px rgba(0,0,0,0.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f4f1;
  color: var(--texto);
  font-size: 16px;
  min-height: 100vh;
}

.app-header {
  background: var(--verde);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.app-header .back-link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 1.3rem;
  line-height: 1;
}

main {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--sombra);
  padding: 16px;
}

.card-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--verde);
  margin-bottom: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

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

.field label {
  font-size: 0.82rem;
  color: var(--cinza);
  font-weight: 500;
}

.field input[type="number"] {
  border: 1.5px solid var(--borda);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}

.field input[type="number"]::-webkit-inner-spin-button,
.field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

.field input[type="number"]:focus { border-color: var(--verde); }

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

.calc-item {
  background: var(--verde-claro);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.calc-item .value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--verde);
}

.calc-item .label {
  font-size: 0.72rem;
  color: var(--cinza);
  margin-top: 2px;
}

.medicao-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.medicao-row .field { flex: 1; margin-bottom: 0; }

.btn {
  padding: 11px 18px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn:active { opacity: 0.8; }

.btn-primary {
  background: var(--verde);
  color: #fff;
}

.btn-danger {
  background: none;
  color: var(--vermelho);
  padding: 4px 6px;
  font-size: 1.1rem;
  border-radius: 6px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat-item {
  text-align: center;
  padding: 10px 6px;
  background: var(--cinza-claro);
  border-radius: 8px;
}

.stat-item .value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--texto);
}

.stat-item .label {
  font-size: 0.7rem;
  color: var(--cinza);
  margin-top: 2px;
}

.pct-bar-group { display: flex; flex-direction: column; gap: 8px; }

.pct-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.pct-row .pct-label { width: 72px; color: var(--cinza); font-weight: 500; }

.pct-row .pct-track {
  flex: 1;
  height: 8px;
  background: var(--borda);
  border-radius: 99px;
  overflow: hidden;
}

.pct-row .pct-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

.pct-row .pct-num { width: 38px; text-align: right; font-weight: 600; }

.fill-aceitavel { background: var(--verde-medio); }
.fill-dupla     { background: var(--amarelo); }
.fill-falha     { background: var(--vermelho); }

.color-aceitavel { color: var(--verde-medio); }
.color-dupla     { color: var(--amarelo); }
.color-falha     { color: var(--vermelho); }

.lista-medicoes { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }

.medicao-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--cinza-claro);
  font-size: 0.9rem;
}

.medicao-item .med-info { display: flex; align-items: center; gap: 8px; }
.medicao-item .med-num  { color: var(--cinza); font-size: 0.78rem; min-width: 20px; }
.medicao-item .med-val  { font-weight: 600; }

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-aceitavel { background: #d4edda; color: #1a6b2a; }
.badge-dupla     { background: #fdebd0; color: #a04000; }
.badge-falha     { background: #fadbd8; color: #922b21; }

.empty-state {
  text-align: center;
  color: var(--cinza);
  font-size: 0.85rem;
  padding: 12px 0;
}

.cv-indicator {
  font-size: 0.72rem;
  margin-top: 2px;
  font-weight: 600;
}

/* Fertilizante — grade de linhas */
.params-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.linhas-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.btn-linha {
  width: 56px;
  height: 52px;
  border: 1.5px solid var(--borda);
  border-radius: 8px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cinza);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  line-height: 1.1;
}

.btn-linha .linha-val {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--verde);
}

.btn-linha.ativa {
  border-color: var(--verde);
  background: var(--verde-claro);
  color: var(--verde);
}

.btn-linha.preenchida {
  border-color: var(--verde);
  background: var(--verde);
  color: #fff;
}

.btn-linha.preenchida .linha-val {
  color: rgba(255,255,255,0.85);
}

.btn-linha.preenchida.ativa {
  outline: 3px solid var(--verde-claro);
  outline-offset: 1px;
}

.entrada-linha {
  background: var(--verde-claro);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.entrada-linha .entrada-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--verde);
  white-space: nowrap;
  padding-bottom: 11px;
}

.entrada-linha .field { flex: 1; margin-bottom: 0; }

.btn-outline {
  background: none;
  border: 1.5px solid var(--borda);
  color: var(--cinza);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

/* Resultado CV */
.resultado-cv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.cv-big {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--texto);
  line-height: 1;
}

.cv-big span {
  font-size: 1rem;
  font-weight: 600;
  color: var(--cinza);
}

.badge-cv {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-otimo   { background: #d4edda; color: #1a6b2a; }
.badge-bom     { background: #d1ecf1; color: #0c5460; }
.badge-regular { background: #fdebd0; color: #a04000; }
.badge-ruim    { background: #fadbd8; color: #922b21; }

.divider {
  height: 1px;
  background: var(--borda);
  margin: 12px 0;
}

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

.stats-row .stat-item { flex: 1; }

.ideal-destaque {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--verde-claro);
  border-radius: 8px;
  padding: 14px;
}

.ideal-destaque .value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--verde);
}

.ideal-destaque .label {
  font-size: 0.8rem;
  color: var(--cinza);
}

.progresso-linha {
  font-size: 0.78rem;
  color: var(--cinza);
  margin-bottom: 10px;
}

.progresso-linha strong { color: var(--verde); }

/* Index */
.home-header {
  background: var(--verde);
  color: #fff;
  padding: 20px 20px 18px;
  text-align: center;
}

.home-header .logo-sigla {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
}

.home-header .logo-nome {
  font-size: 0.78rem;
  opacity: 0.82;
  margin-top: 3px;
  letter-spacing: 0.03em;
}

.banner-patrocinador {
  background: #f5f0e8;
  border-top: 1px solid #e5ddd0;
  border-bottom: 1px solid #e5ddd0;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.banner-patrocinador .banner-tag {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a08060;
  font-weight: 700;
  white-space: nowrap;
}

.banner-patrocinador .banner-texto {
  font-size: 0.82rem;
  color: #5a4020;
  font-weight: 600;
}

.banner-sep {
  width: 1px;
  height: 16px;
  background: #c8b89a;
  flex-shrink: 0;
}

.modulos-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

.modulo-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--sombra);
  padding: 18px 16px;
  text-decoration: none;
  color: var(--texto);
  transition: box-shadow 0.15s, transform 0.1s;
  border: 1.5px solid transparent;
}

.modulo-card:active {
  transform: scale(0.98);
  box-shadow: none;
  border-color: var(--borda);
}

.modulo-card .card-icon {
  width: 48px;
  height: 48px;
  background: var(--verde-claro);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modulo-card .card-icon svg {
  width: 26px;
  height: 26px;
}

.modulo-card .card-body { flex: 1; }

.modulo-card .card-body h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--texto);
  margin-bottom: 2px;
}

.modulo-card .card-body p {
  font-size: 0.8rem;
  color: var(--cinza);
  line-height: 1.4;
}

.modulo-card .card-arrow {
  color: var(--verde);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.home-footer {
  text-align: center;
  padding: 20px 16px 28px;
  font-size: 0.75rem;
  color: var(--cinza);
}
