/* ============================================================
   Financeiro Varzini — estilos globais
   ============================================================ */
:root {
  --green: #00a86b;
  --green-dark: #008f5b;
  --green-light: #e6f7f0;
  --red: #e74c3c;
  --red-light: #fdeceb;
  --yellow: #f39c12;
  --yellow-light: #fef6e7;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #2c3e50;
  --text-soft: #7f8c8d;
  --border: #e4e9ee;
  --shadow: 0 1px 3px rgba(30, 45, 60, .08), 0 1px 2px rgba(30, 45, 60, .04);
  --shadow-lg: 0 10px 32px rgba(30, 45, 60, .18);
  --radius: 12px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }

/* ---------- layout com sidebar ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #1e2b38;
  color: #cfd8e0;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  transition: transform .25s ease;
}
.sidebar .logo {
  padding: 20px 18px 16px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
}
.sidebar nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  color: #cfd8e0;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidebar nav a.active {
  background: rgba(0,168,107,.16);
  border-left-color: var(--green);
  color: #fff;
}
.sidebar nav a .ico { width: 20px; text-align: center; }
.sidebar .side-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
}
.sidebar .side-footer .uname { color: #fff; font-weight: 600; margin-bottom: 6px; word-break: break-word; }
.sidebar .side-footer a { display: block; color: #9fb0be; padding: 3px 0; }
.sidebar .side-footer a:hover { color: #fff; text-decoration: none; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px 28px 60px;
  min-width: 0;
}

/* topbar mobile */
.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  background: #1e2b38;
  color: #fff;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .hamburger {
  background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 2px 6px;
}
.topbar .tb-logo { font-weight: 700; }
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 45;
}
body.menu-open .overlay { display: block; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.menu-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; padding: 16px 14px 60px; }
  .topbar { display: flex; }
}

/* ---------- cabeçalho de página ---------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.page-head .subtitle { color: var(--text-soft); font-size: 13px; }

/* ---------- navegação de mês ---------- */
.month-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px;
  box-shadow: var(--shadow);
}
.month-nav button {
  background: none; border: none;
  font-size: 17px; color: var(--text-soft);
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 50%;
  line-height: 1;
}
.month-nav button:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.month-nav button:disabled { opacity: .3; cursor: default; }
.month-nav .month-label {
  min-width: 140px;
  text-align: center;
  font-weight: 600;
  text-transform: capitalize;
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card.tight { padding: 14px 16px; }
.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.stat-card .label { font-size: 13px; color: var(--text-soft); margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .value.neg { color: var(--red); }
.stat-card .hint { font-size: 12px; margin-top: 6px; }
.stat-card.warn { background: var(--yellow-light); border: 1px solid #f6dfae; }
.stat-card a { font-size: 12px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #c0392b; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.ghost { background: transparent; color: var(--text-soft); border: none; }
.btn.ghost:hover { background: var(--bg); color: var(--text); }

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-soft);
  font-size: 15px;
  width: 30px; height: 30px;
  border-radius: 6px;
  line-height: 1;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

.fab {
  position: fixed;
  right: 28px; bottom: 28px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  border: none;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,168,107,.45);
  z-index: 30;
}
.fab:hover { background: var(--green-dark); }

/* ---------- formulários ---------- */
label.fld { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--text); }
label.fld span.lbl { display: block; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(0,168,107,.35);
  outline-offset: 0;
  border-color: var(--green);
}
input[type=color] {
  width: 46px; height: 34px; padding: 2px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer;
}
input[type=checkbox] { accent-color: var(--green); width: 16px; height: 16px; }
textarea { resize: vertical; min-height: 64px; }
.check {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; cursor: pointer; user-select: none; font-weight: 500;
}
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.form-hint { font-size: 12px; color: var(--text-soft); margin: -6px 0 12px; }

/* ---------- filtros ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin-bottom: 18px;
}
.filters select, .filters input[type=search] { width: auto; min-width: 150px; }
.filters .spacer { flex: 1; }

/* ---------- tabela / lista de lançamentos ---------- */
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
  text-align: left; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-soft);
  padding: 8px 10px; border-bottom: 2px solid var(--border);
}
table.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: #fafcfd; }
.tbl-wrap { overflow-x: auto; }

