/* ============================================================
   ArmeríaGES – Design System
   Theme: Military-Precision | Color: Deep Teal & Gunmetal
   Font: Sora (display) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #EEF2F7;
  --bg-alt:       #E4EAF3;
  --surface:      #FFFFFF;
  --surface-2:    #F7F9FC;

  --sidebar-bg:   #0B2D2A;
  --sidebar-w:    260px;
  --sidebar-w-sm: 72px;

  --primary:      #0E4F3C;
  --primary-mid:  #0F6B52;
  --primary-lt:   #1A9070;
  --accent:       #22C997;
  --accent-glow:  rgba(34,201,151,.25);

  --danger:       #E84545;
  --warning:      #F5A623;
  --info:         #2F9BFF;
  --success:      #22C997;

  --text-primary: #111827;
  --text-secondary:#4B5563;
  --text-muted:   #9CA3AF;
  --text-inv:     #FFFFFF;

  --border:       rgba(0,0,0,.08);
  --border-mid:   rgba(0,0,0,.12);
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:    0 12px 40px rgba(0,0,0,.12);
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    18px;
  --topbar-h:     64px;
  --transition:   .2s cubic-bezier(.4,0,.2,1);
}

@media (display-mode: standalone) {
  body { overscroll-behavior-y: contain; }
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; }
img { max-width: 100%; }
input, select, textarea { font-family: inherit; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 18px; left: 18px;
  width: calc(var(--sidebar-w) - 18px);
  height: calc(100vh - 36px);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 20px 60px rgba(15,23,42,.18);
}

.sidebar::before {
  content: '';
  display: block;
  width: 38px;
  height: 10px;
  margin: 18px 0 0 20px;
  background:
    radial-gradient(circle at 5px 5px,#ff5f57 0 3px,transparent 3.5px),
    radial-gradient(circle at 19px 5px,#ffbd2e 0 3px,transparent 3.5px),
    radial-gradient(circle at 33px 5px,#28c840 0 3px,transparent 3.5px);
  flex-shrink: 0;
}

/* Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 30px; height: 30px;
  background: transparent;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.brand-icon svg { width: 20px; height: 20px; }
.brand-text { overflow: hidden; white-space: nowrap; }
.brand-name {
  display: block;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: .76rem;
  color: var(--sidebar-text);
  letter-spacing: .3px;
}
.brand-sub { font-size: .56rem; color: var(--sidebar-muted); letter-spacing: .4px; }

.sidebar-toggle {
  color: var(--sidebar-muted);
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--sidebar-text); background: rgba(255,255,255,.08); }

/* User chip */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: auto 18px 18px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  background: rgba(255,255,255,.06);
  flex-shrink: 0;
}
.user-avatar {
  width: 34px; height: 34px;
  background: var(--primary-lt);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .75rem;
  color: #fff;
  flex-shrink: 0;
}
.user-info { overflow: hidden; white-space: nowrap; }
.user-name { display: block; font-size: .82rem; font-weight: 500; color: var(--sidebar-text); }
.user-role {
  font-size: .65rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  display: inline-block;
  margin-top: 3px;
}
.role-superadmin { background: rgba(229,57,53,.2); color: #ff6b6b; }
.role-admin       { background: rgba(34,201,151,.15); color: var(--accent); }
.role-agente      { background: rgba(47,155,255,.15); color: var(--info); }
.role-consultor   { background: rgba(245,166,35,.15); color: var(--warning); }
.role-instructor_tiro { background: rgba(34,201,151,.15); color: var(--accent); }

/* Nav */
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 12px; }

.sidebar-nav::before {
  content: 'PERSONAL';
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 12px);
  height: 34px;
  margin: 2px 6px 12px;
  border-radius: 9px;
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .8px;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}
.nav-section-label {
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--sidebar-muted);
  opacity: .72;
  padding: 15px 8px 8px;
  white-space: nowrap;
  overflow: hidden;
}
.nav-list { list-style: none; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  color: var(--sidebar-muted);
  font-size: .84rem;
  font-weight: 400;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  border-radius: 10px;
}
.nav-link:hover { color: var(--sidebar-text); background: rgba(255,255,255,.08); }
.nav-link.active {
  color: var(--sidebar-active-text);
  background: var(--sidebar-active-bg);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}
