/* ═══════════════════════════════════════════════════
   LoanFlow CRM — Modern Stylesheet
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Brand */
  --blue:     #1B6FD8;
  --blue-d:   #1358B0;
  --blue-l:   #EBF3FF;
  --blue-xl:  #F5F9FF;
  --green:    #16A34A;
  --green-d:  #14532D;
  --green-l:  #DCFCE7;
  --amber:    #D97706;
  --amber-l:  #FEF3C7;
  --red:      #DC2626;
  --red-l:    #FEE2E2;
  --purple:   #7C3AED;
  --purple-d: #5B21B6;
  --purple-l: #EDE9FE;
  --teal:     #0D9488;
  --teal-l:   #CCFBF1;
  --gray:     #6B7280;
  --gray-l:   #F3F4F6;

  /* Surfaces */
  --bg:       #F0F4F8;
  --bg2:      #FFFFFF;
  --bg3:      #F8FAFC;
  --border:   #E8EDF2;
  --border2:  #D1D9E0;

  /* Text */
  --text:     #111827;
  --text2:    #6B7280;
  --text3:    #9CA3AF;

  /* Radius */
  --r4:  4px;
  --r6:  6px;
  --r8:  8px;
  --r10: 10px;
  --r12: 12px;
  --r16: 16px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 4px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════ */
#app-shell,
.shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ══════════════════════════════════════════════════
   TOP NAVIGATION BAR
══════════════════════════════════════════════════ */
.topnav {
  display: flex;
  flex-direction: column;
  background: #0F172A;
  flex-shrink: 0;
  z-index: 100;
}
.topnav-row1 {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 20px;
  gap: 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: relative;
}
/* Truly centred search — absolute positioned */
.topnav-search-centre {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 0 16px;
  height: 36px;
  width: 440px;
  transition: all .15s;
  z-index: 10;
}
.topnav-search-centre:focus-within {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.35);
  box-shadow: 0 0 0 3px rgba(255,255,255,.08);
}
.topnav-search-centre input {
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: #fff;
  width: 100%;
  font-family: inherit;
}
.topnav-search-centre input::placeholder { color: rgba(255,255,255,.45); }
.topnav-row2 {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 20px;
  gap: 2px;
}

.topnav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  margin-right: 8px;
  text-decoration: none;
}
.topnav-logo .logo-name {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.topnav-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.tnav-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r6);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  transition: all .13s;
  white-space: nowrap;
  height: 32px;
}
.tnav-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: .7;
}
.tnav-item:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
}
.tnav-item.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.tnav-item.active svg { opacity: 1; }
.tnav-item .nav-count {
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.topnav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r8);
  transition: background .13s;
}
.topnav-user:hover { background: rgba(255,255,255,.08); }

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px;
  min-height: 0;
  width: 100%;
}

/* ─── Logo icon (used in topnav) ─── */
.logo-icon {
  width: 28px; height: 28px;
  background: var(--blue);
  border-radius: var(--r6);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════ */
.btn {
  height: 34px;
  padding: 0 16px;
  border-radius: var(--r8);
  border: 1px solid var(--border2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all .13s;
  letter-spacing: -.01em;
  box-shadow: var(--shadow-xs);
}
.btn:hover { background: var(--bg3); border-color: var(--border2); }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--blue);   color: #fff; border-color: var(--blue);   box-shadow: 0 1px 3px rgba(27,111,216,.35); }
.btn-primary:hover { background: var(--blue-d); border-color: var(--blue-d); }
.btn-success { background: var(--green);  color: #fff; border-color: var(--green);  box-shadow: 0 1px 3px rgba(22,163,74,.3); }
.btn-success:hover { background: var(--green-d); }
.btn-purple  { background: var(--purple); color: #fff; border-color: var(--purple); box-shadow: 0 1px 3px rgba(124,58,237,.3); }
.btn-purple:hover { background: var(--purple-d); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text2); box-shadow: none; }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-sm { height: 28px; padding: 0 12px; font-size: 11.5px; }
.btn-xs { height: 24px; padding: 0 9px;  font-size: 11px; }

/* ══════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .01em;
}
.b-blue   { background: var(--blue-l);   color: var(--blue-d); }
.b-green  { background: var(--green-l);  color: var(--green-d); }
.b-amber  { background: var(--amber-l);  color: var(--amber); }
.b-red    { background: var(--red-l);    color: var(--red); }
.b-purple { background: var(--purple-l); color: var(--purple-d); }
.b-teal   { background: var(--teal-l);   color: var(--teal); }
.b-gray   { background: var(--gray-l);   color: var(--gray); }

/* ══════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════ */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r12);
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-hdr {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg2);
}
.card-title { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.card-body  { padding: 18px; }

/* ─── Screens ─── */
.screen { display: none; }
.screen.active { display: block; }

/* ══════════════════════════════════════════════════
   DASHBOARD
══════════════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r12);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--blue);
  border-radius: var(--r4) var(--r4) 0 0;
}
.stat-label {
  font-size: 11px;
  color: var(--text2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.stat-val { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-bottom: 4px; }
.stat-sub { font-size: 11px; color: var(--text2); }

.chart-grid   { display: grid; grid-template-columns: 2fr 1fr;       gap: 14px; margin-bottom: 14px; }
.chart-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr;   gap: 14px; margin-bottom: 14px; }
.chart-wrap    { position: relative; height: 240px; }
.chart-wrap-sm { position: relative; height: 200px; }

/* ══════════════════════════════════════════════════
   KANBAN
══════════════════════════════════════════════════ */
.kanban-outer {
  overflow-x: auto;
  padding-bottom: 8px;
  /* Fixed height = viewport minus nav + stage bar + tabs */
  height: calc(100vh - 196px);
}
.kanban-board {
  display: flex;
  gap: 10px;
  min-width: max-content;
  align-items: flex-start;
  padding: 2px;
  height: 100%;
}

.k-col {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg3);
  border-radius: var(--r10);
  padding: 10px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}
