/* ═══════════════════════════════════════════════════════════════
   CRE Loan Document Reviewer — Stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --navy:        #1a1a2e;
  --navy-mid:    #16213e;
  --navy-light:  #2e4057;
  --blue:        #2563eb;
  --blue-hover:  #1d4ed8;
  --blue-light:  #eff6ff;
  --green:       #16a34a;
  --green-light: #dcfce7;
  --orange:      #d97706;
  --orange-light:#fef3c7;
  --red:         #dc2626;
  --red-light:   #fee2e2;
  --grey-100:    #f8fafc;
  --grey-200:    #f1f5f9;
  --grey-300:    #e2e8f0;
  --grey-500:    #64748b;
  --grey-700:    #374151;
  --white:       #ffffff;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:   0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --transition:  .2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--grey-100);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: 'Poppins', sans-serif;
  line-height: 1.3;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #0f3460 100%);
  color: var(--white);
  padding: 32px 0 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
}

.header-emoji {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}

.header-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--white);
}

.header-tagline {
  font-size: .95rem;
  color: rgba(255,255,255,.65);
  font-weight: 300;
  letter-spacing: .01em;
  padding-left: 62px;
}

/* ── Settings Bar ──────────────────────────────────────────── */
.settings-bar {
  background: var(--white);
  border-bottom: 1px solid var(--grey-300);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 24px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  max-width: 1200px;
  margin: 0 auto;
  transition: background var(--transition);
}

.settings-toggle:hover { background: var(--grey-100); }

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--grey-100);
  border: 1px solid var(--grey-300);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: .8rem;
  color: var(--text-muted);
  margin-left: auto;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grey-500);
  transition: background var(--transition);
  flex-shrink: 0;
}

.status-dot.active { background: var(--green); box-shadow: 0 0 0 2px var(--green-light); }

.toggle-chevron {
  font-size: .7rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.toggle-chevron.open { transform: rotate(180deg); }

.settings-panel {
  border-top: 1px solid var(--grey-200);
  background: var(--grey-100);
  animation: slideDown .2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.settings-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  gap: 32px;
  align-items: flex-end;
}

.settings-info { flex: 1; }
.settings-info h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.settings-info p  { font-size: .85rem; color: var(--text-muted); }

.api-key-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex: 2;
}

.input-group { flex: 1; }
.input-group label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--grey-700);
  margin-bottom: 5px;
}

.key-input-wrapper {
  display: flex;
  border: 1.5px solid var(--grey-300);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
  transition: border-color var(--transition);
}
.key-input-wrapper:focus-within { border-color: var(--blue); }

.key-input-wrapper input {
  flex: 1;
  padding: 9px 12px;
  border: none;
  outline: none;
  font-family: 'Inter', monospace;
  font-size: .9rem;
  background: transparent;
}

.eye-btn {
  padding: 0 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.eye-btn:hover { color: var(--text); }

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 32px 0 64px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 24px 28px 0;
}
.card-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.card-header p { font-size: .9rem; color: var(--text-muted); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--blue);
  color: var(--white);
}
.btn-primary:hover { background: var(--blue-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.35); }

.btn-secondary {
  background: var(--grey-200);
  color: var(--grey-700);
  border: 1.5px solid var(--grey-300);
}
.btn-secondary:hover { background: var(--grey-300); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--grey-300);
}
.btn-ghost:hover { background: var(--grey-100); color: var(--text); }

.btn-success {
  background: var(--green);
  color: var(--white);
}
.btn-success:hover { background: #15803d; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(22,163,74,.3); }

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--navy-light);
}
.btn-outline:hover { background: var(--navy); color: var(--white); }

.btn-lg { padding: 12px 28px; font-size: 1rem; }

/* ── Drop Zone ─────────────────────────────────────────────── */
.upload-card { padding-bottom: 28px; }

.drop-zone {
  margin: 20px 28px;
  border: 2.5px dashed var(--grey-300);
  border-radius: var(--radius-lg);
  background: var(--grey-100);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
}

.drop-idle {
  text-align: center;
  padding: 40px 20px;
}
.drop-icon { font-size: 3.5rem; margin-bottom: 12px; filter: grayscale(.3); }
.drop-headline { font-family: 'Poppins', sans-serif; font-size: 1.15rem; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.drop-sub { font-size: .9rem; color: var(--text-muted); margin-bottom: 8px; }
.drop-hint { font-size: .8rem; color: var(--grey-500); }
.link-text { color: var(--blue); font-weight: 500; }

.drop-file {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 32px;
  width: 100%;
}
.file-icon-lg { font-size: 2.5rem; }
.file-meta { flex: 1; }
.file-name { display: block; font-weight: 600; color: var(--navy); font-size: 1rem; word-break: break-all; }
.file-size { display: block; font-size: .85rem; color: var(--text-muted); margin-top: 2px; }

.remove-btn {
  background: var(--red-light);
  color: var(--red);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .9rem;
  flex-shrink: 0;
  transition: all var(--transition);
}
.remove-btn:hover { background: var(--red); color: var(--white); }

.options-row {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 0 28px;
  flex-wrap: wrap;
}

.select-group label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--grey-700);
  margin-bottom: 5px;
}

.select-group select {
  padding: 10px 36px 10px 12px;
  border: 1.5px solid var(--grey-300);
  border-radius: var(--radius);
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  color: var(--text);
  cursor: pointer;
  min-width: 220px;
  transition: border-color var(--transition);
}
.select-group select:focus { outline: none; border-color: var(--blue); }
.doc-type-other {
  margin-top: 8px; width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--grey-300); border-radius: var(--radius);
  font-family: 'Inter', sans-serif; font-size: .9rem; color: var(--text);
}
.doc-type-other:focus { outline: none; border-color: var(--blue); }

.btn-group {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* ── Loading State ─────────────────────────────────────────── */
.loading-card { text-align: center; padding: 64px 24px; }
.loading-inner { display: inline-block; }

.spinner-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.ring-1 {
  border-top-color: var(--blue);
  animation: spin 1.2s linear infinite;
}
.ring-2 {
  inset: 8px;
  border-top-color: var(--navy-light);
  animation: spin 1.6s linear infinite reverse;
}
.ring-3 {
  inset: 16px;
  border-top-color: var(--blue-hover);
  animation: spin 2s linear infinite;
}
.ring-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

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

.loading-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}
.loading-msg {
  font-size: 1rem;
  color: var(--text-muted);
  min-height: 1.6em;
  margin-bottom: 20px;
  transition: opacity .3s;
}
.loading-hint { font-size: .82rem; color: var(--grey-500); margin-top: 16px; }

.progress-track {
  width: 280px;
  height: 4px;
  background: var(--grey-200);
  border-radius: 999px;
  margin: 0 auto;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  border-radius: 999px;
  width: 0%;
  transition: width .8s ease;
  animation: progressAnim 45s ease forwards;
}

@keyframes progressAnim {
  0%   { width: 0%; }
  20%  { width: 25%; }
  50%  { width: 55%; }
  80%  { width: 78%; }
  95%  { width: 88%; }
}

/* ── Results Topbar ────────────────────────────────────────── */
.results-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.results-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.results-title-group h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
}

