/* ============================================================
   FINANCEIRO PESSOAL — Design System v3
   Paleta: Slate escuro + Teal primário + Âmbar acento
   Assinatura: linha de acento gradiente no topo da sidebar
   e nos painéis principais
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300..900;1,14..32,300..900&display=swap');

:root {
    /* --- Superfícies --- */
    --bg:            #f0f4f8;
    --surface:       #ffffff;
    --surface-soft:  #f8fafc;
    --surface-raised:#ffffff;

    /* --- Texto --- */
    --text:          #0d1521;
    --text-2:        #334155;
    --muted:         #64748b;
    --muted-2:       #94a3b8;

    /* --- Bordas --- */
    --border:        #e2e8f0;
    --border-soft:   #f1f5f9;

    /* --- Primária (Teal) --- */
    --primary:       #0d9488;
    --primary-dark:  #0f766e;
    --primary-xdark: #115e59;
    --primary-soft:  #f0fdfa;
    --primary-mid:   #99f6e4;

    /* --- Semânticas --- */
    --green:         #10b981;
    --green-soft:    #d1fae5;
    --green-dark:    #047857;

    --red:           #ef4444;
    --red-soft:      #fee2e2;
    --red-dark:      #b91c1c;

    --orange:        #f59e0b;
    --orange-soft:   #fef3c7;
    --orange-dark:   #92400e;

    --blue:          #3b82f6;
    --blue-soft:     #dbeafe;
    --blue-dark:     #1d4ed8;

    --purple:        #8b5cf6;
    --purple-soft:   #ede9fe;
    --purple-dark:   #6d28d9;

    /* --- Sombras --- */
    --shadow-xs:     0 1px 3px rgba(13,21,33,.06), 0 1px 2px rgba(13,21,33,.04);
    --shadow-sm:     0 4px 12px rgba(13,21,33,.07), 0 2px 4px rgba(13,21,33,.04);
    --shadow:        0 8px 24px rgba(13,21,33,.08), 0 3px 8px rgba(13,21,33,.05);
    --shadow-lg:     0 20px 40px rgba(13,21,33,.12), 0 6px 14px rgba(13,21,33,.06);

    /* --- Raios --- */
    --radius-xl:     20px;
    --radius-lg:     14px;
    --radius-md:     10px;
    --radius-sm:     7px;
    --radius-xs:     5px;

    /* --- Layout --- */
    --sidebar-width: 248px;
    --content-pad:   32px;

    /* --- Transições --- */
    --ease:          cubic-bezier(.4,0,.2,1);
    --dur-fast:      120ms;
    --dur:           200ms;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    font-optical-sizing: auto;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

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

button { cursor: pointer; }

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

.layout {
    display: flex;
    min-height: 100vh;
}

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

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: #0d1521;
    color: white;
    padding: 0;
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

/* Faixa de acento no topo — assinatura visual */
.sidebar::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, #0d9488, #06b6d4, #6366f1);
    flex-shrink: 0;
}

.sidebar-inner {
    padding: 24px 20px 28px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
}

/* Caso o template não use .sidebar-inner, aplicar via seletores diretos */
.sidebar h2 {
    margin: 24px 20px 0;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #f8fafc;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 24px 12px 0;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: #94a3b8;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: background var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease);
    position: relative;
}

.sidebar nav a:hover {
    background: rgba(255,255,255,.07);
    color: #e2e8f0;
}

.sidebar nav a.active,
.sidebar nav a[aria-current="page"] {
    background: rgba(13,148,136,.18);
    color: #5eead4;
    font-weight: 600;
}

.sidebar nav a.active::before,
.sidebar nav a[aria-current="page"]::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 3px;
    border-radius: 999px;
    background: #0d9488;
}

.logout-form {
    margin: auto 12px 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.logout-form button {
    width: 100%;
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.04);
    color: #94a3b8;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.logout-form button:hover {
    background: rgba(255,255,255,.09);
    color: #e2e8f0;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */

.content {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    padding: var(--content-pad);
    min-height: 100vh;
}

/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 28px;
}

.topbar > div:first-child { flex: 1; }

.topbar h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.04em;
    color: var(--text);
}

.topbar p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
}

/* ============================================================
   FILTERS
   ============================================================ */

.filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 10px;
}

.filters label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 120px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.filters input,
.filters select {
    width: 100%;
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    outline: none;
    transition: border-color var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
}

.filters input:focus,
.filters select:focus,
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus,
.form-inline input:focus,
.form-inline select:focus,
.form-inline textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,148,136,.14);
    outline: none;
}

.filters button {
    height: 38px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 0 18px;
    background: var(--primary);
    color: white;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.01em;
    transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.filters button:hover { background: var(--primary-dark); }
.filters button:active { transform: scale(.98); }

/* ============================================================
   CARDS
   ============================================================ */

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

.cards-dashboard    { grid-template-columns: repeat(4, minmax(0,1fr)); }
.cards-situacao     { grid-template-columns: repeat(3, minmax(0,1fr)); }
.cards-resumo-planejamento { grid-template-columns: repeat(3, minmax(0,1fr)); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-xs);
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
    position: relative;
    overflow: hidden;
}

.card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: transparent;
    transition: background var(--dur) var(--ease);
}

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

