﻿/* ─── Controle Financeiro — Light Theme ────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f9fc;
  --surface: #ffffff;
  --surface2: #f0f2f7;
  --border: #e2e5ef;
  --accent: #4f46e5;
  --accent-h: #6366f1;
  --accent-light: rgba(79, 70, 229, 0.08);
  --green: #16a34a;
  --green-light: rgba(22, 163, 74, 0.08);
  --red: #dc2626;
  --red-light: rgba(220, 38, 38, 0.08);
  --yellow: #ca8a04;
  --yellow-light: rgba(202, 138, 4, 0.08);
  --text: #1e293b;
  --text2: #475569;
  --muted: #94a3b8;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.08);
}

/* ─── Dark Theme (soft) ────────────────────────────────────────────────────── */

[data-theme="dark"] {
  --bg: #2b2d3e;
  --surface: #353750;
  --surface2: #3e4058;
  --border: #4f5170;
  --accent: #818cf8;
  --accent-h: #a5b4fc;
  --accent-light: rgba(129, 140, 248, 0.15);
  --green: #4ade80;
  --green-light: rgba(74, 222, 128, 0.12);
  --red: #f87171;
  --red-light: rgba(248, 113, 113, 0.12);
  --yellow: #fbbf24;
  --yellow-light: rgba(251, 191, 36, 0.12);
  --text: #f1f5f9;
  --text2: #e2e8f0;
  --muted: #8b92a8;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.15);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.3);
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .overlay-card,
[data-theme="dark"] .summary-year-dropdown {
  background: var(--surface);
  color: var(--text);
}
[data-theme="dark"] .val-in { color: var(--green); }
[data-theme="dark"] .val-out, [data-theme="dark"] .val-expense { color: var(--red); }
[data-theme="dark"] #entries-table tbody tr {
  background: var(--surface);
}
[data-theme="dark"] #entries-table tbody tr:nth-child(even) {
  background: var(--surface2);
}
[data-theme="dark"] #entries-table thead th {
  background: var(--bg);
  color: var(--text2);
}
[data-theme="dark"] .card {
  background: var(--surface);
}
[data-theme="dark"] .slicer-pill {
  background: var(--surface2);
  color: var(--text2);
  border-color: var(--border);
}
[data-theme="dark"] .slicer-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
[data-theme="dark"] .config-pillar-unmapped {
  border-color: #a0762c !important;
  background: #3a3020 !important;
}
[data-theme="dark"] .config-pillar-unmapped .config-pillar-header {
  background: #4a3d28 !important;
  border-bottom-color: #a0762c !important;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ─── Layout Shell ─────────────────────────────────────────────────────────── */

.shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  flex-shrink: 0;
}

header h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.file-status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.file-status.connected { color: var(--green); font-weight: 500; }

.file-row-count {
  font-size: 10px;
  color: var(--muted);
  margin-left: -4px;
}

nav { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text2);
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.nav-btn:hover { color: var(--accent); background: var(--accent-light); }
.nav-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}
.nav-btn:disabled { opacity: .4; cursor: default; }

/* ─── Summary Bar ──────────────────────────────────────────────────────────── */

.summary-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  gap: 28px;
  font-size: 13px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.summary-item { display: flex; gap: 6px; align-items: center; }
.summary-label { color: var(--muted); font-weight: 500; }
.summary-value { font-weight: 700; }
.val-in  { color: var(--green); }
.val-out { color: var(--red); }
.val-bal { color: var(--accent); }

/* ─── Content / Views ──────────────────────────────────────────────────────── */

.content { flex: 1; overflow: hidden; position: relative; }
.view { display: none; height: 100%; overflow-y: auto; padding: 24px 28px; }
.view.active { display: block; }

/* ─── Welcome View ─────────────────────────────────────────────────────────── */

#view-welcome.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}
#view-welcome h2 { font-size: 24px; color: var(--text); font-weight: 700; }
#view-welcome p { color: var(--text2); max-width: 440px; line-height: 1.7; }
.welcome-actions { display: flex; gap: 12px; margin-top: 8px; }
.welcome-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.login-form { flex-direction: column; width: 260px; }
.login-input { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-alt, #fff); font-size: 14px; }
.login-error { color: #c0392b; font-weight: 600; }

/* ─── Dashboard ────────────────────────────────────────────────────────────── */

#view-dashboard.active { display: block; }

/* ─── Cards ────────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
}

/* ─── Form ─────────────────────────────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px 16px;
}
.span2 { grid-column: span 2; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 11px;
  color: var(--text2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}

input, select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
select option { background: var(--surface); }

.radio-group { display: flex; gap: 20px; padding: 6px 0; }
.radio-group label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.radio-group input[type=radio] { width: auto; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  padding: 9px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); box-shadow: var(--shadow); }
.btn-secondary { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: background .15s;
}
.btn-icon:hover { background: var(--surface2); }

/* ─── Filters ──────────────────────────────────────────────────────────────── */

.slicer-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.slicer-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.slicer-pills {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.slicer-pill {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.slicer-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.slicer-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.slicer-search {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  outline: none;
  min-width: 180px;
  transition: border-color .15s;
}
.slicer-search:focus { border-color: var(--accent); }

.result-info { font-size: 12px; color: var(--text2); margin-bottom: 10px; font-weight: 500; }

/* ─── Table ────────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface2); position: sticky; top: 0; z-index: 1; }
th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  color: var(--text2);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: .4px;
}
th:first-child {
  width: 1%;
  white-space: nowrap;
}
th:hover { color: var(--accent); }
th.sort-asc::after { content: ' ↑'; color: var(--accent); }
th.sort-desc::after { content: ' ↓'; color: var(--accent); }
td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
td:first-child {
  white-space: nowrap;
  width: 1%;
  padding-right: 2px;
}
tbody tr:hover { background: var(--accent-light); }
.desc-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.val-income { color: var(--green); font-weight: 700; }
.val-expense { color: var(--red); font-weight: 700; }
.actions-cell { white-space: nowrap; text-align: right; }
.empty-row { text-align: center; color: var(--muted); padding: 40px !important; }

/* ─── Badges ───────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-tipo { background: var(--accent-light); color: var(--accent); }
.badge-user-A { background: var(--green-light); color: var(--green); }
.badge-user-B { background: var(--yellow-light); color: var(--yellow); }

/* ─── Toast ────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: transform .25s, opacity .25s;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { border-color: var(--red); color: var(--red); background: #fff0f0; }
.toast.ok { border-color: var(--green); color: var(--green); background: #f0fff4; }

/* ─── Loading ──────────────────────────────────────────────────────────────── */

#loading {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  z-index: 900;
  gap: 12px;
  font-size: 15px;
  color: var(--accent);
  font-weight: 600;
}
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ─── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  header { padding: 0 14px; gap: 10px; }
  header h1 { font-size: 15px; }
  .view { padding: 16px; }
  .summary-bar { gap: 14px; padding: 8px 14px; }
  nav .nav-btn { padding: 6px 10px; font-size: 12px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: span 1; }
}

/* ─── Autocomplete dropdown ────────────────────────────────────────────────── */

.autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 4px;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.active {
  background: var(--accent-light);
}
.ac-desc { font-size: 13px; color: var(--text); }
.ac-desc strong { color: var(--accent); font-weight: 700; }
.ac-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ─── Parcelas row ─────────────────────────────────────────────────────────── */

.parcelas-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 6px 0;
}
.parcelas-row .radio-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.parcelas-row input[type=radio] { width: auto; accent-color: var(--accent); }
#parcelas-detail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text2);
}
#parcelas-detail input {
  width: 60px;
  text-align: center;
  padding: 6px 8px;
}