.k-col-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.k-col-name { font-size: 11.5px; font-weight: 600; color: var(--text); }
.k-col-count {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 99px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text2);
}
.k-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r8);
  padding: 11px 12px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: all .13s;
  border-left: 3px solid transparent;
  box-shadow: var(--shadow-xs);
}
.k-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.k-card:last-child { margin-bottom: 0; }
.k-card-name   { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.k-card-amount { font-size: 12px; color: var(--blue); font-weight: 700; margin-bottom: 5px; }
.k-card-meta   { font-size: 10.5px; color: var(--text2); line-height: 1.7; }

/* ══════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text2);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; transition: background .1s; }
.data-table tbody tr:hover td { background: var(--blue-xl); }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  margin-right: 8px;
  background: var(--blue-l);
  color: var(--blue);
  flex-shrink: 0;
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════ */
.g2 { display: grid; grid-template-columns: 1fr 1fr;          gap: 12px 16px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr;      gap: 12px 16px; }
.g4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;  gap: 12px 16px; }
.full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--text2); }
.req { color: var(--red); }

.fi, .fi-ta, .fi-sel {
  border: 1.5px solid var(--border2);
  border-radius: var(--r8);
  padding: 0 11px;
  font-size: 12.5px;
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.fi      { height: 36px; }
.fi-ta   { height: 72px; padding: 9px 11px; resize: vertical; }
.fi-sel  { height: 36px; }
.fi:focus, .fi-ta:focus, .fi-sel:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(27,111,216,.12);
}
.fi-changed { border-color: var(--amber) !important; background: #FFFBF4 !important; }
.hint { font-size: 11px; color: var(--text3); margin-top: 1px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
  margin-bottom: 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════
   STAGE PIPELINE BAR (Salesforce-style)
══════════════════════════════════════════════════ */
.sf-stage-bar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r12);
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sf-pipeline {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  border-radius: var(--r8);
  overflow: hidden;
  border: 1px solid var(--border2);
}
.sf-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 8px 10px 8px 18px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex: 1;
  min-width: 80px;
  background: var(--bg3);
  color: var(--text2);
  transition: background .13s, color .13s;
  border-right: 1px solid var(--border2);
  text-align: center;
}
.sf-stage:first-child { padding-left: 14px; border-radius: var(--r8) 0 0 var(--r8); }
.sf-stage:last-child  { border-right: none; border-radius: 0 var(--r8) var(--r8) 0; }
.sf-stage:hover:not(.sf-active):not(.sf-past) { background: var(--blue-xl); color: var(--blue); }

