/* Log Analytics Dashboard — Dark Theme */

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

body {
  font-family: 'SF Mono', 'Fira Code', Consolas, 'Liberation Mono', monospace;
  background: #1a1a2e;
  color: #f0ece4;
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 180px;
  background: #0f0f23;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.sidebar-header {
  padding: 0 16px 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #60a5fa;
  border-bottom: 1px solid #1a1a2e;
}

.nav-links {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-links li a {
  display: block;
  padding: 10px 16px;
  color: #b8a078;
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s, background 0.15s;
}

.nav-links li a:hover {
  color: #f0ece4;
  background: rgba(96, 165, 250, 0.08);
}

.nav-links li a.active {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
  border-right: 3px solid #60a5fa;
}

.env-selector {
  padding: 16px;
  border-top: 1px solid #1a1a2e;
}

.env-label {
  font-size: 10px;
  color: #9a8a6e;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 8px;
}

.env-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.env-dot {
  display: inline-block;
  padding: 3px 6px;
  font-size: 10px;
  color: #9a8a6e;
  text-decoration: none;
  border: 1px solid #333;
  border-radius: 3px;
  transition: all 0.15s;
}

.env-dot:hover {
  color: #f0ece4;
  border-color: #60a5fa;
}

.env-dot.env-active {
  color: #60a5fa;
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.15);
}

/* Content */
.content {
  margin-left: 180px;
  padding: 24px;
  flex: 1;
  min-width: 0;
}

h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #f0ece4;
}

h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #f0ece4;
}

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat-card {
  background: #16213e;
  border-radius: 6px;
  padding: 16px 20px;
  min-width: 140px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #f0ece4;
}

.stat-label {
  font-size: 11px;
  color: #b8a078;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Panels */
.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: #16213e;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  padding: 8px 10px;
  color: #b8a078;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
  border-bottom: 1px solid #2a2a4a;
}

.data-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(42, 42, 74, 0.5);
}

.data-table tr:hover {
  background: rgba(96, 165, 250, 0.04);
}

.data-table a {
  color: #60a5fa;
  text-decoration: none;
}

.data-table a:hover {
  text-decoration: underline;
}

