/* =====================================================================
   Portal Retiro da Montanha — estilos da aplicação
   Regra: nenhum estilo inline em HTML (CSP estrita). Valores dinâmicos
   entram por custom properties via element.style.setProperty().
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-ui);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-s); }
.num { font-variant-numeric: tabular-nums; }
/* #conteudo recebe foco a cada troca de rota (para leitor de tela); o anel ali parecia defeito */
.content:focus, .content:focus-visible { outline: none; box-shadow: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.display { font-family: var(--font-display); font-optical-sizing: auto; letter-spacing: -.01em; }
[hidden] { display: none !important; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 42px; padding: 0 18px; border-radius: var(--radius-m); border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs-sm); letter-spacing: .01em; cursor: pointer;
  transition: transform .15s var(--ease), background .2s, box-shadow .2s, border-color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow-btn); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-gold { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-btn-gold); }
.btn-gold:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 10px; }
.btn-quiet:hover { background: var(--surface-3); color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 12px; font-size: var(--fs-sm); border-radius: var(--radius-s); }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-m); border: 1px solid var(--line);
  background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- formulários ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.input {
  height: 46px; padding: 0 14px; border-radius: var(--radius-m); border: 1px solid var(--line-strong);
  background: var(--surface); transition: border-color .2s, box-shadow .2s; width: 100%;
}
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input-otp { text-align: center; font-size: var(--fs-xl); letter-spacing: .5em; font-weight: 600; font-variant-numeric: tabular-nums; height: 60px; }
.select { appearance: none; height: 38px; padding: 0 34px 0 12px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C857C' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
.form-msg { min-height: 22px; font-size: var(--fs-sm); margin: -4px 0 12px; }
.form-msg.err { color: var(--crit); }
.form-msg.ok { color: var(--good); }

/* =====================================================================
   LOGIN
   ===================================================================== */
.auth {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-6); padding: 40px 16px;
  background:
    radial-gradient(700px 420px at 50% 0%, rgba(253, 192, 109, .16), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; padding: 36px 32px 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  box-shadow: var(--shadow-2);
}
.auth-card .medalhao { width: 184px; padding: 0; margin-bottom: 22px; box-shadow: none; background: transparent; }
.auth-card .medalhao img { border-radius: 0; }
.auth-rodape { margin: 0; font-size: var(--fs-2xs); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.medalhao {
  width: 168px; margin: 0 auto 26px; padding: 12px; border-radius: var(--radius-l); background: var(--paper);
  box-shadow: var(--shadow-2), inset 0 0 0 1px rgba(59, 42, 32, .06);
}
.medalhao img { width: 100%; height: auto; border-radius: var(--radius); }
.auth-card h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-2xl); margin: 0 0 6px; text-align: center; letter-spacing: -.01em; }
.auth-card .lead { text-align: center; color: var(--ink-2); margin: 0 0 28px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 18px; font-size: var(--fs-sm); }
.field .auth-links { margin: 0; }
.field .auth-links .btn { height: 24px; }
.auth-secure { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); margin-top: 26px; font-size: var(--fs-xs); color: var(--ink-3); }
.auth-secure .icon { width: 14px; height: 14px; }
.qr-box { display: grid; place-items: center; padding: 16px; background: var(--paper); border-radius: var(--radius); border: 1px solid var(--line); margin: 0 auto 14px; width: 220px; }
.qr-box img { width: 188px; height: 188px; }
.secret { font: 600 12px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .08em; text-align: center; word-break: break-all; color: var(--ink-2); background: var(--surface-3); padding: 10px; border-radius: var(--radius-m); margin-bottom: 18px; }
.steps-mini { counter-reset: s; list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--ink-2); }
.steps-mini li { counter-increment: s; display: flex; gap: var(--sp-3); }
.steps-mini li::before { content: counter(s); flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: var(--fs-xs); display: grid; place-items: center; }

@media (max-width: 480px) {
  .auth { justify-content: flex-start; padding-top: 24px; }
  .auth-card { padding: 28px 20px 22px; box-shadow: var(--shadow-1); }
}

