/* Essencial: apresentação restrita a Parceiros e Clientes dinâmicos.
   As telas existentes voltam ao estilo original ao retirar a classe do body. */
html.essential-ui { background: #f8f5ed; overflow-x: visible; }
body.essential-ui {
  --wine: #551d32;
  --wine-deep: #3e1728;
  --wine-dark: #551d32;
  --wine-soft: #6d3047;
  --gold: #86621e;
  --gold-ink: #86621e;
  --gold-soft: #e8d6a1;
  --page: #f8f5ed;
  --surface: #fffdf8;
  --surface-2: #ede8de;
  --ink: #302b27;
  --ink2: #675e55;
  --muted: #675e55;
  --grid: #d9d1c5;
  --line: #d9d1c5;
  --accent: #551d32;
  --accent-soft: #f4ece8;
  --good: #285a42;
  --good-ink: #285a42;
  --good-bg: #e8f0e9;
  --warn: #86621e;
  --warn-ink: #78520d;
  --warn-bg: #f5ebd3;
  --crit: #8a2433;
  --crit-ink: #8a2433;
  --crit-bg: #f8e9e7;
  --cream-txt: #fff4d9;
  --essential-field: #aaa092;
  background: var(--page);
  color: var(--ink);
  overflow-x: visible;
  font-size: 14px;
  line-height: 1.5;
}

body.essential-ui #app.receivables {
  --surface: #fffdf8;
  --surface-2: #ede8de;
  --grid: #d9d1c5;
}

body.essential-ui .content { background: var(--page); }
body.essential-ui main {
  max-width: 1440px;
  padding: 28px 28px 36px;
  min-height: 0;
}
body.essential-ui :is(#partners-view, #flex-list-screen, #flex-account-screen) {
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-width: 0;
}

/* Navegação completa, com a identidade concentrada no vinho. */
body.essential-ui aside#side {
  background: var(--wine);
  border-right: 1px solid #6d3047;
  padding: 24px 14px 16px;
  gap: 20px;
}
/* Menu fixo "Por área": a marca tem a mesma medida em todas as telas; aqui só a cor. */
body.essential-ui aside#side .brand {
  border-bottom-color: #896475;
}
body.essential-ui aside#side .brand h1 {
  color: #fff4d9;
}
body.essential-ui aside#side .brand h1 small {
  color: #eedfd0;
  opacity: 1;
}
body.essential-ui #menu { gap: 4px; }
body.essential-ui #menu .m-grp {
  color: #e8d6a1;
  font-size: 11px;
  letter-spacing: .7px;
}
body.essential-ui #menu .mi {
  min-height: 44px;
  padding: 10px 9px;
  color: #f5ebdf;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: normal;
}
body.essential-ui #menu .mi:hover { background: #6d3047; color: #fff4d9; }
body.essential-ui #menu .mi.active {
  background: #6d3047;
  color: #fff4d9;
  border-color: #af8b67;
  font-weight: 600;
}
body.essential-ui .side-actions { border-top-color: #896475; gap: 7px; }
body.essential-ui .side-actions .sa-lbl { color: #e8d6a1; }
body.essential-ui .side-actions button,
body.essential-ui .side-actions button.primary,
body.essential-ui #menu-toggle {
  color: #fff4d9;
  background: #60253b;
  border: 1px solid #a47e83;
  min-height: 44px;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 10px;
}
body.essential-ui .side-actions button:hover,
body.essential-ui .side-actions button.primary:hover,
body.essential-ui #menu-toggle:hover { background: #6d3047; color: #fff4d9; filter: none; }
body.essential-ui #side :focus-visible { outline-color: #e8d6a1; }
body.essential-ui #user-mail { color: #eedfd0; opacity: 1; }

/* Faixa de contexto e salvamento, subordinada ao título da página. */
body.essential-ui header.topo {
  background: var(--page);
  backdrop-filter: none;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  /* altura igual à do cabeçalho das demais telas: só o espaço lateral acompanha o conteúdo */
  padding: 9px 28px;
  gap: 10px 16px;
  box-shadow: none;
}
body.essential-ui header.topo h2 {
  color: var(--wine);
  font: 400 17px/23.2px Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}
body.essential-ui #save-ind { color: var(--muted); opacity: 1; min-width: 0; line-height: 1.45; }
body.essential-ui #save-ind.ok { color: var(--good-ink); }
body.essential-ui #save-ind.warn { color: var(--crit-ink); }
body.essential-ui #audit-ind {
  color: var(--crit-ink);
  background: var(--crit-bg);
  border-color: #d1a8a7;
}

