/* ========================================
   JOWINAM ADMIN SYSTEM - STYLES.CSS
   Clean, modern, responsive, production-ready
======================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #0f172a;
  --accent: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --light: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-700: #334155;
  --text: #0f172a;
  --text-light: #64748b;
  --border: #cbd5e1;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #f9fafb;
  color: var(--text);
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
}

/* === HEADER === */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  border-bottom: 1px solid var(--border);
  z-index: 100;
  height: 64px;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
}

.hamburger {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-700);
  display: none;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-name {
  font-weight: 500;
  color: var(--gray-700);
}

.dropdown {
  position: relative;
}

.dropdown-btn {
  background: none;
  border: none;
  color: var(--gray-700);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem;
}
 a {
  text-decoration: none;
 }

.dropdown-content {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 160px;
  display: none;
  z-index: 1000;
}

.dropdown-content.show {
  display: block;
}

.dropdown-content a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
}

.dropdown-content a:hover {
  background-color: var(--gray-100);
}

/* === SIDEBAR === */
.sidebar {
  width: 260px;
  background: white;
  border-right: 1px solid var(--border);
  height: 100vh;
  position: fixed;
  top: 64px;
  left: 0;
  overflow-y: auto;
  z-index: 90;
  transition: transform 0.3s ease;
}

/* Desktop: always visible */
@media (min-width: 992px) {
  .sidebar {
    transform: translateX(0);
  }
}

/* Mobile: hidden by default */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .hamburger {
    display: block;
  }
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.sidebar-header p {
  font-size: 0.875rem;
  color: var(--text-light);
}

.sidebar-nav ul {
  list-style: none;
  padding: 0.75rem 0;
}

.sidebar-nav li {
  position: relative;
}

/* SIDEBAR LINKS: ICON + TEXT LEFT, ARROW RIGHT */
.sidebar-nav > ul > li > a,
.sidebar-nav .has-submenu > a {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  gap: 0.75rem;
}

/* Icon styling */
.sidebar-nav a span:first-child {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  font-size: 1.1rem;
}

/* Arrow (only the last span with class .arrow) */
.sidebar-nav .has-submenu > a .arrow {
  margin-left: auto;
  transition: transform 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav .has-submenu.active > a {
  background-color: var(--gray-100);
  color: var(--primary);
}

.has-submenu.active .arrow {
  transform: rotate(90deg);
}

/* Submenu */
.sidebar-nav ul ul {
  display: none;
  background-color: var(--gray-100);
}

.has-submenu.active > ul {
  display: block;
}

.sidebar-nav ul ul a {
  padding: 0.625rem 1.25rem 0.625rem 2.5rem; /* Indented */
  font-weight: 400;
  font-size: 0.95rem;
  gap: 0.75rem;
}

/* === MAIN CONTENT === */
main.container {
  flex: 1;
  margin-top: 64px;
  padding: 1.5rem;
  max-width: 1400px;
  width: 100%;
}

@media (min-width: 992px) {
  main.container {
    margin-left: 260px;
  }
}

@media (max-width: 991px) {
  main.container {
    margin-left: 0;
    padding: 1rem;
  }
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem; /* 10px 20px */
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  background-color: var(--primary);
  color: white;
  min-height: 40px;
}

.btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--gray-100);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--gray-200);
}

.btn-sm {
  padding: 0.375rem 0.75rem; /* 6px 12px */
  font-size: 0.875rem;
  min-height: 32px;
}

.btn-full {
  width: 100%;
}

/* === CARDS & GRID === */
.grid {
  display: grid;
  gap: 1.25rem;
}

.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.balance-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  padding: 1rem;
}

.balance-label {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.balance-amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.kes {
  color: var(--success);
}

/* === TABLES === */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.875rem;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Mobile-friendly table labels */
@media (max-width: 768px) {
  th { display: none; }
  td {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0.5rem;
  }
  td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--gray-700);
    flex: 0 0 40%;
  }
}

/* === FORMS === */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* === ALERTS === */
.alert {
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.alert-success {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-error {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* === UTILITIES === */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.flex-end {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.text-danger { color: var(--danger); }

.mb-4 { margin-bottom: 1.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1.25rem; }
.py-4 { padding: 1rem 0; }

/* Card titles */
.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

/* Status badges */
.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-active { 
  background-color: #dcfce7; 
  color: #166534; 
}

.status-dormant { 
  background-color: #fee2e2; 
  color: #b91c1c; 
}

/* Allocation preview items */
.split-item {
  display: inline-block;
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  margin: 0 0.25rem 0.25rem 0;
}

.escrow-note {
  color: var(--warning);
  font-style: italic;
  font-size: 0.9rem;
}

.once-off-tag {
  background: #fef3c7;
  color: #92400e;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8em;
  margin-left: 0.3rem;
}

/* === CHARTS === */
canvas {
  max-width: 100%;
  height: auto !important;
}
/* Cashbook status badges */
.status-warning {
  background-color: #fef3c7;
  color: #92400e;
}