/* Chevron arrow using clip-path */
.sf-stage:not(:first-child)::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-left: 10px solid var(--border2);
  z-index: 1;
}
.sf-stage.sf-past { background: #1B6FD8; color: #fff; }
.sf-stage.sf-past::before { border-left-color: #1358B0; }
.sf-stage.sf-past:hover { background: #1358B0; }

.sf-stage.sf-active { background: #0F3A6E; color: #fff; font-weight: 700; }
.sf-stage.sf-active::before { border-left-color: #1B6FD8; }

.sf-stage.sf-lost { background: var(--red-l); color: var(--red); }
.sf-stage.sf-lost::before { border-left-color: #fca5a5; }

.sf-stage-label { position: relative; z-index: 2; font-size: 10.5px; }

.sf-complete-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r8);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .13s;
  box-shadow: 0 1px 3px rgba(27,111,216,.35);
  font-family: inherit;
}
.sf-complete-btn:hover { background: var(--blue-d); }
.sf-complete-btn svg { flex-shrink: 0; }

/* ══════════════════════════════════════════════════
   STEP BAR (8-step ribbon)
══════════════════════════════════════════════════ */
.steps-bar {
  display: flex;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r10);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.step {
  flex: 1;
  padding: 9px 6px;
  font-size: 10.5px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text2);
  cursor: pointer;
  line-height: 1.3;
  transition: background .12s;
  font-weight: 500;
}
.step:last-child  { border-right: none; }
.step:hover:not(.active):not(.done) { background: var(--blue-xl); color: var(--blue); }
.step.active      { background: var(--blue-l);  color: var(--blue-d); }
.step.done        { background: var(--green-l); color: var(--green-d); }
.step.active-biz  { background: var(--purple-l); color: var(--purple-d); }
.step-num {
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  flex-shrink: 0;
}
.step.done     .step-num { background: var(--green);  color: #fff; border-color: var(--green); }
.step.active   .step-num { background: var(--blue);   color: #fff; border-color: var(--blue); }
.step.active-biz .step-num { background: var(--purple); color: #fff; border-color: var(--purple); }

/* ══════════════════════════════════════════════════
   PURPOSE TILES
══════════════════════════════════════════════════ */
.purpose-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.ptile {
  border: 1.5px solid var(--border);
  border-radius: var(--r10);
  padding: 14px 10px;
  cursor: pointer;
  text-align: center;
  transition: all .13s;
  background: var(--bg2);
  box-shadow: var(--shadow-xs);
}
.ptile:hover               { border-color: var(--blue); background: var(--blue-xl); }
.ptile.selected            { border-color: var(--blue); border-width: 2px; background: var(--blue-l); }
.ptile.sel-biz:hover       { border-color: var(--purple); background: var(--purple-l); }
.ptile.sel-biz.selected    { border-color: var(--purple); background: var(--purple-l); }
.ptile-icon { width: 34px; height: 34px; border-radius: var(--r8); margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; }
.ptile-lbl  { font-size: 11px; font-weight: 600; color: var(--text); }
.ptile.selected .ptile-lbl     { color: var(--blue-d); }
.ptile.sel-biz.selected .ptile-lbl { color: var(--purple-d); }
.other-purpose-wrap { display: none; margin-bottom: 12px; }

/* ══════════════════════════════════════════════════
   FORM ACTIONS & BREADCRUMB
══════════════════════════════════════════════════ */
.form-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding-top: 8px; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); margin-bottom: 12px; }
.crumb a { color: var(--blue); cursor: pointer; font-weight: 500; }
.crumb a:hover { text-decoration: underline; }
.report-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════
   DEAL / SETTLEMENT
══════════════════════════════════════════════════ */

.deal-table { width: 100%; border-collapse: collapse; }
.deal-table tr { border-bottom: 1px solid var(--border); }
.deal-table tr:last-child { border-bottom: none; }
.deal-table td { padding: 10px 14px; font-size: 12.5px; vertical-align: middle; }
.deal-table td:first-child { font-weight: 600; width: 44%; white-space: nowrap; color: var(--text2); }
.deal-table td.total-cell { font-weight: 700; color: var(--blue);  background: var(--blue-xl); }
.deal-table td.net-cell   { font-weight: 700; color: var(--green); background: var(--green-l); }
.deal-edit-btn { background: none; border: none; cursor: pointer; padding: 3px; border-radius: var(--r4); color: var(--text2); opacity: .6; }
.deal-edit-btn:hover { opacity: 1; background: var(--bg3); }
.deal-edit-btn svg { width: 14px; height: 14px; display: block; }
.deal-inp {
  height: 30px;
  border: 1.5px solid var(--blue);
  border-radius: var(--r6);
  padding: 0 8px 0 16px;
  font-size: 12px;
  background: var(--bg2);
  color: var(--text);
  width: 100%;
  display: none;
  font-family: inherit;
}
.deal-inp:focus { outline: none; }
.deal-inp.active { display: block; }
.deal-val.hidden { display: none; }
.deal-cw { position: relative; display: flex; align-items: center; }
.deal-cw::before { content: "$"; position: absolute; left: 5px; font-size: 11px; color: var(--text2); pointer-events: none; z-index: 1; }
.stage-sel { height: 30px; border: 1px solid var(--border2); border-radius: var(--r6); padding: 0 8px; font-size: 12px; background: var(--bg2); color: var(--text); font-family: inherit; }

/* ══════════════════════════════════════════════════
   SETTLEMENT CHECKLIST
══════════════════════════════════════════════════ */
.checklist-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.checklist-item:last-child { border-bottom: none; }
.checklist-cb {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border2);
  flex-shrink: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
  transition: all .13s;
}
.checklist-cb.checked { background: var(--green); border-color: var(--green); }
.checklist-cb.checked::after { content: '✓'; color: #fff; font-size: 11px; font-weight: 700; }
.checklist-label { font-size: 12.5px; }
.checklist-label.done { text-decoration: line-through; color: var(--text2); }
.checklist-progress { height: 5px; background: var(--border); border-radius: 3px; margin-bottom: 14px; overflow: hidden; }
.checklist-progress-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width .3s; }

/* ══════════════════════════════════════════════════
   FINANCIAL TABLES
══════════════════════════════════════════════════ */
.fin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.fin-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text2);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.fin-table td { padding: 6px 6px; vertical-align: middle; border-bottom: 1px solid var(--border); }
.fin-table tr:last-child td { border-bottom: none; }
.fin-table tr.fin-total td { background: var(--bg3); font-weight: 700; }
.fti {
  height: 30px;
  border: 1.5px solid var(--border2);
  border-radius: var(--r6);
  padding: 0 7px;
  font-size: 11.5px;
  background: var(--bg2);
  color: var(--text);
  width: 100%;
  font-family: inherit;
  transition: border-color .13s;
}
.fti:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(27,111,216,.1); }
.fw { position: relative; display: block; }
.fw::before {
  content: "$";
  position: absolute; left: 6px; top: 50%;
  transform: translateY(-50%);
  font-size: 10px; color: var(--text2);
  pointer-events: none; z-index: 1;
}
.fw .fti { padding-left: 15px; }
.add-fin-btn {
  border: 1.5px dashed var(--border2);
  background: none;
  border-radius: var(--r8);
  padding: 6px 14px;
  font-size: 11.5px;
  color: var(--text2);
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
  transition: all .13s;
}
.add-fin-btn:hover { background: var(--blue-xl); color: var(--blue); border-color: var(--blue); }
.remove-btn { background: none; border: none; cursor: pointer; color: var(--text2); font-size: 16px; padding: 2px 5px; border-radius: var(--r4); }
.remove-btn:hover { color: var(--red); background: var(--red-l); }
.hem-used-hem { color: var(--blue);  font-weight: 600; font-size: 11px; }
.hem-used-act { color: var(--green); font-weight: 600; font-size: 11px; }

/* ══════════════════════════════════════════════════
   SURPLUS CALCULATOR
══════════════════════════════════════════════════ */
.surplus-result { border-radius: var(--r12); padding: 20px; text-align: center; margin-top: 14px; }
.surplus-val { font-size: 32px; font-weight: 700; margin: 8px 0 4px; letter-spacing: -.03em; }
.dsr-bar  { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.dsr-fill { height: 100%; border-radius: 4px; transition: width .35s; }

/* ══════════════════════════════════════════════════
   SUMMARY MINI CARDS
══════════════════════════════════════════════════ */
.sum-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.sum-mini-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r10);
  padding: 12px;
  text-align: center;
}
.sum-mini-lbl { font-size: 10.5px; color: var(--text2); margin-bottom: 4px; font-weight: 500; }
.sum-mini-val { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }

/* ══════════════════════════════════════════════════
   REVIEW SECTIONS
══════════════════════════════════════════════════ */
.review-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.review-section { margin-bottom: 16px; }
.review-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--blue);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--blue-l);
  margin-bottom: 8px;
}
.rrow { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.rrow:last-child { border-bottom: none; }
.rlabel { color: var(--text2); }
.rval   { font-weight: 600; text-align: right; max-width: 58%; }

/* ══════════════════════════════════════════════════
   ACTIVITY PANEL
══════════════════════════════════════════════════ */
.panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 200; display: none; backdrop-filter: blur(2px); }
.panel-overlay.open { display: block; }
.side-panel {
  position: fixed; top: 0; right: 0;
  height: 100%; width: 390px;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  z-index: 201;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.side-panel.open { transform: translateX(0); }
.panel-hdr { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.panel-title { font-size: 13.5px; font-weight: 700; }
.panel-sub   { font-size: 11px; color: var(--text2); margin-top: 2px; }
.panel-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text2); padding: 2px 6px; border-radius: var(--r4); line-height: 1; }
.panel-close:hover { background: var(--bg3); color: var(--text); }
.panel-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.panel-tab { flex: 1; padding: 10px 6px; font-size: 11.5px; font-weight: 500; text-align: center; cursor: pointer; color: var(--text2); border-bottom: 2.5px solid transparent; transition: all .13s; }
.panel-tab:hover { background: var(--bg3); }
.panel-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.panel-section { display: none; flex: 1; flex-direction: column; overflow: hidden; min-height: 0; }
.panel-section.active { display: flex; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 14px; }