.card span {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.card strong {
    display: block;
    margin-top: 8px;
    color: var(--text);
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -0.04em;
    font-weight: 800;
}

.card small {
    display: block;
    margin-top: 8px;
    color: var(--muted-2);
    font-size: 12px;
    line-height: 1.4;
    font-weight: 400;
}

/* Variantes de cartão */
.card.destaque {
    border-color: #99f6e4;
    background: linear-gradient(145deg, #ffffff 0%, #f0fdfa 100%);
}

.card.destaque::after { background: linear-gradient(90deg, #0d9488, #06b6d4); }
.card.destaque strong { color: var(--primary); }

.card.livre,
.card-saldo-total {
    border-color: #5eead4;
    background: linear-gradient(145deg, #f0fdfa 0%, #ccfbf1 100%);
}

.card.livre::after,
.card-saldo-total::after { background: linear-gradient(90deg, #0f766e, #0d9488); }
.card.livre strong,
.card-saldo-total strong { color: var(--primary-xdark); }

.card-gasto {
    border-color: #fca5a5;
    background: linear-gradient(145deg, #fff8f8 0%, #fee2e2 100%);
}

.card-gasto::after { background: linear-gradient(90deg, #dc2626, #ef4444); }
.card-gasto span   { color: #991b1b; }
.card-gasto strong { color: #dc2626; }
.card-gasto small  { color: #b91c1c; }

.card-pendente {
    border-color: #fcd34d;
    background: linear-gradient(145deg, #fffdf0 0%, #fef3c7 100%);
}

.card-pendente::after { background: linear-gradient(90deg, #d97706, #f59e0b); }
.card-pendente span   { color: #92400e; }
.card-pendente strong { color: #d97706; }
.card-pendente small  { color: #92400e; }

.card-guardado {
    border-color: #93c5fd;
    background: linear-gradient(145deg, #f8faff 0%, #eff6ff 100%);
}

.card-guardado::after { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.card-guardado strong { color: var(--blue-dark); }

.card-investido {
    border-color: #c4b5fd;
    background: linear-gradient(145deg, #faf8ff 0%, #f5f3ff 100%);
}

.card-investido::after { background: linear-gradient(90deg, #7c3aed, #8b5cf6); }
.card-investido strong { color: var(--purple-dark); }

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

.grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-duplo {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-soft);
}

.panel-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.panel-header span {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ============================================================
   TABLES
   ============================================================ */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    text-align: left;
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

thead th:first-child { border-radius: var(--radius-sm) 0 0 0; padding-left: 16px; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; padding-right: 16px; }

tbody td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
    color: var(--text);
    font-size: 13.5px;
    white-space: nowrap;
    transition: background var(--dur-fast) var(--ease);
}

tbody td:first-child { padding-left: 16px; }
tbody td:last-child  { padding-right: 16px; }

tbody tr:hover td { background: var(--primary-soft); }

tbody tr:last-child td { border-bottom: 0; }

.panel table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabela-matriz th,
.tabela-matriz td   { text-align: center; }

.tabela-matriz th:first-child,
.tabela-matriz td:first-child { text-align: left; }

.mes-destaque {
    background: var(--orange-soft) !important;
    color: var(--orange-dark);
    font-weight: 800;
}

.valor-positivo { color: var(--green-dark) !important; font-weight: 600; }
.valor-negativo { color: var(--red-dark)   !important; font-weight: 600; }

/* ============================================================
   STATUS & BADGES
   ============================================================ */

.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.status::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: currentColor;
    flex-shrink: 0;
}

.status.realizado { background: var(--green-soft); color: var(--green-dark); }
.status.pendente  { background: #f1f5f9;           color: #475569; }
.status.cancelado { background: var(--red-soft);   color: var(--red-dark); }
.status.ignorado  { background: #f8fafc;            color: var(--muted-2); }

.badge-desejo {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-neutro   { background: #f1f5f9;             color: #475569; }
.badge-laranja  { background: var(--orange-soft);  color: var(--orange-dark); }
.badge-azul     { background: var(--blue-soft);    color: var(--blue-dark); }
.badge-verde    { background: var(--green-soft);   color: var(--green-dark); }
.badge-vermelho { background: var(--red-soft);     color: var(--red-dark); }

/* ============================================================
   BUTTONS & LINKS
   ============================================================ */

.action-btn,
.small-btn,
.danger-btn,
.small-link,
.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 0;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    transition: filter var(--dur-fast) var(--ease),
                transform var(--dur-fast) var(--ease);
    letter-spacing: -0.01em;
}

.action-btn:hover,
.small-btn:hover,
.danger-btn:hover,
.small-link:hover,
.btn-link:hover { filter: brightness(.93); }

.action-btn:active,
.small-btn:active,
.danger-btn:active,
.btn-link:active { transform: scale(.97); }

.action-btn.realizar {
    background: var(--green-soft);
    color: var(--green-dark);
}

.action-btn.pendente {
    background: var(--red-soft);
    color: var(--red-dark);
}

.small-link {
    background: var(--blue-soft);
    color: var(--blue-dark);
}

.small-btn {
    background: var(--text);
    color: white;
}

.danger-btn {
    background: var(--red-soft);
    color: var(--red-dark);
}

.btn-link {
    background: var(--text);
    color: white;
    min-height: 38px;
    padding: 0 16px;
    font-size: 13px;
    border-radius: var(--radius-md);
}

.btn-link.secundario {
    background: var(--border);
    color: var(--text-2);
}

/* ============================================================
   FORM ACTIONS (shared buttons)
   ============================================================ */

.form-actions button,
.form-actions-inline button {
    min-height: 40px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 0 20px;
    background: var(--primary);
    color: white;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.form-actions button:hover,
.form-actions-inline button:hover { background: var(--primary-dark); }

.form-actions button:active,
.form-actions-inline button:active { transform: scale(.98); }

/* ============================================================
   FORMS — PAGE (nova/editar transação / lançamento)
   ============================================================ */

.form-page {
    max-width: 100%;
    width: 100%;
}

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    box-shadow: var(--shadow-xs);
}

.form-card h2 {
    margin: 28px 0 14px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-soft);
}

.form-card h2:first-child { margin-top: 0; }

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

.form-card label,
.form-inline label {
    display: flex;
    flex-direction: column;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.form-card input,
.form-card select,
.form-card textarea,
.form-inline input,
.form-inline select,
.form-inline textarea {
    margin-top: 6px;
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    outline: none;
    transition: border-color var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
}

.form-card input:hover,
.form-card select:hover,
.form-card textarea:hover,
.form-inline input:hover,
.form-inline select:hover,
.form-inline textarea:hover {
    border-color: var(--muted-2);
}

.form-card textarea,
.form-inline textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.form-card small {
    margin-top: 5px;
    color: var(--muted-2);
    font-size: 11.5px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.4;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-soft);
}

.form-actions a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: color var(--dur-fast) var(--ease);
}

.form-actions a:hover { color: var(--text); }

.form-message {
    margin-top: 14px;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    display: none;
}

.form-message.sucesso {
    display: block;
    background: var(--green-soft);
    color: var(--green-dark);
    border: 1px solid #a7f3d0;
}

.form-message.erro {
    display: block;
    background: var(--red-soft);
    color: var(--red-dark);
    border: 1px solid #fca5a5;
}

/* ============================================================
   FORMS — INLINE (gerenciamento / planejamento)
   ============================================================ */

.form-inline {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
    padding: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
}

.form-conta {
    grid-template-columns: 1.2fr 1.4fr 1.2fr 1fr 0.8fr auto;
    align-items: end;
}

.form-desejo {
    grid-template-columns: 1fr 1.2fr 1.4fr 0.9fr 1fr 0.8fr;
    align-items: end;
}

.campo-observacao-desejo { grid-column: span 2; }

.checkbox-line {
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    margin-top: 18px;
    font-size: 13px;
    color: var(--text-2) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: 500 !important;
}

.checkbox-line input[type="checkbox"] {
    width: 16px;
    min-height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-actions-inline {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.btn-limpar {
    background: var(--border) !important;
    color: var(--text-2) !important;
}

.btn-limpar:hover { background: #cbd5e1 !important; }

/* ============================================================
   FILTERS — AVANÇADOS (lancamentos)
   ============================================================ */

.filtros-avancados { margin-bottom: 16px; }

.filtros-avancados .filters { justify-content: flex-start; }

/* ============================================================
   PLANEJAMENTO — TABS
   ============================================================ */

.tabs-planejamento {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.tab-planejamento {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: background var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease);
}

.tab-planejamento:hover {
    border-color: var(--primary-mid);
    color: var(--primary);
}

.tab-planejamento.ativo {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-body {
    margin: 0;
    background: linear-gradient(135deg, #0d1521 0%, #0f2035 100%);
    min-height: 100vh;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: var(--radius-xl);
    padding: 36px;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 30px;
    letter-spacing: -0.05em;
    font-weight: 800;
}

.login-card p  { margin: 0 0 28px; color: var(--muted); font-size: 14px; }

.login-card label {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.login-card input {
    margin-top: 6px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-size: 14px;
    outline: none;
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.login-card input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,148,136,.14);
}

.login-card button {
    width: 100%;
    border: 0;
    border-radius: var(--radius-md);
    padding: 13px 18px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-weight: 700;
    font-size: 14.5px;
    letter-spacing: -0.01em;
    margin-top: 8px;
    transition: background var(--dur-fast) var(--ease);
}

.login-card button:hover { background: var(--primary-dark); }

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

@media (max-width: 1400px) {
    .cards,
    .cards-dashboard { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .cards-situacao  { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .form-conta,
    .form-desejo     { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 1100px) {
    :root { --sidebar-width: 220px; }

    .content { padding: 24px; }

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

    .filters { justify-content: flex-start; }

    .dashboard-duplo { grid-template-columns: 1fr; }

    .cards,
    .cards-dashboard,
    .cards-situacao,
    .cards-resumo-planejamento { grid-template-columns: repeat(2, minmax(0,1fr)); }

    .form-grid,
    .form-conta,
    .form-desejo { grid-template-columns: 1fr; }

    .campo-observacao-desejo { grid-column: span 1; }
}

@media (max-width: 760px) {
    .layout { display: block; }

    .sidebar {
        position: sticky;
        top: 0;
        width: 100%;
        min-width: 0;
        flex-direction: column;
    }

    .sidebar h2 {
        margin: 12px 16px 0;
        font-size: 16px;
    }

    .sidebar nav {
        flex-direction: row;
        margin: 10px 8px 0;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
    }

    .sidebar nav::-webkit-scrollbar { display: none; }

    .sidebar nav a {
        flex: 0 0 auto;
        min-height: 34px;
        padding: 7px 12px;
        font-size: 13px;
        background: rgba(255,255,255,.05);
    }

    .sidebar nav a.active::before { display: none; }

    .logout-form {
        margin: 10px 8px 12px;
        padding-top: 10px;
    }

    .content { width: 100%; margin-left: 0; padding: 18px 14px 32px; }

    .topbar h1 { font-size: 24px; }
    .topbar p  { font-size: 13px; }

    .filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .filters label { min-width: 0; }

    .filters button,
    .filters .btn-link { width: 100%; justify-content: center; }

    .cards,
    .cards-dashboard,
    .cards-situacao,
    .cards-resumo-planejamento { grid-template-columns: 1fr 1fr; }

    .card { min-height: 96px; padding: 16px 18px; }
    .card strong { font-size: 22px; }

    .panel { padding: 16px 18px; border-radius: var(--radius-lg); }

    .panel-header { flex-direction: column; align-items: flex-start; }

    thead th, tbody td { padding: 11px 10px; font-size: 13px; }

    .form-card { padding: 18px; }

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

    .form-actions button,
    .form-actions a { width: 100%; text-align: center; justify-content: center; }

    .form-actions-inline { flex-direction: column; align-items: stretch; }
    .form-actions-inline button { width: 100%; }
}

@media (max-width: 520px) {
    :root { --content-pad: 14px; }

    .filters { grid-template-columns: 1fr; }

    .panel,
    .form-card,
    .card { border-radius: var(--radius-md); }

    .topbar h1 { font-size: 22px; }

    .card strong { font-size: 20px; }

    .cards,
    .cards-dashboard,
    .cards-situacao,
    .cards-resumo-planejamento { grid-template-columns: 1fr; }

    .action-btn,
    .small-btn,
    .danger-btn,
    .small-link {
        min-height: 30px;
        padding: 6px 9px;
        font-size: 11.5px;
    }

    .form-inline { padding: 14px; }
}

/* ============================================================
   SCROLL ELEGANTE
   ============================================================ */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

*::-webkit-scrollbar        { width: 5px; height: 5px; }
*::-webkit-scrollbar-track  { background: transparent; }
*::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ============================================================
   ACESSIBILIDADE
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================================
   EXTRAS — novos padrões de layout v3
   ============================================================ */

/* Section labels (Dashboard) */
.section-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted-2);
    margin: 20px 0 8px;
}

.section-label:first-of-type { margin-top: 0; }

/* Cards variantes de colunas */
.cards-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.cards-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* Filtros em grid (lancamentos / transacoes) */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    align-items: flex-end;
    justify-content: unset;
    flex-wrap: unset;
}

.filters-grid label { min-width: 0; }

.filter-action {
    display: flex;
    align-items: flex-end;
}

.filter-action button {
    height: 38px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 0 20px;
    background: var(--primary);
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease);
    white-space: nowrap;
}

.filter-action button:hover { background: var(--primary-dark); }

/* Formulários compactos inline (gerenciamento / planejamento) */
.form-inline-compacto {
    background: var(--surface-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.form-inline-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 10px;
}

.form-inline-row-wrap { flex-wrap: wrap; }

.form-inline-row label {
    display: flex;
    flex-direction: column;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    min-width: 110px;
}

.form-inline-row label.grow { flex: 1 1 140px; min-width: 140px; }

.form-inline-row input,
.form-inline-row select,
.form-inline-row textarea {
    margin-top: 5px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    width: 100%;
    transition: border-color var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
}

.form-inline-row textarea {
    height: auto;
    min-height: 60px;
    padding: 8px 10px;
    resize: vertical;
}

.form-inline-row input:focus,
.form-inline-row select:focus,
.form-inline-row textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,148,136,.14);
}

.checkbox-line-inline {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding-top: 18px;
    color: var(--text-2) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    white-space: nowrap;
    min-width: auto !important;
}

.checkbox-line-inline input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-inline-btns {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
    padding-top: 16px;
}

.form-inline-btns button {
    height: 38px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 0 16px;
    background: var(--primary);
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background var(--dur-fast) var(--ease);
}

.form-inline-btns button:hover { background: var(--primary-dark); }

.form-inline-btns .btn-limpar {
    background: var(--border) !important;
    color: var(--text-2) !important;
}

.form-inline-btns .btn-limpar:hover { background: #cbd5e1 !important; }

/* Form layout (páginas de formulário em cards) */
.form-layout { display: flex; flex-direction: column; gap: 0; }

.form-card + .form-card { margin-top: 12px; }

.form-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-soft);
}

.form-section-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    text-transform: none;
    border: none;
    padding: 0;
}

.form-section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

/* Grid 3 colunas nos forms */
.form-grid-3 {
    grid-template-columns: repeat(3, minmax(0,1fr));
}

/* span 2 colunas num label */
.span-2 { grid-column: span 2; }

/* Topbar sem filtros (simples) */
.topbar-simples { align-items: center; }

/* panel-header com strong inline */
.panel-header span strong {
    font-size: inherit;
    color: var(--text);
    font-weight: 700;
}

/* ── Responsivo extras ── */
@media (max-width: 1100px) {
    .cards-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .cards-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .form-grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .span-2 { grid-column: span 1; }
    .form-inline-row { flex-wrap: wrap; }
}

@media (max-width: 760px) {
    .cards-3,
    .cards-4 { grid-template-columns: 1fr 1fr; }

    .filters-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-grid-3 { grid-template-columns: 1fr; }

    .form-inline-row label,
    .form-inline-row label.grow { min-width: 0; flex: 1 1 100%; }

    .form-inline-btns { width: 100%; }
    .form-inline-btns button { flex: 1; }
}

@media (max-width: 520px) {
    .cards-3,
    .cards-4 { grid-template-columns: 1fr; }
    .filters-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   DASHBOARD V4 — Nova distribuição visual
   ============================================================ */

.dashboard-topbar {
    align-items: flex-start;
}

.dashboard-title {
    min-width: 240px;
}

.dashboard-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    max-width: 920px;
}

.dashboard-filters {
    justify-content: flex-end;
}

.btn-novo-lancamento {
    background: linear-gradient(135deg, #0d9488, #06b6d4);
    color: white;
    box-shadow: 0 8px 18px rgba(13, 148, 136, 0.22);
}

.dashboard-hero {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 2fr;
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-hero-card {
    min-height: 168px;
    justify-content: space-between;
}

.dashboard-hero-card strong {
    font-size: 34px;
}

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

.mini-card {
    min-height: 76px;
    padding: 14px 16px;
}

.mini-card strong {
    font-size: 20px;
}

.mini-card small {
    display: none;
}

.dashboard-balance-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 16px;
}

.dashboard-balance-strip .card {
    min-height: 104px;
}

.dashboard-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.95fr);
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-panel-principal {
    min-width: 0;
}

.dashboard-side {
    display: grid;
    gap: 16px;
    align-content: start;
}

.dashboard-side .panel {
    min-height: 0;
}

.dashboard-side table tbody td,
.dashboard-side table thead th {
    padding-top: 10px;
    padding-bottom: 10px;
}

.dashboard-secondary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.mobile-fab {
    display: none;
}

/* Deixa o painel principal mais parecido com uma área de trabalho */
.dashboard-panel-principal table tbody td {
    padding-top: 15px;
    padding-bottom: 15px;
}

.dashboard-panel-principal .small-link,
.dashboard-panel-principal .action-btn {
    margin-bottom: 4px;
}

/* Painéis laterais mais compactos */
.dashboard-side .panel-header {
    margin-bottom: 12px;
}

.dashboard-side .panel-header h2 {
    font-size: 14px;
}

/* Mobile/tablet */
@media (max-width: 1320px) {
    .dashboard-hero {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-mini-grid {
        grid-column: span 2;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .dashboard-balance-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-side {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .dashboard-actions {
        width: 100%;
        justify-content: stretch;
    }

    .btn-novo-lancamento {
        width: 100%;
    }

    .dashboard-filters {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-filters label {
        min-width: 0;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .dashboard-mini-grid {
        grid-column: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-balance-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-side {
        grid-template-columns: 1fr;
    }

    .dashboard-hero-card {
        min-height: 138px;
    }

    .dashboard-hero-card strong {
        font-size: 28px;
    }
}

@media (max-width: 600px) {
    .dashboard-filters {
        grid-template-columns: 1fr;
    }

    .dashboard-mini-grid,
    .dashboard-balance-strip {
        grid-template-columns: 1fr;
    }

    .mini-card {
        min-height: 86px;
    }

    .mobile-fab {
        display: flex;
        position: fixed;
        right: 18px;
        bottom: 18px;
        width: 58px;
        height: 58px;
        border-radius: 999px;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #0d9488, #06b6d4);
        color: white;
        font-size: 34px;
        font-weight: 700;
        box-shadow: 0 14px 30px rgba(13, 148, 136, 0.35);
        z-index: 80;
    }
}

/* ============================================================
   TEMA ESCURO — claro/escuro global
   ============================================================ */

.theme-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.theme-toggle {
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 14px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: background var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease),
                transform var(--dur-fast) var(--ease);
}

.theme-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
    color: var(--primary);
}

body.tema-escuro {
    --bg: #07111f;
    --surface: #101c2e;
    --surface-soft: #0b1626;
    --surface-raised: #132238;

    --text: #f8fafc;
    --text-2: #dbe7f5;
    --muted: #94a3b8;
    --muted-2: #64748b;

    --border: #213149;
    --border-soft: #1a2940;

    --primary: #2dd4bf;
    --primary-dark: #14b8a6;
    --primary-xdark: #0f766e;
    --primary-soft: #0f2f32;
    --primary-mid: #134e4a;

    --green-soft: #0f3226;
    --red-soft: #3a1519;
    --orange-soft: #3a2a10;
    --blue-soft: #10284a;
    --purple-soft: #2a1948;

    --shadow-xs: 0 1px 3px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25);
    --shadow-sm: 0 4px 12px rgba(0,0,0,.38), 0 2px 4px rgba(0,0,0,.28);
    --shadow: 0 8px 24px rgba(0,0,0,.42), 0 3px 8px rgba(0,0,0,.32);
    --shadow-lg: 0 20px 40px rgba(0,0,0,.5), 0 6px 14px rgba(0,0,0,.36);
}

body.tema-escuro .sidebar {
    background: #050b14;
}

body.tema-escuro .sidebar nav a {
    color: #94a3b8;
}

body.tema-escuro .sidebar nav a:hover {
    background: rgba(255,255,255,.08);
    color: #f8fafc;
}

body.tema-escuro .topbar h1,
body.tema-escuro .panel-header h2,
body.tema-escuro .card strong,
body.tema-escuro tbody td,
body.tema-escuro .grafico-info strong {
    color: var(--text);
}

body.tema-escuro .topbar p,
body.tema-escuro .card small,
body.tema-escuro .grafico-info span {
    color: var(--muted);
}

body.tema-escuro .panel,
body.tema-escuro .card,
body.tema-escuro .form-card,
body.tema-escuro .form-inline,
body.tema-escuro .form-inline-compacto,
body.tema-escuro .login-card,
body.tema-escuro .theme-toggle,
body.tema-escuro .view-toggle {
    background: var(--surface);
    border-color: var(--border);
}

body.tema-escuro thead th {
    background: var(--surface-soft);
    color: #9fb1c7;
    border-color: var(--border);
}

body.tema-escuro tbody td {
    border-color: var(--border-soft);
}

body.tema-escuro tbody tr:hover td {
    background: #102338;
}

body.tema-escuro .panel-header {
    border-color: var(--border-soft);
}

body.tema-escuro .panel-header span {
    background: var(--surface-soft);
    border-color: var(--border);
    color: var(--muted);
}

body.tema-escuro .filters input,
body.tema-escuro .filters select,
body.tema-escuro .form-card input,
body.tema-escuro .form-card select,
body.tema-escuro .form-card textarea,
body.tema-escuro .form-inline input,
body.tema-escuro .form-inline select,
body.tema-escuro .form-inline textarea,
body.tema-escuro .form-inline-row input,
body.tema-escuro .form-inline-row select,
body.tema-escuro .form-inline-row textarea,
body.tema-escuro .login-card input {
    background: #0b1626;
    border-color: var(--border);
    color: var(--text);
}

body.tema-escuro .filters input::placeholder,
body.tema-escuro .form-card input::placeholder,
body.tema-escuro .form-card textarea::placeholder,
body.tema-escuro .form-inline input::placeholder,
body.tema-escuro .form-inline textarea::placeholder {
    color: #64748b;
}

body.tema-escuro .card.destaque {
    background: linear-gradient(145deg, #101c2e 0%, #0f2f32 100%);
    border-color: #134e4a;
}

body.tema-escuro .card.livre,
body.tema-escuro .card-saldo-total {
    background: linear-gradient(145deg, #0f2f32 0%, #103d3b 100%);
    border-color: #0f766e;
}

body.tema-escuro .card-gasto {
    background: linear-gradient(145deg, #2a1115 0%, #3a1519 100%);
    border-color: #7f1d1d;
}

body.tema-escuro .card-pendente {
    background: linear-gradient(145deg, #2e210d 0%, #3a2a10 100%);
    border-color: #92400e;
}

body.tema-escuro .card-guardado {
    background: linear-gradient(145deg, #0d1d33 0%, #10284a 100%);
    border-color: #1d4ed8;
}

body.tema-escuro .card-investido {
    background: linear-gradient(145deg, #20113a 0%, #2a1948 100%);
    border-color: #6d28d9;
}

body.tema-escuro .card.destaque strong,
body.tema-escuro .card.livre strong,
body.tema-escuro .card-saldo-total strong {
    color: #5eead4;
}

body.tema-escuro .card-gasto strong {
    color: #f87171;
}

body.tema-escuro .card-pendente strong {
    color: #fbbf24;
}

body.tema-escuro .card-guardado strong {
    color: #60a5fa;
}

body.tema-escuro .card-investido strong {
    color: #c4b5fd;
}

body.tema-escuro .status.pendente {
    background: #1e293b;
    color: #cbd5e1;
}

body.tema-escuro .status.realizado {
    background: #0f3226;
    color: #34d399;
}

body.tema-escuro .action-btn.realizar {
    background: #0f3226;
    color: #34d399;
}

body.tema-escuro .action-btn.pendente,
body.tema-escuro .danger-btn {
    background: #3a1519;
    color: #f87171;
}

body.tema-escuro .small-link {
    background: #10284a;
    color: #93c5fd;
}

body.tema-escuro .small-btn,
body.tema-escuro .btn-link {
    background: #e2e8f0;
    color: #0f172a;
}

body.tema-escuro .btn-link.secundario,
body.tema-escuro .btn-limpar {
    background: #1e293b !important;
    color: #cbd5e1 !important;
}

body.tema-escuro .grafico-trilho {
    background: #1e293b;
}

body.tema-escuro .grafico-vazio {
    background: var(--surface-soft);
    color: var(--muted);
}

@media (max-width: 760px) {
    .theme-bar {
        justify-content: stretch;
    }

    .theme-toggle {
        width: 100%;
    }
}

/* ============================================================
   DASHBOARD V5 — alternância quadradinhos / gráficos
   ============================================================ */

.view-toggle {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.view-toggle button {
    height: 30px;
    border: 0;
    border-radius: calc(var(--radius-md) - 3px);
    padding: 0 12px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.view-toggle button.ativo {
    background: var(--primary);
    color: white;
}

.dashboard-graficos {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-graficos.oculto {
    display: none;
}

.grafico-barras {
    display: grid;
    gap: 14px;
}

.grafico-item {
    display: grid;
    gap: 7px;
}

.grafico-info {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.grafico-info span {
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
}

.grafico-info strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.grafico-trilho {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--surface-soft);
    overflow: hidden;
}

.grafico-preenchimento {
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
}

.grafico-preenchimento.teal {
    background: linear-gradient(90deg, #0d9488, #06b6d4);
}

.grafico-preenchimento.verde {
    background: linear-gradient(90deg, #059669, #10b981);
}

.grafico-preenchimento.vermelho {
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.grafico-preenchimento.laranja {
    background: linear-gradient(90deg, #d97706, #f59e0b);
}

.grafico-preenchimento.azul {
    background: linear-gradient(90deg, #2563eb, #3b82f6);
}

.grafico-preenchimento.roxo {
    background: linear-gradient(90deg, #7c3aed, #8b5cf6);
}

.grafico-vazio {
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* Quando estiver no modo gráfico, os cards principais continuam visíveis,
   mas ficam mais compactos para não virar bagunça. */
.modo-graficos-dashboard .dashboard-hero-card {
    min-height: 128px;
}

.modo-graficos-dashboard .dashboard-hero-card strong {
    font-size: 28px;
}

.modo-graficos-dashboard .dashboard-balance-strip .card {
    min-height: 92px;
}

@media (max-width: 1320px) {
    .dashboard-graficos {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .view-toggle {
        width: 100%;
    }

    .view-toggle button {
        flex: 1;
    }
}

/* ============================================================
   DASHBOARD V6 — remove vazios e melhora ocupação visual
   ============================================================ */

/* impede que o painel da esquerda estique na altura da coluna direita */
.dashboard-main-grid {
    align-items: start;
}

/* mantém os blocos de baixo mais naturais */
.dashboard-secondary-grid {
    align-items: start;
}

/* estrutura interna melhor dos painéis */
.panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.panel-header {
    flex-shrink: 0;
}

/* painel principal de lançamentos não deve crescer à toa */
.panel-auto-height {
    align-self: start;
    height: auto;
    min-height: 0;
}

/* painéis compactos da lateral */
.panel-compact {
    padding-bottom: 14px;
}

/* tabelas ocupando melhor a largura do painel */
.panel-fill-table table,
.dashboard-panel-principal table {
    display: table;
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

.panel-fill-table table thead,
.panel-fill-table table tbody,
.panel-fill-table table tr,
.dashboard-panel-principal table thead,
.dashboard-panel-principal table tbody,
.dashboard-panel-principal table tr {
    width: auto;
}

/* deixa a tabela principal mais “cheia” e evita aspecto sobrando */
.dashboard-panel-principal table {
    min-width: 980px;
}

/* tabelas menores usam toda a largura do card */
.dashboard-side .panel-fill-table table,
.dashboard-secondary-grid .panel-fill-table table {
    min-width: 100%;
}

/* menos sensação de vazio */
.dashboard-side .panel,
.dashboard-secondary-grid .panel {
    min-height: 0;
}

/* melhora a leitura das linhas */
.dashboard-side tbody td,
.dashboard-secondary-grid tbody td {
    padding-top: 12px;
    padding-bottom: 12px;
}

/* a tabela principal pode continuar sem quebrar linha */
.dashboard-panel-principal tbody td,
.dashboard-panel-principal thead th {
    white-space: nowrap;
}

/* tabelas menores podem respirar melhor */
.dashboard-side tbody td,
.dashboard-side thead th,
.dashboard-secondary-grid tbody td,
.dashboard-secondary-grid thead th {
    white-space: nowrap;
}

/* cabeçalhos mais bem distribuídos */
.dashboard-side .panel-header,
.dashboard-secondary-grid .panel-header {
    margin-bottom: 14px;
}

/* dá sensação de preenchimento sem exagerar no espaço */
.dashboard-side .panel {
    padding-top: 18px;
    padding-bottom: 16px;
}

/* melhora visual quando há poucas linhas */
.dashboard-side table tbody tr:last-child td,
.dashboard-secondary-grid table tbody tr:last-child td,
.dashboard-panel-principal table tbody tr:last-child td {
    border-bottom: 0;
}

/* se houver pouco conteúdo, o painel continua elegante */
.panel-fill-table {
    overflow: hidden;
}

/* tabelas com uma linha só ficam mais centralizadas visualmente */
.panel-fill-table table tbody td {
    vertical-align: middle;
}

/* ajuste fino no desktop grande */
@media (min-width: 1200px) {
    .dashboard-secondary-grid .panel {
        padding-right: 20px;
    }
}

/* tablet */
@media (max-width: 1320px) {
    .dashboard-panel-principal table {
        min-width: 860px;
    }
}

/* mobile */
@media (max-width: 900px) {
    .panel-fill-table table,
    .dashboard-panel-principal table {
        min-width: 100%;
    }

    .dashboard-panel-principal {
        align-self: stretch;
    }
}

/* ============================================================
   DASHBOARD V7 — altura proporcional e ações melhores
   ============================================================ */

/* mantém a linha principal proporcional */
.dashboard-main-grid {
    align-items: stretch;
}

/* painel esquerdo acompanha a altura da coluna da direita */
.panel-match-side {
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* dá mais respiro interno para não parecer “jogado” */
.panel-match-side table {
    margin-top: 6px;
}

/* ocupa bem o espaço sem ficar esmagado */
.panel-match-side .panel-header {
    margin-bottom: 12px;
}

/* mantém o conteúdo no topo e deixa o restante respirar */
.panel-match-side tbody tr:last-child td {
    border-bottom: 0;
}

/* coluna de ações */
.acoes-cell {
    width: 190px;
    min-width: 190px;
    padding-right: 16px !important;
}

/* botões organizados */
.acoes-stack {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

/* botão editar menor e mais alinhado */
.acoes-stack .small-link {
    margin-right: 0;
}

/* botão de ação sem esmagar */
.acoes-stack .action-btn {
    margin: 0;
}

/* melhora visual geral da tabela principal */
.dashboard-panel-principal table {
    width: 100%;
    min-width: 100%;
    table-layout: auto;
}

/* evita que a última coluna grude na borda */
.dashboard-panel-principal thead th:last-child,
.dashboard-panel-principal tbody td:last-child {
    padding-right: 18px;
}

/* quando houver pouco conteúdo, o bloco continua elegante */
.dashboard-panel-principal {
    overflow: hidden;
}

/* tablets */
@media (max-width: 1100px) {
    .acoes-cell {
        width: 170px;
        min-width: 170px;
    }
}

/* mobile */
@media (max-width: 760px) {
    .dashboard-main-grid {
        align-items: start;
    }

    .panel-match-side {
        height: auto;
        min-height: 0;
    }

    .acoes-cell {
        width: auto;
        min-width: 140px;
    }

    .acoes-stack {
        justify-content: flex-start;
        flex-direction: column;
        align-items: stretch;
    }

    .acoes-stack .small-link,
    .acoes-stack .action-btn {
        width: 100%;
        text-align: center;
    }
}
/* ============================================================
   FORMULÁRIOS — página full width para Nova Transação
   ============================================================ */

.form-page-full {
    max-width: none;
    width: 100%;
}

.form-page-full .form-card {
    width: 100%;
}

.form-page-full .topbar,
.form-page-full .form-grid,
.form-page-full .form-actions {
    width: 100%;
}

/* melhora a distribuição dos campos */
.form-page-full .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

/* se tiver blocos de uma coluna, continuam normais */
.form-page-full .form-grid-1 {
    grid-template-columns: 1fr;
}

/* em telas grandes, faz o formulário realmente ocupar tudo */
@media (min-width: 1200px) {
    .form-page-full {
        width: 100%;
        max-width: 100%;
    }
}

/* no tablet/mobile mantém comportamento responsivo */
@media (max-width: 900px) {
    .form-page-full .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   AJUSTE FINAL — ocupar melhor o espaço disponível
   ============================================================ */

/* Painéis devem deixar o conteúdo respirar e permitir rolagem só quando precisar */
.panel {
    width: 100%;
    overflow-x: auto;
}

/* Tabelas padrão passam a ocupar 100% do painel */
.panel table {
    display: table;
    width: 100%;
    min-width: 100%;
    table-layout: auto;
}

/* Corrige casos onde o thead/tbody ficaram estreitos por causa de regra antiga */
.panel table thead,
.panel table tbody,
.panel table tr {
    width: 100%;
}

/* Células com distribuição mais estável */
.panel table th,
.panel table td {
    white-space: nowrap;
}

/* Tabelas simples com poucas colunas ficam visualmente preenchidas */
.panel table:not(.tabela-matriz) th,
.panel table:not(.tabela-matriz) td {
    min-width: 110px;
}

/* Primeira coluna um pouco mais forte visualmente */
.panel table:not(.tabela-matriz) th:first-child,
.panel table:not(.tabela-matriz) td:first-child {
    min-width: 130px;
}

/* Coluna de ações com espaço suficiente */
.panel table th:last-child,
.panel table td:last-child {
    min-width: 150px;
}

/* Ações sem estourar para fora */
.acoes-cell {
    width: 160px;
    min-width: 160px;
}

.acoes-stack {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
}

.acoes-stack .small-link,
.acoes-stack .action-btn,
.acoes-stack .danger-btn,
.acoes-stack .small-btn {
    margin: 0;
    flex-shrink: 0;
}

/* Dashboard: painel principal encaixado com a altura da lateral */
.dashboard-main-grid {
    align-items: stretch;
}

.panel-match-side {
    height: 100%;
    min-height: 100%;
}

/* Remove a sensação de tabela jogada para a esquerda */
.dashboard-panel-principal table {
    width: 100%;
    min-width: 100%;
}

/* Em tabelas pequenas da lateral, distribui melhor */
.dashboard-side table {
    table-layout: fixed;
}

.dashboard-side table th,
.dashboard-side table td {
    width: auto;
}

/* Situação geral e visão anual podem rolar se passarem da tela */
.dashboard-secondary-grid .panel {
    overflow-x: auto;
}

.dashboard-secondary-grid table {
    min-width: 900px;
}

/* Visão anual precisa de largura mínima para não amassar os meses */
.tabela-matriz {
    min-width: 980px;
    width: 100%;
}

/* Transações: tabela ocupa painel todo */
#tabelaTransacoes {
    width: 100%;
}

/* Lançamentos: tabela ocupa painel todo */
#tabelaLancamentos {
    width: 100%;
}

/* ============================================================
   FORMULÁRIOS COMPACTOS — preencher melhor bancos/categorias/contas/desejos
   ============================================================ */

.form-inline-compacto {
    width: 100%;
}

/* Troca o flex por grid onde faz sentido */
.form-inline-row {
    width: 100%;
}

/* Banco */
#formBanco .form-inline-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    align-items: end;
    gap: 10px;
}

/* Categoria */
#formCategoria .form-inline-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(150px, 220px) auto auto;
    align-items: end;
    gap: 10px;
}

/* Conta */
#formConta .form-inline-row {
    display: grid;
    grid-template-columns:
        minmax(130px, 0.8fr)
        minmax(260px, 2fr)
        minmax(160px, 1fr)
        minmax(150px, 1fr)
        auto
        auto;
    align-items: end;
    gap: 10px;
}

/* Lista de desejos — primeira linha */
#formDesejo .form-inline-row-wrap {
    display: grid;
    grid-template-columns:
        minmax(150px, 1fr)
        minmax(220px, 1.4fr)
        minmax(130px, 0.8fr)
        minmax(150px, 0.9fr)
        minmax(220px, 1.4fr)
        auto
        auto;
    align-items: end;
    gap: 10px;
}

/* Lista de desejos — observação ocupa largura total */
#formDesejo .form-inline-row:not(.form-inline-row-wrap) {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* Labels e inputs precisam ocupar todo o espaço da célula */
.form-inline-row label,
.form-inline-row label.grow,
.form-inline-row input,
.form-inline-row select,
.form-inline-row textarea {
    width: 100%;
    min-width: 0;
}

/* Botões no final alinhados */
.form-inline-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: end;
    width: auto;
}

/* Checkbox não deve criar buraco enorme */
.checkbox-line-inline {
    width: auto !important;
    min-width: fit-content !important;
    justify-content: flex-start;
}

/* ============================================================
   PLANEJAMENTO — resumo anual e lista ocupando melhor o painel
   ============================================================ */

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

/* tabela do resumo anual estica */
#tabelaResumoMensal {
    width: 100%;
}

/* lista de desejos estica */
#tabelaDesejos {
    width: 100%;
}

/* Quando uma tabela tem poucas colunas, ela não fica grudada na esquerda */
#tabelaResumoMensal td,
#tabelaResumoMensal th,
#tabelaDesejos td,
#tabelaDesejos th {
    min-width: 130px;
}

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

@media (max-width: 1200px) {
    #formConta .form-inline-row,
    #formDesejo .form-inline-row-wrap {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #formBanco .form-inline-row,
    #formCategoria .form-inline-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-inline-btns {
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .panel table {
        min-width: 760px;
    }

    .dashboard-side table {
        table-layout: auto;
    }

    #formBanco .form-inline-row,
    #formCategoria .form-inline-row,
    #formConta .form-inline-row,
    #formDesejo .form-inline-row-wrap {
        grid-template-columns: 1fr;
    }

    .form-inline-btns {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline-btns button {
        width: 100%;
    }

    .checkbox-line-inline {
        min-height: 36px;
        padding-top: 0;
    }

    .acoes-cell {
        width: auto;
        min-width: 140px;
    }

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

    .acoes-stack .small-link,
    .acoes-stack .action-btn,
    .acoes-stack .danger-btn,
    .acoes-stack .small-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   EDITAR TRANSAÇÃO — alteração de fixo por período
   ============================================================ */

.form-help {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.form-periodo-action {
    display: flex;
    align-items: end;
}

.form-periodo-action button {
    width: 100%;
    min-height: 40px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 0 18px;
    background: var(--primary);
    color: white;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}

.form-periodo-action button:hover {
    background: var(--primary-dark);
}

@media (max-width: 900px) {
    .form-periodo-action {
        align-items: stretch;
    }
}

/* Botão da alteração por período */
.btn-periodo,
.form-periodo-action button {
    width: 100%;
    min-height: 40px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 0 18px;
    background: var(--primary);
    color: white;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}

.btn-periodo:hover,
.form-periodo-action button:hover {
    background: var(--primary-dark);
}

.btn-periodo:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Resetar período junto do botão Filtrar */
.filter-action-dupla {
    display: flex;
    gap: 10px;
    align-items: end;
}

.filter-action-dupla button {
    width: auto;
}

.btn-reset-periodo {
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 18px;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}

.btn-reset-periodo:hover {
    border-color: var(--primary);
    color: var(--primary);
}

body.tema-escuro .btn-reset-periodo {
    background: #1e293b;
    color: #cbd5e1;
    border-color: #334155;
}

body.tema-escuro .btn-reset-periodo:hover {
    color: #5eead4;
    border-color: #2dd4bf;
}

@media (max-width: 760px) {
    .filter-action-dupla {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-action-dupla button {
        width: 100%;
    }
}
/* Ações compactas em campos de formulário. */
.campo-com-acao {
    display: flex;
    gap: 8px;
    align-items: center;
}

.campo-com-acao select {
    flex: 1;
}

.btn-nova-categoria {
    white-space: nowrap;
}

.modal-categoria {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.48);
}

.modal-categoria.aberto {
    display: flex;
}

.modal-categoria-dialog {
    width: min(100%, 460px);
    padding: 24px;
    border-radius: 16px;
    background: var(--card, #ffffff);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}

.modal-categoria-cabecalho,
.modal-categoria-acoes {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-categoria-cabecalho {
    margin-bottom: 20px;
}

.modal-categoria-dialog form {
    display: grid;
    gap: 14px;
}

.modal-fechar {
    min-width: auto;
    padding: 2px 8px;
    font-size: 24px;
    line-height: 1;
    background: transparent;
    color: inherit;
}

.modal-categoria-acoes {
    justify-content: flex-end;
    margin-top: 6px;
}

@media (max-width: 640px) {
    .campo-com-acao {
        align-items: stretch;
        flex-direction: column;
    }

    .btn-nova-categoria {
        width: 100%;
    }
}


/* ============================================================
   DASHBOARD CONSOLIDADO E PÁGINAS DE BANCOS
   ============================================================ */
.table-scroll {
    overflow-x: auto;
}

.tabela-resumo {
    min-width: 760px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-realizado {
    color: var(--green-dark);
    background: var(--green-soft);
}

.status-pendente {
    color: var(--orange-dark);
    background: var(--orange-soft);
}

.status-neutro {
    color: var(--muted);
    background: var(--surface-soft);
}

.muted-text {
    color: var(--muted);
    font-size: 12px;
}

.bank-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}

.bank-list-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.bank-list-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.bank-list-card h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.02em;
}

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

.bank-list-values div {
    display: grid;
    gap: 2px;
    padding: 11px;
    background: var(--surface-soft);
    border-radius: var(--radius-sm);
}

.bank-list-values span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.bank-list-values strong {
    font-size: 15px;
    letter-spacing: -0.02em;
}

.bank-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 22px;
}

@media (max-width: 1000px) {
    .bank-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .bank-summary-grid,
    .bank-list-values {
        grid-template-columns: 1fr;
    }

    .bank-list-card-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ============================================================
   HISTÓRICO NA PÁGINA INDIVIDUAL DO BANCO
   ============================================================ */
.banco-page-actions {
    align-items: flex-end;
}

.banco-page-actions > .btn-link {
    white-space: nowrap;
}

.historico-banco-panel {
    margin-top: 22px;
}

.tabela-historico-banco {
    min-width: 1180px;
}

.historico-contador {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.status-cancelado {
    color: var(--danger, #a63f3f);
    background: var(--danger-soft, #fde9e9);
}

.contexto-banco-transacao {
    margin: 0 0 18px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary, #3f7cf0);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface-soft);
    font-size: 14px;
    line-height: 1.45;
}

@media (max-width: 920px) {
    .banco-page-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .banco-page-actions > .btn-link {
        width: 100%;
        text-align: center;
    }
}