.parcelas-hint {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* ─── User prompt overlay ──────────────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 950;
}
.overlay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
}
.overlay-card h2 { font-size: 20px; margin-bottom: 8px; color: var(--text); }
.overlay-card p { font-size: 14px; color: var(--text2); margin-bottom: 24px; }
.user-prompt-buttons { display: flex; gap: 16px; justify-content: center; }
.user-btn { font-size: 16px; padding: 14px 32px; min-width: 120px; }

/* ─── Current user badge ───────────────────────────────────────────────────── */

.user-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
}

/* ─── Parcelas badge in table ──────────────────────────────────────────────── */

.parc-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--surface2);
  color: var(--muted);
  margin-left: 6px;
}

/* ─── Today row highlight ──────────────────────────────────────────────────── */

.row-today {
  background: var(--green-light);
  border-left: 3px solid var(--green);
}
.row-today td:first-child {
  padding-left: 9px;
}

/* ─── Session history (recent adds) ───────────────────────────────────────── */

.session-history-card {
  margin-top: 20px;
  padding: 16px 20px;
}
.session-history-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.session-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 8px;
  font-size: 13px;
}
.session-item-date {
  color: var(--muted);
  font-size: 12px;
  min-width: 80px;
}
.session-item-desc {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}

.session-item-actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── Session new entry indicator ──────────────────────────────────────────── */

.row-session-new {
  background: rgba(22, 163, 74, 0.03);
}
.new-badge {
  font-size: 12px;
  margin-right: 4px;
}

/* ─── Rich tooltip (hover on table rows) ───────────────────────────────────── */

.rich-tooltip {
  display: none;
  position: fixed;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  pointer-events: none;
  max-width: 360px;
  min-width: 220px;
}
.tip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 6px;
}
.tip-desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.tip-valor {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.tip-meta {
  font-size: 11px;
  color: var(--muted);
}
.tip-parcelas {
  font-size: 11px;
  color: var(--text2);
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
}

/* ─── Session action icons ─────────────────────────────────────────────────── */

.session-action-icon {
  font-size: 12px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* ─── Privacy mode (hide monetary values) ──────────────────────────────────── */

.privacy-mode .val-in,
.privacy-mode .val-out,
.privacy-mode .val-bal,
.privacy-mode .val-income,
.privacy-mode .val-expense,
.privacy-mode .summary-value,
.privacy-mode .kpi-value,
.privacy-mode .top-item-value,
.privacy-mode .tip-valor,
.privacy-mode .result-info,
.privacy-mode .result-selection,
.privacy-mode .dash-bar-value,
.privacy-mode .dash-top5-item .val-expense,
.privacy-mode .evo-value {
  filter: blur(8px);
  user-select: none;
  transition: filter .2s;
}
.privacy-mode .val-in:hover,
.privacy-mode .val-out:hover,
.privacy-mode .val-bal:hover,
.privacy-mode .val-income:hover,
.privacy-mode .val-expense:hover,
.privacy-mode .summary-value:hover,
.privacy-mode .kpi-value:hover,
.privacy-mode .top-item-value:hover,
.privacy-mode .tip-valor:hover,
.privacy-mode .result-info:hover,
.privacy-mode .result-selection:hover,
.privacy-mode .dash-bar-value:hover,
.privacy-mode .dash-top5-item:hover .val-expense,
.privacy-mode .evo-value:hover {
  filter: none;
}

.nav-privacy {
  font-size: 16px;
  padding: 5px 10px;
  border: none;
  opacity: 0.6;
}
.nav-privacy:hover { opacity: 1; }
.nav-privacy.active {
  opacity: 1;
  background: var(--accent-light);
  border-radius: 8px;
}

/* ─── Field warning (inline, subtle) ──────────────────────────────────────── */

.field-warning {
  font-size: 11px;
  color: var(--yellow);
  display: inline;
  margin-left: 8px;
  text-transform: none;
}

/* ─── Date cell coloring (today / future / past) ──────────────────────────── */

.date-today {
  background: rgba(22, 163, 74, 0.12);
  font-weight: 600;
  color: var(--green);
}
.date-future {
  background: rgba(255, 235, 59, 0.15);
  color: var(--yellow);
}

/* ─── Link buttons ─────────────────────────────────────────────────────────── */

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 0;
}
.btn-link:hover { text-decoration: underline; }
.more-filters {
  margin-bottom: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

/* ─── Weekday in date column ───────────────────────────────────────────────── */

.weekday {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.th-weekday {
  width: 1%;
  white-space: nowrap;
  padding: 10px 2px 10px 0;
}
.td-weekday {
  text-align: left;
  font-size: 9px;
  color: var(--muted);
  font-weight: 500;
  padding: 9px 6px 9px 0;
  white-space: nowrap;
}
.td-weekday.weekend {
  color: var(--red);
}

.date-past {
  color: var(--muted);
}

/* ─── Dashboard ────────────────────────────────────────────────────────────── */

.dash-kpis {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.dash-kpi {
  flex: 1;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.dash-kpi .kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.dash-kpi .kpi-value {
  font-size: 20px;
  font-weight: 700;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}
.dash-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Bar charts */
.dash-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-bar-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  min-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-bar-track {
  flex: 1;
  height: 10px;
  background: var(--surface2);
  border-radius: 5px;
  overflow: hidden;
}
.dash-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 5px;
  transition: width .3s;
}
.dash-bar-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 100px;
  text-align: right;
  white-space: nowrap;
}
.dash-bar-value small {
  color: var(--muted);
  font-weight: 400;
}

/* Top 5 */
.dash-top5 {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-top5-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 8px;
  font-size: 13px;
}
.dash-top5-desc {
  font-weight: 500;
  color: var(--text);
}

/* Month trend */
.dash-trend {
  padding: 8px 0;
}
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 140px;
  padding: 0 8px;
}
.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
}
.trend-bar {
  width: 100%;
  max-width: 60px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height .3s;
}
.trend-current .trend-bar {
  background: var(--accent);
}
.trend-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
}
.trend-value {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.dash-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

@media (max-width: 800px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-kpis { gap: 10px; }
  .dash-kpi { min-width: 100px; padding: 12px 14px; }
}

/* ─── Dashboard grid left column ───────────────────────────────────────────── */

.dash-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dash-bar-pillar {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-h) 100%);
}

