:root {
  --bg: #0f172a;
  --surface: rgba(30, 41, 59, 0.8);
  --surface-solid: #1e293b;
  --border: rgba(255, 255, 255, 0.08);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 10% 50%, rgba(59,130,246,0.12), transparent 30%),
    radial-gradient(circle at 90% 20%, rgba(139,92,246,0.10), transparent 30%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: rgba(15,23,42,0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 2rem;
}
.logo {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(to right, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Nav */
.nav-tools {
  display: flex;
  gap: 0.15rem;
  padding: 0 2rem 0.65rem;
  overflow-x: auto;
}
.nav-link {
  padding: 0.3rem 0.9rem;
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-link.active { background: rgba(59,130,246,0.15); color: var(--primary); }
.nav-sep { color: var(--border); padding: 0 0.25rem; display: flex; align-items: center; font-size: 0.85rem; user-select: none; }

/* Layout */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
  flex: 1;
}
.page-title {
  margin-bottom: 1.75rem;
}
.page-title h1 { font-size: 1.5rem; font-weight: 700; }
.page-title p  { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.3rem; }

.layout-cols {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.layout-cols > * { min-width: 0; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
}
.card + .card { margin-top: 1rem; }
.card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin-bottom: 1.25rem;
}

/* Form */
.form-group { margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }
label.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.65rem 0.9rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
select option { background: #1e293b; }
.input-prefix {
  position: relative;
}
.input-prefix span {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.input-prefix input { padding-left: 2.2rem; }
.input-suffix { position: relative; }
.input-suffix span { position: absolute; right: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.9rem; pointer-events: none; }
.input-suffix input { padding-right: 3.5rem; }

/* Toggle switches */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-info { }
.toggle-info strong { font-size: 0.9rem; display: block; }
.toggle-info span { font-size: 0.78rem; color: var(--text-muted); }
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Buttons */
.btn {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-primary { background: var(--primary); color: white; width: 100%; justify-content: center; padding: 0.8rem; font-size: 1rem; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: rgba(255,255,255,0.05); }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; font-size: 0.8rem; cursor: pointer; font-family: inherit; }
.btn-ghost:hover { color: var(--text); }

/* Breakdown de resultado */
.resultado-vazio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  text-align: center;
  gap: 0.75rem;
}
.resultado-vazio .icon { font-size: 2.5rem; opacity: 0.4; }

.breakdown { font-size: 0.92rem; }

.bd-section { margin-bottom: 1.25rem; }
.bd-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.bd-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.3rem 0;
  gap: 1rem;
}
.bd-row.indent { padding-left: 1rem; }
.bd-row.indent .bd-label { color: var(--text-muted); font-size: 0.85rem; }
.bd-row.indent .bd-val { font-size: 0.85rem; }
.bd-label { flex: 1; }
.bd-val { font-weight: 600; white-space: nowrap; }
.bd-val.positivo { color: var(--success); }
.bd-val.negativo { color: var(--danger); }
.bd-val.neutro   { color: var(--text-muted); }
.bd-val.destaque { color: var(--primary); }

.bd-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}
.bd-divider.strong {
  border-color: rgba(255,255,255,0.15);
  margin: 1rem 0;
}

.bd-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-top: 1rem;
}
.bd-total-label { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.bd-total-val { font-size: 1.4rem; font-weight: 800; color: var(--primary); }

.bd-total-deposito {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-top: 0.5rem;
}
.bd-total-deposito .bd-total-label { color: var(--success); }
.bd-total-deposito .bd-total-val { font-size: 1.4rem; font-weight: 800; color: var(--success); }

.resultado-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* Histórico */
.historico-lista { display: flex; flex-direction: column; gap: 0.5rem; }
.historico-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.9rem;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  gap: 1rem;
}
.historico-item:hover { background: rgba(59,130,246,0.1); }
.historico-info { flex: 1; }
.historico-info strong { font-size: 0.88rem; display: block; }
.historico-info span { font-size: 0.75rem; color: var(--text-muted); }
.historico-valor { font-weight: 700; color: var(--primary); font-size: 0.92rem; white-space: nowrap; }

/* Badge */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-info    { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-warning { background: rgba(245,158,11,0.15); color: #f59e0b; }

/* Aviso tabelas */
.aviso-tabela {
  font-size: 0.75rem;
  color: var(--warning);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-top: 1rem;
}

/* Toasts */
.toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column;
  gap: 8px; z-index: 100;
}
.toast {
  padding: 11px 18px; border-radius: 8px;
  font-size: 13px; color: white;
  opacity: 0; transform: translateY(20px);
  animation: toast-in 0.3s forwards;
}
.toast.t-info  { background: #3b82f6; }
.toast.t-erro  { background: #ef4444; }
.toast.t-ok    { background: #10b981; }
@keyframes toast-in  { to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-20px); } }

/* ==========================================
   VEJA TAMBÉM
   ========================================== */
.veja-tambem {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.veja-tambem-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.veja-tambem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
}
.vt-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.75rem 0.5rem;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  transition: all 0.2s;
}
.vt-card:hover { background: rgba(59,130,246,0.1); border-color: var(--primary); color: var(--primary); }
.vt-card .vt-icon { font-size: 1.3rem; }

/* ==========================================
   AD SLOTS
   ========================================== */
.ad-slot {
  width: 100%;
  background: rgba(0,0,0,0.1);
  border: 1px dashed rgba(255,255,255,0.06);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.1);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ad-slot-topo    { height: 90px; margin-bottom: 1.5rem; }
.ad-slot-resultado { min-height: 100px; margin-top: 1rem; }
.ad-slot-rodape  { height: 60px; margin-top: 1.5rem; }
@media (min-width: 769px) {
  .ad-slot-lateral { width: 300px; min-height: 250px; flex-shrink: 0; }
}
@media print { .ad-slot { display: none !important; } }

/* ==========================================
   FOOTER
   ========================================== */
.site-footer {
  background: rgba(0,0,0,0.3);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 2rem;
}
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.footer-brand {
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(to right, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: block;
  margin-bottom: 0.5rem;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin-top: 0.5rem;
}
.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.footer-nav a:hover { color: var(--text); }
.footer-disclaimer {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.footer-copy {
  font-size: 0.75rem;
  color: rgba(148,163,184,0.5);
  margin-top: 0.75rem;
}

/* ==========================================
   MOBILE
   ========================================== */
@media (max-width: 768px) {
  .layout-cols { grid-template-columns: 1fr; }
  .page { padding: 1rem; }
  .header-top { padding: 0.9rem 1rem; }
  .nav-tools { padding: 0 1rem 0.65rem; }
  .veja-tambem-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-top { flex-direction: column; }
  .bd-total-val, .bd-total-deposito .bd-total-val { font-size: 1.15rem; }
}