/* Notes */
.note-item { padding: 11px 13px; background: var(--bg3); border-radius: var(--r10); margin-bottom: 8px; border-left: 3px solid var(--blue); }
.note-meta   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.note-author { font-size: 11.5px; font-weight: 600; }
.note-time   { font-size: 10px; color: var(--text2); }
.note-text   { font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.note-compose { padding: 12px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.note-author-row { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.note-author-inp { height: 32px; border: 1.5px solid var(--border2); border-radius: var(--r8); padding: 0 10px; font-size: 12px; background: var(--bg2); color: var(--text); font-family: inherit; flex: 1; }
.note-author-inp:focus { outline: none; border-color: var(--blue); }
.note-ta { width: 100%; height: 70px; border: 1.5px solid var(--border2); border-radius: var(--r8); padding: 8px 10px; font-size: 12px; background: var(--bg2); color: var(--text); font-family: inherit; resize: none; margin-bottom: 7px; }
.note-ta:focus { outline: none; border-color: var(--blue); }
.empty-panel { text-align: center; padding: 44px 20px; font-size: 12px; color: var(--text2); }

/* Change log */
.change-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.change-item:last-child { border-bottom: none; }
.change-field { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.change-time  { font-size: 10px; color: var(--text2); margin-bottom: 5px; }
.change-vals  { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cv-from { background: var(--red-l);   color: var(--red);   padding: 2px 7px; border-radius: var(--r4); text-decoration: line-through; font-size: 11px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-to   { background: var(--green-l); color: var(--green); padding: 2px 7px; border-radius: var(--r4); font-size: 11px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Documents */
.drop-zone { border: 2px dashed var(--border2); border-radius: var(--r10); padding: 26px 16px; text-align: center; cursor: pointer; transition: all .15s; margin-bottom: 10px; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--blue); background: var(--blue-xl); }
.doc-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; background: var(--bg3); border-radius: var(--r8); margin-bottom: 5px; border: 1px solid var(--border); }
.doc-icon { width: 32px; height: 32px; border-radius: var(--r6); display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; flex-shrink: 0; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 10px; color: var(--text2); margin-top: 1px; }
.doc-remove { background: none; border: none; cursor: pointer; color: var(--text2); font-size: 16px; padding: 2px 5px; border-radius: var(--r4); }
.doc-remove:hover { color: var(--red); background: var(--red-l); }

/* Panel triggers */
.ptriggers { display: flex; gap: 6px; align-items: center; }
.ptrig { display: flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: var(--r8); border: 1px solid var(--border2); background: var(--bg2); font-size: 11.5px; font-weight: 500; cursor: pointer; color: var(--text2); transition: all .13s; }
.ptrig:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.pcnt { padding: 1px 6px; border-radius: 99px; font-size: 9px; font-weight: 700; color: #fff; }

/* ══════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 300; display: none; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2);
  border-radius: var(--r16);
  border: 1px solid var(--border);
  width: 500px; max-width: 95vw;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; letter-spacing: -.02em; }
.modal-sub   { font-size: 12px; color: var(--text2); margin-bottom: 20px; }

.stage-modal { width: 430px; max-height: 92vh; overflow-y: auto; }
.stage-list  { display: flex; flex-direction: column; gap: 4px; }
.stage-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px;
  border-radius: var(--r8);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .12s;
}
.stage-opt:hover { background: var(--blue-xl); border-color: var(--blue-l); }
.stage-opt.current { background: var(--bg3); border-color: var(--border2); cursor: default; }
.stage-opt-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.stage-opt-name { font-size: 12.5px; font-weight: 500; }
.stage-opt-desc { font-size: 11px; color: var(--text2); }

/* Loan type cards in modal */
.loan-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.ltcard { border: 1.5px solid var(--border); border-radius: var(--r12); padding: 20px; cursor: pointer; text-align: center; transition: all .15s; box-shadow: var(--shadow-xs); }
.ltcard:hover { border-color: var(--blue); box-shadow: var(--shadow-md); }
.ltcard.selected { border-color: var(--blue); border-width: 2px; background: var(--blue-l); }
.ltcard-icon  { width: 48px; height: 48px; border-radius: var(--r10); margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.ltcard-title { font-size: 13.5px; font-weight: 700; margin-bottom: 5px; }
.ltcard-desc  { font-size: 11.5px; color: var(--text2); line-height: 1.5; }

/* ══════════════════════════════════════════════════
   DIRECTORS (BUSINESS FORM)
══════════════════════════════════════════════════ */
.toggle-dir-btn { border: 1.5px dashed var(--purple); background: none; border-radius: var(--r10); padding: 10px 14px; font-size: 12px; color: var(--purple); cursor: pointer; width: 100%; margin-top: 8px; font-weight: 500; font-family: inherit; transition: background .13s; }
.toggle-dir-btn:hover { background: var(--purple-l); }
.dir-block { border: 1px solid var(--border); border-radius: var(--r10); padding: 16px; margin-bottom: 10px; background: var(--bg2); }
.dir-block-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--border); }

/* ══════════════════════════════════════════════════
   INLINE ACTIVITY PANEL (permanent, inside form)
══════════════════════════════════════════════════ */

/* Two-column wrapper: form + panel */
.form-with-panel {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  align-items: start;
}

/* Form content column */
.form-main {
  min-width: 0;
}

/* Permanent inline panel */
.inline-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r12);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  /* Stick to top while scrolling */
  position: sticky;
  top: 0;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.inline-panel-hdr {
  padding: 13px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.inline-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}
.inline-panel-sub {
  font-size: 10.5px;
  color: var(--text2);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Reuse panel-tabs, panel-section, panel-scroll from above */
.inline-panel .panel-tabs {
  flex-shrink: 0;
}
.inline-panel .panel-section {
  flex: 1;
  min-height: 0;
}
.inline-panel .panel-section.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.inline-panel .panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.inline-panel .note-compose {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   GLOBAL SEARCH
══════════════════════════════════════════════════ */
.topnav-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r8);
  padding: 0 12px;
  height: 34px;
  width: 260px;
  transition: all .15s;
}
.topnav-search:focus-within {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.25);
  width: 380px;
}
.topnav-search input {
  background: none;
  border: none;
  outline: none;
  font-size: 12.5px;
  color: #fff;
  width: 100%;
  font-family: inherit;
}
.topnav-search input::placeholder { color: rgba(255,255,255,.35); }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 520px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r10);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  z-index: 9999;
  max-height: 420px;
  overflow-y: auto;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--blue-xl); }
