:root {
  color-scheme: light;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #eef2fb;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #c4d0de;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --danger: #a33a2b;
  --danger-soft: #f7e7e3;
  --positive: #1d7651;
  --negative: #b74a37;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}



* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-header {
  align-items: center;
  background: #1e3a5f;
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px);
}

.app-header > * {
  min-width: 0;
}

/* ── Badge de sincronização ──────────────────────────────────────── */
.sync-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  margin-top: 6px;
  transition: color .3s;
}
.sync-ok      { color: #86efac; }
.sync-off     { color: rgba(255,255,255,.4); }
.sync-error   { color: #fca5a5; }
.sync-loading { color: rgba(255,255,255,.6); }
.sync-prompt  { color: #fde68a; cursor: pointer; text-decoration: underline; }

.eyebrow {
  color: #93c5fd;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.eyebrow.dark {
  color: var(--brand);
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

.header-actions,
.form-actions,
.panel-title,
.tabs {
  align-items: center;
  display: flex;
  gap: 10px;
}

.header-actions {
  flex: 1 1 520px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.header-menu {
  position: relative;
}

.header-menu summary {
  background: #eef3ed;
  border-radius: 6px;
  color: #26352e;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  min-height: 40px;
  padding: 10px 14px;
  user-select: none;
}

.header-menu summary::-webkit-details-marker {
  display: none;
}

.header-menu[open] summary,
.header-menu summary:hover {
  background: #dde8df;
}

.header-menu summary::after {
  content: "▾";
  font-size: 11px;
  margin-left: 8px;
}

.header-menu-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
  min-width: 210px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
}

.header-menu-panel button {
  justify-content: flex-start;
  text-align: left;
  white-space: nowrap;
}

.layout {
  display: grid;
  gap: 18px;
  padding: 22px clamp(14px, 3vw, 36px) 36px;
  width: 100%;
  min-width: 0;
}

.toolbar,
.period-bar,
.panel {
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
}

.period-bar {
  align-items: end;
  border: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  padding: 16px;
  min-width: 0;
}

.period-controls {
  align-items: end;
  display: grid;
  flex: 1 1 520px;
  gap: 12px;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) auto;
  min-width: 0;
}

.toolbar {
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  min-width: 0;
}

label {
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 11px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 122, 90, .16);
  outline: none;
}

textarea {
  resize: vertical;
}

/* --- Painel de resumo unificado ----------------------------------- */
.resumo-panel { background: var(--surface); }

.resumo-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.metric-card {
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
}

.mc-icon { font-size: 16px; line-height: 1; opacity: .45; }
.mc-label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.mc-value { font-size: clamp(18px, 2vw, 24px); font-weight: 800; letter-spacing: -.01em; line-height: 1.1; margin-top: 2px; }

.rc-positive { background: #dcfce7; border-left: 3px solid #16a34a; }
.rc-positive .mc-value { color: #15803d; }
.rc-negative { background: #fee2e2; border-left: 3px solid #dc2626; }
.rc-negative .mc-value { color: #b91c1c; }
.rc-neutral { background: #dbeafe; border-left: 3px solid var(--brand); }
.rc-neutral .mc-value { color: var(--brand-dark); }
.rc-muted { background: var(--surface-2); border: 1px solid var(--line); }
.rc-muted .mc-value { color: var(--ink); }

.resumo-bottom {
  align-items: start;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 0;
  padding-top: 18px;
}

.resumo-bottom > * { flex: 0 0 auto; padding: 0 28px; }
.resumo-bottom > *:first-child { padding-left: 0; }
.resumo-bottom > *:last-child { flex: 1; padding-right: 0; }
.resumo-bottom > * + * { border-left: 1px solid var(--line); }

.resumo-sub-title { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; margin: 0 0 10px; text-transform: uppercase; }

.resumo-contas { min-width: 148px; }
.conta-row { align-items: center; background: var(--surface-2); border-radius: 6px; display: flex; font-size: 13px; justify-content: space-between; margin-bottom: 5px; padding: 6px 10px; }
.conta-row span { color: var(--muted); font-weight: 600; }
.conta-row strong { color: var(--ink); font-weight: 700; }

.resumo-rateio { min-width: 160px; text-align: center; }
.rateio-total { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; color: var(--brand-dark); display: block; font-size: 22px; font-weight: 800; padding: 12px 16px; }

.resumo-pessoas { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
.pessoa-col { display: flex; flex-direction: column; gap: 4px; }
.pessoa-row { align-items: center; border-bottom: 1px solid var(--line); display: flex; font-size: 13px; justify-content: space-between; padding: 5px 0; }
.pessoa-row span { color: var(--muted); }
.pessoa-row strong { color: var(--ink); font-weight: 700; }
.pessoa-row.destaque { background: #eff6ff; border: none; border-radius: 7px; font-weight: 700; margin-top: 2px; padding: 7px 10px; }
.pessoa-row.destaque span { color: var(--brand); }
.pessoa-row.destaque strong { color: var(--brand-dark); font-size: 15px; }

/* --- Add-row inline ----------------------------------------------- */
tbody.add-body .add-row { background: var(--surface-2); border-top: 2px solid var(--line); }
tbody.add-body .add-row td { padding: 6px 4px; vertical-align: middle; }

.add-row-input { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font: inherit; font-size: 13px; min-height: 32px; padding: 0 8px; width: 100%; }
.add-row-input:focus { border-color: var(--brand); outline: none; }
.add-row-input.money { text-align: right; }
.add-row-stacked { margin-top: 4px; }
.add-row-adjustment { margin-bottom: 4px; }

#entry-client-name {
  margin-top: 8px;
}

.add-row-action-cell { min-width: 160px; white-space: nowrap; }
.add-row-recurrence-wrap { display: flex; gap: 4px; margin-bottom: 4px; }
.add-row-recurrence-wrap select { flex: 1; }
.add-row-recurrence-wrap input { width: 56px; flex: 0 0 auto; }
.add-row-btn { font-size: 13px; min-height: 32px; padding: 0 12px; white-space: nowrap; width: 100%; }
.add-body { display: none; }

.panel-add-button {
  min-height: 36px;
  padding: 8px 14px;
  white-space: nowrap;
}

/* --- Modal edição ------------------------------------------------- */
.edit-entry-box { max-width: 760px; width: min(760px, 96vw); }
.edit-entry-box .entry-form {
  align-items: end;
  display: grid;
  gap: 12px 14px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  max-height: min(76vh, 720px);
  overflow-y: auto;
  padding-right: 6px;
}
.edit-entry-box .entry-form > label { grid-column: span 3; min-width: 0; }
.edit-entry-box .entry-form .entry-field-category,
.edit-entry-box .entry-form .entry-field-value,
.edit-entry-box .entry-form .entry-field-payment,
.edit-entry-box .entry-form .entry-field-installments,
.edit-entry-box .entry-form .entry-field-status,
.edit-entry-box .entry-form .entry-field-account { grid-column: span 2; }
.edit-entry-box .entry-form .entry-field-description,
.edit-entry-box .entry-competence-note,
.edit-entry-box .form-actions { grid-column: 1 / -1; }
.entry-competence-note { order: 10; }
.entry-field-client { order: 20; }
.entry-field-category { order: 30; }
.entry-field-description { order: 40; }
.entry-field-value { order: 50; }
.entry-field-payment { order: 60; }
.entry-field-installments { order: 70; }
.entry-field-status { order: 80; }
.entry-field-account { order: 90; }
.entry-field-adjustment { order: 100; }
.entry-field-paid-by { order: 110; }
.edit-entry-box .form-actions { order: 120; }
.entry-field-client,
.entry-field-adjustment { align-self: start; }
.entry-field-client,
.wiest-field-client {
  position: relative;
}
.entry-client-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.entry-client-register { width: fit-content; }
.entry-field-client input[type="search"] {
  min-height: 36px;
  padding: 7px 10px;
}
.client-select-fallback {
  display: none;
}
.client-suggestions {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
  left: 0;
  max-height: 230px;
  overflow-y: auto;
  padding: 4px;
  position: absolute;
  right: 0;
  top: 58px;
  z-index: 80;
}
.client-suggestion-item {
  background: transparent;
  border-radius: 6px;
  color: var(--ink);
  display: block;
  font-size: 13px;
  font-weight: 700;
  min-height: 34px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}
.client-suggestion-item:hover,
.client-suggestion-item:focus {
  background: #eaf2ff;
  color: #1d4ed8;
}
.client-suggestion-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 9px 10px;
}

.client-suggestion-register {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  color: #1d4ed8;
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin: 4px;
  min-height: 34px;
  padding: 8px 10px;
  text-align: left;
  width: calc(100% - 8px);
}

.client-suggestion-register:hover,
.client-suggestion-register:focus {
  background: #dbeafe;
  color: #1e40af;
}

.entry-competence-note {
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  padding: 9px 11px;
}
.entry-competence-note.warning {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.panel {
  border: 1.5px solid #8fa8c4;
  padding: 18px;
}

.panel-title {
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-title-main {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-expand-toggle {
  min-height: 30px;
  padding-inline: 10px;
}

.table-expand-toggle[aria-pressed="true"] {
  background: #eef7ef;
  border-color: #9fc8ac;
  color: #24643a;
}

.estimated-revenue {
  align-items: center;
  background: #eaf2ff;
  border: 1px solid #a8c3e8;
  border-radius: 6px;
  color: #244769;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
}

.estimated-revenue strong {
  color: #0d4ea6;
  font-size: 13px;
  white-space: nowrap;
}

.distribution {
  display: grid;
  gap: 10px;
}

.distribution div {
  align-items: center;
  background: var(--surface-2);
  display: flex;
  justify-content: space-between;
  min-height: 46px;
  padding: 10px 12px;
}

.distribution strong {
  font-size: 16px;
}

.entry-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entry-form label:nth-child(5),
.form-actions {
  grid-column: 1 / -1;
}

.entry-delete-button {
  margin-left: auto;
}

.primary,
.ghost,
.danger,
.tab,
.icon-button {
  border-radius: 6px;
  min-height: 40px;
  padding: 10px 14px;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.primary {
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.primary:hover {
  background: var(--brand-dark);
}

.ghost,
.tab {
  background: #eef3ed;
  color: #26352e;
  font-weight: 700;
}

.ghost:hover,
.tab:hover {
  background: #dde8df;
}

.danger {
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 800;
}

.tab.active {
  background: var(--brand);
  color: #fff;
}

.import-overlay {
  align-items: center;
  background: rgba(20, 32, 24, .55);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 1000;
}

#clients-modal {
  z-index: 1200;
}

#series-modal,
#future-modal,
#sync-modal,
#wiest-entry-modal {
  z-index: 1300;
}

.import-box {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(20, 32, 24, .22);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  width: min(760px, 95vw);
}

.clients-box {
  max-height: 94vh;
  width: min(1280px, 98vw);
}

.import-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.import-close {
  background: none;
  border-radius: 6px;
  color: var(--muted);
  font-size: 18px;
  min-height: 32px;
  padding: 4px 10px;
}

.import-close:hover { background: var(--surface-2); }

.import-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.clients-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.client-search {
  display: flex;
  flex: 1 1 420px;
  gap: 8px;
  min-width: 280px;
}

.client-search input {
  flex: 1;
  min-width: 0;
}

.client-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.client-form.collapsed {
  display: none;
}

.client-form .form-actions,
.client-form label:last-of-type {
  grid-column: 1 / -1;
}

.input-action {
  display: flex;
  gap: 6px;
}

.input-action input {
  min-width: 0;
}

.ghost.compact {
  min-height: 42px;
  padding: 8px 10px;
  white-space: nowrap;
}

.client-list-wrap {
  max-height: min(62vh, 680px);
}

.client-list-wrap table {
  min-width: 980px;
}

.client-list-wrap th:nth-child(1),
.client-list-wrap td:nth-child(1) {
  width: 26%;
}

.client-list-wrap th:nth-child(2),
.client-list-wrap td:nth-child(2) {
  width: 16%;
  white-space: nowrap;
}

.client-list-wrap th:nth-child(3),
.client-list-wrap td:nth-child(3) {
  width: 26%;
}

.client-list-wrap th:nth-child(4),
.client-list-wrap td:nth-child(4) {
  width: 14%;
}

.client-list-wrap th:nth-child(5),
.client-list-wrap td:nth-child(5) {
  min-width: 210px;
  width: 210px;
}

.client-list-wrap td:last-child {
  white-space: nowrap;
}

.client-select-row {
  cursor: pointer;
}

.client-select-row:hover {
  background: #eef6ff;
}

.client-select-row:hover td:first-child {
  color: var(--brand);
  font-weight: 800;
}

.client-list-wrap .row-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.client-list-wrap td:last-child .ghost,
.client-list-wrap td:last-child .icon-button,
.client-list-wrap td:last-child button {
  min-width: 58px;
  white-space: nowrap;
}

.client-line {
  color: var(--brand);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 2px;
}

.description-line {
  display: block;
}

.overdue-alert-panel {
  background: #fff3f0;
  border-color: #e08a7f;
}

.overdue-alert-panel .panel-title strong {
  color: var(--danger);
  font-size: 20px;
}

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

.overdue-item {
  align-items: center;
  background: #fffafa;
  border: 1px solid #efb5ad;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  min-height: 48px;
  padding: 8px 12px;
  text-align: left;
}

.overdue-item strong,
.overdue-item b {
  color: #8f2419;
}

.overdue-item small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.client-center {
  background: #f7fbff;
  border: 1px solid #a9c7e8;
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.client-center-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.client-center-actions,
.wiest-title-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.client-center-header h3,
.client-center-header p,
.client-center h4 {
  margin: 0;
}

.client-center-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.client-center-grid div {
  background: #fff;
  border: 1px solid #c8d9ec;
  border-radius: 6px;
  padding: 10px;
}

.client-center-grid span,
.muted-text {
  color: var(--muted);
  font-size: 12px;
}

.client-center-grid strong {
  display: block;
  font-size: 16px;
  margin-top: 4px;
}

.client-center-details,
.client-center-lists {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.client-center-lists {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.client-center section {
  background: #fff;
  border: 1px solid #d8e4f2;
  border-radius: 6px;
  padding: 12px;
}

.client-center section p {
  margin: 7px 0 0;
}

.series-box {
  width: min(980px, 96vw);
}

.series-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.series-toolbar input {
  flex: 1 1 320px;
}

.series-toolbar select {
  flex: 0 1 180px;
}

.future-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

.series-group {
  display: grid;
}

.series-group summary {
  cursor: pointer;
  list-style: none;
}

.series-group summary::-webkit-details-marker {
  display: none;
}

.series-group[open] .series-row {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.series-row {
  align-items: center;
  background: #f8fbff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 1.4fr) minmax(120px, .7fr) minmax(180px, 1fr) minmax(150px, .8fr) minmax(90px, .5fr);
  padding: 12px 14px;
}

.series-head {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 0;
}

.series-row strong,
.series-row span,
.series-row small {
  display: block;
}

.series-row small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.series-client {
  display: grid;
  gap: 2px;
  grid-template-columns: auto minmax(0, 1fr);
}

.series-client strong,
.series-client small {
  grid-column: 2;
}

.client-dot {
  color: #15803d;
  grid-row: 1 / span 2;
}

.series-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.series-detail-list {
  background: #fff;
  border: 1px solid #bfdbfe;
  border-top: 0;
  border-radius: 0 0 10px 10px;
  display: grid;
  gap: 0;
  padding: 4px 14px;
}

.series-edit-card {
  border-bottom: 1px solid #e5edf8;
  display: grid;
  gap: 8px;
  padding: 10px 0;
}

.series-edit-card:last-child {
  border-bottom: 0;
}

.series-edit-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.series-edit-head strong,
.series-edit-head small {
  display: block;
}

.series-edit-head small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.series-edit-form {
  align-items: end;
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(130px, .7fr) minmax(130px, .7fr) minmax(220px, 1.4fr) auto;
  padding: 10px;
}

.series-edit-form label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 4px;
}

.series-edit-form input {
  min-width: 0;
}

.series-items-list {
  display: grid;
}

.series-detail-row {
  align-items: center;
  border-top: 1px solid #e5edf8;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, .6fr) minmax(110px, auto);
  padding: 10px 0;
}

.series-detail-row:first-child {
  border-top: 0;
}

.series-detail-row small,
.series-detail-row span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.series-detail-row > strong {
  color: var(--brand);
  text-align: right;
}

.client-history,
.client-mini-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.client-history div,
.client-mini-list div {
  border-bottom: 1px solid #edf2f8;
  display: grid;
  gap: 3px;
  padding-bottom: 8px;
}

.client-history strong,
.client-mini-list strong {
  color: var(--brand);
}

.client-history em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.client-mini-list a {
  color: var(--brand-dark);
  font-weight: 800;
}

.reserve-panel {
  background: #fbfdf9;
}

/* Conta L */
.conta-l-session {
  align-items: stretch;
  background: var(--surface);
  justify-content: stretch;
}

.conta-l-box {
  border-radius: 0;
  box-shadow: none;
  background: #f3f7fb;
  gap: 24px;
  max-height: none;
  min-height: 100vh;
  overflow: auto;
  padding: 28px 32px;
  width: 100vw;
}

.conta-l-open-btn {
  margin-top: 6px;
  width: 100%;
}

.conta-l-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.conta-l-header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.conta-l-header-actions label {
  align-items: center;
  color: #48617d;
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
}

.conta-l-header-actions select {
  min-height: 38px;
  min-width: 160px;
}

.conta-l-module-tabs {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
  display: flex;
  gap: 8px;
  padding: 8px;
  position: sticky;
  top: 0;
  z-index: 3;
}

.conta-l-module-tab {
  background: #f1f5f9;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #334155;
  cursor: pointer;
  flex: 1 1 0;
  font: inherit;
  font-weight: 800;
  min-height: 42px;
  padding: 10px 12px;
}

.conta-l-module-tab.active {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}

.conta-l-block {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
  display: grid;
  gap: 16px;
  padding: 18px;
  position: relative;
}

.conta-l-block::before {
  border-radius: 12px 0 0 12px;
  bottom: -2px;
  content: "";
  left: -2px;
  position: absolute;
  top: -2px;
  width: 7px;
}

.conta-l-block-title {
  align-items: center;
  border-radius: 10px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 52px;
  padding: 12px 14px;
}

.conta-l-block-title h3 {
  font-size: 18px;
  font-weight: 900;
}

.conta-l-block-title h4 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.conta-l-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.conta-l-sum-row {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  font-size: 13px;
  gap: 8px;
  padding: 14px;
}

.conta-l-sum-row + .conta-l-sum-row {
  border-top: 1px solid var(--line);
}

.conta-l-sum-row strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.conta-l-base-row {
  font-weight: 700;
}

.conta-l-form {
  align-items: center;
  background: #f8fbf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}

.conta-l-form input,
.conta-l-form select,
.conta-l-form textarea {
  flex: 1 1 120px;
}

.conta-l-form input[type="text"],
.conta-l-form textarea {
  flex: 3 1 320px;
}

.conta-l-form textarea {
  min-height: 74px;
  resize: vertical;
}

.conta-l-table-wrap {
  max-height: 360px;
  min-height: 220px;
}

.conta-l-table-wrap table {
  min-width: 900px;
}

.conta-l-totals {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  font-size: 14px;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 14px;
}

.conta-l-juste {
  border-color: #86b7fe;
}

.conta-l-juste::before {
  background: #2563eb;
}

.conta-l-juste > .conta-l-block-title {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}

.conta-l-juste .conta-l-form {
  background: #f8fbff;
  border-color: #bfdbfe;
}

.conta-l-juste .conta-l-totals {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.conta-l-anderson {
  border-color: #7dd3fc;
}

.conta-l-anderson::before {
  background: #0ea5e9;
}

.conta-l-anderson > .conta-l-block-title {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  color: #075985;
}

.conta-l-anderson > .conta-l-block-title .ghost {
  background: #ffffff;
  border: 1px solid #7dd3fc;
}

.conta-l-wiest {
  border-color: #93c5fd;
}

.conta-l-wiest::before {
  background: #2563eb;
}

.conta-l-wiest > .conta-l-block-title {
  background: #e2e8f0;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
}

.conta-l-wiest > .conta-l-block-title .ghost {
  background: #ffffff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
}

.wiest-form {
  background: #f1f5f9;
  border-color: #bfdbfe;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(145px, .75fr) minmax(220px, 1.25fr) minmax(150px, .75fr);
  align-items: end;
}

.wiest-entry-box {
  max-width: 720px;
  width: min(720px, 96vw);
}

.wiest-entry-box .wiest-form {
  max-height: none;
  overflow: visible;
}

.wiest-field {
  color: #1e3a8a;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 800;
  gap: 5px;
  min-width: 0;
}

.wiest-field input,
.wiest-field select,
.wiest-field textarea {
  flex: 0 0 auto;
  width: 100%;
}

.wiest-entry-box .wiest-field input,
.wiest-entry-box .wiest-field select {
  flex: 0 0 auto;
  height: 42px;
  min-height: 42px;
}

.wiest-entry-box .wiest-field-value input {
  max-width: 180px;
}

.wiest-entry-box .wiest-form {
  grid-template-columns: minmax(140px, .8fr) minmax(210px, 1.2fr) minmax(135px, .7fr);
}

.wiest-field-date {
  grid-column: 1;
}

.wiest-field-client {
  grid-column: 2 / -1;
}

.wiest-field-description {
  grid-column: 1 / -1;
}

.wiest-field-description textarea {
  height: 118px;
  min-height: 118px;
  resize: vertical;
}

.wiest-field-value,
.wiest-field-payment,
.wiest-recurrence-note {
  grid-column: span 1;
}

.wiest-field-value {
  align-self: end;
}

.wiest-field-client input[type="search"] {
  min-height: 36px;
  padding: 7px 10px;
}

.wiest-client-line {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.wiest-client-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  min-height: 36px;
}

.wiest-client-actions .ghost {
  min-height: 36px;
  padding: 7px 12px;
  white-space: nowrap;
}

.wiest-form > .primary {
  align-self: end;
  min-height: 44px;
}

.wiest-entry-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.wiest-recurrence-count {
  align-items: center;
  color: #334155;
  display: flex;
  flex: 0 1 120px;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.wiest-recurrence-count input {
  max-width: 76px;
}

.wiest-recurrence-note {
  align-self: end;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 800;
  padding: 0 0 12px;
}

.wiest-fee-option {
  align-items: center;
  align-self: end;
  background: #f8fafc;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #0f172a;
  display: flex;
  flex: 0 1 auto;
  font-size: 12px;
  font-weight: 700;
  gap: 7px;
  height: 42px;
  min-height: 42px;
  padding: 0 12px;
  white-space: nowrap;
}

.wiest-fee-option input {
  appearance: auto;
  flex: 0 0 auto;
  height: 15px;
  margin: 0;
  min-height: 0;
  padding: 0;
  width: 15px;
}

.wiest-fee-tag {
  background: #eef6ff;
  color: #1d4ed8;
}

.wiest-doc-actions {
  align-items: center;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 14px;
}

.wiest-doc-actions strong {
  color: #1e3a8a;
  display: block;
  font-size: 14px;
}

.wiest-doc-actions span {
  color: #475569;
  font-size: 13px;
}

.wiest-doc-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wiest-search-bar {
  align-items: center;
  display: flex;
  gap: 8px;
}

.wiest-search-bar input {
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #0f172a;
  flex: 1;
  min-height: 42px;
  min-width: 240px;
  padding: 0 14px;
}

.select-col {
  text-align: center;
  width: 44px;
}

.share-caixa-cell {
  white-space: nowrap;
}

.inline-check {
  align-items: center;
  color: #1e3a8a;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.wiest-table-wrap {
  border-color: #93c5fd;
}

.wiest-table-wrap th {
  background: #e2e8f0;
  color: #1e3a8a;
}

.wiest-table-wrap th:nth-child(8),
.wiest-table-wrap td:nth-child(8) {
  width: 150px;
}

.wiest-final-totals {
  background: #f8fafc;
  border-color: #93c5fd;
  border-left: 8px solid #2563eb;
}

.wiest-final-totals span {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 7px 10px;
}

.anderson-compensations,
.anderson-services {
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .72);
  display: grid;
  gap: 12px;
  padding: 14px;
}

.anderson-compensations {
  background: #fff7ed;
  border: 2px solid #fed7aa;
  border-left: 8px solid #f59e0b;
}

.anderson-compensations .conta-l-block-title {
  background: #ffedd5;
  border: 1px solid #fed7aa;
  min-height: 42px;
}

.anderson-compensations .conta-l-block-title h4 {
  color: #9a3412;
}

.anderson-comp-form {
  background: #fffbeb;
  border-color: #fed7aa;
}

.anderson-comp-table-wrap {
  border-color: #fed7aa;
}

.anderson-comp-table-wrap th {
  background: #ffedd5;
  color: #7c2d12;
}

.anderson-comp-table-wrap tbody tr {
  background: #fffaf2;
}

.anderson-compensations .conta-l-totals {
  background: #fffbeb;
  border-color: #fed7aa;
}

.anderson-compensations .conta-l-total-saldo strong,
#anderson-comp-share-total {
  color: #c2410c;
}

.anderson-settings {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  max-width: 460px;
  width: 100%;
}

.anderson-settings input {
  background: #ffffff;
  font-weight: 700;
  min-height: 36px;
  padding: 7px 10px;
}

.anderson-comp-form input#anderson-comp-description {
  flex: 3 1 360px;
}

.anderson-comp-form input#anderson-comp-value,
.anderson-comp-form input#anderson-comp-tax,
.anderson-comp-form input#anderson-comp-share {
  flex: 1 1 120px;
}

.anderson-comp-table-wrap {
  max-height: 220px;
}

.anderson-comp-table-wrap table {
  min-width: 820px;
}

.anderson-services {
  background: #ecfdf5;
  border: 2px solid #bbf7d0;
  border-left: 8px solid #16a34a;
}

.anderson-services .conta-l-block-title {
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  min-height: 42px;
}

.anderson-services .conta-l-block-title h4 {
  color: #166534;
}

.anderson-services .conta-l-block-title {
  align-items: end;
  gap: 16px;
}

.anderson-form {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.anderson-table-wrap {
  border-color: #bbf7d0;
}

.anderson-table-wrap th {
  background: #dcfce7;
  color: #14532d;
}

.anderson-table-wrap tbody tr {
  background: #f7fef9;
}

.anderson-table-wrap tbody tr:nth-child(even) {
  background: #effaf3;
}

.anderson-settings label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 6px;
}

.anderson-form input#anderson-description {
  flex: 4 1 420px;
}

.anderson-form input#anderson-hours,
.anderson-form input#anderson-value {
  flex: 1 1 120px;
}

.conta-l-total-saldo {
  margin-left: auto;
}

.conta-l-total-saldo strong {
  color: var(--brand);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.anderson-final-totals {
  background: #eff6ff;
  border-color: #93c5fd;
  border-left: 8px solid var(--brand);
  align-items: center;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .08);
}

.anderson-final-totals span {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 7px 10px;
}

.anderson-final-totals .conta-l-total-saldo {
  background: #dbeafe;
  border-color: #60a5fa;
}

.anderson-final-totals .conta-l-total-saldo strong {
  font-size: 18px;
}

.cl-entry-credito td:nth-child(4) {
  color: var(--success, #2e7d46);
}

.cl-entry-debito td:nth-child(4) {
  color: var(--danger);
}

.cl-tipo {
  font-size: 12px;
}

.reserve-balance {
  color: var(--brand);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.reserve-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.reserve-summary div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.reserve-summary span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.reserve-summary strong {
  font-size: 17px;
}

.reserve-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 150px 1fr 140px auto;
  margin-bottom: 12px;
}

.reserve-form input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 42px;
  padding: 0 10px;
}

.reserve-table-wrap {
  max-height: 260px;
}

.reserve-entry-deposit {
  background: #f0faf4;
}

.reserve-entry-withdrawal {
  background: #fff7f6;
}

.import-mapping {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.import-default-fields {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 160px);
  margin-top: 10px;
}

.import-default-fields label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
}

.import-default-fields input,
.import-default-fields select {
  min-height: 38px;
  padding: 8px 10px;
}

.import-preview-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.import-edit-wrap {
  max-height: 360px;
}

.import-edit-table {
  min-width: 720px;
}

.import-edit-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  min-height: 32px;
  padding: 6px 8px;
  width: 100%;
}

.import-edit-input.money-input {
  text-align: right;
}

.import-footer {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

#import-count {
  color: var(--muted);
  flex: 1;
  font-size: 13px;
}

.devedores-total {
  background: var(--danger-soft);
  border-radius: 6px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
}

.lancamentos-split {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-width: 0;
}

.lancamentos-split > * {
  min-width: 0;
}

.lancamentos-split.expanded-receitas,
.lancamentos-split.expanded-despesas {
  grid-template-columns: minmax(0, 1fr);
}

.lancamentos-split.expanded-receitas #panel-despesas,
.lancamentos-split.expanded-despesas #panel-receitas {
  display: none;
}

.lancamentos-split.single {
  grid-template-columns: 1fr;
}

.lancamentos-split .table-wrap table {
  min-width: 0;
}

.table-wrap {
  border: 1px solid var(--line);
  max-height: 580px;
  overflow-x: auto;
  overflow-y: auto;
  width: 100%;
  min-width: 0;
}

table {
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

thead {
  background: #edf3ee;
  position: sticky;
  top: 0;
  z-index: 1;
}

th,
td {
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  padding: 8px 7px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #425149;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

td {
  font-size: 13px;
}

.money {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.multiline-cell {
  white-space: pre-line;
}

.pill {
  background: #e8f4ef;
  border-radius: 999px;
  color: var(--positive);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
}

.pill.open {
  background: #f3eee3;
  color: #80612a;
}

.status-toggle {
  background: #e8f4ef;
  border-radius: 999px;
  color: var(--positive);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  min-height: 26px;
  padding: 5px 8px;
}

.status-toggle.open {
  background: #f3eee3;
  color: #80612a;
}

.status-toggle:hover {
  filter: brightness(.96);
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.entry-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
  min-width: 96px;
}

.asaas-col {
  width: 112px;
}

.icon-button {
  background: #eef3ed;
  min-width: 42px;
  padding: 8px 10px;
}

.icon-button.delete {
  background: var(--danger-soft);
  color: var(--danger);
}

tr.row-editable {
  cursor: pointer;
}

.inline-edit-cell {
  background: transparent;
  border-radius: 4px;
  color: inherit;
  display: block;
  font: inherit;
  padding: 2px 4px;
  text-align: left;
  width: 100%;
}

.inline-edit-cell:hover {
  background: #eef6ff;
  color: var(--brand);
}

.payment-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  margin-left: 5px;
  padding: 2px 6px;
  vertical-align: middle;
  white-space: nowrap;
}

.payment-badge.single {
  background: #eef2ff;
  color: #3730a3;
}

.payment-badge.recurring {
  background: #dcfce7;
  color: #166534;
}

.payment-badge.installment {
  background: #fef3c7;
  color: #92400e;
}

.row-menu {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 45, 36, .18);
  display: flex;
  flex-direction: column;
  min-width: 140px;
  overflow: hidden;
  position: fixed;
  z-index: 999;
}

.row-menu-item {
  background: none;
  border-radius: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
  padding: 10px 16px;
  text-align: left;
}

.row-menu-item:hover {
  background: var(--surface-2);
}

.row-menu-item.delete {
  color: var(--danger);
}

.row-menu-item.delete:hover {
  background: var(--danger-soft);
}

tr.row-paid {
  background: #f0faf4;
}

tr.row-open {
  background: #fdf6ec;
}

tr.row-adjustment-due {
  background: #fff3bf;
}

.adjustment-tag {
  color: #78350f;
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
}

.consolidated-tag {
  background: #eef7ef;
  border: 1px solid #b9d8c1;
  border-radius: 6px;
  color: #24643a;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  margin-left: 8px;
  padding: 2px 6px;
  vertical-align: middle;
}

.ajustes-panel {
  border-color: #e5c86f;
  background: #fffbeb;
}

.ajustes-panel h2 {
  color: #78350f;
}

.adjustment-due-date {
  color: #92400e;
  font-weight: 700;
  white-space: nowrap;
}

tr.row-paid:hover {
  background: #e4f5ea;
}

tr.row-open:hover {
  background: #faeedd;
}

tr.row-adjustment-due:hover {
  background: #ffe8a3;
}

.empty {
  color: var(--muted);
  padding: 34px;
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .app-header,
  .period-bar,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar,
  .period-controls,
  .summary-grid,
  .account-summary,
  .split,
  .client-form,
  .reserve-summary,
  .reserve-form,
  .client-center-grid,
  .client-center-details,
  .client-center-lists,
  .series-row,
  .series-detail-row,
  .series-edit-form,
  .anderson-settings,
  .conta-l-summary,
  .wiest-form,
  .lancamentos-split,
  .lancamentos-split.single {
    grid-template-columns: 1fr;
  }

  .wiest-field-description {
    grid-column: auto;
  }

  .wiest-client-line {
    grid-template-columns: 1fr;
  }

  .wiest-client-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .entry-form {
    grid-template-columns: 1fr;
  }

  .header-actions,
  .form-actions,
  .tabs {
    width: 100%;
  }

  .header-menu {
    flex: 1;
  }

  .header-menu summary {
    text-align: center;
  }

  .header-menu-panel {
    left: 0;
    right: auto;
    width: 100%;
  }

  .header-actions button,
  .form-actions button,
  .tabs button {
    flex: 1;
  }
}


@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html,
  body {
    background: #edf4ff;
    color: #111;
    font-size: 9.5pt;
    margin: 0;
  }

  .app-header,
  .toolbar,
  .period-controls,
  .entry-form,
  .form-actions,
  .print-hide,
  .add-body,
  .import-overlay,
  .row-menu,
  .overdue-alert-panel,
  .client-center,
  .clients-box {
    display: none !important;
  }

  body::before {
    background: #eaf2ff;
    border: 1px solid #7fa2cc;
    color: #0d2850;
    content: "Uhlig & Wiest Advocacia\A" attr(data-print-period) "\A Gerado em " attr(data-print-generated);
    display: block;
    font-size: 10pt;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 4mm;
    padding: 3mm 4mm;
    white-space: pre-line;
  }

  .layout {
    background: #ffffff;
    border: 1px solid #8aa4c5;
    box-shadow: none;
    gap: 5mm;
    margin: 0;
    max-width: none;
    padding: 5mm;
    width: 100%;
  }

  .period-bar {
    align-items: flex-start;
    border: 0;
    border-bottom: 1.5px solid #333;
    box-shadow: none;
    justify-content: flex-start;
    padding: 0 0 4mm;
  }

  .period-bar::after {
    color: #555;
    content: "Relatório Financeiro";
    font-size: 9pt;
    font-weight: 700;
    margin-left: auto;
    text-transform: uppercase;
  }

  .eyebrow.dark {
    color: #555;
    font-size: 7.5pt;
    letter-spacing: 0;
  }

  #period-title {
    color: #111;
    font-size: 18pt;
    line-height: 1.1;
  }

  .period-bar,
  .resumo-panel,
  .reserve-panel,
  #devedores-panel {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .panel {
    background: #f8fbff !important;
    border: 1px solid #b8cce5;
    box-shadow: none;
    padding: 3mm;
  }

  .panel-title {
    border-bottom: 1px solid #d0d0d0;
    margin-bottom: 3mm;
    padding-bottom: 2mm;
  }

  .panel-title h2 {
    color: #111;
    font-size: 12pt;
  }

  .resumo-metrics {
    display: grid;
    gap: 2.5mm;
    grid-template-columns: repeat(4, 1fr);
  }

  .reserve-summary {
    display: grid;
    gap: 2.5mm;
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-card,
  .reserve-summary div {
    background: #fff !important;
    border: 1px solid #cfcfcf;
    box-shadow: none;
    min-height: auto;
    padding: 2mm;
  }

  .mc-icon {
    display: none;
  }

  .mc-label,
  .reserve-summary span {
    color: #555;
    font-size: 7pt;
    letter-spacing: 0;
  }

  .mc-value,
  .reserve-summary strong,
  .reserve-balance {
    color: #111;
    font-size: 12pt;
  }

  .reserve-panel {
    background: #fff;
  }

  .reserve-table-wrap {
    margin-top: 3mm;
  }

  .resumo-bottom.print-hide {
    border-top: 1px solid #d0d0d0;
    display: grid !important;
    gap: 2mm;
    grid-template-columns: .8fr 1.2fr;
    margin-top: 2mm;
    padding-top: 2mm;
  }

  .resumo-bottom > * {
    border-left: 0 !important;
    padding: 0 !important;
  }

  .resumo-contas {
    display: none !important;
  }

  .resumo-rateio,
  .pessoa-col {
    border: 1px solid #cfcfcf;
    padding: 2mm !important;
  }

  .resumo-pessoas {
    display: grid;
    gap: 2mm;
    grid-template-columns: repeat(2, 1fr);
  }

  .resumo-sub-title {
    color: #555;
    font-size: 7pt;
    letter-spacing: 0;
  }

  .rateio-total,
  .pessoa-row strong {
    color: #111;
    font-size: 10pt;
  }

  .lancamentos-split,
  .lancamentos-split.single {
    display: grid;
    gap: 3mm;
    grid-template-columns: 1fr;
  }

  #panel-receitas,
  #panel-despesas {
    break-inside: auto;
    page-break-inside: auto;
  }

  #panel-despesas {
    order: -1;
  }

  #panel-receitas {
    order: 1;
  }

  .table-wrap {
    border: 0;
    max-height: none;
    overflow: visible;
  }

  table {
    border-collapse: collapse;
    min-width: 0;
    table-layout: fixed;
    width: 100%;
  }

  thead {
    background: #f0f0f0 !important;
    display: table-header-group;
    position: static;
  }

  tfoot {
    display: table-footer-group;
  }

  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  th,
  td {
    border: 1px solid #d2d2d2;
    font-size: 5.8pt;
    line-height: 1.15;
    padding: .8mm 1mm;
    vertical-align: top;
  }

  th {
    color: #222;
    font-size: 5.4pt;
    font-weight: 800;
    letter-spacing: 0;
  }

  td.money,
  th.money {
    text-align: right;
    white-space: nowrap;
  }

  .status-toggle {
    background: transparent;
    border: 0;
    color: #111;
    font-size: 5.8pt;
    font-weight: 700;
    min-height: 0;
    padding: 0;
  }

  .inline-edit-cell {
    background: transparent;
    color: inherit;
    display: block;
    font-size: inherit;
    padding: 0;
    text-align: inherit;
  }

  .client-line {
    color: #111;
    font-size: 5.8pt;
  }

  .layout {
    border-color: #8aa4c5;
  }

  .period-bar {
    background: #eaf2ff !important;
    border: 1px solid #b6cae6;
    border-left: 5px solid #2563eb;
    padding: 4mm;
  }

  .period-bar::after,
  .eyebrow.dark {
    color: #1d4ed8;
  }

  .panel {
    border-color: #b8cce5;
    border-radius: 4px;
  }

  .panel-title {
    border-bottom-color: #b8cce5;
  }

  .panel-title h2 {
    color: #1e3a5f;
  }

  .metric-card:nth-child(1) {
    background: #eaf8ef !important;
    border-color: #a9d7b8;
  }

  .metric-card:nth-child(2) {
    background: #fdecea !important;
    border-color: #efb5ad;
  }

  .metric-card:nth-child(3) {
    background: #eaf2ff !important;
    border-color: #b8cce5;
  }

  .metric-card:nth-child(4) {
    background: #fff7df !important;
    border-color: #ead28a;
  }

  .reserve-panel {
    background: #eaf2ff !important;
    border-color: #8fb4e8;
  }

  .reserve-summary div,
  .resumo-rateio,
  .pessoa-col {
    background: #fff !important;
  }

  #devedores-panel {
    background: #fff8e6 !important;
    border-color: #e5c86f;
  }

  #panel-receitas {
    background: #f6fbf8 !important;
    border-color: #a9d7b8;
  }

  #panel-despesas {
    background: #fff7f6 !important;
    border-color: #efb5ad;
  }

  thead {
    background: #dfeafe !important;
  }

  th {
    border-color: #aebfd7;
    color: #1e3a5f;
  }

  td {
    border-color: #d9e2ef;
  }

  .status-toggle {
    color: #166534;
  }

  tr.row-paid,
  tr.row-open {
    background: #fff !important;
  }

  tr.row-paid {
    background: #f2fbf5 !important;
  }

  tr.row-open {
    background: #ffd9d9 !important;
  }

  tr.row-open td {
    border-color: #ef9a9a;
    color: #7f1d1d;
    font-weight: 700;
  }

  tr.row-adjustment-due {
    background: #fff3bf !important;
  }

  tr.row-adjustment-due td {
    border-color: #e5c86f;
    color: #5f4700;
    font-weight: 700;
  }

  tr.row-open .status-toggle {
    color: #991b1b;
   }

  .empty {
    padding: 4mm;
  }
}

