
/* =====================================================
   LENDFLOW — LENDING MANAGEMENT SOFTWARE
   File: lending-app/public/styles.css
   ===================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --navy: #10213a;
  --navy-light: #1b3150;
  --background: #f4f7fb;
  --surface: #ffffff;
  --text: #172338;
  --muted: #718096;
  --border: #e2e8f0;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.045);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: #9aa7b8;
}

textarea {
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #344256;
  font-weight: 600;
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 5px;
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -0.6px;
}

h2 {
  margin-bottom: 6px;
  font-size: 19px;
  font-weight: 700;
}

h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

small {
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* =====================================================
   AUTHENTICATION
   ===================================================== */

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px 16px;
  background:
    radial-gradient(
      circle at top left,
      rgba(37, 99, 235, 0.14),
      transparent 35%
    ),
    var(--background);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.08);
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.auth-card > .brand-logo {
  margin: 0 auto 18px;
}

.auth-card h1,
.auth-card > p {
  text-align: center;
}

.auth-card > p {
  margin-bottom: 25px;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.auth-card form label:not(:first-child) {
  margin-top: 7px;
}

.auth-card form .btn {
  margin-top: 13px;
}

.text-button {
  display: block;
  margin: 17px auto 0;
  padding: 5px;
  border: none;
  background: transparent;
  color: var(--primary);
  font-weight: 650;
}

.text-button:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 650;
  text-align: center;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  border-color: var(--border);
  background: #fff;
  color: #334155;
}

.btn-secondary:hover {
  border-color: #b9c6d8;
  background: #f8fafc;
}

.auth-card .btn {
  width: 100%;
}

/* =====================================================
   APPLICATION LAYOUT
   ===================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 50;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: 255px;
  padding: 22px 16px;
  overflow-y: auto;
  background: var(--navy);
  color: #fff;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 5px 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand strong {
  display: block;
  font-size: 17px;
}

.sidebar-brand small {
  display: block;
  margin-top: 2px;
  color: #a8b8cf;
}

.workspace-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 23px 4px 20px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
}

.workspace-info .muted {
  color: #93a8c3;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

.workspace-info strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #c5d1e1;
  text-align: left;
  font-weight: 550;
}

.nav-link span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  font-size: 19px;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-link.active {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--primary);
  color: #fff;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 25px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  padding: 12px 3px;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 37px;
  height: 37px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 800;
}

.user-details {
  min-width: 0;
}

.user-details strong,
.user-details small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-details strong {
  max-width: 150px;
  font-size: 12px;
}

.user-details small {
  margin-top: 3px;
  color: #a8b8cf;
}

.sidebar-bottom .btn {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar-bottom .btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.main-content {
  width: calc(100% - 255px);
  min-width: 0;
  margin-left: 255px;
  padding: 28px 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin-bottom: 4px;
}

.topbar p {
  margin-bottom: 0;
}

.topbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}

.currency-label {
  color: var(--muted);
  font-size: 12px;
}

#baseCurrency {
  color: var(--primary);
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 20px;
}

.page {
  display: block;
  min-width: 0;
}

.welcome-row,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 22px;
}

.welcome-row h2,
.section-heading h2 {
  margin-bottom: 5px;
}

.welcome-row p,
.section-heading p {
  margin-bottom: 0;
}

/* =====================================================
   DASHBOARD CARDS
   ===================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 25px;
}

.stat-card {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card > span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.stat-card > strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 750;
  letter-spacing: -0.5px;
}

.stat-card > small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.content-card {
  min-width: 0;
  margin-bottom: 22px;
  padding: 23px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.content-card > h2:first-child {
  margin-bottom: 18px;
}

.content-card > .muted:last-child {
  margin-bottom: 0;
}

/* =====================================================
   TABLES
   ===================================================== */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 13px;
  text-align: left;
}

thead {
  background: #f7f9fc;
}

th {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.45px;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 14px;
  border-bottom: 1px solid #edf1f6;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #fafcff;
}

