/* Scribed editorial application system. Canonical brand values: lib/document-brand.js. */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Source+Serif+4:opsz,wght@8..60,500;8..60,600;8..60,700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Surfaces */
  --ink: #333333;
  --paper: #F7FBF8;
  --paper-2: #FBFCFB;
  --fog: #F7FBF8;
  --rule: #DDDDDD;
  --mute: #777777;
  --white: #FFFFFF;
  /* Mirrored from lib/document-brand.js for browser CSS. */
  --brand: #39B14A;
  --brand-dark: #2D8E3C;
  --brand-light: #EDF8EF;
  --brand-cyan: #46C5DF;
  --brand-cyan-tint: #EAF8FC;
  --green-soft: #EDF8EF;
  --success: #39B14A;
  --accent-amber: #B86E00;
  /* Semantic */
  --red: #B42318;
  --amber: #9A6700;
  --amber-light: #FEF3C7;
  --red-light: #FFE4E6;
  /* Greys (slate scale) */
  --grey-50: #FBFCFB;
  --grey-100: #F7FBF8;
  --grey-200: #DDDDDD;
  --grey-300: #CCCCCC;
  --grey-500: #777777;
  --grey-700: #555555;
  --grey-900: #333333;
  /* Shape & type */
  --radius: 8px;
  --radius-sm: 4px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 2px 8px rgba(31, 31, 31, 0.06);
  --shadow-lg: 0 6px 18px rgba(31, 31, 31, 0.10);
  --font-serif: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 200ms;
  --sidebar-w: 260px;
  --sidebar-bg: #FFFFFF;
  --sidebar-bg-2: #FFFFFF;
  --sidebar-text: #555555;
  --sidebar-text-active: #1F1F1F;
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10000;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--grey-900);
  background: var(--paper-2);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

/* Focus — always visible */
:focus-visible {
  outline: 3px solid rgba(57, 177, 74, 0.42);
  outline-offset: 2px;
}

a, button, .btn, .client-card, .filter-chip, .wf-step, .cc-more {
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--rule);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
  box-shadow: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 26px 22px 22px;
  border-bottom: 1px solid var(--rule);
}
.sidebar-brand .logo-mark {
  display: block;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  filter: none;
}

.sidebar-brand .logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink);
  text-transform: none;
}

.sidebar-brand .logo-text .logo-s {
  border-bottom: 2px solid var(--brand);
  padding-bottom: 1px;
  color: var(--brand);
}

.sidebar-nav { flex: 1; padding: 18px 10px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 2px 0;
  color: var(--sidebar-text);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
  border-left: none;
  border-radius: var(--radius-sm);
  min-height: 44px;
}

.sidebar-nav a:hover {
  background: var(--fog);
  color: var(--ink);
}

.sidebar-nav a.active {
  background: var(--brand-light);
  color: var(--sidebar-text-active);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand);
}

.sidebar-footer {
  padding: 16px 20px 22px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: #64748B;
}

.sidebar-footer a {
  color: #94A3B8;
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-footer a:hover { color: var(--brand-dark); }

#user-name { color: var(--grey-700); }

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 32px 40px 48px;
  max-width: 1180px;
}

/* ── Eyebrow label ── */
.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

/* ── Typography ── */
h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--grey-900);
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--grey-900);
  letter-spacing: 0;
}

.subtitle {
  font-size: 14px;
  color: var(--mute);
  margin-bottom: 24px;
  font-weight: 400;
}

/* ── Cards ── */
.card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--grey-300);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.review-panel > summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  list-style: none;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}
.review-panel > summary::-webkit-details-marker { display: none; }
.review-panel > summary::after {
  content: '+';
  margin-left: auto;
  font-family: var(--font-body);
  color: var(--brand-dark);
}
.review-panel[open] > summary::after { content: '\2212'; }
.review-panel > summary small {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--mute);
}
.review-panel-body {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.review-panel-inset {
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--fog);
}
.review-panel-inset > summary { font-size: 14px; font-family: var(--font-body); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

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

.btn-secondary {
  background: var(--white);
  color: var(--grey-700);
  border: 1px solid var(--rule);
}
.btn-secondary:hover { background: var(--fog); border-color: var(--grey-500); }

.btn-success {
  background: var(--brand);
  color: white;
}
.btn-success:hover { background: var(--brand-dark); }

.btn-danger {
  background: var(--red);
  color: white;
}
.btn-danger:hover { opacity: 0.9; }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
  margin-bottom: 5px;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--white);
  color: var(--grey-900);
  transition: border 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(57, 177, 74, 0.12);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Client grid ── */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.client-card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px 24px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.client-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.client-card:hover {
  border-color: rgba(57, 177, 74, 0.45);
  box-shadow: var(--shadow-md);
  transform: none;
}
.client-card:hover::before { opacity: 1; }

