:root {
  --bg: #f7f1df;
  --panel: #fff;
  --soft: #fbf6e8;
  --line: #ded6c3;
  --text: #142235;
  --muted: #65707b;
  --teal: #0c4c62;
  --teal-dark: #08394b;
  --teal-soft: #e2f0ee;
  --green: #157348;
  --green-soft: #e4f2e8;
  --amber: #b97906;
  --amber-soft: #fff0c8;
  --red: #c62828;
  --red-soft: #ffe8e8;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.side {
  background: rgba(255, 252, 242, .94);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  background: linear-gradient(135deg, rgba(255,255,255,.72), rgba(251,246,232,.9));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 10px 22px rgba(20, 34, 53, .05);
}

.brand-image {
  position: relative;
  min-height: 86px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(247, 241, 223, .06), rgba(247, 241, 223, .15)),
    url("assets/menzinho-backoffice-header.png") center / cover no-repeat;
}

.brand-image .mark,
.brand-image strong,
.brand-image span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.brand span, .overline, .muted, small { color: var(--muted); }
.brand span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.nav { display: grid; gap: 3px; margin-top: 18px; }
.nav button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0 10px;
  text-align: left;
  cursor: pointer;
}
.nav button:hover, .nav button.active { background: var(--teal-soft); color: var(--teal-dark); font-weight: 700; }