.search-result-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue-l);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.search-result-name { font-size: 13px; font-weight: 600; }
.search-result-meta { font-size: 11px; color: var(--text2); margin-top: 1px; }
.search-empty { padding: 20px; text-align: center; font-size: 12px; color: var(--text2); }

/* ══════════════════════════════════════════════════
   USER DROPDOWN
══════════════════════════════════════════════════ */
.user-menu { position: relative; }

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r8);
  transition: background .13s;
  user-select: none;
}
.user-menu-trigger:hover { background: rgba(255,255,255,.08); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r12);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
  display: none;
  animation: dropIn .15s ease;
}
.user-dropdown.open { display: block; }
@keyframes dropIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }

.user-dropdown-header {
  padding: 14px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
}
.user-dropdown-item svg { color: var(--text2); flex-shrink: 0; }
.user-dropdown-item:hover { background: var(--bg3); }
.user-dropdown-danger { color: var(--red); }
.user-dropdown-danger svg { color: var(--red); }
.user-dropdown-danger:hover { background: var(--red-l); }

/* ══════════════════════════════════════════════════
   OPPORTUNITIES TOOLBAR & VIEW TOGGLE
══════════════════════════════════════════════════ */
.opps-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.view-toggle {
  display: flex;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border2);
  border-radius: var(--r8);
  overflow: hidden;
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text2);
  font-family: inherit;
  transition: all .13s;
}
.view-btn:hover { background: var(--bg3); color: var(--text); }
.view-btn.active {
  background: var(--blue);
  color: #fff;
}
.view-btn.active svg { opacity: 1; }

/* ══════════════════════════════════════════════════
   KANBAN — DRAG AND DROP + STAGE DROPDOWN
══════════════════════════════════════════════════ */
.k-card {
  position: relative;
  cursor: grab;
}
.k-card:active { cursor: grabbing; }

.k-card-dragging {
  opacity: .45;
  transform: rotate(2deg);
  box-shadow: var(--shadow-lg);
}

.k-col-dragover {
  background: var(--blue-xl);
  border: 2px dashed var(--blue);
}

.k-card-drag-handle {
  position: absolute;
  top: 8px; right: 8px;
  color: var(--text3);
  font-size: 14px;
  cursor: grab;
  line-height: 1;
  user-select: none;
}
.k-card:hover .k-card-drag-handle { color: var(--text2); }



.k-del-btn {
  height: 24px !important;
  padding: 0 6px !important;
  color: var(--text3) !important;
  flex-shrink: 0;
  font-size: 11px !important;
}
.k-del-btn:hover { color: var(--red) !important; background: var(--red-l) !important; }

