/* ==================================================================
 * SUUBI SACCO — Master CSS (Consolidated)
 * ================================================================== */

:root {
  --primary:       #f7941e; /* Brand Orange */
  --primary-600:   #e07b0d;
  --secondary:     #2e3192; /* Brand Blue */
  --bg:            #f8fafc;
  --surface:       #ffffff;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --sidebar-w:     250px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { text-decoration: none; color: var(--secondary); }
h1, h2, h3, h4 { margin-top: 0; color: var(--secondary); }
p { margin-top: 0; }

/* ==================================================================
 * 1. ADMIN DASHBOARD LAYOUT
 * ================================================================== */
.layout { display: flex; min-height: 100vh; width: 100%; }
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  padding: 1.5rem 2rem;
  min-width: 0;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--secondary);
  color: #fff;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}
.sidebar .brand {
  font-weight: 800; font-size: 1.1rem;
  padding-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1rem; color: #fff;
}
.sidebar .heading {
  color: #818cf8; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 700; padding: 1rem 0.5rem 0.25rem;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  display: flex !important; align-items: center !important; gap: 12px !important;
  padding: 10px 12px !important; border-radius: 8px;
  color: #c7d2fe; font-size: 0.9rem; font-weight: 500;
  transition: all 0.15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(247,148,30,0.3); }
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar nav a .badge {
  margin-left: auto !important; background: #dc2626; color: #fff;
  padding: 2px 8px; border-radius: 12px; font-size: 0.7rem; font-weight: 700;
}

/* Topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
  margin: -1.5rem -2rem 2rem -2rem;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.page-title { font-size: 1.5rem; font-weight: 800; margin: 0; }
.user-menu { display: flex; align-items: center; gap: 1rem; }
.user-info { text-align: right; line-height: 1.2; }
.user-name { font-weight: 700; font-size: 0.9rem; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }
.avatar {
  width: 40px; height: 40px; background: var(--secondary); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
}

/* ==================================================================
 * 2. ADMIN COMPONENTS (Cards, Grids, Tables, Forms)
 * ================================================================== */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 1.5rem; box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
a.card { display: block; transition: transform 0.2s, box-shadow 0.2s; }
a.card:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(0,0,0,0.08) !important; border-color: var(--primary) !important; }
.card h3 { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; font-weight: 700; }
.card .stat { font-size: 1.75rem; font-weight: 800; margin: 0 0 0.5rem 0; color: var(--secondary); }

/* Grids */
.grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important; gap: 1.5rem !important; width: 100%; }
.kpi-grid { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; gap: 1.5rem !important; margin-bottom: 2rem !important; }
.kpi-grid .card { border-top: 4px solid var(--secondary); }
.kpi-grid .card:nth-child(even) { border-top-color: var(--primary); }

