:root {
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef4ff;
  --muted: #90a7c4;
  --brand: #3a7bff;
  --brand-dark: #1d3f7a;
  --brand-soft: #78a7ff;
  --success: #31d0aa;
  --danger: #ff5c7c;
  --warning: #f7bf38;
  --info: #6fe5ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(58, 123, 255, 0.2), transparent 22%),
    linear-gradient(135deg, #162236 0%, #1a2638 40%, #101a29 100%);
  background-size: 28px 28px, 28px 28px, auto, auto;
  min-height: 100vh;
}

.text-secondary,
.small.text-secondary {
  color: var(--muted) !important;
}

.main-panel,
.finance-app {
  min-height: 100vh;
}

.hero-panel,
.sheet-card,
.summary-card,
.metric-card,
.top-tabs .nav-link {
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(5, 5, 18, 0.24);
}

.hero-panel {
  background:
    radial-gradient(circle at top right, rgba(111, 229, 255, 0.12), transparent 28%),
    radial-gradient(circle at left bottom, rgba(58, 123, 255, 0.22), transparent 24%),
    linear-gradient(135deg, rgba(25, 37, 58, 0.98), rgba(18, 28, 44, 0.96));
  border-radius: 24px;
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hero-brand-icon {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(58, 123, 255, 0.3), rgba(20, 76, 173, 0.28));
  display: grid;
  place-items: center;
  flex: 0 0 68px;
}

.hero-brand-icon img {
  width: 48px;
  height: 48px;
}

.eyebrow,
.section-kicker {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.64rem;
  font-weight: 700;
}

.eyebrow {
  color: var(--brand-soft);
  margin-bottom: 0.55rem;
}

.hero-panel h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 800;
}

.hero-copy {
  max-width: 620px;
  color: rgba(245, 244, 255, 0.72);
  font-size: 0.92rem;
}

.hero-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.table-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-pill {
  border-radius: 999px;
  padding: 0.72rem 1rem;
  font-weight: 700;
  font-size: 0.88rem;
}

.top-tabs {
  gap: 0.8rem;
}

.top-tabs .nav-link {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 0.85rem 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.top-tabs .nav-link.active {
  background: linear-gradient(135deg, rgba(58, 123, 255, 0.28), rgba(29, 63, 122, 0.28));
  color: #fffaf3;
  border-color: rgba(120, 167, 255, 0.24);
}

.sheet-card,
.summary-card {
  border-radius: 22px;
  background: rgba(24, 37, 57, 0.92);
  backdrop-filter: blur(12px);
  padding: 1.15rem;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 0.85rem;
}

.sheet-card h2,
.summary-card h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.sheet-subtitle {
  color: var(--muted);
  margin-top: 0.3rem;
  font-size: 0.8rem;
}

.month-switch {
  min-width: min(100%, 190px);
}

.month-switch label {
  font-size: 0.78rem;
}

.finance-table,
.csv-table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
}

.csv-table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.finance-table {
  table-layout: fixed;
}

.finance-table thead th,
.csv-table thead th {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: normal;
}

.finance-table td,
.finance-table th,
.csv-table td,
.csv-table th {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.78rem;
}

.csv-table thead th {
  border-bottom: none;
  padding-bottom: 0.15rem;
}

.csv-table tbody td {
  color: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.85rem 0.9rem;
}