.main { min-width: 0; padding: 22px clamp(18px, 2vw, 30px) 34px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.overline { margin: 0 0 5px; font-size: 13px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 27px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; margin-bottom: 8px; }

.actions, .row, .filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
button.primary, button.secondary {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
}
.primary { border: 1px solid var(--teal); background: var(--teal); color: #fff; font-weight: 700; }
.secondary { border: 1px solid var(--line); background: #fff; color: var(--text); }
.compact { min-height: 32px !important; padding: 0 10px !important; }
.as-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 8px 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.icon-btn,
.icon-upload {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}
.icon-btn svg,
.icon-upload svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-upload input { display: none; }
.help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1px solid #9fb0b8;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: help;
}
.tip {
  display: none;
  position: absolute;
  z-index: 40;
  max-width: 260px;
  margin-top: 22px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(17,24,39,.14);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}
.help:hover + .tip,
.help:focus + .tip { display: inline-block; }

.view { display: none; }
.view.active { display: block; }
.empty-state {
  min-height: 180px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-grid { grid-template-columns: minmax(0, 1.16fr) minmax(360px, .84fr); align-items: start; }

.card, .metric, .lane, .report-page {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.card, .metric, .lane { padding: 14px; }
.metric strong { display: block; font-size: 24px; margin: 6px 0 3px; }
.good strong, .positive { color: var(--green); }
.warn strong, .warning { color: var(--amber); }
.bad strong, .negative { color: var(--red); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 650px; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--soft); text-transform: uppercase; font-size: 12px; color: #334155; }
tr:last-child td { border-bottom: 0; }
.money { text-align: right; white-space: nowrap; font-weight: 800; }

.account-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.account-chip {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.account-chip small {
  color: var(--muted);
  font-weight: 800;
}

.account-chip strong {
  font-size: 14px;
}

.account-chip span {
  font-weight: 900;
}

.contract-grid {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 2px;
  gap: 12px;
  margin-top: 12px;
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
}

.contract-card {
  flex: 0 0 min(560px, calc(100vw - 360px));
  max-width: 560px;
  min-width: 0;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  scroll-snap-align: start;
}

.contract-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
}

.contract-head > div {
  min-width: 0;
}

.contract-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.contract-head p,
.contract-section p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.contract-facts strong,
.contract-section strong {
  overflow-wrap: anywhere;
}

.contract-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.contract-facts div,
.contract-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 9px 10px;
  min-width: 0;
  overflow: hidden;
}

.contract-facts small,
.contract-section small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.contract-facts strong {
  display: block;
  margin-top: 3px;
}

.contract-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.finance-list,
.compact-list {
  display: grid;
  gap: 10px;
}

.finance-card,
.registry-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.finance-card-main,
.finance-card-values,
.registry-card > div {
  min-width: 0;
}

.finance-card-main small,
.finance-card-main p,
.registry-card p,
.registry-card small {
  display: block;
  margin: 2px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.finance-card-main strong,
.registry-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.finance-card-values {
  display: grid;
  justify-items: end;
  gap: 2px;
  white-space: nowrap;
}

.bad-text { color: var(--bad); }
.warn-text { color: var(--warn); }

.entry-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.entry-card {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.entry-card p {
  margin: 3px 0;
}

.entry-card small {
  color: var(--muted);
}

.payment-list {
  display: grid;
  gap: 8px;
}

.payment-item {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr) minmax(145px, auto);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.payment-date strong,
.payment-date small,
.payment-main strong,
.payment-main span,
.payment-main small,
.payment-amount strong {
  display: block;
}

.payment-main {
  min-width: 0;
}

.payment-main span,
.payment-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-amount {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.chip.good { background: var(--green-soft); color: var(--green); }
.chip.warn { background: var(--amber-soft); color: var(--amber); }
.chip.bad { background: var(--red-soft); color: var(--red); }
.chip.info { background: var(--teal-soft); color: var(--teal-dark); }

.status {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 11px;
}
.status.good { border-color: #b7e5c6; background: var(--green-soft); }
.status.warn { border-color: #f0cf91; background: var(--amber-soft); }
.status.bad { border-color: #f2b4b4; background: var(--red-soft); }

.recon-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.recon-head h2 { margin: 2px 0 4px; font-size: 28px; }
.recon-head p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.recon-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.recon-summary-card { min-height: 102px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 14px; cursor: pointer; }
.recon-summary-card span, .recon-summary-card small { display: block; color: var(--muted); }
.recon-summary-card strong { display: block; margin: 5px 0; font-size: 27px; color: var(--teal-dark); }
.recon-summary-card.warn strong { color: var(--amber); }
.recon-summary-card.bad strong { color: var(--red); }
.recon-summary-card.good strong { color: var(--green); }
.recon-summary-card.active { border: 2px solid var(--teal); padding: 13px; background: var(--teal-soft); }
.recon-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 14px 0 10px; }
.recon-tabs { display: flex; gap: 4px; overflow-x: auto; }
.recon-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); padding: 10px 12px; cursor: pointer; }
.recon-tabs button.active { color: var(--teal-dark); border-bottom-color: var(--teal); font-weight: 800; }
.recon-search { width: min(310px, 100%); }
.recon-progress { display: none; }
.recon-layout { display: grid; grid-template-columns: minmax(280px, 34%) minmax(0, 1fr); gap: 14px; align-items: start; }
.recon-queue { max-height: 720px; overflow: auto; }
.recon-review { min-width: 0; }
.list { display: grid; gap: 8px; }
.list-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  text-align: left;
}
.list-card.active { border-color: var(--teal); background: var(--teal-soft); }
.list-card > span:not(.list-card-head):not(.list-card-foot), .list-card > small { display: block; margin-top: 5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
.list-card-head strong { overflow-wrap: anywhere; }
.list-card-head b { justify-self: start; white-space: normal; }
.list-card-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.list-card-foot { align-items: center; margin-top: 8px; }
.list-card-foot em { color: var(--muted); font-size: 12px; font-style: normal; }
.recon-movement { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.recon-movement h2 { margin: 3px 0; }
.recon-movement p { margin: 0; color: var(--muted); }
.recon-amount { font-size: 25px; white-space: nowrap; }
.recon-match { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 8px; background: var(--green-soft); }
.recon-match.missing { border-left-color: var(--amber); background: var(--amber-soft); }
.recon-match h3, .recon-match p { margin: 3px 0; }
.recon-guidance { margin-top: 12px; padding: 12px; border-radius: 8px; border: 1px solid #b7e5c6; background: var(--green-soft); }
.recon-guidance.warn { border-color: #f0cf91; background: var(--amber-soft); }
.recon-guidance p { margin: 5px 0 0; }
.recon-actions { position: sticky; bottom: -1px; display: flex; flex-wrap: nowrap; gap: 8px; margin: 14px -18px -18px; padding: 12px 18px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); z-index: 2; overflow-x: auto; }
.recon-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 1 1 0; min-width: 150px; white-space: nowrap; }
.recon-actions svg { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; }
.payment-workflow-head { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; margin-bottom:14px; }
.payment-workflow-head h2, .payment-work-card h2 { margin:2px 0; }
.payment-work-card { margin-top:14px; }
.payment-work-item { display:grid; grid-template-columns:minmax(0,1fr) auto 42px; gap:12px; align-items:center; padding:12px 0; border-top:1px solid var(--line); }
.payment-work-item:first-of-type { border-top:0; }
.payment-work-item div:first-child { display:grid; gap:3px; min-width:0; }
.payment-work-item span, .payment-work-item small { color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.payment-work-value { display:grid; justify-items:end; gap:5px; }
.reconciliation-view .top { display: none; }

@media (min-width: 761px) and (max-width: 1180px) {
  .recon-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recon-layout { grid-template-columns: minmax(260px, 38%) minmax(0, 1fr); }
  .recon-queue { max-height: 640px; }
  .recon-head { align-items: flex-start; }
  .recon-head > div:first-child { max-width: 70%; }
}
.doc-preview {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: repeating-linear-gradient(0deg, #fff 0 23px, #eef3f4 24px);
  padding: 16px;
}

.files-table td:first-child {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { display: grid; gap: 6px; font-weight: 700; font-size: 13px; }
.field-label { display: inline-flex; align-items: center; gap: 5px; width: max-content; max-width: 100%; }
.field-label .help { margin: 0; flex: 0 0 auto; }
input, select, textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5dc;
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
}
textarea { min-height: 82px; resize: vertical; }
.upload { display: grid; min-height: 86px; place-items: center; border: 1px dashed #b9c6cc; border-radius: 8px; background: var(--soft); color: var(--muted); text-align: center; padding: 10px; }

.kanban-focus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.kanban-stats { display: grid; grid-template-columns: repeat(3, 92px); gap: 8px; }
.kanban-stats div { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px; text-align: center; }
.kanban-stats strong, .kanban-stats span { display: block; }
.kanban-stats span { font-size: 12px; color: var(--muted); }
.filter-strip { display: grid; grid-template-columns: repeat(5, minmax(145px, 1fr)) auto; gap: 10px; align-items: end; margin: 12px 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.board { display: grid; grid-template-columns: repeat(6, minmax(245px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.lane { min-height: 520px; background: #f8fbfb; }
.task { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; cursor: grab; }
.task.dragging { opacity: .5; }

.report-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.report-page { min-height: 640px; padding: 22px; box-shadow: 0 14px 32px rgba(17,24,39,.08); }
.management-reports { margin-top: 14px; }
.reports-view .top { display: none; }
.reports-view .main { padding-top: 22px; }
.report-overview-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; }
.report-overview-head h2 { margin: 2px 0 4px; font-size: 28px; }
.report-overview-head p { margin: 0; color: var(--muted); }
.annual-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.annual-kpis > div { padding: 18px; border-right: 1px solid var(--line); }
.annual-kpis > div:last-child { border-right: 0; }
.annual-kpis span, .annual-kpis small, .annual-kpis strong { display: block; }
.annual-kpis span { color: var(--muted); font-size: 13px; }
.annual-kpis strong { margin: 7px 0 5px; font-size: 24px; color: var(--navy); font-variant-numeric: tabular-nums; }
.annual-kpis strong .numeric-value { margin: 0; color: inherit; }
.numeric-value { font-variant-numeric: tabular-nums; }
.negative-value, .annual-kpis strong .negative-value { color: var(--red) !important; }
.annual-kpis small { color: var(--muted); }
.annual-charts { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 14px; margin-top: 14px; }
.annual-charts > section { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.chart-heading { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.chart-heading span, .chart-heading strong { display: block; }
.chart-heading span, .chart-heading small { color: var(--muted); font-size: 12px; }
.chart-heading strong { margin-top: 3px; font-size: 18px; }
.year-picker { min-width: 132px; color: var(--muted); }
.year-picker select { margin-top: 5px; color: var(--text); font-size: 16px; font-weight: 800; }
.donut-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: center; min-height: 245px; padding-top: 12px; }
.donut-chart { position: relative; display: grid; place-content: center; width: 170px; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(var(--teal) 0 var(--result), #e8b853 var(--result) 100%); text-align: center; }
.donut-chart::after { content: ""; position: absolute; inset: 29px; border-radius: 50%; background: #fff; }
.donut-chart strong, .donut-chart span { position: relative; z-index: 1; display: block; }
.donut-chart strong { font-size: 25px; color: var(--navy); }
.donut-chart span { color: var(--muted); font-size: 12px; }
.donut-legend { display: grid; gap: 10px; }
.donut-legend p { display: grid; grid-template-columns: 11px minmax(0, 1fr); gap: 4px 8px; margin: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.donut-legend p .numeric-value { grid-column: 2; font-weight: 800; }
.donut-legend i, .chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.donut-legend i.result, .chart-legend i.revenue { background: var(--teal); }
.donut-legend i.absorbed { background: #e8b853; }
.chart-explanation { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.monthly-panel { margin-top: 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.monthly-chart-shell { display: grid; grid-template-columns: 52px minmax(0, 1fr); margin-top: 18px; }
.monthly-axis { display: flex; flex-direction: column; justify-content: space-between; height: 226px; padding: 0 7px 0 0; color: var(--muted); font-size: 10px; text-align: right; }
.monthly-chart { display: grid; grid-template-columns: repeat(12, minmax(34px, 1fr)); gap: 8px; height: 250px; border-bottom: 1px solid var(--line); }
.month-column { display: grid; grid-template-rows: 1fr 24px; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; text-align: center; cursor: pointer; }
.month-column:hover .month-bars, .month-column:focus-visible .month-bars { background-color: var(--teal-soft); }
.month-bars { position: relative; min-height: 0; background: linear-gradient(to top, #edf1f2 1px, transparent 1px); background-size: 100% 25%; }
.month-bar { position: absolute; bottom: 0; left: 50%; width: min(24px, 72%); min-height: 0; border-radius: 3px 3px 0 0; transform: translateX(-50%); }
.month-bar.revenue { background: var(--teal); }
.month-bar.expense, .chart-legend i.expense { width: min(38px, 96%); background: #d06464; opacity: .48; }
.month-total-bar { position: absolute; bottom: 0; left: 50%; border-radius: 3px 3px 0 0; transform: translateX(-50%); }
.month-total-bar.expense { z-index: 1; width: min(34px, 82%); background: #d06464; opacity: .62; }
.month-total-bar.revenue { z-index: 2; width: min(20px, 48%); background: var(--teal); }
.stack-column { position: absolute; bottom: 0; display: flex; flex-direction: column-reverse; width: min(18px, 44%); overflow: hidden; border-radius: 3px 3px 0 0; }
.entry-stack { left: calc(50% - 10px); transform: translateX(-50%); }
.payment-stack { left: calc(50% + 10px); transform: translateX(-50%); }
.stack-column .segment { display: block; width: 100%; min-height: 0; border-radius: 0; }
.segment.service, .chart-legend i.service { background: var(--teal); }
.segment.investment-income, .chart-legend i.investment-income { background: var(--green); }
.segment.operating, .chart-legend i.operating { background: var(--navy); }
.segment.tax, .chart-legend i.tax { background: #e8b853; }
.segment.distribution, .chart-legend i.distribution { background: #d06464; }
.segment.other-payment, .chart-legend i.other-payment { background: #8a969b; }
.month-column small { padding-top: 6px; color: var(--muted); }
.chart-legend { display: flex; justify-content: flex-end; gap: 18px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend.detailed { flex-wrap: wrap; justify-content: center; }
.composition-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.composition-summary > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.composition-summary header { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.composition-summary header span { color: var(--muted); font-variant-numeric: tabular-nums; }
.composition-track { display: flex; height: 12px; margin: 9px 0; overflow: hidden; border-radius: 3px; background: #e4e9e9; }
.composition-segment { display: block; height: 100%; }
.composition-segment.service { background: var(--teal); }
.composition-segment.investment-income { background: var(--green); }
.composition-segment.operating { background: var(--navy); }
.composition-segment.tax { background: #e8b853; }
.composition-segment.distribution { background: #d06464; }
.composition-segment.other-payment { background: #8a969b; }
.composition-summary footer { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 10px; }
.composition-summary footer span { display: inline-flex; align-items: center; gap: 5px; }
.composition-summary footer i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.chart-data-warning { margin-top: 12px; padding: 10px 12px; border: 1px solid #ebcf86; border-radius: 7px; background: var(--amber-soft); color: var(--muted); font-size: 12px; }
.chart-data-warning strong { color: var(--amber); }
.report-open-period { margin-top: 14px; }
.monthly-detail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.monthly-detail div { padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.monthly-detail span, .monthly-detail strong { display: block; }
.monthly-detail span { color: var(--muted); font-size: 12px; }
.monthly-detail strong { margin-top: 6px; font-size: 22px; }
.monthly-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.monthly-totals div { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.monthly-totals span, .monthly-totals strong { display: block; }
.monthly-totals span { color: var(--muted); font-size: 11px; }
.monthly-totals strong { margin-top: 5px; font-size: 17px; white-space: nowrap; }
.monthly-breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.monthly-breakdown section { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 8px; }
.monthly-breakdown h3 { margin: 0 0 8px; font-size: 14px; }
.monthly-breakdown p { display: flex; justify-content: space-between; gap: 14px; margin: 0; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.monthly-breakdown p span { color: var(--muted); }
.monthly-breakdown p strong { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.monthly-breakdown .financial-movement { margin-top: 4px; padding: 8px; border: 1px dashed var(--teal); border-radius: 6px; background: var(--teal-soft); }
.monthly-breakdown small { display: block; font-size: 9px; }
.popup-note { margin: 12px 0 0; font-size: 11px; }
.cash-position { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.cash-position div { padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); }
.cash-position span, .cash-position strong { display: block; }
.cash-position span { color: var(--muted); font-size: 10px; }
.cash-position strong { margin-top: 4px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cash-position .cash-variation { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; background: #fff; }
.cash-equation { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.report-library { margin-top: 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.report-library-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.report-library-head h2, .report-library-head p { margin: 0; }
.report-library-head p { margin-top: 4px; color: var(--muted); }
.report-library-head > span { display: inline-flex; align-items: center; gap: 6px; color: var(--teal); font-weight: 800; }
.report-library-head svg, .report-download-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.report-download-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.report-download { display: grid; grid-template-columns: 36px minmax(0, 1fr) 40px; align-items: center; gap: 10px; min-height: 92px; padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.report-download-icon { display: grid; place-items: center; width: 34px; height: 34px; color: var(--teal); background: var(--soft); border-radius: 6px; }
.report-download p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.report-disclaimer { margin: 12px 2px 0; color: var(--muted); font-size: 12px; }
.report-selector { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
.report-selector button { flex: 0 0 auto; min-height: 40px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 700; white-space: nowrap; }
.report-selector button.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.report-page-single { min-height: 0; box-shadow: 0 10px 28px rgba(17,24,39,.07); }
.report-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.report-header h2 { margin: 2px 0 4px; font-size: 26px; }
.report-header p { margin: 0; color: var(--muted); }
.report-status { flex: 0 0 auto; border: 1px solid #9bd6b3; border-radius: 999px; background: #e6f6ec; color: #08783d; padding: 6px 10px; font-size: 12px; font-weight: 800; }
.report-source { margin: 14px 0; padding: 10px 12px; border-left: 3px solid var(--teal); background: var(--soft); color: var(--muted); font-size: 13px; }
.report-source span { margin: 0 6px; }
.report-table { margin-top: 14px; }
.report-table tbody tr:last-child td { border-bottom: 0; }
.report-chart { display: grid; gap: 14px; margin: 20px 0 8px; }
.chart-row { display: grid; gap: 6px; }
.chart-label { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.chart-label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-label strong { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.chart-track { height: 14px; border-radius: 4px; background: #e7ecee; overflow: hidden; }
.chart-bar { display: block; height: 100%; background: var(--teal); border-radius: 4px; }
.chart-bar.negative { background: #d06464; }
.chart-empty { margin: 20px 0; padding: 24px; background: var(--soft); color: var(--muted); text-align: center; }
.cash-chart { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; min-height: 310px; margin: 20px 0 10px; align-items: end; }
.cash-column { display: grid; grid-template-rows: auto 210px auto; gap: 8px; min-width: 0; text-align: center; }
.cash-value { font-weight: 800; font-size: clamp(12px, 1.05vw, 16px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cash-bar-zone { display: flex; align-items: end; justify-content: center; background: linear-gradient(to top, #edf1f2 1px, transparent 1px); background-size: 100% 25%; border-bottom: 1px solid var(--line); }
.cash-bar { display: block; width: min(70px, 64%); min-height: 8px; border-radius: 5px 5px 0 0; }
.cash-bar.in { background: var(--green); }
.cash-bar.out { background: #d06464; }
.cash-label { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.report-details { margin-top: 18px; border-top: 1px solid var(--line); }
.report-details summary { cursor: pointer; padding: 14px 0 4px; color: var(--teal); font-weight: 800; }
.management-visual { margin: 18px 0; padding: 18px; background: var(--soft); border-radius: 8px; }
.management-score { display: flex; align-items: baseline; gap: 12px; }
.management-score strong { font-size: 36px; color: var(--teal); }
.management-score span { color: var(--muted); }
.management-progress { height: 12px; margin-top: 12px; border-radius: 4px; background: #e3e8e9; overflow: hidden; }
.management-progress span { display: block; height: 100%; background: var(--teal); }
.report-callout { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.report-callout.good { background: #edf8f1; border-color: #b7dfc5; }
.report-callout.warn { background: #fff7e2; border-color: #ebcf86; }
.report-callout.bad { background: #fff0f0; border-color: #efb9b9; }
.report-callout p { margin: 5px 0 0; color: var(--muted); }
.management-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.management-summary .report-callout { margin-top: 0; }
.report-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.bars { height: 150px; display: flex; align-items: end; gap: 14px; border-bottom: 1px solid var(--line); }
.bar { flex: 1; min-width: 32px; border-radius: 6px 6px 0 0; background: var(--teal); }
.bar.green { background: var(--green); }
.bar.amber { background: #e0a028; }

.modal { display: none; position: fixed; inset: 0; background: rgba(17,24,39,.42); padding: 24px; z-index: 30; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-card { width: min(980px, 100%); max-height: 90vh; overflow: auto; background: #fff; border-radius: 10px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: 14px; }
#modalBody { padding: 14px; }
.email-preview, pre { white-space: pre-wrap; border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; font-family: Consolas, monospace; font-size: 13px; }

@media (max-width: 1180px) {
  .shell, .dash-grid, .recon-layout { grid-template-columns: 1fr; }
  .cols-4, .cols-3, .report-wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-strip { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
  .annual-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .annual-kpis > div:nth-child(2) { border-right: 0; }
  .annual-kpis > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .annual-charts { grid-template-columns: 1fr; }
  .monthly-chart { overflow-x: auto; }
}

@media (max-width: 760px) {
  body { background: var(--bg); }
  .shell { display: block; }
  .side { position: sticky; top: 0; z-index: 10; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .brand { border-bottom: 1px solid var(--line); }
  .brand-image {
    min-height: 66px;
    background-size: cover;
    background-position: center;
  }
  .mark { width: 36px; height: 36px; }
  .nav { display: flex; overflow-x: auto; gap: 6px; margin-top: 10px; padding-bottom: 4px; }
  .nav button { flex: 0 0 auto; min-height: 34px; border: 1px solid var(--line); background: #fff; white-space: nowrap; }
  .main { padding: 14px; }
  .top { align-items: flex-start; flex-direction: column; gap: 10px; }
  .actions { width: 100%; }
  .actions button { flex: 1 1 150px; }
  .empty-state { align-items: flex-start; flex-direction: column; }
  .data-actions { justify-content: flex-start; }
  .cols-2, .cols-3, .cols-4, .form-grid, .report-wrap { grid-template-columns: 1fr; }
  .reconciliation-view .main { padding-top: 12px; }
  .recon-head { align-items: flex-start; margin-bottom: 12px; }
  .recon-head > div:first-child { min-width: 0; }
  .recon-head h2 { font-size: 24px; }
  .recon-head p { font-size: 14px; line-height: 1.4; }
  .recon-head .row { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, 38px); gap: 6px; }
  .recon-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; }
  .recon-summary-card { min-width: 0; min-height: 102px; padding: 11px; }
  .recon-summary-card.active { padding: 10px; }
  .recon-summary-card strong { font-size: 24px; }
  .recon-summary-card span, .recon-summary-card small { overflow-wrap: anywhere; }
  .recon-toolbar { display: block; }
  .recon-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; }
  .recon-tabs button { min-width: 0; padding: 9px 3px; font-size: 13px; }
  .recon-search { width: 100%; margin-top: 8px; }
  .recon-progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 10px 0; }
  .recon-progress span { overflow: hidden; text-align: center; white-space: nowrap; text-overflow: ellipsis; border-top: 3px solid var(--line); padding-top: 6px; color: var(--muted); font-size: 10px; }
  .recon-progress span.active { border-color: var(--teal); color: var(--teal-dark); font-weight: 800; }
  .recon-layout { display: flex; flex-direction: column; }
  .recon-queue { max-height: 360px; width: 100%; padding: 11px; }
  .recon-review { width: 100%; }
  .recon-movement, .recon-match { align-items: flex-start; flex-direction: column; }
  .recon-amount { font-size: 22px; }
  .recon-actions { display: flex; flex-wrap: nowrap; margin-left: -14px; margin-right: -14px; margin-bottom: -14px; padding: 10px 14px; }
  .recon-actions button { flex: 0 0 auto; min-width: 142px; white-space: nowrap; }
  .payment-workflow-head { align-items:stretch; flex-direction:column; }
  .payment-stage-metrics { display:flex; overflow-x:auto; scroll-snap-type:x mandatory; }
  .payment-stage-metrics .metric { min-width:190px; scroll-snap-align:start; }
  .payment-work-item { grid-template-columns:minmax(0,1fr) auto 38px; gap:8px; }
  .payment-work-item .chip { max-width:130px; overflow:hidden; text-overflow:ellipsis; }
  .list-card { min-width: 0; overflow: hidden; }
  .list-card-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .list-card-head strong { overflow-wrap: anywhere; }
  .list-card-head b { justify-self: start; white-space: normal; }
  .list-card > span:not(.list-card-head):not(.list-card-foot), .list-card > small { white-space: normal; overflow-wrap: anywhere; }
  .management-summary { grid-template-columns: 1fr; }
  .report-overview-head { align-items: stretch; flex-direction: column; }
  .reports-view .main { padding-top: 14px; }
  .annual-kpis { grid-template-columns: 1fr; }
  .annual-kpis > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .annual-kpis > div:last-child { border-bottom: 0; }
  .report-download-grid { grid-template-columns: 1fr; }
  .report-library-head { align-items: flex-start; }
  .cash-chart { grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 0; }
  .cash-column { grid-template-rows: auto 150px auto; }
  .donut-layout { grid-template-columns: 130px minmax(0, 1fr); gap: 14px; min-height: 190px; }
  .donut-chart { width: 128px; }
  .donut-chart::after { inset: 23px; }
  .donut-chart strong { font-size: 20px; }
  .monthly-panel { overflow: hidden; }
  .monthly-chart-shell { grid-template-columns: 38px minmax(0, 1fr); overflow: visible; }
  .monthly-chart { grid-template-columns: repeat(12, minmax(18px, 1fr)); width: 100%; gap: 2px; height: 220px; padding-bottom: 2px; }
  .monthly-axis { height: 196px; background: #fff; font-size: 9px; }
  .month-column small { font-size: 9px; }
  .month-bar { width: min(14px, 68%); }
  .month-bar.expense { width: min(20px, 92%); }
  .month-total-bar.expense { width: min(18px, 82%); }
  .month-total-bar.revenue { width: min(11px, 50%); }
  .stack-column { width: min(11px, 43%); }
  .entry-stack { left: calc(50% - 6px); }
  .payment-stack { left: calc(50% + 6px); }
  .cash-position { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cash-position .cash-variation { grid-column: 1 / -1; }
  .monthly-detail { grid-template-columns: 1fr; }
  .monthly-detail strong { font-size: 20px; white-space: nowrap; }
  .monthly-totals { grid-template-columns: 1fr; }
  .monthly-breakdown { grid-template-columns: 1fr; }
  .composition-summary { grid-template-columns: 1fr; }
  .monthly-totals strong { font-size: 19px; }
  .chart-label { align-items: flex-start; }
  .chart-label span { white-space: normal; }
  .report-page-single { padding: 16px; }
  .report-header { align-items: flex-start; }
  .report-header h2 { font-size: 22px; }
  .payment-item {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .payment-main span,
  .payment-main small {
    white-space: normal;
  }
  .payment-amount {
    justify-items: start;
  }
  .account-strip {
    grid-template-columns: 1fr;
  }
  .contract-grid {
    gap: 10px;
    margin-left: -2px;
    padding-right: 14px;
  }
  .contract-facts {
    grid-template-columns: 1fr;
  }
  .contract-card {
    flex-basis: calc(100vw - 44px);
    max-width: calc(100vw - 44px);
    padding: 12px;
  }
  .account-chip {
    min-width: 0;
  }
  .finance-card,
  .registry-card {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
  .finance-card-values {
    justify-items: start;
    grid-column: 1 / -1;
  }
  .finance-card .icon-btn,
  .registry-card .icon-btn {
    grid-column: 2;
    grid-row: 1;
  }
  .entry-card {
    align-items: flex-start;
    flex-direction: column;
  }
  table { min-width: 0; }
  .table-wrap { border: 0; overflow: visible; }
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
  .table-wrap td { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; }
  .files-table td { align-items: flex-start; }
  .files-table td:first-child { max-width: none; }
  .files-table td[data-label="Arquivo"],
  .files-table td[data-label="Origem"] {
    display: grid;
    gap: 4px;
    justify-content: stretch;
  }
  .table-wrap td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
  .money { text-align: left; }
  .kanban-focus { grid-template-columns: 1fr; }
  .kanban-stats { grid-template-columns: repeat(3, 1fr); }
  .filter-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-strip button { grid-column: 1 / -1; }
  .board { grid-template-columns: repeat(6, minmax(78vw, 1fr)); scroll-snap-type: x mandatory; }
  .lane { min-height: 450px; scroll-snap-align: start; }
}
.operational-focus-view .top {
  display: none;
}
.automation-details {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.automation-reasons { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 4px; }
.automation-reasons span { border:1px solid var(--border); background:var(--surface-muted); padding:6px 9px; font-size:.82rem; color:var(--muted); }
.generated-report-head { margin-top:24px; padding-top:20px; border-top:1px solid var(--border); }
.official-file { border-left:3px solid var(--teal); }
.official-file small { display:block; margin-top:5px; color:var(--muted); }

.automation-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

.automation-details .compact-list {
  margin-top: 10px;
  max-height: 420px;
  overflow: auto;
}