/* =====================================================================
   SHELL
   ===================================================================== */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; color: var(--chrome-text);
  background: var(--chrome-2);
  display: flex; flex-direction: column; padding: 18px 16px 14px;
  border-right: 1px solid var(--on-dark-soft);
}
/* marca: logomarca oficial (SVG branco) centralizada, sem caixa; o nome já está no desenho */
.side-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 8px 18px; border-bottom: 1px solid var(--on-dark-line); margin-bottom: 6px; text-decoration: none; }
.side-brand:hover { text-decoration: none; }
.side-logo { width: 152px; height: auto; transition: opacity .2s var(--ease), transform .3s var(--ease); }
.side-brand:hover .side-logo { opacity: .92; transform: scale(1.015); }
.side-tag { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--chrome-sub); }
/* imagem que muda com o tema (logomarca colorida no claro, branca no escuro) */
.so-escuro { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .so-claro { display: none; }
  :root:not([data-theme="light"]) .so-escuro { display: block; }
}
:root[data-theme="dark"] .so-claro { display: none; }
:root[data-theme="dark"] .so-escuro { display: block; }
.nav-group { margin: 14px 0 4px; padding: 0 12px; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--chrome-sub); opacity: .85; }
.nav { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: var(--sp-3); padding: 10px 12px; border-radius: var(--radius-m);
  color: var(--chrome-text); font-weight: 500; font-size: var(--fs-sm); text-decoration: none; transition: background .2s, color .2s;
}
.nav a:hover { background: var(--on-dark-hover); color: var(--chrome-ink); }
.nav a .icon { color: var(--chrome-icon); opacity: .85; }
.nav a.active { background: var(--on-dark-active); color: var(--chrome-ink); font-weight: 600; }
.nav-txt { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a.active .icon { color: var(--chrome-accent); opacity: 1; }
.nav a.active::before { content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--chrome-accent); }
.scrim { display: none; }
.nav .tag { white-space: nowrap; flex: none; margin-left: auto; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; padding: 2px 7px; border-radius: var(--radius-pill); background: var(--on-dark-fill); color: var(--chrome-ink); }
.nav-soon { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--on-dark-hover); }
.nav-soon > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--sp-2); padding-top: 6px; padding-bottom: 6px; border-radius: var(--radius-s); }
.nav-soon > summary::-webkit-details-marker { display: none; }
.nav-soon > summary:hover { color: var(--chrome-ink); }
.nav-soon > summary .icon { width: 14px; height: 14px; margin-left: auto; transition: transform .2s var(--ease); }
.nav-soon[open] > summary .icon { transform: rotate(90deg); }
.nav-count { padding: 1px 7px; border-radius: var(--radius-pill); font-size: var(--fs-2xs); letter-spacing: 0; background: var(--on-dark-fill); color: var(--chrome-ink); }
.nav-soon .nav a { color: var(--chrome-sub); font-size: var(--fs-sm); }
.nav-soon .nav a .icon { opacity: .6; }
.nav-soon .nav a { gap: var(--sp-3); }
.nav-soon .nav-txt { white-space: normal; }
.nav-soon .nav .tag { padding: 0; background: transparent; color: var(--chrome-sub); font-weight: 600; letter-spacing: 0; opacity: .85; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--on-dark-line); display: flex; align-items: center; gap: var(--sp-1); }
.side-out { flex: none; width: 36px; height: 36px; border-radius: var(--radius-m); border: 0; background: transparent; color: var(--chrome-sub); display: grid; place-items: center; cursor: pointer; transition: background .2s, color .2s; }
.side-out:hover { background: var(--on-dark-hover); color: var(--chrome-ink); }
.user-chip { display: flex; align-items: center; gap: var(--sp-3); padding: 8px; border-radius: var(--radius-m); cursor: pointer; background: transparent; border: 0; flex: 1; min-width: 0; text-align: left; color: inherit; text-decoration: none; }
.user-chip:hover { background: var(--on-dark-hover); text-decoration: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm); color: var(--accent-ink); background: var(--sun); flex: none; }
.user-txt { min-width: 0; }
.user-chip .n { font-size: var(--fs-sm); font-weight: 600; color: var(--chrome-ink); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .r { font-size: var(--fs-2xs); color: var(--chrome-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-4); padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--ink-3); min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-btn { margin-left: var(--sp-5); display: inline-flex; align-items: center; gap: var(--sp-2); height: 38px; padding: 0 10px 0 12px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font: inherit; font-size: var(--fs-sm); cursor: pointer; min-width: 200px; transition: border-color .2s, color .2s; }
.cmd-btn:hover { border-color: var(--line-strong); color: var(--ink-2); }
.cmd-btn .icon { width: 16px; height: 16px; }
.cmd-btn kbd { margin-left: auto; }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: var(--radius-xs); border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface-2); font: 600 var(--fs-2xs)/1.5 var(--font-ui); color: var(--ink-2); text-align: center; }
/* busca rápida */
dialog.cmd { width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); display: flex; flex-direction: column; overflow: hidden; }
dialog.cmd:not([open]) { display: none; }
dialog.cmd::backdrop { background: var(--overlay); }
.cmd-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.cmd-head > .icon { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.cmd-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); font: 400 var(--fs-md) var(--font-ui); padding: var(--sp-2) 0; }
dialog.cmd .cmd-input, dialog.cmd .cmd-input:focus, dialog.cmd .cmd-input:focus-visible { border: 0; box-shadow: none; outline: none; height: auto; }
.cmd-list { list-style: none; margin: 0; padding: var(--sp-2); overflow-y: auto; }
.cmd-grupo { padding: var(--sp-3) var(--sp-3) var(--sp-1); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.cmd-item { display: flex; align-items: center; gap: var(--sp-3); padding: 9px var(--sp-3); border-radius: var(--radius-s); cursor: pointer; font-size: var(--fs-sm); }
.cmd-item .icon { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.cmd-item.on { background: var(--accent-soft); }
.cmd-item.on .icon { color: var(--accent-strong); }
.cmd-rot { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-dica { margin-left: auto; font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; }
.cmd-vazio { padding: var(--sp-6); text-align: center; color: var(--ink-3); }
.cmd-foot { display: flex; gap: var(--sp-4); padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-3); background: var(--surface-2); }
.cmd-foot kbd { margin-right: 2px; }
@media (max-width: 860px) { .cmd-btn { min-width: 0; margin-left: var(--sp-2); padding: 0 10px; } .cmd-btn-txt, .cmd-btn kbd { display: none; } }
@media print { .cmd-btn, dialog.cmd { display: none !important; } }
.top-ctx { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }
.ctx-label { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.menu-btn { display: none; }
/* centralizado: em monitores largos o conteúdo não fica colado à esquerda com uma faixa vazia à direita */
.content { padding: 30px 32px 56px; max-width: 1440px; width: 100%; margin-inline: auto; }
/* títulos sem palavra sozinha na última linha; parágrafos sem "viúvas" */
h1, h2, h3, .card-title { text-wrap: balance; }
p { text-wrap: pretty; }
.banner-demo {
  display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 22px; padding: 11px 16px; border-radius: var(--radius-m);
  background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); font-size: var(--fs-sm);
}
.banner-demo .icon { color: var(--accent-strong); }
.banner-demo b { font-weight: 700; }

@media (max-width: 1080px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .main, .content, .topbar { max-width: 100vw; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: var(--shadow-3); }
  .shell.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .shell.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 22px 16px 48px; }
  .ctx-label { display: none; }
}
@media (max-width: 640px) {
  /* barra superior em duas linhas: [menu · título · busca] / [fazenda · safra · tema] */
  .topbar { height: auto; flex-wrap: wrap; row-gap: 10px; column-gap: var(--sp-3); padding: 10px 16px; }
  .crumbs { flex: 1; min-width: 0; }
  .crumbs > span, .crumbs > .icon { display: none; }
  .top-ctx { order: 5; flex: 1 1 100%; margin-left: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--sp-2); }
  .top-ctx .select { max-width: none; min-width: 0; height: 38px; padding-left: 10px; padding-right: 26px; font-size: var(--fs-sm); background-position: right 8px center; }
  .icon-btn { width: 38px; height: 38px; flex: none; }
  /* cabeçalho da página: ações só com ícone */
  .head-actions { width: 100%; }
  .head-actions .stamp { flex: 1; min-width: 0; }
  .head-actions .btn-lbl { display: none; }
  .head-actions .btn { width: 38px; padding: 0; justify-content: center; }
  /* KPIs em 2 colunas, mais compactos */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: var(--sp-3); }
  .kpis .kpi { padding: 14px; }
  .kpis .kpi .lbl { font-size: var(--fs-xs); gap: 6px; align-items: flex-start; }
  .kpis .kpi .lbl .icon { width: 14px; height: 14px; margin-top: 1px; flex: none; }
  .kpis .kpi .val { font-size: 22px; margin-top: 4px; }
  .kpis .kpi .val small { font-size: var(--fs-2xs); }
  .kpis .kpi.pending .val { font-size: var(--fs-sm); margin-top: 6px; }
  .kpis .kpi .foot, .kpis .delta, .kpis .meta { font-size: var(--fs-2xs); }
  .kpis .delta { white-space: normal; }
  .kpis .kpi .spark { margin-top: 6px; }
  /* alertas: botão de ação abaixo do texto, que fica com a largura toda */
  .attn-item { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .attn-item > .btn { grid-column: 2; justify-self: start; }
  /* cabeçalho de cartão: o botão desce em vez de espremer o título */
  .card-head { flex-wrap: wrap; }
  /* comparativo por fazenda: só o que decide (fazenda, colhido, % previsão, vs safra anterior) */
  .t.cmp tr > :nth-child(2), .t.cmp tr > :nth-child(5), .t.cmp tr > :nth-child(7), .t.cmp tr > :nth-child(8) { display: none; }
  .table-wrap .t.cmp th, .table-wrap .t.cmp td { padding: 12px 8px; }
  .table-wrap .t.cmp thead th { letter-spacing: .03em; }
  .table-wrap .t.cmp tbody th, .table-wrap .t.cmp tfoot th { white-space: normal; }
  /* faixa de destaque: 3 números lado a lado */
  .hero-figs { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: var(--sp-2); }
  .hero-fig { padding: 10px; }
  .hero-fig b { font-size: 19px; }
  .hero-fig span { font-size: var(--fs-2xs); line-height: 1.3; display: block; }
  /* título do cartão ocupa o espaço e o contador/selo fica na mesma linha, à direita */
  .card-head > div:first-child { flex: 1 1 200px; min-width: 0; }
}
/* celulares estreitos (320–399 px): uma coluna onde duas espremiam os números */
@media (max-width: 399px) {
  /* fazenda numa linha própria; safra e tema embaixo (lado a lado, os nomes ficavam cortados) */
  .top-ctx { grid-template-columns: minmax(0, 1fr) auto; }
  .top-ctx > select:first-of-type { grid-column: 1 / -1; }
  .kpis { grid-template-columns: minmax(0, 1fr) !important; }
  .kpis .kpi .val { font-size: 26px; }
  .hero-figs { grid-template-columns: minmax(0, 1fr) !important; }
  .hero-fig { display: flex; align-items: baseline; gap: var(--sp-3); padding: 10px 14px; }
  .hero-fig b { font-size: 20px; flex: none; }
  .hero-fig span { font-size: var(--fs-xs); }
  .banner-demo { font-size: var(--fs-xs); padding: 10px 12px; }
}