.client-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--grey-900);
}

.client-card .meta {
  font-size: 13px;
  color: var(--mute);
}

.client-card .stats {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--grey-700);
}

.client-card .stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Upload area ── */
.upload-area {
  border: 2px dashed var(--rule);
  border-radius: var(--radius);
  padding: 44px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--fog);
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--brand);
  background: var(--brand-light);
}

.upload-area strong {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--grey-900);
}

.upload-area p {
  font-size: 14px;
  color: var(--mute);
  margin-top: 8px;
}

/* ── File list ── */
.file-list { list-style: none; }

.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--fog);
  font-size: 14px;
}

.file-list li:last-child { border-bottom: none; }

.file-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.file-badge.pdf { background: var(--red-light); color: var(--red); }
.file-badge.image { background: var(--fog); color: var(--grey-700); }
.file-badge.docx { background: var(--green-soft); color: var(--brand-dark); }

/* ── Status / alerts ── */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-success { background: var(--green-soft); color: var(--brand-dark); }
.alert-error { background: var(--red-light); color: var(--red); }
.alert-info { background: var(--brand-light); color: var(--brand-dark); }

.generating {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--brand-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--brand-dark);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--brand-light);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Login page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--paper);
}

.login-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 44px;
  width: 420px;
  border: 1px solid var(--rule);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}

.login-brand .logo-mark { display: none; }

.login-brand .logo-text {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--grey-900);
  text-transform: none;
}

.login-brand .logo-text .logo-s {
  border-bottom: 2px solid var(--brand);
  padding-bottom: 1px;
}

.login-box .subtitle {
  text-align: center;
  margin-bottom: 32px;
}

.login-box .btn { width: 100%; justify-content: center; }

.login-box .footer-link {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--mute);
}

.login-box .footer-link a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}

.login-box .footer-link a:hover { text-decoration: underline; }

/* ── Structure form ── */
.form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B70' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-group select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(57, 177, 74, 0.12);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Borrower rows */
.borrower-row input:focus, .borrower-row select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(57, 177, 74, 0.12);
}

/* Tranche table */
.tranche-table-header {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--fog);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tranche-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-top: none;
  align-items: center;
  transition: all 0.15s;
  background: var(--white);
}

.tranche-row:last-child {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.tranche-row:hover {
  background: var(--fog);
}

.tranche-row input, .tranche-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
}

.tranche-row input:focus, .tranche-row select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(57, 177, 74, 0.12);
}

.tranche-remove {
  background: none;
  border: none;
  color: var(--mute);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
}

.tranche-remove:hover {
  color: var(--red);
  background: var(--red-light);
}

/* Disclosure sections */
.disclosure-section {
  margin-bottom: 20px;
}

.disclosure-label {
  display: block;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--grey-900);
  margin-bottom: 8px;
}

.disclosure-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  line-height: 1.6;
  resize: vertical;
  background: var(--white);
  color: var(--grey-900);
}