td[colspan] {
  padding: 25px 14px;
  color: var(--muted);
  text-align: center;
}

td .btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

/* Status labels created by JavaScript */

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 20px;
  background: #edf2f7;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-active,
.status-paid,
.status-completed {
  background: var(--success-bg);
  color: var(--success);
}

.status-pending,
.status-partial {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-overdue,
.status-defaulted,
.status-cancelled {
  background: var(--danger-bg);
  color: var(--danger);
}

/* =====================================================
   FORMS
   ===================================================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-grid h3 {
  margin-bottom: 0;
}

.form-grid > div:not(.form-actions) {
  min-width: 0;
}

.full-width {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 5px;
}

#repaymentForm {
  margin-bottom: 25px;
}

#repaymentForm h3 {
  margin-bottom: 0;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-of-type {
  margin-bottom: 20px;
}

.settings-row p {
  margin: 5px 0 0;
  font-size: 12px;
}

.settings-row > span,
.settings-row > code {
  max-width: 50%;
  overflow-wrap: anywhere;
  text-align: right;
}

.settings-row code {
  padding: 5px 8px;
  border-radius: 5px;
  background: #f1f5f9;
  font-size: 11px;
}

/* =====================================================
   NOTICES
   ===================================================== */

.message {
  display: none;
  margin-bottom: 18px;
  padding: 12px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.message:not(:empty) {
  display: block;
}

.message.success {
  border-color: #bbf7d0;
  background: var(--success-bg);
  color: var(--success);
}

.message.error {
  border-color: #fecaca;
  background: var(--danger-bg);
  color: var(--danger);
}

.message.info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

#authMessage,
#registerMessage {
  margin-top: 15px;
  margin-bottom: 0;
}

/* =====================================================
   FOOTER
   ===================================================== */

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 35px;
  padding: 20px 0 5px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 1200px) {
  .main-content {
    padding: 25px 22px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    padding: 18px;
  }
}

@media (max-width: 850px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 10px 0 30px rgba(15, 23, 42, 0.15);
  }

  .main-content {
    width: 100%;
    margin-left: 0;
    padding: 22px 18px;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar {
    gap: 12px;
  }

  .topbar-actions {
    gap: 6px;
    padding: 8px;
  }

  .currency-label {
    display: none;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 13px;
  }

  .auth-card {
    padding: 25px 20px;
  }

  .main-content {
    padding: 17px 12px;
  }

  .topbar {
    align-items: flex-start;
    margin-bottom: 23px;
    padding-bottom: 17px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar p {
    max-width: 220px;
    font-size: 12px;
  }

  .topbar-actions {
    flex-shrink: 0;
  }

  .welcome-row,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .welcome-row .btn,
  .section-heading > .btn {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card > span {
    margin-bottom: 8px;
    font-size: 11px;
  }

  .stat-card > strong {
    font-size: 20px;
  }

  .stat-card > small {
    font-size: 10px;
  }

  .content-card {
    padding: 15px;
    margin-bottom: 15px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .full-width {
    grid-column: auto;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .form-actions .btn {
    flex: 1 1 auto;
  }

  .settings-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .settings-row > span,
  .settings-row > code {
    max-width: 100%;
    text-align: left;
  }

  .app-footer {
    flex-direction: column;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


.borrower-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  width: 100%;
}

.borrower-search input {
  flex: 1;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid #dce3ee;
  border-radius: 10px;
  background: #fff;
  color: #172b4d;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.borrower-search input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.borrower-search button {
  padding: 12px 18px;
  border: 1px solid #dce3ee;
  border-radius: 10px;
  background: #fff;
  color: #2563eb;
  cursor: pointer;
  font-weight: 600;
}

.borrower-search button:hover {
  background: #eff6ff;
}

@media (max-width: 600px) {
  .borrower-search {
    gap: 6px;
  }

  .borrower-search button {
    padding: 12px;
  }
}