.csv-table tbody td:first-child {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

.csv-table tbody td:last-child {
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
}

.csv-row-even td {
  background: rgba(255, 255, 255, 0.05);
}

.csv-row-odd td {
  background: rgba(111, 229, 255, 0.04);
}

.finance-table tbody tr {
  border-color: var(--line);
  cursor: grab;
}

.finance-table tbody tr.dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.finance-table tbody tr.drop-target {
  outline: 2px dashed rgba(120, 167, 255, 0.55);
  outline-offset: -3px;
}

.finance-table input,
.finance-table select,
.month-switch input,
.search-wrap input {
  min-width: 0;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.8rem;
  padding: 0.52rem 0.68rem;
}

.finance-table input.readonly-field {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  opacity: 1;
}

.finance-table input::placeholder,
.search-wrap input::placeholder {
  color: var(--muted);
}

.finance-table select option {
  color: #111;
}

.finance-table td:last-child,
.finance-table th:last-child {
  min-width: 150px;
}

.budget-row-paid {
  background: rgba(49, 208, 170, 0.22);
}

.budget-row-pending {
  background: rgba(255, 92, 124, 0.15);
}

.budget-row-paid input,
.budget-row-paid select {
  background: rgba(49, 208, 170, 0.12);
  border-color: rgba(49, 208, 170, 0.3);
}

.budget-row-pending input,
.budget-row-pending select {
  background: rgba(255, 92, 124, 0.08);
  border-color: rgba(255, 92, 124, 0.2);
}

.payment-method-field {
  display: flex;
  align-items: center;
  gap: 0.42rem;
}

.payment-method-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--info);
  flex: 0 0 30px;
  font-size: 0.82rem;
}

