:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #062454;
  --muted: #536681;
  --border: #d6e1ef;
  --primary: #1557bd;
  --primary-dark: #0d4094;
  --soft: #eef4fb;
  --green: #08784b;
  --teal: #0f7c94;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}
.hidden { display: none !important; }
.app-shell { padding: 18px 16px 28px; }
.brand-logo { max-height: 64px; margin-bottom: 8px; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 16px; }
h1 { font-size: 34px; line-height: 1.1; margin: 0 0 8px; color: var(--text); }
h2 { font-size: 26px; margin: 0 0 4px; color: var(--text); }
.muted { color: var(--muted); margin: 0; font-size: 16px; }
.topbar-actions { display: flex; gap: 12px; align-items: center; }
.btn { border: 0; border-radius: 10px; padding: 13px 18px; font-weight: 800; font-size: 15px; cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary, .btn-ghost { background: #eaf0f7; color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.status-row { display: flex; gap: 24px; align-items: center; margin: 14px 0 16px; font-size: 18px; }
.error-text { color: var(--danger); font-weight: 800; }

.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.metric-card {
  display: flex; align-items: center; gap: 20px; min-height: 138px; padding: 26px;
  border-radius: 20px; background: linear-gradient(135deg, #fff 0%, #f8fbff 100%);
  border: 1px solid var(--border); box-shadow: 0 14px 34px rgba(10,30,60,.06); position: relative; overflow: hidden;
}
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--teal); }
.metric-card-amount::before, .metric-card-today::before { background: var(--green); }
.metric-card-icon { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: #eaf8fa; border: 1px solid #cae9ee; flex: 0 0 auto; }
.metric-card-amount .metric-card-icon, .metric-card-today .metric-card-icon { background: #eaf8f1; border-color: #cdebdc; }
.metric-card-icon svg { width: 30px; height: 30px; fill: none; stroke: var(--teal); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.metric-card-amount .metric-card-icon svg, .metric-card-today .metric-card-icon svg { stroke: var(--green); }
.metric-card-content { display: flex; flex-direction: column; gap: 6px; }
.metric-card-label { font-weight: 800; color: #40516c; }
.metric-card-content strong { font-size: 36px; line-height: 1; color: var(--text); }
.metric-card-content small { color: #65748e; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 26px; margin-bottom: 22px; box-shadow: 0 12px 26px rgba(20,50,90,.04); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.panel-heading.compact { margin-bottom: 10px; }
.charts-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 18px; margin-bottom: 22px; }
.chart-panel { margin-bottom: 0; }
.chart-panel canvas { width: 100%; max-height: 240px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; color: var(--muted); font-size: 13px; font-weight: 700; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }

.filters-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; align-items: end; }
label { color: #53627a; font-weight: 800; display: flex; flex-direction: column; gap: 8px; }
.input, .select { width: 100%; border: 1px solid #cfdceb; border-radius: 10px; background: #fff; color: var(--text); padding: 13px 14px; font-size: 15px; outline: none; }
.input:focus, .select:focus { border-color: #7aa7e8; box-shadow: 0 0 0 3px rgba(21,87,189,.12); }
.results-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.pagination-size { display: flex; flex-direction: row; align-items: center; gap: 8px; color: #53627a; font-weight: 800; }
.pagination-size .select { width: 90px; }
.table-wrap { overflow: auto; max-height: 520px; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
th { background: #e9eff6; color: var(--text); text-align: left; padding: 14px 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; z-index: 1; }
td { border-bottom: 1px solid #dbe5f1; padding: 14px 12px; vertical-align: top; font-size: 14px; }
td small { color: var(--muted); display: block; margin-top: 4px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; font-weight: 800; background: #ecfdf3; color: #08784b; }
.empty-state { color: var(--muted); text-align: center; padding: 24px; }
.pagination-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pagination-controls { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination-pages { display: flex; align-items: center; gap: 2px; }
.pagination-page, .pagination-link { min-width: 38px; height: 38px; padding: 0 12px; border: 1px solid #d9e2ef; background: #fff; color: #2764b8; border-radius: 8px; font-weight: 800; cursor: pointer; }
.pagination-page.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination-link:disabled { color: #9aa8bc; background: #eef3f9; cursor: not-allowed; }
.pagination-dots { min-width: 34px; text-align: center; color: #7a8aa0; font-weight: 800; }
.pagination-info { font-size: 13px; color: #66758d; font-weight: 800; }

.loading-overlay { position: fixed; inset: 0; background: rgba(6,22,48,.35); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 9999; }
.loading-overlay.is-visible { display: flex; }
.loading-modal { border-radius: 24px; padding: 34px 38px; width: min(490px, 92vw); background: #fff; text-align: center; box-shadow: 0 24px 60px rgba(10, 30, 60, .25); }
.loading-gear-wrap { width: 96px; height: 96px; margin: 0 auto 22px; border-radius: 28px; display: grid; place-items: center; background: #eef5ff; border: 1px solid #d8e7ff; }
.loading-gear { width: 58px; height: 58px; fill: none; stroke: #1957b7; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; animation: gearSpin 1.2s linear infinite; }
@keyframes gearSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.loading-modal-title { font-size: 28px; font-weight: 900; color: var(--text); margin: 0 0 12px; }
.loading-modal-message { font-size: 17px; color: #65748e; line-height: 1.45; }
.loading-progress { height: 4px; border-radius: 999px; background: #e4ecf6; overflow: hidden; margin-top: 26px; }
.loading-progress span { display: block; width: 45%; height: 100%; border-radius: inherit; background: #1957b7; animation: loadingBar 1.1s ease-in-out infinite alternate; }
@keyframes loadingBar { from { transform: translateX(-35%); } to { transform: translateX(145%); } }

@media (max-width: 1200px) { .cards-grid, .charts-grid, .filters-grid { grid-template-columns: 1fr; } .topbar { flex-direction: column; } }
