/* CHAT AREA */
.chat-area {
  grid-area: main;
  display: flex;
  flex-direction: column;
  background: var(--bg-obsidian);
  overflow: hidden;
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  border-bottom: 1px solid var(--border-faint);
  flex-shrink: 0;
}

.chat-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

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

/* HOME SCREEN — Dashboard, NOT splash */
.home-screen {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.home-status-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-status-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-status-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(23, 232, 154, 0.5);
}
.home-status-indicator.investigating { background: var(--cyan); box-shadow: 0 0 8px rgba(21, 217, 255, 0.5); }
.home-status-indicator.error { background: var(--red); box-shadow: 0 0 8px rgba(255, 59, 79, 0.5); }

.home-status-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
}
.home-status-detail {
  font-size: 14px;
  color: var(--text-muted);
  margin-left: auto;
}

.home-status-summary {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.home-status-metric {
  font-size: 14px;
  color: var(--text-muted);
}
.home-status-metric strong {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--violet-bright);
  margin-right: 4px;
}

/* HOME CORE SECTION */
.home-core-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 24px 28px;
}

.home-core-wrap {
  display: flex;
  align-items: center;
  gap: 32px;
}

.home-core {
  width: 200px;
  height: 200px;
  flex-shrink: 0;
}

.home-core-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-core-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.home-core-state {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 2px;
}

.home-core-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 600px;
}

/* HOME SECTIONS */
.home-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* INCIDENT CARDS */
.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.home-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-faint);
  border-left: 3px solid var(--violet);
  border-radius: 4px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.home-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-default);
}
.home-card.severity-critical { border-left-color: var(--red); }
.home-card.severity-high { border-left-color: var(--amber); }
.home-card.severity-normal { border-left-color: var(--green); }

.home-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.home-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.home-card-sev {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 2px;
  text-transform: uppercase;
}
.home-card-sev.critical { color: var(--red); background: rgba(255, 59, 79, 0.1); }
.home-card-sev.high { color: var(--amber); background: rgba(245, 166, 35, 0.1); }
.home-card-sev.normal { color: var(--green); background: rgba(23, 232, 154, 0.1); }

.home-card-detail {
  font-size: 13px;
  color: var(--text-muted);
}
.home-card-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

/* SUGGESTIONS */
.home-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suggestion-btn {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-faint);
  border-radius: 4px;
  font-size: 15px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.suggestion-btn::before {
  content: '▶';
  font-size: 10px;
  color: var(--violet);
  flex-shrink: 0;
}
.suggestion-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
}

/* MESSAGES */
.message {
  display: flex;
  gap: 14px;
  width: 100%;
}

.message-user {
  justify-content: flex-end;
}

.message-bubble {
  padding: 14px 18px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.message-user .message-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  max-width: 75%;
}

.message-assistant .message-bubble {
  background: transparent;
  border: 1px solid var(--border-faint);
  max-width: 100%;
}

.message-error .message-bubble {
  background: rgba(255, 59, 79, 0.05);
  border: 1px solid rgba(255, 59, 79, 0.2);
  color: var(--red);
}

.message-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.message-assistant .message-avatar {
  background: linear-gradient(135deg, var(--violet-dim), var(--violet));
  color: white;
}
.message-user .message-avatar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* INVESTIGATION PANEL */
.investigation-panel {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.investigation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-graphite);
  border-bottom: 1px solid var(--border-faint);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--cyan);
  text-transform: uppercase;
}

.investigation-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  animation: inv-pulse 1s ease-in-out infinite;
}
@keyframes inv-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.investigation-body {
  display: flex;
  gap: 0;
  min-height: 200px;
}

.investigation-timeline {
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-right: 1px solid var(--border-faint);
  overflow-y: auto;
  max-height: 400px;
}

.investigation-viz {
  width: 360px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.investigation-viz-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* TIMELINE STEPS */
.inv-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
}

