/* ============ Minami CPro — design system ============ */
:root {
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 14px; --r-sm: 9px; --sidebar-w: 248px; --topbar-h: 60px; --tabbar-h: 62px;
  --ok: #2f7d4f; --warn: #c98a1b; --danger: #b3402e; --info: #2f6f8f; --purple: #7d3c98;
}
[data-theme="light"] {
  --bg: #f4f2e9; --surface: #fbfaf4; --surface-2: #efede1; --surface-3: #e6e3d3; --border: #dad6c4; --border-2: #c9c4ac;
  --text: #17261d; --muted: #5e6e63; --faint: #8a978d;
  --primary: #1e4b33; --primary-2: #2b6a47; --primary-soft: #dfeadf; --on-primary: #f6f4ea;
  --accent: #d9b13b; --accent-soft: #f6ecc8;
  --side-bg: linear-gradient(180deg, #1b4430 0%, #12301f 100%); --side-text: #e8efe4; --side-muted: #9fb7a6;
  --shadow: 0 1px 2px rgba(23,38,29,.06), 0 6px 18px rgba(23,38,29,.07);
  --ok-soft: #dcefe2; --warn-soft: #f7ead0; --danger-soft: #f5dcd6; --info-soft: #d9e8ef; --purple-soft: #ecdff2;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0b140f; --surface: #111d16; --surface-2: #172619; --surface-3: #1e3123; --border: #243a2b; --border-2: #35503f;
  --text: #e7efe6; --muted: #94a89a; --faint: #66796c;
  --primary: #52b983; --primary-2: #3b9c69; --primary-soft: #183624; --on-primary: #07130c;
  --accent: #e3bc4a; --accent-soft: #3a3115;
  --side-bg: linear-gradient(180deg, #0d1c13 0%, #08120c 100%); --side-text: #e3ece2; --side-muted: #7f9686;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.35);
  --ok: #54c283; --warn: #e0a93a; --danger: #e5705c; --info: #5ab0d4; --purple: #b778d4;
  --ok-soft: #153123; --warn-soft: #3a2e12; --danger-soft: #3e1d17; --info-soft: #12303d; --purple-soft: #2e1b38;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body.sem-scroll { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0 0 .6em; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
.ico { flex: none; }
small, .muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1rem; min-height: 42px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); border-radius: 11px; cursor: pointer; font-weight: 600; font-size: .92rem; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primario { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: 0 2px 8px rgba(30,75,51,.25); }
.btn.primario:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.perigo { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.perigo.suave { background: transparent; color: var(--danger); border-color: var(--border-2); }
.btn.perigo.suave:hover { background: var(--danger-soft); }
.btn.pequeno { min-height: 34px; padding: .35rem .7rem; font-size: .84rem; border-radius: 9px; }
.btn.icone { padding: 0; width: 42px; }
.btn.icone.pequeno { width: 34px; }
.btn.bloco { width: 100%; }

/* ---------- formulário ---------- */
.campo { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.rotulo { font-size: .8rem; font-weight: 650; color: var(--muted); letter-spacing: .01em; }
.dica { color: var(--faint); font-size: .78rem; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=month], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: .6rem .8rem; background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
textarea { min-height: 80px; resize: vertical; }
input[type=file] { width: 100%; padding: .5rem; background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: 10px; color: var(--text); }
input[type=file]::file-selector-button { margin-right: .7rem; padding: .5rem .9rem; border: 0; border-radius: 8px; background: var(--primary); color: var(--on-primary); font: 650 .88rem var(--font); cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--primary); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 18px; height: 18px; }
.grade { display: grid; gap: .9rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade .span2 { grid-column: 1 / -1; }
.linha { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.linha.entre { justify-content: space-between; }
.fluxo { display: flex; flex-direction: column; gap: 1rem; }
.sw { display: flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; }

/* ---------- cartões / chips ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; }
.card.sem-pad { padding: 0; overflow: hidden; }
.card h3 { font-size: 1rem; margin-bottom: .7rem; }
.card-cab { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-cab h3 { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 99px; font-size: .75rem; font-weight: 650; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.chip.ok, .chip.adequado { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn, .chip.media, .chip.baixo { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.baixo { background: var(--danger-soft); color: var(--danger); }
.chip.danger, .chip.alta { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.alto { background: var(--purple-soft); color: var(--purple); border-color: transparent; }
.chip.info, .chip.baixa { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 70%, var(--text)); border-color: transparent; }
.chip.btn-chip { cursor: pointer; font-family: inherit; }
.chip.btn-chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.ativo { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: .45rem .8rem; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--muted); }
.seg button.ativo { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- tabelas ---------- */
.tabela-wrap { overflow: auto; border-radius: var(--r-sm); max-width: 100%; }
table.tab { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tab th, .tab td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tab th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tab td.n, .tab th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tab tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.tab td.c-baixo { background: var(--danger-soft); color: var(--danger); font-weight: 650; }
.tab td.c-alto { background: var(--purple-soft); color: var(--purple); font-weight: 650; }
.tab td.c-adequado { color: var(--ok); }
.acoes { display: flex; gap: .25rem; justify-content: flex-end; }

/* ---------- estados ---------- */
.carregando { display: flex; align-items: center; justify-content: center; gap: .7rem; padding: 2.5rem; color: var(--muted); }
.spin { width: 22px; height: 22px; border: 3px solid var(--border-2); border-top-color: var(--primary); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.vazio { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.vazio .ico { color: var(--primary); opacity: .6; }
.vazio strong { color: var(--text); }
.aviso { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .9rem; border-radius: 10px; background: var(--info-soft); color: var(--text); font-size: .88rem; border: 1px solid transparent; }
.aviso .ico { color: var(--info); margin-top: 1px; }
.aviso.warn { background: var(--warn-soft); } .aviso.warn .ico { color: var(--warn); }
.aviso.erro { background: var(--danger-soft); } .aviso.erro .ico { color: var(--danger); }
.aviso.ok { background: var(--ok-soft); } .aviso.ok .ico { color: var(--ok); }
.aviso ul { margin: .2rem 0 0; padding-left: 1.1rem; }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(6,14,9,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 1rem; animation: aparece .15s; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; width: min(560px, 100%); max-height: min(92dvh, 900px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.35); animation: sobe .2s; }
.modal.largo { width: min(860px, 100%); }
.modal-cab { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem .6rem; }
.modal-cab h3 { font-size: 1.1rem; }
.modal-corpo { padding: .4rem 1.2rem 1.1rem; overflow: auto; }
.modal-rod { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.2rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes aparece { from { opacity: 0; } }
@keyframes sobe { from { transform: translateY(14px); opacity: 0; } }
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 3000; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: 12px; background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow); font-size: .9rem; animation: sobe .2s; }
.toast.erro { background: var(--danger); color: #fff; } .toast.info { background: #28465a; color: #fff; }
.toast.saindo { opacity: 0; transition: opacity .3s; }

/* ============ shell ============ */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; padding: 1.1rem .8rem; gap: .4rem; overflow-y: auto; }
.marca { display: flex; align-items: center; gap: .65rem; padding: .3rem .5rem 1rem; }
.marca-logo { width: 38px; height: 38px; flex: none; }
.marca strong { font-size: 1.15rem; letter-spacing: -.02em; color: #fff; display: block; line-height: 1.1; }
.marca small { color: var(--side-muted); font-size: .72rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button.item { display: flex; align-items: center; gap: .75rem; padding: .66rem .8rem; border-radius: 11px; color: var(--side-text); text-decoration: none; font-weight: 600; font-size: .92rem; border: 0; background: transparent; cursor: pointer; width: 100%; text-align: left; position: relative; }
.nav a:hover, .nav button.item:hover { background: rgba(255,255,255,.07); }
.nav a.ativo { background: rgba(255,255,255,.11); }
.nav a.ativo::before { content: ""; position: absolute; left: -.8rem; top: 22%; bottom: 22%; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.nav .sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 1.55rem; padding-left: .8rem; border-left: 1px solid rgba(255,255,255,.14); }
.nav .sub a { padding: .42rem .7rem; font-size: .85rem; font-weight: 550; color: var(--side-muted); }
.nav .sub a.ativo { color: #fff; background: rgba(255,255,255,.09); }
.nav .sub a.ativo::before { display: none; }
.side-rodape { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; padding-top: .8rem; border-top: 1px solid rgba(255,255,255,.1); }
.side-rodape .usuario { display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem; color: var(--side-muted); font-size: .85rem; overflow: hidden; }
.side-rodape .usuario span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-btn { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: 10px; border: 0; background: rgba(255,255,255,.06); color: var(--side-text); cursor: pointer; font-weight: 600; font-size: .86rem; width: 100%; }
.side-btn:hover { background: rgba(255,255,255,.12); }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: var(--topbar-h); padding: .6rem 1.6rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 1.3rem; }
.topbar .sub { color: var(--muted); font-size: .85rem; }
.topbar-acoes { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.mobile-marca { display: none; align-items: center; gap: .55rem; }
.content { padding: 1.5rem 1.6rem 2.5rem; flex: 1; min-width: 0; max-width: 1400px; width: 100%; margin: 0 auto; }
.content.cheio { padding: 0; max-width: none; margin: 0; }
.tabbar { display: none; }

.pagina { display: flex; flex-direction: column; gap: 1.2rem; }
.abas { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: thin; }
.aba { padding: .5rem .95rem; border-radius: 99px; border: 1px solid var(--border-2); background: var(--surface); text-decoration: none; color: var(--muted); font-weight: 650; font-size: .87rem; white-space: nowrap; cursor: pointer; }
.aba:hover { border-color: var(--primary); color: var(--primary); }
.aba.ativo { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.aba.ia { display: inline-flex; align-items: center; gap: .35rem; }

/* ---------- painel ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; }
.kpi { padding: 1rem 1.1rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .15rem; position: relative; overflow: hidden; }
.kpi .v { font-size: 1.9rem; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: .9rem; font-weight: 600; color: var(--muted); margin-left: .2rem; }
.kpi .t { font-size: .78rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.kpi.alerta .v { color: var(--danger); }
.dash-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1rem; }
.barras { display: flex; flex-direction: column; gap: .55rem; }
.barra { display: grid; grid-template-columns: 90px 1fr auto; gap: .6rem; align-items: center; font-size: .85rem; }
.barra .trilho { height: 11px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.barra .fill { height: 100%; background: linear-gradient(90deg, var(--primary-2), var(--primary)); border-radius: 99px; }
.lista { display: flex; flex-direction: column; }
.lista .item { display: flex; align-items: center; gap: .7rem; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.lista .item:last-child { border-bottom: 0; }
.lista .item .grow { flex: 1; min-width: 0; }
.lista .item .grow strong, .lista .item .grow span { display: block; overflow: hidden; text-overflow: ellipsis; }
.pill-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.pill-dot.alta { background: var(--danger); } .pill-dot.media { background: var(--warn); } .pill-dot.baixa { background: var(--info); }

/* ---------- áreas ---------- */
.lote { overflow: hidden; }
.lote-cab { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.2rem; cursor: pointer; flex-wrap: wrap; }
.lote-cab .titulo { flex: 1; min-width: 160px; }
.lote-cab h3 { margin: 0; font-size: 1.05rem; }
.lote-cab .chev { transition: transform .2s; color: var(--muted); }
.lote.aberto .chev { transform: rotate(90deg); }
.lote-corpo { display: none; border-top: 1px solid var(--border); }
.lote.aberto .lote-corpo { display: block; }
.talhao-cards { display: none; }
.stat-linha { display: flex; gap: 1.2rem; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.stat-linha b { color: var(--text); font-variant-numeric: tabular-nums; }
.dropzone { border: 2px dashed var(--border-2); border-radius: 14px; padding: 1.4rem; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.sobre { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .ico { color: var(--primary); }
.dropzone input { display: none; }
input.auto { background: var(--primary-soft); border-color: var(--primary); font-weight: 700; }
/* campo de arquivo */
.arq { display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; background: var(--surface-2); border: 1.5px dashed var(--border-2); border-radius: 12px; min-height: 52px; transition: border-color .15s, background .15s; }
.arq:hover { border-color: var(--primary); }
.arq.tem { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
.arq-btn { display: inline-flex; align-items: center; gap: .45rem; flex: none; padding: .55rem .95rem; border: 0; border-radius: 9px; background: var(--primary); color: var(--on-primary); font: 700 .88rem var(--font); cursor: pointer; }
.arq-btn:hover { filter: brightness(1.1); }
.arq-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 2px; }
.arq-nome { flex: 1; min-width: 0; font-size: .9rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.arq.tem .arq-nome { color: var(--text); font-weight: 600; }
.arq-x { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.arq-x:hover { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.arq-info { font-size: .83rem; margin-top: .35rem; color: var(--muted); }
.arq-info.ok { color: var(--primary); font-weight: 600; }
.arq-info.erro { color: var(--danger); font-weight: 600; }
.preview-pop { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; font-size: .88rem; }
.preview-pop b { font-variant-numeric: tabular-nums; }

/* ---------- análises ---------- */
.arvore-dados details { border-bottom: 1px solid var(--border); }
.arvore-dados summary { list-style: none; cursor: pointer; padding: .75rem 1rem; display: flex; align-items: center; gap: .6rem; font-weight: 650; }
.arvore-dados summary::-webkit-details-marker { display: none; }
.arvore-dados summary::before { content: "▸"; color: var(--muted); transition: transform .15s; display: inline-block; }
.arvore-dados details[open] > summary::before { transform: rotate(90deg); }
.arvore-dados details details { margin-left: 1.2rem; }
.arvore-dados .periodo-linha { display: flex; align-items: center; gap: .7rem; padding: .55rem 1rem .55rem 2.4rem; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.arvore-dados .periodo-linha .grow { flex: 1; min-width: 150px; }
.dist { display: flex; height: 9px; border-radius: 99px; overflow: hidden; background: var(--surface-3); min-width: 90px; }
.dist i { display: block; height: 100%; }
.dist .b { background: var(--danger); } .dist .a { background: var(--ok); } .dist .h { background: var(--purple); }
.cruz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .8rem; }
.diag { padding: .9rem 1rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); border-left: 5px solid var(--info); display: flex; flex-direction: column; gap: .35rem; }
.diag.alta { border-left-color: var(--danger); } .diag.media { border-left-color: var(--warn); } .diag.baixa { border-left-color: var(--ok); }
.diag small { color: var(--muted); }
.checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
.check-item { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); font-size: .88rem; }
.check-item .ico { color: var(--faint); } .check-item.tem .ico { color: var(--ok); }
.ia-progresso { display: flex; align-items: center; gap: 1rem; padding: 1.4rem; border-radius: var(--r); background: linear-gradient(135deg, var(--primary-soft), var(--surface)); border: 1px solid var(--border); }
.ia-progresso .spin { width: 30px; height: 30px; }

/* ---------- recomendações ---------- */
.rec { background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--info); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; break-inside: avoid; }
.rec.alta { border-left-color: var(--danger); } .rec.media { border-left-color: var(--warn); } .rec.baixa { border-left-color: var(--info); }
.rec.concluida { opacity: .62; }
.rec-cab { display: flex; gap: .8rem; align-items: flex-start; padding: 1rem 1.2rem .6rem; flex-wrap: wrap; }
.rec-cab h3 { font-size: 1.05rem; flex: 1; min-width: 200px; margin: 0; }
.rec-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); border-top: 1px solid var(--border); margin-top: .5rem; }
.rec-bloco { background: var(--surface); padding: .8rem 1.2rem; }
.rec-bloco h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); margin-bottom: .3rem; display: flex; align-items: center; gap: .4rem; }
.rec-bloco p { margin: 0; font-size: .92rem; white-space: pre-wrap; }
.rec-just { padding: .7rem 1.2rem; font-size: .82rem; color: var(--muted); background: var(--surface-2); white-space: pre-wrap; border-top: 1px solid var(--border); }
.rec-rod { display: flex; gap: .5rem; padding: .6rem 1.2rem; align-items: center; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--border); }
.resumo-recs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
.print-cab { display: none; }
.prog { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--ok); }

/* ============ MAPAS ============ */
.mapa-wrap { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(100dvh - var(--topbar-h)); position: relative; }
.mapa-lado { background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; }
.mapa-lado section { padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.mapa-lado h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .6rem; }
.arv { list-style: none; margin: 0; padding: 0; }
.arv ul { list-style: none; margin: 0; padding-left: 1.1rem; border-left: 1px solid var(--border); margin-left: .75rem; }
.arv-no { display: flex; align-items: center; gap: .35rem; padding: .4rem .45rem; border-radius: 9px; cursor: pointer; font-size: .9rem; user-select: none; }
.arv-no:hover { background: var(--surface-2); }
.arv-no.sel { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.arv-no .chev { transition: transform .15s; color: var(--muted); width: 18px; display: inline-flex; justify-content: center; }
.arv-no .chev.aberto { transform: rotate(90deg); }
.arv-no .n { margin-left: auto; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.arv-no.lote-n { font-weight: 700; }
.mapa-area { position: relative; min-width: 0; background: #0b140f; }
#mapa { position: absolute; inset: 0; }
.leaflet-container { font-family: var(--font); background: #0f1a13; }
.mapa-flutuante { position: absolute; z-index: 800; display: flex; flex-direction: column; gap: .5rem; }
.mapa-flutuante.tl { top: .7rem; left: .7rem; right: 60px; }
.mapa-flutuante.br { bottom: 1.6rem; right: .7rem; align-items: flex-end; }
.mapa-flutuante .btn { box-shadow: var(--shadow); }
.mapa-coord { position: absolute; left: .7rem; bottom: .5rem; z-index: 800; font: 600 .72rem var(--mono); background: rgba(10,20,14,.72); color: #e8efe4; padding: .25rem .55rem; border-radius: 7px; pointer-events: none; }
.legenda { position: absolute; left: .7rem; bottom: 2.4rem; z-index: 800; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; box-shadow: var(--shadow); min-width: 190px; max-width: 260px; font-size: .78rem; }
.legenda strong { display: block; margin-bottom: .35rem; font-size: .8rem; }
.legenda .rampa { height: 12px; border-radius: 6px; border: 1px solid var(--border); }
.legenda .escala { display: flex; justify-content: space-between; margin-top: .2rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.legenda .ref { margin-top: .35rem; color: var(--muted); }
.gaveta { position: absolute; top: 0; right: 0; bottom: 0; width: min(390px, 100%); z-index: 900; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -10px 0 30px rgba(0,0,0,.2); display: flex; flex-direction: column; animation: desliza .22s; }
@keyframes desliza { from { transform: translateX(30px); opacity: 0; } }
.gaveta-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; padding: 1rem 1.1rem .6rem; }
.gaveta-cab h3 { font-size: 1.15rem; }
.gaveta-corpo { overflow-y: auto; padding: .2rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .88rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.valor-linha { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.valor-linha:last-child { border-bottom: 0; }
.valor-linha b { font-variant-numeric: tabular-nums; }
.pt-marca { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2.5px solid #000; color: #000; font: 800 11px/19px var(--font); text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.pt-marca.fraco { opacity: .45; }
.pt-marca.sel { transform: scale(1.25); border-color: var(--accent); box-shadow: 0 0 0 3px #000; }
.pt-valor { margin-top: 1px; transform: translateX(-50%); position: absolute; left: 50%; top: 24px; font: 700 10px var(--font); color: #fff; background: rgba(0,0,0,.72); padding: 0 4px; border-radius: 4px; white-space: nowrap; }
.mapa-toggle-lado { display: none; }
.camadas { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; }
.camada-btn { display: flex; align-items: center; gap: .45rem; padding: .5rem .6rem; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--text); text-align: left; }
.camada-btn:hover { border-color: var(--primary); }
.camada-btn.ativo { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.camada-btn i { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ============ login ============ */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--bg); }
.auth-arte { gap: 1.6rem; position: relative; overflow: hidden; background: radial-gradient(1200px 700px at 20% 10%, #2b6a47 0%, #17402b 45%, #0b1d13 100%); color: #eef3ea; display: flex; flex-direction: column; justify-content: flex-start; padding: 2.4rem; }
.auth-arte svg.fundo { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-arte > *:not(svg) { position: relative; z-index: 1; }
.auth-arte h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -.03em; line-height: 1.1; max-width: 22ch; }
.auth-arte p { color: #b9ccbd; max-width: 44ch; font-size: 1.02rem; }
.auth-tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.auth-tags span { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 99px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); font-size: .8rem; font-weight: 600; backdrop-filter: blur(4px); }
.auth-painel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.4rem; }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 1.1rem; }
.auth-card h1 { font-size: 1.7rem; }
.auth-mobile-marca { display: none; }
.input-icone { position: relative; }
.input-icone > .ico { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icone input { padding-left: 2.5rem; }
.input-icone .olho { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); }
.codigo-input { text-align: center; font: 700 1.9rem var(--mono); letter-spacing: .5em; padding-left: .5em; }
.auth-troca { text-align: center; color: var(--muted); font-size: .9rem; }
.auth-troca button { background: none; border: 0; color: var(--primary); font-weight: 700; cursor: pointer; padding: 0; }
.aviso-dev { border: 1px dashed var(--accent); background: var(--accent-soft); }
.tema-flutuante { position: fixed; top: .8rem; right: .8rem; z-index: 10; }
.tema-flutuante .btn { background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(6px); }

/* ============ responsivo ============ */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: .5rem 1rem; min-height: 56px; --topbar-h: 56px; }
  .topbar h1 { font-size: 1.1rem; }
  .mobile-marca { display: flex; }
  .topbar .sub { display: none; }
  .content { padding: 1rem 1rem calc(var(--tabbar-h) + 1.4rem); }
  .content.cheio { padding: 0; }
  .tabbar { display: grid; grid-template-columns: repeat(7, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabbar-h); z-index: 60; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 650; }
  .tabbar a.ativo { color: var(--primary); }
  .tabbar a.ativo .ico { stroke-width: 2.4; }
  .grade, .grade.g3 { grid-template-columns: 1fr; }
  .mapa-wrap { grid-template-columns: 1fr; height: calc(100dvh - 56px - var(--tabbar-h) - env(safe-area-inset-bottom)); }
  .mapa-lado { position: absolute; z-index: 950; left: 0; right: 0; bottom: 0; top: 18%; border-radius: 18px 18px 0 0; border: 1px solid var(--border); box-shadow: 0 -10px 40px rgba(0,0,0,.35); transform: translateY(105%); transition: transform .25s; }
  .mapa-wrap.lado-aberto .mapa-lado { transform: none; }
  .mapa-toggle-lado { display: inline-flex; }
  .gaveta { top: auto; left: 0; right: 0; width: 100%; max-height: 62%; border-left: 0; border-top: 1px solid var(--border); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.3); animation: sobe .22s; }
  .legenda { bottom: .6rem; left: .5rem; max-width: 56%; min-width: 150px; }
  .mapa-coord { display: none; }
  .mapa-flutuante.br { bottom: 4.2rem; }
  .tabela-talhoes { display: none; }
  .talhao-cards { display: flex; flex-direction: column; gap: .6rem; padding: .8rem; }
  .rec-grade { grid-template-columns: 1fr; }
  .modal { max-height: 94dvh; border-radius: 18px 18px 0 0; align-self: flex-end; width: 100%; }
  .overlay { padding: 0; align-items: flex-end; }
  .toasts { bottom: calc(var(--tabbar-h) + .6rem); left: .8rem; right: .8rem; max-width: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-arte { display: none; }
  .auth-mobile-marca { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
  .barra { grid-template-columns: 70px 1fr auto; }
}
@media (max-width: 420px) { .camadas { grid-template-columns: 1fr; } .kpi .v { font-size: 1.6rem; } }

/* ============ impressão (plano de ação) ============ */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .sidebar, .topbar, .tabbar, .toasts, .nao-imprimir, .btn { display: none !important; }
  .app { display: block; } .content { padding: 0; max-width: none; }
  .print-cab { display: block; border-bottom: 3px solid #1e4b33; padding-bottom: 8px; margin-bottom: 14px; }
  .rec, .card { box-shadow: none; border-color: #bbb; } .rec { break-inside: avoid; margin-bottom: 10px; }
  [data-theme="dark"] { --surface: #fff; --surface-2: #f3f3f3; --text: #000; --muted: #444; --border: #bbb; --primary: #1e4b33; }
  .rec.concluida { opacity: .6; }
  body { font-size: 10pt; }
  .kpis { grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
  .kpi { box-shadow: none; border: 1px solid #bbb; border-radius: 8px; padding: 8px 10px; break-inside: avoid; }
  .kpi .v { font-size: 1.3rem; } .kpi .t { font-size: .62rem; white-space: nowrap; }
  .rec { border-left-width: 5px; margin-bottom: 8px; }
  .rec-cab { padding: .6rem .9rem .3rem; } .rec-cab h3 { font-size: 1rem; }
  .rec-grade { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; margin-top: .3rem; }
  .rec-bloco { padding: .5rem .9rem; } .rec-bloco p { font-size: .85rem; }
  .rec-just { padding: .5rem .9rem; font-size: .75rem; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.so-mobile { display: none; }
@media (max-width: 899px) { .so-mobile { display: inline-flex; } }
button.arv-no { background: none; border: 0; width: 100%; text-align: left; color: inherit; font: inherit; font-size: .9rem; }
.arv-no .chev:empty { visibility: hidden; }
.leaflet-tooltip { font: 600 .8rem var(--font); }
.leaflet-control-zoom a { width: 38px !important; height: 38px !important; line-height: 38px !important; }
.leaflet-container .leaflet-control-attribution { font-size: 10px; }

@media (min-width: 900px) {
  .mapa-area:has(.gaveta) .leaflet-top.leaflet-right { right: min(390px, 100%); }
  .mapa-area:has(.gaveta) .mapa-flutuante.br { right: calc(min(390px, 100%) + .7rem); }
}

.mapa-wrap { overflow: hidden; }
@media (max-width: 899px) {
  .topbar .btn .txt { display: none; }
  .topbar .btn:has(.txt) { width: 42px; padding: 0; }
  .mapa-area .leaflet-control-zoom { display: none; }
  .mapa-flutuante.tl { right: .7rem; }
  .mapa-flutuante.tl .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .mapa-flutuante.tl .linha { min-width: 0; }
}

/* ------------------------------- clima ------------------------------------ */
.grafico { width: 100%; height: auto; display: block; }
.grafico text { fill: var(--muted); font: 600 11px var(--font); }
.grafico .grade-l { stroke: var(--border); stroke-width: 1; }
.grafico .barra-chuva { fill: var(--info); opacity: .85; }
.grafico .barra-neg { fill: var(--danger); opacity: .8; }
.grafico .l-eto { stroke: var(--warn); stroke-width: 2.2; fill: none; }
.grafico .l-tmax { stroke: var(--danger); stroke-width: 2.2; fill: none; }
.grafico .l-tmed { stroke: var(--primary); stroke-width: 2.2; fill: none; }
.grafico .l-tmin { stroke: var(--info); stroke-width: 2.2; fill: none; }
.leg-graf { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: .4rem; }
.leg-graf i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.estacao-card { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
@media (max-width: 899px) { .tabbar a { font-size: .58rem; } }

/* ------------------------------- safra / drone ---------------------------- */
.drone-grade { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
@media (max-width: 899px) { .drone-grade { grid-template-columns: 1fr; } }
.drone-mapa { height: 480px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); }
@media (max-width: 899px) { .drone-mapa { height: 62dvh; } }
.rampa { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #a50026, #f46d43, #fee08b, #a6d96a, #006837); }
.rampa-rot { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.tabela-compacta td, .tabela-compacta th { padding: .45rem .6rem; }
.pt-valor { background: rgba(0,0,0,.72); color: #fff; border: 0; border-radius: 6px; padding: 1px 5px; font: 700 11px var(--font); }
.pt-valor::before { display: none; }
.barras-2 .b1 { fill: var(--danger); opacity: .8; } .barras-2 .b2 { fill: var(--primary); opacity: .9; } .barras-2 .b3 { fill: var(--info); opacity: .85; }

/* Comparação de índices do drone */
.cmp-filtros { display: grid; gap: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-sel { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 999px; font-size: .82rem; cursor: pointer; background: var(--surface); user-select: none; }
.chip-sel input { position: absolute; opacity: 0; pointer-events: none; }
.chip-sel i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chip-sel:has(input:checked) { border-color: var(--primary, #1f4d36); background: color-mix(in srgb, var(--primary, #1f4d36) 14%, var(--surface)); font-weight: 600; }
.chip-sel:has(input:focus-visible) { outline: 2px solid var(--primary, #1f4d36); outline-offset: 2px; }
.tab-cmp { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.tab-cmp th, .tab-cmp td { padding: .4rem .6rem; border-bottom: 1px solid var(--border); text-align: right; }
.tab-cmp th:first-child, .tab-cmp td:first-child { text-align: left; }
.tab-wrap { overflow-x: auto; }

/* Fazenda / equipe */
.side-rodape a.side-btn { text-decoration: none; }
.side-rodape a.side-btn.ativo { background: rgba(255,255,255,.16); }
.side-rodape .fazenda-nome { color: #fff; font-weight: 650; }

/* ---------- gráficos responsivos (graficos.js) ---------- */
.gxy { position: relative; }
.gxy-area { width: 100%; line-height: 0; }
.gxy-svg { display: block; max-width: 100%; overflow: visible; }
.gxy-grade { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.gxy-zero { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.gxy-alvo { stroke-width: 1.2; stroke-dasharray: 6 4; }
.gxy-guia { stroke: var(--muted); stroke-width: 1; opacity: .7; }
.gxy-txt { fill: var(--muted); font-size: 11px; font-family: inherit; }
.gxy-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: .45rem .65rem; font-size: .8rem; line-height: 1.35; box-shadow: var(--shadow); min-width: 130px; }
.gxy-tip[hidden] { display: none; }
.gxy-tip strong { display: block; margin-bottom: .15rem; }
.gxy-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; }
.gxy + .leg-graf, .gxy .leg-graf { margin-top: .5rem; }
.grade-graf { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1rem; }
.grade-graf .card h3 { font-size: .98rem; }
.kpi-sub { font-size: .75rem; color: var(--muted); font-weight: 500; }
@media (max-width: 480px) { .grade-graf { grid-template-columns: 1fr; } }

/* ---------- recomendações compactas ---------- */
.rec-barra { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.rec-resumo { display: flex; align-items: center; gap: .7rem; font-size: .88rem; flex-wrap: wrap; }
.rec-it { border-top: 1px solid var(--border); }
.rec-it > summary { display: flex; align-items: center; gap: .7rem; padding: .7rem .4rem; cursor: pointer; list-style: none; }
.rec-it > summary::-webkit-details-marker { display: none; }
.rec-it > summary:hover { background: var(--surface-2); }
.rec-it .rec-t { flex: 1; min-width: 0; font-weight: 600; }
.rec-it .rec-q { color: var(--muted); font-size: .8rem; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-it.concluida .rec-t { text-decoration: line-through; opacity: .6; }
.rec-it .rec-corpo { margin: 0 .2rem .9rem; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rec-it .rec-rod { border-top: 1px solid var(--border); }
@media (max-width: 700px) { .rec-it .rec-q { display: none; } }
.arvore-dados .rec-it > summary { padding: .7rem .4rem; font-weight: 500; gap: .7rem; }
.arvore-dados .rec-it > summary::before { content: none; }
.saf-secao h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .5rem; }
.saf-secao + .saf-secao { margin-top: .4rem; }
.kpi .v { white-space: nowrap; }
.comparativo .barra-td { min-width: 220px; }
.comparativo .barra-td { display: flex; align-items: center; gap: .6rem; }
.comparativo .trilho { flex: 1; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.comparativo .fill { height: 100%; background: var(--primary); border-radius: 99px; }
.comparativo tr.lote td { background: var(--surface-2); }
.comparativo tr.sub .fill { background: color-mix(in srgb, var(--primary) 55%, var(--surface-3)); }
.comparativo .num { min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.kpis.compactos { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: .6rem; }
.kpis.compactos .kpi { padding: .7rem .8rem; }
.kpis.compactos .kpi .v { font-size: 1.45rem; }
.kpis.compactos .kpi .t { font-size: .68rem; }
.kpis.compactos { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
.kpis.compactos .kpi.data .v { font-size: 1.25rem; }
.kpis.compactos .kpi .v { overflow: hidden; text-overflow: ellipsis; }

/* Painel › Safra da fazenda: 3 colunas, valores em R$ sem corte */
.kpis.compactos.safra-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.compactos.safra-kpis .kpi .v { overflow: visible; text-overflow: clip; font-size: 1.35rem; }
.kpis.compactos.safra-kpis .kpi.data .v { font-size: 1.35rem; }
@media (max-width: 520px) { .kpis.compactos.safra-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Relatório */
.rel-secao h4 { margin: 1rem 0 .4rem; font-size: .95rem; }
.rel-secao .kpis { margin-bottom: .4rem; }
@media print { .abas { display: none !important; } .print-cab { display: block !important; } .rel-secao { break-inside: auto; } .tab th, .tab td { padding: 3px 6px; font-size: 9pt; } }

.rel-resumo { font-size: 1.05rem; line-height: 1.6; margin: .8rem 0 0; }
.rel-corpo p { line-height: 1.65; margin: .5rem 0; max-width: 78ch; }
.rel-dest, .rel-ok, .rel-atencao, .rel-passos { margin: .5rem 0 0; padding-left: 1.2rem; display: grid; gap: .35rem; line-height: 1.5; }
.rel-ok li::marker { color: var(--primary); } .rel-atencao li::marker { color: var(--danger); }

/* ====== impressão do plano de ação (documento próprio, só aparece ao imprimir) ====== */
.rec-print { display: none; }
@media print {
  @page { size: A4; margin: 14mm 13mm 16mm; }
  .rec-pagina > .print-cab, .rec-pagina > .fluxo, .rec-pagina > .rec-barra { display: none !important; }
  .rec-pagina .rec-print { display: block; color: #111; font-size: 9.6pt; line-height: 1.38; }
  .rp-cab { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 2.5px solid #1e4b33; padding-bottom: 8px; }
  .rp-marca { font-size: 8.5pt; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #1e4b33; }
  .rp-cab h1 { font-size: 20pt; margin: 1px 0 0; letter-spacing: -.01em; }
  .rp-sub { color: #444; font-size: 10pt; }
  .rp-meta { text-align: right; font-size: 8.5pt; color: #444; }
  .rp-res { display: flex; gap: 22px; padding: 8px 0 10px; border-bottom: 1px solid #ccc; font-size: 9pt; color: #333; flex-wrap: wrap; }
  .rp-res b { font-size: 12pt; color: #111; } .rp-res b.alta { color: #b3402e; } .rp-res b.media { color: #b07a10; } .rp-res b.baixa { color: #2f6f8f; }
  .rp-lote h2 { font-size: 13pt; margin: 16px 0 2px; padding: 4px 0; color: #1e4b33; border-bottom: 1px solid #1e4b33; break-after: avoid; }
  .rp-tal h3 { display: flex; justify-content: space-between; align-items: baseline; font-size: 10.5pt; margin: 10px 0 6px; padding: 3px 8px; background: #eef3ee; border-radius: 4px; break-after: avoid; }
  .rp-tal h3 span { font-weight: 500; font-size: 8.5pt; color: #555; }
  .rp-it { display: flex; gap: 10px; padding: 8px 0 9px; border-bottom: 1px solid #ddd; break-inside: avoid; }
  .rp-box { flex: none; width: 15px; height: 15px; margin-top: 2px; border: 1.5px solid #333; border-radius: 3px; text-align: center; font-size: 10pt; line-height: 13px; font-weight: 800; }
  .rp-corpo { flex: 1; min-width: 0; }
  .rp-topo { display: flex; gap: 10px; align-items: baseline; font-size: 7.8pt; text-transform: uppercase; letter-spacing: .07em; }
  .rp-prio { font-weight: 800; } .rp-prio.alta { color: #b3402e; } .rp-prio.media { color: #b07a10; } .rp-prio.baixa { color: #2f6f8f; }
  .rp-cat { color: #666; }
  .rp-tit { font-size: 11pt; font-weight: 700; margin: 1px 0 4px; }
  .rp-l { display: flex; gap: 8px; padding: 1.5px 0; }
  .rp-k { flex: none; width: 56px; font-weight: 700; font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; color: #1e4b33; padding-top: 1px; }
  .rp-v { flex: 1; white-space: pre-wrap; }
  .rp-base { margin-top: 4px; padding-left: 8px; border-left: 2px solid #ccc; font-size: 8pt; color: #555; white-space: pre-wrap; }
  .rp-it.feita .rp-tit { text-decoration: line-through; color: #777; }
  .rp-ass { display: flex; justify-content: space-between; margin-top: 26px; font-size: 9pt; break-inside: avoid; }
  .rp-rod { margin-top: 12px; font-size: 7.5pt; color: #777; border-top: 1px solid #ccc; padding-top: 5px; }
}

.rec-it .rec-grade.dois { grid-template-columns: 3fr 2fr; }
.rec-it .rec-grade.dois .rec-bloco:first-child p { font-weight: 650; font-size: 1rem; }
.rec-obs { padding: .6rem 1.2rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--border); display: grid; gap: .25rem; }
.rec-obs b { color: var(--text); }
@media (max-width: 700px) { .rec-it .rec-grade.dois { grid-template-columns: 1fr; } }
@media print { .rp-it .rp-l:first-child .rp-v { font-weight: 700; font-size: 10.5pt; } .rp-it .rp-l:nth-child(n+3) { color: #555; font-size: 8.8pt; } .rp-it .rp-l:nth-child(n+3) .rp-k { font-size: 7.3pt; } }

.rec-mais { border-top: 1px solid var(--border); } .rec-mais > summary { padding: .5rem 1.2rem; cursor: pointer; font-size: .8rem; color: var(--muted); font-weight: 600; }
.rec-mais .rec-obs { border-top: 0; padding-top: .2rem; }
@media print { .rec-mais { display: none; } }

/* ============ Relatório da safra (profissional) ============ */
.rel-folha { display: flex; flex-direction: column; gap: 1.6rem; }
.rel-cab { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-end; padding-bottom: .9rem; border-bottom: 2px solid var(--primary); }
.rel-cab .fz { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); font-weight: 700; }
.rel-cab h2 { margin: .2rem 0 0; font-size: 1.7rem; letter-spacing: -.02em; }
.rel-cab .meta { font-size: .8rem; color: var(--muted); text-align: right; line-height: 1.45; }
.rel-exec { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; background: var(--ok-soft); border-radius: var(--r); padding: 1rem 1.1rem; }
.rel-exec.atencao { background: var(--warn-soft); } .rel-exec.critico { background: var(--danger-soft); }
.rel-selo { font-weight: 800; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; padding: .3rem .75rem; border-radius: 999px; border: 1px solid currentColor; color: var(--ok); }
.rel-exec.atencao .rel-selo { color: var(--warn); } .rel-exec.critico .rel-selo { color: var(--danger); }
.rel-exec p { margin: 0; line-height: 1.6; max-width: 75ch; }
.rel-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.rel-kpi { padding: .8rem 1rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-width: 0; }
.rel-kpi:nth-child(3n) { border-right: 0; } .rel-kpi:nth-last-child(-n+3) { border-bottom: 0; }
.rel-kpi .t { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.rel-kpi .v { display: block; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: .1rem 0; letter-spacing: -.02em; }
.rel-kpi .v small { font-size: .8rem; color: var(--muted); font-weight: 600; margin-left: .25rem; }
.rel-kpi.neg .v { color: var(--danger); }
.rel-d { font-size: .75rem; font-variant-numeric: tabular-nums; color: var(--muted); display: flex; gap: .4rem; flex-wrap: wrap; }
.rel-d b { font-weight: 700; } .rel-d.bom b { color: var(--ok); } .rel-d.ruim b { color: var(--danger); }
.rel-sec h3 { font-size: 1.1rem; margin: 0; } .rel-sec .sub { color: var(--muted); margin: .15rem 0 .9rem; font-size: .88rem; }
.rel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.3rem; }
.rel-fig { min-width: 0; display: flex; flex-direction: column; gap: .4rem; break-inside: avoid; }
.rel-fig.larga { grid-column: 1 / -1; }
.rel-fig h4 { margin: 0; font-size: .9rem; }
.rel-leve { font-size: .82rem; background: var(--primary-soft, var(--surface-2)); border-radius: 6px; padding: .4rem .65rem; margin: 0; }
.gest-box { line-height: 0; } .gest { width: 100%; height: auto; display: block; overflow: visible; }
.gest-sep { stroke: var(--surface); stroke-width: 2; } .gest-faixa { fill: var(--danger); opacity: .07; }
.gxy-num { font-variant-numeric: tabular-nums; }
.rel-ag { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.rel-ag > div { border-top: 2px solid var(--border); padding-top: .6rem; min-width: 0; }
.rel-ag h4 { margin: 0 0 .25rem; font-size: .92rem; } .rel-ag p { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.5; }
.rel-fim { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.3rem; }
.rel-fim h4 { margin: 0 0 .5rem; padding-bottom: .35rem; border-bottom: 2px solid; font-size: .92rem; }
.rel-fim .a h4 { color: var(--ok); } .rel-fim .b h4 { color: var(--warn); } .rel-fim .c h4 { color: var(--primary); }
.rel-fim ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .4rem; font-size: .88rem; line-height: 1.45; }
.rel-rod { font-size: .72rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: .7rem; }
@media (max-width: 720px) {
  .rel-grid, .rel-fim { grid-template-columns: 1fr; } .rel-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rel-kpi:nth-child(3n) { border-right: 1px solid var(--border); } .rel-kpi:nth-child(2n) { border-right: 0; }
  .rel-kpi:nth-last-child(-n+3) { border-bottom: 1px solid var(--border); } .rel-kpi:nth-last-child(-n+2) { border-bottom: 0; }
  .rel-exec { grid-template-columns: 1fr; } .rel-cab .meta { text-align: left; }
}
@media print {
  .card.rel-folha { border: 0; padding: 0; background: none; gap: 14px; } .rel-cab h2 { font-size: 1.4rem; } .rel-sec { break-inside: auto; } .rel-grid { gap: 12px; }
  .rel-kpis { grid-template-columns: repeat(3, 1fr) !important; } .rel-kpi { padding: 6px 10px; }
  .rel-kpi:nth-child(3n) { border-right: 0 !important; } .rel-kpi:nth-last-child(-n+3) { border-bottom: 0 !important; }
  .rel-fim { grid-template-columns: repeat(3, 1fr) !important; } .rel-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .rel-exec, .rel-leve { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* relatório: blocos inteiros, sem cortar no meio da página */
.rel-ag { grid-template-columns: 1fr; gap: 0; }
.rel-ag > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: .3rem 1.2rem; padding: .8rem 0; border-top: 1px solid var(--border); }
.rel-ag > div > h4 { grid-row: 1 / span 3; margin: 0; }
.rel-ag > div > :not(h4) { grid-column: 2; }
.rel-ag p { color: var(--text); font-size: .88rem; }
@media (max-width: 720px) { .rel-ag > div { grid-template-columns: 1fr; } .rel-ag > div > h4 { grid-row: auto; } .rel-ag > div > :not(h4) { grid-column: 1; } }
@media print {
  .rel-cab, .rel-exec, .rel-kpis, .rel-fim, .rel-ag > div, .rel-fig, .rel-rod { break-inside: avoid; page-break-inside: avoid; }
  .rel-sec > h3, .rel-sec > .sub, .rel-fig > h4 { break-after: avoid; page-break-after: avoid; }
  .rel-sec { break-inside: auto; }
  .rel-ag > div { padding: 6px 0; } .rel-ag p { font-size: 9.5pt; }
  .rel-fim ul { font-size: 9.5pt; }
}

/* relatório: margem de impressão fina (só uma moldura discreta ao redor) */
@page relatorio { size: A4; margin: 3mm; }
@media print { body:has(.rel-folha) { page: relatorio; } }
@media print { .rel-folha .gest, .rel-folha .gxy-svg { max-height: 58mm; width: auto; max-width: 100%; margin: 0 auto; } .rel-folha .rel-fig.larga .gxy-svg, .rel-folha .rel-fig.larga .gest { max-height: 52mm; } .rel-folha .rel-fig .gxy-area { text-align: center; } }
@media print { html, body { height: auto !important; } .app, .main { min-height: 0 !important; } }

/* relatório sem moldura: sem borda na tela e sem margem de papel (o respiro de 3 mm fica por dentro) */
.card.rel-folha { border: 0; box-shadow: none; }
.rel-cab { border-bottom-width: 1px; }
@page relatorio { size: A4; margin: 0; }
@media print { .card.rel-folha { padding: 3mm !important; } }
/* durante a geração do PDF: texto legível (≈11 pt) mantendo o layout em colunas */
.rel-pdf .gxy-txt { font-size: 11.5px; }
.rel-pdf .rel-kpi .v { font-size: 1.4rem; }

/* painel: atenção agora, agrupada por urgência */
.at-grupos { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.2rem; align-items: start; }
.at-grupo { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.at-cab { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.at-dica { font-size: .75rem; flex-basis: 100%; }
.at-lista { display: flex; flex-direction: column; }
.at-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .2rem; text-decoration: none; color: inherit; border-bottom: 1px solid var(--border); min-width: 0; }
.at-item:last-child { border-bottom: 0; } .at-item:hover { background: var(--surface-2); }
.at-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .88rem; line-height: 1.35; }
.at-txt .muted { font-size: .78rem; }
.at-grupo > .btn { align-self: flex-start; }

/* ============ Chuva (azul: claro = pouca, escuro = muita) ============ */
[data-theme="light"] { --chuva: #3a78b5; --chuva-forte: #0b2c5a; --chuva-soft: #e3eefa; }
[data-theme="dark"] { --chuva: #5b9bd5; --chuva-forte: #b9d7f3; --chuva-soft: #14283d; }
.ch-bars { display: flex; align-items: flex-end; gap: 4px; width: 100%; }
.ch-bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--muted); }
.ch-bar:disabled { cursor: default; }
.ch-bar i { display: block; width: 100%; background: var(--chuva); border-radius: 3px 3px 0 0; opacity: .75; transition: opacity .15s; }
.ch-bar:hover i, .ch-bar.sel i { opacity: 1; }
.ch-bar.sel i { background: var(--chuva-forte); }
.ch-bar .v { font-size: .62rem; font-variant-numeric: tabular-nums; line-height: 1; min-height: .62rem; }
.ch-bar .m { font-size: .62rem; text-transform: uppercase; letter-spacing: .03em; line-height: 1; }
.ch-bar.sel .m { color: var(--text); font-weight: 700; }
.kpis-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.kpis-mini div { background: var(--surface-2); border-radius: 10px; padding: .45rem .6rem; display: flex; flex-direction: column; }
.kpis-mini b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.kpis-mini span { font-size: .7rem; color: var(--muted); }
.pluv { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; white-space: nowrap; pointer-events: auto; }
.pluv::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #0b2c5a; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.pluv .n { font: 600 10px var(--font); color: #cfe1f5; background: rgba(11,44,90,.88); padding: 1px 6px; border-radius: 4px 4px 0 0; margin-top: 3px; }
.pluv b { font: 700 12px var(--font); color: #fff; background: rgba(11,44,90,.88); padding: 0 6px 2px; border-radius: 0 0 4px 4px; }
.pluv.vazio::before { border-color: #7a8794; } .pluv.vazio .n, .pluv.vazio b { background: rgba(60,70,80,.85); }
/* tela de lançamento */
.chuva-lanc { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
.chuva-lanc label { display: flex; flex-direction: column; gap: .25rem; font-size: .75rem; font-weight: 650; color: var(--muted); min-width: 0; }
.chuva-lanc input { font-size: 1.05rem; font-weight: 650; width: 100%; }
.chuva-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .chuva-2col { grid-template-columns: 1fr; } }
.dash-grid.igual { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.dash-grid.igual > .card { min-width: 0; }
@media (max-width: 900px) { .dash-grid.igual { grid-template-columns: 1fr; } }
.ch-lotes { display: flex; flex-direction: column; gap: .35rem; }
.ch-lote { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) 4.6rem; gap: .6rem; align-items: center; font-size: .82rem; }
.ch-lote .tr { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.ch-lote .fl { height: 100%; background: var(--chuva); border-radius: 99px; }
.ch-lote b { text-align: right; font-variant-numeric: tabular-nums; }
/* comparativo em meia largura: sem esconder colunas */
.dash-grid.igual .comparativo .barra-td { min-width: 0; }
.dash-grid.igual .comparativo th, .dash-grid.igual .comparativo td { padding-inline: .45rem; font-size: .8rem; }
.dash-grid.igual .comparativo .num { min-width: 0; }
.dash-grid.igual .comparativo .trilho { min-width: 36px; }

/* Painel em duas colunas: cartões da mesma altura, conteúdo preenchendo o espaço */
.dash-grid.igual > .card { display: flex; flex-direction: column; }
.dash-grid.igual > .card > .vazio { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.dash-grid.igual > .card > .tabela-wrap { flex: 1; }
.dash-grid.igual .safra-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dash-grid.igual .safra-kpis .kpi { grid-column: span 2; }
.dash-grid.igual .safra-kpis .kpi:nth-child(n+4) { grid-column: span 3; }
.dash-grid.igual .safra-kpis .kpi:nth-child(4):last-child { grid-column: span 6; }
.dash-grid.igual .comparativo td { padding-block: .75rem; }
.dash-grid.igual .ch-lotes { margin-top: .2rem; }
.dash-grid.igual .ch-bars { margin-top: .2rem; }
@media (max-width: 520px) { .dash-grid.igual .safra-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid.igual .safra-kpis .kpi, .dash-grid.igual .safra-kpis .kpi:nth-child(n+4) { grid-column: auto; } }
.dash-grid.igual .comparativo { width: 100%; }
.dash-grid.igual .comparativo th { font-size: .66rem; letter-spacing: .03em; padding-inline: .35rem; }
.dash-grid.igual .comparativo td { padding-inline: .35rem; }
.dash-grid.igual .comparativo .barra-td { gap: .4rem; }
.dash-grid.igual > .card > .tabela-wrap { flex: 0 1 auto; }

/* login: etapas do sistema e prévia do painel */
.auth-arte { gap: 1.5rem; }
.auth-etapas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; position: relative; }
.auth-etapas::before { content: ""; position: absolute; left: 9px; right: 9px; top: 9px; height: 2px; background: rgba(232,194,90,.45); }
.auth-etapas li { position: relative; display: flex; flex-direction: column; min-width: 0; }
.auth-etapas i { width: 18px; height: 18px; border-radius: 50%; background: #12301f; border: 2px solid #e8c25a; margin-bottom: .45rem; position: relative; }
.auth-etapas b { font-size: .8rem; font-weight: 600; }
.auth-etapas span { font-size: .68rem; color: #9fb7a6; line-height: 1.25; }
.auth-previa { display: flex; flex-direction: column; gap: .7rem; }
.auth-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; }
.auth-kpi, .auth-bloco { background: rgba(10,29,19,.6); border: 1px solid rgba(255,255,255,.14); border-radius: 10px; padding: .6rem .8rem; display: flex; flex-direction: column; min-width: 0; }
.auth-kpi small, .auth-bloco small { font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: #9fb7a6; }
.auth-bloco small { text-transform: none; font-size: .75rem; letter-spacing: 0; margin-bottom: .5rem; }
.auth-kpi strong { font-size: 1.4rem; font-weight: 600; line-height: 1.2; }
.auth-kpi span { font-size: .7rem; color: #8fcca2; }
.auth-duo { display: grid; grid-template-columns: 1.1fr 1fr; gap: .6rem; }
.auth-barras { display: flex; align-items: flex-end; gap: .5rem; height: 120px; }
.auth-barras i { flex: 1; background: #3b9a62; border-radius: 3px 3px 0 0; }
.auth-barras i.dest { background: #e8c25a; }
.auth-aviso { display: flex; flex-direction: column; padding: .4rem 0; border-top: 1px solid rgba(255,255,255,.1); font-size: .8rem; }
.auth-aviso b { font-weight: 600; } .auth-aviso span { color: #e8c25a; font-size: .72rem; }
.auth-ex { color: #9fb7a6; font-size: .7rem; margin-top: auto; }
@media (max-width: 1180px) { .auth-duo { display: none; } .auth-etapas b { font-size: .64rem; letter-spacing: -.01em; } .auth-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ============ Safra: resumo (filtro único, resultado em destaque) ============ */
.saf-filtro { position: sticky; top: 0; z-index: 3; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: .8rem 1rem; display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: flex-end; box-shadow: var(--shadow, 0 1px 2px rgba(0,0,0,.05)); }
.saf-filtro .grupo { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.saf-filtro .grupo > small { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.saf-filtro select { min-width: 210px; }
.saf-filtro input[type="month"] { min-width: 0; width: 12rem; }
.saf-lido { margin-left: auto; text-align: right; font-size: .78rem; color: var(--muted); display: flex; flex-direction: column; min-width: 0; }
.saf-lido b { color: var(--text, inherit); font-size: .95rem; }
.saf-hero { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: .9rem; }
.saf-k { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.saf-k small { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.saf-k b { font-size: 1.6rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.saf-k b span { font-size: .8rem; font-weight: 600; color: var(--muted); }
.saf-k > span { font-size: .78rem; color: var(--muted); }
.saf-res { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.saf-res small, .saf-res > span { color: inherit; opacity: .82; }
.saf-res b { font-size: 2rem; }
.saf-res.neg { background: var(--danger); border-color: var(--danger); color: #fff; }
.saf-duo { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; }
.saf-duo.um { grid-template-columns: 1fr; }
.saf-duo .card, .grade-graf .card { min-width: 0; }
.saf-duo .card h3, .grade-graf .card h3 { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.saf-duo .card h3 small, .grade-graf .card h3 small { font: 500 .78rem var(--font); color: var(--muted); }
.saf-hb { display: flex; flex-direction: column; gap: .7rem; }
.saf-hb > div { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: .6rem; align-items: center; font-size: .86rem; }
.saf-hb .tr { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.saf-hb .tr i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.saf-hb em { font-style: normal; font-size: .78rem; color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.saf-faixa { display: flex; height: 28px; border-radius: 8px; overflow: hidden; gap: 2px; margin-bottom: .5rem; }
.saf-faixa i { display: flex; align-items: center; justify-content: center; font: 600 .7rem var(--font); color: #fff; font-style: normal; min-width: 0; white-space: nowrap; overflow: hidden; }
.saf-pill { display: inline-block; padding: .05rem .6rem; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.saf-pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.saf-pill.neg { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.saf-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; text-align: left; }
.saf-link:hover { text-decoration: underline; }
.saf-sem td { opacity: .6; }
.saf-det { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: .8rem 1rem; }
.saf-det summary { cursor: pointer; font-weight: 700; }
.saf-det summary span { font-weight: 400; color: var(--muted); font-size: .85rem; }
@media (max-width: 900px) { .saf-hero { grid-template-columns: 1fr 1fr; } .saf-duo { grid-template-columns: 1fr; } .saf-lido { margin-left: 0; text-align: left; } }
@media (max-width: 520px) { .saf-hero { grid-template-columns: 1fr; } .saf-filtro select { min-width: 0; width: 100%; } .saf-filtro .grupo { width: 100%; } .saf-hb > div { grid-template-columns: 90px 1fr auto; } .saf-filtro { position: static; } }

/* Safra: menus em cascata (lote e talhão) dentro do filtro */
.saf-dd { position: relative; display: inline-flex; }
.saf-tem-menu { display: inline-flex; align-items: center; gap: .45rem; }
.saf-seta { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .7; flex: none; }
.saf-tem-menu[aria-expanded="true"] .saf-seta { transform: rotate(-135deg) translateY(-1px); }
.saf-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 20; min-width: 190px; max-width: min(320px, 84vw); max-height: min(50vh, 320px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 34px rgba(0,0,0,.2); padding: .35rem; display: flex; flex-direction: column; gap: 2px; }
.saf-menu > small { font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .35rem .6rem .25rem; }
.saf-menu button { display: flex; width: 100%; text-align: left; padding: .5rem .65rem; border: 0; background: transparent; border-radius: 8px; font: inherit; font-size: .88rem; font-weight: 600; color: inherit; cursor: pointer; }
.saf-menu button:hover { background: var(--surface-2); }
.saf-menu button.on { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.saf-menu button.on::after { content: "✓"; margin-left: auto; padding-left: .8rem; }

/* Visão do lote */
.lote-talhoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; margin-top: .8rem; }
.lote-tal { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; display: flex; flex-direction: column; gap: .3rem; background: var(--surface, transparent); }
.lote-tal.sem { opacity: .6; }
.lote-tal ul { margin: .2rem 0 0; padding-left: 1.1rem; font-size: .82rem; }
.lote-mat td.c-alto { background: var(--purple-soft); color: var(--purple); font-weight: 650; }
.lote-mat td.pior { box-shadow: inset 0 -3px 0 var(--danger); }
.lote-mat td.melhor { box-shadow: inset 0 -3px 0 var(--ok); }
.lote-mat td, .lote-mat th { text-align: right; } .lote-mat td:first-child, .lote-mat th:first-child { text-align: left; }
