/* ============================================================
   Finance Planner — Design System
   Padrão visual alinhado com o Crédito Fácil / JDLC
   ============================================================ */

:root {
  --navy:     #0f2744;
  --blue:     #1e56a0;
  --sky:      #3b82f6;
  --green:    #16a34a;
  --emerald:  #059669;
  --red:      #dc2626;
  --amber:    #d97706;
  --slate:    #64748b;
  --surface:  #f8fafc;
  --white:    #ffffff;
  --border:   #e2e8f0;
  --text:     #0f172a;
  --text-muted: #64748b;

  --radius:   10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,.10);
  --font:     'Inter', system-ui, sans-serif;
  --sidebar-w: 230px;
}

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

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout principal ──────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-icon {
  width: 32px; height: 32px;
  background: var(--blue);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 15px;
}
.logo-text {
  font-weight: 700;
  font-size: 15px;
  color: var(--navy);
  letter-spacing: -.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--slate);
  font-weight: 500;
  font-size: 13.5px;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface); color: var(--navy); text-decoration: none; }
.nav-item.active { background: #dbeafe; color: var(--blue); }
.nav-item i { width: 16px; text-align: center; font-size: 14px; }

.sidebar-bottom {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.user-avatar {
  width: 32px; height: 32px;
  background: #dbeafe;
  color: var(--blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name  { display: block; font-size: 12px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { display: block; font-size: 11px; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { color: var(--slate); transition: color .15s; }
.btn-logout:hover { color: var(--red); text-decoration: none; }

/* ── Main content ──────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { flex: 1; font-weight: 600; font-size: 15px; color: var(--navy); }
.sidebar-toggle { background: none; border: none; font-size: 18px; color: var(--slate); cursor: pointer; }
.topbar-bell { color: var(--slate); position: relative; font-size: 16px; }

.page-content { padding: 28px 32px; flex: 1; }

/* ── Cards ─────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 16px;
}

/* Cartões de resumo (dashboard) */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.summary-card {
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: none;
  box-shadow: var(--shadow);
}
.summary-card .sc-label { font-size: 12px; color: var(--slate); margin-bottom: 6px; }
.summary-card .sc-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-income  { background: #f0fdf4; } .sc-income  .sc-value { color: var(--green); }
.sc-expense { background: #fef2f2; } .sc-expense .sc-value { color: var(--red);   }
.sc-balance { background: #eff6ff; } .sc-balance .sc-value { color: var(--blue);  }
.sc-savings { background: #ecfdf5; } .sc-savings .sc-value { color: var(--emerald);}
.sc-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  margin-bottom: 10px;
}
.sc-income  .sc-icon { background: #dcfce7; color: var(--green);   }
.sc-expense .sc-icon { background: #fee2e2; color: var(--red);     }
.sc-balance .sc-icon { background: #dbeafe; color: var(--blue);    }
.sc-savings .sc-icon { background: #d1fae5; color: var(--emerald); }

/* ── Botões ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  font-family: var(--font);
  text-decoration: none;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--blue);   color: #fff; }
.btn-primary:hover { background: var(--navy); }
.btn-secondary { background: #f1f5f9; color: #475569; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger    { background: var(--red);    color: #fff; }
.btn-success   { background: var(--green);  color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Formulários ────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.form-control::placeholder { color: #adb5bd; }
.form-text { font-size: 12px; color: var(--slate); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; }

/* Prefixo R$ */
.input-prefix { position: relative; }
.input-prefix::before { content: 'R$'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--slate); }
.input-prefix .form-control { padding-left: 34px; }

/* ── Tabelas ─────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table.fp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.fp-table thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--slate);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.fp-table tbody td { padding: 11px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.fp-table tbody tr:last-child td { border-bottom: none; }
.fp-table tbody tr:hover td { background: var(--surface); }

/* ── Badges ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 500;
}
.badge-income  { background: #dcfce7; color: #166534; }
.badge-expense { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-rascunho  { background: #f1f5f9; color: #475569; }
.badge-publicado { background: #dcfce7; color: #166534; }
.badge-arquivado { background: #fee2e2; color: #991b1b; }

/* Número no sino */
.badge-dot {
  position: absolute;
  top: -4px; right: -6px;
  min-width: 16px; height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ── Progresso ───────────────────────────────────── */
.progress-bar { background: #e2e8f0; border-radius: 99px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }
.progress-ok       { background: var(--emerald); }
.progress-warning  { background: var(--amber);   }
.progress-exceeded { background: var(--red);     }

/* ── Flash messages ─────────────────────────────── */
.flash-message {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 9999;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  max-width: 360px;
  animation: slideInRight .25s ease;
}
.flash-message button { margin-left: auto; background: none; border: none; cursor: pointer; opacity: .6; font-size: 14px; }
.flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
@keyframes slideInRight { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Cabeçalho de página ────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--navy); }
.page-header p  { font-size: 13px; color: var(--slate); margin-top: 2px; }

/* ── Modal ───────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  margin: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 600; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 18px; color: var(--slate); cursor: pointer; }
.modal-body   { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Paginação ───────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--slate);
  text-decoration: none;
  transition: background .15s;
}
.pagination a:hover { background: var(--surface); text-decoration: none; }
.pagination .current { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── Páginas de auth ─────────────────────────────── */
body.auth-page { background: var(--surface); }
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-icon { margin: 0 auto 10px; width: 44px; height: 44px; font-size: 20px; }
.auth-logo h1 { font-size: 20px; font-weight: 700; color: var(--navy); }
.auth-logo p  { font-size: 13px; color: var(--slate); margin-top: 4px; }
.auth-footer  { text-align: center; margin-top: 20px; font-size: 13px; color: var(--slate); }

/* ── Landing page ────────────────────────────────── */
body.landing { background: #fff; }
.landing-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  height: 62px;
  display: flex; align-items: center; justify-content: space-between;
}
.landing-nav .nav-links { display: flex; gap: 28px; }
.landing-nav .nav-links a { font-size: 14px; color: var(--slate); font-weight: 500; }
.landing-nav .nav-links a:hover { color: var(--navy); text-decoration: none; }
.landing-hero { max-width: 680px; padding: 80px 40px 60px; }
.landing-hero h1 { font-size: 52px; font-weight: 800; color: var(--navy); line-height: 1.1; letter-spacing: -1px; margin-bottom: 18px; }
.landing-hero h1 span { color: var(--blue); }
.landing-hero p { font-size: 18px; color: var(--slate); line-height: 1.7; margin-bottom: 32px; max-width: 480px; }
.landing-hero .hero-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.landing-section { padding: 72px 40px; }
.landing-section h2 { font-size: 32px; font-weight: 700; color: var(--navy); text-align: center; margin-bottom: 10px; }
.landing-section .section-sub { text-align: center; color: var(--slate); margin-bottom: 48px; max-width: 520px; margin-left: auto; margin-right: auto; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 1040px; margin: 0 auto; }
.feature-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s;
}
.feature-card:hover { box-shadow: var(--shadow-md); }
.feature-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 14px; }
.feature-card h3 { font-size: 15px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.feature-card p  { font-size: 13px; color: var(--slate); line-height: 1.65; }
.landing-dark { background: var(--navy); }
.landing-dark h2, .landing-dark p { color: #fff !important; }
.landing-dark .section-sub { color: #94a3b8 !important; }
.stats-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
.stat-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-lg); padding: 20px; }
.stat-card .stat-value { font-size: 30px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 12px; color: #94a3b8; }

/* ── Responsivo ──────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-md); }
  .main-content { margin-left: 0; }
  .topbar { display: flex; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
  .landing-hero h1 { font-size: 36px; }
  .landing-hero { padding: 48px 20px 40px; }
  .landing-section { padding: 48px 20px; }
  .landing-nav { padding: 0 20px; }
  .landing-nav .nav-links { display: none; }
  .page-content { padding: 20px 16px; }
  .auth-card { padding: 28px 22px; }
}

@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Utilitários ─────────────────────────────────── */
.text-income  { color: var(--green)  !important; }
.text-expense { color: var(--red)    !important; }
.text-muted   { color: var(--slate)  !important; }
.text-navy    { color: var(--navy)   !important; }
.text-blue    { color: var(--blue)   !important; }
.text-right   { text-align: right;  }
.text-center  { text-align: center; }
.fw-bold      { font-weight: 700; }
.fw-semibold  { font-weight: 600; }
.font-mono    { font-variant-numeric: tabular-nums; }
.mt-8  { margin-top: 8px;  } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--slate); }
.empty-state i { font-size: 36px; margin-bottom: 12px; opacity: .3; display: block; }
.empty-state p { margin-bottom: 16px; }