.inv-step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--violet);
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
}
.inv-step-dot::after {
  content: '';
  position: absolute;
  top: 12px; left: 3px;
  width: 2px; height: 20px;
  background: var(--border-faint);
}
.inv-step:last-child .inv-step-dot::after { display: none; }

.inv-step-dot.active {
  background: var(--cyan);
  animation: inv-pulse 1s ease-in-out infinite;
}
.inv-step-dot.done { background: var(--green); }

.inv-step-content { flex: 1; }
.inv-step-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}
.inv-step-text {
  color: var(--text-secondary);
}
.inv-step-text strong { color: var(--cyan); }

/* TECH VIZ SVG */
.tech-viz-svg {
  width: 100%;
  height: 220px;
  background: var(--bg-obsidian);
  border-radius: 4px;
}

.tech-grid line {
  stroke: var(--border-faint);
  stroke-width: 0.5;
}

.tech-node {
  fill: var(--violet);
  filter: drop-shadow(0 0 3px var(--violet));
  animation: tech-node-pulse 2s ease-in-out infinite;
}
.tech-node-core {
  fill: var(--cyan);
  filter: drop-shadow(0 0 4px var(--cyan));
  animation: tech-node-pulse 1.5s ease-in-out infinite;
}

@keyframes tech-node-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.tech-link {
  stroke: var(--violet-dim);
  stroke-width: 0.5;
  opacity: 0.3;
  stroke-dasharray: 2 2;
  animation: tech-flow 3s linear infinite;
}
@keyframes tech-flow {
  to { stroke-dashoffset: -8; }
}

.tech-pulse-1, .tech-pulse-2 {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 0.5;
  opacity: 0;
  animation: tech-ring-expand 2s ease-out infinite;
}
.tech-pulse-2 { animation-delay: 1s; }

@keyframes tech-ring-expand {
  0% { opacity: 0.6; r: 6; }
  100% { opacity: 0; r: 30; }
}

/* INPUT AREA */
.chat-input-area {
  flex-shrink: 0;
  padding: 14px 28px 10px;
  border-top: 1px solid var(--border-faint);
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  transition: all 0.2s ease;
  min-height: 72px;
}
.chat-input-wrapper:focus-within {
  border-color: var(--violet);
  box-shadow: 0 0 0 1px var(--violet), 0 0 12px rgba(139, 92, 246, 0.15);
}

.chat-input-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 72px;
  flex-shrink: 0;
  color: var(--violet);
  border-right: 1px solid var(--border-faint);
}
.chat-input-prompt svg { width: 20px; height: 20px; }

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  padding: 22px 16px;
  resize: none;
  min-height: 72px;
  max-height: 180px;
}
.chat-input::placeholder { color: var(--text-muted); }

.chat-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 72px;
  flex-shrink: 0;
  color: var(--text-muted);
  border-left: 1px solid var(--border-faint);
  border-radius: 0 6px 6px 0;
  transition: all 0.15s ease;
}
.chat-send:hover { color: var(--violet-bright); background: var(--bg-surface-hover); }
.chat-send:disabled { opacity: 0.3; cursor: not-allowed; }
.chat-send svg { width: 20px; height: 20px; }

.chat-input-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 0 4px;
}
.chat-input-hint kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-faint);
  border-radius: 3px;
  color: var(--text-muted);
}

/* RESPONSE BLOCKS */
.rb-incident {
  background: var(--bg-surface);
  border: 1px solid var(--border-faint);
  border-left: 3px solid var(--violet);
  border-radius: 4px;
  padding: 12px 14px;
  margin: 8px 0;
}
.rb-incident.severity-critical { border-left-color: var(--red); }
.rb-incident.severity-high { border-left-color: var(--amber); }
.rb-incident.severity-disaster { border-left-color: var(--red); }
.rb-incident.severity-average { border-left-color: var(--amber); }
.rb-incident.severity-warning { border-left-color: var(--cyan); }
.rb-incident.severity-information { border-left-color: var(--violet); }
.rb-incident.severity-not_classified { border-left-color: var(--text-muted); }