.day-header {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: capitalize;
  padding: 16px 10px 6px;
  border-bottom: 1px solid var(--border);
}
.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.tx-row:hover { background: #fafcfd; }
.tx-row .tx-main { flex: 1; min-width: 0; }
.tx-row .tx-desc { font-weight: 500; word-break: break-word; }
.tx-row .tx-sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.tx-row .tx-amount { font-weight: 700; white-space: nowrap; }
.tx-amount.expense { color: var(--red); }
.tx-amount.refund { color: var(--green); }
.tx-row.is-deleted .tx-desc { text-decoration: line-through; color: var(--text-soft); }
.tx-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.tx-row:hover .tx-actions, .tx-row:focus-within .tx-actions { opacity: 1; }
@media (pointer: coarse), (max-width: 900px) { .tx-actions { opacity: 1; } }

.list-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 10px 2px; font-weight: 700;
}

/* ---------- pílula de categoria ---------- */
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 230px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
}
.cat-pill.uncat { background: #fff; color: var(--text-soft); border: 1px dashed #b8c2cb; }
.cat-pill:hover { filter: brightness(.93); }
.cat-pill.uncat:hover { filter: none; background: var(--bg); }
.cat-pill.static { cursor: default; }
.cat-pill.static:hover { filter: none; }

/* badges */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.badge.gray { background: #eef1f4; color: var(--text-soft); }
.badge.yellow { background: var(--yellow-light); color: #ad6e05; border: 1px solid #f2d89a; }
.badge.green { background: var(--green-light); color: var(--green-dark); }
.badge.red { background: var(--red-light); color: var(--red); }

/* ---------- seletor de categorias ---------- */
.cat-picker {
  position: absolute;
  z-index: 80;
  width: 300px;
  max-height: 380px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cat-picker .cp-search { padding: 10px; border-bottom: 1px solid var(--border); }
.cat-picker .cp-list { overflow-y: auto; padding: 6px 0; }
.cat-picker .cp-group {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  color: var(--text-soft); padding: 8px 14px 3px;
  display: flex; align-items: center; gap: 6px;
}
.cat-picker .cp-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 8px 14px 8px 22px;
  background: none; border: none; cursor: pointer;
  font-size: 14px; text-align: left; font-family: inherit; color: var(--text);
}
.cat-picker .cp-item:hover, .cat-picker .cp-item.focus { background: var(--green-light); }
.cat-picker .cp-item .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cat-picker .cp-none {
  border-top: 1px solid var(--border); color: var(--text-soft); font-style: italic;
  padding-left: 14px;
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 30, 40, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 16px;
  z-index: 100;
  overflow-y: auto;
}
.modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  animation: modal-in .18s ease;
}
.modal.wide { max-width: 640px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
.modal .m-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0;
}
.modal .m-head h3 { font-size: 17px; margin: 0; }
.modal .m-body { padding: 16px 20px; }
.modal .m-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 0 20px 18px;
}

/* ---------- toast ---------- */
.toast-area {
  position: fixed;
  right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: #24343f;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast.success { background: var(--green-dark); }
.toast.error { background: var(--red); }
.toast button.t-action {
  background: rgba(255,255,255,.18); border: none; color: #fff;
  border-radius: 6px; padding: 4px 10px; cursor: pointer; font-weight: 700; font-size: 13px;
  white-space: nowrap;
}
.toast button.t-action:hover { background: rgba(255,255,255,.3); }

/* ---------- gráficos / dashboard ---------- */
.donut-wrap { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.donut-wrap svg { flex: none; }
.legend { flex: 1; min-width: 220px; }
.legend .lg-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: 8px;
  width: 100%; background: none; border: none; cursor: pointer;
  font-size: 13.5px; font-family: inherit; color: var(--text); text-align: left;
}
.legend .lg-item:hover { background: var(--bg); }
.legend .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.legend .lg-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .lg-val { font-weight: 600; white-space: nowrap; }
.legend .lg-pct { color: var(--text-soft); font-size: 12px; width: 44px; text-align: right; }

.hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13.5px; }
.hbar-row .hb-name { width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row .hb-track { flex: 1; background: var(--bg); border-radius: 6px; height: 16px; overflow: hidden; }
.hbar-row .hb-fill { height: 100%; background: var(--green); border-radius: 6px; min-width: 2px; }
.hbar-row .hb-val { width: 105px; text-align: right; font-weight: 600; white-space: nowrap; font-size: 12.5px; }

.acc-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.acc-line:last-child { border-bottom: none; }
.acc-line .acc-meta { font-size: 12px; color: var(--text-soft); }
.acc-line .acc-total { font-weight: 700; color: var(--red); }

/* ---------- import ---------- */
.dropzone {
  border: 2px dashed #b9c6d1;
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  color: var(--text-soft);
  background: #fbfcfd;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--green); background: var(--green-light); color: var(--green-dark); }
.dropzone .dz-icon { font-size: 34px; margin-bottom: 8px; }
.dropzone strong { color: var(--text); }
.import-counters { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0; }
.import-counters .ic {
  background: var(--bg); border-radius: 10px; padding: 10px 16px; text-align: center; min-width: 110px;
}
.import-counters .ic b { display: block; font-size: 22px; }
.import-counters .ic.ok b { color: var(--green-dark); }
.import-counters .ic.warn b { color: var(--yellow); }
.import-counters .ic.mut b { color: var(--text-soft); }
details.grp { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
details.grp summary {
  cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: 14px;
  list-style: none; display: flex; align-items: center; gap: 8px;
}
details.grp summary::before { content: "▸"; color: var(--text-soft); transition: transform .15s; }
details.grp[open] summary::before { transform: rotate(90deg); }
details.grp .grp-body { padding: 0 14px 10px; }
.notice {
  background: var(--yellow-light); border: 1px solid #f2d89a;
  border-radius: 10px; padding: 12px 16px; font-size: 13.5px; margin: 14px 0;
}
.notice.info { background: #eaf3fb; border-color: #c7dff2; }

.pending-card {
  border: 1px solid #f2d89a;
  background: var(--yellow-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.pending-card .p-new { font-weight: 600; }
.pending-card .p-sim {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; margin-top: 8px; font-size: 13px;
}
.pending-card .p-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- categorias ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.cat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.cat-card .cc-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; color: #fff; font-weight: 700;
}
.cat-card .cc-head .cc-actions { margin-left: auto; display: flex; gap: 2px; }
.cat-card .cc-head .icon-btn { color: rgba(255,255,255,.85); }
.cat-card .cc-head .icon-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.cat-card .cc-subs { padding: 8px 16px 12px; }
.cat-card .cc-sub {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 13.5px; border-bottom: 1px dashed var(--border);
}
.cat-card .cc-sub:last-child { border-bottom: none; }
.cat-card .cc-sub .sub-actions { margin-left: auto; display: flex; opacity: 0; }
.cat-card .cc-sub:hover .sub-actions { opacity: 1; }
@media (pointer: coarse) { .cat-card .cc-sub .sub-actions { opacity: 1; } }
.cat-card .cc-empty { color: var(--text-soft); font-size: 13px; font-style: italic; padding: 4px 0; }

/* ---------- contas ---------- */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.acc-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
  position: relative;
}
.acc-card.inactive { opacity: .55; }
.acc-card .a-type { font-size: 12px; color: var(--text-soft); margin-bottom: 2px; }
.acc-card .a-name { font-weight: 700; font-size: 16px; }
.acc-card .a-bank { font-size: 13px; color: var(--text-soft); }
.acc-card .a-stats { margin-top: 12px; font-size: 13px; display: flex; justify-content: space-between; }
.acc-card .a-stats b { color: var(--red); }
.acc-card .a-edit { position: absolute; top: 12px; right: 12px; }

/* ---------- login / standalone ---------- */
.auth-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #16222d 0%, #1e2b38 55%, #10502f 130%);
  padding: 20px;
}
.auth-card {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 380px; padding: 34px 32px;
}
.auth-card .a-logo { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.auth-card .a-tag { text-align: center; color: var(--text-soft); font-size: 13px; margin-bottom: 24px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: 15px; margin-top: 4px; }
.auth-error {
  background: var(--red-light); color: var(--red);
  border-radius: 8px; padding: 10px 13px; font-size: 13.5px; margin-bottom: 16px;
}
.auth-info {
  background: var(--yellow-light); border: 1px solid #f2d89a; color: #7a5104;
  border-radius: 8px; padding: 10px 13px; font-size: 13.5px; margin-bottom: 16px;
}

/* ---------- estados ---------- */
.empty-state {
  text-align: center; padding: 46px 20px; color: var(--text-soft);
}
.empty-state .es-icon { font-size: 40px; margin-bottom: 10px; }
.empty-state p { margin: 4px 0 12px; }

.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, #edf1f4 25%, #f7f9fa 50%, #edf1f4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
  height: 16px;
  margin: 10px 0;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.muted { color: var(--text-soft); }
.small { font-size: 12.5px; }
.mono { font-family: Consolas, monospace; }
.mt0 { margin-top: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* focus visível para acessibilidade */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* senha revelável */
.pw-mask { letter-spacing: 2px; font-family: Consolas, monospace; }

/* ============================================================
   Relatório & Projeção (estilos novos — não alterar acima)
   ============================================================ */
:root {
  --fc-fore: #b0568c;        /* valor previsto (rosa) */
  --fc-fut-bg: #fcfafd;      /* fundo de mês futuro */
  --fc-cur-bg: #edf8f2;      /* fundo do mês atual */
}

/* --- toolbar: visão, horizonte e legenda --- */
.fc-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  margin-bottom: 18px;
}
.seg {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-soft);
  padding: 6px 12px; border-radius: 7px;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: #fff; color: var(--green-dark); box-shadow: var(--shadow); }
.fc-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  margin-left: auto;
  font-size: 12px; color: var(--text-soft);
}
.fc-legend span { display: inline-flex; align-items: center; gap: 5px; }
.fc-legend b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.fc-legend .fc-unit { color: #b2bcc4; font-style: italic; }

/* --- semântica dos valores --- */
.fc-fore { color: var(--fc-fore); font-style: italic; }
.fc-exc { text-decoration: line-through; color: var(--text-soft); font-style: italic; }
.fc-dash { color: #c3cdd5; }
.fc-adj {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--yellow); margin-left: 5px; vertical-align: 2px;
}
.fc-plus { color: var(--text-soft); margin: 0 3px; font-size: 11px; font-style: normal; }

/* --- card + rolagem da matriz --- */
.card.fcast-card { padding: 0; overflow: hidden; }
.fcast-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.fc-skel { padding: 18px 22px 24px; }
.fc-skel .skeleton { height: 20px; }
.fc-skel .skeleton:first-child { height: 26px; margin-bottom: 16px; }

/* --- tabela matriz --- */
table.fcast {
  border-collapse: separate; border-spacing: 0;
  min-width: 100%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
table.fcast th, table.fcast td { padding: 8px 12px; white-space: nowrap; }
table.fcast thead th {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-soft);
  text-align: right;
  background: #fff;
  border-bottom: 2px solid var(--border);
  padding-top: 12px;
}
table.fcast thead th.fc-cur { color: var(--green-dark); border-bottom-color: var(--green); }
table.fcast .fc-now {
  display: block; font-size: 9px; font-weight: 800; letter-spacing: .1em;
  color: var(--green); line-height: 1.2;
}

/* primeira coluna fixa */
table.fcast th.fc-name, table.fcast td.fc-name {
  position: sticky; left: 0; z-index: 2;
  text-align: left;
  min-width: 250px; max-width: 310px;
  background: #fff;
  border-right: 1px solid var(--border);
  box-shadow: 6px 0 8px -6px rgba(30, 45, 60, .10);
}

/* fundos: base, zebra, coluna futura, coluna atual */
table.fcast td { background: #fff; border-bottom: 1px solid #f0f3f6; }
table.fcast tr.even td { background: #f9fbfc; }
table.fcast td.fc-fut, table.fcast thead th.fc-fut { background: var(--fc-fut-bg); }
table.fcast tr.even td.fc-fut { background: #f5f2f9; }
table.fcast td.fc-cur, table.fcast thead th.fc-cur { background: var(--fc-cur-bg); }
table.fcast tr.even td.fc-cur { background: #e5f2ec; }
table.fcast tbody tr.fc-row:hover td { background: #edf2f6; }
table.fcast tbody tr.fc-row:hover td.fc-cur { background: #e2efe8; }

/* cabeçalho de seção */
table.fcast tr.fc-sec-head td {
  background: #f1f4f7;
  font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding-top: 9px; padding-bottom: 9px;
}
table.fcast tr.fc-sec-head td.fc-name { cursor: pointer; user-select: none; }
table.fcast tr.fc-sec-head td.fc-name:hover { color: var(--green-dark); }
.fc-caret {
  display: inline-block; width: 14px;
  color: var(--text-soft); font-size: 11px;
  transition: transform .15s ease;
}
.fc-caret.closed { transform: rotate(-90deg); }
.fc-count {
  font-size: 10.5px; font-weight: 700;
  background: #fff; color: var(--text-soft);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 7px; margin-left: 4px;
  vertical-align: 1px;
}

/* célula do item (1ª coluna) */
.fc-item { display: flex; align-items: center; gap: 6px; }
.fc-item-txt { flex: 1; min-width: 0; }
.fc-label {
  display: block; font-weight: 600; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis;
}
.fc-sub {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-soft);
  white-space: nowrap; overflow: hidden;
}
.fc-sub-txt { overflow: hidden; text-overflow: ellipsis; }
.fc-sub .badge { flex: none; font-size: 10px; padding: 1px 7px; }
.fc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.fc-more { flex: none; opacity: 0; transition: opacity .12s; }
tr:hover .fc-more, .fc-more:focus-visible { opacity: 1; }
@media (pointer: coarse) { .fc-more { opacity: 1; } }

/* célula prevista clicável */
table.fcast td.fc-click { cursor: pointer; }
table.fcast tbody tr.fc-row td.fc-click:hover {
  box-shadow: inset 0 0 0 1.5px var(--green);
  border-radius: 6px;
  background: var(--green-light);
}

/* subtotal e total geral */
table.fcast tr.fc-subtotal td {
  background: #f6f8fa;
  font-weight: 700; font-size: 12.5px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
table.fcast tr.fc-subtotal td.fc-cur { background: #e3efe8; }
table.fcast tr.fc-grand td {
  background: #24343f; color: #fff;
  font-weight: 700; font-size: 13px;
  border-bottom: none; border-top: none;
  padding-top: 11px; padding-bottom: 11px;
}
table.fcast tr.fc-grand td.fc-name {
  background: #24343f; border-right-color: rgba(255,255,255,.14);
  text-transform: uppercase; letter-spacing: .05em; font-size: 12px;
}
table.fcast tr.fc-grand td.fc-cur { background: #1d5741; }

/* menu ⋯ da linha */
.fc-menu {
  position: absolute; z-index: 90;
  min-width: 215px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
}
.fc-menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 8px 12px; border-radius: 7px;
  font-family: inherit; font-size: 13.5px; color: var(--text);
}
.fc-menu button:hover { background: var(--green-light); color: var(--green-dark); }
.fc-menu .fc-menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* modal de célula */
.fc-cellpop .fc-cp-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 8px 0; font-size: 14px;
  border-bottom: 1px dashed var(--border);
}
.fc-cellpop .fc-cp-row:last-of-type { border-bottom: none; }
.fc-cp-edit { margin-top: 14px; }
.fc-cp-edit .fld { margin-bottom: 0; }
.fc-cp-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* --- dashboard: card de projeção --- */
.proj-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.proj-head h2 { margin: 0; }
.proj-head a { font-size: 13px; white-space: nowrap; }

/* --- responsivo --- */
@media (max-width: 900px) {
  .fc-legend { margin-left: 0; }
  table.fcast th.fc-name, table.fcast td.fc-name { min-width: 170px; max-width: 200px; }
  table.fcast th, table.fcast td { padding: 7px 9px; }
  .fc-sub .badge { display: none; }
}