.top5-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}

.tip-details {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tip-detail-line {
  font-size: 11px;
  color: var(--text2);
}

/* ─── Duplicate warning ────────────────────────────────────────────────────── */

.dupe-warning {
  margin-top: 12px;
  padding: 10px 16px;
  background: rgba(202, 138, 4, 0.08);
  border: 1px solid rgba(202, 138, 4, 0.3);
  border-radius: 8px;
  font-size: 13px;
  color: var(--yellow);
}
.dupe-icon {
  margin-right: 4px;
}

/* ─── Duplicate badge ──────────────────────────────────────────────────────── */

.dupe-badge {
  cursor: pointer;
  font-size: 12px;
  margin-left: 4px;
  opacity: 0.8;
  transition: opacity .15s;
}
.dupe-badge:hover {
  opacity: 1;
}

/* ─── Search row with reset button ────────────────────────────────────────── */

.slicer-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

/* ─── Disconnect button ────────────────────────────────────────────────────── */

.btn-disconnect {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--muted);
  transition: all .15s;
}
.btn-disconnect:hover {
  color: var(--red);
  background: var(--red-light);
}

/* ─── Summary year toggle & dropdown ───────────────────────────────────────── */

.summary-year-btn {
  background: var(--accent-light);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
.summary-year-btn:hover {
  background: var(--accent);
  color: #fff;
}

.summary-year-dropdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 8px 10px;
  position: fixed;
  z-index: 1000;
  width: 440px;
}
.year-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
}
.year-table col.col-ano { width: 50px; }
.year-table col.col-val { width: 100px; }
.year-table col.col-num { width: 40px; }
.year-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  text-transform: uppercase;
  white-space: nowrap;
}
.year-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  white-space: nowrap;
}
.year-row {
  transition: background .1s;
}
.year-active {
  background: var(--accent-light);
  font-weight: 600;
}
.year-total {
  background: var(--surface2);
  font-weight: 700;
}
.year-total td {
  border-bottom: none;
}

/* ─── Config panel ─────────────────────────────────────────────────────────── */

.config-hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}
.config-sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.config-section h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.config-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.config-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface2);
  border-radius: 6px;
  font-size: 13px;
}
.config-item-name {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}
.config-item-icon {
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background .15s;
}
.config-item-icon:hover {
  background: var(--border);
}
.config-bank-icon {
  width: 20px;
  min-width: 20px;
  text-align: center;
  line-height: 1;
}
.config-item-count {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.nav-config {
  font-size: 14px;
  padding: 5px 8px;
  opacity: 0.6;
}
.nav-config:hover { opacity: 1; }

/* ─── Security & Export section ────────────────────────────────────────────── */

.config-security {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.config-security h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.config-security-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.encryption-status {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface2);
}
.encryption-status.encrypted {
  color: var(--green);
  background: var(--green-light);
}

/* ─── Password overlay ─────────────────────────────────────────────────────── */

.password-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--surface2);
  color: var(--text);
  margin-bottom: 16px;
  outline: none;
  text-align: center;
  letter-spacing: 2px;
}
.password-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ─── Evolution chart ──────────────────────────────────────────────────────── */

.dash-evolution { padding: 8px 0; }
.evo-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding: 0 4px;
  overflow-x: auto;
}
.evo-col {
  flex: 1;
  min-width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
}
.evo-bar {
  width: 100%;
  max-width: 50px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.evo-seg {
  width: 100%;
  min-height: 2px;
  transition: height .3s;
}
.evo-current .evo-bar {
  box-shadow: 0 0 0 2px var(--accent);
}
.evo-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
}
.evo-value {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}
.evo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.evo-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text2);
}
.evo-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* ─── Save indicator ───────────────────────────────────────────────────────── */

.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.btn-save {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background .15s;
  line-height: 1;
}
.btn-save:hover {
  background: var(--accent-light);
}
.save-timestamp {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}

/* ─── Compact view ─────────────────────────────────────────────────────────── */

.compact-view #entries-table td {
  padding: 6px 10px;
  font-size: 12px;
}
.compact-view #entries-table .td-weekday {
  font-size: 9px;
}
.compact-view #entries-table th {
  padding: 8px 10px;
}
.compact-view .desc-cell {
  max-width: 200px;
}

/* ─── Result row (info + toggle) ───────────────────────────────────────────── */

.result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.result-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: auto;
}

/* ─── PJ toggle on form ────────────────────────────────────────────────────── */

.pj-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: all .15s;
}
.pj-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.pj-toggle input { accent-color: var(--accent); width: auto; }

/* ─── Sticky filters + table header in Lançamentos ────────────────────────── */

#view-list.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#view-list > .card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}
#view-list .table-wrap {
  flex: 1;
  overflow-y: auto;
}

/* ─── Bulk edit toolbar ────────────────────────────────────────────────────── */

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  font-size: 11px;
}
.bulk-select-all {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.bulk-select-all input { accent-color: var(--accent); width: auto; }
.bulk-sep { color: var(--border); }
.bulk-label { color: var(--text2); font-weight: 500; }
.bulk-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  background: var(--surface);
  color: var(--text);
  max-width: 160px;
}

/* ─── Checkbox column ──────────────────────────────────────────────────────── */

