
/* Finanças Mestre · ECS — mesma identidade do Estoque Pro */
:root {
  --bg: #f4f6f9;
  --bg-card: #ffffff;
  --border: #e5e9f0;
  --border-gold: rgba(184, 148, 42, 0.4);
  --gold: #b8942a;
  --gold-light: #c9a227;
  --gold-dark: #8a7020;
  --text: #1a2332;
  --text-muted: #6b7280;
  --sidebar-bg: #1a2332;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --orange: #ea580c;
  --orange-bg: #ffedd5;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --shadow: 0 4px 20px rgba(26, 35, 50, 0.06);
  --shadow-gold: 0 4px 20px rgba(184, 148, 42, 0.12);
  --radius: 12px;
  --sidebar: 260px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }

/* Login */
.login-screen {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #1a2332 0%, #2c3e50 50%, #1a2332 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 16px;
  padding: 28px 24px; box-shadow: var(--shadow-gold);
  border: 1px solid var(--border-gold);
}
.login-logo { display: block; width: 72px; height: 72px; object-fit: contain; margin: 0 auto 12px; }
.login-card h1 {
  color: var(--gold-dark); font-size: 20px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; text-align: center; margin: 0 0 4px;
}
.login-sub { text-align: center; font-size: 12px; color: var(--text-muted); margin: 0 0 18px; }
.login-card label { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); margin: 10px 0 4px; }
.login-card input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit;
}
.login-card input:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,148,42,.15);
}
.btn-block { width: 100%; margin-top: 16px; }
.login-hint { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 12px; }
.login-footer-brand {
  margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gold-dark); text-align: center; font-weight: 700;
}

