/* ClariFund - Modern B2B Fintech Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Premium Light Fintech Palette (Stripe/Linear/Brex aesthetic) */
  --bg-app: #F8FAFC;          /* Clean canvas */
  --bg-sidebar: #FFFFFF;      /* Crisp white sidebar */
  --bg-header: rgba(255, 255, 255, 0.88); /* Frosted glass header */
  --bg-card: #FFFFFF;         /* Pure white cards */
  --bg-card-hover: #F1F5F9;   /* Subtle slate hover */
  --bg-card-inner: #F8FAFC;   /* Soft slate inner containers */
  --bg-elevated: #EEF2F6;     /* Elevated chip/pill background */

  --border-subtle: #E2E8F0;   /* Light gray/slate border */
  --border-medium: #CBD5E1;   /* Medium border for controls */
  --border-accent: #0284C7;   /* Vibrant blue focus/accent */

  --primary: #0284C7;         /* Azure blue */
  --primary-hover: #0369A1;
  --primary-glow: rgba(2, 132, 199, 0.15);
  --primary-gradient: linear-gradient(135deg, #0284C7 0%, #2563EB 100%);
  --blue-accent: #2563EB;
  --indigo-accent: #4F46E5;

  --success: #059669;         /* Rich emerald */
  --success-bg: rgba(5, 150, 105, 0.08);
  --success-border: rgba(5, 150, 105, 0.25);

  --warning: #D97706;         /* Warm amber */
  --warning-bg: rgba(217, 119, 6, 0.08);
  --warning-border: rgba(217, 119, 6, 0.25);

  --danger: #DC2626;          /* Crimson */
  --danger-bg: rgba(220, 38, 38, 0.08);
  --danger-border: rgba(220, 38, 38, 0.25);

  --text-primary: #0F172A;     /* Deep slate text */
  --text-secondary: #475569;   /* Slate body text */
  --text-muted: #64748B;       /* Captions / labels */
  --text-highlight: #0284C7;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Layout Hierarchy */
.app-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-app);
}

/* Persistent Sidebar */
.app-sidebar {
  width: 290px;
  flex-shrink: 0;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  overflow: hidden;
}

.sidebar-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #0F172A 0%, #0284C7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtext {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.sidebar-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 4px;
}

/* Progressive Disclosure Nav Items */
.step-nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  list-style: none;
}

.step-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  position: relative;
  user-select: none;
  outline: none;
}

.step-nav-item:focus,
.step-nav-item:focus-visible {
  outline: none;
  box-shadow: none;
}

.step-nav-item:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-subtle);
}

.step-nav-item.active {
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.08) 0%, rgba(37, 99, 235, 0.04) 100%);
  border-color: rgba(2, 132, 199, 0.3);
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.06);
}

.step-nav-item.active .step-pill {
  background: var(--primary-gradient);
  color: #FFFFFF;
  font-weight: 700;
  border-color: var(--primary);
}

.step-pill {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-medium);
  transition: all 0.2s;
}

.step-pill.completed {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: #FFFFFF !important;
}

.step-pill.declined {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #FFFFFF !important;
}

.step-nav-text {
  flex: 1;
  min-width: 0;
}

.step-nav-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.step-nav-sub {
  font-size: 0.67rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sidebar-validity-box {
  background: #F8FAFC;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.validity-timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.validity-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--warning);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.validity-badge.frozen {
  color: var(--primary);
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.3);
}

.validity-text {
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Sidebar Footer / Role Profile */
.sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-subtle);
  background-color: #FFFFFF;
}

.borrower-mini-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.profile-company {
  font-size: 0.67rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-app);
}

/* Sticky App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  height: 68px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breadcrumbs .current {
  color: var(--text-primary);
  font-weight: 600;
}

.loan-id-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.clariguide-btn {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(79, 70, 229, 0.08) 100%);
  border: 1px solid rgba(2, 132, 199, 0.3);
  color: var(--primary);
  padding: 7px 16px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.1);
}

.clariguide-btn:hover {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.14) 0%, rgba(79, 70, 229, 0.14) 100%);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.18);
  transform: translateY(-1px);
}

/* Header Sandbox Badge & Reset Button */
.sandbox-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.25);
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
  white-space: nowrap;
}

.sandbox-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--primary);
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.6);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.btn-reset-demo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-reset-demo:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px;
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 95;
  animation: fadeIn 0.2s ease-out;
}

/* Main Screen Container */
.screen-content {
  flex: 1;
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: fadeIn 0.2s ease-out;
}

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

/* Card Common Styles */
.clarifund-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

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

.card-title-group h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.card-title-group p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Metric Highlight Grid */
.metrics-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-card {
  background-color: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s;
}

.metric-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
}

.metric-card.highlight {
  border-color: rgba(2, 132, 199, 0.35);
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.06) 0%, rgba(37, 99, 235, 0.02) 100%);
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 6px 0 2px 0;
  font-family: var(--font-sans);
  letter-spacing: -0.5px;
}

.metric-value.cyan {
  color: var(--primary);
}

.metric-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--danger-bg);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Progressive Navigation Bar at bottom of screen */
.progressive-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 12px;
}

/* Donut Chart and Ledger Styles (CostBreakdown) */
.cost-breakdown-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: stretch;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
}

.ledger-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.ledger-table th:last-child {
  text-align: right;
}