/* Dots */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-green { background: #4ade80; }
.dot-yellow { background: #fbbf24; }
.dot-orange { background: #fb923c; }
.dot-red { background: #f87171; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-novel { background: rgba(96, 165, 250, 0.2); color: #60a5fa; }
.badge-emerging { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.badge-familiar { background: rgba(74, 222, 128, 0.2); color: #4ade80; }
.badge-routine { background: rgba(136, 136, 136, 0.2); color: #b8a078; }
.badge-spiking { background: rgba(248, 113, 113, 0.2); color: #f87171; }

.env-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  vertical-align: middle;
}

/* Text helpers */
.mono { font-family: 'SF Mono', 'Fira Code', Consolas, monospace; }
.mono-sm { font-family: 'SF Mono', 'Fira Code', Consolas, monospace; font-size: 11px; }
.muted { color: #9a8a6e; }
.text-red { color: #f87171; }
.text-yellow { color: #fbbf24; }
.text-green { color: #4ade80; }

/* Pattern column — overflow hidden */
.col-pattern { width: 50%; }
.pattern-cell {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Compact panel (spiking) */
.panel-compact {
  padding: 12px 16px;
}
.panel-compact h2 { margin-bottom: 6px; }
.panel-compact .pattern-list li { padding: 3px 0; }

/* Pattern list */
.pattern-list {
  list-style: none;
}

.pattern-list li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(42, 42, 74, 0.5);
  font-size: 12px;
}

/* Action buttons for proposals */
.action-buttons { white-space: nowrap; }
.btn {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid #333;
  border-radius: 3px;
  background: transparent;
  color: #b8a078;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 2px;
}
.btn:hover { color: #fff; }
.btn-ignore { border-color: #8a7a5e; }
.btn-ignore:hover { background: rgba(136,136,136,0.3); border-color: #b8a078; }
.btn-count { border-color: #1e3a5f; }
.btn-count:hover { background: rgba(96,165,250,0.2); border-color: #60a5fa; color: #60a5fa; }
.btn-watch { border-color: #854d0e; }
.btn-watch:hover { background: rgba(251,191,36,0.2); border-color: #fbbf24; color: #fbbf24; }

/* Actor tag badges */
.tag { padding: 1px 6px; border-radius: 3px; font-size: 9px; margin-left: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.tag-scanner { background: rgba(248,113,113,0.2); color: #f87171; }
.tag-dealer { background: rgba(74,222,128,0.2); color: #4ade80; }
.tag-borrower { background: rgba(96,165,250,0.2); color: #60a5fa; }
.tag-admin { background: rgba(251,191,36,0.2); color: #fbbf24; }
.tag-bot { background: rgba(184,160,120,0.15); color: #b8a078; }
.tag-ssti { background: rgba(248,113,113,0.2); color: #f87171; }
.tag-funder { background: rgba(251,146,60,0.2); color: #fb923c; }
.tag-compliance { background: rgba(168,85,247,0.2); color: #a855f7; }

/* Alert badge in sidebar */
.alert-badge { background: #f87171; color: #fff; border-radius: 50%; padding: 1px 6px; font-size: 10px; font-weight: bold; margin-left: 6px; }

/* Rule cards */
.rule-card { border-left: 3px solid #333; padding: 12px 16px; margin-bottom: 10px; background: #1e293b; border-radius: 0 4px 4px 0; }
.rule-name { font-weight: bold; font-size: 13px; }
.rule-match { color: #b8a078; font-size: 11px; margin-top: 4px; }
.rule-stats { color: #60a5fa; font-size: 12px; margin-top: 6px; }
.rule-actors { font-size: 11px; color: #b8a078; margin-top: 4px; }
.rule-actors a { color: #60a5fa; text-decoration: none; }
.rule-actors a:hover { text-decoration: underline; }

/* Alert cards */
.alert-card { padding: 14px 16px; border-radius: 6px; margin-bottom: 10px; }
.alert-info { background: #172554; border-left: 3px solid #60a5fa; }
.alert-warning { background: #422006; border-left: 3px solid #fbbf24; }
.alert-critical { background: #450a0a; border-left: 3px solid #f87171; }
.alert-dismissed { opacity: 0.4; }
.alert-title { font-weight: bold; font-size: 13px; }
.alert-detail { font-size: 12px; color: #aaa; margin-top: 6px; }
.alert-meta { font-size: 11px; color: #9a8a6e; margin-top: 6px; }
.alert-meta a { color: #60a5fa; text-decoration: none; }
.alert-meta a:hover { text-decoration: underline; }

/* Dismiss button */
.btn-dismiss { background: transparent; border: 1px solid #555; color: #b8a078; padding: 3px 10px; border-radius: 3px; font-family: inherit; font-size: 11px; cursor: pointer; }
.btn-dismiss:hover { border-color: #b8a078; color: #fff; }

/* Unmatched banner */
.unmatched-banner { background: #422006; border-radius: 4px; padding: 10px 14px; margin-top: 12px; color: #fbbf24; font-size: 12px; }
.unmatched-banner a { color: #fbbf24; }

/* Disposition badges for rules */
.badge-ignore { background: rgba(184,160,120,0.15); color: #b8a078; }
.badge-count { background: rgba(96,165,250,0.2); color: #60a5fa; }
.badge-watch { background: rgba(251,191,36,0.2); color: #fbbf24; }
.badge-block { background: rgba(248,113,113,0.2); color: #f87171; }
.badge-unknown { background: rgba(184,160,120,0.15); color: #b8a078; }
.badge-escalate { background: rgba(248,113,113,0.2); color: #f87171; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 2px; }
.tl-compressed { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #0f172a; border-radius: 4px; font-size: 12px; color: #8a7a5e; flex-wrap: wrap; }
.tl-samples { width: 100%; padding: 4px 0 2px 132px; }
.tl-sample { padding: 2px 0; font-size: 11px; color: #64748b; }
.tl-sample .tl-time { font-size: 10px; color: #475569; }
.tl-sample a { color: #475569; text-decoration: none; }
.tl-sample a:hover { color: #60a5fa; }
.tl-time { font-family: monospace; font-size: 11px; color: #8a7a5e; min-width: 120px; flex-shrink: 0; }
.tl-bar { flex: 0 0 80px; height: 6px; background: #1e293b; border-radius: 3px; overflow: hidden; }
.tl-bar-fill { display: block; height: 100%; background: #334155; border-radius: 3px; }
.tl-summary { color: #9a8a6e; font-size: 11px; }
.tl-event { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 4px; font-size: 12px; border-left: 3px solid #333; }
.tl-event.tl-watch { background: #1c1a00; border-left-color: #fbbf24; }
.tl-event.tl-escalate { background: #1a0000; border-left-color: #f87171; }
.tl-event.tl-unknown { background: #0f172a; border-left-color: #60a5fa; }
.tl-event.tl-count { background: #0f172a; border-left-color: #334155; }
.tl-icon { font-size: 14px; flex-shrink: 0; width: 20px; text-align: center; }
.tl-detail { flex: 1; }
.tl-detail a { color: #60a5fa; text-decoration: none; }
.tl-detail a:hover { text-decoration: underline; }
.tl-meta { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* Behavior badges */
.tl-badges { display: inline-flex; gap: 8px; flex-wrap: wrap; margin-left: 6px; }
.behavior-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.behavior-count { font-weight: 700; }
.behavior-actor {
  font-size: 14px;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s, transform 0.15s;
  cursor: pointer;
}
.behavior-actor:hover { opacity: 1; transform: scale(1.2); }
.behavior-actor.stalled { color: #fb923c; opacity: 1; }
.behavior-actor.errored { opacity: 1; }
.behavior-actor.streaming { opacity: 0.5; }
.behavior-has-stall { border: 1px solid rgba(251,146,60,0.4); }
.behavior-has-error { border: 1px solid rgba(248,113,113,0.5); }

/* Behavior colors — user behaviors */
.behavior-working_deal { background: rgba(74,222,128,0.15); color: #4ade80; }
.behavior-working_deal .behavior-actor { color: #4ade80; }
.behavior-reviewing_loan { background: rgba(96,165,250,0.15); color: #60a5fa; }
.behavior-reviewing_loan .behavior-actor { color: #60a5fa; }
.behavior-onboarding { background: rgba(168,85,247,0.15); color: #a855f7; }
.behavior-onboarding .behavior-actor { color: #a855f7; }
.behavior-awaiting_funder { background: rgba(251,191,36,0.15); color: #fbbf24; }
.behavior-awaiting_funder .behavior-actor { color: #fbbf24; }
.behavior-managing_portal { background: rgba(74,222,128,0.1); color: #86efac; }
.behavior-managing_portal .behavior-actor { color: #86efac; }
.behavior-admin { background: rgba(251,191,36,0.1); color: #fcd34d; }
.behavior-admin .behavior-actor { color: #fcd34d; }
.behavior-authenticating { background: rgba(148,163,184,0.15); color: #94a3b8; }
.behavior-authenticating .behavior-actor { color: #94a3b8; }
.behavior-browsing { background: rgba(148,163,184,0.1); color: #64748b; }
.behavior-browsing .behavior-actor { color: #64748b; }

.behavior-reviewing_applications { background: rgba(251,146,60,0.15); color: #fb923c; }
.behavior-reviewing_applications .behavior-actor { color: #fb923c; }
.behavior-compliance_review { background: rgba(168,85,247,0.15); color: #a855f7; }
.behavior-compliance_review .behavior-actor { color: #a855f7; }

/* Behavior colors — system behaviors */
.behavior-polling_funder { background: rgba(148,163,184,0.1); color: #64748b; }
.behavior-processing_workflow { background: rgba(96,165,250,0.1); color: #93c5fd; }
.behavior-funder_response { background: rgba(74,222,128,0.1); color: #86efac; }
.behavior-worker_error { background: rgba(248,113,113,0.2); color: #f87171; }