.nav-icon { width: 18px; text-align: center; flex-shrink: 0; font-size: .9rem; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
}

/* Footer */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px 14px 16px;
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.footer-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  font-size: .65rem;
  transition: var(--transition);
}
.footer-link:hover { color: var(--sidebar-text); background: rgba(255,255,255,.08); }
.footer-link.logout:hover { color: var(--danger); }
.footer-link i { font-size: .85rem; }

/* Collapsed sidebar: hidden menu, full workspace */
.sidebar.collapsed { transform: translateX(calc(-100% - 30px)); pointer-events:none; }
.sidebar.collapsed::before { margin-left: 17px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .footer-link span { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-user { justify-content: center; margin: auto 10px 14px; padding: 10px 0; }
.sidebar.collapsed .brand { justify-content: center; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .sidebar-toggle { display: none; }
.sidebar.collapsed .sidebar-nav::before {
  content: '';
  width: 28px;
  height: 16px;
  margin: 4px auto 10px;
  border-radius: 999px;
  background: var(--sidebar-active-bg);
}

/* ═══════════════════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════════════════ */
.main-wrapper {
  margin-left: calc(var(--sidebar-w) + 18px);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}
.main-wrapper.expanded { margin-left: 0; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-radius: 0 0 0 18px;
  box-shadow: 0 8px 28px rgba(15,23,42,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.mobile-toggle { display: none; color: var(--text-secondary); padding: 8px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  width: 340px;
  transition: var(--transition);
}
.search-box:focus-within {
  border-color: var(--primary-lt);
  box-shadow: 0 0 0 3px rgba(14,79,60,.08);
}
.search-icon { color: var(--text-muted); font-size: .85rem; }
.search-input { flex: 1; border: none; background: none; outline: none; font-size: .85rem; color: var(--text-primary); }
.search-input::placeholder { color: var(--text-muted); }
.search-kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem;
  background: var(--bg-alt);
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-muted);
}

.topbar-date { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--text-secondary); }
.topbar-date i { color: var(--text-muted); }

.topbar-actions { display: flex; gap: 6px; }
.action-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  position: relative;
  transition: var(--transition);
  background: var(--bg);
  border: 1px solid var(--border);
}
.action-btn:hover { color: var(--primary); border-color: var(--primary-lt); }
.action-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: .55rem;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  position: relative;
  transition: var(--transition);
}
.topbar-profile:hover { background: var(--bg); }
.profile-avatar {
  width: 34px; height: 34px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .72rem;
}
.profile-caret { font-size: .65rem; color: var(--text-muted); }
.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px); right: 0;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 220px;
  padding: 8px;
  z-index: 300;
}
.profile-dropdown.show { display: block; }
.dropdown-header { padding: 8px 8px 12px; }
.dropdown-header strong { display: block; font-size: .85rem; }
.dropdown-header small { color: var(--text-muted); font-size: .75rem; }
.profile-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  font-size: .82rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
}
.profile-dropdown a:hover { background: var(--bg); color: var(--text-primary); }
.profile-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }
.text-danger { color: var(--danger) !important; }

/* ── Page Content ────────────────────────────────────────── */
.page-content { flex: 1; padding: 28px 28px 40px; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-title {
  font-family: 'Sora', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-subtitle { font-size: .85rem; color: var(--text-secondary); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   COMPONENTS
═══════════════════════════════════════════════════════════ */

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-mid); box-shadow: 0 4px 14px rgba(14,79,60,.3); }
.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover { background: #1ab584; box-shadow: 0 4px 14px rgba(34,201,151,.35); }
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-mid);
}
.btn-outline:hover { background: var(--bg); color: var(--text-primary); border-color: var(--border-mid); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-icon { padding: 9px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-family: 'Sora', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary-lt); }
.card-body { padding: 22px; }
.card-actions { display: flex; gap: 6px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--stat-color, var(--primary));
  opacity: .05;
  transform: translate(20px, -20px);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-label { font-size: .75rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px; }