/* Tables (Forces 100% width on desktop, scroll on mobile) */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { 
  display: table !important; width: 100% !important; border-collapse: collapse; 
  background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 2rem;
}
.table th, .table td { padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.9rem; vertical-align: middle; }
.table th { background: #f8fafc; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); font-weight: 700; letter-spacing: 0.05em; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }

/* Forms */
.form-inline { display: flex !important; gap: 1rem !important; align-items: center !important; flex-wrap: wrap !important; background: #fff; padding: 1rem 1.25rem; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 2rem; }
.form-inline label { margin: 0; font-weight: 600; color: var(--text-muted); font-size: 0.9rem; }
.form-inline select, .form-inline input { width: auto; flex: 1; min-width: 150px; margin-bottom: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="file"], select, textarea {
  width: 100%; padding: 0.75rem 1rem; border: 1px solid #cbd5e1; border-radius: 8px;
  font-family: inherit; font-size: 0.95rem; color: var(--text); background: #fff;
  margin-bottom: 1rem; transition: border 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(247,148,30,0.15); }

/* Buttons & Badges */
.btn { display: inline-block; padding: 0.6rem 1.25rem; border-radius: 8px; background: var(--primary); color: #fff; border: none; cursor: pointer; font-weight: 600; font-size: 0.9rem; text-align: center; transition: background 0.15s; }
.btn:hover { background: var(--primary-600); }
.btn-ghost { background: #fff; color: var(--secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f8fafc; }

.badge { display: inline-block; padding: 0.25rem 0.6rem; font-size: 0.75rem; font-weight: 700; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #e0f2fe; color: #075985; }
.badge-muted   { background: #f1f5f9; color: #475569; }

.alert { padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; border-left: 4px solid; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #16a34a; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #dc2626; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #f59e0b; }

/* ==================================================================
 * 3. MOBILE WALLET UI (Member Portal)
 * ================================================================== */
/* ==================================================================
 * 3. MOBILE WALLET UI (Member Portal) - DESKTOP FIX
 * ================================================================== */

/* Darker background for the desktop monitor */
body.wallet-body {
  background: #cbd5e1; 
  margin: 0; 
  font-family: system-ui, -apple-system, sans-serif; 
  color: var(--text);
}

/* The actual "Phone Screen" container */
.wallet-app {
  max-width: 480px;      
  margin: 0 auto;        /* Centers the white app container */
  background: #f1f5f9;   
  min-height: 100vh;
  padding-bottom: 85px;  
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,0.1); 
  overflow-x: hidden;
}

/* Bulletproof Bottom Navigation Centering */
.bottom-nav { 
  position: fixed; 
  bottom: 0; 
  left: 0;          /* Force left */
  right: 0;         /* Force right */
  margin: 0 auto;   /* Auto margins force it to center */
  width: 100%;
  max-width: 480px; /* Matches the wallet-app width */
  background: #fff; 
  border-top: 1px solid var(--border); 
  display: flex; 
  justify-content: space-around; 
  padding: 0.75rem 0 1.25rem; 
  z-index: 100; 
}

/* Ensure the header and content don't stretch */
.wallet-header {
  border-radius: 0; /* Optional: removes the curve on desktop, keeps it flat */
}
@media (min-width: 481px) {
  .wallet-header { border-radius: 0 0 24px 24px; }
}
.wallet-header { background: var(--secondary); color: #fff; padding: 1.25rem 1.25rem 3.5rem; border-radius: 0 0 24px 24px; }
.wallet-header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.wallet-logo { height: 36px; object-fit: contain; background: #ffffff; padding: 4px 8px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.wallet-balance p { margin: 0; color: #c7d2fe; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.wallet-balance h2 { margin: 0.25rem 0 0; font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; }

.wallet-actions { 
  display: grid; 
  grid-template-columns: repeat(4, 1fr); 
  gap: 0.75rem; 
  padding: 0 1.25rem; 
  margin-top: -2.5rem; 
  position: relative; 
  z-index: 10; 
  max-width: 480px; /* Prevents them from stretching */
  margin-left: auto; 
  margin-right: auto;
}
.action-btn { background: #fff; padding: 1rem 0.5rem; border-radius: 16px; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.06); text-decoration: none; color: var(--secondary); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; transition: transform 0.1s; }
.action-btn:active { transform: scale(0.95); }
.action-btn svg { width: 24px; height: 24px; color: var(--primary); }
.action-btn span { font-size: 0.75rem; font-weight: 600; }

.wallet-content { padding: 1.5rem 1.25rem; }

/* Wallet Cards & Lists */
.w-card { background: #fff; border-radius: 16px; padding: 1.25rem; box-shadow: 0 2px 10px rgba(0,0,0,0.03); margin-bottom: 1rem; border: 1px solid #f1f5f9; }
.w-card-title { font-size: 1rem; font-weight: 700; color: var(--secondary); margin: 0 0 1rem; display: flex; justify-content: space-between; align-items: center; }
.w-list { list-style: none; padding: 0; margin: 0; }
.w-list-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; border-bottom: 1px solid #f1f5f9; }
.w-list-item:last-child { border-bottom: none; padding-bottom: 0; }
.w-list-left { display: flex; flex-direction: column; gap: 0.25rem; }
.w-list-title { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.w-list-subtitle { font-size: 0.8rem; color: var(--text-muted); }
.w-list-amount { font-weight: 700; font-size: 1rem; text-align: right; }

/* Wallet Forms */
.w-label { display: block; font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 0.4rem; margin-top: 1rem; }
.w-input { width: 100%; padding: 0.85rem 1rem; border: 1px solid #cbd5e1; border-radius: 12px; font-size: 1rem; background: #f8fafc; box-sizing: border-box; transition: border 0.2s; margin-bottom: 0; }
.w-input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(247,148,30,0.1); }
.w-btn { display: block; width: 100%; padding: 0.85rem; border-radius: 12px; background: var(--primary); color: #fff; border: none; font-weight: 700; font-size: 1rem; text-align: center; text-decoration: none; cursor: pointer; transition: background 0.2s; margin-top: 1rem; }
.w-btn:active { background: var(--primary-600); }

/* Timeline Activity */
.timeline { position: relative; padding-left: 1.5rem; margin: 0; list-style: none; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-item::before { content: ''; position: absolute; left: -1.5rem; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.timeline-date { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; margin-bottom: 0.25rem; }
.timeline-desc { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.timeline-amount { font-size: 0.95rem; font-weight: 700; }

/* Bottom Navigation */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border); display: flex; justify-content: space-around; padding: 0.75rem 0 1.25rem; z-index: 100; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; color: #94a3b8; text-decoration: none; font-size: 0.7rem; font-weight: 600; }
.bottom-nav a.active { color: var(--secondary); }
.bottom-nav a.active svg { color: var(--primary); }
.bottom-nav svg { width: 22px; height: 22px; }

/* ==================================================================
 * 4. AUTH PAGES
 * ================================================================== */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%); }
.auth-card { max-width: 420px; width: 100%; background: #fff; padding: 2.25rem 2rem; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.auth-card h1 { margin: 0 0 .35rem; font-size: 1.5rem; }
.auth-card p.sub { color: var(--text-muted); margin: 0 0 1.5rem; font-size: .92rem; }
.auth-card .brand { text-align: center; color: var(--secondary); font-weight: 800; letter-spacing: .08em; font-size: .95rem; margin-bottom: 1.5rem; }
.auth-card .btn { width: 100%; margin-top: 1rem; }
.auth-card .links { text-align: center; margin-top: 1rem; font-size: .9rem; color: var(--text-muted); }

/* ==================================================================
 * 5. RESPONSIVE & UTILITIES
 * ================================================================== */
.hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--secondary); }
.flex-between { display: flex !important; justify-content: space-between !important; align-items: center !important; flex-wrap: wrap; gap: 1rem; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; width: 100%; padding: 1rem; }
  .topbar { margin: -1rem -1rem 1.5rem -1rem; padding: 1rem; }
  .hamburger { display: block; }
  .table { display: block !important; overflow-x: auto !important; white-space: nowrap; }
  .grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr !important; }
}