/* HidroGestão — app
   Identidade: caderno de campo + painel de instrumentos (a mesma do site).
   Papel quente, verde-tinta, destaque verde-limão, leituras e números em mono. */
:root {
  --ink: #10231a; --ink-2: #1e3a2a; --ink-3: #2c4c39; --lime: #c5ec3f; --lime-2: #b2db27; --on-ink: #e9e4d4; --on-ink-muted: #95a593;
  --bg: #f3efe4; --surface: #fbf9f2; --surface-2: #ece6d6; --text: #10231a; --muted: #5a6658; --line: #ddd5c2;
  --brand: #2f6b35; --brand-2: #1f4d25; --brand-soft: #e3ebcc; --ink-on-brand: #10231a;
  --pipe: #2a7ab8; --water: #6fb6e6; --water-2: #2a7ab8; --tank: #e6eef2; --tank-line: #8aa3b3;
  --red: #d9483b; --red-soft: #fbe3de; --red-ink: #9c2318;
  --yellow: #e8a900; --yellow-soft: #fbefc8; --yellow-ink: #6e5000;
  --green: #3c9a46; --green-soft: #dff0d3; --green-ink: #1d5e26;
  --gray-soft: #e8e3d6; --gray-ink: #5a6658;
  --hole-empty: #e4ddcb; --tube: #d6cdb7; --tube-edge: #c7bda4; --sel: #1f5fa8; --ready: #e8a900; --over: #d9480f;
  --shadow: 0 1px 0 rgba(16, 35, 26, .06);
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 10px; --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1611; --surface: #13211a; --surface-2: #1a2b21; --text: #ebe6d6; --muted: #9aa898; --line: #26392d;
    --brand: #c5ec3f; --brand-2: #d8f57a; --brand-soft: #1f3322; --ink-on-brand: #10231a;
    --tank: #1a2a33; --tank-line: #4b6170;
    --red-soft: #3a1c18; --red-ink: #ff9d92; --yellow-soft: #3a3014; --yellow-ink: #ffd76a; --green-soft: #183522; --green-ink: #9ae2a4;
    --gray-soft: #22302a; --gray-ink: #a9b6a6;
    --hole-empty: #22332a; --tube: #2c3f33; --tube-edge: #36493c; --sel: #7cb8ff;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--display); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; min-height: 100vh; }
body.modal-open { overflow: hidden; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h2 { font-size: 1.05rem; }
small { font-size: .82em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.grow { flex: 1; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- layout ---------- */
.sidenav { display: none; }
.main-wrap { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 1.15rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mini { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--brand); font-size: .9rem; }
.brand-mini span { display: none; }
main { padding: 16px; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 1280px; margin: 0 auto; outline: none; }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; min-height: var(--nav-h); justify-content: center; color: var(--muted); text-decoration: none; font-size: .72rem; }
.bottomnav a.active { color: var(--brand); font-weight: 600; }
.bottomnav a.active .ic { stroke-width: 2.4; }

@media (min-width: 900px) {
  body { display: grid; grid-template-columns: 230px 1fr; }
  .sidenav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--line); }
  .sidenav .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
  .sidenav .brand small { display: block; color: var(--muted); }
  .sidenav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
  .sidenav a:hover { background: var(--surface-2); }
  .sidenav a.active { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
  .bottomnav, .brand-mini { display: none; }
  main { padding: 24px 28px 40px; }
  .topbar { padding: 14px 28px; }
}

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.two-col { display: grid; gap: 16px; }
.two-col > .card { margin-bottom: 0; }
.two-col { margin-bottom: 16px; }
@media (min-width: 1000px) { .two-col { grid-template-columns: 1fr 1fr; align-items: start; } }

.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--ink-on-brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.good { background: var(--green-soft); border-color: var(--green); color: var(--green-ink); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-t { color: var(--red); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 5px 10px; font-size: .88rem; }
.btn .ic { width: 18px; height: 18px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.link-btn { border: 0; background: none; color: var(--brand); cursor: pointer; font: inherit; font-size: .85rem; padding: 4px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-btns.center { justify-content: center; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-actions p { margin: 0; max-width: 60ch; }
.page-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.page-head .back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 500; }
.ph-title { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 160px; }
.ph-title h2 { margin: 0; font-size: 1.25rem; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.chip.s-green { background: var(--green-soft); color: var(--green-ink); }
.chip.s-yellow { background: var(--yellow-soft); color: var(--yellow-ink); }
.chip.s-red { background: var(--red-soft); color: var(--red-ink); }
.chip.s-gray { background: var(--gray-soft); color: var(--gray-ink); }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.s-green::before { background: var(--green); } .chip.s-yellow::before { background: var(--yellow); } .chip.s-red::before { background: var(--red); }
.tag { font-size: .72rem; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.badge { font-size: .8rem; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c); vertical-align: -1px; flex: none; }
.sw.lg { width: 22px; height: 22px; }
.sw.ring { background: var(--hole-empty); box-shadow: 0 0 0 2px var(--ready); }
.sw.ring.over { box-shadow: 0 0 0 2px var(--over); }
.sw.sw-empty { background: var(--hole-empty); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3); }
.empty { text-align: center; padding: 32px 16px; }
.pill-info { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; }
.ok-line { display: flex; gap: 8px; align-items: center; color: var(--green-ink); margin: 0; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .kpis { grid-template-columns: repeat(6, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi b small { font-size: .55em; color: var(--muted); font-weight: 500; }
.kpi span { color: var(--muted); font-size: .82rem; }
.kpi.good { border-color: var(--green); background: var(--green-soft); }
.kpi.warn { border-color: var(--yellow); background: var(--yellow-soft); }

.alerts, .upcoming, .timeline, .mini-list { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; gap: 10px; padding: 9px 10px; border-radius: 10px; margin-bottom: 6px; align-items: flex-start; }
.alerts .al-red { background: var(--red-soft); } .alerts .al-red .ic { color: var(--red); }
.alerts .al-yellow, .alerts .al-warn { background: var(--yellow-soft); } .alerts .al-yellow .ic, .alerts .al-warn .ic { color: var(--yellow); }
.alerts .al-info { background: var(--surface-2); } .alerts .al-info .ic { color: var(--pipe); }
.upcoming li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.upcoming li:last-child { border: 0; }
.upcoming small { display: block; color: var(--muted); }
.upcoming .when { width: 74px; flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.upcoming .when.late { color: var(--green-ink); }
.timeline li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.timeline li:last-child { border: 0; }
.tl-date { width: 88px; flex: none; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.tl-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ttag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; margin-right: 4px; background: var(--surface-2); color: var(--muted); }
.t-app { background: var(--yellow-soft); color: var(--yellow-ink); } .t-harv { background: var(--green-soft); color: var(--green-ink); }
.t-loss { background: var(--red-soft); color: var(--red-ink); } .t-plant { background: var(--brand-soft); color: var(--brand-2); }
.t-tr { background: #e3f0fb; color: #1d5f94; }
.mini-list li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }

/* ---------- reservatório + bancadas ligadas ---------- */
.res-group { display: grid; gap: 0; padding: 0; overflow: hidden; }
.tank-col { position: relative; display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--surface-2); }
.tank { width: 76px; height: 86px; flex: none; }
.tank-body { fill: var(--tank); }
.tank-outline { fill: none; stroke: var(--tank-line); stroke-width: 3; }
.tank-water { fill: var(--water); }
.tank-lid { fill: var(--tank-line); }
.tank-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tank-name { font-weight: 700; text-decoration: none; color: var(--text); }
.readings { display: flex; gap: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.readings .bad, td.bad { color: var(--red); font-weight: 700; }
.target { color: var(--brand-2); }
.pipe-col { position: relative; padding: 16px 16px 16px 46px; display: grid; gap: 12px; }
.pipe-col::before { content: ""; position: absolute; left: 22px; top: 0; bottom: 34px; width: 8px; border-radius: 0 0 6px 6px; background: repeating-linear-gradient(180deg, var(--pipe) 0 10px, var(--water) 10px 20px); background-size: 100% 40px; animation: flow 1.4s linear infinite; }
.bench-card, .pipe-empty, .add-to-group { position: relative; }
.bench-card::before, .pipe-empty::before, .add-to-group::before { content: ""; position: absolute; left: -24px; top: 50%; width: 24px; height: 8px; margin-top: -4px; background: var(--pipe); }
.add-to-group { justify-self: start; }
@keyframes flow { to { background-position: 0 40px; } }
@media (prefers-reduced-motion: reduce) { .pipe-col::before { animation: none; } }
@media (min-width: 760px) {
  .res-group { grid-template-columns: 220px 1fr; }
  .tank-col { flex-direction: column; align-items: flex-start; }
  .tank-col::after { content: ""; position: absolute; right: -24px; top: 58px; width: 24px; height: 8px; background: var(--pipe); }
  .tank { width: 96px; height: 108px; }
  .pipe-col::before { top: 58px; }
}
.bench-card { display: block; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--green); border-radius: 12px; padding: 10px 12px; transition: box-shadow .15s; }
.bench-card:hover { box-shadow: var(--shadow); }
.bench-card.s-yellow { border-left-color: var(--yellow); }
.bench-card.s-red { border-left-color: var(--red); }
.bc-head, .bc-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bc-head { margin-bottom: 8px; }
.bc-foot { margin-top: 8px; font-size: .8rem; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- grade de furos ---------- */
.grid { display: flex; flex-direction: column; gap: 7px; user-select: none; -webkit-user-select: none; touch-action: none; }
.grid.mini { gap: 3px; touch-action: auto; }
.profile { display: flex; align-items: center; gap: 6px; }
.plabel { flex: none; width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 700; cursor: pointer; padding: 0; }
.plabel:hover { color: var(--text); border-color: var(--sel); }
.tube { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: clamp(1px, .45vw, 5px); align-items: center; padding: 5px 9px; border-radius: 999px; background: linear-gradient(180deg, var(--tube), var(--tube-edge)); }
.hole { display: block; width: 100%; max-width: 30px; justify-self: center; aspect-ratio: 1; border-radius: 50%; background: var(--hole-empty); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); cursor: pointer; transition: transform .08s; }
.hole.on { background: var(--c); box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .18); }
.hole.ready { box-shadow: 0 0 0 2px var(--ready); }
.hole.over { box-shadow: 0 0 0 2px var(--over); }
.hole.sel { outline: 3px solid var(--sel); outline-offset: 1px; transform: scale(.86); }
.grid.mini .tube { padding: 2px 5px; gap: 1px; }
.grid.mini .hole { max-width: 9px; cursor: inherit; }
.grid.mini .hole.ready, .grid.mini .hole.over { box-shadow: 0 0 0 1px var(--ready); }
.grid.mini .hole.over { box-shadow: 0 0 0 1px var(--over); }
.grid.medium .hole { max-width: 18px; }
.grid.medium .tube { padding: 3px 7px; gap: 2px; }
.grid-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--brand); color: var(--ink-on-brand); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: .82rem; color: var(--muted); align-items: center; }
.grad-wrap { gap: 8px; }
.grad { display: inline-block; width: 120px; height: 10px; border-radius: 6px; background: linear-gradient(90deg, #fbf1b8, #cfe697 40%, #66b84a 75%, #1b7a33); }

.selbar { position: relative; z-index: 10; margin: 14px -6px -6px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 8px; }
.selbar.active { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 6px); border-color: var(--sel); box-shadow: 0 4px 20px rgba(0, 0, 0, .18); }
@media (min-width: 900px) { .selbar.active { bottom: 10px; } }
@media (max-width: 599px) { .sel-info small { display: none; } .sel-acts .btn { min-height: 38px; padding: 6px 10px; } }
.grid-scroll { overflow-x: auto; }
.grid.zoom { touch-action: pan-x pan-y; }
.grid.zoom .tube { min-width: calc(var(--cols) * 26px); }
.grid.zoom .hole { max-width: 26px; min-width: 20px; }
.sel-info { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.sel-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.sel-quick button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .82rem; cursor: pointer; color: var(--text); }
.sel-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sel-acts .btn { flex: 1 1 auto; }

.safety-banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; border: 1px solid transparent; }
.safety-banner.s-green { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.safety-banner.s-yellow { background: var(--yellow-soft); border-color: color-mix(in srgb, var(--yellow) 50%, transparent); }
.safety-banner.s-red { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.modal .safety-banner { margin-bottom: 10px; }

/* lotes */
.lot { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.lot-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.progress { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-bottom: 10px; }
.progress i { display: block; height: 100%; border-radius: 6px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 0 0 10px; }
.kv dt { font-size: .75rem; color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; font-size: .9rem; }
.guide { background: var(--brand-soft); border-radius: 10px; padding: 8px 12px; font-size: .88rem; margin-bottom: 10px; }
.guide small { display: block; color: var(--muted); margin-top: 2px; }
.lot-notes { font-size: .88rem; color: var(--muted); margin: 0 0 10px; white-space: pre-wrap; }

/* aplicações */
.status-legend { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: .9rem; }
.agroup { margin-bottom: 14px; }
.agroup-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.atiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.atile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; font: inherit; color: var(--text); min-height: 96px; }
.atile.s-green { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.atile.s-yellow { background: var(--yellow-soft); border-color: color-mix(in srgb, var(--yellow) 55%, transparent); }
.atile.s-red { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 55%, transparent); }
.atile .st { font-size: .78rem; font-weight: 700; }
.atile.s-green .st { color: var(--green-ink); } .atile.s-yellow .st { color: var(--yellow-ink); } .atile.s-red .st { color: var(--red-ink); }
.atile small { color: var(--muted); }
.atile .chk { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; background: var(--surface); }
.atile .chk .ic { width: 14px; height: 14px; opacity: 0; }
.atile.picked { outline: 3px solid var(--sel); outline-offset: 1px; }
.atile.picked .chk { background: var(--sel); border-color: var(--sel); color: #fff; }
.atile.picked .chk .ic { opacity: 1; }
.apply-bar { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 6px); display: flex; justify-content: flex-end; padding-top: 8px; }
@media (min-width: 900px) { .apply-bar { bottom: 10px; } }
.apply-bar .btn { box-shadow: 0 4px 16px rgba(0, 0, 0, .15); }
.app-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.app-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }

/* tabelas */
.table-wrap { overflow-x: auto; margin-bottom: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-size: .76rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.tbl.compact th, .tbl.compact td { padding: 5px 6px; }
.tbl td:last-child { white-space: normal; }
.good-t { color: var(--green-ink); }
.tbl.weeks input { width: 70px; padding: 6px; }
.tbl.weeks td:last-child input { width: 100%; min-width: 220px; }
.tbl.weeks tr.nur td:first-child { color: var(--brand); font-weight: 700; }

/* reservatórios */
.res-top { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.res-top h2 { margin: 0; }
.res-top p { margin: 6px 0; }
.sparks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.spark { margin: 0; }
.spark figcaption { font-size: .78rem; color: var(--muted); margin-bottom: 2px; }
.spark svg { width: 100%; height: 56px; display: block; background: var(--surface-2); border-radius: 8px; }
.spark .band { fill: color-mix(in srgb, var(--green) 18%, transparent); }
.spark .line { fill: none; stroke: var(--pipe); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark .pt { fill: var(--pipe); } .spark .pt.bad { fill: var(--red); }

/* culturas / mais */
.crop-list, .more-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.crop-item, .more-item { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); margin: 0; }
.crop-item small { display: block; }
.more-item { padding: 18px; font-weight: 600; }
.more-item .ic { color: var(--brand); }

/* nursery */
.nursery-card .card-head h2 a { color: var(--text); text-decoration: none; }

/* welcome */
.welcome { text-align: center; padding: 36px 20px; max-width: 640px; margin: 24px auto; }
.welcome p { color: var(--muted); max-width: 52ch; margin: 0 auto 18px; }

/* ---------- formulários e modal ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: .8rem; color: var(--muted); font-weight: 600; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-height: 42px; width: 100%; }
input[type="color"] { padding: 3px; height: 42px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 0; border-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }
.field-set { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; min-width: 0; }
.field-set legend { font-weight: 700; font-size: .85rem; padding: 0 4px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; }
.radio, .check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check { margin-bottom: 12px; }
.bchecks { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.bcheck { display: inline-flex; }
.bcheck input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bcheck span { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; font-size: .88rem; }
.bcheck input:checked + span { background: var(--sel); border-color: var(--sel); color: #fff; }
.bcheck input:focus-visible + span { outline: 2px solid var(--sel); outline-offset: 2px; }
.prod-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; align-items: end; padding: 10px 0; border-bottom: 1px dashed var(--line); position: relative; }
.prod-row .field { margin-bottom: 6px; }
.prod-row .icon-btn { position: absolute; top: 2px; right: -6px; }
.prod-row .field:first-child { padding-right: 30px; }
@media (min-width: 700px) { .prod-row { grid-template-columns: 2fr 1.2fr 1fr 1fr 38px; } .prod-row .icon-btn { position: static; margin-bottom: 8px; } .prod-row .field:first-child { padding-right: 0; } }

#modal-root { position: fixed; inset: 0; z-index: 100; }
.backdrop { position: absolute; inset: 0; background: rgba(10, 20, 10, .45); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.modal form { display: flex; flex-direction: column; min-height: 0; max-height: 92vh; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.modal header h2 { margin: 0; font-size: 1.1rem; }
.mbody { padding: 6px 16px 10px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
@media (min-width: 700px) {
  .backdrop { align-items: center; padding: 24px; }
  .modal { max-width: 560px; border-radius: 18px; }
  .modal.wide { max-width: 860px; }
}

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #1d2a1f; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 200; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { #toast { bottom: 24px; } }

/* ---------- login / conta ---------- */
body.booting .sidenav, body.booting .main-wrap, body.booting .bottomnav,
body.auth-mode .sidenav, body.auth-mode .main-wrap, body.auth-mode .bottomnav { display: none !important; }
body.auth-mode { display: block; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; padding-top: max(24px, env(safe-area-inset-top)); }
.auth-card { width: 100%; max-width: 420px; padding: 24px 20px; margin: 0; }
.auth-card h2 { font-size: 1.3rem; margin: 8px 0 12px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.auth-brand strong { display: block; font-size: 1.1rem; color: var(--brand); }
.auth-brand small { display: block; }
.auth-msg { margin: 0 0 12px; font-size: .9rem; }
.auth-msg:empty { display: none; }
.auth-msg.err { color: var(--red-ink); background: var(--red-soft); padding: 8px 12px; border-radius: 10px; }
.auth-msg.info { color: var(--green-ink); background: var(--green-soft); padding: 8px 12px; border-radius: 10px; }
.auth-links { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 16px; font-size: .9rem; }
.auth-foot { margin-top: 14px; font-size: .9rem; }
.auth-loading { text-align: center; padding: 24px 0; color: var(--muted); }
.auth-card .check { align-items: flex-start; font-size: .88rem; }
.auth-card .check input { margin-top: 2px; flex: none; }
.btn.block { width: 100%; min-height: 46px; font-size: 1rem; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; cursor: pointer; opacity: .6; font-size: 1rem; }
.spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.sync { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.sync.busy i { background: var(--pipe); animation: pulse 1s ease-in-out infinite; }
.sync.off i { background: var(--yellow); }
.sync.err i { background: var(--red); }
.sync.err, .sync.off { color: var(--text); }
@keyframes pulse { 50% { opacity: .3; } }
@media (max-width: 599px) { .sync.ok span, .sync.busy span { display: none; } }
.account-banner { padding: 10px 16px; font-size: .9rem; text-align: center; }
.account-banner.warn { background: var(--yellow-soft); color: var(--yellow-ink); }
.account-banner.err { background: var(--red-soft); color: var(--red-ink); }
.account-banner a { font-weight: 700; color: inherit; }
.acct-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.versions { list-style: none; margin: 0; padding: 0; }
.versions li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.versions small { display: block; }
.pay-opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; }
.pay-opt input { margin-top: 3px; flex: none; }
.pay-opt small { display: block; }
.account-banner .link-btn { font-weight: 700; color: inherit; text-decoration: underline; }

/* ---------- contas: custos e lucro ---------- */
.fin-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px 6px; scrollbar-width: none; }
.fin-tabs::-webkit-scrollbar { display: none; }
.fin-tabs a { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-size: .88rem; font-weight: 600; }
.fin-tabs a.on { background: var(--brand); border-color: var(--brand); color: var(--ink-on-brand); }
.fin-ex { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; background: var(--yellow-soft); color: var(--yellow-ink); }
.fin-ex .row-btns { margin: 0; }
.fin-foot { margin-top: 4px; }
.neg { color: var(--red-ink); }
.kpi.bad { border-color: var(--red); background: var(--red-soft); }
.kpi small { display: block; margin-top: 2px; }
.kpis.three { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.fin-cols { display: grid; gap: 0 16px; min-width: 0; }
@media (min-width: 1000px) { .fin-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.fin-dre td { white-space: normal; vertical-align: top; }
.tbl.fin-dre td small { display: block; font-size: .78rem; }
.tbl.fin-dre td.num { white-space: nowrap; font-weight: 600; }
.tbl tr.total td { font-weight: 700; background: var(--surface-2); }
.tbl tr.sep td { border-top: 2px solid var(--line); }
.tbl tr.cur td { background: var(--brand-soft); font-weight: 600; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr auto; gap: 4px 12px; align-items: center; font-size: .9rem; }
.hbar .ht { height: 12px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar .ht i { display: block; height: 100%; min-width: 2px; background: var(--pipe); border-radius: 0 4px 4px 0; }
.hbar.good .ht i { background: var(--green); }
.hbar.bad .ht i { background: var(--red); }
.hbar.good .hl, .hbar.bad .hl { font-weight: 700; }
.hbar .hv { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.hbar .hv small { display: block; color: var(--muted); font-weight: 400; }
@media (max-width: 520px) { .hbar { grid-template-columns: 1fr auto; } .hbar .ht { grid-column: 1 / -1; grid-row: 2; } }
.chart { width: 100%; max-width: 620px; height: auto; display: block; overflow: visible; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .tl { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .pos { fill: var(--green); }
.chart .neg { fill: var(--red); }
.chart .hit { fill: transparent; }
.chart g:hover .pos, .chart g:hover .neg { opacity: .7; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
.chart .pt { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.chart .pt.neg { fill: var(--red); }
.chart g:hover .pt { r: 5; }
.chart .cur { stroke: var(--muted); stroke-dasharray: 4 3; }
.chart .curl { fill: var(--text); font-size: 10px; font-weight: 600; }
.fin-field { display: grid; grid-template-columns: 1fr; gap: 6px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.fin-field:last-child { border-bottom: 0; }
.fin-field .fl { font-weight: 600; }
.fin-field .fl small { display: block; font-weight: 400; margin-top: 2px; }
.fi { display: flex; align-items: center; gap: 8px; }
.fi input { min-width: 0; }
.fi em { font-style: normal; color: var(--muted); font-size: .85rem; white-space: nowrap; min-width: 34px; }
.fin-field .fi { max-width: 260px; }
.fin-tip { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .88rem; background: var(--brand-soft); border-radius: 10px; padding: 8px 10px; }
@media (min-width: 700px) { .fin-field { grid-template-columns: 1fr 240px; align-items: center; } }
.fin-list { display: flex; flex-direction: column; margin-bottom: 4px; }
.fin-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: end; }
.fin-row .c-head { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; }
.fin-row .c-head input { flex: 1; min-width: 0; }
.fin-row label, .fin-row .c-out { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fin-row .ml { font-size: .74rem; color: var(--muted); font-weight: 600; }
.fin-row .c-out b { padding: 10px 0; font-variant-numeric: tabular-nums; }
.fin-row.head { display: none; }
.fin-row.cost { grid-template-columns: minmax(0, 1fr) 150px 32px; align-items: center; }
.fin-row.cost label.fi { flex-direction: row; align-items: center; }
.num-in { text-align: right; font-variant-numeric: tabular-nums; }
.fin-flow .fi { width: 96px; }
.fin-flow input { min-height: 34px; padding: 5px 8px; }
.fin-sub { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0 2px; font-weight: 700; }
.fin-sub + .btn, .fin-sub + .fin-sub + .btn { margin-top: 12px; }
@media (min-width: 1100px) {
  .fin-row.inv { grid-template-columns: minmax(140px, 1fr) 70px 110px 115px 80px 115px 32px; align-items: center; }
  .fin-row.inv .c-head { display: contents; }
  .fin-row.inv .c-head .del { order: 9; }
  .fin-row.inv .ml { display: none; }
  .fin-row.inv .c-out b { text-align: right; padding: 0; }
  .fin-row.head { display: grid; font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; padding: 4px 0; }
  .fin-row.head .r { text-align: right; }
}
.sim-grid { display: grid; gap: 12px 24px; margin-bottom: 14px; }
@media (min-width: 700px) { .sim-grid { grid-template-columns: 1fr 1fr; } }
.sim-ctl { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
input[type="range"] { padding: 0; border: 0; background: transparent; min-height: 32px; accent-color: var(--brand); }

/* =====================================================================
   Identidade visual (sobrepõe o básico acima)
   ===================================================================== */
:root { --inv-bg: var(--ink); --inv-fg: var(--lime); --focus: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --inv-bg: var(--lime); --inv-fg: var(--ink); --focus: var(--lime); } }
:root[data-theme="dark"] { --inv-bg: var(--lime); --inv-fg: var(--ink); --focus: var(--lime); }

h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 1.14rem; }
a { text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* números e rótulos com cara de instrumento */
.kpi b, .readings, .tbl td.num, .tbl th, .upcoming .when, .tl-date, .kv dd, .fin-sub b, .hbar .hv, .num-in, .chip, .tag, .ttag,
.fin-row .c-out b, .sim-ctl span b, .sel-info b, .tank-info small, .bc-foot, .spark figcaption, .acct-line b { font-family: var(--mono); }
.kpi { border-radius: var(--radius); box-shadow: none; padding: 14px 16px; position: relative; }
.kpi > span:first-child { display: block; font: 600 .66rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 8px; }
.kpi b { font-weight: 600; font-size: 1.55rem; letter-spacing: -.03em; }
.kpi.good { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 55%, transparent); }
.kpi.good::after, .kpi.bad::after { content: ""; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.kpi.bad::after { background: var(--red); }
.chip { border-radius: 4px; font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; padding: 3px 8px; }
.chip::before { width: 6px; height: 6px; border-radius: 2px; }
.tag, .ttag { border-radius: 4px; text-transform: uppercase; letter-spacing: .05em; font-size: .66rem; }
.tbl th { font-size: .66rem; letter-spacing: .08em; font-weight: 600; }
.tbl td.num { font-weight: 500; }
.tbl.fin-dre td.num { font-weight: 600; }

/* topo, menu lateral e barra inferior em verde-tinta */
.topbar { background: color-mix(in srgb, var(--bg) 90%, transparent); }
.topbar h1 { font-size: 1.3rem; font-weight: 750; letter-spacing: -.03em; }
.brand-mini { color: var(--text); }
.brand-mini img { border-radius: 7px; }
.bottomnav { background: var(--ink); border-top: 0; }
.bottomnav a { color: var(--on-ink-muted); font-weight: 500; font-size: .7rem; gap: 4px; }
.bottomnav a .ic { width: 52px; height: 28px; padding: 4px 16px; border-radius: 999px; transition: background .15s; }
.bottomnav a.active { color: var(--lime); }
.bottomnav a.active .ic { background: var(--lime); color: var(--ink); }
@media (min-width: 900px) {
  body { grid-template-columns: 240px 1fr; }
  .sidenav { background: var(--ink); color: var(--on-ink); border-right: 0; padding: 20px 12px; gap: 2px; }
  .sidenav .brand { padding: 2px 8px 22px; }
  .sidenav .brand img { border-radius: 8px; }
  .sidenav .brand strong { color: #fbf9f2; font-size: 1.08rem; letter-spacing: -.02em; }
  .sidenav .brand small { color: var(--on-ink-muted); font-size: .78rem; }
  .sidenav a { position: relative; color: var(--on-ink); border-radius: 6px; font-weight: 500; padding: 10px 12px; }
  .sidenav a .ic { color: var(--on-ink-muted); }
  .sidenav a:hover { background: var(--ink-2); }
  .sidenav a.active { background: var(--ink-2); color: var(--lime); font-weight: 650; }
  .sidenav a.active .ic { color: var(--lime); }
  .sidenav a.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 3px 3px 0; background: var(--lime); }
  .topbar { padding: 16px 32px; }
  main { padding: 26px 32px 48px; }
}

/* cartões, botões e campos */
.card { border-radius: var(--radius); box-shadow: none; }
.btn { border-radius: 6px; font-weight: 600; min-height: 40px; transition: background .12s, transform .12s, box-shadow .12s; }
.btn.primary { background: var(--lime); border: 1.5px solid var(--ink); color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
.btn.primary:hover { background: var(--lime-2); }
.btn.primary:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--ink); }
.btn.danger { border-radius: 6px; }
.icon-btn { border-radius: 6px; }
.seg { border-radius: 6px; }
.seg button.on { background: var(--inv-bg); color: var(--inv-fg); }
input, select, textarea { border-radius: 6px; background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--focus) 70%, transparent); border-color: var(--focus); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); }
.field > span { font: 600 .68rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .07em; }
.field-set { border-radius: 8px; }
.pill-info { border-radius: 6px; border-left: 3px solid var(--inv-bg); }
.guide { border-radius: 6px; border-left: 3px solid var(--brand); }
.bench-card { border-radius: 8px; }
.lot, .app-item { border-radius: 8px; }
.atile { border-radius: 8px; }
.modal { border-radius: 16px 16px 0 0; }
@media (min-width: 700px) { .modal { border-radius: 14px; } }
.modal header h2 { font-size: 1.25rem; letter-spacing: -.02em; }
#toast { background: var(--ink); color: #fbf9f2; border-radius: 6px; font: 500 .85rem var(--mono); border: 1px solid var(--ink-3); }
.empty h2, .welcome h2 { font-size: 1.6rem; letter-spacing: -.03em; }
.welcome img { margin: 0 auto 14px; border-radius: 14px; }
.more-item .ic { color: var(--text); }
.account-banner { font-weight: 500; }

/* abas da tela Contas: sublinhado */
.fin-tabs { gap: 2px; margin-bottom: 18px; padding-bottom: 0; border-bottom: 1px solid var(--line); }
.fin-tabs a { border: 0; border-radius: 0; background: none; padding: 10px 12px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600; }
.fin-tabs a:hover { color: var(--text); }
.fin-tabs a.on { background: none; color: var(--text); border-bottom-color: var(--inv-bg); }
.fin-ex { border-left: 3px solid var(--yellow); }

/* ---------- tela de login com painel da marca ---------- */
.auth-wrap { padding: 24px 16px; }
.auth-side { display: none; }
.auth-card { border-radius: 14px; box-shadow: none; }
.auth-card h2 { font-size: 1.7rem; letter-spacing: -.03em; font-weight: 750; }
.auth-brand strong { color: var(--text); letter-spacing: -.02em; }
.auth-brand img { border-radius: 10px; }
.auth-back { display: inline-block; margin-top: 14px; font-size: .9rem; color: var(--muted); }
@media (min-width: 960px) {
  body.auth-mode #auth-root { min-height: 100vh; }
  .auth-wrap { display: grid; grid-template-columns: minmax(420px, 1fr) 1fr; padding: 0; min-height: 100vh; align-items: stretch; }
  .auth-side { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; background: var(--ink); color: var(--on-ink); padding: 40px 48px; }
  .auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
  .auth-card .auth-brand { display: none; }
  .auth-card { border: 0; background: transparent; }
}
.auth-main { width: 100%; display: flex; flex-direction: column; align-items: center; }
.auth-logo { display: inline-flex; align-items: center; gap: 10px; color: #fbf9f2; text-decoration: none; font-weight: 750; font-size: 1.15rem; letter-spacing: -.02em; }
.auth-logo img { border-radius: 9px; }
.auth-k { font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--lime); margin: 0 0 16px; }
.auth-side h2 { font-size: clamp(2.2rem, 3.6vw, 3.3rem); line-height: .98; letter-spacing: -.04em; font-weight: 800; color: #fbf9f2; margin: 0 0 28px; max-width: 12ch; }
.auth-side h2 em { font-style: normal; color: var(--lime); }
.auth-bench { display: grid; gap: 8px; max-width: 420px; margin-bottom: 26px; }
.auth-bench p { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin: 0; padding: 5px 9px; border-radius: 999px; background: var(--ink-2); }
.auth-bench i { aspect-ratio: 1; border-radius: 50%; background: var(--c); }
.auth-bench i.r { box-shadow: 0 0 0 2px var(--lime); }
.auth-side ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.auth-side li { display: flex; align-items: center; gap: 10px; font-weight: 550; }
.auth-side li::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--lime); flex: none; }
.auth-side small { color: var(--on-ink-muted); font: 500 .76rem var(--mono); }

.atile .st { font: 600 .66rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .06em; margin: 2px 0 4px; }
.atile strong, .atile b { font-size: 1rem; letter-spacing: -.01em; }
.atile small { font-family: var(--mono); font-size: .72rem; }
.hbar .ht i { background: color-mix(in srgb, var(--text) 72%, transparent); }
.hbar.good .ht i { background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--ink); }
.chart .line { stroke: var(--text); }

/* tema escuro escolhido à mão em Ajustes (mesmos valores do automático) */
:root[data-theme="dark"] {
  --bg: #0c1611; --surface: #13211a; --surface-2: #1a2b21; --text: #ebe6d6; --muted: #9aa898; --line: #26392d;
  --brand: #c5ec3f; --brand-2: #d8f57a; --brand-soft: #1f3322; --ink-on-brand: #10231a;
  --tank: #1a2a33; --tank-line: #4b6170;
  --red-soft: #3a1c18; --red-ink: #ff9d92; --yellow-soft: #3a3014; --yellow-ink: #ffd76a; --green-soft: #183522; --green-ink: #9ae2a4;
  --gray-soft: #22302a; --gray-ink: #a9b6a6;
  --hole-empty: #22332a; --tube: #2c3f33; --tube-edge: #36493c; --sel: #7cb8ff;
  --shadow: none;
}

/* primeiros passos */
.onb .card-head h2 small { font: 500 .78rem var(--mono); margin-left: 6px; }
.onb-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-bottom: 12px; }
.onb-bar i { display: block; height: 100%; background: var(--lime); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 40%, transparent); }
.onb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.onb-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.onb-list a { color: var(--text); font-weight: 600; }
.onb-list s { color: var(--muted); }
.onb-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; }
.onb-list li.ok .onb-dot { background: var(--lime); border-color: var(--ink); color: var(--ink); }
.onb-dot .ic { width: 12px; height: 12px; stroke-width: 3; }

/* produção real nas Contas */
.real-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.real-grid div { background: var(--surface); padding: 12px 14px; }
.real-grid small { display: block; font: 600 .66rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.real-grid b { display: block; font: 600 1.35rem/1.1 var(--mono); letter-spacing: -.02em; }
.real-grid span { font-size: .8rem; color: var(--muted); }

/* rastreabilidade */
.trace-filters { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 0 12px; }
@media (max-width: 520px) { .trace-filters { grid-template-columns: 1fr; } }
.lot-code { font-family: var(--mono); font-weight: 600; }
.trace-tbl td { vertical-align: middle; }
.lot-sheet .sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-k { font: 600 .7rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 6px; }
.lot-sheet .sheet-head h2 { font-size: 2rem; letter-spacing: -.035em; margin: 0 0 4px; font-family: var(--display); }
.lot-sheet .sheet-head p { margin: 0; display: flex; align-items: center; gap: 6px; }
.sheet-kv { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.sheet-kv .wide { grid-column: 1 / -1; }
.vio { margin: 6px 0 0; padding-left: 18px; }
.sheet-foot { margin-top: 8px; }

/* impressão / PDF da ficha do lote */
@media print {
  @page { margin: 14mm; }
  .sidenav, .bottomnav, .topbar, .account-banner, #toast, #cookie-banner, .no-print, #modal-root { display: none !important; }
  body { display: block !important; background: #fff !important; color: #000 !important; font-size: 11pt; }
  main { padding: 0 !important; max-width: none; }
  .card, .sheet-kv { border: 1px solid #bbb !important; break-inside: avoid; box-shadow: none !important; background: #fff !important; }
  a { color: #000 !important; text-decoration: none !important; }
  .chip, .ttag, .safety-banner { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (min-width: 900px) { .real-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }

/* colheita: furos colhidos → unidades para venda */
.harv-box { display: grid; grid-template-columns: auto auto 1fr; gap: 10px 14px; align-items: center; background: var(--surface-2); border-radius: 10px; padding: 12px 14px; margin: 4px 0 6px; }
.harv-from small { display: block; font: 600 .66rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.harv-from b { font: 600 2rem/1 var(--mono); }
.harv-arrow { font: 600 1.4rem var(--mono); color: var(--muted); }
.harv-to { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 0 10px; }
.harv-to .field { margin-bottom: 0; }
@media (max-width: 560px) { .harv-box { grid-template-columns: 1fr; } .harv-arrow { display: none; } }
.harv-prev { margin: 4px 0 12px; font-size: .9rem; min-height: 1.4em; }

/* manejo sugerido */
.mj .card-head h2 { display: flex; align-items: center; gap: 8px; }
.mj .card-head h2 .ic { color: var(--yellow); }
.mj .card-head h2 small { font: 500 .78rem var(--mono); }
.mj-item { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--surface); }
.mj-item summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; }
.mj-item summary::-webkit-details-marker { display: none; }
.mj-item summary::after { content: "+"; margin-left: auto; font: 600 1.1rem var(--mono); color: var(--muted); }
.mj-item[open] summary::after { content: "–"; }
.mj-item summary .muted { font-size: .85rem; }
.mj-cat { width: 10px; height: 10px; border-radius: 3px; background: var(--muted); flex: none; }
.mj-cat.c-praga { background: var(--red); } .mj-cat.c-doenca { background: #8e5bd6; } .mj-cat.c-ambiente { background: var(--pipe); } .mj-cat.c-nutricao { background: var(--yellow); }
.mj-body { padding: 0 14px 14px; border-top: 1px dashed var(--line); }
.mj-body h4, .mj-block h4 { font: 600 .68rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 6px; }
.mj-sign { margin: 10px 0 0; font-size: .92rem; }
.mj-quote { margin: 10px 0 0; font-style: italic; color: var(--muted); font-size: .9rem; }
.mj-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .92rem; }
.mj-list li::marker { color: var(--brand); }
.mj-list.prevent li::marker { color: var(--muted); }
.mj-body .row-btns { margin-top: 12px; }
.mj-block { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.mj-block h3 { font-size: 1.1rem; display: flex; align-items: center; gap: 8px; margin: 0; }
.mj-note { margin: 10px 0 0; border-left: 3px solid var(--yellow); padding-left: 10px; }

/* agrofit */
.ag-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 8px; }
.ag-item { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--surface); }
.ag-item header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.ag-item p { margin: 2px 0; }
.ag-item .row-btns { margin-top: 8px; }
.tag.ag-bio { background: var(--green-soft); color: var(--green-ink); }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; vertical-align: -3px; margin-right: 6px; }

/* verificação anti-robô (Turnstile) */
.captcha { min-height: 65px; margin: 4px 0 12px; display: flex; justify-content: center; }
