/* ============================================================
   BOC Bank Lending CRM — Stylesheet
   Brand: #133C53 (navy), #c9a84c (gold)
   Fonts: Playfair Display (headings) / DM Sans (body)
   ============================================================ */

:root {
  --brand:        #133C53;
  --brand-light:  #1a4f6e;
  --brand-pale:   #e8f0f5;
  --brand-dark:   #0d2b3a;
  --gold:         #c9a84c;
  --gold-light:   #e8c96a;
  --hot:          #c0392b;
  --hot-bg:       #fdf2f2;
  --hot-border:   #f5c6c6;
  --warm:         #c07a00;
  --warm-bg:      #fdf8ee;
  --warm-border:  #f5dfa0;
  --cold:         #2471a3;
  --cold-bg:      #eaf4fb;
  --cold-border:  #a9d4ef;
  --complete:     #1a6b3a;
  --complete-bg:  #edf7f1;
  --complete-border: #a3d9b8;
  --text:         #1a1a2e;
  --text-muted:   #6b7280;
  --text-light:   #9ca3af;
  --border:       #e5e9ee;
  --bg:           #f4f6f9;
  --card-bg:      #ffffff;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 2px 16px rgba(19,60,83,0.08);
  --shadow-md:    0 4px 24px rgba(19,60,83,0.13);
  --shadow-lg:    0 8px 40px rgba(19,60,83,0.18);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', 'Segoe UI', sans-serif;
  --transition:   0.2s ease;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── UTILITIES ── */
.hidden { display: none !important; }

/* ── AUTH SCREEN ── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 60%, var(--brand-light) 100%);
  padding: 24px;
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeUp 0.5s ease both;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 36px;
}

.auth-logo-mark {
  width: 52px;
  height: 52px;
  background: var(--brand);
  color: var(--gold);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
}

.auth-bank-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  text-align: left;
  line-height: 1.1;
}

.auth-system-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: left;
}

.auth-headline {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 10px;
}

.auth-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.auth-footer {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 20px;
  line-height: 1.5;
}

/* ── LOADING SCREEN ── */
.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.loading-logo-mark {
  width: 64px;
  height: 64px;
  background: var(--gold);
  color: var(--brand);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner-sm {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ── HEADER ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--brand);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-logo-mark {
  width: 38px;
  height: 38px;
  background: var(--gold);
  color: var(--brand);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
}

.header-titles {
  display: flex;
  flex-direction: column;
}

.header-bank {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

.header-crm {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.header-nav {
  display: flex;
  gap: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

/* ── MOBILE NAV ── */
.mobile-nav {
  display: none;
  background: var(--brand-dark);
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.mobile-nav::-webkit-scrollbar { display: none; }

/* ── NAV BUTTONS ── */
.nav-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-btn:hover { color: rgba(255,255,255,0.9); }

.nav-btn.active {
  color: #fff;
  font-weight: 700;
  border-bottom-color: var(--gold);
}

/* ── MAIN CONTENT ── */
.main-content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* ── TAB SECTIONS ── */
.tab-section { animation: fadeIn 0.25s ease both; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--brand);
}

.page-date {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.page-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── CARDS ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  border: 1px solid var(--border);
}

.card-header {
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
}

/* ── STAT GRID ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 3px;
}

/* ── DASHBOARD GRID ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

.lo-card, .followup-card { min-height: 200px; }

/* ── LO TABLE ── */
.lo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.lo-table thead tr {
  background: var(--brand-pale);
}

.lo-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lo-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.lo-table tbody tr:last-child { border-bottom: none; }
.lo-table tbody tr:hover { background: var(--brand-pale); }

.lo-table td {
  padding: 11px 12px;
  color: var(--text);
}

.lo-table td:first-child { font-weight: 600; }

/* ── UPCOMING LIST ── */
.upcoming-list { display: flex; flex-direction: column; gap: 0; }

.upcoming-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.upcoming-item:last-child { border-bottom: none; }

.upcoming-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

.upcoming-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.upcoming-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus { border-color: var(--brand); }

.filter-select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.filter-select:focus { border-color: var(--brand); }

/* ── PIPELINE LANES ── */
.pipeline-lanes { display: flex; flex-direction: column; gap: 18px; }

.pipeline-lane { overflow: hidden; }

.lane-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.lane-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.lane-value {
  font-size: 12px;
  color: var(--text-light);
  margin-left: auto;
}

.lane-cards { display: flex; flex-direction: column; gap: 8px; }

.lane-empty {
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
  padding: 10px 0;
}

/* ── PROSPECT CARD ── */
.prospect-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  gap: 12px;
  flex-wrap: wrap;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.prospect-card:hover {
  box-shadow: var(--shadow);
  border-color: #c8d6df;
}

.prospect-card.overdue {
  background: var(--hot-bg);
  border-color: var(--hot-border);
}

.prospect-info { flex: 1; min-width: 160px; }

.prospect-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.overdue-tag {
  font-size: 11px;
  color: var(--hot);
  font-weight: 600;
}

.prospect-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.prospect-amount {
  font-size: 12px;
  color: var(--brand);
  font-weight: 700;
  margin-top: 2px;
}

.prospect-trigger {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.prospect-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.followup-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── FORMER CUSTOMER LIST ── */
.former-list { display: flex; flex-direction: column; gap: 10px; }

.former-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.former-info { flex: 1; min-width: 200px; }

.former-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.former-company {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.former-details {
  display: flex;
  gap: 16px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.former-detail {
  font-size: 12px;
  color: var(--text-muted);
}

.former-detail.highlight {
  color: var(--brand);
  font-weight: 700;
}

.former-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-hot      { background: var(--hot);      color: #fff; }
.badge-warm     { background: var(--warm);     color: #fff; }
.badge-cold     { background: var(--cold);     color: #fff; }
.badge-complete { background: var(--complete); color: #fff; }

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  border: 2px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary:hover { background: var(--brand-light); border-color: var(--brand-light); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary.btn-full { width: 100%; padding: 13px 20px; font-size: 15px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--brand);
  border: 2px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-secondary:hover { background: var(--brand-pale); }

.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: var(--brand-dark);
  border: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-gold:hover { background: var(--gold-light); border-color: var(--gold-light); }

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--brand);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 13px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-ghost-sm:hover { border-color: var(--brand); background: var(--brand-pale); }

.btn-danger-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--hot);
  border: 1.5px solid #f5c6c6;
  border-radius: var(--radius-sm);
  padding: 6px 13px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-danger-sm:hover { background: var(--hot-bg); border-color: var(--hot); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,20,30,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease both;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.25s ease both;
}

.modal-header {
  background: var(--brand);
  color: #fff;
  padding: 18px 24px;
  border-radius: 16px 16px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
}

.modal-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--transition);
}

.modal-close:hover { color: #fff; }

.modal-body { padding: 24px; }

/* ── FORMS ── */
.form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 calc(50% - 7px);
  min-width: 180px;
}

.form-group.full { flex: 1 1 100%; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-input, .form-select, .form-textarea {
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: #fafbfc;
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand);
  background: #fff;
}

.form-textarea { resize: vertical; }

.form-row {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.form-row .form-group { flex: 1; min-width: 160px; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 8px;
}

/* ── DETAIL VIEW ── */
.detail-grid { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }

.detail-row { display: flex; gap: 12px; align-items: flex-start; }

.detail-label {
  font-weight: 700;
  color: var(--brand);
  min-width: 150px;
  flex-shrink: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding-top: 1px;
}

.detail-value { color: var(--text); line-height: 1.5; }

.detail-actions { margin-top: 16px; }

/* ── EMAIL SECTION ── */
.email-card { margin-bottom: 16px; }

.email-draft-output { }

.email-draft-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.email-draft-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.email-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 20px 0;
}

.email-textarea {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  background: #fafbfc;
  outline: none;
  resize: vertical;
  transition: border-color var(--transition);
}

.email-textarea:focus { border-color: var(--brand); background: #fff; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--brand-dark);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 2000;
  animation: fadeUp 0.25s ease both;
  max-width: 320px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--hot); }

/* ── IMPORT MODAL ── */
.import-info {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 14px;
}

.import-code {
  background: var(--brand-pale);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--brand);
  display: block;
  margin-bottom: 16px;
  word-break: break-all;
}

/* ── SIGN OUT in header ── */
.header .btn-ghost-sm {
  color: rgba(255,255,255,0.7);
  border-color: rgba(255,255,255,0.25);
}

.header .btn-ghost-sm:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.1);
}

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .header-nav { display: none; }
  .mobile-nav { display: flex; }
  .header { padding: 0 16px; }
  .main-content { padding: 20px 14px 60px; }
  .user-name { display: none; }
}

@media (max-width: 600px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-group { flex: 1 1 100%; }
  .auth-card { padding: 36px 24px; }
}