.disclosure-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(57, 177, 74, 0.12);
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ── Confirmed badge ── */
.badge-confirmed {
  background: var(--brand-light);
  color: var(--brand-dark);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Commission display ── */
.commission-bar {
  background: var(--fog);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.commission-bar .amount {
  font-size: 14px;
  color: var(--brand-dark);
  font-weight: 600;
}

.commission-bar .detail {
  font-size: 12px;
  color: var(--mute);
}

/* ── Totals bar ── */
.totals-bar {
  display: flex;
  justify-content: flex-end;
  gap: 28px;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  margin-top: 10px;
  font-size: 14px;
}

.totals-bar .label { color: var(--mute); }
.totals-bar strong { color: var(--brand-dark); }

/* ── Mobile hamburger ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  z-index: 20;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--grey-900);
  border-radius: 2px;
  transition: all 0.3s;
}

.mobile-header .logo-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--grey-900);
}

.mobile-header .logo-text .logo-s {
  border-bottom: 2px solid var(--brand);
  padding-bottom: 1px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 25;
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-overlay.active {
  opacity: 1;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 30;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding: 72px 16px 24px;
  }

  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: 1fr; }

  .card { padding: 18px 16px; }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  h1 { font-size: 24px; }

  .upload-area { padding: 28px 16px; }

  .totals-bar {
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
  }

  .tranche-table-header { display: none; }

  .tranche-row {
    flex-direction: column;
    gap: 10px;
    padding: 14px;
  }

  .tranche-row input, .tranche-row select {
    font-size: 14px;
  }

  .login-box {
    width: 100%;
    margin: 16px;
    padding: 28px 20px;
  }

  .commission-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* Better touch targets */
  .btn { padding: 12px 20px; min-height: 44px; }
  .file-list li { padding: 14px 16px; }

  .ea-glance { grid-template-columns: 1fr !important; }
  .ea-metric { padding: 12px !important; }

  /* Prevent iOS zoom on input focus */
  input, select, textarea { font-size: 16px !important; }

  /* Smooth scrolling for iOS */
  .main { -webkit-overflow-scrolling: touch; }
}

/* =====================================================================
   Income & Expense Analysis
   ===================================================================== */

.ea-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px; gap: 12px;
}
@media (max-width: 600px) { .ea-header { flex-direction: column; } }

.ea-coverage-notice {
  margin-top: 6px; font-size: 13px; color: var(--grey-700);
  display: flex; align-items: center; gap: 6px;
}
.ea-coverage-notice .dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.ea-coverage-notice .dot.green { background: var(--brand); }
.ea-coverage-notice .dot.amber { background: var(--amber); }

/* Layer 1: Glance metrics */
.ea-glance {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 12px;
}
.ea-metric {
  background: var(--fog); border-radius: var(--radius-sm);
  padding: 16px; text-align: center;
}
.ea-metric-value {
  font-size: 24px; font-weight: 700; color: var(--grey-900);
}
.ea-metric-value.green { color: var(--brand); }
.ea-metric-value.red { color: var(--red); }
.ea-metric-label {
  font-size: 11px; color: var(--mute); margin-top: 2px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* Status line */
.ea-status-line {
  font-size: 13px; color: var(--grey-700); padding: 10px 0;
  border-bottom: 1px solid var(--fog); margin-bottom: 4px;
}

/* Layer 2: Collapsible sections */
.ea-section {
  border-bottom: 1px solid var(--fog);
}
.ea-section:last-child { border-bottom: none; }
.ea-section-header {
  display: flex; align-items: center; gap: 8px; padding: 14px 0;
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--grey-900);
  user-select: none; transition: color 0.15s;
}
.ea-section-header:hover { color: var(--brand); }
.ea-section-toggle {
  margin-left: auto; font-size: 13px; color: var(--mute);
  transition: transform 0.2s;
}
.ea-section-toggle.open { transform: rotate(90deg); }
.ea-section-meta {
  font-size: 12px; font-weight: 500; color: var(--mute);
  margin-left: auto; margin-right: 8px;
}
.ea-section-body {
  padding: 0 0 16px;
}
.ea-section-body .ea-glance .ea-metric-value { font-size: 18px; }
.ea-section-body .ea-glance .ea-metric { padding: 10px; }

/* Income & expense tables inside sections */
.ea-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.ea-table th {
  text-align: left; padding: 8px 12px; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--mute); border-bottom: 1px solid var(--rule);
  font-weight: 500;
}
.ea-table th.right { text-align: right; }
.ea-table td {
  padding: 7px 12px; border-bottom: 1px solid var(--fog);
  color: var(--grey-700);
}
.ea-table td.right { text-align: right; }
.ea-table td.bold { font-weight: 600; color: var(--grey-900); }
.ea-table tr.total-row {
  background: var(--fog);
}
.ea-table tr.total-row td {
  font-weight: 600; font-size: 12px; border-bottom: none;
}
.ea-table .tier-label {
  padding: 10px 12px; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--brand-dark); background: var(--brand-light);
  border-bottom: 1px solid var(--rule);
}

