:root {
  --bg: #07101f;
  --panel: #0d1829;
  --panel-2: #111f33;
  --line: #21334b;
  --text: #eff7ff;
  --muted: #91a5bf;
  --accent: #61dafb;
  --accent-2: #7cf7c5;
  --danger: #ff6b7f;
  --warn: #ffcf66;
  --good: #68e0a3;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 5%, rgba(53, 111, 173, 0.18), transparent 30%),
    radial-gradient(circle at 85% 0%, rgba(53, 172, 142, 0.11), transparent 28%),
    var(--bg);
}
button, input { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; }
.topbar {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 31, 0.86);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border: 1px solid #3b5b7e; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800; letter-spacing: -0.04em;
  background: linear-gradient(145deg, #173050, #0b1728);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.brand { font-size: 19px; font-weight: 750; letter-spacing: -0.02em; }
.brand span { color: var(--accent); font-weight: 650; }
.subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }
.status-wrap { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px;
  color: #c3d2e4; background: #0c192b; font-size: 12px; white-space: nowrap;
}
.badge-good { border-color: rgba(104,224,163,.35); color: #9ff0c4; background: rgba(60,173,112,.10); }
.badge-warn { border-color: rgba(255,207,102,.32); color: #ffe19b; background: rgba(255,207,102,.08); }
.badge-bad { border-color: rgba(255,107,127,.32); color: #ffadba; background: rgba(255,107,127,.08); }

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 16px;
  max-width: 1800px;
  margin: 0 auto;
}
.panel {
  background: linear-gradient(180deg, rgba(16,31,51,.96), rgba(11,23,40,.96));
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.sidebar, .agent-panel { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 108px); overflow: auto; }
.sidebar { padding: 14px; }
.agent-panel { padding: 14px; }
.workspace { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.compact-head { margin-bottom: 16px; }
.panel-head h2 { margin: 2px 0 0; font-size: 17px; letter-spacing: -0.02em; }
.eyebrow { color: #6c83a1; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.count-pill { min-width: 28px; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }

.incident-list { display: flex; flex-direction: column; gap: 9px; }
.incident-item {
  width: 100%; text-align: left; border: 1px solid transparent; border-radius: 11px;
  padding: 12px; background: #0a1525; cursor: pointer; transition: .18s ease;
}
.incident-item:hover { border-color: #2d4562; transform: translateY(-1px); }
.incident-item.selected { border-color: #356b91; background: linear-gradient(135deg, rgba(45,93,132,.27), rgba(13,29,49,.96)); }
.incident-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.incident-id { font-size: 11px; font-weight: 800; color: var(--accent); letter-spacing: .05em; }
.incident-name { margin-top: 9px; font-size: 13px; font-weight: 700; line-height: 1.35; }
.incident-meta { margin-top: 7px; color: var(--muted); font-size: 11px; }

.hero { padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.hero-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero h1 { margin: 4px 0 0; font-size: clamp(20px, 2vw, 28px); letter-spacing: -0.035em; }
.muted { color: var(--muted); margin: 8px 0 0; max-width: 800px; line-height: 1.55; font-size: 13px; }
.severity { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 850; }
.severity.p1, .severity-p1, .severity.mini.p1 { color: #ffc0c9; background: rgba(255,107,127,.12); border: 1px solid rgba(255,107,127,.34); }
.severity.p2, .severity.mini.p2 { color: #ffe19b; background: rgba(255,207,102,.10); border: 1px solid rgba(255,207,102,.32); }
.severity.p3, .severity.mini.p3 { color: #aee8ff; background: rgba(97,218,251,.09); border: 1px solid rgba(97,218,251,.28); }
.severity.mini { min-width: 30px; padding: 3px 6px; font-size: 9px; }
.hero-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.btn, .icon-btn {
  border: 1px solid #2b425e; background: #0d1a2c; border-radius: 10px; padding: 9px 12px;
  cursor: pointer; transition: .18s ease; font-size: 12px; font-weight: 700;
}
.btn:hover, .icon-btn:hover { border-color: #46688d; transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #1c6a90, #185479); border-color: #367da1; }
.icon-btn { padding: 6px 9px; color: var(--muted); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { padding: 16px; min-width: 0; }
.metric-label { color: var(--muted); font-size: 11px; }
.metric-value { margin-top: 8px; font-size: 28px; font-weight: 820; letter-spacing: -0.04em; }
.metric-value.compact { font-size: 23px; color: #c9f2ff; }
.metric-foot { margin-top: 5px; color: #617a98; font-size: 10px; }
.two-col { display: grid; grid-template-columns: 1.08fr .92fr; gap: 14px; }
.block { padding: 17px; }

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: grid; grid-template-columns: 44px 12px 1fr; gap: 10px; min-height: 67px; position: relative; }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; left: 59px; top: 23px; bottom: -2px; width: 1px; background: #253b56; }
.timeline-time { color: #6f88a7; font-size: 11px; padding-top: 2px; }
.timeline-marker { width: 10px; height: 10px; border-radius: 50%; margin-top: 3px; z-index: 2; box-shadow: 0 0 0 4px rgba(97,218,251,.06); background: var(--accent); }
.timeline-marker.deploy { background: #ab8cff; }
.timeline-marker.metric { background: var(--accent); }
.timeline-marker.alert { background: var(--danger); }
.timeline-marker.log { background: var(--warn); }
.timeline-title { font-weight: 760; font-size: 12px; }
.timeline-detail { color: var(--muted); font-size: 11px; line-height: 1.45; margin-top: 4px; }

.confidence { color: #9ff0c4; background: rgba(104,224,163,.08); border: 1px solid rgba(104,224,163,.24); border-radius: 999px; padding: 6px 9px; font-size: 10px; white-space: nowrap; }
.root-summary { margin: 0; font-size: 14px; line-height: 1.6; font-weight: 680; }
.evidence-list { margin-top: 15px; display: flex; flex-direction: column; gap: 8px; }
.evidence-item { display: grid; grid-template-columns: 18px 1fr; gap: 8px; color: var(--muted); font-size: 11px; }
.evidence-item span { color: var(--good); }
.evidence-item p { margin: 0; line-height: 1.45; }
.recommendation { margin-top: 16px; padding: 13px; background: rgba(97,218,251,.055); border: 1px solid rgba(97,218,251,.18); border-radius: 10px; }
.recommendation-title { font-size: 11px; color: #bfefff; font-weight: 800; }
.recommendation p { color: #afc1d6; font-size: 11px; line-height: 1.5; margin: 7px 0 10px; }
.human-gate { color: #ffd98b; font-size: 9px; border-top: 1px solid rgba(255,207,102,.16); padding-top: 9px; }

.search-wrap input {
  width: 190px; max-width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); background: #081423; outline: none; font-size: 11px;
}
.search-wrap input:focus { border-color: #3c6d92; }
.logs { background: #07121f; border: 1px solid #1a2c42; border-radius: 10px; overflow: hidden; }
.log-row { display: grid; grid-template-columns: 64px 52px 115px 1fr; gap: 9px; padding: 9px 11px; border-bottom: 1px solid #14263a; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; }
.log-row:last-child { border-bottom: 0; }
.log-ts { color: #6b849f; }
.log-level { font-weight: 800; }
.log-level.error { color: #ff91a1; }
.log-level.warn { color: #ffd77f; }
.log-level.info { color: #8bdcff; }
.log-service { color: #98aeca; }
.log-message { color: #c4d2e2; min-width: 0; overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 20px; text-align: center; font-size: 12px; }

.prompt-card { padding: 13px; background: linear-gradient(140deg, rgba(22,72,103,.36), rgba(11,25,43,.72)); border: 1px solid #2a526e; border-radius: 11px; }
.prompt-label { color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.prompt-card p { margin: 8px 0 0; font-size: 11px; line-height: 1.55; color: #c3d4e7; }
.tool-strip { display: flex; gap: 6px; flex-wrap: wrap; margin: 13px 0; }
.tool-chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; color: #a8bed7; border: 1px solid #253c56; background: #091727; padding: 5px 7px; border-radius: 999px; }
.activity { display: flex; flex-direction: column; gap: 9px; }
.activity-empty { min-height: 190px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); padding: 20px; border: 1px dashed #2a3d55; border-radius: 11px; }
.activity-empty p { margin: 9px 0 3px; font-size: 12px; font-weight: 700; color: #b6c6d8; }
.activity-empty span { font-size: 10px; line-height: 1.45; }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(97,218,251,.45); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 11px rgba(97,218,251,0); } 100% { box-shadow: 0 0 0 0 rgba(97,218,251,0); } }
.activity-item { padding: 11px; border: 1px solid #21384f; border-radius: 10px; background: #091625; }
.activity-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.activity-tool { color: #9de5ff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 800; }
.activity-time { color: #5f7692; font-size: 9px; }
.activity-source { color: #607894; font-size: 8px; margin-top: 3px; text-transform: uppercase; letter-spacing: .08em; }
.activity-item pre { overflow: auto; margin: 8px 0 0; padding: 8px; background: #06101c; border-radius: 7px; color: #93a9c2; font-size: 9px; line-height: 1.4; }
.activity-item p { margin: 7px 0 0; color: #b3c4d7; font-size: 10px; line-height: 1.4; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; padding: 10px 14px; background: #e9f7ff; color: #102134; border-radius: 9px; font-size: 12px; font-weight: 750; transition: .2s ease; z-index: 50; box-shadow: 0 12px 35px rgba(0,0,0,.28); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1250px) {
  .layout { grid-template-columns: 230px minmax(0, 1fr); }
  .agent-panel { position: static; grid-column: 1 / -1; max-height: none; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .two-col { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-actions { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 14px; align-items: flex-start; }
  .status-wrap { display: none; }
  .layout { padding: 10px; gap: 10px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-value { font-size: 22px; }
  .log-row { grid-template-columns: 54px 46px 1fr; }
  .log-service { display: none; }
  .block, .hero { padding: 14px; }
}