.rb-severity-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 2px;
  text-transform: uppercase;
}
.rb-severity-tag.critical, .rb-severity-tag.disaster { color: var(--red); background: rgba(255, 59, 79, 0.1); }
.rb-severity-tag.high, .rb-severity-tag.average { color: var(--amber); background: rgba(245, 166, 35, 0.1); }
.rb-severity-tag.warning { color: var(--cyan); background: rgba(21, 217, 255, 0.1); }
.rb-severity-tag.information, .rb-severity-tag.not_classified { color: var(--text-muted); background: var(--bg-surface); }

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

.rb-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.rb-meta-item { display: flex; gap: 4px; font-size: 13px; }
.rb-meta-label { color: var(--text-dim); }
.rb-meta-value { color: var(--text-secondary); font-family: var(--font-mono); }

.rb-analyze-btn {
  margin-top: 8px;
  padding: 6px 14px;
  background: var(--violet-dim);
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.rb-analyze-btn:hover { background: var(--violet); }

.rb-metric-group { margin: 8px 0; }
.rb-metric-group-title { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.rb-metric-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.rb-metric-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-faint);
  border-radius: 3px;
  font-size: 14px;
}
.rb-metric-name { color: var(--text-secondary); }
.rb-metric-value { font-family: var(--font-mono); color: var(--cyan); }

.rb-host-status { margin: 8px 0; }
.rb-host-items { display: flex; flex-direction: column; gap: 4px; }
.rb-host-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-faint);
  border-radius: 3px;
  font-size: 14px;
}
.rb-host-name { color: var(--text-secondary); }
.rb-host-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
}
.rb-host-badge.online { color: var(--green); background: rgba(23, 232, 154, 0.1); }
.rb-host-badge.offline { color: var(--red); background: rgba(255, 59, 79, 0.1); }

.rb-summary { margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.rb-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border-faint);
}
.rb-summary-item:last-child { border-bottom: none; }
.rb-summary-label { color: var(--text-muted); }
.rb-summary-value { font-family: var(--font-mono); color: var(--text-primary); }

/* MARKDOWN */
.message-bubble h1, .message-bubble h2, .message-bubble h3 { margin: 12px 0 6px; color: var(--text-primary); }
.message-bubble h1 { font-size: 22px; }
.message-bubble h2 { font-size: 19px; }
.message-bubble h3 { font-size: 17px; }
.message-bubble p { margin: 6px 0; }
.message-bubble ul, .message-bubble ol { margin: 6px 0; padding-left: 20px; }
.message-bubble li { margin: 3px 0; }
.message-bubble code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 1px 4px;
  background: var(--bg-surface);
  border-radius: 3px;
  color: var(--cyan);
}
.message-bubble pre {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-faint);
  border-radius: 4px;
  overflow-x: auto;
}
.message-bubble pre code { padding: 0; background: none; }
.message-bubble strong { color: var(--text-primary); }
.message-bubble a { color: var(--cyan); text-decoration: none; }
.message-bubble a:hover { text-decoration: underline; }
.message-bubble table { border-collapse: collapse; margin: 8px 0; width: 100%; }
.message-bubble th, .message-bubble td { border: 1px solid var(--border-faint); padding: 4px 8px; font-size: 12px; }
.message-bubble th { color: var(--text-muted); }

/* HISTORY */
.history-list { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.history-group { display: flex; flex-direction: column; gap: 6px; }
.history-day-label { font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 4px 0; }
.history-item {
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-faint);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.history-item:hover { background: var(--bg-surface-hover); border-color: var(--border-default); }
.history-item-title { font-size: 15px; color: var(--text-primary); margin-bottom: 2px; }
.history-item-meta { font-size: 13px; color: var(--text-dim); }
.history-empty { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }
.history-loading { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }

/* SCROLL TO BOTTOM */
.scroll-bottom-btn {
  position: absolute;
  bottom: 80px; right: 24px;
  width: 36px; height: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s;
}
.scroll-bottom-btn.visible { opacity: 1; }