/* Review items (flags, notes) */
.ea-review-item {
  padding: 10px 14px; border-radius: var(--radius-sm);
  margin-bottom: 6px; font-size: 13px; color: var(--grey-700);
  background: var(--fog); display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--rule);
}
.ea-review-item .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--amber); flex-shrink: 0; margin-top: 6px;
}
.ea-review-item.note .dot { background: var(--mute); }

/* Document checklist (inside section) */
.dc-progress-ring {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding: 12px 16px;
  background: var(--fog); border-radius: var(--radius-sm);
}
.dc-ring-visual {
  width: 52px; height: 52px; position: relative; flex-shrink: 0;
}
.dc-ring-visual svg { transform: rotate(-90deg); }
.dc-ring-visual .ring-bg { stroke: var(--rule); }
.dc-ring-visual .ring-fill { transition: stroke-dashoffset 0.5s ease, stroke 0.3s; }
.dc-ring-text {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 700; color: var(--grey-900);
}
.dc-ring-label { font-size: 13px; color: var(--grey-700); }
.dc-ring-label strong { font-weight: 600; }

.dc-checklist { list-style: none; }
.dc-checklist-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--fog);
  transition: opacity 0.3s, background 0.3s;
}
.dc-checklist-item:last-child { border-bottom: none; }
.dc-checklist-item input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer; flex-shrink: 0;
  margin-top: 2px; accent-color: var(--brand);
}
.dc-checklist-item .dc-item-label {
  font-size: 13px; font-weight: 500; color: var(--grey-900);
}
.dc-checklist-item .dc-item-desc {
  font-size: 12px; color: var(--mute); margin-top: 1px;
}
.dc-checklist-item.checked .dc-item-label { color: var(--mute); text-decoration: line-through; }
.dc-checklist-item.checked .dc-item-desc { color: var(--rule); }
.dc-cat-label {
  font-size: 11px; font-weight: 500; color: var(--mute);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 12px 0 4px;
}
.dc-provided-toggle {
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  padding: 8px 0; font-size: 13px; font-weight: 500; color: var(--brand);
  user-select: none;
}

/* Summary */
.ea-summary {
  margin-top: 12px; padding: 12px 16px; background: var(--fog);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--grey-700);
}

/* =====================================================================
   Dashboard — Search/Filter bar
   ===================================================================== */
.dash-filters {
  display: flex; gap: 10px; margin-bottom: 20px; align-items: center;
}
.search-input {
  flex: 1; padding: 9px 14px 9px 36px; border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm); font-size: 13px; background: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B6B70' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center;
  font-family: var(--font-body);
}
.search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(57, 177, 74, 0.12); }
.filter-chip {
  padding: 8px 14px; border: 1px solid var(--grey-200); border-radius: 20px;
  font-size: 12px; color: var(--grey-500); cursor: pointer; background: var(--white);
  font-family: var(--font-body); font-weight: 500; transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--grey-300); }
.filter-chip.active { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

/* ── Improved client cards ── */
.client-card .cc-top {
  display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px;
}
.client-card .cc-name {
  font-size: 15px; font-weight: 600; color: var(--grey-900);
}
.client-card .cc-date { font-size: 12px; color: var(--mute); }
.client-card .cc-more {
  width: 28px; height: 28px; border-radius: 6px; border: none; background: none;
  cursor: pointer; font-size: 18px; color: var(--mute); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; position: relative;
}
.client-card .cc-more:hover { background: var(--fog); }

.cc-menu {
  position: absolute; top: 100%; right: 0; z-index: 10;
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1); min-width: 140px; display: none;
  overflow: hidden;
}
.cc-menu.open { display: block; }
.cc-menu button {
  display: block; width: 100%; text-align: left; padding: 9px 14px;
  font-size: 13px; border: none; background: none; cursor: pointer;
  font-family: var(--font-body); color: var(--grey-700);
}
.cc-menu button:hover { background: var(--fog); }
.cc-menu button.danger { color: var(--red); }
.cc-menu button.danger:hover { background: var(--red-light); }