.th-check, .td-check {
  width: 30px;
  min-width: 30px;
  text-align: center;
  padding: 6px 4px !important;
  display: none;
}
.bulk-mode .th-check, .bulk-mode .td-check {
  display: table-cell;
}
.th-check input, .td-check input, .row-check {
  width: auto;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ─── Compact form layout (New Entry) ──────────────────────────────────────── */

.form-card {
  padding: 16px 20px;
}
.form-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}
.form-header h2 { margin-bottom: 0; }
.form-type-toggle {
  display: flex;
  gap: 10px;
  font-size: 12px;
  align-items: center;
  flex-shrink: 0;
}
.form-type-toggle label {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.form-type-toggle input[type=radio] { width: auto; accent-color: var(--accent); }

.form-row-1, .form-row-2 {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.form-row-3 {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.form-field label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.form-field input, .form-field select {
  padding: 7px 10px;
  font-size: 12px;
}

/* Specific widths */
.f-data { width: 130px; flex-shrink: 0; }
.f-desc { flex: 1; min-width: 150px; }
.f-valor { width: 100px; flex-shrink: 0; }
.f-forma { width: 145px; flex-shrink: 0; }
.f-parcelas { flex-shrink: 0; min-width: 180px; }

.parcelas-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  min-height: 34px;
}
#parcelas-detail {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 70px;
}
.radio-sm {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.radio-sm input[type=radio] { width: auto; accent-color: var(--accent); }
.parc-detail-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
}
.parc-detail-inline input {
  width: 42px;
  padding: 4px 6px;
  font-size: 11px;
  text-align: center;
}

.form-row-2 .form-field { flex: 1; min-width: 100px; }

.pj-toggle-compact {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
  align-self: flex-end;
  margin-bottom: 1px;
}
.pj-toggle-compact input { width: auto; accent-color: var(--accent); }
.pj-toggle-compact:hover { border-color: var(--accent); }

@media (max-width: 800px) {
  .form-row-1, .form-row-2 { flex-direction: column; align-items: stretch; }
  .f-data, .f-valor, .f-forma { width: 100%; }
}

/* ─── Lançamentos filter lines (compact) ───────────────────────────────────── */

.filter-line-2, .filter-line-3 {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.filter-line-2 .slicer-group, .filter-line-3 .slicer-group { display: flex; flex-direction: column; gap: 4px; }
.filter-line-2 .slicer-pills, .filter-line-3 .slicer-pills { display: flex; gap: 3px; align-items: center; min-height: 30px; }

/* ─── Table column width optimization (shrink-to-fit all except Descrição) ─── */

#entries-table th,
#entries-table td {
  white-space: nowrap;
  width: 1%;
}
#entries-table th[data-col="descricao"],
#entries-table .desc-cell {
  width: auto;
  white-space: normal;
  word-break: break-word;
}
#entries-table .actions-cell {
  width: 1%;
  white-space: nowrap;
}

/* ─── Bank icons inline alignment ──────────────────────────────────────────── */

#entries-table td svg {
  vertical-align: middle;
  margin-right: 3px;
  margin-top: -1px;
}

.pj-badge {
  font-size: 10px;
  margin-right: 2px;
  opacity: 0.7;
}

/* ─── Help page ────────────────────────────────────────────────────────────── */

.nav-help {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  opacity: 0.6;
  border-radius: 50%;
  min-width: 28px;
  text-align: center;
}
.nav-help:hover { opacity: 1; background: var(--accent-light); }

.help-card {
  max-width: 800px;
  margin: 0 auto;
}
.help-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.help-section:last-child { border-bottom: none; }
.help-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}
.help-section ul {
  list-style: none;
  padding: 0;
}
.help-section li {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
  padding-left: 16px;
  position: relative;
  margin-bottom: 4px;
}
.help-section li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
}
.help-section code {
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* ─── PJ Summary card ──────────────────────────────────────────────────────── */

.dash-pj-card {
  background: var(--surface);
  border: 1px solid #0d9488;
  border-radius: var(--radius);
  padding: 12px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  display: inline-flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.dash-pj-title {
  font-size: 12px;
  font-weight: 700;
  color: #0d9488;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.dash-pj-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.dash-pj-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.dash-pj-value {
  font-size: 14px;
  font-weight: 700;
}
.dash-pj-lucro {
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

/* ─── Choice modal ─────────────────────────────────────────────────────────── */

.choice-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
}
.btn-danger:hover {
  background: #b91c1c;
}

/* ─── Config add button ────────────────────────────────────────────────────── */

.btn-add-config {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--accent-light);
  border: 1px dashed var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
}
.btn-add-config:hover {
  background: var(--accent);
  color: #fff;
  border-style: solid;
}

/* ─── Dashboard Config Panel ───────────────────────────────────────────────── */

#config-dashboard-pillars {
  max-height: none;
  overflow-y: visible;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.config-pillar-group {
  margin-bottom: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.config-pillar-group.config-pillar-unmapped {
  border-color: #ffb81c;
  background: #fffbf0;
}
.config-pillar-group.config-pillar-unmapped .config-pillar-header {
  background: #fff3d0;
  border-bottom-color: #ffb81c;
}
.config-pillar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.config-pillar-title {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.config-pillar-title small {
  font-weight: 400;
  color: var(--muted);
}
.config-pillar-color {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  background: none;
}
.config-pillar-cat {
  padding: 5px 12px 5px 12px;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.config-pillar-cat:last-child {
  border-bottom: none;
}
.config-cat-icon {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-size: 14px;
  line-height: 1;
}
.config-cat-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 80px;
}
.config-pillar-select {
  font-size: 11px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  width: 110px;
}
.config-pillar-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Keywords section */
.config-kw-group {
  margin-bottom: 0;
}
.config-kw-header {
  gap: 6px;
}
.config-kw-pillar-name {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.config-kw-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
}
.config-kw-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text);
}
.config-kw-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
}
.config-kw-remove:hover {
  color: var(--red, #e60000);
}
.config-kw-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px dashed var(--accent);
  border-radius: 50%;
  background: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}
.config-kw-add:hover {
  background: var(--accent);
  color: #fff;
}
#config-dashboard-keywords {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

/* Appearance section */
.config-appearance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.config-appearance-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.config-appearance-icon {
  font-size: 18px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background .15s;
}
.config-appearance-icon:hover {
  background: var(--border);
}
.config-appearance-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.config-appearance-color {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  background: none;
}

/* ─── Bank dot fallback ────────────────────────────────────────────────────── */

.bank-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  text-align: center;
  line-height: 14px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  vertical-align: middle;
  margin-right: 3px;
}

/* === Insights Module === */

#view-insights { padding: 24px 28px; }
.ins-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.ins-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.ins-card-header h3 { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }
.ins-card-badge { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; background: var(--surface2); color: var(--text2); white-space: nowrap; margin-left: auto; }