/* =====================================================================
   PÁGINAS
   ===================================================================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-5); flex-wrap: wrap; margin-bottom: 26px; }
.eyebrow { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--accent-strong); margin-bottom: 8px; display: flex; align-items: center; gap: var(--sp-3); }
.eyebrow::before { content: ""; width: 22px; height: 1.5px; background: currentColor; }
.page-head h1 { font-family: var(--font-display); font-weight: 500; font-size: clamp(28px, 2.6vw, 38px); line-height: 1.1; margin: 0; letter-spacing: -.015em; }
.page-head p { margin: 8px 0 0; color: var(--ink-2); max-width: 680px; }
.head-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.print-only { display: none; }
/* títulos de grupo na tela inicial (Comercial / Operação) */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin: 0 0 var(--sp-3); }
.sec-title { margin: 0; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.01em; }
.sec-lock { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--ink-3); }
.sec-lock .icon { width: 14px; height: 14px; }
.fin { margin-bottom: var(--sp-6); }
.stamp { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; }
.stamp .icon { width: 14px; height: 14px; color: var(--good); }
.stamp.stale { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-bg); }
.stamp.stale .icon { color: var(--warn); }
.stamp b { color: var(--ink); font-weight: 600; }
.stamp-src { color: var(--ink-3); }
@media (max-width: 640px) { .stamp-src { display: none; } }

