/* PayCore — Design System */
:root {
  --primary:      #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light:#EFF6FF;
  --success:      #10B981;
  --warning:      #F59E0B;
  --danger:       #EF4444;
  --info:         #3B82F6;
  --sidebar-bg:   #1a2438;
  --sidebar-w:    260px;
  --topbar-h:     64px;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --bg:           #f1f5f9;
  --card:         #ffffff;
  --radius:       10px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: .875rem;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.layout-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 1040;
  transition: transform .25s ease;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.15);
}
.sidebar-logo {
  max-height: 72px;
  max-width: 210px;
  width: auto;
  object-fit: contain;
  display: block;
  border-radius: 14px;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.35));
}

.sidebar-menu { flex: 1; padding: .75rem 0; }

.menu-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  padding: 1rem 1.25rem .35rem;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  border-radius: 0;
  transition: background .15s, color .15s;
  font-size: .83rem;
  font-weight: 500;
  position: relative;
}
.menu-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.menu-item.active {
  background: rgba(37,99,235,.3);
  color: #fff;
}
.menu-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.menu-item i { font-size: 1rem; width: 1.1rem; flex-shrink: 0; }
.menu-item.text-danger-light { color: rgba(239,68,68,.7); }
.menu-item.text-danger-light:hover { color: #EF4444; background: rgba(239,68,68,.1); }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding: .5rem 0; }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1039;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-title h5 { font-size: .9rem; font-weight: 600; color: var(--text-muted); }
.sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: .25rem;
  display: none;
}

/* ── Content area ─────────────────────────────────────────────────────────── */
.content-area { padding: 1.5rem; flex: 1; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: .875rem;
}
.card-body { padding: 1.25rem; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #EFF6FF; color: var(--primary); }
.stat-icon.green  { background: #ECFDF5; color: var(--success); }
.stat-icon.amber  { background: #FFFBEB; color: var(--warning); }
.stat-icon.red    { background: #FEF2F2; color: var(--danger); }
.stat-icon.purple { background: #F5F3FF; color: #7C3AED; }

.stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-sub   { font-size: .72rem; color: var(--text-muted); margin-top: .1rem; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table { font-size: .82rem; }
.table th { font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: #f8fafc; border-top: none; }
.table > :not(caption) > * > * { padding: .65rem .85rem; }
.table-hover > tbody > tr:hover > * { background-color: var(--primary-light); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-label { font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; }
.form-control, .form-select {
  font-size: .85rem;
  border-color: var(--border);
  border-radius: 8px;
  padding: .5rem .75rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-section {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.form-section-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); margin-bottom: 1rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { font-size: .83rem; font-weight: 500; border-radius: 8px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { font-size: .78rem; padding: .3rem .65rem; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { font-size: .7rem; font-weight: 600; padding: .28em .6em; border-radius: 6px; }
.bg-warning { color: #1e293b !important; }

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.avatar-sm {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-md {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.avatar-lg {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header h4 { font-size: 1.15rem; font-weight: 700; color: var(--text); margin: 0; }
.page-header p  { font-size: .8rem; color: var(--text-muted); margin: .1rem 0 0; }

/* ── Login logo ──────────────────────────────────────────────────────────── */
.login-logo-img {
  max-height: 140px;
  max-width: 280px;
  width: auto;
  object-fit: contain;
  border-radius: 20px;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.18));
  transition: transform .2s ease;
}
.login-logo-img:hover {
  transform: scale(1.03);
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a2438 0%, #1D4ED8 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
}
.login-logo {
  width: 56px; height: 56px;
  background: var(--primary);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: #fff; margin: 0 auto 1.25rem;
}

/* ── Revenue type colors ─────────────────────────────────────────────────── */
.revenue-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2em .55em;
  border-radius: 6px;
  font-size: .7rem;
  font-weight: 600;
  background: rgba(37,99,235,.1);
  color: var(--primary);
}

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert-success { background: #ECFDF5; border-color: #6EE7B7; color: #065F46; }
.alert-error, .alert-danger { background: #FEF2F2; border-color: #FCA5A5; color: #991B1B; }
.alert-warning { background: #FFFBEB; border-color: #FCD34D; color: #92400E; }
.alert-info    { background: #EFF6FF; border-color: #93C5FD; color: #1E40AF; }

/* ── Overdue highlight ───────────────────────────────────────────────────── */
tr.row-overdue td { color: var(--danger); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar-toggle { display: flex; }
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
}

/* ── Dashboard chart container ───────────────────────────────────────────── */
.chart-container { position: relative; height: 260px; }

/* ── Setup page ──────────────────────────────────────────────────────────── */
.setup-card {
  max-width: 600px;
  margin: 4rem auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
}
