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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #fff;
  color: #111;
  font-size: 15px;
}

a { color: #1a56db; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1100px; margin: 0 auto; padding: 0 12px; }

/* Navbar */
.navbar {
  background: #fff;
  border-bottom: 2px solid #1a56db;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.navbar .brand { font-weight: 700; font-size: 17px; color: #1a56db; }
.navbar .nav-links { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.navbar .nav-links a, .navbar .nav-links button {
  font-size: 13px; padding: 5px 10px; border-radius: 4px;
  background: none; border: none; cursor: pointer; color: #111;
}
.navbar .nav-links a:hover, .navbar .nav-links button:hover { background: #e8f0fe; color: #1a56db; }
.navbar .logout-btn { color: #c0392b !important; }

/* Sidebar Layout */
.layout { display: flex; min-height: calc(100vh - 47px); }
.sidebar {
  width: 200px; min-width: 200px; background: #f7f8fa;
  border-right: 1px solid #ddd; padding: 16px 0;
}
.sidebar a {
  display: block; padding: 9px 20px; color: #222; font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar a:hover, .sidebar a.active {
  background: #e8f0fe; color: #1a56db;
  border-left: 3px solid #1a56db; text-decoration: none;
}
.main-content { flex: 1; padding: 20px 16px; overflow-x: auto; }

/* Cards */
.card {
  background: #fff; border: 1px solid #ddd;
  border-radius: 6px; padding: 16px; margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: #1a56db; }

/* Stats row */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-box {
  flex: 1; min-width: 130px; background: #fff;
  border: 1px solid #ddd; border-radius: 6px;
  padding: 14px 16px; text-align: center;
}
.stat-box .stat-num { font-size: 24px; font-weight: 700; color: #1a56db; }
.stat-box .stat-label { font-size: 12px; color: #555; margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-block; padding: 7px 16px; border-radius: 4px;
  border: none; cursor: pointer; font-size: 14px; font-weight: 500;
}
.btn-primary { background: #1a56db; color: #fff; }
.btn-primary:hover { background: #1446b0; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #922b21; }
.btn-success { background: #1e8449; color: #fff; }
.btn-success:hover { background: #186038; }
.btn-secondary { background: #e0e0e0; color: #222; }
.btn-secondary:hover { background: #c8c8c8; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Forms */
.form-group { margin-bottom: 13px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #bbb;
  border-radius: 4px; font-size: 14px; background: #fff; color: #111;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: #1a56db; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: #e8f0fe; }
th, td { padding: 8px 10px; border: 1px solid #ddd; text-align: left; }
th { font-weight: 600; color: #1a56db; white-space: nowrap; }
tbody tr:hover { background: #f0f5ff; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.badge-green { background: #d4efdf; color: #1a6636; }
.badge-red { background: #fadbd8; color: #922b21; }
.badge-blue { background: #d6eaf8; color: #1a4f9c; }
.badge-orange { background: #fdebd0; color: #a04000; }

/* Auth page */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: #f7f8fa;
}
.auth-box {
  background: #fff; border: 1px solid #ddd; border-radius: 8px;
  padding: 32px 28px; width: 100%; max-width: 380px;
}
.auth-box h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; color: #1a56db; text-align: center;}
.auth-box p { font-size: 13px; color: #555; margin-bottom: 18px; text-align: center; }
.divider { text-align: center; margin: 14px 0; color: #999; font-size: 12px; position: relative; }
.divider::before, .divider::after {
  content: ''; position: absolute; top: 50%; width: 42%; height: 1px; background: #ddd;
}
.divider::before { left: 0; } .divider::after { right: 0; }
.google-btn {
  width: 100%; padding: 9px; border: 1px solid #ddd; border-radius: 4px;
  background: #fff; cursor: pointer; font-size: 14px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.google-btn:hover { background: #f5f5f5; }
.role-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.role-tab {
  flex: 1; padding: 7px; border: 1px solid #ddd; border-radius: 4px;
  background: #fff; cursor: pointer; font-size: 13px; text-align: center;
}
.role-tab.active { background: #1a56db; color: #fff; border-color: #1a56db; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; font-size: 13px; }
.alert-danger { background: #fadbd8; color: #922b21; border: 1px solid #f5b7b1; }
.alert-success { background: #d4efdf; color: #1a6636; border: 1px solid #a9dfbf; }

/* Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.35); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: #fff; border-radius: 8px; padding: 24px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  margin: 10px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #555; }

/* Page title */
.page-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: #111; }
.page-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }

/* Responsive */
@media (max-width: 700px) {
  .sidebar { display: none; }
  .sidebar.open { display: block; position: fixed; top: 47px; left: 0; bottom: 0; z-index: 150; width: 200px; }
  .stats-row { flex-direction: column; }
  .stat-box { min-width: 100%; }
  .form-row { flex-direction: column; }
  .auth-box { margin: 16px; }
  .navbar .brand { font-size: 14px; }
  .menu-btn { display: block !important; }
  table { font-size: 12px; }
}
.menu-btn { display: none; background: none; border: none; font-size: 22px; cursor: pointer; padding: 0 6px; }

/* Loader */
.loader { text-align: center; padding: 30px; color: #555; }

/* Print */
@media print {
  .sidebar, .navbar, .btn, .page-actions .btn { display: none !important; }
  .main-content { padding: 0; }
}

/* Search Dropdown (used in collections, savings) */
.search-dropdown {
  position: absolute;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 4px;
  z-index: 50;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
.search-item {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 14px;
  color: #222;
}
.search-item:hover { background: #e8f0fe; color: #1a56db; }
.form-group { position: relative; }

/* Badge purple for savings */
.badge-purple { background: #e8d5f7; color: #6b21a8; }
