/* ============================================
   Civalent — Regulatory Intelligence for Construction
   Wireframe Stylesheet
   Brand: Indigo + Copper (LOCKED)
   ============================================ */

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

:root {
  --bg-primary: #07091a;
  --bg-secondary: #0b0f22;
  --bg-tertiary: #10152b;
  --bg-card: #0b0f22;
  --bg-hover: #1b223e;
  --bg-input: #07091a;

  --text-primary: #e6ebf5;
  --text-secondary: #8892b0;
  --text-muted: #586380;
  --text-inverse: #07091a;

  --accent-teal: #d4845e;
  --accent-teal-hover: #e29a78;
  --accent-teal-muted: rgba(212, 132, 94, 0.15);
  --accent-violet: #8690f8;
  --accent-violet-muted: rgba(134, 144, 248, 0.15);

  --status-green: #34d399;
  --status-green-bg: rgba(52, 211, 153, 0.12);
  --status-yellow: #fbbf24;
  --status-yellow-bg: rgba(251, 191, 36, 0.12);
  --status-red: #f87171;
  --status-red-bg: rgba(248, 113, 113, 0.12);
  --status-gray: #586380;
  --status-gray-bg: rgba(88, 99, 128, 0.12);
  --status-blue: #60a5fa;
  --status-blue-bg: rgba(96, 165, 250, 0.12);

  --border-color: #1d2548;
  --border-subtle: #141a38;

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  --sidebar-width: 240px;
  --header-height: 56px;
  --touch-min: 56px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--accent-teal);
  text-decoration: none;
}

a:hover {
  color: var(--accent-teal-hover);
  text-decoration: none;
}

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

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--header-height);
}

.sidebar-logo .logo-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo .logo-icon .layer {
  position: absolute;
  left: 0;
  right: 0;
  border-radius: 2px;
}

.sidebar-logo .logo-icon .layer-1 {
  top: 3px;
  height: 6px;
  background: var(--accent-teal);
  opacity: 0.45;
}

.sidebar-logo .logo-icon .layer-2 {
  top: 11px;
  height: 6px;
  background: var(--accent-teal);
  opacity: 0.7;
}

.sidebar-logo .logo-icon .layer-3 {
  top: 19px;
  height: 6px;
  background: var(--accent-teal);
}

.sidebar-logo .logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 12px 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  min-height: var(--touch-min);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}

.sidebar-link:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-link.active {
  background-color: var(--accent-teal-muted);
  color: var(--accent-teal);
}

.sidebar-link .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-link .nav-badge {
  margin-left: auto;
  background: var(--status-red);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-color);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  min-height: var(--touch-min);
}

.sidebar-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-violet);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

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

.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content-header {
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.breadcrumbs a {
  color: var(--text-muted);
}

.breadcrumbs a:hover {
  color: var(--accent-teal);
}

.breadcrumbs .separator {
  color: var(--text-muted);
  user-select: none;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-body {
  padding: 24px 32px;
  flex: 1;
}

/* --- Page Title --- */
.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch-min);
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-teal);
  color: var(--text-inverse);
  border-color: var(--accent-teal);
}

