:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #eef4fb;
  --sidebar-active: #2b4a87;
  --text: #14213d;
  --muted: #5e6c84;
  --border: #d8e0ed;
  --primary: #1d4ed8;
  --primary-dark: #173ea9;
  --danger: #c62828;
  --success: #217a3d;
  --warning: #b7791f;
  --shadow: 0 16px 40px rgba(20, 33, 61, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, #f7faff 0%, #edf3fb 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--primary);
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #11203d 0%, #1b2e57 100%);
  color: #fff;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  padding: 8px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  margin-bottom: 8px;
}

.sidebar-brand h2 {
  margin: 0;
  font-size: 1.25rem;
}

.sidebar-brand p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.95rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-link {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.sidebar-link.active {
  background: var(--sidebar-active);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.page-content {
  padding: 26px;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(216, 224, 237, 0.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel + .panel {
  margin-top: 20px;
}

.panel-narrow {
  max-width: 560px;
}

.inset-panel {
  background: var(--surface-alt);
  box-shadow: none;
}

.page-header,
.section-header,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-header {
  margin-bottom: 22px;
}

.section-header {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
}

h1,
h2 {
  margin: 0;
}

.muted-text {
  margin: 8px 0 0;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.stat-card {
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid rgba(216, 224, 237, 0.72);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-card strong {
  font-size: 2rem;
  line-height: 1;
}

.stat-label {
  color: var(--muted);
  font-weight: 700;
}

.stat-total {
  border-top: 4px solid #334155;
}

.stat-pending {
  border-top: 4px solid #f59e0b;
}

.stat-verified {
  border-top: 4px solid #2563eb;
}

.stat-review {
  border-top: 4px solid #eab308;
}

.stat-settled {
  border-top: 4px solid #16a34a;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 22px;
}

.chart-panel {
  min-height: 360px;
}

.chart-panel canvas {
  width: 100% !important;
  height: 280px !important;
}

.dashboard-filter-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.dashboard-filter-actions {
  justify-content: flex-end;
}

.report-filters-grid {
  grid-template-columns: repeat(5, minmax(160px, 1fr));
}

.bank-filters-grid {
  grid-template-columns: repeat(5, minmax(160px, 1fr));
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-wide {
  grid-column: span 2;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0 14px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

.btn {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  font-weight: 600;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #dbe4f3;
  color: var(--text);
}

.btn-success {
  background: #dcfce7;
  color: var(--success);
}

.btn-warning {
  background: #fef3c7;
  color: var(--warning);
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
}

.message {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
}

.message-success {
  background: #e8f8ee;
  border-color: #b7e3c5;
  color: #185c30;
}

.message-error {
  background: #fdeeee;
  border-color: #f5c2c2;
  color: #8f1f1f;
}

.status-line {
  color: var(--muted);
  font-weight: 600;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

thead th {
  text-align: left;
  padding: 14px 12px;
  font-size: 0.88rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.16), transparent 32%),
    radial-gradient(circle at bottom right, rgba(20, 33, 61, 0.14), transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, #edf3fb 100%);
}

.login-shell {
  width: 100%;
  max-width: 460px;
}

.login-panel {
  padding: 32px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 33, 61, 0.36);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(100%, 560px);
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal-wide {
  width: min(100%, 980px);
}

@media (max-width: 1080px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .filters-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: 18px;
  }

  .dashboard-filter-grid,
  .report-filters-grid,
  .bank-filters-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 640px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-filter-grid,
  .report-filters-grid,
  .bank-filters-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: span 1;
  }

  .page-header,
  .section-header,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }
}