.grid { display: grid; gap: var(--sp-5); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
@media (max-width: 1240px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .g-3, .g-2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .g-4 { grid-template-columns: 1fr; } }
.stack { display: grid; gap: var(--sp-5); }
.section-gap { margin-top: 26px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 22px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: 16px; }
.card-title { font-weight: 600; font-size: var(--fs-md); margin: 0; letter-spacing: -.005em; }
.card-sub { font-size: var(--fs-sm); color: var(--ink-3); margin: 3px 0 0; }
.card-note { font-size: var(--fs-xs); color: var(--ink-3); margin: 12px 0 0; }

/* nota de escopo (ex.: filtro por fazenda em dado que a origem não separa) */
.scope-note { display: flex; align-items: flex-start; gap: var(--sp-2); margin: 0 0 18px; padding: 10px 14px; border-radius: var(--radius-m);
  border: 1px solid var(--line); background: var(--surface-2); font-size: var(--fs-sm); color: var(--ink-2); }
.scope-note .icon { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--accent); }

/* hero da safra */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-l); padding: 30px 32px; color: var(--hero-ink);
  background: var(--hero-2);
  box-shadow: var(--shadow-2); margin-bottom: 18px;
}
.hero .serra { position: absolute; right: -20px; bottom: -6px; width: 520px; max-width: 70%; opacity: .28; pointer-events: none; }
.hero-in { position: relative; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--sp-8); align-items: end; }
.hero .k { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--hero-kicker); }
.hero h2 { font-family: var(--font-display); font-weight: 500; font-size: clamp(26px, 2.4vw, 34px); margin: 8px 0 6px; color: var(--hero-title); line-height: 1.15; }
.hero p { margin: 0; color: var(--hero-text); max-width: 520px; }
.hero-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.hero-fig { background: var(--on-dark-soft); border: 1px solid var(--on-dark-fill); border-radius: var(--radius); padding: 14px 16px; }
.hero-fig b { display: block; font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-xl); letter-spacing: -.02em; color: var(--on-dark); line-height: 1.15; font-variant-numeric: tabular-nums; }
.hero-fig span { font-size: var(--fs-xs); color: var(--hero-sub); }
@media (max-width: 960px) { .hero-in { grid-template-columns: 1fr; } .hero { padding: 24px 20px; } }
@media (max-width: 480px) { .hero-figs { grid-template-columns: 1fr 1fr; } }

