/* Estância da Barra — Gestão Financeira Agropecuária
   Identidade: verde-floresta, verde-sálvia, dourado discreto, bege, branco e grafite. */

@font-face { font-family: 'Cormorant Garamond'; font-weight: 500; font-display: swap; src: url('../assets/fonts/cormorant-garamond-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 600; font-display: swap; src: url('../assets/fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 700; font-display: swap; src: url('../assets/fonts/cormorant-garamond-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('../assets/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('../assets/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('../assets/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('../assets/fonts/inter-latin-700-normal.woff2') format('woff2'); }

:root {
  --forest: #203C32; --forest-2: #2B4D41; --forest-3: #3E6354; --forest-ink: #162B24;
  --sage: #8A9B85; --sage-2: #B9C4B5; --sage-3: #E3E8E0;
  --gold: #B49A62; --gold-2: #D6C597; --gold-3: #F1EAD8; --gold-ink: #7E6A3E;
  --beige: #F4F1E9; --beige-2: #ECE7DA; --white: #FFFFFF;
  --graphite: #333A36; --muted: #6E7772; --line: rgba(51, 58, 54, .12); --line-2: rgba(51, 58, 54, .07);
  --neg: #A4553F; --neg-bg: #F6E6E0; --warn: #9A7A2E; --warn-bg: #F6EED8; --ok: #3E6354; --ok-bg: #E2EBE4;
  --serif: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(22, 43, 36, .05), 0 4px 14px rgba(22, 43, 36, .05);
  --shadow-lg: 0 18px 50px rgba(22, 43, 36, .22);
  --sidebar: 268px; --sidebar-c: 76px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 14px; line-height: 1.45; color: var(--graphite); background: var(--beige); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
body.modal-open { overflow: hidden; }
a { color: var(--forest-3); }
h1, h2, h3, h4 { margin: 0; color: var(--forest); font-weight: 600; }
p { margin: 0 0 .5em; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; } .strong { font-weight: 600; }
.neg, td.neg, .num.neg { color: var(--neg) !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.spacer { flex: 1; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }

/* ---------- boot / fatal */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--forest); color: var(--gold-2); font-family: var(--serif); font-size: 18px; letter-spacing: .04em; }
.boot img { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.fatal { max-width: 640px; margin: 80px auto; padding: 0 16px; }

/* ---------- layout */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
body.collapsed .app { grid-template-columns: var(--sidebar-c) 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--forest); color: #DDE3DC; overflow: hidden; z-index: 30; }
.sidebar::after { content: ''; position: absolute; inset: 0 0 0 auto; width: 1px; background: linear-gradient(transparent, rgba(180, 154, 98, .45), transparent); }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 18px 18px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.brand-mark { width: 46px; height: auto; flex: none; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-family: var(--serif); font-size: 18px; font-weight: 700; letter-spacing: .04em; color: #F3F0E7; text-transform: uppercase; line-height: 1.05; }
.brand-text span { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-2); margin-top: 5px; line-height: 1.3; }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: #CBD3CA; text-decoration: none; font-size: 13.5px; position: relative; white-space: nowrap; transition: background .15s, color .15s; }
.nav-item svg { flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.on { background: rgba(180, 154, 98, .16); color: #fff; }
.nav-item.on::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav-item.on svg { color: var(--gold-2); opacity: 1; }
.sidebar-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255, 255, 255, .07); display: flex; flex-direction: column; gap: 8px; }
.collapse-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #AEB8AD; font: inherit; font-size: 12.5px; cursor: pointer; padding: 6px; border-radius: 6px; }
.collapse-btn:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.local-note { color: #8FA08D; font-size: 10.5px; letter-spacing: .03em; padding-left: 6px; }
body.collapsed .brand { justify-content: center; padding: 20px 8px; }
body.collapsed .brand-text, body.collapsed .nav-item span, body.collapsed .collapse-btn span, body.collapsed .local-note { display: none; }
body.collapsed .nav-item { justify-content: center; padding: 10px; }
body.collapsed .brand-mark { width: 42px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: rgba(244, 241, 233, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); min-height: 58px; }
.top-title { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--forest); }
.quick { display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }
.bell { position: relative; }
.bell-count { position: absolute; top: -3px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.bell-count.crit { background: var(--neg); }
.demo-flag, .backup-flag { font-size: 11.5px; padding: 4px 10px; border-radius: 20px; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.demo-flag { background: var(--gold-3); color: var(--gold-ink); border: 1px dashed var(--gold); }
.backup-flag { background: var(--neg-bg); color: var(--neg); }
.view { padding: 24px 28px 60px; outline: none; max-width: 1560px; width: 100%; }

/* ---------- cabeçalhos */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-family: var(--serif); font-size: 32px; font-weight: 600; letter-spacing: .01em; line-height: 1.1; }
.page-head .sub { color: var(--muted); margin-top: 4px; max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-title { font-family: var(--serif); font-size: 22px; margin: 26px 0 12px; }

/* ---------- botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 500; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--forest); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--forest-2); }
.btn.gold { background: var(--gold); color: #fff; }
.btn.gold:hover:not(:disabled) { background: #A68B54; }
.btn.secondary { background: var(--white); border-color: var(--line); color: var(--forest); }
.btn.secondary:hover:not(:disabled) { border-color: var(--sage); background: #FBFAF6; }
.btn.ghost { background: transparent; color: var(--forest-3); }
.btn.ghost:hover:not(:disabled) { background: rgba(32, 60, 50, .06); }
.btn.danger { background: var(--neg); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--neg); border-color: rgba(164, 85, 63, .35); }
.btn.danger-ghost:hover { background: var(--neg-bg); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: transparent; border: 0; color: var(--forest-3); cursor: pointer; text-decoration: none; flex: none; }
.icon-btn:hover { background: rgba(32, 60, 50, .08); color: var(--forest); }
.icon-btn.danger:hover { background: var(--neg-bg); color: var(--neg); }
td .icon-btn { width: 30px; height: 30px; }

/* ---------- cartões e KPIs */
.card { background: var(--white); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px 0; }
.card-head h3 { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-body { padding: 14px 20px 18px; }
.card > .card-body:only-child { padding-top: 18px; }
.card-toolbar { margin-bottom: 14px; }
.filters-card .card-body { padding: 12px 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.kpi { background: var(--white); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 15px 16px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; min-width: 0; position: relative; }
.kpi.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.kpi.clickable:hover { border-color: var(--sage-2); transform: translateY(-1px); }
.kpi.emph { background: var(--forest); border-color: var(--forest); }
.kpi.emph .kpi-label, .kpi.emph .kpi-sub { color: #C9D2C8; } .kpi.emph .kpi-value { color: #fff; } .kpi.emph .kpi-basis { background: rgba(255, 255, 255, .1); color: var(--gold-2); } .kpi.emph .kpi-value.neg { color: #F0B8A6 !important; }
.kpi-top { display: flex; align-items: center; gap: 7px; color: var(--sage); }
.kpi-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); flex: 1; min-width: 0; }
.kpi-basis { font-size: 10px; padding: 2px 7px; border-radius: 10px; background: var(--sage-3); color: var(--forest-3); white-space: nowrap; }
.kpi-value { font-family: var(--serif); font-size: 27px; font-weight: 600; color: var(--forest); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.grid-2c { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2c.tight { gap: 14px; align-items: start; }
.chart-box { position: relative; width: 100%; }

/* ---------- alertas */
.alert-strip { display: grid; gap: 8px; margin-bottom: 18px; }
.alert-pill { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 9px; border: 1px solid; font-size: 13px; }
.alert-pill > div:nth-child(2) { flex: 1; display: flex; flex-direction: column; } .alert-pill span { color: var(--graphite); font-size: 12.5px; }
.alert-pill.critico { background: var(--neg-bg); border-color: rgba(164, 85, 63, .25); color: var(--neg); }
.alert-pill.atencao { background: var(--warn-bg); border-color: rgba(154, 122, 46, .25); color: var(--warn); }
.alert-pill-actions { display: flex; gap: 4px; align-items: center; }
.more-alerts { font-size: 12.5px; }
.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alert-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 9px; border: 1px solid var(--line); background: #FDFCF9; }
.alert-item.critico { border-left: 3px solid var(--neg); } .alert-item.atencao { border-left: 3px solid var(--gold); } .alert-item.info { border-left: 3px solid var(--sage); }
.alert-item.seen { opacity: .6; }
.alert-icon { color: var(--muted); padding-top: 2px; } .alert-item.critico .alert-icon { color: var(--neg); } .alert-item.atencao .alert-icon { color: var(--warn); }
.alert-text { flex: 1; min-width: 0; } .alert-text p { margin: 2px 0 0; font-size: 12.8px; color: var(--graphite); }
.alert-actions { display: flex; gap: 6px; align-items: center; }
.badge.lv { margin-left: 8px; font-size: 10px; }

/* ---------- formulários */
input, select, textarea { font: inherit; color: var(--graphite); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); height: 38px; padding: 0 11px; min-width: 0; }
textarea { height: auto; padding: 9px 11px; resize: vertical; width: 100%; }
input[type='checkbox'] { height: 16px; width: 16px; accent-color: var(--forest); padding: 0; margin: 0; }
input[type='file'] { height: auto; padding: 6px; border-style: dashed; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--sage); outline: none; box-shadow: 0 0 0 3px rgba(138, 155, 133, .18); }
input.money { text-align: right; font-variant-numeric: tabular-nums; }
select:disabled { background: #F6F5F0; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12px; font-weight: 600; color: var(--forest-3); letter-spacing: .01em; }
.field input, .field select { width: 100%; }
.req { color: var(--gold-ink); }
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
label.check.big { font-size: 15px; font-weight: 600; color: var(--forest); margin-bottom: 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; margin-top: 12px; }
.span-2 { grid-column: span 2; }
.subhead { font-family: var(--serif); font-size: 17px; color: var(--forest); border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: 4px; }
fieldset { border: 0; border-top: 1px solid var(--line-2); padding: 14px 0 6px; margin: 0; }
fieldset:first-of-type { border-top: 0; padding-top: 2px; }
legend { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--forest); padding: 0 8px 0 0; }
.form-errors { background: var(--neg-bg); color: var(--neg); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.form-errors ul { margin: 4px 0 0; padding-left: 18px; }
.settle-box { background: var(--beige); border-radius: 8px; padding: 12px; margin-top: 10px; }
.rateio { background: var(--beige); border-radius: 8px; padding: 12px; }
.rateio-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.rateio-rows { display: flex; flex-direction: column; gap: 8px; }
.rateio-row { display: grid; grid-template-columns: 1fr 160px 34px; gap: 8px; }
.rateio-status { font-size: 12.5px; font-weight: 600; } .rateio-status.ok { color: var(--ok); } .rateio-status.bad { color: var(--neg); }
.rateio-actions { display: flex; gap: 8px; margin: 8px 0 6px; }
.payments { margin-top: 12px; }
.pay-summary { display: flex; gap: 14px; align-items: center; font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; }
.pay-add { display: grid; grid-template-columns: 140px 150px 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 10px; padding: 12px; background: var(--beige); border-radius: 8px; }
.attachment { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.att-name { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.inline-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.note { background: var(--sage-3); color: var(--forest); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; display: flex; gap: 6px; align-items: flex-start; }
.note.warn { background: var(--warn-bg); color: #6E5620; }
.note.demo { background: var(--gold-3); color: var(--gold-ink); border: 1px dashed var(--gold); }
.months-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 10px 0 6px; }
.month { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; }
.month input { width: 100%; height: 34px; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.big-num { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--forest); padding-top: 4px; }
.logo-box { display: flex; gap: 18px; align-items: center; }
.logo-prev { width: 120px; height: 90px; object-fit: contain; background: var(--forest); border-radius: 10px; padding: 10px; flex: none; }

/* ---------- filtros e abas */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.period-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.period-filter select, .period-filter input, .filters select { height: 36px; }
.seg { display: inline-flex; background: var(--beige-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; font: inherit; font-size: 12.8px; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg-btn.on { background: var(--white); color: var(--forest); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { border: 0; background: none; font: inherit; font-size: 14px; padding: 10px 16px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tab.on { color: var(--forest); border-bottom-color: var(--gold); }
.tab:hover { color: var(--forest); }
.toolbar-row { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-row p { margin: 0; max-width: 720px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }

/* ---------- tabelas */
.table-wrap { display: flex; flex-direction: column; }
.table-toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 16px 10px; flex-wrap: wrap; }
.toolbar-extra { display: flex; gap: 6px; }
.table-info { margin-left: auto; color: var(--muted); font-size: 12px; }
.search-box { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 10px; background: var(--white); color: var(--muted); min-width: 240px; }
.search-box input { border: 0; height: 34px; padding: 0; width: 100%; box-shadow: none !important; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--line); background: #FBFAF6; white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tbody tr:hover { background: #FAF8F2; }
table.data tr.clickable { cursor: pointer; }
table.data tfoot td { font-weight: 700; color: var(--forest); background: var(--beige); border-top: 1px solid var(--line); }
table.data tr.strong td { font-weight: 700; background: #F8F6EF; }
table.data.compact td, table.data.compact th { padding: 6px 8px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--forest); }
th.sorted.asc::after { content: ' ▲'; font-size: 9px; } th.sorted.desc::after { content: ' ▼'; font-size: 9px; }
.a-right { text-align: right !important; } .a-center { text-align: center; }
.table-empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 10px; font-size: 12.5px; color: var(--muted); }
.pager:empty { display: none; }
table.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
table.mini th, table.mini td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); text-align: left; }
.desc { display: flex; flex-direction: column; gap: 1px; max-width: 360px; }
.desc small { font-size: 11.5px; }
.att-ic { color: var(--gold); display: inline; vertical-align: middle; }
.amt.in { color: var(--forest-3); font-weight: 600; } .amt.out { color: var(--graphite); font-weight: 600; } .amt.transfer { color: var(--muted); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
tr.demo td:first-child { box-shadow: inset 3px 0 0 var(--gold-2); }
tr.cancelled td { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .25); }
tr.cancelled td:last-child, tr.cancelled td .badge { text-decoration: none; }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--neg); }
tr.estimate td { color: #6F7A74; font-style: italic; }
tr.neg-row td:last-child { background: var(--neg-bg); }
tr.over td { background: #FBF1ED; } tr.near td { background: #FCF8EC; }
.list-foot { margin-top: -6px; }
.prazo { font-size: 12px; white-space: nowrap; } .prazo.late { color: var(--neg); font-weight: 600; } .prazo.soon { color: var(--warn); font-weight: 600; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 12px; white-space: nowrap; background: var(--sage-3); color: var(--forest-3); }
.badge.st-prevista { background: #EEF0EC; color: var(--muted); border: 1px dashed var(--sage-2); }
.badge.st-pendente { background: var(--gold-3); color: var(--gold-ink); }
.badge.st-parcial { background: #E7EEF0; color: #3F6371; }
.badge.st-liquidada { background: var(--ok-bg); color: var(--ok); }
.badge.st-cancelada { background: #EEEDEA; color: #8A8D89; }
.badge.overdue, .badge.st-overdue { background: var(--neg-bg); color: var(--neg); }
.badge.st-planejada, .badge.st-planejado { background: #EEF0EC; color: var(--muted); }
.badge.st-em_andamento { background: var(--gold-3); color: var(--gold-ink); }
.badge.st-colhida, .badge.st-encerrada, .badge.st-encerrado { background: var(--ok-bg); color: var(--ok); }
.chip { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 10px; background: var(--sage-3); color: var(--forest-3); margin-left: 6px; white-space: nowrap; }
.chip.gold { background: var(--gold-3); color: var(--gold-ink); } .chip.light { background: #F2F2EE; color: var(--muted); }
.trend { font-size: 12px; font-weight: 600; white-space: nowrap; }
.trend.favorable { color: var(--ok); } .trend.unfavorable { color: var(--neg); } .trend.neutral, .trend.flat { color: var(--muted); }

/* ---------- comparação / demonstrativo */
.statement { display: flex; flex-direction: column; }
.stmt-line { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 13.5px; }
.stmt-line.indent { padding-left: 16px; color: #4C5550; }
.stmt-line.strong { font-weight: 700; color: var(--forest); border-bottom: 1px solid var(--line); }
.stmt-group { margin: 10px 0 4px; }
.stmt-group h4 { font-family: var(--serif); font-size: 16px; margin-bottom: 2px; }
.split-lines { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; border-top: 1px solid var(--line-2); padding-top: 10px; font-size: 13px; }
.split-lines div { display: flex; justify-content: space-between; gap: 12px; }

/* ---------- projetos (safras/ciclos) */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-bottom: 18px; }
.project { background: var(--white); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; cursor: pointer; transition: border-color .15s, transform .15s; display: flex; flex-direction: column; gap: 12px; }
.project:hover { border-color: var(--sage-2); transform: translateY(-1px); }
.project header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.project h3 { font-family: var(--serif); font-size: 20px; line-height: 1.15; }
.project .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.project footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line-2); padding-top: 10px; }
dl.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 0; }
dl.metrics.wide { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
dl.metrics dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
dl.metrics dd { margin: 2px 0 0; font-weight: 600; color: var(--forest); font-size: 15px; font-variant-numeric: tabular-nums; }

/* ---------- árvore de cadastros */
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 2px 0 8px 18px; padding: 0 0 0 12px; border-left: 1px solid var(--line); }
.tree-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; flex-wrap: wrap; }
.tree-row:hover { background: #FAF8F2; }
.tree-node { border-bottom: 1px solid var(--line-2); padding: 4px 0; }
.tree-node:last-child { border-bottom: 0; }
.inactive > .tree-row > *:not(.badge):not(.icon-btn) { opacity: .55; }

/* ---------- relatórios */
.report-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.report-nav { display: flex; flex-direction: column; gap: 3px; position: sticky; top: 76px; background: var(--white); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.report-tab { text-align: left; border: 0; background: none; font: inherit; font-size: 13.2px; padding: 9px 12px; border-radius: 7px; cursor: pointer; color: var(--graphite); display: flex; align-items: center; gap: 8px; }
.report-tab:hover { background: #F7F5EE; }
.report-tab.on { background: var(--forest); color: #fff; }
.report-tab:first-child { font-weight: 600; }
.report-head .card-body { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.report-head h2 { font-family: var(--serif); font-size: 24px; }
.report-head .sub { color: var(--muted); }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
ul.notes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.insights li::marker { color: var(--gold); }
.exec-preview { background: var(--white); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 28px 28px; overflow: hidden; }
.exec-cover { margin: 0 -28px 22px; padding: 30px 28px 26px; background: var(--forest); color: #E6EBE4; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; border-bottom: 3px solid var(--gold); }
.exec-cover img { width: 240px; max-width: 70%; }
.exec-kicker { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-2); margin-top: 8px; }
.exec-cover h2 { color: #fff; font-family: var(--serif); font-size: 30px; }
.exec-cover p { font-size: 12px; color: #B9C4B5; margin: 0; max-width: 680px; }
.exec-h { font-family: var(--serif); font-size: 22px; margin: 24px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--gold-2); }
.exec-preview h4 { font-family: var(--serif); font-size: 16px; margin-bottom: 6px; }
.exec-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.exec-kpi { background: #FAF9F5; border: 1px solid var(--line-2); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.exec-kpi span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.exec-kpi strong { font-family: var(--serif); font-size: 22px; color: var(--forest); }
.exec-kpi small { font-size: 11.5px; color: var(--muted); }
.exec-kpi.dark { background: var(--forest); } .exec-kpi.dark span { color: var(--gold-2); } .exec-kpi.dark strong { color: #fff; }

/* ---------- orçamento */
.meter { display: flex; align-items: center; gap: 8px; min-width: 160px; }
.meter-bar { flex: 1; height: 7px; background: var(--beige-2); border-radius: 4px; overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--forest-3); border-radius: 4px; }
.meter-bar span.near { background: var(--gold); } .meter-bar span.over { background: var(--neg); }

/* ---------- vazio, modal, toast */
.empty { text-align: center; padding: 34px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h3 { font-family: var(--serif); font-size: 21px; }
.empty p { color: var(--muted); max-width: 520px; }
.empty-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--sage-3); color: var(--forest-3); }
.overlay { position: fixed; inset: 0; background: rgba(22, 43, 36, .45); display: grid; place-items: center; padding: 20px; z-index: 100; opacity: 0; transition: opacity .18s; }
.overlay.in { opacity: 1; }
.modal { background: var(--white); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; transform: translateY(10px); transition: transform .18s; }
.overlay.in .modal { transform: none; }
.modal.sm { max-width: 460px; } .modal.md { max-width: 640px; } .modal.lg { max-width: 880px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px 12px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-family: var(--serif); font-size: 23px; }
.modal-head .sub { color: var(--muted); font-size: 12.5px; margin: 2px 0 0; }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-footer { display: flex; gap: 8px; align-items: center; padding: 12px 22px 16px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.modal-footer:empty { display: none; }
.check-list { padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--forest); color: #fff; padding: 11px 15px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: 13px; transform: translateY(8px); opacity: 0; transition: all .22s; }
.toast.in { transform: none; opacity: 1; }
.toast.error { background: var(--neg); } .toast.warn { background: #7E6A3E; }
.toast svg { flex: none; margin-top: 1px; }
.danger-zone { border-color: rgba(164, 85, 63, .25); }
.error-card { padding: 20px; }

/* ---------- responsivo */
@media (max-width: 1180px) {
  .grid-main, .grid-2c { grid-template-columns: minmax(0, 1fr); }
  .report-layout { grid-template-columns: minmax(0, 1fr); }
  .report-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .exec-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app, body.collapsed .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .22s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.collapsed .brand-text, body.collapsed .nav-item span { display: flex; }
  body.collapsed .nav-item { justify-content: flex-start; padding: 9px 12px; }
  .collapse-btn { display: none; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 8px 16px; }
  .top-title { display: none; }
  .quick .btn span { display: none; }
  .quick .btn { padding: 0 10px; }
  .view { padding: 18px 16px 50px; }
  .page-head h1 { font-size: 27px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 22px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .pay-add { grid-template-columns: 1fr 1fr; }
  .months-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .search-box { min-width: 0; flex: 1; }
  .backup-flag, .demo-flag { display: none; }
  .modal-body, .modal-head, .modal-footer { padding-left: 16px; padding-right: 16px; }
  .exec-preview { padding: 0 16px 20px; } .exec-cover { margin: 0 -16px 18px; }
}
@media (max-width: 520px) {
  .kpi-grid, .kpi-grid.k2 { grid-template-columns: minmax(0, 1fr); }
  .rateio-row { grid-template-columns: 1fr 110px 30px; }
  .exec-kpis { grid-template-columns: minmax(0, 1fr); }
  .quick-link { display: none; }
}

@media print {
  .sidebar, .topbar, .page-actions, .filters-card, .table-toolbar, .row-actions, .pager, .tabs, .report-nav { display: none !important; }
  .app { display: block; } .view { padding: 0; } body { background: #fff; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
}

/* checkboxes dentro de campos */
.field label.check { font-size: 13px; font-weight: 500; color: var(--graphite); }
.field input[type='checkbox'], label.check input[type='checkbox'] { width: 16px; flex: none; }

/* ---------- acesso (modo nuvem) */
.auth { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at top, #2B4D41, var(--forest) 60%, var(--forest-ink)); overflow-y: auto; }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.auth-logo { width: 280px; max-width: 80%; }
.auth-kicker { color: var(--gold-2); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; margin-bottom: 18px; }
.auth-form { width: 100%; background: rgba(255, 255, 255, .06); border: 1px solid rgba(180, 154, 98, .35); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; color: #DDE3DC; font-size: 12.5px; font-weight: 600; }
.auth-form input { height: 44px; background: rgba(255, 255, 255, .95); }
.auth-btn { height: 44px; width: 100%; }
.auth-link { background: none; border: 0; color: var(--gold-2); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; }
.auth-msg { background: rgba(164, 85, 63, .2); color: #F6D6CB; border-radius: 8px; padding: 10px 12px; font-size: 13px; width: 100%; }
.auth-msg.ok { background: rgba(138, 155, 133, .25); color: #E3E8E0; }
.auth-foot { color: #9FB09D; font-size: 11.5px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.auth-loading { color: var(--gold-2); font-family: var(--serif); font-size: 18px; }
.user-box { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px; }
.user-mail { color: #F3F0E7; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: #8FA08D; font-size: 10.5px; }
body.collapsed .user-mail, body.collapsed .user-role { display: none; }
/* perfil somente leitura: oculta ações de gravação (o banco também as bloqueia) */
body.readonly .quick .btn, body.readonly .page-actions .btn.primary, body.readonly .page-actions .btn.gold, body.readonly .page-actions .btn.secondary,
body.readonly .row-actions .icon-btn, body.readonly .row-actions .btn, body.readonly .toolbar-row > .btn { display: none !important; }

/* ---------- boletos e comprovantes */
.att-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.att-picker .hint { flex-basis: 100%; }
.att-link span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
textarea.mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: .02em; }
.row-gap.tight { margin-top: 6px; gap: 8px; }
.row-actions.left { justify-content: flex-start; flex-wrap: wrap; }
fieldset.boleto-set { background: var(--gold-3); border: 1px dashed var(--gold); border-radius: 10px; padding: 12px 14px 10px; margin: 6px 0 10px; }
fieldset.boleto-set legend { padding: 0 6px; }
.pay-add { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; }
.pay-add .pay-rec { grid-column: 1 / -1; }
table.mini .att-picker .btn { height: 28px; }

/* ---------- funcionários e pró-labore */
.badge.ms-nao_lancado { background: #EEF0EC; color: var(--muted); border: 1px dashed var(--sage-2); }
.badge.ms-pendente { background: var(--gold-3); color: var(--gold-ink); }
.badge.ms-parcial { background: #E7EEF0; color: #3F6371; }
.badge.ms-pago { background: var(--ok-bg); color: var(--ok); }
.inactive-card { opacity: .6; }
table.data.compact input.money { height: 32px; }
