:root {
  --forest: #173d2d;
  --forest-2: #235841;
  --ink: #173028;
  --muted: #637169;
  --paper: #f4f1e8;
  --surface: #fffdf8;
  --line: #d9ddd4;
  --soft: #e8ece3;
  --acid: #d8ee7c;
  --acid-dark: #42611e;
  --clay: #b75f3d;
  --gold: #dda83a;
  --blue: #5a93a2;
  --danger: #a4412d;
  --shadow: 0 18px 60px rgba(32, 51, 42, .08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: var(--forest-2); }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: white; padding: .8rem 1rem; border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.app-header {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1320px;
  margin: auto;
  padding: 0 32px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 14px; object-fit: contain; background: #fff; box-shadow: 0 3px 12px rgba(25,61,43,.12); }
.brand span { display: grid; line-height: 1.02; letter-spacing: -.02em; }
.brand strong { font-size: 1.08rem; }
.brand small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .18em; margin-top: 4px; }
.header-meta { display: flex; align-items: center; gap: 10px; }
.source-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #d7dbd2; border-radius: 999px; color: var(--muted); font-size: .78rem; background: rgba(255,255,255,.45); }
.source-pill i { width: 7px; height: 7px; border-radius: 50%; background: #6a9e3a; box-shadow: 0 0 0 4px rgba(106,158,58,.13); }

main { max-width: 1180px; margin: 0 auto; padding: 22px 28px 64px; }
.hero {
  min-height: 285px;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  padding: 52px 58px;
  border-radius: 30px;
  background: var(--forest);
  color: white;
  box-shadow: 0 24px 70px rgba(23,61,45,.16);
}
.hero::before { content: ""; position: absolute; width: 400px; height: 400px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; right: -130px; top: -180px; box-shadow: 0 0 0 55px rgba(255,255,255,.025), 0 0 0 110px rgba(255,255,255,.018); }
.eyebrow { margin: 0 0 13px; color: var(--acid); text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 800; }
.hero h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: clamp(2.25rem, 5vw, 4rem); line-height: .98; letter-spacing: -.055em; }
.hero-copy { max-width: 610px; margin: 23px 0 0; color: rgba(255,255,255,.72); font-size: 1rem; }
.hero-button { position: relative; z-index: 2; margin-top: 22px; background: var(--acid); color: var(--forest); box-shadow: 0 10px 24px rgba(0,0,0,.14); }
.hero-button:hover { background: #e4f59d; }
.creator-mark { margin: 14px 0 0; color: rgba(255,255,255,.58); font-size: .66rem; letter-spacing: .025em; }
.creator-mark strong { color: var(--acid); }
.hero-logo { width: 235px; max-height: 235px; object-fit: contain; border-radius: 28px; box-shadow: 0 18px 45px rgba(0,0,0,.22); background: white; }
.hero-mark { position: relative; flex: 0 0 270px; display: grid; justify-items: center; text-align: center; z-index: 1; }
.hero-mark svg { width: 250px; height: 150px; overflow: visible; }
.hero-mark svg path:first-child { fill: var(--acid); opacity: .92; }
.hero-mark svg path:not(:first-child) { stroke: var(--forest); fill: none; stroke-width: 5; stroke-linecap: round; }
.hero-mark span { margin-top: -9px; font-family: Georgia, serif; font-size: 1.45rem; }
.hero-mark small { color: rgba(255,255,255,.62); font-size: .7rem; letter-spacing: .06em; margin-top: 4px; }

.stepper { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; margin: 34px auto 27px; max-width: 880px; padding: 0 10px; }
.stepper > i { height: 1px; background: #ccd2c8; margin: 0 19px; }
.step { appearance: none; border: 0; background: none; display: grid; grid-template-columns: 35px auto; grid-template-rows: 20px 16px; column-gap: 11px; text-align: left; color: #89918b; padding: 0; }
.step span { grid-row: 1 / 3; width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid #cbd0c9; border-radius: 50%; background: var(--paper); font-size: .79rem; font-weight: 700; }
.step b { font-size: .78rem; letter-spacing: .01em; color: inherit; }
.step small { font-size: .67rem; white-space: nowrap; }
.step.active { color: var(--forest); }
.step.active span { background: var(--acid); border-color: var(--acid); color: var(--forest); box-shadow: 0 0 0 5px rgba(216,238,124,.28); }
.step.complete span { background: var(--forest); color: white; border-color: var(--forest); }

.panel { scroll-margin-top: 20px; background: var(--surface); border: 1px solid rgba(52,75,63,.10); border-radius: var(--radius); padding: 34px 38px; box-shadow: var(--shadow); }
.panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-bottom: 26px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.panel-heading > div { display: flex; align-items: center; gap: 13px; }
.panel-heading h2 { margin: 0; font-family: Georgia, serif; font-weight: 500; font-size: 1.65rem; letter-spacing: -.025em; }
.panel-heading p { margin: 0; max-width: 420px; color: var(--muted); font-size: .82rem; text-align: right; }
.section-number { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--forest); color: white; font-size: .66rem; font-weight: 800; letter-spacing: .04em; }

.form-grid { display: grid; gap: 18px 16px; }
.context-grid { grid-template-columns: 1.1fr 1fr 1fr 1fr; }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: 1 / -1; }
.context-core { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr) minmax(0, .85fr); gap: 16px; align-items: start; }
.context-core .field { grid-template-rows: minmax(36px, auto) 46px minmax(34px, auto); align-content: start; }
.context-core .field > span { align-self: start; line-height: 1.35; }
.context-core .field input, .context-core .field select { height: 46px; min-height: 46px; line-height: 1.25; }
.context-core .field small { align-self: start; min-height: 34px; }
.field { position: relative; display: grid; gap: 7px; }
.field > span { color: #43524a; font-size: .72rem; font-weight: 750; letter-spacing: .025em; }
.field > span em { color: #8b948f; font-style: normal; font-weight: 500; float: right; }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid #cfd5cd; border-radius: 10px; background: white; color: var(--ink); outline: none; transition: .18s ease;
}
.field select { padding-right: 32px; }
.field input::placeholder { color: #a0a8a2; }
.field input:hover, .field select:hover { border-color: #98a59c; }
.field input:focus, .field select:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(35,88,65,.10); }
.field small { color: #8a938d; font-size: .64rem; line-height: 1.3; }
.field.required > span::before { content: "•"; color: var(--clay); margin-right: 4px; }
.field.imported input { border-color: #779f50; background: #fbfff1; box-shadow: inset 3px 0 #91bd59; }
.field.imported::after { content: "Importado"; position: absolute; right: 8px; top: -1px; color: #537632; font-size: .55rem; text-transform: uppercase; letter-spacing: .08em; }

.advanced { margin-top: 23px; border: 1px solid var(--line); border-radius: 12px; background: #f9faf5; }
.advanced summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 14px 16px; color: #4b5951; font-size: .78rem; font-weight: 700; list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: "+"; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); color: var(--forest); font-size: 1rem; }
.advanced[open] summary::after { content: "−"; }
.technical-panel { padding-top: 0; overflow: hidden; border-color: #a9bf8d; border-left: 4px solid var(--forest-2); background: #fbfcf7; box-shadow: 0 12px 32px rgba(35,88,65,.08); }
.technical-settings-group { display: grid; }
.lime-goal { display: grid; grid-template-columns: minmax(250px, 1.5fr) repeat(2, minmax(170px, .65fr)); gap: 14px; align-items: end; margin-top: 20px; padding: 17px; border: 1px solid #c8d7bd; border-radius: 13px; background: linear-gradient(135deg, #f4f8ec, #fbfcf7); }
.lime-goal > div { display: flex; align-items: center; gap: 12px; align-self: center; }
.lime-goal h3 { margin: 0; color: var(--forest); font-family: Georgia, serif; font-size: 1rem; }
.lime-goal p { margin: 4px 0 0; color: var(--muted); font-size: .65rem; line-height: 1.4; }
.technical-panel > summary { min-height: 74px; padding: 18px 20px; background: linear-gradient(135deg, #eef4e2, #f8faef); }
.technical-panel > summary > span { display: grid; gap: 3px; }
.technical-panel > summary b { color: var(--forest); font-family: Georgia, serif; font-size: 1.08rem; letter-spacing: .035em; }
.technical-panel > summary small { color: #58685f; font-size: .67rem; font-weight: 600; }
.technical-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px; border-bottom: 1px solid var(--line); margin-bottom: 12px; background: #f3f6ec; }
.technical-heading > div { display: flex; align-items: center; gap: 11px; }
.technical-heading h3 { margin: 0; font-family: Georgia, serif; font-size: 1.08rem; font-weight: 600; }
.technical-heading p { margin: 0; color: var(--muted); font-size: .68rem; text-align: right; }
.technical-grid { grid-template-columns: repeat(4, 1fr); padding: 5px 16px 18px; }
.technical-update-action { display: flex; justify-content: flex-end; padding: 0 16px 18px; }
.result-technical-slot { margin: 17px 0; }
.result-technical-slot:empty { display: none; }
.result-technical-slot .technical-settings-group { gap: 14px; }
.result-technical-slot .lime-goal, .result-technical-slot .technical-panel { margin-top: 0; }
.history-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 5px 16px 9px; }
.history-grid > div { display: grid; grid-template-columns: 1fr 105px; gap: 7px; padding: 12px; border: 1px solid #dce1d8; border-radius: 10px; background: white; }
.history-grid strong { grid-column: 1 / -1; color: #506057; font-size: .66rem; }
.history-grid select, .history-grid input { min-width: 0; min-height: 40px; padding: 8px 9px; border: 1px solid #cfd5cd; border-radius: 8px; background: white; color: var(--ink); font-size: .7rem; }
.history-note { margin: 0; padding: 0 16px 16px; color: #7d8781; font-size: .62rem; }

.panel-actions { display: flex; gap: 12px; margin-top: 28px; }
.panel-actions.end { justify-content: flex-end; }
.panel-actions.between { justify-content: space-between; align-items: center; }
.panel-actions > div { display: flex; gap: 10px; }
.recommendation-note { margin: 16px 0 4px; padding: 13px 15px; border-left: 4px solid var(--leaf); border-radius: 8px; background: #f4f8ec; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.recommendation-note strong, .recommendation-note b { color: var(--forest); }
.button { appearance: none; border: 1px solid transparent; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 14px; padding: 10px 17px; border-radius: 10px; font-weight: 750; font-size: .76rem; text-decoration: none; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--forest); color: white; box-shadow: 0 8px 18px rgba(23,61,45,.15); }
.button.primary:hover { background: #0e3324; }
.button.secondary { border-color: var(--forest); color: var(--forest); background: white; }
.button.ghost { border-color: #ccd3cb; color: #4c5b52; background: transparent; }
.button.compact { min-height: 36px; padding: 7px 12px; font-size: .68rem; border-radius: 8px; }
.button:disabled { cursor: not-allowed; transform: none; opacity: .45; box-shadow: none; }

.upload-zone { position: relative; min-height: 132px; display: grid; grid-template-columns: 54px 1fr auto; grid-template-rows: 1fr auto; align-items: center; gap: 8px 18px; padding: 24px; border: 1.5px dashed #a9b4ac; border-radius: 15px; background: #fbfcf7; transition: .18s ease; }
.upload-zone.dragging { border-color: var(--forest); background: #f2f8e5; box-shadow: inset 0 0 0 2px rgba(216,238,124,.5); }
.upload-icon { width: 52px; height: 52px; display: grid; place-items: center; grid-row: 1; border-radius: 14px; background: #eaf2d1; }
.upload-icon svg { width: 24px; fill: none; stroke: var(--forest); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.upload-zone > div:nth-child(3) { display: grid; }
.upload-zone strong { font-family: Georgia, serif; font-size: 1.1rem; font-weight: 600; }
.upload-zone span { color: var(--muted); font-size: .72rem; margin-top: 3px; }
.upload-status { grid-column: 1 / -1; min-height: 18px; font-size: .7rem; color: var(--muted); }
.upload-status.success { color: #397026; }
.upload-status.error { color: var(--danger); }
.upload-status.warning { color: #8b641b; }
.upload-status.loading::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border: 2px solid #c5ccc5; border-top-color: var(--forest); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.import-tools { display: flex; justify-content: center; gap: 7px; color: #89918c; font-size: .67rem; margin: 11px 0 27px; }
.import-tools a, .link-button { color: var(--forest-2); font-weight: 700; background: none; border: 0; padding: 0; font-size: inherit; }

.sample-panel { margin: 0 0 25px; padding: 23px; border: 1px solid #ccd8be; border-radius: 16px; background: linear-gradient(145deg, #fbfff2, #f5f8ed); }
.sample-panel-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .42fr); gap: 24px; align-items: end; }
.sample-panel-head h3 { margin: 7px 0 3px; font-family: Georgia, serif; font-size: 1.42rem; font-weight: 600; }
.sample-panel-head p { margin: 0; color: var(--muted); font-size: .7rem; }
.read-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; background: #dcefb4; color: #365924; font-size: .57rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.read-badge::before { content: "✓"; }
.sample-select { min-width: 0; }
.extraction-score { display: grid; grid-template-columns: minmax(160px, 320px) 1fr; gap: 13px; align-items: center; margin: 21px 0 16px; }
.extraction-score > span { height: 7px; overflow: hidden; border-radius: 99px; background: #dfe5d7; }
.extraction-score i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--forest-2), #78a342); transition: width .3s ease; }
.extraction-score p { margin: 0; color: #60705f; font-size: .66rem; }
.extracted-values { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.extracted-item { min-width: 0; display: grid; gap: 4px; padding: 11px 10px; border: 1px solid #d9e1d1; border-radius: 10px; background: rgba(255,255,255,.72); }
.extracted-item span { color: #69766d; font-size: .58rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.extracted-item strong { color: var(--forest); font-family: Georgia, serif; font-size: .98rem; font-weight: 600; }
.extracted-item strong small { color: #89928b; font-family: inherit; font-size: .52rem; font-weight: 400; }
.extracted-item.missing { border-style: dashed; background: transparent; }
.extracted-item.missing strong { color: #909891; font-family: inherit; font-size: .64rem; font-weight: 500; }
.auto-note { margin: 15px 0 0; padding-top: 14px; border-top: 1px solid #d9dfd2; color: #657269; font-size: .68rem; }
.auto-note strong { color: var(--forest); }

.analysis-sections { display: grid; gap: 23px; }
fieldset { margin: 0; padding: 22px 20px 20px; border: 1px solid var(--line); border-radius: 14px; }
legend { padding: 0 8px; display: inline-flex; align-items: baseline; gap: 10px; }
legend span { font-family: Georgia, serif; font-size: 1.05rem; font-weight: 600; }
legend small { color: var(--muted); font-size: .64rem; }
.soil-grid { grid-template-columns: repeat(4, 1fr); }
.compact-grid { grid-template-columns: repeat(5, 1fr); }
.micronutrients { margin: 0; }
.micronutrients > .soil-grid { padding: 5px 16px 18px; }
.form-message { margin-top: 18px; padding: 11px 14px; border-radius: 9px; background: #fff0eb; border: 1px solid #efc6b8; color: #8d3c27; font-size: .76rem; }

.results-panel { padding: 0; background: transparent; border: 0; box-shadow: none; }
.result-header { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 32px 36px; border-radius: var(--radius); background: var(--forest); color: white; box-shadow: var(--shadow); }
.result-header .eyebrow { margin-bottom: 7px; }
.result-header h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.result-stale { margin: 0 0 18px; padding: 13px 16px; border: 1px solid #d8ad4a; border-left-width: 4px; border-radius: 10px; background: #fff8e7; color: #6e5418; font-size: .72rem; line-height: 1.5; }
.result-stale strong { display: block; margin-bottom: 4px; font-size: .78rem; }
.result-stale p { margin: 0; }
.result-provenance { margin: 9px 0 0; color: #60705f; font-size: .62rem; line-height: 1.5; }
.result-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 13px; }
.result-meta span { padding: 5px 8px; border: 1px solid rgba(255,255,255,.15); border-radius: 999px; color: rgba(255,255,255,.72); font-size: .62rem; }
.result-actions { display: flex; gap: 7px; }
.result-header .button.ghost { color: white; border-color: rgba(255,255,255,.25); }
.result-header .button.secondary { color: var(--forest); border-color: white; }

.result-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 11px; margin: 17px 0; }
.result-card { --accent-card: var(--acid); min-height: 242px; display: flex; flex-direction: column; padding: 22px; border: 1px solid rgba(41,62,51,.1); border-radius: 18px; background: var(--surface); box-shadow: 0 10px 32px rgba(32,51,42,.05); }
.result-card.gypsum { --accent-card: #b4cfce; }
.result-card.nitrogen { --accent-card: #8fbd79; }
.result-card.phosphorus { --accent-card: #efbd61; }
.result-card.potassium { --accent-card: #dc8260; }
.card-top { display: flex; align-items: center; gap: 9px; }
.card-top p { margin: 0; color: #59685f; font-size: .69rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.card-symbol { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-card); color: var(--forest); font-family: Georgia, serif; font-weight: 700; }
.dose { display: grid; margin: 21px 0 5px; }
.dose strong { font-family: Georgia, serif; font-size: 2.65rem; line-height: 1; letter-spacing: -.05em; font-weight: 500; }
.dose span { color: var(--muted); font-size: .68rem; margin-top: 5px; }
.card-status { margin: 5px 0 18px; color: var(--forest-2); font-size: .7rem; font-weight: 700; }
.card-total { display: grid; gap: 4px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.card-total span { font-size: .72rem; }
.card-total small { color: #89928c; font-size: .6rem; line-height: 1.35; }

.application-block, .limestone-block { margin: 0 0 15px; padding: 25px 27px; border: 1px solid rgba(41,62,51,.1); border-radius: 18px; background: var(--surface); }
.application-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.application-card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fbfcf7; }
.application-card-head { display: flex; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); background: #f0f4e8; }
.application-card-head > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--forest); color: white; font-family: Georgia, serif; font-size: .72rem; font-weight: 700; }
.application-card-head > div { display: grid; }
.application-card-head strong { font-size: .78rem; }
.application-card-head small { color: var(--muted); font-size: .58rem; }
.application-steps { padding: 4px 14px 10px; }
.application-step { display: grid; grid-template-columns: 25px 1fr; gap: 9px; padding: 13px 0; border-bottom: 1px solid #e4e8e0; }
.application-step:last-child { border-bottom: 0; }
.application-step > i { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: var(--acid); color: var(--forest); font-size: .58rem; font-style: normal; font-weight: 850; }
.application-step > div { display: grid; gap: 3px; min-width: 0; }
.application-step strong { color: var(--forest); font-size: .72rem; line-height: 1.35; }
.application-step p { margin: 0; color: #4f6057; font-size: .66rem; font-weight: 700; }
.application-step span { color: #738078; font-size: .62rem; }
.application-step small { color: #909892; font-size: .55rem; line-height: 1.4; }
.limestone-block { display: grid; grid-template-columns: 1.1fr 1.6fr; gap: 20px; background: linear-gradient(145deg, #f6f8ed, #fffdf8); }
.limestone-summary { display: grid; grid-template-columns: 48px 1fr; gap: 13px; align-items: start; }
.limestone-summary > span { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: var(--clay); color: white; font-family: Georgia, serif; font-size: .74rem; font-weight: 700; }
.limestone-summary small { color: #78857d; font-size: .59rem; text-transform: uppercase; letter-spacing: .06em; }
.limestone-summary h3 { margin: 4px 0 5px; font-family: Georgia, serif; font-size: 1.24rem; font-weight: 600; }
.limestone-summary p { margin: 0; color: #5d6c63; font-size: .66rem; line-height: 1.5; }
.limestone-summary em { display: block; margin-top: 8px; color: #7b6841; font-size: .6rem; font-style: normal; font-weight: 700; }
.limestone-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.limestone-options article { display: grid; align-content: start; gap: 4px; padding: 13px; border: 1px solid #d9ded5; border-radius: 11px; background: white; }
.limestone-options strong { font-size: .72rem; }
.limestone-options span { color: var(--clay); font-size: .58rem; font-weight: 750; }
.limestone-options p { margin: 3px 0 0; color: #758078; font-size: .57rem; line-height: 1.45; }

.result-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 15px; }
.diagnosis-block, .attention-block, .memory-block { padding: 25px 27px; border: 1px solid rgba(41,62,51,.1); border-radius: 18px; background: var(--surface); }
.subheading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.subheading h3 { margin: 0; font-family: Georgia, serif; font-size: 1.22rem; font-weight: 600; }
.subheading span { color: #8a938d; font-size: .63rem; }
.diagnosis-grid { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 20px; }
.diagnosis-item { display: flex; justify-content: space-between; gap: 12px; padding: 15px 0; border-bottom: 1px solid #e8ebe5; }
.diagnosis-item > div { display: grid; align-content: center; gap: 3px; }
.diagnosis-item > div:last-child { justify-items: end; text-align: right; }
.diagnosis-item span { color: #657169; font-size: .64rem; }
.diagnosis-item strong { font-family: Georgia, serif; font-size: 1.15rem; font-weight: 600; }
.diagnosis-item strong small { font-family: inherit; color: #8d9690; font-size: .57rem; font-weight: 400; }
.diagnosis-item > div > small { color: #929a95; font-size: .55rem; max-width: 120px; }
.status { display: inline-flex; padding: 3px 7px; border-radius: 999px; font-size: .57rem; font-style: normal; font-weight: 800; }
.status.good { color: #3e6c29; background: #e8f3d8; }
.status.warning { color: #8a6115; background: #fff0c9; }
.status.danger { color: #9a3b29; background: #fae1d9; }
.status.neutral { color: #53645b; background: #e9ede8; }
.empty-state { color: var(--muted); font-size: .75rem; }
.attention-block ul { list-style: none; padding: 0; margin: 0; }
.attention-block li { display: grid; grid-template-columns: 24px 1fr; gap: 9px; padding: 13px 0; border-bottom: 1px solid #e8ebe5; }
.attention-block li:last-child { border-bottom: 0; }
.attention-block li > span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #f8e0d6; color: var(--danger); font-weight: 900; font-size: .68rem; }
.attention-block li p { margin: 1px 0 0; color: #5b6961; font-size: .68rem; line-height: 1.45; }
.attention-block li.all-good > span { color: #3e6c29; background: #e8f3d8; }

.memory-block { margin-top: 15px; }
.memory-list details { border-bottom: 1px solid var(--line); }
.memory-list details:last-child { border-bottom: 0; }
.memory-list summary { min-height: 61px; display: flex; align-items: center; justify-content: space-between; gap: 20px; cursor: pointer; list-style: none; padding: 12px 5px; }
.memory-list summary::-webkit-details-marker { display: none; }
.memory-list summary span { font-size: .75rem; font-weight: 750; }
.memory-list summary strong { color: var(--forest-2); font-family: Georgia, serif; font-size: .94rem; font-weight: 500; }
.memory-content { display: grid; grid-template-columns: 1.1fr 1.35fr .9fr; gap: 25px; padding: 1px 5px 20px; }
.memory-content > div { display: grid; align-content: start; gap: 5px; }
.memory-content small { color: #8a948e; font-size: .58rem; text-transform: uppercase; letter-spacing: .08em; }
.memory-content p, .memory-content code { margin: 0; color: #506057; font-family: inherit; font-size: .66rem; line-height: 1.5; }
.memory-content code { color: var(--forest); background: #eef2e7; padding: 7px 9px; border-radius: 7px; }

.disclaimer { display: grid; grid-template-columns: 28px 1fr; gap: 12px; margin: 16px 0 0; padding: 17px 20px; border: 1px solid #dec991; border-radius: 13px; background: #fff8df; }
.disclaimer svg { width: 24px; fill: none; stroke: #8b641b; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.disclaimer p { margin: 0; color: #6f5c31; font-size: .68rem; line-height: 1.5; }
.reference-strip { display: grid; grid-template-columns: 130px 1fr; gap: 25px; align-items: center; margin-top: 28px; padding: 18px 24px; border-top: 1px solid #cfd5cc; border-bottom: 1px solid #cfd5cc; }
.reference-strip > span { color: #7c8780; font-size: .61rem; text-transform: uppercase; letter-spacing: .13em; }
.reference-strip p { margin: 0; color: #647169; font-size: .7rem; }
.reference-strip strong { color: #3d4c44; }
.reference-links { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; }
.reference-links a { padding: 5px 8px; border: 1px solid #ccd7ca; border-radius: 999px; color: var(--forest); background: #f7faf4; font-size: .6rem; font-weight: 750; text-decoration: none; }
.reference-links a:hover { border-color: var(--leaf); }

.extraction-consistency { margin: 0 0 16px; padding: 13px 15px; border: 1px solid var(--danger); border-left-width: 4px; border-radius: 10px; background: #fdf1ec; color: #6d3222; font-size: .7rem; line-height: 1.5; }
.extraction-consistency strong { display: block; margin-bottom: 4px; font-size: .74rem; }
.extraction-consistency p { margin: 0 0 8px; }
.extraction-consistency ul { margin: 0; padding-left: 18px; display: grid; gap: 5px; }
.extraction-review { display: flex; align-items: flex-start; gap: 10px; margin-top: 15px; padding: 13px; border: 1px solid #d8ad4a; border-radius: 10px; background: #fff8e7; color: #6e5418; font-size: .7rem; line-height: 1.45; }
.extraction-review input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--forest); }
.extraction-review strong { display: block; }

.sources-block { margin: 12px 0; padding: 25px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.source-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.source-entry { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px 14px; padding: 14px; border: 1px solid var(--line); border-left: 4px solid #9aab91; border-radius: 10px; background: #fbfcf8; }
.source-entry.applied { border-left-color: var(--leaf); }
.source-entry > div { display: grid; gap: 3px; }
.source-entry span { color: var(--leaf); font-size: .56rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.source-entry.contextual span { color: #826927; }
.source-entry strong { font-size: .72rem; }
.source-entry small, .source-entry p { color: var(--muted); font-size: .61rem; }
.source-entry p { grid-column: 1; margin: 0; line-height: 1.45; }
.source-entry a { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--forest); font-size: .61rem; font-weight: 750; text-decoration: none; }

footer { display: flex; justify-content: space-between; max-width: 1180px; margin: auto; padding: 22px 28px 42px; color: #879089; font-size: .62rem; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: -80px; transform: translateX(-50%); padding: 11px 17px; border-radius: 10px; background: var(--ink); color: white; box-shadow: 0 12px 30px rgba(0,0,0,.2); font-size: .73rem; transition: .25s ease; }
.toast.show { bottom: 24px; }

@media (max-width: 980px) {
  .context-grid { grid-template-columns: repeat(2, 1fr); }
  .technical-grid { grid-template-columns: repeat(2, 1fr); }
  .application-grid { grid-template-columns: 1fr; }
  .limestone-block { grid-template-columns: 1fr; }
  .soil-grid { grid-template-columns: repeat(3, 1fr); }
  .compact-grid { grid-template-columns: repeat(3, 1fr); }
  .result-cards { grid-template-columns: repeat(3, 1fr); }
  .result-layout { grid-template-columns: 1fr; }
  .hero-mark { flex-basis: 220px; }
  .hero-mark svg { width: 210px; }
  .extracted-values { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .context-core { grid-template-columns: 1fr; }
  .context-core .field { grid-template-rows: auto 46px auto; }
  .context-core .field small { min-height: 0; }
}

@media (max-width: 720px) {
  .app-header { height: 68px; padding: 0 18px; }
  .source-pill { display: none; }
  .brand img { width: 48px; height: 48px; }
  .brand small { max-width: 180px; letter-spacing: .09em; }
  main { padding: 10px 13px 45px; }
  .hero { min-height: auto; padding: 35px 28px; border-radius: 22px; }
  .hero h1 { font-size: 2.35rem; }
  .hero-copy { font-size: .86rem; }
  .hero-mark { display: none; }
  .stepper { margin: 26px auto 20px; grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .stepper > i { display: none; }
  .step { grid-template-columns: 29px 1fr; grid-template-rows: auto; gap: 7px; align-items: center; }
  .step span { grid-row: auto; width: 29px; height: 29px; }
  .step small { display: none; }
  .panel { padding: 24px 18px; border-radius: 17px; }
  .panel-heading { align-items: start; margin-bottom: 22px; padding-bottom: 20px; }
  .panel-heading p { display: none; }
  .panel-heading h2 { font-size: 1.35rem; }
  .context-grid, .soil-grid, .compact-grid, .technical-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .lime-goal { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .lime-goal > div { grid-column: 1 / -1; }
  .limestone-options { grid-template-columns: 1fr; }
  .history-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 2; }
  .span-4 { grid-column: 1 / -1; }
  .upload-zone { grid-template-columns: 43px 1fr; padding: 18px; }
  .upload-icon { width: 42px; height: 42px; }
  .upload-zone .button { grid-column: 1 / -1; width: 100%; }
  .sample-panel { padding: 18px; }
  .sample-panel-head { grid-template-columns: 1fr; gap: 17px; }
  .extraction-score { grid-template-columns: 1fr; gap: 7px; }
  .extracted-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-actions.between { align-items: stretch; gap: 10px; }
  .panel-actions.between, .panel-actions.between > div { flex-direction: column-reverse; }
  .panel-actions .button { width: 100%; }
  .result-header { padding: 26px 22px; align-items: start; flex-direction: column; }
  .result-actions { width: 100%; flex-wrap: wrap; }
  .result-actions .button { flex: 1; }
  .result-cards { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .result-card { min-height: 215px; padding: 17px 15px; }
  .dose strong { font-size: 2.1rem; }
  .diagnosis-block, .attention-block, .memory-block { padding: 21px 18px; }
  .diagnosis-grid { grid-template-columns: 1fr; }
  .memory-content { grid-template-columns: 1fr; gap: 13px; }
  .memory-list summary { align-items: start; flex-direction: column; gap: 2px; }
  .reference-strip { grid-template-columns: 1fr; gap: 5px; }
  .reference-links { grid-column: 1; }
  .source-list { grid-template-columns: 1fr; }
  .source-entry { grid-template-columns: 1fr; }
  .source-entry a { grid-column: 1; grid-row: auto; }
  footer { padding: 20px 17px 35px; flex-direction: column; gap: 3px; }
}

@media (max-width: 430px) {
  .context-grid, .soil-grid, .compact-grid, .technical-grid { grid-template-columns: 1fr; }
  .lime-goal { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .span-4 { grid-column: span 1; }
  .result-cards { grid-template-columns: 1fr; }
  .history-grid > div { grid-template-columns: 1fr; }
  .history-grid strong { grid-column: auto; }
  .result-card { min-height: 205px; }
  fieldset { padding: 18px 14px 16px; }
  legend { display: grid; gap: 1px; }
  .extracted-values { grid-template-columns: 1fr; }
  .step b { font-size: .66rem; }
  .step { grid-template-columns: 26px 1fr; }
  .step span { width: 26px; height: 26px; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: white; color: #111; font-size: 10pt; }
  .app-header, .hero, .stepper, form, footer, .reference-strip, .no-print, .result-actions, .toast { display: none !important; }
  main { max-width: none; padding: 0; }
  .results-panel { display: block !important; }
  .result-header { padding: 18px 20px; box-shadow: none; break-inside: avoid; }
  .result-cards { grid-template-columns: repeat(2, 1fr); }
  .result-card { min-height: 170px; box-shadow: none; break-inside: avoid; }
  .result-layout { grid-template-columns: 1.5fr 1fr; }
  .diagnosis-block, .attention-block, .memory-block, .sources-block { box-shadow: none; break-inside: avoid; }
  .memory-list details { display: block; }
  .memory-list details > .memory-content { display: grid !important; }
  .disclaimer { break-inside: avoid; }
}

.account-pill { color: var(--muted); font-size: .82rem; font-weight: 700; }
.logout-button { min-height: 35px; padding: 0 13px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--green-deep); font: inherit; font-size: .82rem; font-weight: 800; cursor: pointer; }
.logout-button:hover { border-color: var(--green); background: var(--green-pale); }
.logout-button:disabled { opacity: .55; cursor: wait; }

/* Ajuste Tecnico trazido para a etapa da leitura do laudo. Reserva o espaco
   com o mesmo respiro dos demais blocos do passo, para a revelacao nao
   provocar salto de layout. */
.step-two-technical-slot { margin: 26px 0 0; }
.step-two-technical-slot[hidden] { display: none; }
.step-two-technical-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; }

/* Mesma razao do formulario publico: abaixo de 16px o iOS amplia a pagina ao
   focar o campo. A area tecnica e usada no celular, em campo. */
.field input, .field select { font-size: 16px; }

/* Acabamento: numeros e navegacao por teclado.

   Em fonte proporcional o "1" ocupa menos largura que o "8", entao uma coluna
   de doses sai com as casas desalinhadas e a leitura de cima para baixo, que e
   como se confere uma prescricao, fica ruidosa. tabular-nums fixa a largura do
   algarismo sem trocar a fonte. */
.dose strong,
.extracted-item strong,
.diagnosis-item strong,
.application-item strong,
.memory-content,
.result-card .dose { font-variant-numeric: tabular-nums; }

/* A area tecnica nao tinha nenhum :focus-visible: quem navega por teclado nao
   enxergava onde estava. O anel so aparece na navegacao por teclado, entao o
   clique de mouse continua limpo. */
:where(input, select, button, a, summary, [tabindex]):focus-visible {
  outline: 3px solid rgba(40, 98, 70, .45);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Enquadramento dos campos do formulario.

   Cada .field era uma grade independente, entao dimensionava as proprias
   linhas: um rotulo que quebrava em duas linhas empurrava o seu controle para
   baixo, e o campo ao lado, com rotulo de uma linha, ficava mais alto. Medido
   antes da correcao: ate 17px de diferenca entre controles da mesma linha.

   Com subgrid os campos passam a usar as linhas da grade do formulario, entao
   rotulo, controle e dica se alinham entre todos os campos da mesma faixa,
   independentemente de quantas linhas cada texto ocupe. Custa 1px de altura
   total; a alternativa de fixar a altura do rotulo custava 61px e nao
   resolvia, porque a dica abaixo do campo tambem varia. */
.form-grid > .field {
  grid-row: span 3;
  grid-template-rows: subgrid;
  row-gap: 7px;
}
/* Blocos que nao sao campo ocupam as mesmas tres linhas, para nao quebrar o
   ritmo da grade. */
.form-grid > :not(.field) { grid-row: span 3; }

/* Gráficos do laudo. Apoio ao diagnóstico, não prescrição. */
.charts-block { display: grid; gap: 14px; margin: 0 0 18px; }
.charts-note { margin: 0; padding: 9px 11px; border-left: 3px solid var(--acid); border-radius: 0 8px 8px 0; background: var(--soft); color: var(--muted); font-size: .78rem; line-height: 1.45; }
.chart { margin: 0; }
.chart svg { display: block; width: 100%; height: auto; }
/* Um grid só para réguas e relações: colunas alinhadas de ponta a ponta. */
.chart-grid { display: grid; gap: 10px 14px; align-items: start; }
.chart-group { grid-column: 1 / -1; margin: 6px 0 0; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
@media (min-width: 720px) { .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print {
  .charts-block { break-inside: avoid; }
  .chart { break-inside: avoid; }
  .chart svg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Critérios que sustentam o tipo de calcário indicado. */
.limestone-options .criterio-ok { color: #3e6c29; }
.limestone-options .criterio-fora { color: #9a3b29; }
.limestone-options .criterio-fora::after { content: " ·  fora da faixa"; font-size: .8em; font-weight: 700; }

/* O contexto da recomendação acompanha o passo ativo. Nos passos 2 e 3 ele
   aparece como bloco secundário, com título próprio, já que o cabeçalho "01"
   fica no passo 1. */
.moved-context-slot { margin: 17px 0; padding: 15px 16px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.moved-context-slot:empty { display: none; }
.moved-context-title { margin: 0 0 12px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.moved-context-slot .context-grid { margin: 0; }
@media print { .moved-context-slot { display: none !important; } }

/* Botão de instalar, criado pelo pwa.js quando o navegador sinaliza que o app
   é instalável. Fica fora do fluxo para não empurrar nada da página. */
.pwa-install-button { position: fixed; right: 16px; bottom: 16px; z-index: 60; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--forest); border-radius: 999px; background: var(--forest); color: #fff;
  font: inherit; font-size: .86rem; font-weight: 800; cursor: pointer; box-shadow: 0 10px 30px rgba(23, 61, 45, .28); }
.pwa-install-button:hover { background: var(--forest-2); }
.pwa-install-button:disabled { opacity: .6; cursor: progress; }
.pwa-install-button:focus-visible { outline: 3px solid var(--acid); outline-offset: 2px; }
@media print { .pwa-install-button { display: none !important; } }
