:root {
  --primary: #0f4c81;
  --primary-dark: #0a3559;
  --primary-light: #e8f1f8;
  --accent: #1a73e8;
  --success: #0d9488;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
img{
    height: 100px;
    width: 200px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== LOGIN ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a3559 0%, #0f4c81 50%, #1a73e8 100%);
  padding: 1.5rem;
}

.login-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.login-logo .logo-mark {
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo strong {
  display: block;
  font-size: 1.05rem;
}

.login-logo span {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--gray-200);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-tab:hover {
  color: var(--primary);
}

.login-sub {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.login-error {
  background: #fef2f2;
  color: var(--danger);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.login-success {
  background: #ecfdf5;
  color: #047857;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.btn-full {
  width: 100%;
  margin-top: 0.5rem;
}

.demo-accounts {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.8rem;
  color: var(--gray-700);
}

.demo-accounts ul {
  list-style: none;
  margin-top: 0.5rem;
}

.demo-accounts li {
  margin-bottom: 0.35rem;
}

.demo-accounts code {
  background: var(--gray-100);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78rem;
}

/* Header */
.header {
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-mark {
  background: white;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-text strong {
  font-size: 1.05rem;
}

.logo-text span {
  font-size: 0.75rem;
  opacity: 0.85;
}

.nav {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  color: white;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-btn:hover,
.nav-btn.active {
  background: white;
  color: var(--primary);
  border-color: white;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.85rem;
  line-height: 1.3;
}

.role-badge {
  font-size: 0.7rem;
  background: rgba(255,255,255,.2);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Main */
.main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.subtitle {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar input[type="search"],
.toolbar select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
  background: white;
  min-width: 160px;
}

/* Export / Import dropdown */
.export-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-arrow {
  font-size: 0.65rem;
  margin-left: 0.25rem;
  opacity: 0.9;
}

.export-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
}

.export-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 1rem;
  border: none;
  background: white;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--gray-900);
  cursor: pointer;
}

.export-menu-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.export-menu-item + .export-menu-item {
  border-top: 1px solid var(--gray-100);
}

/* Multi status filter (dashboard) */
.status-filter-wrap {
  position: relative;
  display: inline-block;
}
.status-filter-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  padding: 0.75rem;
}
.status-filter-panel label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  padding: 0.25rem 0;
  cursor: pointer;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.stat-card .label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card .value {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

/* Table */
.table-wrap {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  background: var(--gray-100);
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--primary-light);
}

.data-table .actions {
  display: flex;
  gap: 0.35rem;
}

.btn-icon {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 5px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--gray-700);
}

.btn-icon:hover {
  background: var(--gray-100);
}

.btn-icon.danger:hover {
  background: #fef2f2;
  border-color: var(--danger);
  color: var(--danger);
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-draft { background: #f3f4f6; color: #4b5563; }
.badge-submitted { background: #dbeafe; color: #1d4ed8; }
.badge-under-review { background: #fef3c7; color: #b45309; }
.badge-approved { background: #d1fae5; color: #047857; }
.badge-rejected { background: #fee2e2; color: #b91c1c; }
.badge-disbursed { background: #ccfbf1; color: #0f766e; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.empty-state.hidden { display: none; }

/* Form */
.loan-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-section {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.form-section legend {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0 0.35rem;
}

.optional {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.sub-heading {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 1rem 0 0.6rem;
  color: var(--gray-700);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-700);
}

.field input,
.field select,
.field textarea {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.field input:disabled {
  background: var(--gray-100);
  color: var(--gray-700);
  cursor: not-allowed;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.mt-1 { margin-top: 1rem; }

/* Income source rows */
.income-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 0.6rem;
  align-items: end;
  margin-bottom: 0.6rem;
  padding: 0.6rem;
  background: var(--gray-50);
  border-radius: 6px;
}

.income-row .field {
  margin: 0;
}

/* Documents */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
}

.doc-item:hover {
  background: var(--gray-100);
}

.doc-item input {
  accent-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-ghost {
  background: white;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-ghost:hover {
  background: var(--gray-100);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 0 2rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
  font-size: 1.15rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--gray-500);
  padding: 0 0.25rem;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 0.9rem;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.4rem 1rem;
}

.detail-grid dt {
  color: var(--gray-500);
  font-size: 0.8rem;
}

.detail-grid dd {
  font-weight: 500;
  margin: 0;
}

.detail-section {
  margin-bottom: 1.25rem;
}

.detail-section h3 {
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--gray-200);
}

/* Footer */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--gray-500);
  border-top: 1px solid var(--gray-200);
  background: white;
}

/* Responsive */
@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .income-row {
    grid-template-columns: 1fr;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-area {
    width: 100%;
    justify-content: space-between;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem 0.6rem;
  }
}

.hidden {
  display: none !important;
}