/* Health Score */
.ins-health { padding: 16px 20px; }
.ins-health-score { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ins-health-emoji { font-size: 28px; }
.ins-health-label { font-size: 18px; font-weight: 700; }
.ins-health-rate { font-size: 13px; color: var(--text2); margin-left: auto; }
.ins-health-green .ins-health-label { color: var(--green); }
.ins-health-yellow .ins-health-label { color: var(--yellow); }
.ins-health-red .ins-health-label { color: var(--red); }
.ins-health-detail { display: flex; gap: 20px; font-size: 13px; margin-bottom: 12px; flex-wrap: wrap; }
.ins-health-detail span { display: flex; gap: 6px; align-items: center; }
.ins-health-history { display: flex; gap: 6px; align-items: center; }
.ins-hist-dot { font-size: 14px; }
.ins-hist-label { font-size: 11px; color: var(--muted); margin-left: 8px; }

/* Recommendations */
.ins-rec-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ins-rec-item:last-child { border-bottom: none; }
.ins-rec-icon { font-size: 24px; flex-shrink: 0; }
.ins-rec-content strong { display: block; font-size: 13px; color: var(--text); margin-bottom: 4px; }
.ins-rec-content p { font-size: 12px; color: var(--text2); margin: 0; line-height: 1.5; }

/* Parcelado timeline */
.ins-edp-list { display: flex; flex-direction: column; gap: 8px; }
.ins-edp-item { display: grid; grid-template-columns: 90px 1fr auto auto auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface2); border-radius: 8px; font-size: 12px; }
.ins-edp-date { font-weight: 600; color: var(--accent); }
.ins-edp-desc { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-edp-value { font-weight: 700; color: var(--red); white-space: nowrap; }
.ins-edp-remaining { color: var(--muted); white-space: nowrap; }
.ins-edp-freed { font-weight: 600; color: var(--green); white-space: nowrap; }

/* Subscription Audit */
.ins-subs-split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.ins-subs-col { display: flex; flex-direction: column; gap: 6px; }
.ins-subs-essential-title { font-size: 13px; color: var(--green); font-weight: 600; margin-bottom: 4px; }
.ins-subs-cuttable-title { font-size: 13px; color: var(--yellow); font-weight: 600; margin-bottom: 4px; }
.ins-sub-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-radius: 6px; font-size: 12px; }
.ins-sub-essential { background: var(--green-light); }
.ins-sub-cuttable { background: var(--yellow-light); }
.ins-sub-desc { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.ins-sub-value { font-weight: 700; white-space: nowrap; }
.ins-sub-savings { margin-top: 12px; padding: 10px; background: var(--yellow-light); border-radius: 8px; font-size: 13px; color: var(--yellow); text-align: center; }

/* Category Spikes */
.ins-spike-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--red-light); border-radius: 8px; font-size: 12px; margin-bottom: 6px; }
.ins-spike-icon { font-size: 18px; }
.ins-spike-cat { font-weight: 600; color: var(--text); flex: 1; }
.ins-spike-pct { font-weight: 700; color: var(--red); font-size: 14px; }
.ins-spike-detail { color: var(--text2); white-space: nowrap; }

/* Trajectory Chart */
.ins-traj-chart { display: flex; gap: 4px; align-items: flex-end; height: 160px; padding: 0 4px; }
.ins-traj-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.ins-traj-bars { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.ins-traj-bar { width: 45%; max-width: 20px; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .3s; }
.ins-traj-income { background: var(--green); opacity: 0.7; }
.ins-traj-expense { background: var(--red); opacity: 0.7; }
.ins-traj-label { font-size: 9px; color: var(--muted); font-weight: 500; }
.ins-traj-legend { display: flex; gap: 16px; justify-content: center; margin-top: 12px; font-size: 11px; color: var(--text2); }
.ins-traj-leg-item { display: flex; align-items: center; gap: 5px; }
.ins-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ins-dot-income { background: var(--green); }
.ins-dot-expense { background: var(--red); }

/* PJ Card */
.ins-pj-summary { display: flex; gap: 24px; margin-bottom: 16px; font-size: 13px; flex-wrap: wrap; }
.ins-pj-summary span { display: flex; gap: 6px; align-items: center; }
.ins-pj-chart { display: flex; gap: 4px; align-items: flex-end; height: 120px; padding: 0 4px; }

/* General */
.ins-empty { color: var(--muted); font-size: 13px; padding: 12px 0; }

/* Privacy mode for insights */
.privacy-mode .ins-health-rate,
.privacy-mode .ins-sub-value,
.privacy-mode .ins-edp-value,
.privacy-mode .ins-edp-freed,
.privacy-mode .ins-spike-detail,
.privacy-mode .ins-pj-summary strong,
.privacy-mode .ins-card-badge,
.privacy-mode .ins-rec-content p {
  filter: blur(8px);
  user-select: none;
  transition: filter .2s;
}
.privacy-mode .ins-health-rate:hover,
.privacy-mode .ins-sub-value:hover,
.privacy-mode .ins-edp-value:hover,
.privacy-mode .ins-edp-freed:hover,
.privacy-mode .ins-spike-detail:hover,
.privacy-mode .ins-pj-summary strong:hover,
.privacy-mode .ins-card-badge:hover,
.privacy-mode .ins-rec-content p:hover {
  filter: none;
}

@media (max-width: 800px) {
  .ins-edp-item { grid-template-columns: 1fr; gap: 4px; }
  .ins-subs-split { grid-template-columns: 1fr; }
  .ins-traj-chart, .ins-pj-chart { height: 120px; }
}

/* Insights month navigation */
.ins-month-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.ins-confidence-inline { margin-left: auto; font-size: 11px; color: var(--muted); font-style: italic; }
.ins-month-btn { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px; color: var(--text2); transition: all .15s; }
.ins-month-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.ins-month-label { font-size: 18px; font-weight: 700; color: var(--text); min-width: 80px; text-align: center; }
.ins-month-reset { background: var(--accent-light); border: 1px solid var(--accent); color: var(--accent); border-radius: 8px; padding: 6px 14px; cursor: pointer; font-size: 12px; font-weight: 600; transition: all .15s; }
.ins-month-reset:hover { background: var(--accent); color: #fff; }

/* 3-column recurring costs grid */
.ins-subs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.ins-subs-pj-title { font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.ins-sub-pj { background: var(--accent-light); }

@media (max-width: 800px) {
  .ins-subs-grid { grid-template-columns: 1fr; }
}

/* Insights 2-column top row */
.ins-top-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; align-items: start; }
.ins-left-col { display: flex; flex-direction: column; gap: 12px; }
.ins-right-col { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 900px) { .ins-top-row { grid-template-columns: 1fr; } }

/* Collapsible sections */
.ins-collapsible { cursor: pointer; user-select: none; }
.ins-collapsible:hover { opacity: 0.85; }
.ins-toggle { font-size: 11px; color: var(--muted); flex-shrink: 0; width: 16px; text-align: center; }
.ins-card-body { transition: none; }

/* Compact spacing for nested cards in right column */
.ins-right-col .ins-card { margin-bottom: 0; }
.ins-right-col .ins-recs { padding: 16px 20px; }
.ins-right-col .ins-spikes { padding: 12px 20px; }
.ins-right-col .ins-rec-item { padding: 8px 0; }
.ins-right-col .ins-spike-item { margin-bottom: 4px; }

/* Config panel tabs */
.config-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.config-tab { background: transparent; border: none; padding: 10px 20px; font-size: 13px; font-weight: 600; color: var(--text2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; border-radius: 8px 8px 0 0; }
.config-tab:hover { color: var(--accent); background: var(--accent-light); }
.config-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-light); }
.config-tab-content { display: none; }
.config-tab-content.active { display: block; }

/* Row selection for subtotals */
.row-selected { background: var(--accent-light) !important; border-left: 3px solid var(--accent); position: relative; z-index: 2; box-shadow: 0 2px 8px rgba(79,70,229,.18), 0 4px 16px rgba(79,70,229,.08); transform: scale(1.005); }
.row-selected td:first-child { padding-left: 9px; }
.result-selection { color: var(--accent) !important; font-weight: 700 !important; background: var(--accent-light); padding: 6px 12px; border-radius: 8px; display: inline-block; }
.btn-clear-sel { color: var(--red) !important; font-size: 11px; margin-left: 12px; }

/* Costs avg/actual toggle */
.ins-costs-toggle { font-size: 11px; padding: 4px 10px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--border); color: var(--accent); cursor: pointer; font-weight: 600; transition: all .15s; white-space: nowrap; }
.ins-costs-toggle:hover { background: var(--accent-light); border-color: var(--accent); }
.ins-costs-toggle small { color: var(--muted); font-weight: 400; }
.ins-sub-zero { opacity: 0.4; }

