
:root {
  --bg: #0b1220;
  --bg-soft: #111827;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --orange: #d97706;
  --orange-soft: #ffedd5;
  --gray-soft: #e5e7eb;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: #f1f5f9; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.w-full { width: 100%; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { background: var(--bg); color: #fff; padding: 24px 18px; display: flex; flex-direction: column; gap: 22px; }
.brand { font-size: 1.2rem; font-weight: 800; letter-spacing: .2px; }
.brand small { display: block; font-weight: 500; color: rgba(255,255,255,.65); margin-top: 4px; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-link { color: rgba(255,255,255,.84); padding: 12px 14px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-chip { background: rgba(255,255,255,.1); padding: 12px; border-radius: 12px; }
.user-chip strong { display: block; }
.logout-btn { background: transparent; border: 1px solid rgba(255,255,255,.18); color: #fff; padding: 10px 12px; border-radius: 12px; }
.main { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.page-title { margin: 0; font-size: 1.8rem; }
.page-subtitle { margin: 6px 0 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.soft { background: var(--panel-soft); box-shadow: none; border: 1px solid var(--line); }
.cards-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card .label { color: var(--muted); font-size: 0.92rem; }
.card .metric { margin-top: 8px; font-size: 1.65rem; font-weight: 800; }
.card .hint { margin-top: 8px; color: var(--muted); font-size: 0.9rem; }
.metric.green, .value-income { color: var(--green); }
.metric.red, .value-outcome { color: var(--red); }
.section-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.table-card { padding: 0; overflow: hidden; }
.table-header { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #f8fafc; color: #475569; font-size: 0.92rem; position: sticky; top: 0; z-index: 1; }
tr:hover td { background: #fcfdff; }
.filters { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px; }
.filters .field, .modal-grid .field { display: flex; flex-direction: column; gap: 6px; }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 12px; padding: 10px 12px; background: #fff; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.btn { border: none; border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.secondary { background: #e2e8f0; color: #0f172a; }
.btn.soft { background: #eff6ff; color: var(--primary); }
.btn.danger { background: var(--red); color: #fff; }
.btn.success { background: var(--green); color: #fff; }
.btn.warning { background: var(--orange); color: #fff; }
.btn.small { padding: 7px 10px; border-radius: 10px; font-size: 0.88rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.gray { background: #eef2f7; color: #475569; }
.summary-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.summary-chip { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.summary-chip .title { color: var(--muted); font-size: .9rem; }
.summary-chip .amount { margin-top: 6px; font-size: 1.25rem; font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.toolbar .grow { flex: 1 1 260px; }
.error-banner, .info-banner, .success-banner { padding: 12px 14px; border-radius: 12px; }
.error-banner { background: var(--red-soft); color: var(--red); }
.info-banner { background: #e0f2fe; color: #0369a1; }
.success-banner { background: var(--green-soft); color: var(--green); }
.dialog-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.dialog-backdrop.open { display: flex; }
.dialog { width: min(820px, 100%); background: #fff; border-radius: 20px; box-shadow: 0 30px 80px rgba(15,23,42,.32); display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.dialog.small { width: min(560px, 100%); }
.dialog-header { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-body { padding: 18px 20px; overflow: auto; }
.dialog-footer { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.modal-grid .field.full { grid-column: 1 / -1; }
.empty-state { padding: 26px; text-align: center; color: var(--muted); }
.kv-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.kv { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.kv .k { color: var(--muted); font-size: .88rem; }
.kv .v { margin-top: 6px; font-weight: 700; }
.row-number { color: var(--muted); }
@media (max-width: 1200px) {
  .cards-grid, .summary-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filters { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .section-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 20; }
  .filters, .modal-grid { grid-template-columns: 1fr; }
  .cards-grid, .summary-row, .kv-list { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
}


.report-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.report-filters .report-filter-small {
  flex: 0 0 110px;
  max-width: 110px;
}

.report-filters .report-filter-wide {
  flex: 0 0 200px;
  max-width: 200px;
}

.report-filters .report-filter-actions {
  flex: 0 0 auto;
}

.report-filters .inline-actions {
  flex-wrap: nowrap;
}

@media (max-width: 1100px) {
  .report-filters .report-filter-small,
  .report-filters .report-filter-wide,
  .report-filters .report-filter-actions {
    flex: 1 1 180px;
    max-width: none;
  }

  .report-filters .inline-actions {
    flex-wrap: wrap;
  }
}