.badge-status {
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.status-pago {
  background: rgba(49, 208, 170, 0.18);
  color: #9ef1dc;
}

.status-pendente {
  background: rgba(255, 92, 124, 0.16);
  color: #ffc3cf;
}

.metric-card {
  background: linear-gradient(180deg, rgba(33, 48, 72, 0.96), rgba(24, 37, 57, 0.94));
  border-radius: 22px;
  padding: 0.92rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.95rem;
}

.metric-card p {
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.metric-card strong {
  font-size: 1.12rem;
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 1.08rem;
}

.success-tone .metric-icon {
  background: linear-gradient(135deg, #31d0aa, #138e72);
}

.warning-tone .metric-icon {
  background: linear-gradient(135deg, #f7bf38, #c88d04);
}

.info-tone .metric-icon {
  background: linear-gradient(135deg, #6fe5ff, #328ba0);
}

.danger-tone .metric-icon {
  background: linear-gradient(135deg, #ff5c7c, #d12d50);
}

.success-tone {
  background: linear-gradient(180deg, rgba(49, 208, 170, 0.16), rgba(24, 37, 57, 0.96));
  border-color: rgba(49, 208, 170, 0.22);
}

.warning-tone {
  background: linear-gradient(180deg, rgba(247, 191, 56, 0.16), rgba(24, 37, 57, 0.96));
  border-color: rgba(247, 191, 56, 0.22);
}

.info-tone {
  background: linear-gradient(180deg, rgba(111, 229, 255, 0.16), rgba(24, 37, 57, 0.96));
  border-color: rgba(111, 229, 255, 0.22);
}

.danger-tone {
  background: linear-gradient(180deg, rgba(255, 92, 124, 0.16), rgba(24, 37, 57, 0.96));
  border-color: rgba(255, 92, 124, 0.22);
}

.summary-card {
  background: linear-gradient(180deg, rgba(32, 46, 70, 0.98), rgba(20, 32, 49, 0.94));
}

.summary-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.7rem;
}

.summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.summary-item span {
  color: var(--muted);
}

.summary-item strong {
  font-size: 0.96rem;
}

.finance-progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.finance-progress .progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, #31d0aa, #6fe5ff, #8d89ff, #ff5c7c);
}

.alerts-wrap {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.due-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  background: rgba(247, 191, 56, 0.1);
  border: 1px solid rgba(247, 191, 56, 0.18);
  color: #ffe8a8;
  font-size: 0.78rem;
}

.due-alert-empty {
  color: var(--muted);
  font-size: 0.76rem;
  padding: 0.2rem 0;
}

.upload-zone {
  border: 2px dashed rgba(141, 137, 255, 0.26);
  border-radius: 22px;
  min-height: 210px;
  padding: 1.3rem;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 0.65rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  cursor: pointer;
}

.upload-zone i {
  font-size: 1.9rem;
  color: var(--brand-soft);
}

.csv-insights {
  display: grid;
  gap: 0.75rem;
}

.csv-stat {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.82rem 0.95rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.badge-market {
  background: rgba(247, 191, 56, 0.14);
  color: #ffe8a8;
}

.badge-transport {
  background: rgba(111, 229, 255, 0.14);
  color: #bdf3ff;
}

.badge-online {
  background: rgba(141, 137, 255, 0.16);
  color: #d3d1ff;
}

.badge-food {
  background: rgba(255, 146, 102, 0.15);
  color: #ffd4bf;
}

.badge-pets {
  background: rgba(255, 92, 124, 0.14);
  color: #ffc7d3;
}

.badge-health {
  background: rgba(49, 208, 170, 0.14);
  color: #baf7e8;
}

.badge-credit {
  background: rgba(49, 208, 170, 0.16);
  color: #c9fff1;
}

.badge-card {
  background: rgba(255, 255, 255, 0.08);
  color: #f5f4ff;
}

.csv-stat span {
  color: var(--muted);
}

.csv-stat strong {
  font-size: 0.9rem;
  font-weight: 800;
}

.search-wrap {
  position: relative;
  min-width: min(100%, 260px);
}

.search-wrap i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-wrap input {
  padding-left: 2.25rem;
  border-radius: 999px;
}

.merchant-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
}

.merchant-item {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.03));
  border-radius: 18px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.merchant-item-featured {
  border-color: rgba(141, 137, 255, 0.24);
  background: linear-gradient(180deg, rgba(93, 90, 240, 0.1), rgba(111, 229, 255, 0.05));
}

.merchant-item-credit {
  border-color: rgba(49, 208, 170, 0.2);
  background: linear-gradient(180deg, rgba(49, 208, 170, 0.08), rgba(49, 208, 170, 0.04));
}

.merchant-item small,
.empty-summary,
.empty-state-cell {
  color: var(--muted);
}

.empty-state-cell {
  text-align: center;
  padding: 1.6rem 1rem !important;
}

.remove-row-btn {
  width: 100%;
  border-radius: 14px;
  font-weight: 700;
  border: 1px solid rgba(255, 92, 124, 0.4);
  color: #ffd5de;
  background: rgba(255, 92, 124, 0.08);
  font-size: 0.76rem;
  padding: 0.55rem 0.65rem;
}

.remove-row-btn:hover {
  background: rgba(255, 92, 124, 0.18);
  color: #fff;
}

.row-action-stack {
  display: grid;
  gap: 0.45rem;
}

.negative {
  color: var(--danger);
}

.positive {
  color: var(--success);
}

.save-status {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.income-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 800;
}

.btn-status-reset {
  border-radius: 999px;
  border: 1px solid rgba(120, 167, 255, 0.28);
  background: rgba(58, 123, 255, 0.12);
  color: #dce9ff;
  font-size: 0.68rem;
  white-space: nowrap;
}

.status-header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.dashboard-filter-wrap {
  min-width: min(100%, 360px);
}

.report-month-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.report-month-chip {
  border: 1px solid rgba(120, 167, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 16px;
  padding: 0.65rem 0.85rem;
  min-width: 150px;
  text-align: left;
}

.report-month-chip span,
.report-month-chip small {
  display: block;
}

.report-month-chip small {
  color: var(--muted);
  margin-top: 0.2rem;
}

.report-month-chip.active {
  background: linear-gradient(135deg, rgba(58, 123, 255, 0.22), rgba(29, 63, 122, 0.22));
  border-color: rgba(120, 167, 255, 0.36);
}

.dashboard-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(33, 48, 72, 0.94), rgba(24, 37, 57, 0.92));
  padding: 1rem;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dashboard-card span {
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-card strong {
  font-size: 1.3rem;
}

#historyChart {
  width: 100% !important;
  height: 220px !important;
  max-height: 220px;
}

#compositionChart {
  width: 100% !important;
  height: 220px !important;
  max-height: 220px;
}

@media (max-width: 991px) {
  .hero-panel,
  .sheet-header {
    align-items: stretch;
  }

  #historyChart,
  #compositionChart {
    height: 190px !important;
    max-height: 190px;
  }
}
