/* ============================================================
   AUGEE FINANCE — Design System v2
   Premium Financial Dashboard
   ============================================================ */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root {
  /* Sidebar — sempre escura, independente do tema */
  --sidebar-bg: #0C0908;
  --sidebar-ink: rgba(255, 255, 255, 0.88);
  --sidebar-muted: rgba(255, 255, 255, 0.72);
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(201, 168, 76, 0.14);
  --sidebar-active-ink: #E2BC68;

  /* Tema padrão: Areia */
  --accent: #8B6226;
  --accent-strong: #5A3A10;
  --accent-light: rgba(139, 98, 38, 0.10);
  --bg: #F8F6F1;
  --panel: #FFFFFF;
  --soft: #F1EBE0;
  --ink: #1C1410;
  --muted: #7A6D62;
  --line: #EAE3D6;
  --line-strong: #D4C8B6;

  /* Semântico */
  --green: #186A42;
  --green-bg: #EFF8F3;
  --red: #B02A1A;
  --red-bg: #FEF2F0;
  --amber: #8A6008;
  --amber-bg: #FEF8EC;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 2px 10px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.09), 0 2px 6px rgba(0, 0, 0, 0.05);

  /* Animações */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 180ms;
}

/* Tema Azul */
body[data-theme="blue"] {
  --accent: #2A63A8;
  --accent-strong: #1A4A82;
  --accent-light: rgba(42, 99, 168, 0.10);
  --bg: #F4F8FD;
  --panel: #FFFFFF;
  --soft: #E8F0FA;
  --ink: #0F1E35;
  --muted: #4A6480;
  --line: #D5E5F5;
  --line-strong: #B8D0EC;
  --sidebar-active-bg: rgba(42, 99, 168, 0.15);
  --sidebar-active-ink: #7ABAFF;
}

/* Tema Rosa */
body[data-theme="rose"] {
  --accent: #B04470;
  --accent-strong: #762D4A;
  --accent-light: rgba(176, 68, 112, 0.10);
  --bg: #FDF6FA;
  --panel: #FFFFFF;
  --soft: #F7E8F2;
  --ink: #2A1020;
  --muted: #8A5068;
  --line: #ECCFDF;
  --line-strong: #E0B0CC;
  --sidebar-active-bg: rgba(176, 68, 112, 0.14);
  --sidebar-active-ink: #F5A8CC;
}

/* Tema Verde */
body[data-theme="green"] {
  --accent: #0D6B62;
  --accent-strong: #094A44;
  --accent-light: rgba(13, 107, 98, 0.10);
  --bg: #F2FAF7;
  --panel: #FFFFFF;
  --soft: #DFF0EB;
  --ink: #0A2826;
  --muted: #3A7068;
  --line: #BBDFDA;
  --line-strong: #98D0C8;
  --sidebar-active-bg: rgba(13, 107, 98, 0.14);
  --sidebar-active-ink: #6DD4C8;
}

/* Tema Escuro */
body[data-theme="dark"] {
  --accent: #C9A84C;
  --accent-strong: #E8C97A;
  --accent-light: rgba(201, 168, 76, 0.12);
  --bg: #0F0D0A;
  --panel: #1C1812;
  --soft: #241F18;
  --ink: #F0E8DC;
  --muted: #9A8C7A;
  --line: #302A1E;
  --line-strong: #3E3628;
  --sidebar-bg: #080604;
  --sidebar-active-bg: rgba(201, 168, 76, 0.14);
  --sidebar-active-ink: #E8C97A;
}

/* ============================================================
   BASE
   ============================================================ */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Sora', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Números tabulares para valores financeiros */
.metric strong,
.amount,
.focus-card strong,
.budget-values b,
.report-card strong,
.dre-line strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

h2, h3 { margin: 0; }
h2 { font-size: 1rem; font-weight: 700; letter-spacing: -0.015em; }
h3 { font-size: 0.88rem; font-weight: 600; }

/* ============================================================
   LAYOUT
   ============================================================ */

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

/* ============================================================
   TOAST
   ============================================================ */

.toast {
  background: var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  color: white;
  font-size: 0.83rem;
  font-weight: 600;
  left: 50%;
  max-width: min(520px, calc(100vw - 32px));
  opacity: 0;
  padding: 12px 18px;
  pointer-events: none;
  position: fixed;
  top: 20px;
  transform: translate(-50%, -16px);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
  z-index: 100;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: #1C1410; }

/* ============================================================
   SIDEBAR
   ============================================================ */

.topbar {
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
}

/* Logo */
.brand {
  border-bottom: 1px solid var(--sidebar-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 12px 12px;
}

.brand-logo {
  display: block;
  height: auto;
  max-height: 44px;
  max-width: 148px;
  mix-blend-mode: screen;
  object-fit: contain;
  object-position: left center;
  opacity: 0.95;
  width: 100%;
}

.brand-copy { display: none; }

.brand h1 {
  color: rgba(255, 255, 255, 0.90);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 0;
  text-transform: uppercase;
}

.brand .eyebrow {
  color: var(--sidebar-muted);
  font-size: 0.63rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0;
}

/* Nav */
.tabs {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
  overflow-y: auto;
  padding: 8px 6px;
}

.tab {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--sidebar-muted);
  display: flex;
  font-size: 0.78rem;
  font-weight: 500;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.tab:hover {
  background: var(--sidebar-hover);
  color: rgba(255, 255, 255, 0.72);
}

.tab.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-ink);
  font-weight: 700;
}

.tab-icon {
  font-size: 0.9rem;
  opacity: 0.8;
  width: 16px;
  text-align: center;
}

/* Ações do sidebar */
.top-actions {
  border-top: 1px solid var(--sidebar-line);
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 8px 6px;
}

.top-actions select {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.80);
  font-size: 0.74rem;
  min-height: 34px;
  padding: 6px 8px;
}