.client-card .cc-meta {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.client-card .cc-sub { font-size: 13px; color: var(--mute); margin-top: 3px; }
.client-card .cc-foot {
  display: flex; justify-content: space-between; align-items: center; margin-top: 16px;
}
.cc-pill {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px;
  font-family: var(--font-body); display: inline-block;
}
.cc-pill.lender { background: var(--fog); color: var(--grey-700); }
.cc-pill.type { background: var(--fog); color: var(--grey-700); }
.cc-pill.status-draft { background: var(--grey-100); color: var(--grey-500); }
.cc-pill.status-progress { background: var(--fog); color: var(--grey-700); }
.cc-pill.status-submitted { background: var(--brand-light); color: var(--brand-dark); }
.cc-pill.status-settled { background: var(--green-soft); color: var(--brand-dark); }

.client-card .cc-progress {
  display: flex; align-items: center; gap: 6px;
}
.cc-step {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--grey-200); transition: all 0.2s;
}
.cc-step.done { background: var(--brand); }
.cc-step.current { background: var(--white); border: 2px solid var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.cc-progress-label { font-size: 12px; color: var(--mute); margin-left: 4px; }

.client-card .cc-bottom {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--grey-100);
  font-size: 12px; color: var(--mute);
}
.client-card .cc-bottom strong { color: var(--grey-700); font-weight: 600; }

/* Primary path — single “what’s next” strip */
.next-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--white);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius, 10px);
  padding: 14px 18px;
  margin: 0 0 20px;
}
.next-action-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.next-action-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-dark);
}
.next-action-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--grey-900);
}
.next-action-detail {
  font-size: 13px;
  color: var(--mute);
  line-height: 1.4;
}
.next-action-ctas { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 700px) {
  .next-action-bar { flex-direction: column; align-items: stretch; }
  .next-action-ctas .btn { width: 100%; }
}

/* =====================================================================
   Workspace — Visual Stepper
   ===================================================================== */
.workflow-stepper {
  display: flex; align-items: center; padding: 20px 24px;
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius);
  margin-bottom: 24px; overflow-x: auto;
}
.wf-step { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.wf-step:last-child { flex: 0; }
.wf-step-circle {
  width: 32px; height: 32px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
  flex-shrink: 0; transition: all 0.2s;
}
.wf-step-circle.done { background: var(--brand); color: white; }
.wf-step-circle.current { background: var(--white); border: 2.5px solid var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-light); }
.wf-step-circle.upcoming { background: var(--grey-100); color: var(--grey-500); border: 1.5px solid var(--grey-300); }
.wf-step-info { white-space: nowrap; }
.wf-step-label { font-size: 12px; font-weight: 500; }
.wf-step-label.done { color: var(--brand-dark); }
.wf-step-label.current { color: var(--grey-900); font-weight: 600; }
.wf-step-label.upcoming { color: var(--mute); }
.wf-step-hint { font-size: 11px; color: var(--mute); display: block; }
.wf-step-line {
  flex: 1; height: 2px; margin: 0 6px; border-radius: 1px; min-width: 20px;
}
.wf-step-line.done { background: var(--brand); }
.wf-step-line.upcoming { background: var(--grey-200); }

/* =====================================================================
   Review items — resolve buttons + count badges
   ===================================================================== */
.review-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.review-counts { display: flex; gap: 8px; }
.review-count {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px;
}
.review-count.critical { background: var(--red-light); color: var(--red); }
.review-count.warning { background: var(--amber-light); color: var(--amber); }
.review-count.resolved { background: var(--green-soft); color: var(--brand-dark); }

.ea-review-item .ri-resolve {
  padding: 4px 10px; font-size: 11px; font-weight: 600; border-radius: 4px;
  border: 1px solid var(--grey-200); background: var(--white); color: var(--grey-500);
  cursor: pointer; white-space: nowrap; margin-left: auto; flex-shrink: 0;
  transition: all 0.15s;
}
.ea-review-item .ri-resolve:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.ea-review-item.resolved { opacity: 0.5; border-color: var(--green-soft); }
.ea-review-item .ri-resolved-badge {
  padding: 4px 10px; font-size: 11px; font-weight: 600; border-radius: 4px;
  background: var(--green-soft); color: var(--brand-dark); white-space: nowrap;
  margin-left: auto; flex-shrink: 0;
}

/* =====================================================================
   Generation — Progress stages + Skeleton
   ===================================================================== */