/* KPI */
.kpi { position: relative; display: flex; flex-direction: column; gap: var(--sp-1); }
.kpi .lbl { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.kpi .lbl .icon { width: 16px; height: 16px; color: var(--accent-strong); }
.kpi .val { font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-2xl); line-height: 1.15; letter-spacing: -.025em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .val small { font-family: var(--font-ui); font-size: var(--fs-sm); font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.kpi .foot { font-size: var(--fs-xs); color: var(--ink-3); display: flex; align-items: center; gap: 6px; min-height: 20px; }
.kpi .spark { margin-top: 10px; height: 34px; }
.delta { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; }
.delta > span { font-size: 9px; }
.delta b { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.good b, .delta.good > span { color: var(--good); }
.delta.bad b, .delta.bad > span { color: var(--crit); }
.delta.neutral b { color: var(--ink-2); }
.meta { margin-top: 12px; display: grid; gap: 6px; font-size: var(--fs-xs); color: var(--ink-3); }
.meta b { color: var(--ink); font-weight: 600; }
.meta-bar { height: 6px; border-radius: var(--radius-pill); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.meta-bar i { display: block; height: 100%; width: var(--w); border-radius: inherit; background: var(--series); }
.meta-bar.over i { background: var(--good); }
.kpi.pending .val { font-size: var(--fs-lg); font-family: var(--font-ui); font-weight: 600; color: var(--ink-3); margin-top: 14px; }

/* chips e status (status sempre com ícone + texto) */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.chip .icon { width: 13px; height: 13px; stroke-width: 2.2; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.crit { background: var(--crit-bg); color: var(--crit); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.gold { background: var(--accent-soft); color: var(--accent-strong); }

/* módulos */
.mod {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-3); padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); color: inherit; text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.mod:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-strong); text-decoration: none; }
.mod-ico { width: 44px; height: 44px; border-radius: var(--radius-m); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.mod-ico .icon { width: 22px; height: 22px; }
.mod h3 { margin: 4px 0 0; font-size: var(--fs-md); font-weight: 600; }
.mod p { margin: 0; font-size: var(--fs-sm); color: var(--ink-2); flex: 1; }
.mod-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding-top: 10px; border-top: 1px dashed var(--line); font-size: var(--fs-xs); color: var(--ink-3); }

/* linha do tempo das ondas */
.waves { display: grid; gap: var(--sp-3); }
.wave { display: grid; grid-template-columns: 200px minmax(0, 1fr) 132px; align-items: center; gap: var(--sp-4); }
.wave .nm { font-size: var(--fs-sm); font-weight: 600; line-height: 1.25; }
.wave .nm span { display: block; font-size: var(--fs-2xs); font-weight: 500; color: var(--ink-3); }
.wave .track { position: relative; height: 26px; border-radius: var(--radius-s); background: var(--surface-3); }
.wave .bar { position: absolute; top: 4px; bottom: 4px; left: var(--x0); width: var(--w); border-radius: var(--radius-xs); background: var(--brand); opacity: .85; }
.wave .bar.done { background: var(--action); }
.wave .bar.now { background: var(--accent); opacity: 1; }
.wave .bar.next { background: transparent; border: 1.5px dashed var(--line-strong); opacity: 1; }
.wave .today { position: absolute; top: -4px; bottom: -4px; left: var(--t); width: 2px; background: var(--crit); border-radius: 2px; }
.wave-axis { display: grid; grid-template-columns: 200px minmax(0, 1fr) 132px; gap: var(--sp-4); font-size: var(--fs-2xs); color: var(--ink-3); }
.wave-axis .ticks { display: flex; justify-content: space-between; }
@media (max-width: 720px) {
  .wave, .wave-axis { grid-template-columns: 110px minmax(0, 1fr); }
  .wave > .chip, .wave-axis > :last-child { display: none; }
  .wave-axis .ticks > span:nth-child(even), .wave-axis .ticks > span:last-child { visibility: hidden; }   /* no celular, um mês sim, um não; o último não cabe */
}

/* lista de saúde */
.health { list-style: none; margin: 0; padding: 0; display: grid; }
.health li { display: flex; align-items: center; gap: var(--sp-3); padding: 12px 0; border-bottom: 1px solid var(--line); }
.health li:last-child { border-bottom: 0; }
.health .hi { width: 34px; height: 34px; border-radius: var(--radius-m); display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.health .ht { min-width: 0; flex: 1; }
.health .ht b { display: block; font-size: var(--fs-sm); font-weight: 600; }
.health .ht span { font-size: var(--fs-xs); color: var(--ink-3); }

/* estágios E0–E3 */
.stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; counter-reset: st; }
.stage { position: relative; padding: 0 12px 0 0; }
.stage .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-xs); background: var(--surface-3); color: var(--ink-3); border: 2px solid var(--line); position: relative; z-index: 1; }
.stage::after { content: ""; position: absolute; top: 14px; left: 30px; right: 0; height: 2px; background: var(--line); }
.stage:last-child::after { display: none; }
.stage.done .dot { background: var(--action); border-color: var(--action); color: var(--on-dark); }
.stage.done::after { background: var(--action); }
.stage.now .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 5px var(--accent-soft); }
.stage h4 { margin: 12px 0 2px; font-size: var(--fs-sm); }
.stage p { margin: 0; font-size: var(--fs-xs); color: var(--ink-3); }
@media (max-width: 720px) { .stages { grid-template-columns: 1fr 1fr; row-gap: 20px; } .stage::after { display: none; } }

