:root {
  --bg: #0b0b0b;
  --card: #121212;
  --ink: #eaeaea;
  --muted: #9a9a9a;
  --accent: #f7931e;
}

/* base */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial, sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111;
  padding: 12px 20px;
  border-bottom: 1px solid #222;
}

.logo {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.3em;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
  margin-left: 12px;
  font-weight: 500;
}
.nav a:hover { color: var(--accent); }

.container {
  max-width: 1100px;
  margin: 20px auto;
  padding: 0 20px;
}

.card {
  background: var(--card);
  border: 1px solid #222;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

h1, h2, h3 { color: var(--accent); }

.footer {
  text-align: center;
  padding: 20px;
  border-top: 1px solid #222;
  color: var(--muted);
}

.muted { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* --- TABELAS --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid #333;
  vertical-align: middle;
  color: var(--ink);
}

th {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 13px;
}

/* colgroup larguras da tabela de lançamentos */
table.finio col.col-data       { width: 8%; }
table.finio col.col-tipo       { width: 10%; }
table.finio col.col-categoria  { width: 12%; }
table.finio col.col-descricao  { width: 32%; }
table.finio col.col-forma      { width: 10%; }
table.finio col.col-valor      { width: 10%; }
table.finio col.col-status     { width: 10%; }
table.finio col.col-acoes      { width: 8%; }

/* alinhamentos utilitários */
.t-left   { text-align: left; }
.t-center { text-align: center; }
.t-right  { text-align: right; }

/* Coluna de valores (LINHAS) — à DIREITA para alinhar os centavos “na régua” */
td.valor {
  text-align: right;                     /* <-- ajuste principal */
  font-variant-numeric: tabular-nums;    /* cada dígito mesma largura */
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  padding-right: 18px;                   /* respiro antes do Status */
}

/* Coluna de status (linhas) */
td.status { text-align: center; }

/* Chips de status */
.chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 12px;
  border: 1px solid transparent;
}
.chip.ok   { background: #113d2b; color: #baf1c9; border-color:#1d6b47; }
.chip.warn { background: #3d3011; color: #f7e8b0; border-color:#6b531d; }
.chip.bad  { background: #3d1111; color: #f7b0b0; border-color:#6b1d1d; }

/* Ação */
.table-action { color: var(--accent); text-decoration: none; font-weight: 600; }
.table-action:hover { text-decoration: underline; }

/* Botão padrão */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #000;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.btn:hover { filter: brightness(1.08); }

/* --- Dropdown (submenu) --- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropbtn {
  color: var(--ink);
  text-decoration: none;
  margin-left: 12px;
  font-weight: 500;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #1a1a1a;
  min-width: 160px;
  border: 1px solid #333;
  border-radius: 6px;
  z-index: 10;
  top: 25px;
  left: 0;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.dropdown-content a {
  color: var(--ink);
  padding: 8px 12px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {
  background-color: #222;
  color: var(--accent);
}

/* Mostrar submenu ao passar o mouse */
.dropdown:hover .dropdown-content {
  display: block;
}

/* cor laranja no hover do botão principal */
.dropbtn:hover {
  color: var(--accent);
}

/* --- Botões de filtro (Receita/Despesa) --- */
.tipo-btn {
  background: #1a1a1a;
  color: var(--ink);
  border: 1px solid #333;
  transition: 0.2s;
}
.tipo-btn:hover {
  background: var(--accent);
  color: #000;
}
.tipo-btn.receita.ativo {
  background: #113d2b;
  color: #baf1c9;
  border-color: #1d6b47;
}
.tipo-btn.despesa.ativo {
  background: #3d1111;
  color: #f7b0b0;
  border-color: #6b1d1d;
}
.tipo-btn.ativo {
  filter: brightness(1.1);
}

/* Campos padrão (inputs e selects) */
.input-fin {
  width: 100%;
  padding: 8px 10px;
  background: #0e0e0e;
  border: 1px solid #333;
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px;
}

.input-fin:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 4px #f7931e33;
}

/* --- Dropdown (submenu Cadastros) --- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropbtn {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  margin-left: 12px;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #1a1a1a;
  min-width: 180px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  border: 1px solid #333;
  border-radius: 6px;
  z-index: 100;
  margin-top: 6px;
}

.dropdown-content a {
  display: block;
  color: var(--ink);
  padding: 10px 14px;
  text-decoration: none;
  font-size: 14px;
}

.dropdown-content a:hover {
  background-color: #2a2a2a;
  color: var(--accent);
}

.dropdown:hover .dropdown-content {
  display: block;
}

/* --- LINKS --- */
.link {
  color: var(--accent);
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}
.link-danger {
  color: #f7b0b0;
  text-decoration: none;
}
.link-danger:hover {
  text-decoration: underline;
}

/* --- MODAL PADRÃO --- */
.modal-fin {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-content-fin {
  background: var(--card);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 25px rgba(0,0,0,0.6);
}

/* --- BOTÕES --- */
.btn-danger {
  background: #3d1111;
  color: #f7b0b0;
}
.btn-danger:hover {
  background: #561717;
}
/* ====== Layouts de topo reutilizáveis ====== */
.toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.fluxo-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* header de Contas: título + botão */
.contas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* Tabelas com rolagem horizontal suave no mobile */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ====== Mobile (máx 768px) ====== */
@media (max-width: 768px) {

  /* Barra do topo em Lançamentos */
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
  }

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

  .toolbar-right #frmPeriodo,
  .toolbar-right #busca,
  .toolbar-right .btn {
    width: 100%;
  }

  .toolbar-right .btn {
    text-align: center;
  }

  /* Filtros do Fluxo de Caixa */
  .fluxo-filter-form {
    flex-direction: column;
    align-items: stretch;
  }

  .fluxo-filter-form > div {
    width: 100%;
  }

  .fluxo-filter-form .btn {
    width: 100%;
    text-align: center;
  }

  /* Header de Contas no mobile */
  .contas-header {
    flex-direction: column;
    align-items: stretch;
  }

  .contas-header .btn {
    width: 100%;
    text-align: center;
  }
}