/* App shell */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); background: var(--sidebar-bg); color: #e8eef5;
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  display: flex; flex-direction: column; padding: 16px 12px;
  transform: translateX(0); transition: transform .2s;
}
.sidebar-brand {
  display: flex; gap: 10px; align-items: center; padding: 6px 8px 16px;
  border-bottom: 1px solid rgba(184,148,42,.25); margin-bottom: 8px;
}
.sidebar-brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; }
.brand-text {
  font-weight: 700; font-size: 12px; letter-spacing: 0.06em;
  color: var(--gold-light); text-transform: uppercase;
}
.sidebar-brand small { display: block; font-size: 10px; opacity: .65; }
.nav-section {
  padding: 12px 12px 4px; font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--gold); font-weight: 700; opacity: .9;
}
.nav-item {
  display: flex; align-items: center; gap: 8px;
  color: #c5d0dc; text-decoration: none; padding: 10px 12px;
  border-radius: 8px; font-size: 13px; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: rgba(184,148,42,.15); color: var(--gold-light);
  border-left-color: var(--gold); font-weight: 600;
}
.nav-icon { width: 1.25em; text-align: center; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.user-label { font-size: 11px; color: #94a3b8; margin-bottom: 8px; padding: 0 4px; }
.btn-ghost {
  width: 100%; background: transparent; border: 1px solid rgba(184,148,42,.35);
  color: var(--gold-light); border-radius: 8px; padding: 8px; cursor: pointer; font: inherit; font-size: 12px;
}
.main { margin-left: var(--sidebar); flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 17px; flex: 1; font-weight: 700; }
.clock { font-size: 11px; color: var(--text-muted); }
.btn-menu {
  display: none; background: rgba(184,148,42,.1); border: 1px solid var(--border-gold);
  color: var(--gold-dark); width: 40px; height: 40px; border-radius: 10px; font-size: 18px; cursor: pointer;
}
.content { padding: 16px 18px 48px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.card-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.card-value { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.card-value.pos { color: var(--green); }
.card-value.neg { color: var(--red); }
.panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(184,148,42,.06), transparent);
}
.panel-header h3 { margin: 0; font-size: 14px; font-weight: 700; }
.panel-body { padding: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
input, select, textarea {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,148,42,.12);
}
.btn {
  border: 0; border-radius: 10px; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-light)); color: #fff;
  box-shadow: var(--shadow-gold);
}
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
th {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
}
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.badge-pago { background: var(--green-bg); color: #166534; }
.badge-pend { background: var(--orange-bg); color: #9a3412; }
.badge-rec { background: var(--green-bg); color: #166534; }
.badge-fix { background: var(--orange-bg); color: #9a3412; }
.badge-var { background: var(--red-bg); color: #991b1b; }
.section-title {
  margin: 16px 0 8px; padding: 8px 10px; border-radius: 10px; font-size: 12px; font-weight: 800;
}
.section-rec { background: var(--green-bg); color: #166534; }
.section-fix { background: var(--orange-bg); color: #9a3412; }
.section-var { background: var(--red-bg); color: #991b1b; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #1a2332; color: #fff; padding: 12px 16px; border-radius: 12px; z-index: 100;
  box-shadow: var(--shadow); max-width: 90vw; font-size: 13px;
}
.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }
.month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.month-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; cursor: pointer; transition: .15s;
}
.month-card:hover { border-color: var(--gold); box-shadow: var(--shadow-gold); }
.month-card strong { display: block; margin-bottom: 6px; }
.month-card span { font-size: 12px; color: var(--text-muted); display: block; }
.empty { text-align: center; color: var(--text-muted); padding: 24px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: #fff;
}
.plan-card.featured {
  border-color: var(--gold); box-shadow: var(--shadow-gold);
  background: linear-gradient(180deg, rgba(184,148,42,.08), #fff);
}
.plan-card h4 { margin: 0 0 6px; color: var(--gold-dark); }
.plan-card ul { margin: 10px 0; padding-left: 18px; font-size: 13px; color: var(--text-muted); }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30;
}
@media (max-width: 960px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .form-grid, .plan-grid { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-105%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .main { margin-left: 0; }
  .btn-menu { display: inline-grid; place-items: center; }
}
@media (max-width: 520px) {
  .cards { grid-template-columns: 1fr; }
}

/* Matriz categorias (planilha) */
.matriz-wrap { overflow-x: auto; }
table.matriz-cat { font-size: 12px; min-width: 900px; }
table.matriz-cat th { position: sticky; top: 0; background: #1a2332; color: #c9a227; z-index: 1; white-space: nowrap; }
table.matriz-cat td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.matriz-cat td.zero { color: #94a3b8; }
table.matriz-cat .cat-name { font-weight: 600; white-space: nowrap; }
table.matriz-cat tr.sec td { background: #1a2332; color: #c9a227; font-weight: 700; letter-spacing: .04em; font-size: 11px; }
table.matriz-cat tr.row-rec { background: #f0fdf4; }
table.matriz-cat tr.row-desp { background: #fff7ed; }
table.matriz-cat tr.tot-row { background: #f1f5f9; font-weight: 700; }
table.matriz-cat tr.tot-row td { border-top: 2px solid #b8942a; }

.card-highlight { border-color: rgba(184,148,42,.45); box-shadow: var(--shadow-gold); }
.card-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* PWA install banner */
.install-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9999;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(26, 35, 50, 0.97);
  color: #fff;
  box-shadow: 0 -8px 24px rgba(0,0,0,.2);
}
.install-banner.hidden { display: none !important; }
.install-banner-inner {
  max-width: 720px; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
}
.install-banner-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.install-banner-text strong { color: #c9a227; font-size: 14px; }
.install-banner-text span { opacity: .85; font-size: 12px; }
.install-banner-actions { display: flex; gap: 8px; }
.install-banner .btn-outline { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; }

/* PWA install banner */
.pwa-install {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 9999;
  background: #1a2332; color: #fff; border-radius: 14px;
  border: 1px solid rgba(184,148,42,.5);
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  padding: 12px 14px; max-width: 420px; margin: 0 auto;
}
.pwa-install-inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pwa-install-text { flex: 1; min-width: 140px; }
.pwa-install-text strong { display: block; color: #c9a227; font-size: 14px; }
.pwa-install-text span { font-size: 12px; opacity: .85; }
.pwa-install-actions { display: flex; gap: 8px; }
.pwa-install-hint { margin: 8px 0 0; font-size: 11px; opacity: .9; line-height: 1.4; }

/* ===== Comercial EC$ 360 ===== */
.landing {
  min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(ellipse at top, #1a2332 0%, #0a0a0c 55%);
  color: #f5f5f5; padding: 24px 16px 40px;
}
.landing-hero { max-width: 480px; margin: 0 auto; text-align: center; }
.landing-hero .brand { color: #c9a227; letter-spacing: .12em; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.landing-hero h1 { font-size: 1.75rem; margin: 8px 0 12px; line-height: 1.25; }
.landing-hero p.lead { color: #a8a29a; font-size: 15px; line-height: 1.5; margin-bottom: 20px; }
.landing-benefits { text-align: left; max-width: 420px; margin: 0 auto 24px; }
.landing-benefits li { margin: 10px 0; font-size: 14px; color: #e7e5e4; list-style: none; padding-left: 28px; position: relative; }
.landing-benefits li::before { content: "✓"; position: absolute; left: 0; color: #c9a227; font-weight: 700; }
.plan-cards { display: grid; gap: 12px; max-width: 420px; margin: 0 auto 20px; }
.plan-card {
  background: #1a1a1a; border: 1px solid #333; border-radius: 14px; padding: 16px; text-align: left;
}
.plan-card.featured { border-color: #c9a227; box-shadow: 0 0 0 1px rgba(201,162,39,.35); }
.plan-card h3 { margin: 0 0 4px; color: #c9a227; font-size: 15px; }
.plan-card .price { font-size: 1.5rem; font-weight: 700; margin: 6px 0; }
.plan-card .price span { font-size: 13px; font-weight: 500; color: #a8a29a; }
.plan-card ul { margin: 8px 0 0; padding-left: 18px; color: #a8a29a; font-size: 13px; }
.trial-banner {
  background: linear-gradient(90deg, #1a2332, #2a2210);
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 10px; padding: 10px 14px; margin: 12px 16px;
  font-size: 13px; color: #e8d48b; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center;
}
.trial-banner strong { color: #c9a227; }
.onboarding-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.onboarding-card {
  background: #12151c; border: 1px solid #333; border-radius: 16px;
  max-width: 420px; width: 100%; padding: 22px; color: #f5f5f5;
  max-height: 90vh; overflow: auto;
}
.onboarding-card h2 { margin: 0 0 8px; font-size: 1.25rem; }
.onboarding-card .step { color: #c9a227; font-size: 12px; letter-spacing: .08em; font-weight: 700; margin-bottom: 6px; }
.onboarding-card label { display: block; font-size: 12px; color: #a8a29a; margin: 12px 0 4px; }
.onboarding-card input, .onboarding-card select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #333;
  background: #0a0a0c; color: #fff; font: inherit;
}
.onboarding-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.empty-state {
  text-align: center; padding: 40px 20px; color: #a8a29a;
}
.empty-state h3 { color: #f5f5f5; margin-bottom: 8px; }
.badge-plano {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: rgba(201,162,39,.15); color: #c9a227; font-size: 11px; font-weight: 700;
}
.cta-upgrade {
  margin: 12px 0; padding: 12px; border-radius: 10px;
  background: rgba(201,162,39,.08); border: 1px dashed rgba(201,162,39,.4);
  font-size: 13px;
}


/* Módulo Investimentos — contraste legível (tema claro do app) */
.inv-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media(min-width:720px){ .inv-grid { grid-template-columns: 1fr 1fr; } }
.inv-card {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.inv-card h4 { margin: 0 0 6px; color: var(--gold-dark, #8a7020); font-size: 15px; font-weight: 700; }
.inv-card .rate { font-size: 1.35rem; font-weight: 700; color: var(--text, #1a2332); }
.inv-card .rate small { font-size: 12px; color: var(--text-muted, #6b7280); font-weight: 500; }
.inv-card .meta { font-size: 13px; color: var(--text-muted, #4b5563); margin-top: 8px; line-height: 1.45; }
.inv-badge {
  display: inline-block; font-size: 10px; padding: 3px 8px; border-radius: 999px;
  background: #f5f0e0; color: #8a7020; font-weight: 700; margin-left: 6px;
}
.inv-badge.safe { background: #dcfce7; color: #166534; }
.inv-badge.warn { background: #fee2e2; color: #991b1b; }
.inv-sim { display: grid; gap: 10px; }
.inv-sim label { font-size: 12px; color: var(--text-muted, #4b5563); font-weight: 600; }
.inv-sim input, .inv-sim select {
  width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border, #d1d5db);
  background: #fff; color: var(--text, #1a2332); font: inherit; font-size: 15px;
}
.inv-sim input:focus, .inv-sim select:focus {
  outline: none; border-color: var(--gold, #c9a227); box-shadow: 0 0 0 3px rgba(184,148,42,.2);
}
.inv-result {
  margin-top: 12px; padding: 16px; border-radius: 12px;
  background: #1a2332; border: 1px solid #c9a227;
  color: #f5f5f5;
}
.inv-result .big { font-size: 1.6rem; font-weight: 700; color: #e8d48b; }
.inv-result strong { color: #fff; }
.inv-edu {
  font-size: 14px; color: #374151; line-height: 1.55; padding: 14px;
  border-left: 4px solid var(--gold-dark, #8a7020);
  background: #faf6eb; border-radius: 0 10px 10px 0;
  margin: 12px 0;
}
.inv-edu strong { color: #1a2332; }
.inv-table {
  width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 12px;
  background: #fff; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border, #e5e7eb);
}
.inv-table th {
  text-align: left; color: #1a2332; padding: 12px 10px;
  border-bottom: 2px solid #c9a227; background: #faf6eb;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
}
.inv-table td {
  padding: 12px 10px; border-bottom: 1px solid #e5e7eb;
  color: #1a2332; font-weight: 500;
}
.inv-table td:nth-child(2),
.inv-table td:nth-child(3) { font-variant-numeric: tabular-nums; font-weight: 600; }
.inv-table tr:last-child td { border-bottom: none; }
.inv-table tr:hover td { background: #f9fafb; }
/* ganho na tabela — cor via inline; reforço */
.inv-table .ganho-pos { color: #166534 !important; font-weight: 700; }
.panel-body .inv-table + p,
.panel-body ol { color: #374151; }

/* Marca EC$ 360° em todas as telas */
.ecs-brand-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: #0a0a0c; border-bottom: 1px solid rgba(201,162,39,.35);
}
.ecs-brand-bar img { height: 36px; width: auto; max-width: 120px; object-fit: contain; }
.ecs-brand-bar .ecs-tag { font-size: 11px; color: #c9a227; font-weight: 700; letter-spacing: .06em; }
.login-logo-img, .brand-logo { max-height: 72px; width: auto; object-fit: contain; }