/* Controles e seus estados usam os mesmos tokens nas duas áreas. */
body.essential-ui button {
  min-height: 44px;
  padding: 9px 13px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--wine);
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 0;
  white-space: normal;
  box-shadow: none;
}
body.essential-ui button:hover { background: var(--surface-2); border-color: #b6aa9b; color: var(--wine); }
body.essential-ui button.primary {
  background: var(--wine);
  border-color: var(--wine);
  color: #fff8e7;
  font-weight: 600;
}
body.essential-ui button.primary:hover { background: var(--wine-deep); border-color: var(--wine-deep); color: #fff8e7; filter: none; }
body.essential-ui button:disabled { cursor: not-allowed; opacity: .55; }
body.essential-ui :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--essential-field);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  box-shadow: none;
}
body.essential-ui #partners-view :is(input, select, textarea):not([type="checkbox"]) {
  border-color: var(--essential-field);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}
body.essential-ui :is(input, textarea)::placeholder { color: #766c63; opacity: 1; }
body.essential-ui :is(input, select, textarea):hover { border-color: #86621e; }
body.essential-ui :is(input, select, textarea):focus { border-color: var(--gold); box-shadow: none; }
body.essential-ui #partners-view :is(input, select, textarea):focus { border-color: var(--gold); }
body.essential-ui :is(button, input, select, textarea, summary, a):focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
body.essential-ui :is(input, select, textarea):disabled { background: var(--surface-2); color: var(--muted); }
body.essential-ui summary { min-height: 44px; padding: 12px 0; color: var(--wine); cursor: pointer; }
body.essential-ui summary::marker { color: var(--gold); }

body.essential-ui :is(#partners-view h2, #flex-list-screen h2, #flex-account-title) {
  display: block;
  font: 400 28px/1.2 Georgia, "Times New Roman", serif;
  color: var(--wine);
  text-transform: none;
  letter-spacing: -.35px;
  margin: 0;
  padding: 0;
  border: 0;
  overflow-wrap: anywhere;
}
body.essential-ui :is(.partner-heading, .essential-heading, #flex-list-screen .rx-heading) {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px 24px;
  margin: 0 0 24px;
}
body.essential-ui :is(.partner-heading, .essential-heading, #flex-list-screen .rx-heading) > div:first-child {
  min-width: 0;
  flex: 1 1 280px;
}
body.essential-ui :is(.partner-heading small, .essential-heading p, #flex-list-screen .rx-heading p) {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 65ch;
  overflow-wrap: anywhere;
}
body.essential-ui #flex-account-title { margin-top: 18px; }
body.essential-ui :is(#partners-view h3, #flex-account-screen h3) {
  color: var(--wine);
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
}

/* Valores em uma faixa única, com divisores e sem cartões coloridos. */
body.essential-ui :is(.partner-summary, #flex-list-screen .rx-metrics, #flex-account-screen .rx-metrics) {
  display: grid;
  gap: 18px 24px;
  padding: 18px 0;
  margin: 0 0 24px;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
body.essential-ui .partner-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body.essential-ui :is(#flex-list-screen, #flex-account-screen) .rx-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.essential-ui :is(.partner-summary > div, .rx-metric) { display: block; min-width: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
body.essential-ui :is(.partner-summary span, .rx-metric span) { color: var(--muted); font-size: 13px; font-weight: 400; }
body.essential-ui :is(.partner-summary strong, .rx-metric strong, .rx-metric.positive strong, .rx-metric.attention strong) {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.3px;
  margin: 5px 0 0;
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: anywhere;
}
body.essential-ui .partner-summary small { margin-top: 5px; font-size: 12px; line-height: 1.45; color: var(--muted); font-weight: 400; }

body.essential-ui .partner-filters { gap: 12px; margin: 24px 0 12px; }
body.essential-ui :is(#partners-view label, .rx-toolbar label) { color: var(--muted); font-size: 13px; font-weight: 400; }
body.essential-ui .rx-toolbar { margin: 24px 0 14px; gap: 14px; }
body.essential-ui .rx-toolbar .rx-search { min-width: 0; flex: 1 1 280px; }
body.essential-ui .rx-toolbar > label:not(.rx-search) { flex: 0 1 230px; }
body.essential-ui .rx-filters { margin-bottom: 14px; gap: 7px; }
body.essential-ui .rx-filters .fchip { background: var(--surface-2); border-color: transparent; font-size: 13px; }
body.essential-ui .rx-filters .fchip.on { background: var(--wine); color: #fff8e7; }
body.essential-ui :is(.partner-count, .rx-meta, .rx-editor-note, .partner-secondary) { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* Nomes à esquerda, números alinhados e divisores discretos. */
body.essential-ui :is(.partner-table, #flex-list-screen .rx-table) {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  overflow: visible;
}
body.essential-ui #flex-list-screen .rx-table-wrap { border: 0; border-radius: 0; overflow: visible; }
body.essential-ui :is(.partner-table, #flex-list-screen .rx-table) th {
  padding: 12px 10px;
  background: var(--surface);
  border-bottom: 1px solid #b6aa9b;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
}
body.essential-ui :is(.partner-table, #flex-list-screen .rx-table) td {
  padding: 14px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}
body.essential-ui :is(.partner-table, #flex-list-screen .rx-table) td:first-child strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.4; }
body.essential-ui :is(.partner-table, #flex-list-screen .rx-table) td small { font-size: 12px; color: var(--muted); margin-top: 5px; }
body.essential-ui :is(.partner-table, #flex-list-screen .rx-table) tbody tr:hover > td { background: #f3ede5; }
body.essential-ui .partner-table th:first-child,
body.essential-ui #flex-list-screen .rx-table th:first-child { width: 30%; }
body.essential-ui .partner-table th:nth-child(2) { width: 19%; }
body.essential-ui .partner-table th:nth-child(3),
body.essential-ui .partner-table th:nth-child(4) { width: 17%; text-align: right; }
body.essential-ui .partner-table th:last-child { width: 17%; }
body.essential-ui .partner-table td.partner-number { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: normal; }
body.essential-ui #flex-list-screen .rx-table th:nth-child(2) { width: 16%; text-align: right; }
body.essential-ui #flex-list-screen .rx-table td:nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }
body.essential-ui #flex-list-screen .rx-table th:nth-child(3),
body.essential-ui #flex-list-screen .rx-table th:nth-child(4) { width: 18%; }
body.essential-ui #flex-list-screen .rx-table th:last-child { width: 18%; }
body.essential-ui .partner-table button[data-partner-action="abrir"],
body.essential-ui #flex-list-screen button[data-flex-open] {
  background: transparent;
  border-color: transparent;
  color: var(--wine);
  font-weight: 400;
  padding: 9px 4px;
  text-decoration: underline;
  text-decoration-color: #bda9af;
  text-underline-offset: 4px;
}
body.essential-ui .partner-table button[data-partner-action="abrir"]:hover,
body.essential-ui #flex-list-screen button[data-flex-open]:hover { background: transparent; color: var(--wine-deep); text-decoration-color: var(--wine); }
body.essential-ui :is(.partner-tag, .essential-status) {
  display: inline-block;
  max-width: 100%;
  padding: 4px 8px;
  background: var(--surface-2);
  border: 0;
  border-radius: 4px;
  color: #514a43;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  white-space: normal;
}
body.essential-ui :is(.partner-tag.partner-warning, .essential-status.pending, .essential-status.attention) { background: var(--warn-bg); color: var(--warn-ink); }
body.essential-ui :is(.partner-tag.partner-late, .essential-status.late) { background: var(--crit-bg); color: var(--crit-ink); }
body.essential-ui :is(.essential-status.good, .essential-status.positive) { background: var(--good-bg); color: var(--good-ink); }

/* Detalhes, edição, histórico e documentos conservam os controles nativos. */
body.essential-ui .partner-back { margin-bottom: 18px; }
body.essential-ui #partners-document-status { scroll-margin-top: 112px; scroll-margin-bottom: 16px; overflow-wrap: anywhere; }
body.essential-ui .partner-section { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; }
body.essential-ui details.partner-section { padding-top: 0; }
body.essential-ui .partner-section-heading { gap: 12px; margin-bottom: 16px; }
body.essential-ui details.partner-movements > summary { font-size: 14px; font-weight: 600; line-height: 1.4; }
body.essential-ui .partner-info { background: transparent; border: 0; border-radius: 0; padding: 0; margin: 12px 0 24px; }
body.essential-ui .partner-agreements { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: visible; }
body.essential-ui .partner-agreement { padding: 20px; }
body.essential-ui .partner-agreement-heading { gap: 18px; }
body.essential-ui .partner-agreement-heading strong { font-size: 18px; font-weight: 600; }
body.essential-ui .partner-editor {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  scroll-margin-top: 85px;
}
body.essential-ui .partner-editor h3 { font-size: 21px; }
body.essential-ui :is(.partner-new-client, .partner-first-agreement, .partner-review > div) { background: var(--page); border-color: var(--line); }
body.essential-ui :is(.partner-note, .partner-document, .partner-history) { background: var(--surface); border-color: var(--line); box-shadow: none; }
body.essential-ui .partner-note.partner-warning { background: var(--warn-bg); color: var(--warn-ink); border-color: #d9c59a; }
body.essential-ui .partner-empty { background: var(--surface); border: 1px solid var(--line); padding: 28px 20px; }
body.essential-ui :is(.partner-footer, #essential-help) { border-top: 1px solid var(--line); color: var(--muted); margin-top: 24px; }
body.essential-ui #flex-account-screen .flex-actions { gap: 9px; }
body.essential-ui #flex-account-screen > h3 { margin: 26px 0 8px; }
body.essential-ui .flex-entry { align-items: flex-start; padding: 16px 0; }
body.essential-ui .flex-entry > div { min-width: 0; }
body.essential-ui .flex-entry strong { font-weight: 600; font-variant-numeric: tabular-nums; }
body.essential-ui .flex-entry p { color: var(--muted); font-size: 13px; }

body.essential-ui dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  max-width: calc(100% - 28px);
  box-shadow: 0 20px 70px #26151d45;
}
body.essential-ui dialog::backdrop { background: #28141c73; }
body.essential-ui dialog h3 { color: var(--wine); font: 400 24px/1.25 Georgia, "Times New Roman", serif; letter-spacing: 0; }
body.essential-ui dialog .row { flex-wrap: wrap; gap: 10px; }
body.essential-ui #dlg-flex { width: 620px; padding: 24px; }
body.essential-ui #dlg-flex > label,
body.essential-ui #dlg-flex .duo2 > label { display: grid; gap: 6px; color: var(--muted); margin-top: 14px; font-size: 13px; }
body.essential-ui #dlg-flex-client { border-color: var(--line); border-radius: 10px; background: var(--surface); }
body.essential-ui #dlg-flex-client :is(.flex-client-header, .flex-client-footer) { border-color: var(--line); background: var(--surface); }
body.essential-ui #dlg-flex-client :is(input, select, textarea) { border-color: var(--essential-field); background: var(--surface); color: var(--ink); box-shadow: none; font-size: 16px; }
body.essential-ui #dlg-flex-client .flex-client-charge { border-color: var(--line); background: var(--page); border-radius: 8px; }
body.essential-ui #dlg-flex-client #flex-client-close { border-color: var(--line); color: var(--muted); background: var(--page); }
body.essential-ui .file-dropzone { border-color: var(--essential-field); background: var(--surface); }
body.essential-ui .file-dropzone:hover,
body.essential-ui .file-dropzone.is-dragging { border-color: var(--wine); background: var(--accent-soft); }

body.essential-ui .content footer { max-width: 1440px; padding: 0 28px 28px; color: var(--muted); }
body.essential-ui footer :is(b, i) { color: var(--ink); }
body.essential-ui footer a { color: var(--wine); font-weight: 500; }
body.essential-ui #essential-help { margin-top: 0; }
body.essential-ui #essential-help summary { font-size: 13px; font-weight: 400; }
body.essential-ui #essential-help > div { padding: 0 0 16px; max-width: 90ch; }

@media (max-width: 1200px) {
  body.essential-ui main { padding: 26px 24px 32px; }
  body.essential-ui :is(#flex-list-screen, #flex-account-screen) .rx-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.essential-ui .partner-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.essential-ui .partner-filters > label:first-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  body.essential-ui :is(#flex-list-screen .rx-table, #flex-list-screen .rx-table tbody) { display: block; width: 100%; min-width: 0; background: transparent; }
  body.essential-ui #flex-list-screen .rx-table tbody > tr {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    overflow: visible;
    margin: 12px 0;
  }
  body.essential-ui #flex-list-screen .rx-table td { background: transparent; border: 0; }
  body.essential-ui #flex-list-screen .rx-table td:first-child,
  body.essential-ui #flex-list-screen .rx-table td:last-child { grid-column: 1 / -1; }
  body.essential-ui #flex-list-screen .rx-table td:first-child { border: 0; }
  body.essential-ui #flex-list-screen .rx-table td:last-child { padding-top: 4px !important; }
  body.essential-ui #flex-list-screen .rx-table tbody tr:hover > td { background: transparent; }
  body.essential-ui #flex-list-screen .rx-table td:first-child::before,
  body.essential-ui #flex-list-screen .rx-table td:last-child::before { display: none; }
  body.essential-ui .rx-heading .primary { flex: 0 1 auto; }
}

@media (max-width: 900px) {
  body.essential-ui .shell { flex-direction: column; }
  body.essential-ui aside#side { width: 100%; height: auto; position: static; padding: 18px 16px 14px; border-right: 0; border-bottom: 1px solid #896475; gap: 12px; }
  body.essential-ui aside#side .brand { border: 0; padding-bottom: 0; }
  body.essential-ui #menu-toggle { display: block; margin: 0; align-self: flex-start; }
  body.essential-ui aside#side:not(.menu-open) #menu,
  body.essential-ui aside#side:not(.menu-open) .side-actions { display: none; }
  body.essential-ui #menu { flex-direction: row; flex-wrap: wrap; overflow: visible; }
  body.essential-ui #menu .m-grp { width: 100%; padding: 10px 9px 2px; }
  body.essential-ui #menu .mi { white-space: normal; }
  body.essential-ui .side-actions { padding-top: 12px; border-top: 1px solid #896475; }
  body.essential-ui .side-actions button { flex: 1 1 140px; }
  body.essential-ui header.topo { padding: 9px 18px; }
  body.essential-ui main { padding: 24px 18px 28px; }
  body.essential-ui .content footer { padding: 0 18px 24px; }
  body.essential-ui :is(.partner-table, #flex-list-screen .rx-table) td:first-child { position: static; }
}

@media (max-width: 760px) {
  body.essential-ui .partner-table,
  body.essential-ui .partner-table tbody { background: transparent; }
  body.essential-ui .partner-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    margin: 12px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
  }
  body.essential-ui .partner-table td { padding: 0; border: 0; background: transparent; min-width: 0; width: auto; }
  body.essential-ui .partner-table td:first-child,
  body.essential-ui .partner-table td:nth-child(2),
  body.essential-ui .partner-table td:last-child { grid-column: 1 / -1; }
  body.essential-ui .partner-table td.partner-number { text-align: left; }
  body.essential-ui .partner-table td:first-child::before { display: none; }
  body.essential-ui .partner-table tbody tr:hover > td { background: transparent; }
  body.essential-ui .partner-table td[data-label]::before { color: var(--muted); font-size: 12px; }
  body.essential-ui .partner-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  body.essential-ui :is(.partner-summary strong, .rx-metric strong) { font-size: 22px; }
}

@media (max-width: 480px) {
  body.essential-ui main { padding: 24px 16px 28px; }
  body.essential-ui :is(.partner-heading, .essential-heading, #flex-list-screen .rx-heading) { display: flex; flex-direction: column; gap: 16px; }
  body.essential-ui :is(.partner-heading, .essential-heading, #flex-list-screen .rx-heading) > div:first-child { flex: 0 1 auto; }
  body.essential-ui .partner-heading > .partner-actions { width: 100%; margin: 0; }
  body.essential-ui .partner-heading > .partner-actions > button { flex: 1 1 120px; }
  body.essential-ui #flex-list-screen .rx-heading > button { width: 100%; }
  body.essential-ui :is(#partners-view h2, #flex-list-screen h2, #flex-account-title) { font-size: 27px; }
  body.essential-ui :is(.partner-summary, #flex-list-screen .rx-metrics, #flex-account-screen .rx-metrics) { grid-template-columns: 1fr; gap: 16px; padding: 18px 0; }
  body.essential-ui .partner-summary > div { padding: 0; border: 0; }
  body.essential-ui .partner-filters { grid-template-columns: 1fr; }
  body.essential-ui .partner-filters > label:first-child { grid-column: auto; }
  body.essential-ui .rx-toolbar > label:not(.rx-search) { flex: 1 1 100%; }
  body.essential-ui .rx-filters .fchip { padding: 9px 10px; }
  body.essential-ui :is(.partner-editor, .partner-agreement) { padding: 16px; }
  body.essential-ui .partner-agreement-heading { gap: 14px; }
  body.essential-ui #dlg-flex { padding: 18px; }
  body.essential-ui #dlg-flex .duo2 { display: grid; grid-template-columns: 1fr; }
  body.essential-ui .content footer { padding: 0 16px 24px; }
}

/* Paleta Essencial nas demais áreas: somente pintura, sem alterar sua estrutura.
   O escopo exclui a apresentação completa já existente e a impressão. */
@media screen {
  html.regularize-colors:not(.essential-ui) { background-color: #f8f5ed; }
  html.regularize-colors body:not(.essential-ui) {
    --wine: #551d32;
    --wine-deep: #3e1728;
    --wine-dark: #551d32;
    --wine-soft: #6d3047;
    --gold: #86621e;
    --gold-ink: #86621e;
    --gold-soft: #e8d6a1;
    --page: #f8f5ed;
    --surface: #fffdf8;
    --surface-2: #ede8de;
    --ink: #302b27;
    --ink2: #675e55;
    --muted: #675e55;
    --grid: #d9d1c5;
    --line: #d9d1c5;
    --ring: #551d3226;
    --accent: #551d32;
    --accent-soft: #f4ece8;
    --good: #285a42;
    --good-ink: #285a42;
    --good-bg: #e8f0e9;
    --warn: #86621e;
    --warn-ink: #78520d;
    --warn-bg: #f5ebd3;
    --amber-bg: #f5ebd3;
    --crit: #8a2433;
    --crit-ink: #8a2433;
    --crit-bg: #f8e9e7;
    --cream-txt: #fff4d9;
    --essential-field: #aaa092;
    --palette-forecast: #365c78;
    background-color: var(--page);
    background-image: none;
    color: var(--ink);
  }
  html.regularize-colors body:not(.essential-ui) #app.receivables {
    --surface: #fffdf8;
    --surface-2: #ede8de;
    --grid: #d9d1c5;
  }
  html.regularize-colors body:not(.essential-ui) .content { background-color: var(--page); }
  html.regularize-colors body:not(.essential-ui) button { background-color: var(--surface); color: var(--wine); }
  html.regularize-colors body:not(.essential-ui) button.ghost { background-color: transparent; color: var(--muted); }
  html.regularize-colors body:not(.essential-ui) button.ghost:hover { color: var(--crit); }
  html.regularize-colors body:not(.essential-ui) button.primary {
    background-color: var(--wine); background-image: none; border-color: var(--wine); color: #fff8e7;
  }
  html.regularize-colors body:not(.essential-ui) button.primary:hover { background-color: var(--wine-deep); border-color: var(--wine-deep); color: #fff8e7; }

  html.regularize-colors body:not(.essential-ui) aside#side { background-color: var(--wine); background-image: none; border-color: var(--wine-soft); }
  html.regularize-colors body:not(.essential-ui) aside#side .brand { border-bottom-color: #896475; }
  html.regularize-colors body:not(.essential-ui) aside#side .brand h1 { color: #fff4d9; }
  html.regularize-colors body:not(.essential-ui) aside#side .brand h1 small { color: #eedfd0; }
  html.regularize-colors body:not(.essential-ui) #menu .m-grp { color: var(--gold-soft); }
  html.regularize-colors body:not(.essential-ui) #menu .mi { background-color: transparent; color: #f5ebdf; }
  html.regularize-colors body:not(.essential-ui) #menu .mi:hover { background-color: var(--wine-soft); color: var(--cream-txt); }
  html.regularize-colors body:not(.essential-ui) #menu .mi.active { background-color: var(--wine-soft); color: var(--cream-txt); border-left-color: #af8b67; border-bottom-color: #af8b67; }
  html.regularize-colors body:not(.essential-ui) .side-actions { border-top-color: #896475; }
  html.regularize-colors body:not(.essential-ui) .side-actions .sa-lbl { color: var(--gold-soft); }
  html.regularize-colors body:not(.essential-ui) .side-actions button,
  html.regularize-colors body:not(.essential-ui) .side-actions button.primary,
  html.regularize-colors body:not(.essential-ui) #menu-toggle { background-color: #60253b; background-image: none; color: var(--cream-txt); border-color: #a47e83; }
  html.regularize-colors body:not(.essential-ui) .side-actions button:hover,
  html.regularize-colors body:not(.essential-ui) #menu-toggle:hover { background-color: var(--wine-soft); color: var(--cream-txt); }
  html.regularize-colors body:not(.essential-ui) #side :focus-visible { outline-color: var(--gold-soft); }
  html.regularize-colors body:not(.essential-ui) #user-mail { color: #eedfd0; }

  html.regularize-colors body:not(.essential-ui) header.topo { background-color: var(--page); background-image: none; color: var(--muted); border-bottom-color: var(--line); }
  html.regularize-colors body:not(.essential-ui) header.topo h2 { color: var(--wine); }
  html.regularize-colors body:not(.essential-ui) header.topo button { background-color: var(--surface); color: var(--wine); border-color: var(--line); }
  html.regularize-colors body:not(.essential-ui) header.topo button:hover { background-color: var(--surface-2); color: var(--wine); border-color: var(--gold); }
  html.regularize-colors body:not(.essential-ui) #save-ind { color: var(--muted); }
  html.regularize-colors body:not(.essential-ui) #save-ind.ok { color: var(--good-ink); }
  html.regularize-colors body:not(.essential-ui) #save-ind.warn { color: var(--crit-ink); }
  html.regularize-colors body:not(.essential-ui) #audit-ind { color: var(--crit-ink); background-color: var(--crit-bg); border-color: #d1a8a7; }
  html.regularize-colors body:not(.essential-ui) #tabs .tab { background-color: var(--surface-2); color: var(--muted); border-color: var(--line); }
  html.regularize-colors body:not(.essential-ui) #tabs .tab:hover { color: var(--wine); }
  html.regularize-colors body:not(.essential-ui) #tabs .tab.active { background-color: var(--surface); color: var(--wine); border-color: var(--gold); }
  html.regularize-colors body:not(.essential-ui) #tabs button.act { background-color: var(--surface); color: var(--wine); border-color: var(--line); }
  html.regularize-colors body:not(.essential-ui) #tabs button.act:hover { background-color: var(--surface-2); color: var(--wine); border-color: var(--gold); }
  html.regularize-colors body:not(.essential-ui) :is(.warn-ls, #mes-aviso) { background-color: var(--warn-bg); color: var(--warn-ink); border-color: var(--gold-soft); }

  html.regularize-colors body:not(.essential-ui) section.card,
  html.regularize-colors body:not(.essential-ui) #rec .rc { border-color: var(--line); }
  html.regularize-colors body:not(.essential-ui) .tile { background-color: var(--surface); background-image: none; border-color: var(--line); }
  html.regularize-colors body:not(.essential-ui) .tile .lbl { color: var(--muted); }
  html.regularize-colors body:not(.essential-ui) .tile .val { color: var(--ink); }
  html.regularize-colors body:not(.essential-ui) .tile.pago .val { color: var(--good-ink); }
  html.regularize-colors body:not(.essential-ui) .tile.falta .val { color: var(--crit-ink); }
  html.regularize-colors body:not(.essential-ui) :is(td input, td select:not(.st), .mini input, input.fbusca, select.fsel) { border-color: var(--essential-field); background-color: var(--surface); }
  html.regularize-colors body:not(.essential-ui) :is(input, select:not(.st), textarea):focus { background-color: var(--surface); box-shadow: 0 0 0 2px #86621e40; }
  html.regularize-colors body:not(.essential-ui) :where(textarea, .obtn, .opop, .rec:not(.ok):not(.x), .fchip, .pst:not(.recebido):not(.parcial):not(.ematraso):not(.areceber):not(.cancelado), .doc-item, .file-dropzone, .client-summary, .chart-months button, .chart-compare, .chart-kpi, .daily-kpi) { background-color: var(--surface); }
  html.regularize-colors body:not(.essential-ui) #month-select { background-color: var(--surface); }
  html.regularize-colors body:not(.essential-ui) #tb-desp tr.obs-row textarea { background-color: var(--surface); }
  html.regularize-colors body:not(.essential-ui) .obtn.has { background-color: var(--warn-bg); color: var(--gold-ink); }
  html.regularize-colors body:not(.essential-ui) .rec.ok { background-color: var(--good-bg); color: var(--good-ink); }
  html.regularize-colors body:not(.essential-ui) .rec.x { background-color: var(--crit-bg); color: var(--crit-ink); }
  html.regularize-colors body:not(.essential-ui) :is(.fchip.on, .chart-months button.active) { background-color: var(--wine); color: #fff8e7; }
  html.regularize-colors body:not(.essential-ui) :is(.rx-text-btn, .rx-disclosure, .rx-par-toggle) { background-color: transparent; }
  html.regularize-colors body:not(.essential-ui) .rx-table tbody tr:not(.exp):not(.client-editor):hover > td { background-color: #f3ede5; }
  html.regularize-colors body:not(.essential-ui) .rx-table :is(tbody, tfoot) > tr { background-color: var(--surface); }
  html.regularize-colors body:not(.essential-ui) .rx-danger { background-color: var(--crit-bg); color: var(--crit-ink); border-color: #d1a8a7; }
  html.regularize-colors body:not(.essential-ui) #payment-history [data-delete-drive] { background-color: transparent; border-color: #d1a8a7; }
  html.regularize-colors body:not(.essential-ui) :is(.rx-editor-grid input, .rx-editor-grid select, .rx-config textarea, .rx-receive input, .rx-detail-editor input, .rx-detail-editor textarea, .rx-cli-detail textarea, .rx-cob-detail textarea, #tb-cob1 .rx-cob-form input, #tb-cob2 .rx-cob-form input, #dlg-payment input, #dlg-payment select, #payment-history .alist li, #dlg-cli input, #dlg-cli textarea, #dlg-add-parcela input, #dlg-add-parcela select, #dlg-add-entrada input) { background-color: var(--surface); }
  html.regularize-colors body:not(.essential-ui) :is(#dlg-payment, #dlg-docs, #dlg-cli, #dlg-add-parcela, #dlg-add-entrada, #dlg-bulk-dates, #dlg-bulk-dates input:not([type=checkbox]), #dlg-bulk-dates select) { background-color: var(--surface); }
  html.regularize-colors body:not(.essential-ui) :is(.pst.cancelado, .chip.cancelado) { background-color: var(--surface-2); color: var(--muted); border-color: var(--grid); }
  html.regularize-colors body:not(.essential-ui) tr.pr-cancel td { background-color: #eeeae4; color: #756e66; }
  html.regularize-colors body:not(.essential-ui) tr.pr-cancel :is(input, select) { color: #756e66; }
  html.regularize-colors body:not(.essential-ui) tbody tr.lin-on > td { background-image: linear-gradient(#86621e28, #86621e28); }
  html.regularize-colors body:not(.essential-ui) .pbar { background-color: var(--surface-2); }
  html.regularize-colors body:not(.essential-ui) .pbar > div { background-image: linear-gradient(90deg, var(--good), #45745b); }
  html.regularize-colors body:not(.essential-ui) .file-dropzone:hover { background-color: var(--accent-soft); }
  html.regularize-colors body:not(.essential-ui) .file-dropzone.is-dragging { background-color: var(--warn-bg); box-shadow: 0 0 0 4px #86621e33 inset; }
  html.regularize-colors body:not(.essential-ui) .file-dropzone:focus-visible { outline-color: #551d323d; }
  html.regularize-colors body:not(.essential-ui) #doc-view-body { background-color: var(--surface-2); }
  html.regularize-colors body:not(.essential-ui) input[type=date].dt-bad { box-shadow: 0 0 0 3px #8a24332e !important; }

  html.regularize-colors body:not(.essential-ui) .chart-point { stroke: var(--surface); }
  html.regularize-colors body:not(.essential-ui) :is(.daily-kpi.receita .val, .chart-kpi.receita .lbl, .chart-kpi.receita .val) { color: var(--good-ink); }
  html.regularize-colors body:not(.essential-ui) :is(.daily-kpi.despesas .val, .chart-kpi.despesas .lbl, .chart-kpi.despesas .val) { color: var(--warn-ink); }
  html.regularize-colors body:not(.essential-ui) .daily-kpi.prevista .val { color: var(--palette-forecast); }
  html.regularize-colors body:not(.essential-ui) .chart-kpi.receita { border-color: #285a4273; }
  html.regularize-colors body:not(.essential-ui) .chart-kpi.despesas { border-color: #86621e73; }
  html.regularize-colors body:not(.essential-ui) .chart-kpi.lucro { border-color: #551d3266; }
  html.regularize-colors body:not(.essential-ui) .daily-flow .day-hit:hover { fill: #86621e1a; }
  html.regularize-colors body:not(.essential-ui) .chart-wrap :is([fill="#2e8b57"], [fill="#2e8b3a"]) { fill: var(--good); }
  html.regularize-colors body:not(.essential-ui) .chart-wrap :is([fill="#d97706"], [fill="#c98d1b"]) { fill: var(--gold); }
  html.regularize-colors body:not(.essential-ui) .chart-wrap [fill="#8d1226"] { fill: var(--wine); }
  html.regularize-colors body:not(.essential-ui) .chart-wrap [fill="rgba(141,18,38,.10)"] { fill: #551d321a; }
  html.regularize-colors body:not(.essential-ui) .chart-wrap [fill="#2563a6"] { fill: var(--palette-forecast); }
  html.regularize-colors body:not(.essential-ui) .chart-wrap :is([fill="#6b5559"], [fill="#5d3a40"]) { fill: var(--muted); }
  html.regularize-colors body:not(.essential-ui) .chart-wrap [stroke="#2e8b57"] { stroke: var(--good); }
  html.regularize-colors body:not(.essential-ui) .chart-wrap [stroke="#d97706"] { stroke: var(--gold); }
  html.regularize-colors body:not(.essential-ui) .chart-wrap [stroke="#8d1226"] { stroke: var(--wine); }
  html.regularize-colors body:not(.essential-ui) .chart-wrap [stroke="#2563a6"] { stroke: var(--palette-forecast); }
  html.regularize-colors body:not(.essential-ui) .chart-wrap :is([stroke="#bdaeb0"], [stroke="#c9ab6e"]) { stroke: var(--line); }
  html.regularize-colors body:not(.essential-ui) :is(.chart-legend, .leg) i[style*="#2e8b"] { background-color: var(--good) !important; }
  html.regularize-colors body:not(.essential-ui) :is(.chart-legend, .leg) i[style*="#d97706"],
  html.regularize-colors body:not(.essential-ui) :is(.chart-legend, .leg) i[style*="#c98d1b"] { background-color: var(--gold) !important; }
  html.regularize-colors body:not(.essential-ui) .chart-legend i[style*="#8d1226"] { background-color: var(--wine) !important; }
  html.regularize-colors body:not(.essential-ui) .chart-legend i[style*="#2563a6"] { background-color: var(--palette-forecast) !important; }

  html.regularize-colors body:not(.essential-ui) #login-ov { background-image: linear-gradient(175deg, var(--wine-deep) 0%, var(--wine) 55%, var(--wine-deep) 100%); }
  html.regularize-colors body:not(.essential-ui) :is(#login-card input, #login-retry) { background-color: var(--surface); }
  html.regularize-colors body:not(.essential-ui) #rec .seg span { background-color: var(--surface); }
  html.regularize-colors body:not(.essential-ui) #rec .seg input:checked + span { background-color: var(--accent-soft); }
  html.regularize-colors body:not(.essential-ui) #rec .tipos button.on { background-color: var(--wine); background-image: none; color: #fff8e7; border-color: var(--wine); }
  html.regularize-colors body:not(.essential-ui) #rec .prev { background-color: var(--surface-2); }
  html.regularize-colors body:not(.essential-ui) #rec :is(input, select) { background-color: var(--surface); }
  html.regularize-colors body:not(.essential-ui) .content footer { color: var(--muted); }
  html.regularize-colors body:not(.essential-ui) footer :is(b, i) { color: var(--ink); }
  html.regularize-colors body:not(.essential-ui) :is(footer a, #login-foot a) { color: var(--wine); }
}

/* Destaques de leitura nas tabelas financeiras, somente na tela. */
@media screen {
  body:not(.essential-ui) #app :is(
    input.money, input[data-f="nome"], input[data-d="tipo"],
    input[data-b="tipo"], input[data-a="desc"]
  ) { font-weight: 600; }
}
