:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f5f7fa;
}
* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; }
button, input, select, textarea { font: inherit; }
button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: #fff;
  background: #166a5b;
  cursor: pointer;
}
button:hover { background: #10574b; }
button:disabled { color: #8b95a7; background: #e6eaf0; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #f5b942;
  outline-offset: 3px;
}
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: #f5f7fa; }
.login-panel {
  display: grid;
  width: min(100%, 420px);
  gap: 16px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}
.brand-mark, .sidebar-brand { font-weight: 800; letter-spacing: 0; }
.brand-mark { color: #166a5b; }
h1, h2, p, .metric strong, .metric small { margin: 0; }
.login-panel p, .eyebrow, .metric span, .metric small, td small { color: #647084; }
.login-panel label { display: grid; gap: 7px; color: #354157; font-weight: 600; }
.login-panel input, .admin-form input, .admin-form select, .admin-form textarea, .panel-header input, .filters input, .filters select, .import-form textarea, .message-preview textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd7e3;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(22, 106, 91, 0.18); border-color: #166a5b; }
.error-message { border: 1px solid #fecaca; border-radius: 6px; margin: 0 0 14px; padding: 10px 12px; color: #991b1b; background: #fff1f2; }
.toast-message { position: sticky; top: 12px; z-index: 4; border: 1px solid #a7f3d0; border-radius: 6px; margin: 0 0 14px; padding: 10px 12px; color: #065f46; background: #ecfdf5; }
.loading-skeleton { display: grid; gap: 10px; margin: 0 0 14px; }
.loading-skeleton span { display: block; height: 12px; border-radius: 999px; background: linear-gradient(90deg, #e7edf5, #f6f8fb, #e7edf5); background-size: 220% 100%; animation: shimmer 1.2s linear infinite; }
.loading-skeleton span:nth-child(2) { width: 72%; }
.loading-skeleton span:nth-child(3) { width: 48%; }
@keyframes shimmer { from { background-position: 220% 0; } to { background-position: -220% 0; } }
.status-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 4px 0 0; }
.status-strip div { border: 1px solid #e4e9f0; border-radius: 6px; padding: 10px; background: #f8fafc; }
.status-strip dt { color: #647084; font-size: 12px; }
.status-strip dd { margin: 3px 0 0; font-weight: 700; }
.app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 24px; padding: 24px; color: #fff; background: #172033; }
.sidebar nav { display: grid; gap: 8px; }
.nav-item { justify-content: flex-start; width: 100%; border: 1px solid transparent; color: #d9e1ee; background: transparent; text-align: left; }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255, 255, 255, 0.1); }
.content { min-width: 0; padding: 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.eyebrow { margin-bottom: 4px; font-size: 13px; font-weight: 700; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.user-chip {
  max-width: 260px;
  overflow: hidden;
  border: 1px solid #d9e1ec;
  border-radius: 999px;
  padding: 9px 12px;
  color: #354157;
  background: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric, .panel { border: 1px solid #dfe5ee; border-radius: 8px; background: #fff; }
.metric { display: grid; gap: 7px; min-width: 0; padding: 18px; }
.metric strong { overflow-wrap: anywhere; font-size: 22px; }
.metric small { overflow-wrap: anywhere; }
.panel { overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e6ebf2; padding: 18px; }
.panel-header input { max-width: 320px; }
.admin-form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 18px; border-bottom: 1px solid #e6ebf2; }
.prospect-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.prospect-form textarea { grid-column: span 2; min-height: 92px; }
.inline-actions, .filters { display: flex; flex-wrap: wrap; gap: 10px; }
.filters { padding: 14px 18px; border-bottom: 1px solid #e6ebf2; }
.filters label { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; color: #354157; }
.filters label input { width: auto; }
.checkbox-field { display: inline-flex; align-items: center; gap: 8px; color: #354157; }
.checkbox-field input { width: auto; min-height: auto; }
.filters input, .filters select { width: auto; min-width: 180px; }
.import-form { display: grid; gap: 12px; padding: 18px; }
.import-form textarea { min-height: 280px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.message-preview { display: grid; gap: 12px; padding: 18px; border-bottom: 1px solid #e6ebf2; background: #fbfcfe; }
.message-preview textarea { min-height: 160px; }
.widget-preview { display: grid; gap: 12px; border: 2px solid #166a5b; border-radius: 8px; padding: 16px; background: #fbfcfe; }
.widget-preview button { justify-self: start; border-radius: 999px; }
.widget-preview small { color: #647084; }
code { overflow-wrap: anywhere; color: #172033; }
.settings-grid { display: grid; grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr); gap: 18px; padding: 18px; }
.settings-grid article { display: grid; align-content: start; gap: 12px; border: 1px solid #e6ebf2; border-radius: 8px; padding: 14px; background: #fbfcfe; }
.settings-grid textarea { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }
.metrics-output {
  overflow: auto;
  max-height: 360px;
  margin: 18px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  padding: 14px;
  color: #172033;
  background: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 18px; border-bottom: 1px solid #e6ebf2; }
.analysis-grid article { display: grid; gap: 8px; border: 1px solid #e6ebf2; border-radius: 8px; padding: 14px; background: #fbfcfe; }
.analysis-grid .analysis-main { grid-column: span 2; }
.analysis-grid ul { margin: 0; padding-left: 18px; color: #354157; }
.muted { padding: 0 18px; color: #647084; }
.timeline-section { border-top: 1px solid #e6ebf2; }
.timeline { display: grid; gap: 12px; padding: 18px; }
.timeline-item { display: grid; gap: 8px; border: 1px solid #e6ebf2; border-radius: 8px; padding: 14px; background: #fbfcfe; }
.timeline-item header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.timeline-item p { color: #354157; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #edf1f6; padding: 12px 18px; text-align: left; vertical-align: top; }
th { color: #647084; font-size: 13px; font-weight: 700; }
td strong, td small { display: block; }
.badge { display: inline-flex; border-radius: 999px; padding: 4px 8px; color: #075e51; background: #dff8ef; font-size: 12px; font-weight: 700; }
.score-pill { display: inline-flex; border-radius: 999px; padding: 4px 8px; color: #1e3a8a; background: #dbeafe; font-size: 12px; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.actions button { min-height: 32px; padding: 7px 9px; font-size: 13px; }
.empty-panel { display: grid; gap: 8px; padding: 18px; }
.compact-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pipeline-mini { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding: 18px; }
.pipeline-mini article { display: grid; gap: 5px; border: 1px solid #e6ebf2; border-radius: 8px; padding: 12px; background: #fbfcfe; }
.pipeline-mini span { color: #647084; font-size: 12px; }
.pipeline-mini strong { font-size: 20px; }
.pipeline-board {
  display: grid;
  grid-auto-columns: minmax(230px, 1fr);
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  padding: 18px;
}
.pipeline-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 280px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}
.pipeline-column header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pipeline-card {
  display: grid;
  gap: 9px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.05);
}
.pipeline-card small { display: block; color: #647084; }
.pipeline-card select { min-width: 130px; border: 1px solid #cfd7e3; border-radius: 6px; padding: 8px 10px; background: #fff; }
.activity-list { display: grid; gap: 10px; padding: 18px; }
.activity-list article { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; border: 1px solid #e6ebf2; border-radius: 8px; padding: 12px; background: #fbfcfe; }
.activity-list span, .activity-list small { color: #647084; }
.chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 620px; }
.chat-history { display: grid; align-content: start; gap: 8px; border-right: 1px solid #e6ebf2; padding: 18px; background: #fbfcfe; }
.chat-history button { justify-content: flex-start; align-items: flex-start; flex-direction: column; border: 1px solid #dfe5ee; color: #172033; background: #fff; text-align: left; }
.chat-history button.active { border-color: #166a5b; background: #ecfdf5; }
.chat-history small { color: #647084; font-weight: 500; }
.chat-main { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid #e6ebf2; padding: 14px 18px; }
.chat-suggestions button { min-height: 34px; padding: 8px 10px; color: #354157; background: #f8fafc; font-size: 13px; }
.chat-messages { display: grid; align-content: start; gap: 12px; overflow: auto; padding: 18px; }
.chat-message { max-width: 880px; border: 1px solid #dfe5ee; border-radius: 8px; padding: 14px; background: #fff; }
.chat-message.user { justify-self: end; background: #eef6ff; }
.chat-message p { white-space: pre-wrap; color: #354157; }
.chat-citations { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chat-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; border-top: 1px solid #e6ebf2; padding: 14px 18px; background: #fbfcfe; }
@media (max-width: 1180px) {
  .admin-form, .prospect-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .prospect-form textarea { grid-column: span 3; }
  .compact-grid, .pipeline-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { padding: 16px; }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 16px; }
  .topbar, .panel-header { align-items: flex-start; flex-direction: column; }
  .topbar-actions, .panel-header input { width: 100%; max-width: none; }
  .dashboard-grid, .status-strip, .admin-form, .prospect-form { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .prospect-form textarea { grid-column: span 1; }
  .analysis-grid, .analysis-grid .analysis-main { grid-template-columns: 1fr; grid-column: span 1; }
  .compact-grid, .pipeline-mini, .activity-list article { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-history { border-right: 0; border-bottom: 1px solid #e6ebf2; }
  .chat-input { grid-template-columns: 1fr; }
  .inline-actions, .filters, .filters input, .filters select { width: 100%; }
}