/* -- Integração Asaas -------------------------------------------------------- */

.asaas-chip {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 4px 10px;
  white-space: nowrap;
}

.asaas-chip.offline {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.45);
}

.asaas-chip.sandbox {
  background: #fef3c7;
  color: #92400e;
}

.asaas-chip.live {
  background: #d1fae5;
  color: #065f46;
}

.asaas-icons {
  align-items: center;
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.asaas-icon-btn {
  align-items: center;
  background: none;
  border: 0;
  border-radius: 6px;
  color: #cbd5e1;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  padding: 4px;
  text-decoration: none;
  transition: color .15s, background .15s;
}

.asaas-icon-btn:hover {
  background: #f1f5f9;
  color: #64748b;
}

.asaas-icon-btn.loading {
  cursor: wait;
  opacity: .5;
}

/* boleto */
.asaas-icon-btn.boleto-none    { color: #cbd5e1; }
.asaas-icon-btn.boleto-emitted { color: #dc2626; }
.asaas-icon-btn.boleto-paid    { color: #1d7651; }

.asaas-icon-btn.cancel-ready { color: #b42318; }
.asaas-icon-btn.cancel-ready:hover {
  background: #fee4e2;
  color: #912018;
}

/* nota */
.asaas-icon-btn.nota-none    { color: #cbd5e1; }
.asaas-icon-btn.nota-emitted { color: #2563eb; }
.asaas-icon-btn.nota-waiting { color: #d97706; }
.asaas-icon-btn.nota-paid    { color: #1d7651; }

/* email */
.asaas-icon-btn.email-ready { color: #64748b; }
.asaas-icon-btn.email-ready:hover { background: #f1f5f9; color: #1e293b; }
.asaas-icon-btn.email-none  { color: #e2e8f0; cursor: not-allowed; }

.asaas-icon-btn.print-ready { color: #0f766e; }
.asaas-icon-btn.print-ready:hover { background: #ecfdf5; color: #115e59; }

/* whatsapp */
.asaas-icon-btn.whatsapp-ready { color: #15803d; }
.asaas-icon-btn.whatsapp-ready:hover { background: #f0fdf4; color: #166534; }
.asaas-icon-btn.whatsapp-none { color: #e2e8f0; cursor: not-allowed; }

.asaas-icon-btn.nota-emitted:hover,
.asaas-icon-btn.nota-waiting:hover {
  background: #eff6ff;
}

.asaas-icon-btn.boleto-emitted:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.asaas-icon-btn.boleto-paid:hover,
.asaas-icon-btn.nota-paid:hover {
  background: #f0fdf4;
}

.asaas-icon-btn.despesa-del { color: #cbd5e1; }
.asaas-icon-btn.despesa-del:hover { background: var(--danger-soft); color: var(--danger); }

@media print {
  .asaas-chip { display: none; }
}

.panel-title-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.row-menu-asaas {
  border-top: 1px solid var(--line);
  color: var(--danger);
}

.row-menu-asaas:hover {
  background: var(--danger-soft);
}

.row-menu-asaas + .row-menu-asaas {
  border-top: none;
  color: var(--ink);
}

.row-menu-asaas + .row-menu-asaas:hover {
  background: var(--surface-2);
}

/* -- Toasts ------------------------------------------------------------------ */

.toast-container {
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  position: fixed;
  right: 24px;
  z-index: 9999;
}

.toast {
  align-items: flex-start;
  border-left: 4px solid transparent;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(15,23,42,.15);
  display: flex;
  font-size: 14px;
  gap: 10px;
  max-width: 380px;
  min-width: 240px;
  padding: 12px 14px;
  pointer-events: auto;
  animation: toast-in .2s ease;
}

.toast-success {
  background: #f0fdf4;
  border-color: #1d7651;
  color: #14532d;
}

.toast-error {
  background: #fff7f6;
  border-color: var(--danger);
  color: #7f1d1d;
}

.toast-info {
  background: #eff6ff;
  border-color: var(--brand);
  color: #1e3a5f;
}

.toast-msg {
  flex: 1;
  line-height: 1.45;
}

.toast-close {
  background: none;
  color: inherit;
  flex-shrink: 0;
  font-size: 12px;
  opacity: .6;
  padding: 0;
}

.toast-close:hover {
  opacity: 1;
}

.toast-out {
  animation: toast-out .3s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(16px); }
}

@media print {
  .toast-container { display: none; }
}

/* ── Modal de conciliação Asaas ──────────────────────────────────── */

.sync-box {
  width: min(1120px, 98vw);
}

.sync-filters {
  align-items: flex-end;
  display: flex;
  gap: 10px;
}

.sync-filters label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 700;
  gap: 4px;
}

.sync-filters input[type="date"] {
  min-height: 38px;
  padding: 6px 10px;
  width: 150px;
}

.primary.compact,
.ghost.compact {
  min-height: 38px;
  padding: 6px 14px;
  white-space: nowrap;
}

.sync-table-wrap {
  max-height: 340px;
  overflow: auto;
}

.sync-table-wrap table {
  min-width: 980px;
}

.sync-check-col {
  text-align: center;
  width: 36px;
}

.sync-row-check {
  cursor: pointer;
}

.sync-edit-input,
.sync-match-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  min-height: 34px;
  padding: 6px 8px;
  width: 100%;
}

.sync-match-select {
  min-width: 220px;
}

.sync-kind-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  justify-content: center;
  min-width: 66px;
  padding: 4px 8px;
}

.sync-kind-pill.income {
  background: #dcfce7;
  color: #166534;
}

.sync-kind-pill.expense {
  background: #fee2e2;
  color: #991b1b;
}