.gen-stages { margin-top: 16px; }
.gen-stage { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.gs-icon {
  width: 24px; height: 24px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0;
}
.gs-icon.done { background: var(--green-soft); color: var(--brand-dark); }
.gs-icon.active { background: var(--brand); color: white; animation: gen-pulse 1.5s ease-in-out infinite; }
.gs-icon.pending { background: var(--grey-100); color: var(--grey-500); }
@keyframes gen-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(57,177,74,0.28); } 50% { box-shadow: 0 0 0 6px rgba(57,177,74,0); } }
.gs-label { font-size: 13px; color: var(--grey-700); }
.gs-label.done { color: var(--mute); }
.gs-label.active { font-weight: 600; color: var(--grey-900); }
.gs-time { margin-left: auto; font-size: 12px; color: var(--mute); }

.gen-skeleton {
  background: var(--fog); border-radius: var(--radius-sm);
  padding: 20px; margin-top: 16px;
}
.skel-line {
  height: 10px; background: var(--grey-200); border-radius: 5px;
  margin-bottom: 8px; animation: shimmer 1.5s ease-in-out infinite;
}
.skel-line:nth-child(1) { width: 60%; }
.skel-line:nth-child(2) { width: 90%; }
.skel-line:nth-child(3) { width: 75%; }
.skel-line:nth-child(4) { width: 85%; animation-delay: 0.2s; }
.skel-line:nth-child(5) { width: 40%; animation-delay: 0.4s; }
@keyframes shimmer { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

@media (max-width: 768px) {
  .dash-filters { flex-wrap: wrap; }
  .search-input { min-width: 100%; }
  .workflow-stepper { padding: 14px 16px; overflow-x: hidden; }
  .wf-step-info { display: none; }
  .wf-step-line { min-width: 8px; margin: 0 2px; }
}

/* Editorial alignment with the product brief. */
h1 {
  font-size: 26px;
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  line-height: 1.2;
}
h2 { font-family: var(--font-serif); font-size: 17px; font-weight: 600; letter-spacing: 0; color: var(--ink); }
.subtitle { color: var(--mute); font-size: 14.5px; }

.card {
  background: var(--white);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: none;
  transition: border-color var(--dur) var(--ease);
}
.card:hover {
  border-color: var(--grey-300);
  box-shadow: none;
}

.btn {
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform 120ms var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: none;
}
.btn-primary:hover {
  background: var(--brand-dark);
  filter: none;
  box-shadow: none;
}
.btn-secondary {
  background: #fff;
  border: 1.5px solid var(--rule);
  color: var(--grey-700);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  border-color: #94A3B8;
  color: var(--ink);
  background: var(--fog);
}
.btn-success {
  background: var(--success);
  color: #fff;
}

.form-group label { font-weight: 600; color: var(--grey-700); }
.form-group input,
.form-group textarea,
.form-group select {
  min-height: 44px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(57, 177, 74, 0.16);
}

.client-card {
  box-shadow: none;
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
}
.client-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.client-card:hover {
  transform: none;
  box-shadow: none;
  border-color: rgba(57, 177, 74, 0.45);
}
.client-card:hover::before { opacity: 1; }

.cc-pill.status-progress {
  background: var(--brand-cyan-tint);
  color: #245B66;
}
.cc-pill.status-submitted {
  background: var(--brand-light);
  color: var(--brand-dark);
}
.cc-pill.status-settled {
  background: var(--green-soft);
  color: #047857;
}
.cc-step.done { background: var(--brand); }
.cc-step.current {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.filter-chip {
  border-radius: var(--radius-pill);
  min-height: 36px;
  transition: all var(--dur) var(--ease);
}
.filter-chip.active {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
  box-shadow: none;
}

.next-action-bar {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--brand-light);
  box-shadow: none;
  border-left: 4px solid var(--brand);
}
.next-action-eyebrow { color: var(--brand-dark); }

.workflow-stepper {
  box-shadow: none;
  border: 1px solid var(--rule);
  background: var(--white);
}
.wf-step-circle.done {
  background: var(--brand);
}
.wf-step-circle.current {
  border-color: var(--brand);
  color: var(--brand-dark);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.wf-step-circle.upcoming { border-color: var(--grey-300); }

.login-page {
  background: var(--paper);
}
.login-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--rule);
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
}
.login-brand .logo-text {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 28px;
  color: var(--ink);
}
.login-brand .logo-s {
  border-bottom: 3px solid var(--brand);
  color: var(--brand);
}
.login-box .subtitle { color: var(--mute); margin-bottom: 24px; }
.login-box .btn-primary { width: 100%; justify-content: center; }

