:root {
  --bg: #0a0a0a;
  --bg-card: #171717;
  --bg-card-hover: #1f1f1f;
  --border: #2a2a2a;
  --accent: #ff6600;
  --accent-dark: #cc5200;
  --text: #ffffff;
  --text-dim: #9a9a9a;
  --text-dimmer: #6b6b6b;
  --green: #25d366;
  --red: #ff5252;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans Pro", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: 60px;
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 32px; width: 100%; max-width: 360px; }
.login-card h1 { font-size: 1.3rem; margin: 0 0 4px; }
.login-card p { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 22px; }
.login-error { color: var(--red); font-size: 0.82rem; margin-top: 10px; min-height: 18px; }

/* ---------- form fields ---------- */
.form-field { margin-bottom: 12px; }
.form-field label { display: block; font-size: 0.78rem; color: var(--text-dim); margin-bottom: 5px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; background: #111; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-size: 0.9rem;
}
.form-field textarea { resize: vertical; min-height: 60px; font-family: inherit; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field-grid .form-field.full { grid-column: 1 / -1; }

/* ---------- header / tabs ---------- */
.fin-header { background: rgba(10,10,10,0.9); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.fin-header-inner { max-width: 1100px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 14px; }
.fin-header-inner h1 { font-size: 1.05rem; margin: 0; }
.fin-brand { color: var(--text-dimmer); font-size: 0.8rem; }
.fin-header-inner .spacer { flex: 1; }
.link-btn { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 8px; font-size: 0.82rem; }
.link-btn.danger:hover { border-color: var(--red); color: var(--red); }
.fin-tabs { max-width: 1100px; margin: 0 auto; display: flex; gap: 6px; padding: 0 20px 12px; overflow-x: auto; }
.fin-tabs button { white-space: nowrap; background: transparent; color: var(--text-dim); border: 1px solid var(--border); padding: 8px 16px; border-radius: 20px; font-size: 0.84rem; font-weight: 600; }
.fin-tabs button.active { background: var(--accent); color: #111; border-color: var(--accent); }
.fin-main { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* ---------- panel ---------- */
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.panel h2 { font-size: 1rem; margin: 0 0 4px; }
.panel .panel-sub { color: var(--text-dim); font-size: 0.8rem; margin: 0 0 18px; }
.panel-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head-row h2 { margin: 0; }

/* ---------- buttons ---------- */
.btn-save { background: var(--accent); color: #111; border: none; border-radius: 8px; padding: 10px 18px; font-weight: 700; font-size: 0.88rem; }
.btn-save:hover { background: var(--accent-dark); }
.btn-save:disabled { opacity: 0.5; cursor: default; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 9px 16px; font-size: 0.85rem; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn { background: none; border: none; color: var(--text-dim); font-size: 0.95rem; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: #222; color: var(--text); }
.icon-btn.danger:hover { color: var(--red); }

/* ---------- table ---------- */
.fin-table { width: 100%; border-collapse: collapse; }
.fin-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dimmer); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.fin-table td { padding: 10px 8px; border-bottom: 1px solid #1e1e1e; vertical-align: middle; font-size: 0.87rem; }
.fin-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.fin-table td.col-actions { width: 90px; white-space: nowrap; text-align: right; }
.empty-row { color: var(--text-dim); text-align: center; padding: 30px; font-size: 0.85rem; }

/* ---------- badges/status ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.badge.pendente { background: #3a2a08; color: #ffb347; }
.badge.pago { background: #0f3320; color: var(--green); }
.money { font-weight: 700; }
.money.neg { color: var(--red); }

/* ---------- modal ---------- */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 100; }
.overlay.show { display: flex; }
.sheet { background: var(--bg-card); border-radius: 14px; width: 100%; max-width: 560px; padding: 22px; position: relative; }
.sheet h3 { margin: 0 0 16px; font-size: 1.1rem; }
.close-x { position: absolute; top: 14px; right: 14px; background: none; border: none; color: var(--text-dim); font-size: 1.4rem; line-height: 1; }
.close-x:hover { color: var(--text); }

/* ---------- itens table (nota fiscal) ---------- */
.itens-table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; }
.itens-table th { font-size: 0.7rem; text-transform: uppercase; color: var(--text-dimmer); text-align: left; padding: 4px 6px; }
.itens-table td { padding: 4px 6px; }
.itens-table input { width: 100%; background: #111; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; color: var(--text); font-size: 0.82rem; }
.itens-table td.col-del { width: 30px; }

/* ---------- upload nota ---------- */
.nota-upload { border: 1px dashed var(--border); border-radius: 10px; padding: 16px; text-align: center; margin-bottom: 16px; }
.nota-upload input[type=file] { display: none; }
.nota-upload-status { font-size: 0.8rem; color: var(--text-dim); margin-top: 8px; }
.nota-preview { max-width: 160px; max-height: 160px; border-radius: 8px; margin-top: 10px; }

/* ---------- dashboard ---------- */
.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.dash-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.dash-card .label { font-size: 0.76rem; color: var(--text-dim); margin-bottom: 6px; }
.dash-card .value { font-size: 1.5rem; font-weight: 800; }
.dash-card .value.up { color: var(--red); }
.dash-card .value.down { color: var(--green); }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { width: 160px; font-size: 0.8rem; color: var(--text-dim); flex-shrink: 0; }
.bar-track { flex: 1; background: #111; border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 6px; }
.bar-value { width: 90px; text-align: right; font-size: 0.82rem; font-weight: 700; flex-shrink: 0; }

/* ---------- month picker ---------- */
.month-picker { display: flex; align-items: center; gap: 10px; }
.month-picker button { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 32px; height: 32px; }
.month-picker span { font-weight: 700; min-width: 130px; text-align: center; }

@media (max-width: 700px) {
  .field-grid { grid-template-columns: 1fr; }
  .bar-label { width: 100px; }
  .fin-table { display: block; overflow-x: auto; white-space: nowrap; }
}