/* ══════════════════════════════════════════════════
   CLOSE DEAL MODAL
══════════════════════════════════════════════════ */
.close-opt {
  border: 2px solid var(--border);
  border-radius: var(--r12);
  padding: 18px 14px;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
  background: var(--bg2);
}
.close-opt:hover { border-color: var(--border2); box-shadow: var(--shadow-md); }
.close-opt.selected { border-width: 2px; box-shadow: var(--shadow-md); }
#close-opt-settled.selected { border-color: var(--green); background: var(--green-l); }
#close-opt-lost.selected    { border-color: var(--red);   background: var(--red-l); }

.close-opt-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
}
.close-opt-title {
  font-size: 14px; font-weight: 700; margin-bottom: 4px;
}
.close-opt-desc { font-size: 11.5px; color: var(--text2); }

.lost-reason-opt {
  padding: 8px 12px;
  border: 1.5px solid var(--border2);
  border-radius: var(--r8);
  font-size: 12px;
  cursor: pointer;
  transition: all .13s;
  text-align: center;
  background: var(--bg2);
}
.lost-reason-opt:hover { border-color: var(--red); background: var(--red-l); color: var(--red); }
.lost-reason-opt.selected { border-color: var(--red); background: var(--red-l); color: var(--red); font-weight: 600; }


/* ── Stage bar — final outcome colours ── */
.sf-bar-settled .sf-stage,
.sf-bar-settled .sf-stage.sf-past,
.sf-bar-settled .sf-stage.sf-active {
  background: #DCFCE7;
  border-color: #86EFAC;
  color: #15803D;
}
.sf-bar-settled .sf-stage::after {
  border-left-color: #DCFCE7 !important;
}
.sf-bar-settled .sf-complete-btn {
  background: #16A34A;
  border-color: #15803D;
}
.sf-bar-settled .sf-complete-btn:hover {
  background: #15803D;
}

.sf-bar-lost .sf-stage,
.sf-bar-lost .sf-stage.sf-past,
.sf-bar-lost .sf-stage.sf-active {
  background: #FEE2E2;
  border-color: #FCA5A5;
  color: #B91C1C;
}
.sf-bar-lost .sf-stage::after {
  border-left-color: #FEE2E2 !important;
}
.sf-bar-lost .sf-complete-btn {
  background: #DC2626;
  border-color: #B91C1C;
}
.sf-bar-lost .sf-complete-btn:hover {
  background: #B91C1C;
}

/* Kanban column header & total */
.k-col-hdr {
  text-align: center !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 3px !important;
}
.k-col-total {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--blue);
  text-align: center;
  margin-top: 1px;
}

/* ── Toggle switch ── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border2);
  border-radius: 99px;
  transition: .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }
.toggle-switch input:disabled + .toggle-slider { opacity: .5; cursor: not-allowed; }

/* ══════════════════════════════════════════════════
   REPORT BUILDER
══════════════════════════════════════════════════ */
.report-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  align-items: start;
}
.report-builder-panel { position: sticky; top: 14px; }
.report-results-panel {}

/* Column picker chips */
.rpt-col-list {
  min-height: 36px;
  border: 1.5px dashed var(--border2);
  border-radius: var(--r8);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rpt-col-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r6);
  font-size: 11.5px;
  cursor: grab;
  user-select: none;
  transition: background .1s;
}
.rpt-col-chip:hover { background: var(--bg3); }
.rpt-col-chip.active { border-color: var(--blue); background: var(--blue-xl); color: var(--blue); }
.rpt-col-chip-handle { color: var(--text3); cursor: grab; }
.rpt-col-chip-remove { margin-left: auto; cursor: pointer; color: var(--text3); font-size:14px; line-height:1; }
.rpt-col-chip-remove:hover { color: var(--red); }
.rpt-col-group {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text3);
  padding: 6px 4px 2px;
}

/* Saved reports list */
.saved-report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  gap: 8px;
}
.saved-report-item:last-child { border-bottom: none; }
.saved-report-item:hover { background: var(--bg3); }

/* ══════════════════════════════════════════════════
   INTEGRATIONS PANEL
══════════════════════════════════════════════════ */
.integ-section {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.integ-section:last-child { border-bottom: none; }
.integ-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.integ-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r8);
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 11.5px;
}
.integ-empty {
  font-size: 11.5px;
  color: var(--text2);
  padding: 8px 0;
  line-height: 1.5;
}
.integ-score {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}
.integ-score.good  { background: var(--green-l); color: var(--green); }
.integ-score.fair  { background: #FEF9C3;        color: #B45309; }
.integ-score.poor  { background: var(--red-l);   color: var(--red); }

.btn-outline-blue {
  border: 1.5px solid var(--blue) !important;
  color: var(--blue) !important;
  background: transparent !important;
  font-size: 11px !important;
  padding: 4px 10px !important;
  height: 28px !important;
}
.btn-outline-blue:hover {
  background: var(--blue-xl) !important;
}
.btn-sm {
  font-size: 11.5px !important;
  padding: 5px 12px !important;
  height: 30px !important;
}


/* ── Deal step layout ── */
.deal-layout { display: flex; flex-direction: column; gap: 14px; }
.deal-top-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
.deal-top-row > .card { display: flex; flex-direction: column; }
.deal-top-row > .card .card-body { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.deal-checklist-row .card { width: 100%; }
.deal-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 12px; }
/* ── Deal section layout ── */
.deal-info-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.deal-info-block {
  background: var(--bg3);
  border-radius: var(--r8);
  padding: 12px 14px;
  border: 1px solid var(--border);
}
.deal-info-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text2);
  margin-bottom: 4px;
}
.deal-info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.deal-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 280px));
  gap: 12px;
}