.top-actions select option {
  background: #1a1410;
  color: white;
}

.icon-button {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.72rem;
  font-weight: 500;
  min-height: 34px;
  padding: 0 10px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.90);
}

/* ============================================================
   MAIN / SHELL
   ============================================================ */

.shell {
  max-width: 1800px;
  padding: 32px clamp(16px, 3.5vw, 48px);
  width: 100%;
}

/* Page heading */
.page-heading {
  align-items: flex-end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-heading h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0;
}

.page-heading p, .page-heading > div > p {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 4px 0 0;
}

.heading-actions {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.heading-actions label {
  color: var(--muted);
  display: grid;
  font-size: 0.70rem;
  font-weight: 700;
  gap: 5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ============================================================
   SUMMARY METRICS
   ============================================================ */

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  min-height: 114px;
  padding: 18px 20px;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.metric:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.05;
}

.metric.emphasis strong { color: var(--green); }
.metric.warning strong { color: var(--amber); }

/* ============================================================
   WORKSPACE / PANELS
   ============================================================ */

.workspace {
  background: transparent;
  border: 0;
  overflow: visible;
}

.panel { display: none; }
.panel.active { display: block; }

.panel-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */

.money-board {
  display: grid;
  gap: 14px;
  grid-template-columns: 0.82fr 1.18fr;
}

/* Focus card */
.focus-card {
  background: linear-gradient(145deg, var(--accent-strong) 0%, var(--accent) 100%);
  border-radius: 12px;
  color: white;
  display: grid;
  gap: 10px;
  overflow: hidden;
  padding: 28px;
  position: relative;
}

.focus-card::before {
  background: radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.10) 0%, transparent 60%);
  content: '';
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.focus-card::after {
  background: radial-gradient(circle at 20% 90%, rgba(0, 0, 0, 0.15) 0%, transparent 50%);
  content: '';
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.card-kicker {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  position: relative;
  text-transform: uppercase;
}

.focus-card strong {
  color: white;
  font-size: clamp(1.9rem, 4vw, 3.4rem);
  font-weight: 800;
  line-height: 1;
  position: relative;
}

.focus-card p {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.76rem;
  margin: 0;
  position: relative;
}

.progress {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  height: 4px;
  margin-top: 4px;
  overflow: hidden;
  position: relative;
}

.progress span {
  background: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  display: block;
  height: 100%;
  transition: width 600ms var(--ease);
}

/* Surface cards */
.surface {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.surface.wide { grid-column: 1 / -1; }

.note, .dropzone {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}

.section-title {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title h2 {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-title span {
  color: var(--muted);
  font-size: 0.74rem;
}

/* ============================================================
   STACK / ROWS
   ============================================================ */

.stack, .assistant-log {
  display: grid;
  gap: 8px;
}

.stack { margin-top: 0; }
.compact { gap: 6px; }

.row {
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 56px;
  padding: 12px 16px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}

.row > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.row strong {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
}

.row small {
  color: var(--muted);
  display: block;
  font-size: 0.74rem;
  line-height: 1.35;
}

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

.soft-row {
  background: var(--soft);
}

.eyebrow, .hint, .metric span, .row small {
  color: var(--muted);
}

/* Valores */
.amount {
  font-size: 0.90rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.amount.income { color: var(--green); }
.amount.expense { color: var(--red); }
.metric.emphasis strong { color: var(--green); }

/* ============================================================
   MINI GRID (3 meses)
   ============================================================ */

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

/* ============================================================
   BUDGET GRID
   ============================================================ */

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

.budget-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  padding: 14px;
  transition: box-shadow var(--dur) var(--ease);
}

.budget-card:hover { box-shadow: var(--shadow-sm); }

.budget-card > div:first-child {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
}

.budget-card span, .budget-card small {
  color: var(--muted);
  font-size: 0.76rem;
}

.budget-values {
  align-items: baseline;
  display: flex;
  gap: 6px;
}

.budget-values b {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Category badge */
.category-badge {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  min-width: 0;
}

.category-badge span {
  align-items: center;
  background: color-mix(in srgb, var(--cat-color) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--cat-color) 28%, transparent);
  border-radius: 6px;
  color: var(--cat-color);
  display: inline-flex;
  font-size: 0.80rem;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  width: 26px;
}

/* ============================================================
   ANNUAL FORECAST
   ============================================================ */

.annual-insight {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding: 16px;
}

.annual-insight strong { font-size: 1rem; font-weight: 700; }

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

.month-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  transition: box-shadow var(--dur) var(--ease);
}

.month-card:hover { box-shadow: var(--shadow-sm); }

.month-card.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.month-card strong { font-size: 0.80rem; font-weight: 700; line-height: 1.2; }
.month-card small { color: var(--muted); font-size: 0.70rem; line-height: 1.3; }

/* ============================================================
   LIFE GRID / GOALS
   ============================================================ */

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

.decision-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  padding: 16px;
}

.decision-card strong {
  font-size: 0.88rem;
  font-weight: 700;
}

.decision-card span {
  background: var(--soft);
  border-radius: 8px;
  font-size: 0.80rem;
  padding: 10px 12px;
}

/* ============================================================
   MODULE GRID
   ============================================================ */

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

.module-card {
  background: color-mix(in srgb, var(--panel) 70%, var(--soft));
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 14px;
  transition: box-shadow var(--dur) var(--ease);
}

.module-card:hover { box-shadow: var(--shadow-sm); }

.module-card > span, .inline-icon {
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  display: inline-flex;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.module-card strong { font-size: 0.83rem; font-weight: 700; }
.module-card small { color: var(--muted); font-size: 0.73rem; line-height: 1.35; }

/* ============================================================
   PLANNING PANEL
   ============================================================ */

.planning-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.planning-snapshot {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ============================================================
   DRE TABLE
   ============================================================ */

.dre-table {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.dre-line {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) 110px 170px;
  min-height: 50px;
  padding: 0 18px;
  transition: background var(--dur) var(--ease);
}

.dre-line + .dre-line { border-top: 1px solid var(--line); }

.dre-line:not(.header):not(.total):hover { background: var(--soft); }

.dre-line strong, .dre-line span { font-size: 0.83rem; }

.dre-line.header, .dre-line.total {
  background: var(--soft);
  font-weight: 700;
}

.dre-line .percent, .dre-line .value { text-align: right; }

/* ============================================================
   FORMS & INPUTS
   ============================================================ */

input, select, textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 12px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
}

textarea {
  min-height: 160px;
  resize: vertical;
  width: 100%;
}

.chat-form input { width: 100%; }

/* ============================================================
   BUTTONS
   ============================================================ */

button[type="submit"],
#importInvoice {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: white;
  font-weight: 600;
  min-height: 42px;
  padding: 0 18px;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  white-space: nowrap;
}

button[type="submit"]:hover,
#importInvoice:hover {
  background: var(--accent-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.secondary-button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 500;
  min-height: 40px;
  padding: 0 14px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.secondary-button:hover {
  background: var(--soft);
  border-color: var(--line-strong);
}

.small-button {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: white;
  font-size: 0.74rem;
  font-weight: 600;
  min-height: 28px;
  padding: 0 10px;
  transition: background var(--dur) var(--ease);
}

.small-button:hover { background: var(--accent-strong); }

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  min-height: 28px;
  padding: 0 10px;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.ghost-button:hover {
  background: var(--soft);
  border-color: var(--line-strong);
  color: var(--ink);
}

.danger-button {
  background: var(--red-bg);
  border: 1px solid color-mix(in srgb, var(--red) 28%, transparent);
  border-radius: 8px;
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 500;
  min-height: 42px;
  padding: 0 16px;
  transition: background var(--dur) var(--ease);
}

.danger-button:hover { background: color-mix(in srgb, var(--red) 10%, white); }

/* ============================================================
   FORM GRIDS
   ============================================================ */

.chat-form, .actions { display: flex; gap: 8px; }

.form-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1.4fr 0.7fr 0.8fr 0.7fr auto;
  margin-bottom: 16px;
}

.transaction-grid {
  grid-template-columns: 1.4fr 0.55fr 0.7fr 0.55fr 0.6fr 0.75fr auto;
}

.installment-grid {
  grid-template-columns: 1.4fr 0.7fr 0.55fr 0.7fr 0.8fr auto;
}

.planning-form {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1.2fr) minmax(110px, 0.5fr) minmax(110px, 0.5fr) auto;
  margin: 12px 0;
}

.settings-form {
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
}

.settings-form label {
  color: var(--muted);
  display: grid;
  font-size: 0.78rem;
  font-weight: 600;
  gap: 6px;
}

/* ============================================================
   IMPORT / INVOICE
   ============================================================ */

.dropzone {
  cursor: pointer;
  display: grid;
  gap: 5px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.dropzone:hover {
  background: var(--soft);
  border-color: var(--accent);
}

.dropzone input { display: none; }
.dropzone span { color: var(--muted); font-size: 0.80rem; }

.import-card {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 300px;
  margin-bottom: 14px;
}

.import-summary {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 5px;
  padding: 14px 16px;
}

.import-summary span, .field-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.invoice-history-title { margin-top: 20px; }

.invoice-items { display: grid; gap: 6px; margin-top: 10px; }

.invoice-item {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  min-height: 40px;
  padding: 7px 10px;
}

.invoice-item span {
  background: var(--soft);
  border-radius: 5px;
  color: var(--accent);
  font-size: 0.70rem;
  font-weight: 700;
  padding: 3px 6px;
  text-align: center;
}

.invoice-item strong, .invoice-item small {
  font-size: 0.80rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-item { grid-template-columns: 88px minmax(0, 1fr) auto; }

.sticky-actions {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(8px);
  bottom: 0;
  padding: 10px 0 0;
  position: sticky;
}

.invoice-total-row {
  align-items: flex-end;
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.invoice-total-row input { max-width: 220px; }

/* ============================================================
   REPORT
   ============================================================ */

.report-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr)) 1.4fr;
  margin-bottom: 16px;
}

.report-card {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 14px 16px;
}

.report-card span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.report-card strong {
  font-size: clamp(1.1rem, 1.8vw, 1.75rem);
  font-weight: 800;
}

.audit-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
}