/* tabela */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.t th { text-align: left; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--surface-2); }
.t .r { text-align: right; }
/* pede sua atenção */
.attn-n { background: var(--warn-bg); color: var(--warn); font-size: var(--fs-xs); padding: 2px 9px; }
.attn-list { list-style: none; margin: 0; padding: 0; display: grid; }
.attn-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); padding: 12px 0; border-top: 1px solid var(--line); }
.attn-item:first-child { border-top: 0; padding-top: 2px; }
.attn-ico { width: 30px; height: 30px; border-radius: var(--radius-s); display: grid; place-items: center; }
.attn-ico .icon { width: 16px; height: 16px; }
.attn-item.crit .attn-ico { background: var(--crit-bg); color: var(--crit); }
.attn-item.warn .attn-ico { background: var(--warn-bg); color: var(--warn); }
.attn-item.info .attn-ico { background: var(--info-bg); color: var(--info); }
.attn-txt { display: grid; gap: 2px; min-width: 0; }
.attn-txt b { font-size: var(--fs-sm); font-weight: 600; }
.attn-txt span { font-size: var(--fs-xs); color: var(--ink-3); }
.attn-more { margin-top: 4px; border-top: 1px solid var(--line); }
.attn-more > summary { cursor: pointer; padding: 12px 0 2px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.attn-more[open] > summary { padding-bottom: 4px; }
.attn-ok { display: flex; align-items: center; gap: var(--sp-2); color: var(--good); font-weight: 600; font-size: var(--fs-sm); }
.attn-ok .icon { width: 18px; height: 18px; }
/* funil pós-colheita */
.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-4); }
.fn-row { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 4px; }
.fn-lbl { font-size: var(--fs-sm); font-weight: 600; }
.fn-track { height: 22px; border-radius: var(--radius-xs); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.fn-track i { display: block; height: 100%; width: var(--w); background: var(--series); border-radius: var(--radius-xs); }
.fn-val { font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; min-width: 112px; text-align: right; }
.fn-val b { font-size: var(--fs-sm); color: var(--ink); font-weight: 600; }
.fn-gap { grid-column: 2 / -1; display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--ink-3); }
.fn-row.gargalo .fn-gap { color: var(--warn); font-weight: 600; }
.fn-gap .chip { height: 20px; font-size: var(--fs-2xs); padding: 0 8px; }
@media (max-width: 520px) { .fn-row { grid-template-columns: 1fr auto; } .fn-track { grid-column: 1 / -1; grid-row: 2; } .fn-gap { grid-column: 1 / -1; } }
.t.cmp tbody th, .t.cmp tfoot th { text-align: left; font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); background: transparent; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.t.cmp tfoot th, .t.cmp tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 600; background: var(--surface-2); }
.t.cmp tr.sel th { box-shadow: inset 3px 0 0 var(--accent); }
.t.cmp .pct { font-weight: 600; }
.t.cmp .pct.good { color: var(--good); }
.t.cmp .pct.bad { color: var(--crit); }
/* chuva: conferência por pluviômetro (sob o gráfico) */
details.pluv { margin-top: var(--sp-4); border-top: 1px solid var(--line); }
details.pluv > summary { cursor: pointer; display: flex; align-items: center; gap: var(--sp-2); padding: 12px 0 4px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
details.pluv[open] > summary { padding-bottom: var(--sp-3); }
details.pluv .card-note { margin-top: var(--sp-3); }
.t.pluv-t tbody th { text-align: left; font-weight: 600; font-size: var(--fs-sm); letter-spacing: 0; text-transform: none; color: var(--ink); background: transparent; padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t.pluv-t td { padding: 11px 16px; }
.t.pluv-t tr:last-child th { border-bottom: 0; }
.pl-nome { display: block; }
.pl-sub { display: block; font-size: var(--fs-2xs); font-weight: 400; color: var(--ink-3); }
.pl-dif.ruim { color: var(--warn); font-weight: 700; }
@media (max-width: 640px) {
  .table-wrap .t.pluv-t th, .table-wrap .t.pluv-t td { padding: 10px 8px; }
  .table-wrap .t.pluv-t tbody th { white-space: normal; }
  .t.pluv-t thead th { letter-spacing: .03em; }
  .t.pluv-t tr > :last-child { display: none; }   /* "Última leitura": a menos importante, sai no celular */
}

/* gráfico */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .ax { fill: var(--ink-3); font-size: var(--fs-2xs); font-family: var(--font-ui); }
.chart .ref { stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
.chart .ref-lbl { fill: var(--ink-2); font-size: var(--fs-2xs); font-weight: 600; font-family: var(--font-ui); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.chart .bar { fill: var(--series); }
.chart .bar-hit { fill: transparent; cursor: crosshair; }
.chart .bar-hit:hover + .bar, .chart .bar.hl { fill: color-mix(in srgb, var(--series) 75%, var(--ink)); }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-soft); }
.chart .ref { stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 4 4; fill: none; }
.chart-legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--ink-2); margin-top: 10px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--series); margin-right: 6px; vertical-align: -1px; }
.chart-legend i.ref { background: none; border-top: 2px dashed var(--ink-3); border-radius: 0; height: 0; width: 14px; vertical-align: 3px; }
.tip {
  position: fixed; z-index: 80; pointer-events: none; min-width: 140px; padding: 10px 12px; border-radius: var(--radius-m);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); font-size: var(--fs-xs); opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.tip.on { opacity: 1; transform: none; }