/* ── Kanban scrollable card area ── */
.k-card-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.k-card-wrap::-webkit-scrollbar { width: 4px; }
.k-card-wrap::-webkit-scrollbar-track { background: transparent; }
.k-card-wrap::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
.k-col-more {
  font-size: 10px;
  color: var(--text3);
  text-align: center;
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* ══════════════════════════════════════════════════
   NOTIFICATIONS
══════════════════════════════════════════════════ */
.topnav-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.7);
  transition: background .15s;
  flex-shrink: 0;
}
.topnav-icon-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.notif-wrap { position: relative; }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  background: var(--red);
  color: #fff;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 1.5px solid #0F172A;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r10);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 9000;
  overflow: hidden;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
  position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg3); }
.notif-item.unread { background: var(--blue-xl); }
.notif-item.unread:hover { background: #DBEAFE; }
.notif-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--blue);
}
.notif-body { flex: 1; }
.notif-text { font-size: 12.5px; color: var(--text); line-height: 1.4; }
.notif-time { font-size: 10.5px; color: var(--text2); margin-top: 3px; }
.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
  margin-top: 6px;
}

/* ══════════════════════════════════════════════════
   DARK MODE
══════════════════════════════════════════════════ */
:root.dark {
  --bg:      #0F172A;
  --bg2:     #1E293B;
  --bg3:     #334155;
  --text:    #F1F5F9;
  --text2:   #94A3B8;
  --text3:   #64748B;
  --border:  #334155;
  --border2: #475569;
  --blue-xl: #1E3A5F;
  --green-l: #14532D22;
  --red-l:   #7F1D1D22;
  --amber-l: #78350F22;
}
:root.dark .topnav    { background: #020617; }
:root.dark .card      { background: var(--bg2); }
:root.dark .fi,
:root.dark .fi-sel,
:root.dark .fi-ta     { background: var(--bg3); color: var(--text); border-color: var(--border2); }
:root.dark .data-table tr:hover td { background: var(--bg3); }
:root.dark .modal     { background: var(--bg2); }
:root.dark .search-results { background: var(--bg2); }
:root.dark .user-dropdown  { background: var(--bg2); }
:root.dark .deal-info-block { background: var(--bg3); }

/* ── 6-column stat grid ── */
.stat-grid-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1200px) { .stat-grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .stat-grid-6 { grid-template-columns: repeat(2, 1fr); } }

/* ══════════════════════════════════════════════════
   DASHBOARD TABS & TOOLBAR
══════════════════════════════════════════════════ */
.dash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--topnav-bg, #0F172A);
  padding: 0 20px;
  height: 48px;
  margin: -20px -20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-wrap: wrap;
  gap: 8px;
}
.dash-tabs {
  display: flex;
  gap: 4px;
}
.dash-tab {
  padding: 6px 16px;
  border-radius: var(--r8);
  background: none;
  border: none;
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  font-family: inherit;
  transition: all .13s;
  white-space: nowrap;
}
.dash-tab:hover  { background: rgba(255,255,255,.08); color: rgba(255,255,255,.8); }
.dash-tab.active { background: rgba(255,255,255,.12); color: #fff; }
.dash-period-sel {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--r8);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  height: 30px;
  font-family: inherit;
  cursor: pointer;
}
.dash-period-sel option { background: #1E293B; color: #fff; }
.dash-panel { animation: fadeIn .2s ease; }
.card-subtitle { font-size: 11px; color: var(--text2); }

/* ══════════════════════════════════════════════════
   DASHBOARD BUILDER
══════════════════════════════════════════════════ */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  align-items: start;
}
.dash-component { min-height: 120px; }

/* Tab add button */
.dash-tab-add {
  border: 1.5px dashed rgba(255,255,255,.25) !important;
  color: rgba(255,255,255,.4) !important;
  display: flex;
  align-items: center;
  gap: 5px;
}
.dash-tab-add:hover {
  border-color: rgba(255,255,255,.5) !important;
  color: rgba(255,255,255,.7) !important;
  background: rgba(255,255,255,.06) !important;
}