.btn-primary:hover {
  background: var(--accent-teal-hover);
  border-color: var(--accent-teal-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0 12px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* --- Stat Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.stat-change {
  font-size: 12px;
  margin-top: 4px;
}

.stat-change.positive {
  color: var(--status-green);
}

.stat-change.negative {
  color: var(--status-red);
}

/* --- Tables --- */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

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

thead {
  background: var(--bg-tertiary);
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

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

tbody tr:hover {
  background: var(--bg-hover);
  cursor: pointer;
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-green {
  background: var(--status-green-bg);
  color: var(--status-green);
}

.badge-yellow {
  background: var(--status-yellow-bg);
  color: var(--status-yellow);
}

.badge-red {
  background: var(--status-red-bg);
  color: var(--status-red);
}

.badge-gray {
  background: var(--status-gray-bg);
  color: var(--status-gray);
}

.badge-blue {
  background: var(--status-blue-bg);
  color: var(--status-blue);
}

.badge-teal {
  background: var(--accent-teal-muted);
  color: var(--accent-teal);
}

.badge-violet {
  background: var(--accent-violet-muted);
  color: var(--accent-violet);
}

/* Status dot indicator */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.green { background: var(--status-green); }
.status-dot.yellow { background: var(--status-yellow); }
.status-dot.red { background: var(--status-red); }
.status-dot.gray { background: var(--status-gray); }
.status-dot.blue { background: var(--status-blue); }

/* --- Code / Monospace --- */
.code-text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-teal);
}

.code-block {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  line-height: 1.6;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.tab {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  min-height: var(--touch-min);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent-teal);
  border-bottom-color: var(--accent-teal);
}

.tab .tab-count {
  font-size: 11px;
  background: var(--bg-tertiary);
  padding: 2px 7px;
  border-radius: 10px;
  color: var(--text-muted);
}

.tab.active .tab-count {
  background: var(--accent-teal-muted);
  color: var(--accent-teal);
}

/* --- Filters / Search --- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 14px;
  min-height: var(--touch-min);
  flex: 1;
  max-width: 400px;
}

.search-input input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  flex: 1;
  min-width: 0;
}

.search-input input::placeholder {
  color: var(--text-muted);
}

.search-input .search-icon {
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--touch-min);
  padding: 0 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-ui);
}

.filter-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.filter-btn.active {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
  background: var(--accent-teal-muted);
}

/* --- Tags --- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* --- Alert Items --- */
.alert-item {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

.alert-item:hover {
  background: var(--bg-hover);
  cursor: pointer;
}

.alert-item:last-child {
  border-bottom: none;
}

.alert-severity {
  width: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.alert-severity.critical { background: var(--status-red); }
.alert-severity.high { background: var(--status-yellow); }
.alert-severity.medium { background: var(--status-blue); }
.alert-severity.info { background: var(--status-gray); }

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.alert-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.5;
}

/* --- Upload Zone --- */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.upload-zone:hover {
  border-color: var(--accent-teal);
  background: var(--accent-teal-muted);
}

.upload-zone .upload-icon {
  font-size: 40px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.upload-zone .upload-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.upload-zone .upload-hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* --- Progress Bar --- */
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-fill.green { background: var(--status-green); }
.progress-fill.teal { background: var(--accent-teal); }
.progress-fill.yellow { background: var(--status-yellow); }
.progress-fill.red { background: var(--status-red); }

/* --- Detail Panel (side panel pattern) --- */
.content-split {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
}

.detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
}

.detail-panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.detail-field {
  margin-bottom: 16px;
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* --- Grid layouts --- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

/* --- Form elements --- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-teal);
}

.form-select {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  appearance: none;
  cursor: pointer;
}

textarea.form-input {
  padding: 14px;
  min-height: 120px;
  resize: vertical;
}

/* --- Comparison Table --- */
.comparison-table th {
  text-align: center;
}

.comparison-table th:first-child {
  text-align: left;
}

.comparison-table td {
  text-align: center;
  vertical-align: top;
}

.comparison-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.comparison-cell {
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
}

.comparison-cell.conflict {
  background: var(--status-red-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.comparison-cell.gap {
  background: var(--status-yellow-bg);
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.comparison-cell.aligned {
  background: var(--status-green-bg);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 32px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state .empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state .empty-description {
  font-size: 14px;
  margin-bottom: 20px;
}

/* --- Section spacing --- */
.section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* --- Diff view --- */
.diff-view {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

.diff-added {
  background: var(--status-green-bg);
  color: var(--status-green);
  padding: 2px 4px;
  border-radius: 2px;
}

.diff-removed {
  background: var(--status-red-bg);
  color: var(--status-red);
  padding: 2px 4px;
  border-radius: 2px;
  text-decoration: line-through;
}

/* --- Activity / Timeline --- */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-teal);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.activity-text strong {
  color: var(--text-primary);
}

.activity-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
  .content-split {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 200px;
  }

  .content-body {
    padding: 20px 24px;
  }

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

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .content-body {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    max-width: none;
  }
}

/* --- Chat Interface --- */
.chat-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  height: calc(100vh - var(--header-height));
}

.chat-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid var(--border-color);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.chat-message {
  display: flex;
  gap: 12px;
  max-width: 800px;
}

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

.chat-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 4px;
}

.chat-message-avatar.ai {
  background: var(--accent-teal);
  color: var(--text-inverse);
}

.chat-message-avatar.human {
  background: var(--accent-violet);
  color: white;
}

.chat-message-body {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

.chat-message.user .chat-message-body {
  background: var(--accent-teal-muted);
  border-color: rgba(212, 132, 94, 0.25);
}

.chat-message-body p {
  margin-bottom: 12px;
}

.chat-message-body p:last-child {
  margin-bottom: 0;
}

.chat-citation {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-teal);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.chat-citation:hover {
  background: var(--accent-teal-muted);
  text-decoration: none;
}

.chat-input-area {
  padding: 16px 32px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.chat-input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input-wrapper {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: var(--touch-min);
}

.chat-input-wrapper:focus-within {
  border-color: var(--accent-teal);
}

.chat-input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
}

.chat-input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  background: var(--bg-secondary);
  padding: 20px;
}

.chat-sidebar-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.chat-source-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chat-source-item:hover {
  background: var(--bg-hover);
}

.chat-source-item .source-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-teal);
  white-space: nowrap;
}

.chat-source-item .source-title {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.chat-source-item .source-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chat-pin-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 0.15s ease;
}

.chat-pin-btn:hover {
  color: var(--accent-teal);
  background: var(--accent-teal-muted);
}

/* --- Intake / Review Cards --- */
.review-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.review-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.review-card:hover {
  border-color: var(--accent-teal);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.review-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.review-card-status {
  font-size: 11px;
  color: var(--accent-teal);
  background: var(--accent-teal-muted);
  padding: 4px 10px;
  border-radius: 100px;
  font-weight: 500;
}

.review-card-client {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.review-card-location {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.review-card-metrics {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.review-card-metric {
  flex: 1;
}

.review-card-metric .metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.review-card-metric .metric-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.review-card-flags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* --- Intake Form --- */
.intake-form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.intake-form-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.intake-or-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 32px 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.intake-or-divider::before,
.intake-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.intake-processing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
}

.intake-processing-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 500px;
  margin: 24px auto 0;
  text-align: left;
}

.intake-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
}

.intake-step.complete {
  background: var(--status-green-bg);
}

.intake-step.active {
  background: var(--accent-teal-muted);
}

.intake-step.pending {
  background: var(--bg-tertiary);
  opacity: 0.6;
}

.intake-step-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.intake-step.complete .intake-step-icon {
  background: var(--status-green);
  color: white;
}

.intake-step.active .intake-step-icon {
  background: var(--accent-teal);
  color: var(--text-inverse);
}

.intake-step.pending .intake-step-icon {
  background: var(--text-muted);
  color: var(--bg-primary);
}

.intake-step-text {
  font-size: 14px;
  font-weight: 500;
}

.intake-step.complete .intake-step-text {
  color: var(--status-green);
}

.intake-step.active .intake-step-text {
  color: var(--accent-teal);
}

.intake-step.pending .intake-step-text {
  color: var(--text-muted);
}

@media (max-width: 1200px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }
  .chat-sidebar {
    display: none;
  }
  .chat-main {
    border-right: none;
  }
}

/* --- Utility --- */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-teal { color: var(--accent-teal); }
.text-copper { color: var(--accent-teal); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