.tip b { display: block; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; margin-bottom: 4px; }
.tip .tv { font-size: var(--fs-md); font-weight: 700; font-variant-numeric: tabular-nums; }
.progress { height: 10px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: var(--p); border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--accent-strong), var(--accent)); }

/* vazio / placeholder de módulo */
.empty { text-align: center; padding: 42px 20px; color: var(--ink-2); }
.empty .mod-ico { margin: 0 auto 14px; width: 56px; height: 56px; border-radius: var(--radius); }
.legacy { display: flex; align-items: center; gap: var(--sp-3); padding: 12px 14px; border-radius: var(--radius-m); background: var(--surface-2); border: 1px solid var(--line); font: 500 12.5px/1.4 ui-monospace, Consolas, monospace; color: var(--ink-2); word-break: break-all; }
.legacy .btn { margin-left: auto; flex: none; }
.bullets { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--sp-3); }
.bullets li { display: flex; gap: var(--sp-3); font-size: var(--fs-sm); }
.bullets li .icon { color: var(--accent-strong); margin-top: 2px; }

/* toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: var(--sp-3); }
.toast { display: flex; align-items: center; gap: var(--sp-3); min-width: 260px; max-width: 380px; padding: 12px 16px; border-radius: var(--radius-m); background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-3); font-size: var(--fs-sm); animation: up .3s var(--ease); }
.toast.err { background: var(--crit); color: var(--on-status); }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

/* carregamento */
.boot { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(600px 400px at 50% 40%, var(--accent-soft), var(--bg)); }
.boot img { width: 200px; height: auto; opacity: .95; animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; transform: scale(.98); } }
.skel { border-radius: var(--radius-s); background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sh 1.2s linear infinite; min-height: 16px; }
@keyframes sh { to { background-position: -200% 0; } }
.fade-in { animation: fade .45s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (forced-colors: active) { .chart .bar { fill: CanvasText; } .chip { border: 1px solid CanvasText; } }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  .sidebar, .topbar, .scrim, .banner-demo, .no-print, .content details:not(.attn-more), .attn-more > summary { display: none !important; }
  .attn-more > ul { display: grid !important; }
  .shell, .main { display: block; }
  .content { padding: 0 !important; }
  .card { box-shadow: none; break-inside: avoid; }
  .hero, .meta-bar i, .fn-track i, .attn-ico, .chip, .stamp, .chart .bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fade-in { animation: none !important; opacity: 1 !important; transform: none !important; }
  .print-only { display: block; }
  html, body, .content { background: #fff !important; }
  .g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .print-foot { margin-top: 16px; font-size: var(--fs-2xs); color: #555; }
}
