:root {
  --ffm-bg: #F7F7F7;
  --ffm-surface: #ffffff;
  --ffm-surface-soft: #fcfcfd;
  --ffm-text: #1D2366;
  --ffm-text-soft: rgba(29, 35, 102, 0.72);
  --ffm-line: rgba(29, 35, 102, 0.10);
  --ffm-line-strong: rgba(29, 35, 102, 0.18);
  --ffm-btn: #F0F0F0;
  --ffm-btn-hover: #DFE0E7;
  --ffm-btn-border: #1D236647;
  --ffm-success-bg: #ECF7EE;
  --ffm-success-text: #256B39;
  --ffm-danger-bg: #FFF1F1;
  --ffm-danger-text: #BA2F39;
  --ffm-warning-bg: #FFF8E8;
  --ffm-warning-text: #8B6500;
  --ffm-shadow: 0 12px 32px rgba(29, 35, 102, 0.08);
  --ffm-radius: 22px;
  --ffm-radius-sm: 16px;
  --ffm-input-h: 52px;
}

.ffm-app-wrapper,
.ffm-report {
  color: var(--ffm-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ffm-app-wrapper * { box-sizing: border-box; }
.ffm-app-wrapper {
  width: 100%;
  background: var(--ffm-bg);
  color: var(--ffm-text);
}

.ffm-shell-title,
.ffm-shell-subtitle,
.ffm-card h3,
.ffm-card p,
.ffm-modal-heading h3,
.ffm-modal-heading p { margin: 0; }

.ffm-shell-head,
.ffm-shell-head-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.ffm-shell-title { font-size: 30px; line-height: 1.1; font-weight: 700; color: var(--ffm-text); }
.ffm-shell-subtitle { margin-top: 6px; color: var(--ffm-text-soft); font-size: 14px; }

.ffm-dashboard-stack,
.ffm-chart-grid,
.ffm-grid,
.ffm-filter-grid,
.ffm-totals-grid,
.ffm-detail-grid {
  display: grid;
  gap: 18px;
}

.ffm-grid-2,
.ffm-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ffm-grid-3,
.ffm-totals-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ffm-detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ffm-chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.ffm-dashboard-stack > * + * { margin-top: 18px; }

.ffm-card,
.ffm-stat-card,
.ffm-detail-item,
.ffm-delete-box,
.ffm-readonly-field,
.ffm-empty-state,
.ffm-empty,
.ffm-launch-card,
.ffm-filter-card,
.ffm-list-card,
.ffm-summary-card,
.ffm-chart-card,
.ffm-comparison-card,
.ffm-top-categories-card,
.ffm-category-balance-card {
  background: var(--ffm-surface);
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: var(--ffm-radius);
  box-shadow: var(--ffm-shadow);
}

.ffm-card,
.ffm-launch-card,
.ffm-filter-card,
.ffm-list-card,
.ffm-summary-card,
.ffm-chart-card,
.ffm-comparison-card,
.ffm-top-categories-card,
.ffm-category-balance-card {
  padding: 24px;
}

.ffm-card-header,
.ffm-card-header--stack {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.ffm-card-header h3 { font-size: 20px; font-weight: 700; color: var(--ffm-text); }
.ffm-card-header p { margin-top: 6px; font-size: 13px; color: var(--ffm-text-soft); }
.ffm-card-header--stack { align-items: stretch; }

.ffm-toolbar-actions,
.ffm-actions-row,
.ffm-actions-inline,
.ffm-chip-group,
.ffm-category-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.ffm-actions-row-top { justify-content: flex-end; }
.ffm-actions-row-tight { margin-top: 18px; }

.ffm-btn,
.ffm-page-btn,
.ffm-link-action,
.ffm-icon-action {
  appearance: none;
  border: 1px solid var(--ffm-btn-border);
  background: var(--ffm-btn);
  color: var(--ffm-text);
  border-radius: 14px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease, opacity .2s ease;
  text-decoration: none;
  font-weight: 600;
}

.ffm-btn,
.ffm-page-btn,
.ffm-link-action {
  min-height: 46px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ffm-btn:hover,
.ffm-page-btn:hover,
.ffm-link-action:hover,
.ffm-icon-action:hover { background: var(--ffm-btn-hover); }
.ffm-btn:disabled,
.ffm-page-btn:disabled,
.ffm-link-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.ffm-btn-primary { background: var(--ffm-text); color: #fff; border-color: transparent; }
.ffm-btn-primary:hover { background: #171c53; }
.ffm-btn-danger,
.ffm-btn-danger-soft,
.ffm-icon-action-danger { color: var(--ffm-danger-text); }
.ffm-btn-danger { background: var(--ffm-danger-bg); }
.ffm-btn-danger-soft { background: #fff; }
.ffm-link-action { background: transparent; padding: 0; border: 0; min-height: auto; }
.ffm-link-danger { color: var(--ffm-danger-text); }
.ffm-link-disabled { color: var(--ffm-text-soft); background: transparent; border: 0; }

.ffm-icon-action {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}
.ffm-icon-action .dashicons { font-size: 18px; width: 18px; height: 18px; }
.ffm-icon-action-danger { background: var(--ffm-danger-bg); border-color: rgba(186,47,57,.18); }

.ffm-field-group { display: flex; flex-direction: column; gap: 8px; }
.ffm-field-group--wide,
.ffm-field-group--wide-search { grid-column: 1 / -1; }
.ffm-field-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ffm-text);
}
.ffm-field-group input[type="text"],
.ffm-field-group input[type="search"],
.ffm-field-group input[type="date"],
.ffm-field-group select,
.ffm-field-group textarea,
.ffm-readonly-field {
  width: 100%;
  border: 1px solid var(--ffm-line);
  background: var(--ffm-surface-soft);
  color: var(--ffm-text);
  border-radius: 16px;
  outline: none;
  box-shadow: none;
  transition: border-color .2s ease, background .2s ease;
  font-size: 15px;
}
.ffm-field-group input[type="text"],
.ffm-field-group input[type="search"],
.ffm-field-group input[type="date"],
.ffm-field-group select,
.ffm-readonly-field {
  min-height: var(--ffm-input-h);
  padding: 0 16px;
}
.ffm-field-group textarea {
  min-height: 128px;
  padding: 14px 16px;
  resize: vertical;
}
.ffm-field-group input:focus,
.ffm-field-group select:focus,
.ffm-field-group textarea:focus {
  border-color: rgba(29,35,102,.32);
  background: #fff;
}
.ffm-money-input--large { font-size: 19px !important; font-weight: 700; letter-spacing: .01em; }
.ffm-readonly-field {
  display: flex;
  align-items: center;
  font-weight: 600;
}

.ffm-inline-status,
.ffm-admin-status,
.ffm-chip,
.ffm-mini-status,
.ffm-pill,
.ffm-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}
.ffm-inline-status,
.ffm-admin-status { margin-bottom: 18px; }
.ffm-inline-status.is-open,
.ffm-admin-status.is-open,
.ffm-mini-status.is-open,
.ffm-badge-contribuicao,
.ffm-pill.contribuicao { background: var(--ffm-success-bg); color: var(--ffm-success-text); }
.ffm-inline-status.is-closed,
.ffm-admin-status.is-closed,
.ffm-mini-status.is-closed,
.ffm-badge-despesa,
.ffm-pill.despesa { background: var(--ffm-danger-bg); color: var(--ffm-danger-text); }
.ffm-chip { background: rgba(29,35,102,.08); color: var(--ffm-text); }
.ffm-badge { justify-content: center; min-width: 114px; }

.ffm-totals-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ffm-stat-card {
  padding: 22px;
  background: #fff;
  border: 0;
  box-shadow: 0 18px 40px rgba(29,35,102,.08);
}
.ffm-stat-top { display: flex; align-items: flex-start; gap: 14px; }
.ffm-stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(29,35,102,.07);
  color: var(--ffm-text);
  font-size: 22px;
}
.ffm-stat-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ffm-stat-label { font-size: 13px; color: var(--ffm-text-soft); }
.ffm-stat-value { font-size: 24px; line-height: 1.15; color: var(--ffm-text); word-break: break-word; }

.ffm-chart-bars,
.ffm-category-bars { display: grid; gap: 14px; }
.ffm-chart-row,
.ffm-category-row {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.ffm-chart-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(29,35,102,.08);
  overflow: hidden;
}
.ffm-chart-track i {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(29,35,102,.95), rgba(29,35,102,.45));
}
.ffm-category-labels { display: flex; flex-direction: column; }
.ffm-category-labels strong { font-size: 14px; }
.ffm-category-labels span { font-size: 12px; color: var(--ffm-text-soft); }

.ffm-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 18px;
  background: #fff;
}
.ffm-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}
.ffm-table th,
.ffm-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(29,35,102,.06);
  vertical-align: middle;
  color: var(--ffm-text);
}
.ffm-table thead th {
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ffm-text-soft);
  font-weight: 700;
  background: rgba(29,35,102,.02);
}
.ffm-table tbody tr:hover { background: rgba(29,35,102,.02); }
.ffm-actions-inline { justify-content: flex-end; gap: 8px; }

