:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #667085;
  --line: #d9e0e8;
  --blue: #315c8c;
  --green: #1e7a55;
  --amber: #a86212;
  --red: #b42318;
  --shadow: 0 10px 30px rgba(24, 33, 47, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--blue); text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }

.appShell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #101822;
  color: white;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brandMark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #315c8c;
}
.brand h1 { margin: 0; font-size: 20px; letter-spacing: 0; }
.brand p { margin: 2px 0 0; color: #a8b3c2; font-size: 13px; }

.search {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a2635;
  border: 1px solid #2d3b4b;
  border-radius: 8px;
  padding: 0 12px;
}
.search input, .stack input, .chatForm input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
}

.companyList { display: flex; flex-direction: column; gap: 8px; }
.companyItem {
  text-align: left;
  display: grid;
  gap: 4px;
  border: 1px solid #2d3b4b;
  background: #162130;
  color: white;
  border-radius: 8px;
  padding: 12px;
}
.companyItem.active { border-color: #7fb2e8; background: #20334a; }
.itemTitle { font-weight: 700; }
.itemMeta { color: #a8b3c2; font-size: 13px; }

.content {
  min-width: 0;
  padding: 28px;
}

.heroBand {
  min-height: 190px;
  background: linear-gradient(120deg, #17324f, #245d67 55%, #edf2f7 55%);
  color: white;
  border-radius: 8px;
  padding: 26px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  box-shadow: var(--shadow);
}
.heroBand h2 { font-size: clamp(30px, 4vw, 54px); line-height: 1; margin: 4px 0 10px; letter-spacing: 0; max-width: 820px; }
.eyebrow { margin: 0; text-transform: uppercase; font-size: 12px; letter-spacing: .08em; color: #b9d9ef; font-weight: 800; }
.subtitle { max-width: 780px; margin: 0; color: #dceaf5; }
.heroActions { display: flex; gap: 10px; flex-wrap: wrap; }

.grid { display: grid; gap: 18px; margin-top: 18px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mainSplit { grid-template-columns: minmax(0, 1.3fr) minmax(360px, .7fr); align-items: start; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel.compact { background: #162130; border-color: #2d3b4b; box-shadow: none; padding: 14px; }
.panel h2, .panel h3 { margin: 0 0 12px; }
.panel p { line-height: 1.55; }
.panelHeader { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panelHeader h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
.muted { color: var(--muted); }
.sidebar .muted { color: #a8b3c2; }

.pill {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #e7edf4;
  color: #334155;
}
.pill.good { background: #dcf5e9; color: var(--green); }
.pill.warn { background: #fff0d9; color: var(--amber); }

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 750;
}
.button.primary { background: var(--blue); color: white; }
.button.secondary { background: white; color: var(--blue); border-color: #b8c9dc; }

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid #ffd28a;
  background: #fff7e8;
  color: #7a4300;
  border-radius: 8px;
}

.factRow {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}
.factRow span { color: var(--muted); }

.program {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.program span { color: var(--muted); font-size: 14px; }

.bullets { padding-left: 18px; margin: 0; }
.bullets li { margin: 0 0 10px; line-height: 1.45; }
.chartBox { height: 300px; min-width: 0; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button {
  border: 1px solid var(--line);
  background: white;
  padding: 8px 12px;
  border-radius: 8px;
  text-transform: capitalize;
}
.tabs button.active { background: var(--blue); border-color: var(--blue); color: white; }

details { border-top: 1px solid var(--line); padding: 12px 0; }
summary { font-weight: 800; cursor: pointer; }
details p { color: #344054; white-space: pre-wrap; }

.artifactList { display: grid; gap: 8px; }
.artifactList a {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}
.artifactList span { overflow-wrap: anywhere; }

.rerunGrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.rerun {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
}

.chatPanel { position: sticky; top: 28px; }
.messages {
  height: 520px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.message {
  border-radius: 8px;
  padding: 10px 12px;
  max-width: 92%;
  white-space: pre-wrap;
}
.message.assistant { background: white; border: 1px solid var(--line); }
.message.user { background: #dfeeff; align-self: flex-end; }
.message p { margin: 0; }
.sources { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sources span {
  background: #eef2f7;
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  font-size: 12px;
}
.chatForm {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  margin-top: 10px;
}
.chatForm input, .stack input {
  height: 40px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 0 10px;
}
.chatForm button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
}

.stack { display: grid; gap: 8px; }
.sectionToggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  background: transparent;
  border: 0;
  font-weight: 800;
  padding: 0;
}
.job {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #dbe6f3;
  font-size: 13px;
  padding: 8px 0;
  border-top: 1px solid #2d3b4b;
}
.status { font-weight: 800; }
.status.completed { color: #70d9a5; }
.status.failed { color: #ff9b90; }
.status.running, .status.queued { color: #ffd38a; }

.empty {
  min-height: 60vh;
  display: grid;
  place-items: center;
  color: var(--muted);
}

@media (max-width: 980px) {
  .appShell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .two, .mainSplit { grid-template-columns: 1fr; }
  .chatPanel { position: static; }
  .heroBand { background: #17324f; flex-direction: column; }
}

.ico { width: 18px; height: 18px; flex: 0 0 auto; }
.hidden { display: none !important; }
.fatal { min-height: 100vh; display: grid; place-items: center; padding: 32px; text-align: center; }
.barChart { display: grid; gap: 10px; }
.barRow { display: grid; grid-template-columns: minmax(160px, 1.2fr) minmax(120px, 2fr) 64px; align-items: center; gap: 10px; font-size: 13px; }
.barRow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barRow div { height: 18px; background: #edf2f7; border-radius: 4px; overflow: hidden; }
.barRow b { display: block; height: 100%; background: #315c8c; }
.barRow em { font-style: normal; color: var(--muted); text-align: right; }
@media (max-width: 720px) { .barRow { grid-template-columns: 1fr; } .barRow span { white-space: normal; } }
.rerunSuggestion {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #b8c9dc;
  background: #f2f7fc;
  border-radius: 8px;
}
.rerunSuggestion span { color: var(--muted); font-size: 13px; }
.rerunSuggestion button {
  width: fit-content;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  padding: 7px 10px;
  font-weight: 800;
}
.llmDebug { margin-top: 8px; color: var(--muted); font-size: 11px; }
.one { grid-template-columns: 1fr; }
.dashboardGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.dashboardCard { min-height: 320px; }
.thesisPanel p, .dashboardCard p { margin-top: 0; color: #344054; }
.factGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.factGrid div { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #f8fafc; min-width: 0; }
.factGrid span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.factGrid strong { overflow-wrap: anywhere; }
.miniList { display: grid; gap: 8px; margin-top: 12px; }
.miniRow { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.miniRow span { color: var(--muted); }
.pillRow { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.miniPill { display: inline-flex; border-radius: 999px; background: #eef4fb; color: #254d77; padding: 5px 8px; font-size: 12px; font-weight: 800; }
.na { color: var(--muted); padding: 12px 0; }
.program.thisCo { background: #f0f7ff; margin-left: -8px; margin-right: -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.timeline { display: grid; gap: 10px; }
.timelineItem { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.timelineItem span { color: var(--blue); font-weight: 900; }
.timelineItem strong { font-weight: 650; line-height: 1.35; }
@media (max-width: 980px) { .dashboardGrid, .factGrid { grid-template-columns: 1fr; } .timelineItem { grid-template-columns: 1fr; } }
.normalizedCard { display: flex; flex-direction: column; gap: 12px; }
.normalizedCard .panelHeader { min-height: 30px; margin-bottom: 0; }
.cardSummary {
  min-height: 74px;
  max-height: 112px;
  overflow: auto;
  padding-right: 4px;
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}
.fieldGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.field {
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #f8fafc;
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}
.field span, .normalizedRow span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.field strong {
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.listBlock {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  min-height: 164px;
}
.listBlock h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .04em;
}
.normalizedList {
  display: grid;
  gap: 7px;
  max-height: 250px;
  overflow: auto;
  padding-right: 4px;
}
.normalizedRow {
  display: grid;
  grid-template-columns: minmax(120px, .85fr) minmax(0, 1.35fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #edf1f5;
}
.normalizedRow:first-child { border-top: 0; }
.normalizedRow strong {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.normalizedBullets li {
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 9px;
}
@media (max-width: 1180px) { .fieldGrid { grid-template-columns: 1fr; } .cardSummary { min-height: 0; } }
@media (max-width: 720px) { .normalizedRow { grid-template-columns: 1fr; gap: 3px; } }
.job { align-items: flex-start; }
.jobMain { display: grid; gap: 4px; min-width: 0; }
.jobMain > div { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.jobKind { color: #dbe6f3; font-weight: 750; }
.jobMain p { margin: 0; color: #a8b3c2; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.cancelJob {
  border: 1px solid #5b2730;
  background: #3a1820;
  color: #ffb3bd;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 850;
}
.cancelJob:disabled { opacity: .6; }