.audit-row p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  margin: 4px 0 0;
}

.audit-action {
  background: var(--accent);
  border-radius: 5px;
  color: white;
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  margin-right: 8px;
  padding: 3px 7px;
  vertical-align: middle;
}

/* ============================================================
   CARD CHIP (cartões)
   ============================================================ */

.card-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.card-chip > div:first-child {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.card-chip small, .card-chip span { color: var(--muted); font-size: 0.76rem; }

/* ============================================================
   RESPONSIVO
   ============================================================ */

@media (max-width: 1180px) {
  .app-frame { grid-template-columns: 1fr; }

  .topbar {
    min-height: auto;
    overflow-y: visible;
    position: static;
  }

  .brand {
    align-items: center;
    flex-direction: row;
    padding: 14px 18px;
  }

  .brand-logo { max-height: 36px; max-width: 120px; }

  .tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px 10px;
  }

  .tab {
    border: 1px solid var(--sidebar-line);
    font-size: 0.76rem;
    min-height: 34px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .tab-icon { display: none; }

  .top-actions {
    display: flex;
    flex-direction: row;
    margin-top: 0;
    padding: 8px 10px 10px;
  }

  .shell { padding-top: 24px; }
}

@media (max-width: 920px) {
  .summary-grid,
  .report-summary,
  .money-board,
  .form-grid,
  .transaction-grid,
  .installment-grid,
  .planning-layout,
  .planning-form,
  .planning-snapshot,
  .mini-grid,
  .import-card,
  .budget-grid,
  .life-grid,
  .module-grid,
  .annual-grid {
    grid-template-columns: 1fr;
  }

  .page-heading,
  .heading-actions,
  .panel-header,
  .chat-form,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metric { min-height: 96px; }

  .row {
    align-items: stretch;
    flex-direction: column;
  }

  .row-actions { justify-content: flex-start; }

  .dre-line {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .dre-line .percent,
  .dre-line .value { text-align: left; }
}

/* ============================================================
   MERCHANT GROUPING
   ============================================================ */

.txn-view-toggle {
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
}

.toggle-opt {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  min-height: 32px;
  padding: 0 14px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.toggle-opt.active {
  background: var(--panel);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
}

.merchant-group-row {
  border-left: 3px solid var(--accent);
}

.merchant-sub-items {
  border: 1px solid var(--line);
  border-radius: 10px;
  display: none;
  gap: 0;
  margin-top: -6px;
  overflow: hidden;
}

.merchant-sub-items.open { display: grid; }

.merchant-sub-item {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 10px 14px 10px 20px;
}

.merchant-sub-item:first-child { border-top: 0; }

.merchant-sub-item strong { font-size: 0.82rem; font-weight: 500; }
.merchant-sub-item small { color: var(--muted); font-size: 0.72rem; }

/* ============================================================
   PAGE HEADING REFINEMENTS
   ============================================================ */

.page-heading {
  margin-bottom: 20px;
}

/* Melhor seletor de mês */
.heading-actions select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.80rem;
  font-weight: 600;
  min-height: 38px;
  padding: 0 10px;
}

/* ============================================================
   SURFACE CARD REFINEMENTS
   ============================================================ */

/* Fundo levemente alternado nas seções wide */
.surface.wide {
  background: var(--panel);
}

/* Separador entre seções do dashboard */
.money-board > .surface + .surface,
.money-board > .surface.wide + .surface.wide {
  margin-top: 0;
}

/* Note card no dashboard */
.note {
  display: grid;
  gap: 4px;
}

.note strong { font-size: 0.88rem; font-weight: 700; }
.note span, .note small { color: var(--muted); font-size: 0.78rem; }

/* ============================================================
   FOCUS CARD — versão negativa em vermelho
   ============================================================ */

.focus-card.negative {
  background: linear-gradient(145deg, #6B1A0F 0%, #B02A1A 100%);
}

/* ============================================================
   METRIC LABEL — uppercase com mais respiro
   ============================================================ */

.metric span {
  margin-bottom: 14px;
}

/* Saldo negativo em vermelho */
.metric.emphasis strong.negative { color: var(--red); }

/* ============================================================
   INVESTIMENTOS
   ============================================================ */

.investment-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 1.6fr 0.7fr 0.7fr 0.8fr auto;
  margin-bottom: 16px;
}

.inv-type-badge {
  border-radius: 5px;
  font-size: 0.70rem;
  font-weight: 700;
  padding: 3px 8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.inv-type-badge.renda_fixa   { background: #EFF8F3; color: #186A42; }
.inv-type-badge.acoes        { background: #EEF2FF; color: #3730A3; }
.inv-type-badge.fii          { background: #FFF7ED; color: #9A4A00; }
.inv-type-badge.criptomoeda  { background: #FEF3C7; color: #92400E; }
.inv-type-badge.poupanca     { background: #F0FDF4; color: #14532D; }
.inv-type-badge.outro        { background: var(--soft); color: var(--muted); }

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

/* ============================================================
   COFRINHO — depósito rápido no goalSnapshot
   ============================================================ */

.goal-quick-row {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.goal-quick-row input {
  flex: 1;
  min-height: 34px;
  padding: 6px 10px;
}

.goal-quick-row select {
  flex: 1.2;
  min-height: 34px;
  padding: 6px 10px;
}

.goal-quick-row button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.78rem;
  white-space: nowrap;
}

/* ============================================================
   MAPA FINANCEIRO (ex-Notion modules)
   ============================================================ */

.map-module {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  min-height: 60px;
  padding: 12px 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.map-module:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.map-module-icon {
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  display: flex;
  font-size: 1rem;
  height: 36px;
  justify-content: center;
  min-width: 36px;
}

.map-module div { display: grid; gap: 2px; min-width: 0; }
.map-module strong { font-size: 0.82rem; font-weight: 700; }
.map-module small { color: var(--muted); font-size: 0.72rem; }

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

/* Danger text helper */
.danger-text { color: var(--red); }
.danger-text:hover { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 28%, transparent); color: var(--red); }

/* FII badge — renegociado */
.inv-type-badge.fii { background: #FFF7ED; color: #9A4A00; }

/* ============================================================
   v2 ADDITIONS — Alerts, Sub-tabs, Bills, Balances, Patrimony
   ============================================================ */

/* 5th metric card (patrimônio) */
.summary-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric.info strong { color: var(--accent); }

/* Alert surface */
.alert-surface { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; }

.alert-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 0;
  padding: 0;
}

.atab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  flex: 1;
  font-size: 0.72rem;
  font-weight: 600;
  min-height: 40px;
  padding: 0 6px;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.atab.active {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

#alertList { padding: 10px; }

.alert-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 12px;
  transition: box-shadow var(--dur) var(--ease);
}

.alert-row.overdue { border-left: 3px solid var(--red); }
.alert-row.today { border-left: 3px solid var(--amber); }
.alert-row.week { border-left: 3px solid #B8A020; }
.alert-row.receivable { border-left: 3px solid var(--green); }

.alert-row strong { font-size: 0.82rem; font-weight: 600; }
.alert-row small { color: var(--muted); font-size: 0.72rem; }

/* Sub-tabs (inside panel) */
.sub-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  margin-bottom: 2px;
  padding-bottom: 0;
}

.stab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.80rem;
  font-weight: 600;
  min-height: 40px;
  padding: 0 14px;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.stab.active { border-bottom-color: var(--accent); color: var(--ink); }
.stab-panel { display: none; }
.stab-panel.active { display: block; }

/* Status tabs for bills */
.status-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0 10px;
}

.btab {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  min-height: 32px;
  padding: 0 12px;
  transition: all var(--dur) var(--ease);
}

.btab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Bill form */
.bill-form { display: grid; gap: 10px; margin-bottom: 16px; }
.bill-row-1 { display: grid; gap: 8px; grid-template-columns: 1.8fr 0.8fr 0.8fr 1fr; }
.bill-row-2 { display: grid; gap: 8px; grid-template-columns: 1fr 1fr auto; }
.bill-row-3 { align-items: center; display: flex; gap: 14px; }
.field-hint { align-self: center; color: var(--muted); font-size: 0.74rem; }
.check-label { align-items: center; cursor: pointer; display: flex; gap: 8px; font-size: 0.82rem; font-weight: 500; }
.check-label input[type="checkbox"] { height: 16px; min-height: 0; padding: 0; width: 16px; }

/* Bill installment progress */
.bill-installment-progress {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr auto;
  margin-top: 6px;
}

.bill-installment-progress .progress { margin: 0; }
.bill-installment-label { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }

/* Bill status badges */
.bill-badge {
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 7px;
  white-space: nowrap;
}

.bill-badge.overdue { background: var(--red-bg); color: var(--red); }
.bill-badge.pending { background: var(--amber-bg); color: var(--amber); }
.bill-badge.paid { background: var(--green-bg); color: var(--green); }
.bill-badge.installment { background: var(--accent-light); color: var(--accent); }

/* Patrimony strip */
.patrimony-strip { padding: 18px 20px; }

.patrimony-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.patrim-card {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 5px;
  padding: 14px 16px;
}

.patrim-card span { color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.patrim-card strong { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.patrim-card.highlight { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); border-color: var(--accent); }
.patrim-card.highlight strong { color: var(--accent); }

/* Bank account cards */
.bank-cards-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0,1fr));
  margin-bottom: 6px;
}

.bank-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 8px;
  padding: 18px;
  position: relative;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.bank-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.bank-card .bank-icon { font-size: 1.6rem; }
.bank-card .bank-name { font-size: 0.88rem; font-weight: 700; }
.bank-card .bank-type { color: var(--muted); font-size: 0.72rem; }
.bank-card .bank-balance { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.bank-card .bank-balance.positive { color: var(--green); }
.bank-card .bank-balance.negative { color: var(--red); }
.bank-card .bank-actions { display: flex; gap: 6px; }

/* Bank/receivable forms */
.bank-grid { grid-template-columns: 1.4fr 0.8fr 0.7fr auto; }
.receivable-grid { grid-template-columns: 1.6fr 0.6fr 0.7fr 0.8fr auto; }
.recurring-income-grid { grid-template-columns: 2fr 0.8fr 0.6fr auto; }

/* Receivable status */
.recv-badge { border-radius: 5px; font-size: 0.68rem; font-weight: 700; padding: 3px 7px; }
.recv-badge.pending { background: var(--amber-bg); color: var(--amber); }
.recv-badge.received { background: var(--green-bg); color: var(--green); }
.recv-badge.overdue { background: var(--red-bg); color: var(--red); }

/* Recurring income row */
.ri-badge { background: var(--green-bg); border-radius: 5px; color: var(--green); font-size: 0.68rem; font-weight: 700; padding: 3px 7px; }

/* Responsive updates */
@media (max-width: 1280px) {
  .summary-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .patrimony-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .bank-cards-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .bill-row-1 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 920px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .patrimony-grid, .bank-cards-grid, .bill-row-1, .bill-row-2, .bank-grid, .receivable-grid, .recurring-income-grid { grid-template-columns: 1fr; }
  .alert-tabs .atab { font-size: 0.64rem; padding: 0 4px; }
}

/* ============================================================
   LUCIDE ICON SYSTEM
   ============================================================ */

/* Tab icons */
.tab-icon-svg {
  display: block;
  flex-shrink: 0;
  height: 15px;
  stroke: currentColor;
  width: 15px;
}

/* Section heading icons */
.section-icon {
  display: inline-block;
  height: 16px;
  stroke: var(--accent);
  vertical-align: middle;
  width: 16px;
}

.card-icon {
  height: 18px;
  opacity: 0.75;
  stroke: rgba(255,255,255,0.9);
  vertical-align: middle;
  width: 18px;
}

/* Metric card icons */
.metric-icon {
  display: inline-block;
  height: 13px;
  vertical-align: middle;
  width: 13px;
}

.metric-icon.income-icon  { stroke: var(--green); }
.metric-icon.expense-icon { stroke: var(--red); }
.metric-icon.warning-icon { stroke: var(--amber); }
.metric-icon.accent-icon  { stroke: var(--accent); }

/* Category badge icon */
.cat-icon-wrap {
  align-items: center;
  background: color-mix(in srgb, var(--cat-color) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--cat-color) 28%, transparent);
  border-radius: 6px;
  display: inline-flex;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.cat-icon-wrap i {
  height: 13px;
  stroke: var(--cat-color);
  width: 13px;
}

/* Map module icons */
.map-module-icon i {
  height: 18px;
  stroke: var(--accent);
  width: 18px;
}

/* Bank card icons */
.bank-icon i {
  display: block;
  height: 28px;
  stroke: var(--accent);
  width: 28px;
}

/* Inline icons (in text) */
.inline-lucide {
  display: inline-block;
  height: 14px;
  stroke: currentColor;
  vertical-align: middle;
  width: 14px;
}

/* Alert tab icons */
.atab-icon {
  display: inline-block;
  height: 12px;
  stroke: currentColor;
  vertical-align: middle;
  width: 12px;
}

.atab-count {
  background: var(--accent);
  border-radius: 999px;
  color: white;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 5px;
}

/* Sub-tab icons */
.stab-icon {
  display: inline-block;
  height: 13px;
  stroke: currentColor;
  vertical-align: middle;
  width: 13px;
}

/* Button icons */
.btn-icon {
  display: inline-block;
  height: 13px;
  stroke: currentColor;
  vertical-align: middle;
  width: 13px;
}

/* All lucide SVGs: consistent stroke, no fill */
[data-lucide] {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/* ============================================================
   EMPTY STATES
   ============================================================ */

.empty-state {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 32px 20px;
  text-align: center;
}

.empty-state i {
  height: 36px;
  opacity: 0.3;
  stroke: var(--ink);
  width: 36px;
}

.empty-state strong { font-size: 0.92rem; font-weight: 700; }
.empty-state p { color: var(--muted); font-size: 0.80rem; margin: 0; max-width: 320px; }

.empty-state-sm {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 20px;
  text-align: center;
}

.empty-state-sm i { height: 24px; opacity: 0.3; stroke: var(--ink); width: 24px; }
.empty-state-sm strong { font-size: 0.84rem; font-weight: 700; }
.empty-state-sm p { color: var(--muted); font-size: 0.76rem; margin: 0; }

/* Link buttons (inline text buttons) */
.link-button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
}

.link-button:hover { color: var(--accent-strong); }

/* Patrimony empty CTA */
.patrim-card strong { font-variant-numeric: tabular-nums; }

/* Planning form fix — texto não cortar */
.planning-form {
  grid-template-columns: minmax(0, 1.4fr) minmax(100px, 0.5fr) minmax(100px, 0.5fr) auto;
}

.planning-form input, .planning-form select {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Category icon picker */
.icon-picker {
  max-width: 160px;
}

/* Dashboard rotina — compact improvements */
#cashflowList .row { min-height: 50px; }

/* Alert empty states */
#alertList .empty-state-sm { padding: 16px; }

/* ============================================================
   TRANSACTION ROW — redesign limpo
   ============================================================ */

.txn-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 148px 120px 76px;
  min-height: 56px;
  padding: 10px 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.txn-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}

/* Coluna 1: Descrição */
.txn-info { min-width: 0; }
.txn-info strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.txn-info small {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Coluna 2: Categoria select */
.txn-cat-select {
  font-size: 0.76rem;
  min-height: 32px;
  padding: 4px 8px;
  width: 100%;
}

/* Coluna 3: Valor + status */
.txn-value {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}

.txn-value .amount {
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.txn-status {
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  text-transform: uppercase;
  white-space: nowrap;
}

.txn-status.pending { background: var(--amber-bg); color: var(--amber); }
.txn-status.renegotiated { background: #FFF7ED; color: #9A4A00; }

/* Coluna 4: Botões ícone */
.txn-btns {
  align-items: center;
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.icon-action {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  display: flex;
  height: 30px;
  justify-content: center;
  padding: 0;
  transition: all var(--dur) var(--ease);
  width: 30px;
}

.icon-action i {
  height: 13px;
  stroke: currentColor;
  width: 13px;
}

.icon-action:hover {
  background: var(--soft);
  border-color: var(--line-strong);
  color: var(--ink);
}

.icon-action.danger:hover {
  background: var(--red-bg);
  border-color: color-mix(in srgb, var(--red) 30%, transparent);
  color: var(--red);
}

@media (max-width: 920px) {
  .txn-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
  }
  .txn-cat-select { grid-column: 1; grid-row: 2; }
  .txn-value { align-items: flex-start; grid-column: 2; grid-row: 1; }
  .txn-btns { grid-column: 2; grid-row: 2; }
}

/* ============================================================
   METRIC CARDS — fix número saindo da caixa
   ============================================================ */

.metric strong {
  font-size: clamp(1rem, 1.4vw, 1.45rem) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.03em;
}

/* 5 cards: reduzir padding para dar mais espaço ao número */
.summary-grid .metric {
  min-height: 100px;
  padding: 14px 16px;
}

.metric span {
  font-size: 0.62rem !important;
  margin-bottom: 10px;
}

/* ============================================================
   METRIC NUMBERS — fix definitivo por ID
   ============================================================ */

#incomeTotal,
#expenseTotal,
#balanceTotal,
#commitmentTotal,
#netWorthTotal {
  display: block;
  font-size: 1.08rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
  width: 100%;
}

/* Logo maior */
.brand-logo {
  max-height: 52px !important;
  max-width: 160px !important;
}

/* Logo 2x */
.brand-logo {
  max-height: 88px !important;
  max-width: 220px !important;
}

/* ============================================================
   NEW DASHBOARD LAYOUT v3
   ============================================================ */

.dash-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  padding: 18px 20px;
}

.dash-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0,1fr));
  margin-bottom: 14px;
}

.dash-row .surface { margin-bottom: 0; }

.dash-row.two-col { grid-template-columns: repeat(2, minmax(0,1fr)); }

.dash-section-header {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dash-section-title {
  align-items: center;
  display: flex;
  font-size: 0.88rem;
  font-weight: 700;
  gap: 8px;
  letter-spacing: -0.01em;
}

.dash-section-title i {
  height: 16px;
  stroke: var(--accent);
  width: 16px;
}

.dash-section-sub {
  color: var(--muted);
  font-size: 0.76rem;
}

/* Focus card breakdown */
.focus-breakdown {
  border-top: 1px solid rgba(255,255,255,0.15);
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
}

.focus-breakdown-row {
  align-items: center;
  display: flex;
  font-size: 0.76rem;
  justify-content: space-between;
  opacity: 0.85;
}

/* Dash 2-col row */
.dash-row-2 {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0,1fr));
  margin-bottom: 14px;
}

/* ============================================================
   STATUS DO MÊS — kanban 3 colunas
   ============================================================ */

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

.status-col {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.status-col-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 8px;
  justify-content: space-between;
  padding: 10px 14px;
}

.status-col-header i {
  height: 14px;
  width: 14px;
}

.status-col.paid .status-col-header { background: var(--green-bg); color: var(--green); }
.status-col.paid .status-col-header i { stroke: var(--green); }
.status-col.pending .status-col-header { background: var(--amber-bg); color: var(--amber); }
.status-col.pending .status-col-header i { stroke: var(--amber); }
.status-col.overdue .status-col-header { background: var(--red-bg); color: var(--red); }
.status-col.overdue .status-col-header i { stroke: var(--red); }

.status-col-items { display: grid; gap: 1px; padding: 8px; }

.status-item {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  gap: 8px;
  min-height: 46px;
  padding: 7px 10px;
}

.status-item.overdue { border-left: 2px solid var(--red); }
.status-item.pending { border-left: 2px solid var(--amber); }
.status-item.paid { border-left: 2px solid var(--green); opacity: 0.75; }

.status-item-info { flex: 1; min-width: 0; }
.status-item-info strong { display: block; font-size: 0.78rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-item-info small { color: var(--muted); font-size: 0.68rem; }
.status-item .amount { font-size: 0.80rem; font-weight: 700; white-space: nowrap; }
.status-item .icon-action { flex-shrink: 0; height: 26px; min-height: 26px; width: 26px; }
.status-item .icon-action i { height: 11px; width: 11px; }
.status-empty { color: var(--muted); font-size: 0.76rem; padding: 12px; text-align: center; }

/* ============================================================
   GRÁFICO DE CATEGORIAS
   ============================================================ */

.cat-chart { display: grid; gap: 8px; padding: 4px 0; }

.cat-bar-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 130px 1fr 110px;
  min-height: 28px;
}

.cat-bar-label {
  align-items: center;
  display: flex;
  font-size: 0.76rem;
  font-weight: 500;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-bar-icon i { height: 13px; stroke: currentColor; width: 13px; }

.cat-bar-track {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  position: relative;
}

.cat-bar-inner {
  border-radius: 999px;
  height: 100%;
  opacity: 0.8;
  transition: width 500ms var(--ease);
}

.cat-bar-values {
  align-items: center;
  display: flex;
  font-size: 0.76rem;
  gap: 8px;
  justify-content: flex-end;
}

.cat-bar-pct { color: var(--muted); font-size: 0.70rem; min-width: 32px; text-align: right; }
.cat-bar-total { border-top: 1px solid var(--line); display: flex; font-size: 0.78rem; font-weight: 700; justify-content: space-between; margin-top: 4px; padding-top: 10px; }

/* ============================================================
   TABELA DE PARCELAMENTOS FUTUROS
   ============================================================ */

.inst-table-wrap { overflow-x: auto; }

.inst-table {
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 600px;
  width: 100%;
}

.inst-table th {
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 8px 12px;
  text-align: center;
  text-transform: uppercase;
}

.inst-table th:first-child { text-align: left; }

.inst-table td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: center;
  vertical-align: middle;
}

.inst-table td:first-child { text-align: left; }

.inst-name strong { display: block; font-size: 0.80rem; font-weight: 600; }
.inst-name small { color: var(--muted); font-size: 0.70rem; }

.inst-val span { display: block; font-weight: 600; }
.inst-val small { color: var(--muted); font-size: 0.68rem; }
.inst-empty { color: var(--line-strong); }

.inst-table tfoot td {
  background: var(--soft);
  font-weight: 700;
}

.inst-total { color: var(--red); font-weight: 700; }

.inst-table tbody tr:hover td { background: var(--soft); }

/* Patrimony in dash-section (no strip padding) */
.dash-section .patrimony-grid { margin-top: 0; }

/* Annual grid compact */
.annual-grid { grid-template-columns: repeat(6, minmax(0,1fr)); }

@media (max-width: 1200px) {
  .dash-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .month-status-grid { grid-template-columns: 1fr; }
  .annual-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .cat-bar-row { grid-template-columns: 100px 1fr 90px; }
}

@media (max-width: 860px) {
  .dash-row { grid-template-columns: 1fr; }
  .cat-bar-row { grid-template-columns: 1fr; }
}

/* ============================================================
   PRÓ-LABORE SNAPSHOT — fix números cortados
   ============================================================ */

/* No dash-row de 3 colunas, planning-snapshot vira stack vertical */
.dash-row .planning-snapshot {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr !important;
}

.dash-row .planning-snapshot .report-card {
  min-height: 60px;
  padding: 10px 12px;
}

.dash-row .planning-snapshot .report-card strong {
  font-size: 1.1rem !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-row .planning-snapshot .report-card span {
  font-size: 0.62rem !important;
}

/* Cofrinho e cartões no dash-row: altura mínima */
.dash-row .surface { min-height: 180px; }

/* Annual grid — 6 cols mais compactas */
.annual-grid {
  grid-template-columns: repeat(6, minmax(0,1fr)) !important;
}

.month-card {
  padding: 10px 12px;
}

.month-card strong { font-size: 0.74rem; }
.month-card small { font-size: 0.66rem; }
.month-card .amount { font-size: 0.78rem; }

/* ============================================================
   AUTH SCREEN
   ============================================================ */

.auth-screen {
  align-items: center;
  background: var(--sidebar-bg);
  display: flex;
  inset: 0;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  position: fixed;
  z-index: 999;
}

.auth-card {
  background: #161210;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 400px;
  overflow: hidden;
  padding: 40px 36px 36px;
  width: 100%;
}

.auth-logo {
  display: block;
  height: auto;
  margin: 0 auto 16px;
  max-height: 56px;
  mix-blend-mode: screen;
  object-fit: contain;
  width: auto;
}

.auth-card h1 {
  color: rgba(255,255,255,0.90);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-align: center;
  text-transform: uppercase;
}

.auth-sub {
  color: rgba(255,255,255,0.35);
  font-size: 0.76rem;
  margin: 0 0 24px;
  text-align: center;
}

.auth-tabs {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
}

.auth-tab {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: rgba(255,255,255,0.45);
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 36px;
  transition: all 180ms ease;
}

.auth-tab.active {
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.90);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  width: 100%;
  box-sizing: border-box;
  color: rgba(255,255,255,0.90);
  font-size: 0.88rem;
  min-height: 46px;
  padding: 0 16px;
  transition: border-color 180ms ease;
}

.auth-form input::placeholder { color: rgba(255,255,255,0.25); }

.auth-form input:focus {
  border-color: #C9A84C;
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
  outline: none;
}

.auth-btn {
  background: linear-gradient(135deg, #8B6226, #C9A84C);
  border: 0;
  border-radius: 10px;
  width: 100%;
  color: white;
  font-size: 0.90rem;
  font-weight: 700;
  margin-top: 4px;
  min-height: 48px;
  transition: opacity 180ms ease, transform 180ms ease;
}

.auth-btn:hover:not(:disabled) { opacity: 0.92; transform: translateY(-1px); }
.auth-btn:disabled { opacity: 0.5; }

.auth-link {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.35);
  font-size: 0.76rem;
  margin-top: 2px;
  padding: 4px 0;
  text-align: center;
  transition: color 180ms ease;
}
.auth-link:hover { color: rgba(255,255,255,0.65); }

.auth-msg {
  font-size: 0.80rem;
  font-weight: 500;
  margin-top: 8px;
  min-height: 20px;
  text-align: center;
}

.auth-loading {
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

.auth-spinner {
  animation: spin 0.8s linear infinite;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  border-top-color: #C9A84C;
  height: 20px;
  width: 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* User info in sidebar */
.user-info {
  border-top: 1px solid var(--sidebar-line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
}

.user-email {
  color: rgba(255,255,255,0.40);
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* App frame hidden by default */
#appFrame { display: none; }

/* ============================================================
   BANK HELP BOX — tela de fatura
   ============================================================ */

.bank-help-box {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 12px;
  padding: 14px 16px;
}

.bank-help-box > strong {
  align-items: center;
  display: flex;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 7px;
  margin-bottom: 12px;
}

.bank-help-box > strong i {
  height: 14px;
  stroke: var(--accent);
  width: 14px;
}

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

.bank-help-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
}

.bank-help-name {
  font-size: 0.78rem;
  font-weight: 700;
}

.bank-help-item span:last-child {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.bank-help-note {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
  margin: 0;
  padding-top: 10px;
}

@media (max-width: 700px) {
  .bank-help-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MONTHLY BARS CHART
   ============================================================ */

.monthly-chart-header {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.monthly-legend {
  align-items: center;
  display: flex;
  font-size: 0.76rem;
  font-weight: 600;
  gap: 6px;
}

.monthly-legend.income-leg { color: var(--green); }
.monthly-legend.expense-leg { color: #e07070; }

.monthly-chart-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

/* ============================================================
   BILLS STATUS CHART
   ============================================================ */

.bills-status-bar {
  border-radius: 8px;
  display: flex;
  height: 20px;
  margin-bottom: 16px;
  overflow: hidden;
  width: 100%;
}

.bs-seg {
  height: 100%;
  min-width: 2px;
  transition: width 500ms var(--ease);
}

.bs-seg.paid    { background: var(--green); }
.bs-seg.pending { background: var(--amber); }
.bs-seg.overdue { background: var(--red); }

.bills-status-legend {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0,1fr));
}

.bs-leg {
  align-items: center;
  display: flex;
  gap: 8px;
}

.bs-dot {
  border-radius: 50%;
  flex-shrink: 0;
  height: 10px;
  width: 10px;
}

.bs-dot.paid    { background: var(--green); }
.bs-dot.pending { background: var(--amber); }
.bs-dot.overdue { background: var(--red); }

.bs-leg div { min-width: 0; }
.bs-leg strong { display: block; font-size: 0.84rem; font-weight: 700; white-space: nowrap; }
.bs-leg small  { color: var(--muted); font-size: 0.70rem; }

/* ============================================================
   PRODUÇÃO — termos e ajustes finais
   ============================================================ */

.terms-check-label {
  align-items: flex-start;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  display: flex;
  font-size: 0.76rem;
  gap: 10px;
  line-height: 1.5;
  margin-top: 4px;
}

.terms-check-label input[type="checkbox"] {
  accent-color: #C9A84C;
  flex-shrink: 0;
  height: 16px;
  margin-top: 2px;
  width: 16px;
}

.auth-terms-link {
  color: #C9A84C;
  text-decoration: underline;
}

.auth-terms-link:hover { color: #e8c55a; }

/* Garantir que botões de demo nunca apareçam */
#seedDemo, #resetData { display: none !important; }

/* ============================================================
   COFRINHO — goal snapshot redesign
   ============================================================ */

.goal-snap-item {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  padding: 12px 14px;
}

.goal-snap-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.goal-snap-header strong {
  font-size: 0.84rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 55%;
}

.goal-snap-header .amount small {
  font-size: 0.70rem;
  font-weight: 400;
  opacity: 0.6;
}

.goal-snap-bar { margin-bottom: 8px; }

.goal-snap-footer {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.goal-snap-footer small {
  color: var(--muted);
  font-size: 0.72rem;
}

.goal-snap-deposit {
  align-items: center;
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.goal-dep-input {
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 0.76rem;
  min-height: 30px;
  padding: 0 8px;
  width: 80px;
}

.goal-snap-total {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.goal-snap-total span {
  color: var(--muted);
  font-size: 0.76rem;
}

.goal-snap-total strong {
  font-size: 0.92rem;
  font-weight: 700;
}

.goal-snap-total strong small {
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.6;
}