.ffm-detail-grid { margin-bottom: 18px; }
.ffm-detail-item {
  padding: 18px;
  box-shadow: none;
  border: 1px solid var(--ffm-line);
}
.ffm-detail-item span,
.ffm-detail-description span { display: block; font-size: 12px; color: var(--ffm-text-soft); margin-bottom: 6px; }
.ffm-detail-item strong { font-size: 16px; }
.ffm-detail-description {
  border: 1px solid var(--ffm-line);
  border-radius: 18px;
  padding: 18px;
  background: var(--ffm-surface-soft);
  margin-bottom: 18px;
}
.ffm-detail-description p { margin: 0; color: var(--ffm-text); }
.ffm-delete-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.ffm-empty-state,
.ffm-empty {
  padding: 28px;
  text-align: center;
  color: var(--ffm-text-soft);
}

.ffm-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.ffm-page-btn.is-active {
  background: var(--ffm-text);
  color: #fff;
  border-color: transparent;
}

.ffm-modal[hidden] { display: none !important; }
.ffm-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ffm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 35, 0.44);
  backdrop-filter: blur(4px);
}
.ffm-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 30px 70px rgba(10,12,35,.24);
}
.ffm-modal-content { padding: 0; }
.ffm-modal-body { padding: 28px; }
.ffm-modal-heading { margin-bottom: 18px; padding-right: 40px; }
.ffm-modal-heading h3 { font-size: 24px; font-weight: 700; }
.ffm-modal-heading p { margin-top: 6px; font-size: 14px; color: var(--ffm-text-soft); }
.ffm-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--ffm-line);
  background: #fff;
  color: var(--ffm-text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.ffm-category-tools { margin-top: 10px; }
.ffm-category-tools .ffm-link-action {
  min-height: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ffm-text);
}
.ffm-category-tools .ffm-link-danger { color: var(--ffm-danger-text); }

