:root {
  color-scheme: dark;
  --bg: #080411;
  --panel: #0e091b;
  --line: rgba(226, 232, 240, 0.1);
  --line-strong: rgba(226, 232, 240, 0.18);
  --text: #f7fafc;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --violet: #6d28d9;
  --cyan: #38bdf8;
  --mint: #2dd4bf;
  --lime: #a3e635;
  --amber: #f59e0b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
* {
  box-sizing: border-box;
}
html,
body {
  min-height: 100%;
}
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
.shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #07020f;
  backdrop-filter: blur(20px);
}
.brand,
.rail-footer,
.search-box,
.top-actions,
.metric-strip,
.panel-head,
.composer,
.request-title,
.proof-grid article,
.evidence,
.bar-row {
  display: flex;
  align-items: center;
}
.brand {
  gap: 10px;
  min-height: 46px;
}
.brand-logo {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  object-fit: cover;
}
.brand strong,
.panel-head strong,
.request-title strong {
  display: block;
  font-weight: 700;
  letter-spacing: 0;
}
.brand span,
.panel-head span,
.metric-strip span,
.case-nav small,
.chat-log small,
.evidence span {
  color: var(--muted);
  font-size: 12px;
}
.search-box {
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}
.search-box svg {
  width: 16px;
  color: var(--muted);
}
.search-box input,
.composer input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}
.case-nav {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
}
.case-nav button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px;
  color: var(--soft);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}
.case-nav button:hover,
.case-nav button.active {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
}
.case-nav button.active {
  box-shadow: inset 3px 0 0 var(--mint);
}
.case-nav svg {
  width: 18px;
  color: var(--cyan);
}
.case-nav strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.case-nav b {
  justify-self: end;
  padding: 4px 7px;
  color: #07120f;
  font-size: 12px;
  border-radius: 8px;
  background: var(--lime);
}
.rail-footer {
  justify-content: space-between;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1118;
}
.rail-footer span,
.metric-strip small {
  color: var(--muted);
  font-size: 12px;
}
.workspace {
  min-width: 0;
  padding: 20px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.topbar p,
.panel-head span {
  margin: 0 0 4px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.02;
  letter-spacing: 0;
}
.top-actions {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.top-actions button,
.top-actions select,
.segmented button,
.composer button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.top-actions select {
  min-width: 150px;
  padding: 0 10px;
  outline: 0;
}
.top-actions button {
  padding: 0 12px;
}
.top-actions .primary,
.segmented button.active,
.composer button {
  color: #061210;
  border-color: transparent;
  background: var(--mint);
}
.top-actions .primary {
  background: var(--lime);
}
.top-actions svg,
.segmented svg,
.composer svg,
.proof-grid svg {
  width: 16px;
  height: 16px;
}
.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.metric-strip article,
.chat-panel,
.result-panel,
.insight-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 9, 28, 0.92);
  box-shadow: var(--shadow);
}
.metric-strip article {
  display: flex;
  min-height: 88px;
  padding: 14px;
  align-items: flex-start;
  flex-direction: column;
  justify-content: space-between;
}
.metric-strip strong {
  font-size: 24px;
  line-height: 1;
}
.grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(440px, 1.65fr) minmax(280px, 0.9fr);
  gap: 14px;
}
.chat-panel,
.result-panel,
.insight-panel {
  min-width: 0;
  overflow: hidden;
}
.panel-head {
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.panel-head.compact {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}
.segmented {
  display: inline-flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}
.segmented button {
  width: 34px;
  height: 30px;
  justify-content: center;
  padding: 0;
}
.chat-log,
.api-list,
.table-wrap {
  height: 522px;
  overflow: auto;
}
.chat-log,
.api-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.chat-log article,
.api-list article,
.proof-grid article,
.evidence,
.gates span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}
.chat-log article {
  padding: 10px;
}
.chat-log article.user {
  border-color: rgba(56, 189, 248, 0.32);
  background: rgba(56, 189, 248, 0.08);
}
.chat-log article.live-ai {
  border-color: rgba(109, 40, 217, 0.72);
  background: rgba(109, 40, 217, 0.22);
}
.chat-log p,
.api-list p {
  margin: 5px 0 0;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.45;
}
.composer {
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}
.composer input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.composer button {
  width: 40px;
  justify-content: center;
}
table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}
th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #0d131b;
}
td {
  color: var(--soft);
  font-size: 13px;
}
.api-list article {
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
}
.request-title {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.request-title span {
  padding: 4px 7px;
  color: #061210;
  font-size: 11px;
  font-weight: 800;
  border-radius: 8px;
  background: var(--cyan);
}
code {
  display: block;
  overflow: hidden;
  color: var(--lime);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proof-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}
.proof-grid article {
  min-height: 138px;
  align-items: flex-start;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
}
.proof-grid svg {
  color: var(--mint);
}
.proof-grid span,
.bar-row {
  color: var(--muted);
  font-size: 12px;
}
.proof-grid strong {
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.chart {
  display: grid;
  gap: 12px;
  padding: 14px;
}
.bar-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 42px;
  gap: 10px;
}
.bar-row div {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}
.bar-row b {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: var(--c);
}
.evidence {
  gap: 12px;
  margin: 0 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.24);
}
.evidence img {
  width: 82px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.evidence strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.35;
}
.gates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
}
.gates span {
  padding: 6px 8px;
  color: var(--soft);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.ai-state {
  display: grid;
  gap: 4px;
  margin: 0 14px 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}
.ai-state span,
.ai-state small {
  color: var(--muted);
  font-size: 12px;
}
.ai-state strong {
  font-size: 13px;
}
@media (max-width: 1180px) {
  .grid {
    grid-template-columns: minmax(270px, 0.9fr) minmax(420px, 1.5fr);
  }
  .insight-panel {
    grid-column: 1 / -1;
  }
}
@media (max-width: 860px) {
  .shell,
  .topbar,
  .grid {
    grid-template-columns: 1fr;
  }
  .rail {
    position: relative;
    height: auto;
  }
  .case-nav,
  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .topbar {
    display: grid;
  }
  .chat-log,
  .table-wrap,
  .api-list {
    height: 360px;
  }
}
@media (max-width: 560px) {
  .workspace,
  .rail {
    padding: 12px;
  }
  .case-nav,
  .metric-strip,
  .proof-grid {
    grid-template-columns: 1fr;
  }
  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    justify-content: stretch;
  }
  .top-actions select {
    width: 100%;
    min-width: 0;
  }
  .top-actions button {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
    justify-content: center;
  }
  .top-actions .primary {
    grid-column: 1 / -1;
  }
}