/* Spike drill-down drawer */
.ins-spike-wrap { margin-bottom: 6px; }
.ins-spike-clickable { cursor: pointer; }
.ins-spike-clickable:hover { opacity: 0.9; }
.ins-spike-arrow { font-size: 10px; color: var(--muted); margin-left: 8px; }
.ins-spike-drawer { padding: 8px 12px 8px 40px; background: var(--surface2); border-radius: 0 0 8px 8px; margin-top: -4px; }
.ins-spike-entry { display: flex; gap: 12px; padding: 4px 0; font-size: 12px; border-bottom: 1px solid var(--border); align-items: center; }
.ins-spike-entry:last-child { border-bottom: none; }
.ins-spike-entry-date { color: var(--muted); min-width: 70px; font-size: 11px; }
.ins-spike-entry-desc { flex: 1; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-spike-entry-value { font-weight: 700; color: var(--red); white-space: nowrap; }

/* Help page - card grid layout */
.help-header { text-align: center; margin-bottom: 28px; }
.help-header h2 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.help-subtitle { font-size: 14px; color: var(--muted); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.help-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s; }
.help-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.help-card-icon { font-size: 28px; margin-bottom: 8px; }
.help-card h3 { font-size: 14px; font-weight: 700; color: var(--accent); margin-bottom: 12px; }
.help-card ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.help-card li { font-size: 12px; color: var(--text2); line-height: 1.5; padding-left: 12px; position: relative; }
.help-card li::before { content: "\2022"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.help-card li strong { color: var(--text); font-weight: 600; }
.help-card code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
@media (max-width: 700px) { .help-grid { grid-template-columns: 1fr; } }

/* Dashboard filters revised layout */
.dash-filters-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 26px; box-shadow: 0 4px 12px rgba(0,0,0,.08); position: sticky; top: 0; z-index: 10; outline: 24px solid var(--bg); }
.dash-filter-row-1 { display: flex; gap: 24px; align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.dash-filter-row-2 { display: flex; align-items: center; gap: 8px; }
.dash-filter-row-2 .slicer-label { margin-right: 4px; flex-shrink: 0; }
.dash-fg { display: flex; flex-direction: column; gap: 4px; }
.dash-ano-stack { display: flex; gap: 3px; flex-wrap: wrap; }
.dash-mes-grid { display: grid; grid-template-columns: repeat(6, auto); gap: 3px; }
.dash-pessoa-stack { display: flex; flex-direction: column; gap: 3px; }
.dash-tags-compact { display: flex; gap: 3px; flex-wrap: wrap; max-height: 52px; overflow-x: auto; overflow-y: hidden; }
.dash-pilar-row { display: flex; gap: 3px; flex-wrap: wrap; flex: 1; }
@media (max-width: 800px) { .dash-filter-row-1 { flex-direction: column; gap: 12px; } .dash-mes-grid { grid-template-columns: repeat(4, auto); } }

/* Dashboard KPIs inline (inside filter box, right side) */
.dash-kpis-inline { display: flex; gap: 12px; margin-left: auto; align-items: flex-start; flex-wrap: wrap; }
.dash-kpi-mini { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 100px; }
.dash-kpi-mini .kpi-label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.dash-kpi-mini .kpi-value { font-size: 16px; font-weight: 700; }

/* Sticky dashboard filter box */


/* ─── Lançamentos filter box (dashboard-style) ─────────────────────────────── */

.list-filters-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.list-filter-row-1 {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.list-filter-row-2 {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.list-filter-row-2 .slicer-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.list-filter-row-2 .slicer-search {
  min-width: 200px;
  width: 100%;
  height: 30px;
  padding: 5px 12px;
}
@media (max-width: 800px) {
  .list-filter-row-1 { flex-direction: column; gap: 12px; }
  .list-filter-row-2 { flex-wrap: wrap; }
}


/* ─── Undo button ──────────────────────────────────────────────────────────── */

.btn-undo {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background .15s;
  line-height: 1;
}
.btn-undo:hover {
  background: var(--accent-light);
}


/* ─── Session item undone (strikethrough) ──────────────────────────────────── */

.session-item-undone {
  opacity: 0.5;
  text-decoration: line-through;
}
.session-item-undone .session-item-desc,
.session-item-undone .val-income,
.session-item-undone .val-expense {
  text-decoration: line-through;
}

/* ─── Tag Input & Badges ───────────────────────────────────────────────────── */

.form-row-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.form-row-tags .slicer-label {
  white-space: nowrap;
  font-size: 12px;
}
.tag-input-area {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-height: 30px;
}
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: var(--accent-light, #eef2ff);
  border: 1px solid var(--accent, #6366f1);
  border-radius: 12px;
  font-size: 11px;
  color: var(--accent, #6366f1);
  font-weight: 500;
}
.tag-chip-remove {
  background: none;
  border: none;
  color: var(--accent, #6366f1);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
}
.tag-chip-remove:hover {
  opacity: 1;
  color: var(--red, #e60000);
}
.tag-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px dashed var(--accent, #6366f1);
  border-radius: 50%;
  background: none;
  color: var(--accent, #6366f1);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}
.tag-add-btn:hover {
  background: var(--accent, #6366f1);
  color: #fff;
}
.tag-inline-input {
  width: 100px;
  padding: 3px 6px;
  border: 1px solid var(--accent, #6366f1);
  border-radius: 4px;
  font-size: 11px;
  outline: none;
}
.tag-badge {
  display: inline-block;
  padding: 1px 6px;
  background: var(--accent-light, #eef2ff);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 9px;
  color: var(--accent, #6366f1);
  font-weight: 500;
  vertical-align: middle;
  margin-left: 2px;
}
.tag-icon {
  font-size: 12px;
  cursor: default;
  vertical-align: middle;
  margin-left: 3px;
}

/* ─── Beta badge ───────────────────────────────────────────────────────────── */

.beta-badge {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--accent, #6366f1);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  vertical-align: super;
  letter-spacing: .3px;
}

/* ─── Help About card ──────────────────────────────────────────────────────── */

.help-card-about {
  border-top: 2px solid var(--accent, #6366f1);
}
.help-about-title {
  font-size: 14px;
  margin-bottom: 4px;
}
.help-about-author {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 8px;
}
.help-about-email {
  color: var(--accent, #6366f1);
  text-decoration: none;
  font-size: 11px;
}
.help-about-email:hover {
  text-decoration: underline;
}
.help-about-notice {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.4;
}
.help-about-copy {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}

/* ─── Help Import card ─────────────────────────────────────────────────────── */

.help-card-import {
  border-top: 2px solid var(--green, #00a94f);
}
.help-import-steps {
  font-size: 12px;
  padding-left: 18px;
  margin: 8px 0;
  line-height: 1.6;
}
.help-import-steps li {
  margin-bottom: 8px;
}
.help-prompt-details {
  margin-top: 10px;
}
.help-prompt-details summary {
  font-size: 12px;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}
.help-prompt-box {
  font-size: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  margin-top: 6px;
  white-space: pre-wrap;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
}

/* ─── Theme toggle row ─────────────────────────────────────────────────────── */

.config-theme-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.config-theme-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ─── Filter hint ──────────────────────────────────────────────────────────── */

.filter-hint {
  font-size: 9px;
  color: var(--muted);
  align-self: flex-end;
  white-space: nowrap;
  opacity: 0.7;
}

/* ─── Session item detail ──────────────────────────────────────────────────── */

.session-item-detail {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

/* ─── Muted N/A placeholder ────────────────────────────────────────────────── */
/* ─── Pagamento column ─────────────────────────────────────────────────────── */

.td-pagamento {
  white-space: nowrap;
}

/* ─── Dashboard Detail Split + Donut ───────────────────────────────────────── */

.dash-detail-split {
  display: flex;
  gap: 24px;
}
.dash-detail-left {
  flex: 1;
  min-width: 0;
  max-height: 400px;
  overflow-y: auto;
}
.dash-detail-right {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.donut-chart {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  position: relative;
}
.donut-chart::after {
  content: '';
  position: absolute;
  top: 25%;
  left: 25%;
  width: 50%;
  height: 50%;
  border-radius: 50%;
  background: var(--surface);
}
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text);
}
.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.donut-legend-pct {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
  font-size: 10px;
}

@media (max-width: 800px) {
  .dash-detail-split { flex-direction: column; }
  .dash-detail-right { flex: none; width: 100%; }
}

/* ─── Highlight rules config ───────────────────────────────────────────────── */

#config-highlight-rules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.config-highlight-rule {
  border-left-width: 4px !important;
  border-left-style: solid !important;
}

/* ─── Color slicer pills ───────────────────────────────────────────────────── */

.slicer-pill-color {
  border-left-width: 3px !important;
  border-left-style: solid !important;
  padding-left: 8px;
}

/* ─── New feature additions: confidence indicator, forecast, review queue, ───── */
/* ─── installment burden total, per-person comparison, backup indicator ──────── */

.ins-confidence {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: -8px 0 16px;
  padding: 4px 10px;
  border-radius: 6px;
}
.ins-conf-low { color: var(--red); }
.ins-conf-ok { color: var(--muted); }
.ins-conf-good { color: var(--green); }

.ins-forecast { text-align: center; }
.ins-forecast-total { font-size: 32px; font-weight: 800; color: var(--text); margin: 4px 0 10px; }
.ins-forecast-breakdown { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; font-size: 13px; color: var(--text2); margin-bottom: 8px; }
.ins-forecast-breakdown strong { color: var(--text); }
.ins-forecast-note { font-size: 11px; color: var(--muted); margin: 8px 0 0; }

.ins-edp-committed { font-size: 13px; color: var(--text2); margin: 0 0 12px; padding: 8px 12px; background: var(--surface2); border-radius: 8px; }
.ins-edp-committed strong { color: var(--text); }

.ins-review-hint { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.ins-review-list { display: flex; flex-direction: column; gap: 6px; }
.ins-review-item {
  display: grid;
  grid-template-columns: 90px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.ins-review-item:hover { background: var(--accent-light); }
.ins-review-desc { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-review-cat { color: var(--muted); white-space: nowrap; }
.ins-review-cat em { font-style: normal; color: var(--red); }
.ins-review-value { font-weight: 700; white-space: nowrap; }
.ins-review-more { font-size: 11px; color: var(--muted); margin: 10px 0 0; }

.dash-person-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.dash-person-compare-col h4 { font-size: 13px; margin: 0 0 10px; }
.dash-person-compare-total { font-size: 12px; color: var(--muted); margin-left: 6px; font-weight: 500; }

.backup-indicator { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.backup-indicator.backup-stale { color: var(--red); }

.privacy-mode .ins-forecast-total,
.privacy-mode .ins-forecast-breakdown strong,
.privacy-mode .ins-edp-committed strong,
.privacy-mode .ins-review-value {
  filter: blur(8px);
  user-select: none;
  transition: filter .2s;
}
.privacy-mode .ins-forecast-total:hover,
.privacy-mode .ins-forecast-breakdown strong:hover,
.privacy-mode .ins-edp-committed strong:hover,
.privacy-mode .ins-review-value:hover {
  filter: none;
}


/* ─── Investimento Panel ────────────────────────────────────────────────────── */

/* Nav button label (hidden at rest, shown on hover) */
.nav-investimento .nav-btn-label { display: none; }
.nav-investimento:hover .nav-btn-label { display: inline; }

/* KPI row */
.inv-kpis {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.inv-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
  box-shadow: var(--shadow);
}
.inv-kpi .kpi-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.inv-kpi .kpi-value {
  font-size: 20px;
  font-weight: 700;
}

/* Action buttons */
.inv-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

/* Inline forms */
.inv-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.inv-form h3 {
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.inv-form-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.inv-form-fields > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inv-form-fields label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.inv-form-fields input,
.inv-form-fields select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  min-width: 130px;
}
.inv-form-fields input:focus,
.inv-form-fields select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.inv-form-actions {
  display: flex;
  gap: 8px;
}

/* History table */
.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.inv-table thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.inv-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.inv-table tbody tr:hover { background: var(--accent-light); }
.inv-table tbody tr:last-child td { border-bottom: none; }

/* Type badges */
.inv-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.inv-aporte {
  background: var(--red-light);
  color: var(--red);
}
.inv-resgate {
  background: var(--green-light);
  color: var(--green);
}

/* Locked Investimento rows in Lançamentos table */
.row-investimento td { opacity: 0.82; }
.row-investimento .actions-cell {
  color: var(--muted);
  font-size: 12px;
}

/* Privacy mode — blur investimento KPIs too */
.privacy-mode .inv-kpi .kpi-value {
  filter: blur(8px);
  user-select: none;
  transition: filter .2s;
}
.privacy-mode .inv-kpi .kpi-value:hover { filter: none; }

/* ─── Investimento — Safe-to-invest card ────────────────────────────────────── */

.inv-safe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.inv-safe-header {
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  letter-spacing: .03em;
}

.inv-safe-body {
  padding: 10px 14px 10px;
}

.inv-safe-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
}

.inv-safe-label {
  color: var(--text2);
}

.inv-safe-value {
  font-weight: 600;
  font-size: 12px;
}

.inv-safe-deduct .inv-safe-label {
  color: var(--muted);
  font-size: 11px;
}

.inv-safe-deduct .inv-safe-value {
  font-size: 11px;
  font-weight: 500;
}

.inv-safe-divider {
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.inv-safe-result {
  padding: 4px 0;
}

.inv-safe-margem {
  font-size: 15px;
  font-weight: 700;
}

.inv-safe-positive .inv-safe-margem { color: var(--green); }
.inv-safe-negative .inv-safe-margem { color: var(--red); }

.inv-safe-msg {
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}

.inv-safe-msg strong { color: var(--green); }

.inv-safe-negative .inv-safe-msg strong { color: var(--red); }

.inv-safe-footnote {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 8px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  font-size: 9px;
  color: var(--muted);
}

.inv-safe-footnote span {
  cursor: default;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Privacy mode */
.privacy-mode .inv-safe-card .inv-safe-value,
.privacy-mode .inv-safe-card .inv-safe-margem {
  filter: blur(8px);
  user-select: none;
  transition: filter .2s;
}
.privacy-mode .inv-safe-card .inv-safe-value:hover,
.privacy-mode .inv-safe-card .inv-safe-margem:hover {
  filter: none;
}

/* ─── Investimento — top row (KPIs + safe card side by side) ────────────────── */

.inv-top-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* Column 1: Pool Total */
.inv-kpi-pool {
  flex-shrink: 0;
  min-width: 120px;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 12px 14px;
}

.inv-kpi-pool .kpi-label {
  font-size: 9px;
}

.inv-kpi-pool .kpi-value {
  font-size: 18px;
  flex: 1;
  display: flex;
  align-items: center;
}

/* Column 2: Aportado + Resgatado stacked */
.inv-kpi-stack {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inv-kpi-stack .inv-kpi {
  flex: 1;
  min-width: 130px;
  max-width: 155px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.inv-kpi-stack .inv-kpi .kpi-label {
  font-size: 9px;
}

.inv-kpi-stack .inv-kpi .kpi-value {
  font-size: 15px;
  flex: 1;
  display: flex;
  align-items: center;
}

/* Column 3: Safe card — fixed reasonable width */
.inv-top-row .inv-safe-card {
  flex: 0 0 300px;
  min-width: 260px;
  margin-bottom: 0;
}

/* Column 4: Chart card — takes all remaining space */
.inv-chart-card {
  flex: 1;
  min-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─── Investimento — chart card (col 4 of top row) ─────────────────────────── */

.inv-chart-card {
  flex: 1;
  min-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.inv-chart-header {
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  letter-spacing: .03em;
}

.inv-chart-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.inv-chart-panel {
  flex: 1;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.inv-chart-divider {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
  margin: 8px 0;
}

.inv-chart-title {
  font-size: 13px;       /* matches .inv-safe-label row size */
  font-weight: 700;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.inv-chart-rate {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  margin-left: auto;
}

.inv-chart-empty {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

/* Evolution bar chart */
.inv-evo-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 80px;
  flex: 1;
}

.inv-evo-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.inv-evo-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.inv-evo-bar {
  width: 100%;
  background: var(--accent);
  opacity: 0.55;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height .3s ease;
}

.inv-evo-bar-current {
  opacity: 1;
  background: var(--accent-h);
}

.inv-evo-label {
  font-size: 9px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
}

.inv-evo-delta {
  font-size: 10px;
  font-weight: 600;
  margin-top: 4px;
}

/* Discipline bars */
.inv-disc-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Each month block: label + bars side by side */
.inv-disc-month {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.inv-disc-label {
  font-size: 9px;
  color: var(--muted);
  font-weight: 700;
  width: 32px;
  flex-shrink: 0;
  text-align: left;
  /* vertically centered by parent align-items:center */
}

/* Column of bar lines (stacked vertically) */
.inv-disc-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

/* Each bar line: track + value */
.inv-disc-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Track is the full-width container — bar width % is relative to this */
.inv-disc-track {
  flex: 1;
  min-width: 0;
  height: 9px;
  background: transparent;
  border-radius: 3px;
  overflow: hidden;
}

.inv-disc-bar {
  height: 100%;
  border-radius: 3px;
  /* width set inline as percentage of maxMove */
}

.inv-disc-aporte  { background: var(--red);   opacity: 0.75; }
.inv-disc-resgate { background: var(--green);  opacity: 0.75; }

.inv-disc-val {
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 96px;
  text-align: right;
}

/* Empty month row */
.inv-disc-row.inv-disc-empty {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 6px;
}

.inv-disc-none {
  font-size: 9px;
  color: var(--muted);
  font-style: italic;
}