.stat-value { font-family: 'Sora', sans-serif; font-size: 1.65rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-compare { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: .78rem; color: var(--text-muted); }
.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
}
.stat-badge.up   { background: rgba(34,201,151,.1); color: var(--success); }
.stat-badge.down { background: rgba(232,69,69,.1);  color: var(--danger); }
.stat-icon {
  position: absolute;
  top: 20px; right: 20px;
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  background: var(--stat-color, var(--primary));
  color: #fff;
  opacity: .9;
}

/* ── Hero Balance Card ───────────────────────────────────── */
.balance-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 60%, var(--primary-lt) 100%);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(14,79,60,.35);
}
.balance-card::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.balance-card::before {
  content: '';
  position: absolute;
  right: 60px; bottom: -60px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.balance-label { font-size: .78rem; opacity: .7; letter-spacing: .4px; margin-bottom: 8px; }
.balance-amount { font-family: 'Sora', sans-serif; font-size: 2.4rem; font-weight: 800; line-height: 1; }
.balance-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: .75rem;
  font-weight: 600;
  margin-left: 12px;
  vertical-align: middle;
}
.balance-actions { display: flex; gap: 10px; margin-top: 24px; position: relative; z-index: 1; }
.balance-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}
.balance-btn.add { background: var(--accent); color: #fff; }
.balance-btn.send { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.balance-btn.req  { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.balance-btn:hover { opacity: .9; }

/* ── Table ───────────────────────────────────────────────── */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.data-table thead th {
  background: var(--bg);
  padding: 11px 16px;
  text-align: left;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }
.data-table td { padding: 13px 16px; color: var(--text-secondary); vertical-align: middle; }
.data-table td strong { color: var(--text-primary); font-weight: 500; }

/* ── Badges / Pills ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge-success { background: rgba(34,201,151,.1);  color: #0d9e74; }
.badge-warning { background: rgba(245,166,35,.1);  color: #c17f00; }
.badge-danger  { background: rgba(232,69,69,.1);   color: #c0392b; }
.badge-info    { background: rgba(47,155,255,.1);  color: #0d7fd0; }
.badge-muted   { background: var(--bg-alt);        color: var(--text-muted); }
.badge-primary { background: rgba(14,79,60,.1);    color: var(--primary); }
.badge-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .8rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: .84rem;
  color: var(--text-primary);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary-lt);
  box-shadow: 0 0 0 3px rgba(14,79,60,.08);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: .74rem; color: var(--text-muted); margin-top: 5px; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; background: var(--bg); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 20px; width: fit-content; }
.tab-btn {
  padding: 7px 16px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  cursor: pointer;
}
.tab-btn.active { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.tab-btn:hover:not(.active) { color: var(--text-secondary); }

/* ── Pagination ──────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.page-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: var(--transition);
  cursor: pointer;
}
.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: .84rem;
  margin-bottom: 16px;
}
.alert-success { background: rgba(34,201,151,.08); border: 1px solid rgba(34,201,151,.2); color: #0d9e74; }
.alert-danger   { background: rgba(232,69,69,.08);  border: 1px solid rgba(232,69,69,.2);  color: #c0392b; }
.alert-warning  { background: rgba(245,166,35,.08); border: 1px solid rgba(245,166,35,.2); color: #c17f00; }
.alert-info     { background: rgba(47,155,255,.08); border: 1px solid rgba(47,155,255,.2); color: #0d7fd0; }

/* ── Grid helpers ────────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
.grid-2-1 { grid-template-columns: 2fr 1fr; }

/* ── Chart toggle pills ──────────────────────────────────── */
.chart-pills { display: flex; gap: 4px; }
.chart-pill {
  padding: 5px 12px;
  border-radius: 99px;
  font-size: .73rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}
.chart-pill.active { background: var(--primary); color: #fff; }

/* ── Mini card for income/expense ────────────────────────── */
.flow-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 20px;
}
.flow-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  margin-bottom: 12px;
}
.flow-icon.in  { background: rgba(34,201,151,.12); color: var(--success); }
.flow-icon.out { background: rgba(245,166,35,.12);  color: var(--warning); }
.flow-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.flow-value { font-family: 'Sora', sans-serif; font-size: 1.25rem; font-weight: 700; margin: 4px 0; }

/* ── Confidential overlay ────────────────────────────────── */
.confidential-blur {
  filter: blur(4px);
  user-select: none;
  pointer-events: none;
  transition: var(--transition);
}
.confidential-wrapper:hover .confidential-blur { filter: none; }
.confidential-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(232,69,69,.1);
  border: 1px solid rgba(232,69,69,.25);
  color: var(--danger);
  font-size: .7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  letter-spacing: .5px;
}

/* ── Steps / Timeline ────────────────────────────────────── */
.timeline { list-style: none; }
.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px; top: 32px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem;
  flex-shrink: 0;
  z-index: 1;
}
.timeline-dot.done    { background: var(--success); color: #fff; }
.timeline-dot.pending { background: var(--bg-alt); border: 2px solid var(--border-mid); color: var(--text-muted); }
.timeline-dot.active  { background: var(--info); color: #fff; }
.timeline-content { flex: 1; }
.timeline-title { font-weight: 500; font-size: .84rem; }
.timeline-date  { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-muted); margin-bottom: 6px; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { opacity: .4; }

/* ── Utility ─────────────────────────────────────────────── */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.mb-4 { margin-bottom: 28px; }
.mt-3 { margin-top: 20px; }
.gap-2 { gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-muted { color: var(--text-muted); font-size: .8rem; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.mono { font-family: 'JetBrains Mono', monospace; letter-spacing: -.3px; }
.w-full { width: 100%; }

/* ── Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--login-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,201,151,.12) 0%, transparent 70%);
}
.login-page::after {
  content: '';
  position: absolute;
  bottom: -150px; left: -150px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14,79,60,.3) 0%, transparent 70%);
}
.login-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(20px);
  position: relative;
  z-index: 1;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 48px; height: 48px;
  background: var(--primary-lt);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.login-logo-icon svg { width: 28px; height: 28px; }
.login-title { font-family: 'Sora', sans-serif; font-size: 1.5rem; font-weight: 700; color: #fff; margin-bottom: 6px; }
.login-sub { font-size: .84rem; color: rgba(255,255,255,.45); margin-bottom: 28px; }
.login-form .form-label { color: rgba(255,255,255,.6); }
.login-form .form-control {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.1);
  color: #fff;
}
.login-form .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,201,151,.15);
}
.login-form .form-control::placeholder { color: rgba(255,255,255,.2); }
.login-security {
  display: flex; align-items: center; gap: 8px;
  margin-top: 24px;
  font-size: .74rem;
  color: rgba(255,255,255,.3);
  justify-content: center;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .search-box { width: 240px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(calc(-100% - 24px)); top: 12px; left: 12px; height: calc(100vh - 24px); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .mobile-toggle { display: flex; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-1-2, .grid-2-1 { grid-template-columns: 1fr; }
  .page-content { padding: 18px 16px 32px; }
  .topbar { padding: 0 16px; }
  .topbar-date, .search-kbd { display: none; }
  .search-box { width: 180px; }
  .balance-amount { font-size: 1.8rem; }
}
@media (max-width: 600px) {
  .grid-4 { grid-template-columns: 1fr; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .topbar-date { display: none; }
  .search-box { display: none; }
  .topbar { height: 58px; gap: 8px; }
  .topbar-profile > div:not(.profile-avatar), .topbar-profile #profileCaret { display:none !important; }
  .page-title { font-size: 1.25rem; }
  .btn { padding: 8px 12px; }
  .data-table { min-width: 720px; }
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card-body { padding: 16px; }
  .dev-footer,.mip-notice { display:none; }
  .page-content { padding-bottom: 28px; }
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(34,201,151,.4); }
  70%  { box-shadow: 0 0 0 10px rgba(34,201,151,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,201,151,0); }
}
.animate-fade-up { animation: fadeUp .4s ease forwards; }
.stat-card { animation: fadeUp .4s ease forwards; }
.stat-card:nth-child(1) { animation-delay: .05s; }
.stat-card:nth-child(2) { animation-delay: .1s; }
.stat-card:nth-child(3) { animation-delay: .15s; }
.stat-card:nth-child(4) { animation-delay: .2s; }

/* ═══════════════════════════════════════════════════════════
   MIP NOTICE + DEV FOOTER
═══════════════════════════════════════════════════════════ */

/* MIP Notice bar */
.mip-notice {
  background: linear-gradient(90deg, #0f2744 0%, #1a3a5c 100%);
  border-top: 2px solid #2b6cb0;
  border-left: 1px solid rgba(255,255,255,.08);
  border-top-left-radius: 14px;
  padding: 10px 0;
  position: fixed;
  bottom: 44px;
  left: calc(var(--sidebar-w) + 18px);
  right: 0;
  z-index: 90;
  transition: left var(--transition);
}
body.sidebar-collapsed .mip-notice,
.mip-notice.expanded { left: 0; }
.mip-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  max-width: 100%;
}
.mip-icon { flex-shrink: 0; }
.mip-text {
  flex: 1;
  font-size: .76rem;
  color: rgba(255,255,255,.75);
  line-height: 1.5;
}
.mip-text strong { color: #fff; }
.mip-text a {
  color: #63b3ed;
  font-weight: 600;
  text-decoration: underline;
}
.mip-text a:hover { color: #90cdf4; }
.mip-close {
  color: rgba(255,255,255,.4);
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: var(--transition);
}
.mip-close:hover { color: #fff; background: rgba(255,255,255,.1); }

/* Developer footer */
.dev-footer {
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255,255,255,.06);
  border-left: 1px solid rgba(255,255,255,.08);
  border-top-left-radius: 14px;
  position: fixed;
  bottom: 0;
  left: calc(var(--sidebar-w) + 18px);
  right: 0;
  z-index: 91;
  transition: left var(--transition);
}
body.sidebar-collapsed .dev-footer,
.dev-footer.expanded { left: 0; }
.dev-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 44px;
  gap: 16px;
}
.dev-left, .dev-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .72rem;
  color: rgba(255,255,255,.35);
}
.dev-brand {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  color: rgba(255,255,255,.7);
  font-size: .75rem;
}
.dev-sep { opacity: .25; }
.dev-mip-link {
  color: #63b3ed !important;
  font-size: .7rem;
  font-weight: 500;
  display: flex; align-items: center; gap: 5px;
}
.dev-mip-link:hover { color: #90cdf4 !important; }
.dev-by { color: rgba(255,255,255,.3); }
.dev-name {
  color: rgba(255,255,255,.8);
  font-size: .76rem;
  font-weight: 600;
}
.dev-wa {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #25D366;
  color: #fff !important;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
  transition: var(--transition);
}
.dev-wa:hover { background: #1da851; }
.dev-wa .fab { font-size: .78rem; }

/* Ensure main content doesn't hide behind footer */
.page-content { padding-bottom: 110px; } /* space for fixed footer+mip */

@media(max-width:600px){
  .dev-footer-inner { flex-direction:column; height:auto; padding:10px 16px; gap:6px; }
  .mip-inner { padding:0 16px; }
  .mip-text { font-size:.7rem; }
}

/* ── Sidebar Expand Float Button ─────────────────────────── */
.sidebar-expand-btn {
  display: none; /* shown via JS when collapsed */
  position: fixed;
  top: 14px;
  left: 10px;
  z-index: 201;
  width: 44px;
  height: 44px;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(14,79,60,.4);
  transition: var(--transition);
}
.sidebar-expand-btn:hover { background: var(--primary-mid); transform: scale(1.05); }

/* Fix collapsed sidebar width sync with footer */
.main-wrapper.expanded ~ .dev-footer,
.main-wrapper.expanded ~ .mip-notice { left: 0; }

@media(max-width:700px){
  .dev-footer,.mip-notice{display:none!important;}
  .main-wrapper{margin-left:0!important;width:100%;}
  body{display:block;}
}