.mode-badge {
  background: var(--blue-light);
  color: var(--blue-hover);
  border: 1px solid #bfdbfe;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}
.mode-badge.demo { background: var(--orange-light); color: var(--orange); border-color: #fde68a; }

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

/* ── Metric Cards ──────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--blue);
}
.metric-card.good::before  { background: var(--green); }
.metric-card.warn::before  { background: var(--orange); }
.metric-card.bad::before   { background: var(--red); }
.metric-card.neutral::before { background: var(--blue); }

.metric-icon { font-size: 1.8rem; margin-bottom: 12px; }

.metric-value {
  font-family: 'Poppins', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
  margin-bottom: 4px;
  word-break: break-word;
}

.metric-label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.metric-status {
  margin-top: 8px;
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.metric-status.good  { background: var(--green-light);  color: #15803d; }
.metric-status.warn  { background: var(--orange-light); color: #92400e; }
.metric-status.bad   { background: var(--red-light);    color: #991b1b; }
.metric-status.neutral { background: var(--blue-light); color: var(--blue-hover); }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs-card { padding: 0; }

.tab-nav {
  display: flex;
  border-bottom: 2px solid var(--grey-200);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 4px;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-nav { scroll-behavior: smooth; }

/* Slide buttons for overflowing tab strips */
.tab-scroll { position: relative; }
.tab-scroll-btn {
  position: absolute; top: 0; bottom: 0; width: 40px; z-index: 3;
  border: none; cursor: pointer; color: var(--navy);
  font-size: 1.6rem; font-weight: 700; line-height: 1;
  display: flex; align-items: center;
}
.tab-scroll-btn.left  { left: 0;  justify-content: flex-start; padding-left: 6px;  background: linear-gradient(to right, var(--white) 55%, rgba(255,255,255,0)); }
.tab-scroll-btn.right { right: 0; justify-content: flex-end;   padding-right: 6px; background: linear-gradient(to left,  var(--white) 55%, rgba(255,255,255,0)); }
.tab-scroll-btn:hover { color: var(--blue); }
.tab-scroll-btn.hidden { display: none; }

.tab-btn {
  padding: 14px 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: .87rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--navy); background: var(--grey-100); }
.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

.tab-badge {
  background: var(--red);
  color: var(--white);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: .72rem;
  font-weight: 700;
}

.tab-body { padding: 24px 28px; }

.tab-pane { display: none; animation: fadeIn .25s ease; }
.tab-pane.active { display: block; }

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

/* ── Data Table ────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.data-table thead tr {
  background: var(--navy);
  color: var(--white);
}
.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-family: 'Poppins', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:nth-child(even) { background: var(--grey-100); }
.data-table tbody tr:hover { background: var(--blue-light); }

.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--grey-200);
  vertical-align: top;
}
.data-table td:first-child {
  font-weight: 600;
  color: var(--navy-light);
  width: 240px;
  white-space: nowrap;
}
.data-table td:last-child { color: var(--text); }

.na-value { color: var(--text-muted); font-style: italic; }

/* ── Key Terms Grid ────────────────────────────────────────── */
.key-terms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.key-term-card {
  background: var(--grey-100);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color var(--transition);
}
.key-term-card:hover { border-color: var(--blue); }

.kt-label {
  font-family: 'Poppins', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  color: var(--navy-light);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kt-value {
  font-size: .9rem;
  color: var(--text);
  line-height: 1.65;
}
.kt-value.na { color: var(--text-muted); font-style: italic; }

/* ── Key Terms — structured blocks ─────────────────────────── */
#keyTermsContent { display: block; }   /* override the .key-terms-grid grid */
.kt-empty { color: var(--text-muted); font-style: italic; padding: 8px 2px; }

.kt-block {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-left: 4px solid var(--grey-300);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.kt-block.accent-red   { border-left-color: var(--red); }
.kt-block.accent-green { border-left-color: var(--green); }
.kt-block.accent-plain { border-left-color: var(--navy-light); }

.kt-block-head {
  font-family: 'Poppins', sans-serif;
  font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--navy); margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.kt-block.accent-red   .kt-block-head { color: var(--red); }
.kt-block.accent-green .kt-block-head { color: var(--green); }

.kt-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid var(--grey-200);
}
.kt-row:last-child { border-bottom: 0; }
.kt-row-key { font-weight: 600; color: var(--navy); font-size: .92rem; }
.kt-row-val { color: var(--text-muted); font-size: .9rem; text-align: right; }
.kt-row-val.strong { color: var(--navy); font-weight: 700; }

.kt-text { font-size: .9rem; color: var(--text); line-height: 1.65; }

.kt-guarantor-name {
  font-family: 'Poppins', sans-serif; font-weight: 700; color: var(--navy);
  font-size: 1.05rem; padding-bottom: 10px; margin-bottom: 4px;
  border-bottom: 1px solid var(--grey-200);
}
.kt-guarantor-name span { font-weight: 500; color: var(--text-muted); }

.kt-note {
  margin-top: 12px; padding: 10px 12px;
  background: var(--green-light); border-radius: 8px;
  font-size: .85rem; color: #15803d; line-height: 1.5;
}
.kt-note-inline { font-size: .85rem; color: var(--text-muted); font-style: italic; margin-bottom: 14px; }

/* Headroom chart */
.kt-chart { margin-bottom: 16px; }
.kt-chart-legend { display: flex; gap: 18px; margin-bottom: 12px; font-size: .78rem; color: var(--text-muted); }
.kt-lg { display: inline-flex; align-items: center; gap: 6px; }
.kt-lg::before { content: ''; width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.kt-lg.actual::before   { background: var(--green); }
.kt-lg.required::before { background: var(--grey-300); }

.kt-chart-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; margin-bottom: 12px; }
.kt-chart-label { font-size: .85rem; font-weight: 600; color: var(--navy); }
.kt-chart-bars { display: flex; flex-direction: column; gap: 5px; }
.kt-bar-line { display: flex; align-items: center; gap: 8px; }
.kt-bar { height: 14px; border-radius: 4px; min-width: 2px; transition: width .5s ease; }
.kt-bar.actual   { background: var(--green); }
.kt-bar.required { background: var(--grey-300); }
.kt-bar-val { font-size: .78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.kt-headroom-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kt-hr-card { background: var(--grey-100); border: 1px solid var(--grey-200); border-radius: var(--radius); padding: 12px 14px; }
.kt-hr-card.good { background: var(--green-light); border-color: #bbf7d0; }
.kt-hr-card.bad  { background: var(--red-light);   border-color: #fecaca; }
.kt-hr-label { font-size: .78rem; color: var(--text-muted); margin-bottom: 4px; }
.kt-hr-value { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--navy); }
.kt-hr-card.good .kt-hr-value { color: #15803d; }
.kt-hr-card.bad  .kt-hr-value { color: #991b1b; }

/* ══════════════════════════════════════════ OVERVIEW PAGE ══ */
.ov-intro {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.ov-intro-text { flex: 1 1 420px; }
.ov-intro-text h2 {
  font-family: 'Poppins', sans-serif; color: var(--navy);
  font-size: 1.4rem; margin-bottom: 10px;
}
.ov-intro-text p { color: var(--text); line-height: 1.7; font-size: .95rem; margin-bottom: 8px; }
.ov-intro-hint {
  background: var(--blue-light); border-radius: 8px; padding: 10px 14px;
  font-size: .9rem; color: var(--navy); margin-top: 6px !important;
}
.ov-intro-actions { display: flex; flex-direction: column; gap: 10px; flex: 0 0 auto; }

.ov-deal-strip {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: var(--white); border-radius: var(--radius-lg);
  padding: 14px 20px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.ov-deal-icon { font-size: 1.6rem; }
.ov-deal-body { flex: 1; display: flex; flex-direction: column; }
.ov-deal-name { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.1rem; }
.ov-deal-meta { font-size: .85rem; opacity: .85; }
.ov-deal-tag {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  background: rgba(255,255,255,.15); padding: 5px 10px; border-radius: 20px;
}

.ov-section { margin-bottom: 26px; }
.ov-findings-sub { color: var(--text-muted); font-size: .9rem; margin: -8px 0 16px; }

/* Deal pipeline tracker */
.ov-pipeline {
  background: var(--white); border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: 16px 20px; margin-bottom: 22px;
}
.ov-pl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.ov-pl-kicker { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--navy-light); }
.ov-pl-current { font-size: .85rem; font-weight: 700; color: var(--green); }
.ov-pl-track { display: flex; overflow-x: auto; padding-bottom: 4px; }
.ov-pl-node { flex: 1 0 74px; display: flex; flex-direction: column; align-items: center; gap: 7px; position: relative; text-align: center; }
.ov-pl-node::before {
  content: ''; position: absolute; top: 14px; left: -50%; width: 100%; height: 2px;
  background: var(--grey-300); z-index: 0;
}
.ov-pl-node:first-child::before { display: none; }
.ov-pl-node.done::before, .ov-pl-node.current::before { background: var(--green); }
.ov-pl-dot {
  position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: .8rem;
  background: var(--white); border: 2px solid var(--grey-300); color: var(--grey-500);
}
.ov-pl-node.done .ov-pl-dot { background: var(--green); border-color: var(--green); color: #fff; }
.ov-pl-node.current .ov-pl-dot { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 0 0 4px var(--blue-light); }
.ov-pl-label { font-size: .7rem; line-height: 1.2; color: var(--text-muted); max-width: 84px; }
.ov-pl-node.done .ov-pl-label { color: var(--navy-light); }
.ov-pl-node.current .ov-pl-label { color: var(--navy); font-weight: 700; }

/* ══════════════════════ OVERVIEW DASHBOARD (interactive) ══ */
.ov-deal-header { margin-bottom: 24px; }
.ov-dh-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ov-dh-name { font-family: 'Poppins', sans-serif; font-size: 1.6rem; color: var(--navy); }
.ov-dh-sub { color: var(--text-muted); font-size: .92rem; margin-top: 3px; }
.ov-dh-mode { display: inline-block; margin-top: 8px; font-size: .76rem; font-weight: 600; padding: 4px 11px; border-radius: 20px; }
.ov-dh-mode.live { background: var(--green-light); color: #15803d; }
.ov-dh-mode.demo { background: var(--grey-200); color: var(--grey-700); }
.ov-dh-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ov-section-hint { font-weight: 400; font-size: .85rem; color: var(--text-muted); }

/* Clickable stage pills */
.ov-stages { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ov-pill {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: .85rem; font-weight: 600;
  padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--grey-300);
  background: var(--white); color: var(--navy-light); transition: all var(--transition);
}
.ov-pill:hover { border-color: var(--blue); }
.ov-pill-mark { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; font-size: .72rem; font-weight: 700; background: var(--grey-200); color: var(--grey-500); }
.ov-pill.done { border-color: #bbf7d0; background: var(--green-light); color: #15803d; }
.ov-pill.done .ov-pill-mark { background: var(--green); color: #fff; }
.ov-pill.active { border-color: var(--orange); background: var(--orange-light); color: #92400e; }
.ov-pill.active .ov-pill-mark { background: var(--orange); color: #fff; }
.ov-pill.selected { box-shadow: 0 0 0 3px var(--blue-light); border-color: var(--blue); }

.ov-stage-detail { background: var(--white); border: 1px solid var(--grey-200); border-left: 4px solid var(--blue); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow-sm); }
.ov-sd-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ov-sd-head strong { font-family: 'Poppins', sans-serif; color: var(--navy); }
.ov-sd-status { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: 20px; }
.ov-sd-status.done { background: var(--green-light); color: #15803d; }
.ov-sd-status.active { background: var(--orange-light); color: #92400e; }
.ov-sd-status.todo { background: var(--grey-200); color: var(--grey-500); }
.ov-sd-desc { color: var(--text); font-size: .92rem; line-height: 1.5; margin-bottom: 8px; }
.ov-sd-link { font-weight: 600; color: var(--blue); font-size: .88rem; text-decoration: none; }
.ov-sd-link:hover { text-decoration: underline; }

/* Charts */
.ov-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.ov-chart-card { padding: 18px 20px; }
.ov-chart-title { font-family: 'Poppins', sans-serif; font-size: 1rem; color: var(--navy); margin-bottom: 12px; }
.ov-chart-canvas { position: relative; height: 230px; }
.ov-chart-cap { font-size: .78rem; color: var(--text-muted); margin-top: 12px; line-height: 1.4; text-align: center; }
.ov-chart-fallback { color: var(--text-muted); font-size: .85rem; text-align: center; padding: 40px 0; }

/* ── Insurance & risk transfer ─────────────────────────────── */
.ov-ins-banner { margin-bottom: 16px; }
.ov-ins-status {
  padding: 12px 16px; border-radius: var(--radius); font-weight: 600; font-size: .95rem;
  border-left: 5px solid; line-height: 1.45;
}
.ov-ins-status.good { background: #f0fdf4; border-color: #16a34a; color: #15803d; }
.ov-ins-status.warn { background: #fffbeb; border-color: #d97706; color: #92400e; }
.ov-ins-status.bad  { background: #fef2f2; border-color: #dc2626; color: #991b1b; }
.ov-ins-status.demo { background: #eff6ff; border-color: #2563eb; color: #1e40af; }
.ov-ins-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ov-ins-facts span {
  font-size: .8rem; font-weight: 600; color: var(--navy);
  background: var(--grey-100); border-radius: 20px; padding: 4px 12px;
}

.ov-ins-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .ov-ins-grid { grid-template-columns: 1fr; } }
.ov-ins-card { padding: 18px 20px; }

.ov-ins-coverages { display: flex; flex-direction: column; gap: 2px; }
.ov-cov-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--grey-100); }
.ov-cov-row:last-child { border-bottom: 0; }
.ov-cov-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.ov-cov-dot.ok { background: #16a34a; } .ov-cov-dot.warn { background: #d97706; }
.ov-cov-dot.exception { background: #dc2626; } .ov-cov-dot.not_reviewed { background: #cbd5e1; }
.ov-cov-name { font-size: .9rem; font-weight: 600; color: var(--navy); }
.ov-cov-flag {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 2px 8px; border-radius: 10px; margin-left: 4px;
}
.ov-cov-flag.ok { background: #dcfce7; color: #15803d; }
.ov-cov-flag.warn { background: #fef3c7; color: #92400e; }
.ov-cov-flag.exception { background: #fee2e2; color: #991b1b; }
.ov-cov-flag.not_reviewed { background: var(--grey-100); color: var(--text-muted); }
.ov-cov-meta { font-size: .78rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }

.ov-ins-subhead { font-family: 'Poppins', sans-serif; font-size: 1rem; color: var(--navy); margin: 22px 0 12px; }
.ov-peril-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.ov-peril {
  border: 1px solid var(--grey-200); border-radius: 14px; padding: 16px; text-align: center;
  border-top: 4px solid var(--grey-200); background: var(--white);
}
.ov-peril.low      { border-top-color: #16a34a; }
.ov-peril.moderate { border-top-color: #d97706; }
.ov-peril.high     { border-top-color: #dc2626; }
.ov-peril-ico { font-size: 1.6rem; }
.ov-peril-name { font-weight: 700; color: var(--navy); margin-top: 4px; }
.ov-peril-val { font-size: .9rem; font-weight: 600; color: var(--navy-light); margin-top: 4px; }
.ov-peril-note { font-size: .76rem; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }

/* Clickable findings (expand the analysis) */
.ov-finding { cursor: pointer; }
.ov-find-toggle { float: right; color: var(--text-muted); font-size: .8rem; transition: transform var(--transition); }
.ov-finding.open .ov-find-toggle { transform: rotate(180deg); }
.ov-finding-detail { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.ov-finding.open .ov-finding-detail { max-height: 420px; margin-top: 12px; }
.ov-fd-table { width: 100%; border-collapse: collapse; }
.ov-fd-table td { padding: 6px 8px; font-size: .85rem; border-bottom: 1px solid var(--grey-100); }
.ov-fd-table td:first-child { color: var(--text-muted); }
.ov-fd-table td:last-child { text-align: right; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }
.ov-finding-src {
  display: inline-block; margin-top: 10px; font-size: .72rem; font-weight: 600;
  color: var(--navy-light); background: var(--grey-100);
  border: 1px solid var(--grey-200); padding: 3px 10px; border-radius: 20px;
}
.ov-section-title {
  font-family: 'Poppins', sans-serif; color: var(--navy);
  font-size: 1.15rem; margin-bottom: 16px;
}

/* Stepper */
.ov-stepper { display: flex; flex-direction: column; }
.ov-step {
  display: grid; grid-template-columns: 48px 1fr; gap: 4px;
  text-decoration: none; color: inherit; position: relative;
}
.ov-step-rail { position: relative; display: flex; justify-content: center; }
.ov-step-rail::before {
  content: ''; position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--grey-300);
}
.ov-step:first-child .ov-step-rail::before { top: 24px; }
.ov-step:last-child  .ov-step-rail::before { bottom: calc(100% - 24px); }
.ov-step-num {
  position: relative; z-index: 1; width: 30px; height: 30px; margin-top: 12px;
  border-radius: 50%; background: var(--white); border: 2px solid var(--grey-300);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: .85rem; color: var(--grey-500);
}
.ov-step.done   .ov-step-num { background: var(--green); border-color: var(--green); color: #fff; }
.ov-step.active .ov-step-num { background: var(--orange); border-color: var(--orange); color: #fff; }
.ov-step.ready  .ov-step-num { background: var(--blue); border-color: var(--blue); color: #fff; }

.ov-step-card {
  background: var(--white); border: 1px solid var(--grey-200);
  border-left: 4px solid var(--grey-300);
  border-radius: var(--radius); padding: 14px 18px; margin: 6px 0;
  flex: 1; transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.ov-step.done   .ov-step-card { border-left-color: var(--green); }
.ov-step.active .ov-step-card { border-left-color: var(--orange); }
.ov-step.ready  .ov-step-card { border-left-color: var(--blue); }
.ov-step.is-link { cursor: pointer; }
.ov-step.is-link:hover .ov-step-card {
  box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--blue);
}
.ov-step.soon .ov-step-card { opacity: .72; }

.ov-step-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ov-step-title { font-family: 'Poppins', sans-serif; font-weight: 600; color: var(--navy); font-size: 1rem; }
.ov-step-desc { color: var(--text-muted); font-size: .88rem; margin-top: 4px; line-height: 1.5; }
.ov-step-open { display: inline-block; margin-top: 8px; color: var(--blue); font-weight: 600; font-size: .85rem; }

.ov-step-status {
  font-size: .72rem; font-weight: 600; padding: 4px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.ov-step-status.done   { background: var(--green-light);  color: #15803d; }
.ov-step-status.active { background: var(--orange-light); color: #92400e; }
.ov-step-status.ready  { background: var(--blue-light);   color: #1e40af; }
.ov-step-status.todo   { background: var(--grey-200);     color: var(--grey-500); }
.ov-step-status.soon   { background: var(--grey-200);     color: var(--grey-500); }

/* Glossary */
.ov-gloss-chev { font-size: .8rem; color: var(--text-muted); }
.ov-gloss-grid {
  display: none; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; padding: 4px 24px 22px;
}
.ov-gloss-grid.open { display: grid; }
.ov-gloss-item { background: var(--grey-100); border: 1px solid var(--grey-200); border-radius: var(--radius); padding: 12px 14px; }
.ov-gloss-term { font-family: 'Poppins', sans-serif; font-weight: 700; color: var(--navy); font-size: .9rem; margin-bottom: 4px; }
.ov-gloss-def  { font-size: .85rem; color: var(--text-muted); line-height: 1.55; }

@media (max-width: 600px) {
  .ov-intro-actions { flex-direction: row; width: 100%; }
  .ov-intro-actions .btn { flex: 1; }
}

/* ══════════════════════════════════════════ CREDIT MEMO ══ */
.cm-doc {
  background: var(--white); border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 32px; max-width: 920px; margin: 0 auto;
}
.cm-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; flex-wrap: wrap; border-bottom: 2px solid var(--grey-200);
  padding-bottom: 18px; margin-bottom: 20px;
}
.cm-kicker { font-size: .7rem; letter-spacing: .12em; color: var(--grey-500); font-weight: 600; }
.cm-title { font-family: 'Poppins', sans-serif; font-size: 1.6rem; color: var(--navy); margin: 4px 0; }
.cm-sub { color: var(--text-muted); font-size: .9rem; }
.cm-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.cm-verdict {
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: .95rem;
  padding: 8px 16px; border-radius: 8px; white-space: nowrap;
}
.cm-verdict.good { background: var(--green-light); color: #15803d; }
.cm-verdict.warn { background: var(--orange-light); color: #92400e; }
.cm-verdict.bad  { background: var(--red-light); color: #991b1b; }
.cm-grade {
  display: flex; flex-direction: column; align-items: center;
  border-radius: var(--radius); padding: 8px 16px; min-width: 130px;
}
.cm-grade.good { background: var(--green-light); }
.cm-grade.warn { background: var(--orange-light); }
.cm-grade.bad  { background: var(--red-light); }
.cm-grade-num { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 1.7rem; color: var(--navy); line-height: 1; }
.cm-grade-num small { font-size: .9rem; font-weight: 600; color: var(--grey-500); }
.cm-grade-label { font-size: .72rem; color: var(--grey-700); text-align: center; margin-top: 3px; }

.cm-narrative {
  font-size: .98rem; line-height: 1.75; color: var(--text);
  background: var(--grey-100); border-left: 3px solid var(--blue);
  padding: 14px 18px; border-radius: 8px; margin-bottom: 22px; white-space: pre-wrap;
}
.cm-block { margin-bottom: 22px; }
.cm-block h3 {
  font-family: 'Poppins', sans-serif; font-size: 1rem; color: var(--navy);
  border-bottom: 1px solid var(--grey-200); padding-bottom: 6px; margin-bottom: 12px;
}
.cm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 24px; }
.cm-kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--grey-200); }
.cm-k { color: var(--text-muted); font-size: .88rem; }
.cm-v { color: var(--navy); font-weight: 600; font-size: .9rem; text-align: right; }
.cm-v.muted { color: var(--text-muted); font-weight: 400; }

.cm-table { width: 100%; border-collapse: collapse; }
.cm-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--grey-500); padding: 8px 10px; border-bottom: 2px solid var(--grey-200); }
.cm-table td { padding: 9px 10px; border-bottom: 1px solid var(--grey-200); font-size: .9rem; color: var(--text); }
.cm-table td.num, .cm-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cm-pill { font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.cm-pill.good  { background: var(--green-light); color: #15803d; }
.cm-pill.bad   { background: var(--red-light); color: #991b1b; }
.cm-pill.warn  { background: var(--orange-light, #fffbeb); color: #92400e; }
.cm-pill.muted { background: var(--grey-100); color: var(--grey-500); }

.cm-subh { font-family: 'Poppins', sans-serif; font-size: .9rem; color: var(--navy); margin: 16px 0 8px; }

.cm-two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cm-list { list-style: none; padding: 0; }
.cm-list li { position: relative; padding: 6px 0 6px 20px; font-size: .9rem; line-height: 1.5; color: var(--text); border-bottom: 1px solid var(--grey-100); }
.cm-list li::before { content: '•'; position: absolute; left: 4px; color: var(--grey-500); }
.cm-list.good li::before { content: '✓'; color: var(--green); }
.cm-list.bad li::before  { content: '!'; color: var(--red); font-weight: 700; }
.cm-list li.muted { color: var(--text-muted); font-style: italic; }
.cm-note { margin-top: 12px; padding: 10px 12px; background: var(--green-light); border-radius: 8px; font-size: .85rem; color: #15803d; }
.cm-note.info { background: var(--blue-light, #eff6ff); color: #1e40af; }
.cm-note.bad-note { background: var(--red-light, #fef2f2); color: #991b1b; }

/* Grade transparency + editable narrative */
.cm-grade-how { margin: 14px 0 4px; border: 1px solid var(--grey-200); border-radius: 10px; background: var(--grey-50, #f8fafc); }
.cm-grade-how summary { cursor: pointer; padding: 10px 14px; font-size: .88rem; font-weight: 600; color: var(--navy); }
.cm-grade-how[open] summary { border-bottom: 1px solid var(--grey-200); }
.cm-grade-how .cm-how-table { margin: 0; }
.cm-grade-how .cm-how-table td, .cm-grade-how .cm-how-table th { font-size: .84rem; padding: 7px 14px; }
.cm-how-total td { background: var(--blue-light, #eff6ff); }

.cm-narrative[contenteditable="true"] { cursor: text; }
.cm-narrative[contenteditable="true"]:hover { outline: 1px dashed var(--grey-300, #cbd5e1); outline-offset: 4px; }
.cm-narrative[contenteditable="true"]:focus { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 4px; }
.cm-edit-hint { font-size: .76rem; color: var(--text-muted); font-style: italic; margin: 6px 0 0; }
.cm-signoff {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px;
  margin-top: 28px; padding-top: 18px; border-top: 2px solid var(--grey-200);
}
.cm-sign-cell { display: flex; flex-direction: column; gap: 4px; }
.cm-sign-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--grey-500); font-weight: 700; }
.cm-sign-name { font-size: .95rem; font-weight: 600; color: var(--navy); border-bottom: 1px solid var(--grey-300, #cbd5e1); padding-bottom: 4px; }
.cm-sign-name[onclick] { cursor: pointer; }
.cm-sign-name[onclick]:hover { color: var(--blue); }

.cm-foot { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--grey-200); font-size: .78rem; color: var(--grey-500); line-height: 1.5; }

@media (max-width: 640px) { .cm-two { grid-template-columns: 1fr; } .cm-doc { padding: 20px; } }

/* Print: show only the memo */
@media print {
  .no-print, .site-header, .site-footer, .toast { display: none !important; }
  body { background: #fff; }
  .main-content { padding: 0; }
  .cm-doc { box-shadow: none; border: none; max-width: none; padding: 0; }
  .cm-narrative { background: #fff; }
  /* Closing checklist & tool pages */
  .results-actions, .ws-banner, .cre-step-chip,
  .cl-filter-bar, .cl-detail-toggle, .cl-detail-row { display: none !important; }
  .card, .cl-cat { box-shadow: none !important; border: 1px solid #ddd; break-inside: avoid; }
  .pc-status-select { border: none; background: transparent !important; appearance: none; -webkit-appearance: none; }
  .cm-grade-how, .cm-edit-hint { display: none !important; }
}

/* ══════════════════════════ DEAL INTAKE / SOURCES & USES ══ */
.dk-help { font-size: .85rem; color: var(--text-muted); margin: -4px 0 14px; }
.dk-col-title { font-family: 'Poppins', sans-serif; font-size: .9rem; color: var(--navy-light); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .04em; }

.dk-pie-wrap { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; padding: 8px 24px 22px; }
.dk-pie {
  width: 190px; height: 190px; border-radius: 50%; position: relative; flex: 0 0 auto;
  background: conic-gradient(var(--grey-300) 0% 100%);
}
.dk-pie::after { content: ''; position: absolute; inset: 27%; background: var(--white); border-radius: 50%; box-shadow: inset 0 0 0 1px var(--grey-200); }
.dk-legend { flex: 1; min-width: 220px; }
.dk-leg-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grey-100); }
.dk-leg-dot { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 auto; }
.dk-leg-label { flex: 1; font-size: .9rem; color: var(--navy); font-weight: 600; }
.dk-leg-val { font-size: .85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ══════════════════════════════ CLOSING CONDITIONS ══════ */
.cl-verdict { margin-top: 12px; padding: 11px 16px; border-radius: 8px; font-size: .92rem; }
.cl-ws-note { font-size: .85rem; color: var(--navy-light); background: var(--blue-light); border: 1px solid #dbeafe; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; line-height: 1.5; }
.cl-ws-note.muted { background: var(--grey-100); border-color: var(--grey-200); color: var(--text-muted); }
.cl-ws-note a { color: var(--blue); font-weight: 600; }
.cl-verdict.ready { background: var(--green-light); color: #15803d; }
.cl-verdict.open  { background: var(--orange-light); color: #92400e; }
.cl-cat { margin-bottom: 16px; }
.cl-cat-count { font-size: .85rem; color: var(--text-muted); font-weight: 600; }
.cl-table { width: 100%; border-collapse: collapse; }
.cl-row td { padding: 10px 12px; border-bottom: 1px solid var(--grey-200); font-size: .9rem; vertical-align: middle; }
.cl-row:last-child td { border-bottom: 0; }
.cl-check { width: 34px; text-align: center; font-weight: 700; color: var(--grey-300); font-size: 1.05rem; }
.cl-row.done .cl-check { color: var(--green); }
.cl-name { color: var(--text); }
.cl-status-cell { width: 170px; text-align: right; }
.pc-status-select.done    { background: var(--green-light);  color: #15803d; }
.pc-status-select.active  { background: var(--orange-light); color: #92400e; }
.pc-status-select.todo    { background: var(--grey-200);     color: var(--grey-700); }
.pc-status-select.waived  { background: var(--blue-light);   color: #1e40af; }

/* Closing — condition log (filter, meta chips, detail rows) */
.cl-filter-bar { display: flex; justify-content: flex-end; margin: 0 0 12px; }
.cl-filter { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; color: var(--navy); cursor: pointer; }
.cl-filter input { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.cl-filter-count { font-weight: 500; color: var(--text-muted); }

.cl-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cl-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 600; color: var(--grey-700);
  background: var(--grey-100); border-radius: 12px; padding: 2px 9px; max-width: 100%;
}
.cl-chip.auto    { background: var(--blue-light, #eff6ff); color: #1e40af; }
.cl-chip.overdue { background: var(--red-light, #fef2f2); color: #991b1b; }
.cl-chip.note    { color: var(--text-muted); font-weight: 500; }

.cl-detail-toggle { width: 44px; text-align: center; }
.cl-detail-btn {
  border: 1px solid var(--grey-200); background: var(--white); border-radius: 8px;
  padding: 4px 9px; cursor: pointer; font-size: .85rem; transition: all .15s ease;
}
.cl-detail-btn:hover, .cl-detail-btn.open { background: var(--blue-light); border-color: var(--blue); }

.cl-detail-row td { background: var(--grey-50, #f8fafc); border-bottom: 1px solid var(--grey-200); padding: 12px; }
.cl-detail-grid { display: grid; grid-template-columns: 200px 160px 1fr; gap: 14px; }
.cl-detail-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .76rem; font-weight: 600; color: var(--text-muted); }
.cl-detail-grid select, .cl-detail-grid input {
  padding: 7px 10px; border: 1px solid var(--grey-300, #d1d5db); border-radius: 8px;
  font-size: .85rem; font-family: inherit; background: var(--white);
}
@media (max-width: 760px) { .cl-detail-grid { grid-template-columns: 1fr; } }

/* ── Risk Flags ────────────────────────────────────────────── */
.risk-grid { display: flex; flex-direction: column; gap: 14px; }

.risk-card {
  border-radius: var(--radius);
  border: 2px solid;
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: transform var(--transition);
}
.risk-card:hover { transform: translateX(4px); }

.risk-card.HIGH   { border-color: var(--red);    background: #fff8f8; }
.risk-card.MEDIUM { border-color: var(--orange);  background: #fffdf8; }
.risk-card.LOW    { border-color: var(--green);   background: #f8fff9; }

.risk-sev-col { flex-shrink: 0; }

.sev-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.sev-badge.HIGH   { background: var(--red);    color: var(--white); }
.sev-badge.MEDIUM { background: var(--orange);  color: var(--white); }
.sev-badge.LOW    { background: var(--green);   color: var(--white); }

.risk-body {}
.risk-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}
.risk-explanation { font-size: .88rem; color: var(--text); line-height: 1.6; }

.risk-summary-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.risk-count-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 600;
}
.risk-count-pill.HIGH   { background: var(--red-light);    color: #991b1b; }
.risk-count-pill.MEDIUM { background: var(--orange-light); color: #92400e; }
.risk-count-pill.LOW    { background: var(--green-light);  color: #15803d; }

/* ── Missing Info ──────────────────────────────────────────── */
.missing-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: .9rem;
  color: var(--red);
  font-weight: 600;
}

.missing-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.missing-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: #fff8f8;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  font-size: .9rem;
}

.missing-num {
  background: var(--red);
  color: var(--white);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.missing-x {
  color: var(--red);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

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

/* ── Analyst Notes ─────────────────────────────────────────── */
.notes-box {
  background: var(--grey-100);
  border: 1px solid var(--grey-200);
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 24px;
}
.notes-heading {
  font-family: 'Poppins', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--blue);
  margin-bottom: 10px;
}
.notes-text {
  font-size: .92rem;
  line-height: 1.75;
  color: var(--text);
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  transition: all .3s ease;
  pointer-events: none;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--green); color: var(--white); }
.toast.error   { background: var(--red);   color: var(--white); }
.toast.info    { background: var(--navy);  color: var(--white); }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 20px 24px;
  font-size: .83rem;
  margin-top: auto;
}
.site-footer strong { color: var(--white); }
.footer-sub { margin-top: 4px; font-size: .78rem; opacity: .7; }
.footer-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.footer-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .82rem; font-weight: 600; color: rgba(255,255,255,.92);
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18);
  padding: 6px 14px; border-radius: 999px; text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.footer-btn:hover { background: rgba(255,255,255,.22); color: #fff; text-decoration: none; }
.footer-btn .li-in {
  background: #0a66c2; color: #fff; font-weight: 800; font-size: .68rem;
  border-radius: 3px; padding: 1px 4px; line-height: 1.2;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .key-terms-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .settings-content { flex-direction: column; gap: 16px; }
  .api-key-row { flex-direction: column; align-items: stretch; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .options-row { flex-direction: column; align-items: stretch; }
  .btn-group { flex-direction: column; }
  .select-group select { width: 100%; }
  .results-topbar { flex-direction: column; align-items: flex-start; }
  .data-table td:first-child { width: 140px; font-size: .82rem; }
  .tab-body { padding: 16px; }
  .drop-zone { min-height: 160px; }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .header-title  { font-size: 1.3rem; }
  .header-tagline { padding-left: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   PACKAGE MODE — New Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Mode Switch ─────────────────────────────────────────────── */
.mode-switch {
  display: flex;
  background: var(--grey-200);
  border-radius: var(--radius-lg);
  padding: 5px;
  gap: 4px;
  width: fit-content;
  margin: 0 auto 20px;
  box-shadow: var(--shadow-sm);
}
.mode-btn {
  padding: 9px 28px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  white-space: nowrap;
}
.mode-btn.active {
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.mode-btn:not(.active):hover { color: var(--text); }

/* ── Package Drop Zone ───────────────────────────────────────── */
.pkg-drop-zone {
  margin: 20px 28px 0;
  border: 2px dashed var(--grey-300);
  border-radius: var(--radius-lg);
  background: var(--grey-100);
  cursor: pointer;
  padding: 28px 20px;
  text-align: center;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pkg-drop-zone:hover, .pkg-drop-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
}
.pkg-drop-icon { font-size: 2.4rem; }
.pkg-drop-text { font-weight: 500; color: var(--navy); font-size: .95rem; }

/* ── Package File List ───────────────────────────────────────── */
.pkg-file-list {
  margin: 12px 28px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pkg-empty-state {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: .88rem;
  font-style: italic;
}
.pkg-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--grey-100);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}
.pkg-file-row:hover { border-color: var(--blue); }
.pkg-file-row.status-done { border-left: 3px solid var(--green); }
.pkg-file-row.status-error { border-left: 3px solid var(--red); }
.pkg-file-row.status-running { border-left: 3px solid var(--blue); }
.pkg-file-icon { font-size: 1.4rem; flex-shrink: 0; }
.pkg-file-info { flex: 1; min-width: 0; }
.pkg-file-name { display: block; font-weight: 500; font-size: .88rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pkg-file-sz   { font-size: .77rem; color: var(--text-muted); }
.pkg-doc-select {
  padding: 6px 28px 6px 10px;
  border: 1.5px solid var(--grey-300);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: .8rem;
  color: var(--text);
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M5 6L0 0h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  cursor: pointer;
  min-width: 200px;
  flex-shrink: 0;
}
.pkg-doc-select:focus { outline: none; border-color: var(--blue); }
.pkg-doc-type { display: flex; flex-direction: column; gap: 6px; min-width: 190px; }
.pkg-doc-type .pkg-doc-select { width: 100%; }
.pkg-doc-other {
  padding: 7px 10px; border: 1.5px solid var(--grey-300); border-radius: var(--radius);
  font-family: 'Inter', sans-serif; font-size: .8rem; color: var(--text); width: 100%;
}
.pkg-doc-other:focus { outline: none; border-color: var(--blue); }

.pkg-file-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.pkg-file-status.pending  { background: var(--grey-200); color: var(--text-muted); }
.pkg-file-status.running  { background: var(--blue-light); color: var(--blue-hover); }
.pkg-file-status.done     { background: var(--green-light); color: #15803d; }
.pkg-file-status.error    { background: var(--red-light); color: var(--red); }

.pkg-remove-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: .9rem; padding: 4px;
  border-radius: 4px; flex-shrink: 0; transition: color var(--transition);
}
.pkg-remove-btn:hover { color: var(--red); }

/* ── Package Action Row ──────────────────────────────────────── */
.pkg-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 28px 24px;
  flex-wrap: wrap;
}
.pkg-stats {
  font-size: .88rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Package Loading ─────────────────────────────────────────── */
.pkg-doc-status-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  max-width: 500px;
}
.pkg-doc-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: .85rem;
}
.pkg-doc-status-row.pending { color: var(--text-muted); }
.pkg-doc-status-row.running { background: var(--blue-light); color: var(--blue-hover); font-weight: 500; }
.pkg-doc-status-row.done    { background: var(--green-light); color: #15803d; }
.pkg-doc-status-row.error   { background: var(--red-light); color: var(--red); }
.pkg-status-icon { font-size: 1rem; flex-shrink: 0; }

/* ── Package Result Doc Tabs ─────────────────────────────────── */
.pkg-doc-tab { font-size: .8rem !important; padding: 12px 14px !important; }

/* ── Package Metrics ─────────────────────────────────────────── */
/* reuses .metrics-grid — nothing extra needed */

/* ── Doc Result Rendering ────────────────────────────────────── */
.doc-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.doc-result-header h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}
.doc-section-title {
  font-family: 'Poppins', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  color: var(--navy-light);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 20px 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--grey-200);
}
.score-badge {
  font-size: .8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}
.score-badge.good    { background: var(--green-light); color: #15803d; }
.score-badge.warn    { background: var(--orange-light); color: #92400e; }
.score-badge.bad     { background: var(--red-light); color: #991b1b; }
.score-badge.neutral { background: var(--blue-light); color: var(--blue-hover); }

.simple-list { padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.simple-list li { font-size: .9rem; color: var(--text); line-height: 1.5; }

/* ── Cross-Check Table ───────────────────────────────────────── */
.crosscheck-summary {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cc-pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 600;
}
.cc-pill.PASS    { background: var(--green-light); color: #15803d; }
.cc-pill.FAIL    { background: var(--red-light); color: #991b1b; }
.cc-pill.WARNING { background: var(--orange-light); color: #92400e; }
.cc-pill.INFO    { background: var(--blue-light); color: var(--blue-hover); }

.crosscheck-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.crosscheck-table thead tr { background: var(--navy); }
.crosscheck-table thead th {
  padding: 11px 14px;
  text-align: left;
  color: var(--white);
  font-family: 'Poppins', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.crosscheck-table tbody tr { border-bottom: 1px solid var(--grey-200); transition: background var(--transition); }
.crosscheck-table tbody tr:hover { background: var(--grey-100); }
.crosscheck-table tbody tr.PASS  td { background: #f0fdf4; }
.crosscheck-table tbody tr.FAIL  td { background: #fff5f5; }
.crosscheck-table td { padding: 10px 14px; vertical-align: top; line-height: 1.5; }
.crosscheck-table td:first-child { font-weight: 600; color: var(--navy-light); width: 220px; }

.cc-value-row { margin-bottom: 4px; }
.cc-doc-label {
  display: inline-block;
  background: var(--grey-200);
  color: var(--grey-700);
  font-size: .72rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  margin-right: 6px;
  white-space: nowrap;
}
.cc-value { font-size: .87rem; color: var(--text); }

.cc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.cc-status-badge.PASS    { background: var(--green-light); color: #15803d; }
.cc-status-badge.FAIL    { background: var(--red-light); color: #991b1b; }
.cc-status-badge.WARNING { background: var(--orange-light); color: #92400e; }
.cc-status-badge.INFO    { background: var(--blue-light); color: var(--blue-hover); }

/* ── Pre-Closing Checklist ───────────────────────────────────── */
.checklist-header {
  margin-bottom: 20px;
}
.checklist-progress-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.checklist-progress-info h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
}

.checklist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.checklist-table thead tr { background: var(--navy); }
.checklist-table thead th {
  padding: 11px 14px;
  text-align: left;
  color: var(--white);
  font-family: 'Poppins', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.checklist-table tbody tr { border-bottom: 1px solid var(--grey-200); }
.checklist-table tbody tr:nth-child(even) { background: var(--grey-100); }
.checklist-table tbody tr:hover { background: var(--blue-light); }
.checklist-table td { padding: 11px 14px; vertical-align: middle; }
.checklist-table td:first-child { color: var(--text-muted); width: 40px; text-align: center; }
.checklist-table td:nth-child(2) { font-weight: 500; color: var(--navy-light); }

.checklist-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.checklist-status.received { background: var(--green-light); color: #15803d; }
.checklist-status.issues   { background: var(--orange-light); color: #92400e; }
.checklist-status.missing  { background: var(--red-light); color: #991b1b; }
.checklist-status.clickable { cursor: pointer; transition: filter .15s ease, transform .15s ease; }
.checklist-status.clickable:hover { filter: brightness(.96); transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.checklist-status.clickable:focus-visible { outline: 2px solid var(--blue, #2563eb); outline-offset: 2px; }
.checklist-status .checklist-go { font-weight: 800; opacity: .6; margin-left: 1px; }
.checklist-status.clickable:hover .checklist-go { opacity: 1; }

/* Brief highlight when the checklist jumps you to a document's issues section */
.doc-section-flash {
  animation: docFlash 1.6s ease;
  border-radius: 6px;
}
@keyframes docFlash {
  0%, 100% { background: transparent; }
  15%, 55% { background: var(--orange-light, #fef3c7); }
}

/* ── Package Metrics ─────────────────────────────────────────── */
/* No extra needed — inherits .metrics-grid */

/* ── Responsive additions ────────────────────────────────────── */
@media (max-width: 768px) {
  .pkg-action-row { flex-direction: column; align-items: stretch; }
  .pkg-doc-select { min-width: 0; width: 100%; }
  .pkg-file-row { flex-wrap: wrap; }
  .mode-switch { width: 100%; }
  .mode-btn { flex: 1; text-align: center; }
  .crosscheck-table td:first-child { width: 130px; }
}

/* ═══════════════════════════════════════════════════════════════
   HEADER NAVIGATION
   ═══════════════════════════════════════════════════════════════ */

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.header-brand { margin-bottom: 0 !important; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 4px;
  backdrop-filter: blur(6px);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 500;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--white);
  background: rgba(255,255,255,.08);
  text-decoration: none;
}

.nav-link.active {
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

@media (max-width: 720px) {
  .header-top { flex-direction: column; align-items: flex-start; }
  .site-nav { width: 100%; justify-content: center; }
  .nav-link { font-size: .8rem; padding: 7px 11px; }
}

/* ═══════════════════════════════════════════════════════════════
   CASH FLOW PAGE
   ═══════════════════════════════════════════════════════════════ */

.cf-form-card { padding: 0; overflow: hidden; }

.cf-section {
  padding: 22px 28px;
  border-bottom: 1px solid var(--grey-200);
}
.cf-section:last-of-type { border-bottom: none; }

.cf-section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px;
}

.cf-field { display: flex; flex-direction: column; gap: 4px; }
.cf-field label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--grey-700);
  letter-spacing: .01em;
}
.cf-field input,
.cf-field select {
  font-family: 'Inter', sans-serif;
  font-size: .92rem;
  padding: 9px 12px;
  border: 1.5px solid var(--grey-300);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  transition: border var(--transition), box-shadow var(--transition);
}
.cf-field input:focus,
.cf-field select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.cf-field input.cf-error { border-color: var(--red); }

.cf-action-row {
  padding: 22px 28px;
  background: var(--grey-100);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Upload mode */
.cf-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.cf-upload-tile h3 {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--navy);
}
.drop-zone.small {
  padding: 22px 16px;
}
.drop-zone.small .drop-icon { font-size: 2.5rem; margin-bottom: 6px; }
.drop-zone.small .drop-headline { font-size: .9rem; }
.cf-extract-hint {
  margin-top: 12px;
  font-size: .85rem;
  color: var(--text-muted);
}

/* ── Waterfall ──────────────────────────────────────────────── */
.waterfall-card { padding-bottom: 24px; }

.cf-waterfall {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px 0;
}

.cf-wf-row {
  display: grid;
  grid-template-columns: 220px 1fr 140px;
  align-items: center;
  gap: 14px;
}

.cf-wf-label {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
}
.cf-wf-label.total { font-weight: 700; color: var(--navy); }
.cf-wf-label.indent { padding-left: 14px; color: var(--text-muted); font-size: .85rem; }

.cf-wf-bar-track {
  position: relative;
  height: 26px;
  background: var(--grey-100);
  border-radius: 6px;
  overflow: hidden;
}
.cf-wf-bar {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 6px;
  transition: width .6s ease;
}
.cf-wf-bar.income   { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.cf-wf-bar.expense  { background: linear-gradient(90deg, #f87171, #dc2626); }
.cf-wf-bar.noi      { background: linear-gradient(90deg, #34d399, #16a34a); }
.cf-wf-bar.cashpos  { background: linear-gradient(90deg, #16a34a, #15803d); }
.cf-wf-bar.cashneg  { background: linear-gradient(90deg, #dc2626, #991b1b); }

.cf-wf-value {
  font-family: 'Inter', monospace;
  text-align: right;
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
}
.cf-wf-value.total { color: var(--navy); font-size: 1rem; }
.cf-wf-value.neg   { color: var(--red); }

/* ── Detail Table ────────────────────────────────────────────── */
.cf-detail-table,
.cf-loan-table,
.cf-amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.cf-detail-table th,
.cf-loan-table th,
.cf-amort-table th {
  background: var(--navy);
  color: var(--white);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.cf-detail-table th.num,
.cf-loan-table th.num,
.cf-amort-table th.num { text-align: right; }

.cf-detail-table td,
.cf-loan-table td,
.cf-amort-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--grey-200);
}
.cf-detail-table td.num,
.cf-loan-table td.num,
.cf-amort-table td.num {
  text-align: right;
  font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
}

.cf-detail-table tr.section-row td {
  background: var(--grey-100);
  font-weight: 700;
  color: var(--navy);
}
.cf-detail-table tr.total-row td {
  background: var(--blue-light);
  font-weight: 700;
  color: var(--navy);
  border-top: 2px solid var(--blue);
}
.cf-detail-table tr.noi-row td {
  background: var(--green-light);
  font-weight: 700;
  color: #15803d;
  border-top: 2px solid var(--green);
}
.cf-detail-table tr.highlight td { background: #fff7ed; }
.cf-noi-note { font-weight: 500; font-size: .82em; opacity: .8; }

.cf-loan-table td:first-child { font-weight: 500; }

.cf-amort-table tr.year-summary td {
  background: var(--blue-light);
  font-weight: 700;
  color: var(--navy);
}

/* ── Sensitivity ────────────────────────────────────────────── */
.cf-sensitivity-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 20px 24px;
}

.cf-sens-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 10px;
}

.cf-sens-note {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.45;
  font-style: italic;
}

.cf-sens-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.cf-sens-table th,
.cf-sens-table td {
  padding: 10px 12px;
  text-align: center;
  border: 1px solid var(--grey-200);
  font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
}
.cf-sens-table th {
  background: var(--navy-light);
  color: var(--white);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.cf-sens-table th:first-child {
  background: var(--navy);
  text-align: left;
}
.cf-sens-table td:first-child {
  background: var(--grey-100);
  font-weight: 600;
  text-align: left;
  color: var(--text);
}

.cf-sens-cell.good   { background: var(--green-light); color: #15803d; font-weight: 700; }
.cf-sens-cell.warn   { background: var(--orange-light); color: #92400e; font-weight: 700; }
.cf-sens-cell.bad    { background: var(--red-light); color: #991b1b; font-weight: 700; }

/* Metrics card extra colour for cf */
.metric-card.bad { border-top-color: var(--red); }
.metric-card.warn { border-top-color: var(--orange); }
.metric-card.good { border-top-color: var(--green); }

.btn-sm { padding: 6px 14px !important; font-size: .82rem !important; }

@media (max-width: 768px) {
  .cf-wf-row { grid-template-columns: 130px 1fr 90px; gap: 8px; }
  .cf-wf-label.indent { padding-left: 8px; }
  .cf-section { padding: 18px 18px; }
  .cf-action-row { padding: 18px; }
}

/* ═══════════════════════════════════════════════════════════════
   LOAN SIZING PAGE
   ═══════════════════════════════════════════════════════════════ */

.ls-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--grey-200);
}
.ls-two-col .ls-col {
  border-bottom: none;
}
.ls-two-col .ls-col:first-child {
  border-right: 1px solid var(--grey-200);
}
.cf-grid.one-col {
  grid-template-columns: 1fr;
}

@media (max-width: 820px) {
  .ls-two-col { grid-template-columns: 1fr; }
  .ls-two-col .ls-col:first-child {
    border-right: none;
    border-bottom: 1px solid var(--grey-200);
  }
}

/* ── Sliders ──────────────────────────────────────────────── */
.ls-slider-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.ls-slider-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  align-items: center;
  gap: 16px;
}
.ls-slider-row > label {
  font-size: .9rem;
  font-weight: 500;
  color: var(--grey-700);
}
.ls-slider-row input[type=range] {
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue) var(--ls-fill, 50%), var(--grey-300) var(--ls-fill, 50%), var(--grey-300) 100%);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
.ls-slider-row input[type=range]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--white);
  border: 3px solid var(--blue);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
  transition: transform var(--transition);
}
.ls-slider-row input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.ls-slider-row input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--white);
  border: 3px solid var(--blue);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.ls-slider-val {
  font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
  padding: 6px 10px;
  background: var(--blue-light);
  border-radius: 8px;
}

@media (max-width: 720px) {
  .ls-slider-row { grid-template-columns: 1fr; gap: 6px; }
  .ls-slider-val { text-align: left; width: max-content; }
}

/* ── Binding hero ─────────────────────────────────────────── */
.ls-hero {
  margin-bottom: 24px;
  padding: 28px 32px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #0f3460 100%);
  color: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 26px;
}
.ls-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 50%, rgba(34,197,94,.15) 0%, transparent 50%),
              radial-gradient(circle at 80% 50%, rgba(37,99,235,.15) 0%, transparent 50%);
  pointer-events: none;
}
.ls-hero-icon {
  font-size: 3.5rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.3));
  z-index: 1;
}
.ls-hero-body {
  flex: 1;
  z-index: 1;
}
.ls-hero-label {
  font-size: .85rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
  margin-bottom: 4px;
}
.ls-hero-amount {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 6px;
  text-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.ls-hero-binding {
  font-size: .95rem;
  color: rgba(255,255,255,.85);
}
.ls-hero-binding strong { color: var(--white); }

@media (max-width: 720px) {
  .ls-hero { flex-direction: column; text-align: center; padding: 22px; }
}

/* ── 3 Constraint Cards ──────────────────────────────────── */
.ls-constraints-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.ls-constraint-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 2px solid transparent;
  position: relative;
  transition: transform var(--transition);
}
.ls-constraint-card:hover { transform: translateY(-2px); }

.ls-cc-header {
  padding: 14px 18px;
  color: var(--white);
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ls-cc-header.ltv  { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.ls-cc-header.dscr { background: linear-gradient(135deg, #16a34a, #15803d); }
.ls-cc-header.dy   { background: linear-gradient(135deg, #d97706, #b45309); }

.ls-cc-body {
  padding: 22px 20px 24px;
}

.ls-cc-amount {
  font-family: 'Poppins', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 10px;
  letter-spacing: -.01em;
}

.ls-cc-formula {
  background: var(--grey-100);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: 'Inter', monospace;
  font-size: .82rem;
  color: var(--text);
  line-height: 1.6;
  border-left: 3px solid var(--grey-300);
}
.ls-cc-header.ltv  + .ls-cc-body .ls-cc-formula { border-left-color: var(--blue); }
.ls-cc-header.dscr + .ls-cc-body .ls-cc-formula { border-left-color: var(--green); }
.ls-cc-header.dy   + .ls-cc-body .ls-cc-formula { border-left-color: var(--orange); }

.ls-constraint-card.binding {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(22,163,74,.15), 0 10px 24px rgba(22,163,74,.25);
  animation: lsBindingPulse 2.4s ease-in-out infinite;
}
@keyframes lsBindingPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(22,163,74,.15), 0 10px 24px rgba(22,163,74,.25); }
  50%      { box-shadow: 0 0 0 6px rgba(22,163,74,.28), 0 12px 32px rgba(22,163,74,.4); }
}
.ls-binding-star {
  position: absolute;
  top: 10px; right: 12px;
  font-size: 1.6rem;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}

/* ── Comparison Chart ───────────────────────────────────── */
.ls-compare-chart {
  padding: 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ls-cmp-row {
  display: grid;
  grid-template-columns: 180px 1fr 170px;
  align-items: center;
  gap: 14px;
}

.ls-cmp-label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}
.ls-cmp-track {
  position: relative;
  height: 30px;
  background: var(--grey-100);
  border-radius: 8px;
  overflow: hidden;
}
.ls-cmp-bar {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 8px;
  transition: width .8s ease;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}
.ls-cmp-bar.binding {
  background: linear-gradient(90deg, #dc2626, #b91c1c);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.ls-cmp-bar.actual {
  background: linear-gradient(90deg, #6b7280, #4b5563);
}
.ls-cmp-value {
  font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: .95rem;
  font-weight: 700;
  color: var(--navy);
}
.ls-cmp-tag {
  display: inline-block;
  font-size: .7rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  background: var(--red);
  color: var(--white);
  font-weight: 700;
  letter-spacing: .05em;
}

@media (max-width: 768px) {
  .ls-cmp-row { grid-template-columns: 120px 1fr 110px; gap: 8px; }
}

/* ── Requested vs Max ───────────────────────────────────── */
.ls-req-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px 24px 0;
}
.ls-req-tile {
  background: var(--grey-100);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-align: center;
}
.ls-req-tile .l { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.ls-req-tile .v { font-family: 'Poppins',sans-serif; font-size: 1.4rem; font-weight: 700; color: var(--navy); }

.ls-verdict {
  margin: 20px 24px;
  padding: 16px 22px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .03em;
  text-align: center;
}
.ls-verdict.approved {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: var(--white);
}
.ls-verdict.declined {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: var(--white);
}
.ls-verdict.conditional {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: var(--white);
}

.ls-check-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
  margin: 8px 0 16px;
}
.ls-check-table th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.ls-check-table th.num { text-align: right; }
.ls-check-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--grey-200);
}
.ls-check-table td.num {
  text-align: right;
  font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
}
.ls-check-table td.pass { color: #15803d; font-weight: 700; }
.ls-check-table td.fail { color: #991b1b; font-weight: 700; }

@media (max-width: 720px) {
  .ls-req-summary { grid-template-columns: 1fr; }
}

/* ── Loan Sizing: added inputs & output sections ─────────────── */
.ls-hint { font-weight: 400; font-size: .8em; color: var(--grey-500, #6b7280); }
.cf-check-field { display: flex; align-items: center; }
.ls-check { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; cursor: pointer; }
.ls-check input { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
.ls-preset-field { max-width: 460px; margin-bottom: 14px; }

/* Warning callouts */
.ls-warn-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.ls-warn {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .92rem; font-weight: 500; line-height: 1.45;
  border-left: 5px solid;
}
.ls-warn-ico { flex-shrink: 0; font-size: 1.05rem; }
.ls-warn.danger { background: var(--red-light, #fef2f2);    border-color: #dc2626; color: #991b1b; }
.ls-warn.warn   { background: var(--orange-light, #fffbeb); border-color: #d97706; color: #92400e; }
.ls-warn.info   { background: var(--blue-light, #eff6ff);   border-color: #2563eb; color: #1e40af; }

/* Per-unit / DY-compare / exit tile grid */
.ls-unit-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px; padding: 8px 24px 20px;
}
.ls-unit-tile {
  background: var(--grey-50, #f8fafc); border: 1px solid var(--grey-200, #e5e7eb);
  border-radius: 12px; padding: 14px 16px; text-align: center;
}
.ls-unit-tile .l { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--grey-500, #6b7280); font-weight: 600; }
.ls-unit-tile .v { font-size: 1.3rem; font-weight: 800; color: var(--navy, #1e293b); margin-top: 4px; font-variant-numeric: tabular-nums; }
.ls-unit-tile .s { font-size: .82rem; color: var(--grey-500, #6b7280); margin-top: 2px; }
.ls-unit-tile.good { background: #f0fdf4; border-color: #bbf7d0; }
.ls-unit-tile.good .v { color: #15803d; }
.ls-unit-tile.bad  { background: #fef2f2; border-color: #fecaca; }
.ls-unit-tile.bad .v { color: #991b1b; }
.ls-exit-note { color: var(--grey-500, #6b7280); font-size: .9rem; font-style: italic; }

/* Combined stress matrix — emphasise the row-header column */
.ls-stress-table th:first-child,
.ls-stress-table td:first-child { font-weight: 700; background: var(--grey-50, #f8fafc); text-align: left; }

/* ── App-wide analyst helpers ────────────────────────────────── */
/* Pipeline step chip in the page header */
.cre-step-chip {
  display: inline-block; margin-left: 12px; padding: 2px 12px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  border-radius: 20px; font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.cre-step-chip a { color: #93c5fd; text-decoration: none; }
.cre-step-chip a:hover { text-decoration: underline; }
@media (max-width: 640px) { .cre-step-chip { display: block; margin: 6px 0 0; width: fit-content; } }

/* Glossary term — dotted underline + help cursor; native title tooltip */
.cre-term { text-decoration: underline dotted rgba(100,116,139,.55); text-underline-offset: 3px; cursor: help; }
th.cre-term { text-decoration-color: rgba(255,255,255,.5); }

/* Doc-type "confirm this" flag on package rows */
.pkg-type-flag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  background: var(--orange-light, #fffbeb); color: #92400e;
  font-size: .72rem; font-weight: 800; cursor: help;
}
.pkg-retry-btn {
  background: var(--blue-light, #eff6ff); color: var(--blue);
  border: none; border-radius: 8px; padding: 4px 10px; font-size: .8rem;
  font-weight: 700; cursor: pointer;
}
.pkg-retry-btn:hover { background: var(--blue); color: #fff; }

/* Guided tour widget */
.cre-tour {
  position: fixed; right: 18px; bottom: 18px; z-index: 1000;
  width: min(360px, calc(100vw - 36px));
  background: var(--white); border: 1px solid var(--grey-200);
  border-top: 4px solid #f59e0b; border-radius: 14px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .22);
  padding: 14px 16px; animation: wsBannerSlide .3s ease;
}
.cre-tour-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: var(--navy); font-size: .95rem; }
.cre-tour-count { font-size: .75rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.cre-tour-body { font-size: .86rem; line-height: 1.55; color: var(--text); margin: 8px 0 12px; }
.cre-tour-body a { color: var(--blue); font-weight: 600; }
.cre-tour-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.cre-tour-target {
  outline: 3px solid #f59e0b !important; outline-offset: 5px; border-radius: 10px;
  animation: creTourPulse 1.6s ease-in-out infinite;
}
@keyframes creTourPulse {
  0%, 100% { outline-color: #f59e0b; }
  50%      { outline-color: rgba(245, 158, 11, .35); }
}
@media print { .cre-tour, .cre-tour-target { display: none !important; outline: none !important; } }

/* "What an analyst does here" card */
.cre-analyst-card {
  margin-bottom: 18px; border: 1px solid var(--grey-200); border-left: 4px solid #7c3aed;
  border-radius: 12px; background: var(--white);
}
.cre-analyst-card summary {
  cursor: pointer; padding: 11px 16px; font-weight: 600; font-size: .9rem; color: var(--navy);
}
.cre-analyst-card[open] summary { border-bottom: 1px solid var(--grey-200); }
.cre-analyst-card ul { margin: 0; padding: 12px 16px 14px 34px; }
.cre-analyst-card li { font-size: .88rem; line-height: 1.6; color: var(--text); }

/* Field flash when AI extraction updates a value */
.cf-flash { animation: cfFieldFlash 1.6s ease; }
@keyframes cfFieldFlash {
  0%, 100% { background: transparent; }
  20%, 60% { background: #fef3c7; }
}

/* Document-completeness note linking to the Closing page */
.checklist-note {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 8px;
  background: var(--blue-light, #eff6ff); color: #1e40af; font-size: .85rem; line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   WORKSPACE BANNER (cross-page auto-fill)
   ═══════════════════════════════════════════════════════════════ */

.ws-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 20px;
  margin-bottom: 22px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1.5px solid var(--blue);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(37,99,235,.08);
  animation: wsBannerSlide .35s ease;
}

@keyframes wsBannerSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ws-icon {
  font-size: 1.9rem;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(37,99,235,.25));
}

.ws-text {
  flex: 1;
  font-size: .92rem;
  color: var(--text);
  line-height: 1.45;
}
.ws-text strong { color: var(--navy); font-size: 1rem; display: block; margin-bottom: 2px; }
.ws-text .ws-detail { color: var(--text-muted); font-size: .85rem; }

.ws-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.ws-actions .btn-sm {
  padding: 7px 14px !important;
  font-size: .85rem !important;
}

@media (max-width: 720px) {
  .ws-banner { flex-direction: column; align-items: stretch; text-align: center; }
  .ws-actions { justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════
   POST-CLOSING TRACKER
   ═══════════════════════════════════════════════════════════════ */

.pc-container { max-width: 1320px; }

/* ── Overdue alert ──────────────────────────────────────── */
.pc-overdue-alert {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-left: 5px solid var(--red);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 18px;
  color: #7f1d1d;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: pcPulseSoft 2s ease-in-out infinite;
}
@keyframes pcPulseSoft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.0); }
  50%      { box-shadow: 0 0 0 4px rgba(220,38,38,.15); }
}
.pc-overdue-alert .icon { font-size: 1.4rem; }

/* ── Stacked progress bar (overall) ─────────────────────── */
.pc-overall-progress { padding-bottom: 18px; margin-bottom: 22px; }
.pc-progress-count {
  font-family: 'Inter',monospace;
  font-variant-numeric: tabular-nums;
  font-size: .92rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--grey-100);
  padding: 4px 12px;
  border-radius: 999px;
}
.pc-stack-bar {
  display: flex;
  height: 24px;
  border-radius: 999px;
  overflow: hidden;
  margin: 0 24px;
  background: var(--grey-200);
}
.pc-stack-seg {
  height: 100%;
  transition: width .6s ease;
}
.pc-stack-seg.verified { background: linear-gradient(90deg, #15803d, #16a34a); }
.pc-stack-seg.received { background: linear-gradient(90deg, #34d399, #6ee7b7); }
.pc-stack-seg.pending  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.pc-stack-seg.overdue  { background: linear-gradient(90deg, #b91c1c, #dc2626); }

.pc-stack-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 24px 0;
  font-size: .82rem;
  color: var(--text-muted);
}
.pc-stack-legend .dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.pc-stack-legend .dot.verified { background: #15803d; }
.pc-stack-legend .dot.received { background: #34d399; }
.pc-stack-legend .dot.pending  { background: #f59e0b; }
.pc-stack-legend .dot.overdue  { background: #dc2626; }

/* ── 2-column body grid ─────────────────────────────────── */
.pc-body-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 22px;
  align-items: start;
}
.pc-side-col { position: sticky; top: 80px; }
@media (max-width: 1100px) {
  .pc-body-grid { grid-template-columns: 1fr; }
  .pc-side-col { position: static; }
}

/* ── Category card ──────────────────────────────────────── */
.pc-cat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.pc-cat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #0f3460 100%);
  color: var(--white);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.pc-cat-header:hover { filter: brightness(1.1); }

.pc-cat-chevron {
  font-size: .9rem;
  transition: transform var(--transition);
  width: 14px;
  display: inline-block;
  text-align: center;
}
.pc-cat-card.collapsed .pc-cat-chevron { transform: rotate(-90deg); }
.pc-cat-card.collapsed .pc-cat-body { display: none; }

.pc-cat-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .02em;
  flex: 1;
}
.pc-cat-count {
  font-size: .8rem;
  font-weight: 500;
  background: rgba(255,255,255,.15);
  padding: 3px 10px;
  border-radius: 999px;
}
.pc-cat-mini-bar {
  width: 140px;
  height: 6px;
  background: rgba(255,255,255,.15);
  border-radius: 999px;
  overflow: hidden;
}
.pc-cat-mini-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #34d399, #16a34a);
  transition: width .5s ease;
}

.pc-cat-body { padding: 0; }

/* ── Item rows ──────────────────────────────────────────── */
.pc-item-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.pc-item-table thead th {
  background: var(--grey-100);
  color: var(--grey-700);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--grey-300);
  position: sticky;
  top: 0;
  z-index: 1;
}
.pc-item-table thead th.num { text-align: center; width: 50px; }
.pc-item-table thead th.due { width: 110px; }
.pc-item-table thead th.rcv { width: 110px; }
.pc-item-table thead th.days { width: 110px; text-align: center; }

.pc-item-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--grey-200);
  vertical-align: top;
}
.pc-item-table tbody tr:hover { background: var(--grey-100); }
.pc-item-table tbody tr.row-verified { background: #f0fdf4; }
.pc-item-table tbody tr.row-received { background: #f7fee7; }
.pc-item-table tbody tr.row-overdue  { background: #fef2f2; }
.pc-item-table tbody tr.row-waived   { background: #fffbeb; }
.pc-item-table tbody tr.row-na       { background: var(--white); }
.pc-item-table tbody tr.row-na td.name { text-decoration: line-through; color: var(--text-muted); }

.pc-item-table td.num { text-align: center; font-weight: 600; color: var(--text-muted); }
.pc-item-table td.name strong { color: var(--navy); display: block; margin-bottom: 4px; }
.pc-item-table td.name .note { font-size: .78rem; color: var(--text-muted); line-height: 1.4; }
.pc-expiry-field { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .76rem; color: var(--text-muted); }
.pc-expiry-field label { white-space: nowrap; }
.pc-expiry-field input { padding: 3px 6px; font-size: .78rem; border: 1px solid var(--grey-300, #d1d5db); border-radius: 6px; }

.pc-item-table input,
.pc-item-table select {
  font-family: 'Inter', sans-serif;
  font-size: .85rem;
  padding: 6px 8px;
  border: 1px solid var(--grey-300);
  border-radius: 6px;
  background: var(--white);
  color: var(--text);
  width: 100%;
}
.pc-item-table input:focus,
.pc-item-table select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}

/* Status select colour by value */
.pc-status-select.not-started { background: var(--grey-100); color: var(--text); }
.pc-status-select.requested   { background: #dbeafe; color: #1e40af; font-weight: 600; }
.pc-status-select.received    { background: #d4edda; color: #15803d; font-weight: 600; }
.pc-status-select.verified    { background: #15803d; color: var(--white); font-weight: 700; }
.pc-status-select.waived      { background: #fef3c7; color: #92400e; font-weight: 600; }
.pc-status-select.na          { background: var(--white); color: var(--text-muted); text-decoration: line-through; }

.pc-days-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
  font-weight: 700;
}
.pc-days-pill.good     { background: var(--green-light); color: #15803d; }
.pc-days-pill.warn     { background: var(--orange-light); color: #92400e; }
.pc-days-pill.bad      { background: var(--red-light); color: #991b1b; }
.pc-days-pill.complete { background: var(--grey-200); color: var(--grey-700); }

/* ── Timeline view ──────────────────────────────────────── */
.pc-timeline {
  position: relative;
  margin: 30px 28px 50px;
  height: 220px;
}
.pc-timeline-axis {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--grey-300) 50%, var(--red) 100%);
  border-radius: 3px;
}
.pc-tl-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}
.pc-tl-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 3px solid var(--white);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  cursor: pointer;
  transition: transform var(--transition);
}
.pc-tl-marker:hover .pc-tl-dot { transform: scale(1.4); }
.pc-tl-dot.verified { background: #15803d; }
.pc-tl-dot.received { background: #34d399; }
.pc-tl-dot.pending  { background: #f59e0b; }
.pc-tl-dot.overdue  { background: #dc2626; animation: pcDotPulse 1.6s ease-in-out infinite; }
@keyframes pcDotPulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(0,0,0,.25), 0 0 0 0 rgba(220,38,38,.5); }
  50%      { box-shadow: 0 2px 6px rgba(0,0,0,.25), 0 0 0 8px rgba(220,38,38,0); }
}
.pc-tl-label {
  position: absolute;
  bottom: calc(50% + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: var(--white);
  font-size: .68rem;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.pc-tl-marker:nth-child(odd) .pc-tl-label {
  bottom: auto;
  top: calc(50% + 20px);
}
.pc-tl-marker:hover .pc-tl-label { opacity: 1; }

.pc-tl-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pc-tl-tick {
  position: absolute;
  top: calc(50% - 14px);
  width: 1px;
  height: 12px;
  background: var(--grey-300);
}
.pc-tl-tick-label {
  position: absolute;
  top: calc(50% - 32px);
  transform: translateX(-50%);
  font-size: .7rem;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.pc-tl-today {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--blue);
  z-index: 1;
}
.pc-tl-today::before {
  content: 'Today';
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--blue);
  color: var(--white);
  font-size: .68rem;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Notifications side panel ───────────────────────────── */
.pc-notif-card { padding-bottom: 12px; }
.pc-notif-section {
  padding: 14px 18px;
  border-bottom: 1px solid var(--grey-200);
}
.pc-notif-section:last-child { border-bottom: none; }

.pc-notif-section h3 {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pc-notif-section.today    h3 { color: #92400e; }
.pc-notif-section.week     h3 { color: #1e40af; }
.pc-notif-section.overdue  h3 { color: #991b1b; }
.pc-notif-section.renewals h3 { color: #92400e; }

.pc-notif-section .count-pill {
  background: var(--grey-100);
  color: var(--grey-700);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  margin-left: auto;
}
.pc-notif-section.today    .count-pill { background: var(--orange-light); color: #92400e; }
.pc-notif-section.week     .count-pill { background: #dbeafe; color: #1e40af; }
.pc-notif-section.overdue  .count-pill { background: var(--red-light); color: #991b1b; }
.pc-notif-section.renewals .count-pill { background: var(--orange-light); color: #92400e; }

.pc-notif-item {
  font-size: .82rem;
  padding: 6px 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  line-height: 1.4;
  border-bottom: 1px dashed var(--grey-200);
}
.pc-notif-item:last-child { border-bottom: none; }
.pc-notif-item .meta { color: var(--text-muted); font-size: .74rem; flex-shrink: 0; }
.pc-notif-empty { font-size: .82rem; color: var(--text-muted); font-style: italic; }

/* ── Print styles ───────────────────────────────────────── */
@media print {
  body { background: white; font-size: 11pt; }
  .no-print, .toast { display: none !important; }
  .pc-body-grid { grid-template-columns: 1fr; }
  .pc-cat-card { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
  .pc-cat-card.collapsed .pc-cat-body { display: block; }
  .pc-cat-header { background: #1a1a2e !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pc-item-table input,
  .pc-item-table select {
    border: none;
    background: transparent !important;
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    color: black !important;
  }
  .metric-card { box-shadow: none; border: 1px solid #ccc; }
}