.ledger-table td {
  padding: 12px 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.ledger-table td:last-child {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.ledger-table tr:last-child td {
  border-bottom: none;
}

.ledger-table tr.total-row td {
  font-weight: 700;
  font-size: 0.95rem;
  background-color: rgba(2, 132, 199, 0.03);
  border-top: 2px solid var(--border-medium);
}

/* Chart Canvas & SVG Donut */
.donut-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  position: relative;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card-inner);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

/* Amortization Table */
.amortization-container {
  max-height: 480px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card-inner);
}

.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.amort-table th {
  position: sticky;
  top: 0;
  background-color: #F1F5F9;
  padding: 10px 14px;
  text-align: right;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-subtle);
  z-index: 10;
  white-space: nowrap;
  font-size: 0.74rem;
  letter-spacing: 0.5px;
}

.amort-table th:first-child,
.amort-table th:nth-child(2) {
  text-align: left;
}

.amort-table td {
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  white-space: nowrap;
}

.amort-table td:first-child,
.amort-table td:nth-child(2) {
  text-align: left;
  font-family: var(--font-sans);
}

.amort-table tr:hover td {
  background-color: rgba(2, 132, 199, 0.05);
}

/* Key Obligations Accordion/Cards */
.obligations-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.obligation-card {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s;
}

.obligation-card:hover {
  border-color: var(--border-medium);
}

.obligation-card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background-color: transparent;
}

.obligation-card-header:hover {
  background-color: rgba(15, 23, 42, 0.02);
}

.obligation-title-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.obligation-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.badge-critical {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.badge-high {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-moderate {
  background: rgba(37, 99, 235, 0.08);
  color: #2563EB;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.obligation-card-body {
  padding: 18px 20px;
  border-top: 1px solid var(--border-subtle);
  background: #FFFFFF;
  font-size: 0.85rem;
}

/* Clause Pill Selector Bar */
.clause-pill-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 2px 0 6px 0;
}

/* Agreement Split-Screen Viewer */
.split-viewer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  min-height: 520px;
  align-items: stretch;
}

.split-viewer-pane {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.pane-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #F1F5F9;
}

.pane-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(2, 132, 199, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.pane-content {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  line-height: 1.6;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
}

.legal-raw-text {
  font-family: Georgia, 'Times New Roman', serif;
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-line;
  background: #F8FAFC;
  padding: 16px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  border-top: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

/* Checklist for KFS Acknowledgment */
.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.check-item:hover {
  border-color: var(--border-medium);
}

.check-item.checked {
  background: rgba(16, 185, 129, 0.05);
  border-color: var(--success-border);
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.2s;
}

.check-item.checked .checkbox-custom {
  background: var(--success);
  border-color: var(--success);
  color: #FFFFFF;
}

.check-text-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.check-text-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Auditable Hash Stamp */
.audit-stamp-box {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.08) 0%, rgba(248, 250, 252, 0.95) 100%);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hash-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--success);
  background: rgba(5, 150, 105, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  word-break: break-all;
}

/* ClariGuide Floating Drawer Modal */
.clariguide-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.2s ease-out;
}

.clariguide-drawer {
  width: 460px;
  max-width: 90vw;
  height: 100vh;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(15, 23, 42, 0.15);
  animation: slideLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideLeft {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trust-badge-pill {
  font-size: 0.68rem;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid var(--success-border);
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-color: #F8FAFC;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 90%;
}

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
}

.chat-message.user .chat-bubble {
  background: var(--primary-gradient);
  color: #FFFFFF;
  font-weight: 500;
  border-bottom-right-radius: 2px;
}

.chat-message.assistant .chat-bubble {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
  box-shadow: var(--shadow-sm);
}

.chat-citation-box {
  font-size: 0.72rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(2, 132, 199, 0.08);
  border-radius: var(--radius-sm);
  width: fit-content;
  border: 1px solid rgba(2, 132, 199, 0.25);
}

.chat-abstain-box {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  font-size: 0.78rem;
}

.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  background: #FFFFFF;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input-row input {
  flex: 1;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
}

.chat-input-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.suggested-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.chip-btn {
  font-size: 0.72rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chip-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(0, 229, 255, 0.08);
}

/* Status Badges */
.badge-pill {
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-approved {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* Responsive utilities */
@media (max-width: 1024px) {
  .app-sidebar {
    width: 260px;
  }
  .metrics-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .cost-breakdown-grid,
  .split-viewer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 285px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    box-shadow: 10px 0 30px rgba(15, 23, 42, 0.18);
  }

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

  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar-close-btn {
    display: inline-flex;
  }

  .app-header {
    padding: 0 16px;
    height: 60px;
  }

  .screen-content {
    padding: 20px 14px;
    gap: 20px;
  }

  .header-left {
    gap: 8px;
  }

  .breadcrumb-entity {
    display: none;
  }

  .loan-id-badge {
    display: none;
  }

  .metrics-grid-4 {
    grid-template-columns: 1fr;
  }

  .header-right {
    gap: 8px;
  }

  .clariguide-btn span {
    display: none;
  }

  .clariguide-btn {
    padding: 7px 10px;
  }

  .btn-reset-demo span {
    display: none;
  }

  .btn-reset-demo {
    padding: 6px 8px;
  }
}

/* Center Modal Overlay & Acceptance Card */
.modal-overlay-center {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.acceptance-modal-card {
  width: 100%;
  max-width: 580px;
  background: #FFFFFF;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.floating-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0F172A;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 2000;
  animation: slideUpToast 0.25s ease-out;
}

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