.upload-area {
  border: 2px dashed var(--grey-300);
  background: var(--white);
  border-radius: var(--radius);
  transition: all var(--dur) var(--ease);
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--brand);
  background: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(57, 177, 74, 0.12);
}

.alert {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.alert-success { background: var(--green-soft); color: #065F46; border-color: #A7F3D0; }
.alert-error { background: var(--red-light); color: #9F1239; border-color: #FECDD3; }
.alert-info { background: var(--brand-cyan-tint); color: #245B66; border-color: #B9E7F0; }

.review-count.critical { background: var(--red-light); color: #BE123C; }
.review-count.warning { background: var(--amber-light); color: #B45309; }
.review-count.resolved { background: var(--green-soft); color: #047857; }

#retention-strip {
  background: var(--brand-light) !important;
  border: 1px solid var(--rule) !important;
  box-shadow: none;
  border-radius: var(--radius) !important;
}

.mobile-header {
  background: var(--white) !important;
  color: var(--ink) !important;
  border-bottom: 1px solid var(--rule);
}
.mobile-header .logo-text { color: var(--ink) !important; }
.mobile-header .logo-s { border-color: var(--brand) !important; color: var(--brand) !important; }

/* Bank cards colour identity */
.bank-card { box-shadow: none; border-radius: var(--radius) !important; }
.btn-calculate {
  background: var(--brand) !important;
  border-radius: var(--radius-sm) !important;
  min-height: 48px;
  box-shadow: none;
}

/* Restrained generation status pulse. */
@keyframes gen-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(57, 177, 74, 0.28); }
  50% { box-shadow: 0 0 0 6px rgba(57, 177, 74, 0); }
}

/* Client policy intelligence tool */
.lendo-toggle {
  position: fixed;
  right: 82px;
  bottom: 18px;
  z-index: 998;
  min-width: 78px;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid var(--brand-dark);
  border-radius: 6px;
  background: var(--brand-dark);
  color: #fff;
  font: 600 13px var(--font-body);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
  cursor: pointer;
}
.lendo-toggle:hover { background: #115E59; }
.lendo-toggle:focus-visible { outline: 3px solid rgba(56, 189, 248, .45); outline-offset: 2px; }
.lendo-panel {
  position: fixed;
  right: 18px;
  bottom: 70px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  width: min(460px, calc(100vw - 36px));
  height: min(680px, calc(100vh - 100px));
  overflow: hidden;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 52px rgba(15, 23, 42, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.lendo-panel.open { opacity: 1; visibility: visible; transform: translateY(0); }
body.lendo-open #feedback-fab { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }
.lendo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 10px 14px;
  border-bottom: 1px solid #E2E8F0;
  background: #0F172A;
  color: #F8FAFC;
}
.lendo-header strong { display: block; font-size: 14px; }
.lendo-header span { display: block; margin-top: 1px; color: #94A3B8; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.lendo-icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #CBD5E1;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.lendo-icon-button:hover { background: rgba(255,255,255,.08); color: #fff; }
.lendo-status {
  min-height: 34px;
  padding: 8px 14px;
  border-bottom: 1px solid #E2E8F0;
  background: #F8FAFC;
  color: #475569;
  font-size: 11px;
}
.lendo-status.warning { background: #FFFBEB; color: #92400E; }
.lendo-controls { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid #E2E8F0; }
.lendo-controls label { color: #64748B; font-size: 11px; font-weight: 600; }
.lendo-controls select { width: 100%; padding: 7px 9px; border: 1px solid #CBD5E1; border-radius: 5px; background: #fff; color: #1E293B; font: 12px var(--font-body); }
.lendo-messages { flex: 1; min-height: 210px; overflow-y: auto; padding: 0 14px; background: #fff; }
.lendo-empty { padding: 28px 12px; color: #64748B; text-align: center; font-size: 12px; }
.lendo-message { padding: 14px 0; border-bottom: 1px solid #E2E8F0; }
.lendo-message:last-child { border-bottom: 0; }
.lendo-message.adviser { margin: 10px 0; padding: 10px 12px; border: 0; border-left: 3px solid var(--brand-cyan); background: var(--brand-cyan-tint); }
.lendo-message-label { margin-bottom: 5px; color: var(--brand-dark); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.lendo-message.adviser .lendo-message-label { color: #0369A1; }
.lendo-message p { margin: 0; color: #334155; font-size: 13px; line-height: 1.55; }
.lendo-answer-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.lendo-result, .lendo-confidence { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.lendo-result.eligible, .lendo-result.information { background: #D1FAE5; color: #065F46; }
.lendo-result.conditional { background: #FEF3C7; color: #92400E; }
.lendo-result.ineligible { background: #FEE2E2; color: #991B1B; }
.lendo-result.unclear { background: #E2E8F0; color: #334155; }
.lendo-confidence { background: #F1F5F9; color: #64748B; font-weight: 600; }
.lendo-summary { color: #0F172A !important; font-weight: 550; }
.lendo-citation-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.lendo-citation { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 6px; border: 1px solid #BAE6FD; border-radius: 4px; background: #F0F9FF; color: #0369A1; font-size: 10px; font-weight: 700; text-decoration: none; }
.lendo-citation:hover { border-color: #0284C7; }
.lendo-warning { margin-top: 9px; padding: 8px 10px; border-left: 3px solid #F59E0B; background: #FFFBEB; color: #92400E; font-size: 11px; line-height: 1.45; }
.lendo-warning p { color: inherit; font-size: inherit; }
.lendo-findings { margin-top: 12px; border-top: 1px solid #E2E8F0; }
.lendo-finding { padding: 10px 0; border-bottom: 1px solid #E2E8F0; }
.lendo-finding-status { margin-bottom: 4px; color: #64748B; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.lendo-finding.support .lendo-finding-status { color: #047857; }
.lendo-finding.concern .lendo-finding-status, .lendo-finding.conflict .lendo-finding-status { color: #B91C1C; }
.lendo-finding.condition .lendo-finding-status { color: #B45309; }
.lendo-answer-list { margin-top: 12px; color: #334155; font-size: 12px; }
.lendo-answer-list strong { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.lendo-answer-list ul { margin: 6px 0 0; padding-left: 18px; }
.lendo-answer-list li { margin-bottom: 4px; line-height: 1.45; }
.lendo-answer-list.muted { color: #64748B; }
.lendo-sources { margin-top: 12px; border-top: 1px solid #E2E8F0; padding-top: 9px; }
.lendo-sources summary { color: #475569; font-size: 11px; font-weight: 700; cursor: pointer; }
.lendo-source { padding: 9px 0; border-bottom: 1px solid #E2E8F0; }
.lendo-source:last-child { border-bottom: 0; }
.lendo-source > .lendo-citation { display: inline; padding: 0; border: 0; background: transparent; font-size: 11px; }
.lendo-source-meta { margin-top: 3px; color: #64748B; font-size: 10px; }
.lendo-source blockquote { max-height: 110px; overflow: auto; margin: 7px 0 0; padding: 7px 9px; border-left: 2px solid #CBD5E1; background: #F8FAFC; color: #475569; font-size: 10px; line-height: 1.45; }
.lendo-form { border-top: 1px solid #CBD5E1; background: #F8FAFC; padding: 10px 12px; }
.lendo-form textarea { display: block; width: 100%; resize: vertical; min-height: 62px; max-height: 130px; padding: 9px 10px; border: 1px solid #CBD5E1; border-radius: 5px; background: #fff; color: #0F172A; font: 13px/1.4 var(--font-body); }
.lendo-form textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(57,177,74,.12); }
.lendo-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.lendo-form-footer span { color: #64748B; font-size: 10px; }
.lendo-form-footer .btn { min-width: 62px; justify-content: center; }

@media (max-width: 620px) {
  .lendo-toggle { right: 16px; bottom: 76px; }
  #feedback-fab { right: 16px !important; bottom: 16px !important; }
  .lendo-panel { inset: 8px; width: auto; height: auto; max-height: none; }
  .lendo-panel.open { transform: none; }
}
