/* ALOANMA — Credit Appraisal Assistant */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #0d9488;
  --accent-light: #ccfbf1;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--text);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  padding: 1.25rem 1.35rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.sidebar-brand span {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 0.15rem;
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 0.85rem 0.65rem;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.65rem 0.75rem 0.35rem;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(30, 64, 175, 0.45);
  color: #fff;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.75rem;
  color: #64748b;
}

.sidebar-footer strong {
  color: #94a3b8;
  display: block;
  margin-bottom: 0.15rem;
}

/* Main */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar-left p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 0.82rem;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.content {
  flex: 1;
  padding: 1.5rem 1.75rem 2rem;
  max-width: 1280px;
}

/* Views */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & grids */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.stat-card {
  padding: 1.15rem 1.25rem;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 0.25rem;
  line-height: 1.2;
}

.stat-change {
  font-size: 0.72rem;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-change.positive { color: var(--success); }
.stat-change.neutral { color: var(--text-muted); }
.stat-change.danger { color: var(--danger); }

.stat-card-danger {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fff 0%, #fef2f2 100%);
}

.stat-card-sandbox {
  border-color: #c4b5fd;
  background: linear-gradient(180deg, #fff 0%, #f5f3ff 100%);
}

.stat-card-clientelle {
  border-color: #fcd34d;
  background: linear-gradient(180deg, #fff 0%, #fffbeb 100%);
}

.stat-card-clientelle.stat-card-clickable:hover {
  border-color: #f59e0b;
}

.stat-card-clientelle.stat-card-clickable:focus {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.stat-card-sandbox.stat-card-clickable:hover {
  border-color: #8b5cf6;
}

.stat-card-sandbox.stat-card-clickable:focus {
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.stat-card-kpi {
  border-color: #6ee7b7;
  background: linear-gradient(180deg, #fff 0%, #ecfdf5 100%);
}

.stat-card-kpi.stat-card-clickable:hover {
  border-color: #10b981;
}

.stat-card-kpi.stat-card-clickable:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.stat-card-clickable {
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}

.stat-card-clickable:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.stat-card-clickable:not(.stat-card-danger):hover {
  border-color: var(--primary);
}

.stat-card-danger.stat-card-clickable:hover {
  border-color: #f87171;
}

.stat-card-clickable:focus {
  outline: none;
}

.stat-card-danger.stat-card-clickable:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.stat-card-clickable:not(.stat-card-danger):focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.35rem 1.5rem 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.modal-close {
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.15rem 0.5rem;
}

.modal-confirm {
  max-width: 420px;
}

.confirm-modal-message {
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  padding: 0.5rem 0 1.15rem;
  color: var(--text);
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.close-appraisal-select {
  width: auto;
  min-width: 7.5rem;
  font-size: 0.78rem;
  padding: 0.35rem 0.55rem;
}

.flag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.flag-chip {
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--danger-light);
  color: #991b1b;
  font-weight: 600;
}

.sandbox-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.sandbox-tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  text-align: left;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sandbox-tool-card:hover {
  box-shadow: var(--shadow);
  border-color: #c4b5fd;
  transform: translateY(-1px);
}

.sandbox-tool-card:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
  border-color: #8b5cf6;
}

.sandbox-tool-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: #ede9fe;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sandbox-tool-icon svg {
  width: 20px;
  height: 20px;
  color: #7c3aed;
}

.sandbox-tool-card h4 {
  font-size: 0.92rem;
  font-weight: 600;
}

.sandbox-tool-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
}

.sandbox-result {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border);
}

.sandbox-result h4 {
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.sandbox-result-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.sandbox-result-row:last-child {
  border-bottom: none;
  font-weight: 600;
  padding-top: 0.5rem;
}

.sandbox-result-row span:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sandbox-result.pass {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.sandbox-result.fail {
  background: #fef2f2;
  border-color: #fecaca;
}

.sandbox-schedule-table {
  width: 100%;
  font-size: 0.78rem;
  margin-top: 0.75rem;
  border-collapse: collapse;
}

.sandbox-schedule-table th,
.sandbox-schedule-table td {
  padding: 0.4rem 0.5rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.sandbox-schedule-table th:first-child,
.sandbox-schedule-table td:first-child {
  text-align: left;
}

@media (max-width: 640px) {
  .sandbox-tools-grid { grid-template-columns: 1fr; }
}

.modal-kpi {
  max-width: 980px;
}

.kpi-overview {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.15rem;
  margin-bottom: 1.15rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1px solid #a7f3d0;
}

.kpi-overview-score {
  flex-shrink: 0;
  text-align: center;
  min-width: 88px;
}

.kpi-overview-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #047857;
  line-height: 1;
}

.kpi-overview-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-weight: 500;
}

.kpi-overview-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.kpi-overview-period {
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.stat-value-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.stat-value-row .stat-value {
  margin-top: 0;
}

.kpi-dashboard-class {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.kpi-dashboard-class.kpi-class-a { background: #dbeafe; color: #1d4ed8; }
.kpi-dashboard-class.kpi-class-b { background: #d1fae5; color: #047857; }
.kpi-dashboard-class.kpi-class-c { background: #fef3c7; color: #a16207; }
.kpi-dashboard-class.kpi-class-d { background: #fee2e2; color: #b91c1c; }

.kpi-overview-rating {
  flex-shrink: 0;
  text-align: center;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(167, 243, 208, 0.8);
  min-width: 108px;
}

.kpi-class-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.kpi-class-badge.kpi-class-a { background: #dbeafe; color: #1d4ed8; border: 2px solid #93c5fd; }
.kpi-class-badge.kpi-class-b { background: #d1fae5; color: #047857; border: 2px solid #6ee7b7; }
.kpi-class-badge.kpi-class-c { background: #fef3c7; color: #a16207; border: 2px solid #fcd34d; }
.kpi-class-badge.kpi-class-d { background: #fee2e2; color: #b91c1c; border: 2px solid #fca5a5; }

.kpi-class-title {
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.kpi-class-compare {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.kpi-peer-panel {
  margin-bottom: 1.15rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

.kpi-peer-panel h4 {
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.kpi-peer-summary {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.85rem;
}

.kpi-peer-classes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.kpi-peer-class-card {
  padding: 0.65rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-align: center;
  background: var(--surface-2);
  opacity: 0.72;
  transition: opacity var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.kpi-peer-class-card.active {
  opacity: 1;
  box-shadow: var(--shadow);
  border-width: 2px;
}

.kpi-peer-class-card.kpi-class-a.active { border-color: #93c5fd; background: #eff6ff; }
.kpi-peer-class-card.kpi-class-b.active { border-color: #6ee7b7; background: #ecfdf5; }
.kpi-peer-class-card.kpi-class-c.active { border-color: #fcd34d; background: #fffbeb; }
.kpi-peer-class-card.kpi-class-d.active { border-color: #fca5a5; background: #fef2f2; }

.kpi-peer-class-card .class-letter {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.kpi-peer-class-card .class-name {
  font-size: 0.68rem;
  font-weight: 600;
  margin-top: 0.2rem;
  color: var(--text-muted);
}

.kpi-peer-class-card .class-count {
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 0.15rem;
}

.kpi-peer-class-card.kpi-class-a .class-letter { color: #1d4ed8; }
.kpi-peer-class-card.kpi-class-b .class-letter { color: #047857; }
.kpi-peer-class-card.kpi-class-c .class-letter { color: #a16207; }
.kpi-peer-class-card.kpi-class-d .class-letter { color: #b91c1c; }

@media (max-width: 768px) {
  .kpi-peer-classes { grid-template-columns: repeat(2, 1fr); }
  .kpi-overview { flex-wrap: wrap; }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.kpi-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.95rem 1rem;
  background: var(--surface);
}

.kpi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.kpi-card-header h4 {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
}

.kpi-score-pill {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.kpi-score-pill.excellent { background: #dbeafe; color: #1d4ed8; }
.kpi-score-pill.good { background: #d1fae5; color: #047857; }
.kpi-score-pill.moderate { background: #fef3c7; color: #a16207; }
.kpi-score-pill.poor { background: #fee2e2; color: #b91c1c; }

.kpi-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.55rem;
}

.kpi-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #059669);
}

.kpi-card p {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.35rem;
}

.kpi-card-meta {
  font-size: 0.72rem;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.kpi-card-meta .positive { color: var(--success); }
.kpi-card-meta .negative { color: var(--danger); }

.kpi-risk-mix {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  margin: 0.45rem 0 0.55rem;
}

.kpi-risk-seg.low { background: #34d399; }
.kpi-risk-seg.mid { background: #fbbf24; }
.kpi-risk-seg.high { background: #f87171; }

.kpi-risk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.kpi-risk-legend span::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.kpi-risk-legend .low::before { background: #34d399; }
.kpi-risk-legend .mid::before { background: #fbbf24; }
.kpi-risk-legend .high::before { background: #f87171; }

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-overview { flex-direction: column; align-items: flex-start; }
}

.modal-clientelle {
  max-width: 960px;
}

.clientelle-period-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}

.clientelle-period-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.clientelle-period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.clientelle-period-tab {
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.clientelle-period-tab:hover {
  border-color: #fcd34d;
  color: #b45309;
}

.clientelle-period-tab.active {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
  font-weight: 600;
}

.clientelle-period-tab:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.clientelle-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.clientelle-stat-box {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
}

.clientelle-stat-box.highlight {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fdba74;
}

.clientelle-stat-box .label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.clientelle-stat-box .value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.2rem;
  color: #b45309;
}

.clientelle-stat-box .meta {
  font-size: 0.7rem;
  color: var(--text-subtle);
  margin-top: 0.25rem;
}

.clientelle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.clientelle-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.05rem;
  background: var(--surface);
}

.clientelle-panel h4 {
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.clientelle-bar-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}

.clientelle-bar-row span:first-child {
  flex: 0 0 38%;
  color: var(--text-muted);
}

.clientelle-bar-track {
  flex: 1;
  height: 7px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.clientelle-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.clientelle-bar-row span:last-child {
  flex: 0 0 2.5rem;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.clientelle-table {
  width: 100%;
  font-size: 0.78rem;
  border-collapse: collapse;
}

.clientelle-table th,
.clientelle-table td {
  padding: 0.4rem 0.35rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.clientelle-table th {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.clientelle-table td:last-child,
.clientelle-table th:last-child {
  text-align: right;
}

@media (max-width: 768px) {
  .clientelle-overview { grid-template-columns: repeat(2, 1fr); }
  .clientelle-grid { grid-template-columns: 1fr; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: #0f766e; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

thead {
  background: var(--surface-2);
}

th {
  text-align: left;
  padding: 0.7rem 1rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* Badges & scores */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-pending { background: var(--warning-light); color: var(--warning); }
.badge-review { background: var(--primary-light); color: var(--primary); }
.badge-approved { background: var(--success-light); color: var(--success); }
.badge-rejected { background: var(--danger-light); color: var(--danger); }

/* Virtue Analysis Score */
.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
}

.score-poor { background: #fef2f2; color: #b91c1c; }
.score-marginal { background: #fff7ed; color: #c2410c; }
.score-moderate { background: #fefce8; color: #a16207; }
.score-good { background: #ecfdf5; color: #047857; }
.score-excellent { background: #eff6ff; color: #1d4ed8; }

.score-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.score-key-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.score-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Forms */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.84rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}

.form-textarea { min-height: 90px; resize: vertical; }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone svg {
  width: 36px;
  height: 36px;
  color: var(--text-subtle);
  margin-bottom: 0.65rem;
}

.upload-zone p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.upload-zone strong { color: var(--primary); }

.upload-zone-md {
  padding: 1.35rem 1.25rem;
}

.upload-zone-md svg {
  width: 28px;
  height: 28px;
  margin-bottom: 0.5rem;
}

.upload-zone-md p {
  font-size: 0.82rem;
}

.upload-limit {
  font-size: 0.72rem !important;
  color: var(--text-subtle) !important;
  margin-top: 0.3rem !important;
}

.upload-error {
  font-size: 0.72rem;
  color: var(--danger);
  margin-top: 0.4rem;
}

.doc-upload-section {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border-light);
}

.doc-upload-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.doc-upload-section:first-of-type {
  padding-top: 0;
}

.doc-upload-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.doc-upload-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.form-textarea-sm {
  min-height: 72px;
}

.file-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* Focus chips */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  color: var(--text-muted);
}

.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* Credit ratios */
.ratio-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.ratio-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.ratio-value {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0.25rem 0;
  letter-spacing: -0.02em;
}

.ratio-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.ratio-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.ratio-bar-fill.safe { background: var(--success); }
.ratio-bar-fill.caution { background: var(--warning); }
.ratio-bar-fill.risk { background: var(--danger); }

/* Analysis results */
.analysis-block {
  padding: 1rem;
  border-left: 3px solid var(--primary);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 0.75rem;
}

.analysis-block h4 {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.analysis-block p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.doc-analysis-left,
.doc-analysis-right {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.doc-analysis-layout.doc-analysis-idle {
  display: block;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.doc-analysis-layout.doc-analysis-idle .doc-analysis-left {
  display: none;
}

.doc-analysis-layout.doc-analysis-idle .doc-analysis-right {
  width: 100%;
}

.analysis-brief-card {
  margin-top: 0;
}

.analysis-brief-body {
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.analysis-brief-body p {
  margin-bottom: 0.85rem;
}

.analysis-brief-body p:last-child {
  margin-bottom: 0;
}

.analysis-brief-note {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.78rem;
  font-weight: 600;
  font-style: italic;
  color: var(--primary);
  text-align: center;
}

.anomaly-flag {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  background: var(--warning-light);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.anomaly-flag svg {
  width: 16px;
  height: 16px;
  color: var(--warning);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Chat */
.chat-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
  height: calc(100vh - var(--header-height) - 5rem);
  min-height: 480px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.84rem;
  line-height: 1.55;
}

.message-bot {
  background: var(--surface-2);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message-user {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message-meta {
  font-size: 0.68rem;
  opacity: 0.65;
  margin-top: 0.35rem;
}

.chat-input-area {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}

.chat-input-area input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.84rem;
}

.chat-suggestions {
  padding: 1rem;
}

.chat-suggestions h4 {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  font-weight: 600;
}

.suggestion-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}

.suggestion-btn:hover { background: var(--primary-light); border-color: var(--primary); }

/* Library & news */
.resource-item,
.news-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
}

.resource-item:last-child,
.news-item:last-child { border-bottom: none; }

.resource-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.resource-icon svg { width: 20px; height: 20px; color: var(--primary); }

.resource-body h4,
.news-item h4 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.resource-body p,
.news-item p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.news-date {
  font-size: 0.72rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

/* Appraisal wizard steps */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.step {
  flex: 1;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.step.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.step.done { color: var(--success); }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

.wizard-step-header {
  margin-bottom: 1.25rem;
}

.wizard-step-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.wizard-step-header p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.form-section {
  margin-bottom: 1rem;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 1.1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-light);
}

.form-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.required {
  color: var(--danger);
}

.form-error {
  font-size: 0.72rem;
  color: var(--danger);
  margin-top: 0.25rem;
}

.form-input.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.radio-group-stack {
  flex-direction: column;
  gap: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--text);
  transition: border-color var(--transition), background var(--transition);
  flex: 1;
  min-width: 180px;
}

.radio-group-stack .radio-option {
  min-width: 100%;
}

.radio-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.radio-option input {
  margin-top: 0.15rem;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.radio-option span {
  line-height: 1.45;
}

.inline-tick-group {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.inline-tick {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.inline-tick input {
  accent-color: var(--primary);
  cursor: pointer;
}

.inline-tick:has(input:checked) {
  color: var(--primary);
  font-weight: 600;
}

.pep-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: var(--warning-light);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.pep-alert svg {
  width: 22px;
  height: 22px;
  color: var(--warning);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.pep-alert strong {
  display: block;
  font-size: 0.88rem;
  color: #92400e;
  margin-bottom: 0.2rem;
}

.pep-alert p {
  font-size: 0.82rem;
  color: #78350f;
  line-height: 1.5;
  margin: 0;
}

.caution-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.caution-banner svg {
  width: 22px;
  height: 22px;
  color: var(--warning);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.caution-banner strong {
  color: #92400e;
}

.caution-banner p {
  font-size: 0.82rem;
  color: #78350f;
  line-height: 1.55;
  margin: 0;
}

.caution-cta {
  margin-top: 0.85rem;
  background: #fff;
  border-color: #fcd34d;
  color: #92400e;
}

.caution-cta:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
}

.caution-cta-hint {
  font-size: 0.72rem !important;
  margin-top: 0.45rem !important;
  color: #92400e !important;
}

.assistant-role-banner {
  background: var(--primary-light);
  border-color: #93c5fd;
}

.assistant-role-banner strong { color: var(--primary); }
.assistant-role-banner p { color: #1e3a8a; }

.findings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.findings-actions .btn {
  flex: 1;
  min-width: 240px;
}

.preview-flags {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.flag-item {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.45;
}

.flag-item strong {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.78rem;
}

.flag-green {
  background: var(--success-light);
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.flag-red {
  background: var(--danger-light);
  border: 1px solid #fecaca;
  color: #991b1b;
}

.library-section {
  margin-bottom: 1rem;
}

#view-library {
  background: #f3f8fb;
  margin: -1.5rem -1.75rem 0;
  padding: 1.5rem 1.75rem 2rem;
  min-height: calc(100vh - var(--header-height));
}

#view-library .library-section-general {
  background: linear-gradient(180deg, #eef8fc 0%, #e3f2f9 100%);
  border-color: #b6dff0;
}

#view-library .library-section-company {
  background: linear-gradient(180deg, #eef2ff 0%, #e4e9ff 100%);
  border-color: #c7d2fe;
}

#view-library .library-section-personal {
  background: linear-gradient(180deg, #ecfeff 0%, #dff7fb 100%);
  border-color: #a5f3fc;
}

#view-library .library-section-general .input-panel-block,
#view-library .library-section-general .library-resources-panel {
  background: rgba(255, 255, 255, 0.72);
  border-color: #c5e8f5;
}

#view-library .library-section-company .input-panel-block,
#view-library .library-section-company .library-resources-panel {
  background: rgba(255, 255, 255, 0.72);
  border-color: #d4dcfd;
}

#view-library .library-section-personal .input-panel-block,
#view-library .library-section-personal .library-resources-panel {
  background: rgba(255, 255, 255, 0.72);
  border-color: #b8eff5;
}

#view-library .library-section-general .available-resource-item {
  background: #f7fcfe;
  border-color: #c5e8f5;
}

#view-library .library-section-general .resource-item {
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  border: 1px solid #c5e8f5;
  border-radius: var(--radius-sm);
  background: #f7fcfe;
  border-bottom: 1px solid #c5e8f5;
}

#view-library .library-section-general .resource-icon {
  background: #dbeafe;
}

#view-library .library-section-general .resource-icon svg {
  color: #2563eb;
}

#view-library .library-section-company .resource-icon,
#view-library .library-section-company .available-resource-item .resource-type-badge:not(.badge-text) {
  background: #e0e7ff;
  color: #4338ca;
}

#view-library .library-section-personal .resource-icon,
#view-library .library-section-personal .available-resource-item .resource-type-badge:not(.badge-text) {
  background: #cffafe;
  color: #0e7490;
}

#view-library .library-section-company .available-resource-item {
  background: #f8f9ff;
  border-color: #d4dcfd;
}

#view-library .library-section-personal .available-resource-item {
  background: #f6fdff;
  border-color: #b8eff5;
}

.library-section:last-child {
  margin-bottom: 0;
}

.library-split {
  align-items: start;
  gap: 1.25rem;
}

.library-input-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-panel-block {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.upload-zone-compact {
  padding: 1rem 0.85rem;
}

.upload-zone-compact svg {
  width: 24px;
  height: 24px;
  margin-bottom: 0.35rem;
}

.upload-zone-compact p {
  font-size: 0.78rem;
}

.form-textarea-compact {
  min-height: 100px;
}

.library-resources-panel {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 320px;
}

.available-resources-header {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0.75rem 0 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border-light);
}

.available-resources-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 420px;
  overflow-y: auto;
}

.available-resource-item {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.available-resource-item .resource-type-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.available-resource-item .resource-type-badge.badge-text {
  background: var(--accent-light);
  color: #0f766e;
}

.available-resource-item strong {
  display: block;
  font-size: 0.84rem;
  margin-bottom: 0.2rem;
}

.available-resource-item p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
  white-space: pre-wrap;
}

.available-resource-meta {
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 0.3rem;
}

@media (max-width: 768px) {
  .library-split { grid-template-columns: 1fr; }
  .library-resources-panel { min-height: auto; }
}

.collateral-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.collateral-thumb.has-image {
  padding: 0;
  overflow: hidden;
  border-style: solid;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Collateral preview */
.collateral-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.collateral-thumb {
  aspect-ratio: 4/3;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  font-size: 0.75rem;
}

/* Notice banner */
.notice-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: var(--accent-light);
  border: 1px solid #99f6e4;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.notice-banner svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.notice-banner strong {
  display: block;
  font-size: 0.88rem;
  color: #0f766e;
  margin-bottom: 0.2rem;
}

.notice-banner p {
  font-size: 0.82rem;
  color: #115e59;
  line-height: 1.5;
  margin: 0;
}

/* Services grid */
.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.service-card:hover {
  box-shadow: var(--shadow);
  border-color: #cbd5e1;
}

.service-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.service-icon svg {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

.service-card h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.service-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
  margin-bottom: 1rem;
}

.service-card .btn {
  width: 100%;
}

@media (max-width: 1100px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .services-grid { grid-template-columns: 1fr; }
}

/* Contact */
.contact-info-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.contact-info-item svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.contact-info-item strong {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 0.1rem;
}

.contact-info-item p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.crb-features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.crb-features li {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-light);
  padding-left: 1.25rem;
  position: relative;
}

.crb-features li:last-child { border-bottom: none; }

.crb-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
}

/* Section spacing */
.section { margin-bottom: 1.5rem; }
.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }

/* Mobile toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  color: var(--text);
}

/* Responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-panel { min-height: 420px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .grid-4, .grid-3, .grid-2, .collateral-grid { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}