.ffm-alert {
  padding: 18px 20px;
  border-radius: 18px;
  background: var(--ffm-warning-bg);
  color: var(--ffm-warning-text);
  border: 1px solid rgba(139,101,0,.15);
}

.ffm-global-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100001;
  min-width: 300px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 16px 18px;
  background: #fff;
  color: var(--ffm-text);
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(10,12,35,.18);
  border: 1px solid rgba(29,35,102,.08);
  opacity: 0;
  transform: translateY(-8px) scale(.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.ffm-global-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.ffm-global-toast.is-success::before,
.ffm-global-toast.is-error::before,
.ffm-global-toast.is-info::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 18px 0 0 18px;
}
.ffm-global-toast.is-success::before { background: #3ba95e; }
.ffm-global-toast.is-error::before { background: #d94545; }
.ffm-global-toast.is-info::before { background: var(--ffm-text); }

@media (max-width: 1024px) {
  .ffm-grid-3,
  .ffm-detail-grid,
  .ffm-totals-grid,
  .ffm-chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 782px) {
  .ffm-shell-head,
  .ffm-shell-head-main,
  .ffm-card-header,
  .ffm-card-header--stack,
  .ffm-filter-grid,
  .ffm-grid-2,
  .ffm-grid-3,
  .ffm-detail-grid,
  .ffm-totals-grid,
  .ffm-chart-grid,
  .ffm-chart-row,
  .ffm-category-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .ffm-shell-head,
  .ffm-shell-head-main,
  .ffm-card-header,
  .ffm-card-header--stack {
    display: flex;
    flex-direction: column;
  }

  .ffm-card,
  .ffm-launch-card,
  .ffm-filter-card,
  .ffm-list-card,
  .ffm-summary-card,
  .ffm-chart-card,
  .ffm-comparison-card,
  .ffm-top-categories-card,
  .ffm-category-balance-card,
  .ffm-modal-body { padding: 20px; }

  .ffm-table { min-width: 720px; }
  .ffm-global-toast { top: 16px; right: 16px; left: 16px; min-width: 0; max-width: none; }
}


.ffm-launch-card {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.ffm-launch-card .ffm-card-header {
  margin-bottom: 0;
}

.ffm-launch-card .ffm-btn,
.ffm-launch-card .ffm-btn-primary {
  background: var(--ffm-text) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.ffm-launch-card .ffm-btn:hover,
.ffm-launch-card .ffm-btn-primary:hover {
  background: #171c53 !important;
}

.ffm-category-control-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
}

.ffm-category-control-row > .ffm-category-tools {
  width: 100%;
  margin-top: 0;
  order: -1;
}

.ffm-category-control-row > select {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}
