:root {
  --bg: #eef3f4;
  --ink: #172126;
  --muted: #647176;
  --panel: #ffffff;
  --line: #d3dcdf;
  --info: #0f7f8c;
  --recipient: #b65c31;
  --cpp: #5b6fca;
  --share: #23835b;
  --ask: #9d6a05;
  --stop: #9f3e3e;
  --mark: #ffe680;
  --shadow: 0 18px 36px rgba(20, 37, 43, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 22px;
  padding: 22px 28px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(238, 243, 244, 0.94);
  backdrop-filter: blur(14px);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.1;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 15px;
}

h4 {
  font-size: 13px;
  margin-bottom: 8px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.tab,
.source-tab,
.jump-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
  color: var(--muted);
  padding: 0 13px;
  cursor: pointer;
}

.tab.is-active,
.source-tab.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

main {
  padding: 24px 28px 34px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}

.decision-stage,
.setting-panel,
.panel,
.scenario-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.decision-stage {
  padding: 18px;
}

.stage-top,
.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.decision-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.decision-chip.share {
  background: var(--share);
}

.decision-chip.dont_share {
  background: var(--stop);
}

.decision-chip.ask_user {
  background: var(--ask);
}

.decision-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.decision-card div,
.input-block {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbfb;
  padding: 12px;
}

.decision-card span,
.input-block span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.decision-card strong {
  display: block;
  font-size: 14px;
  line-height: 1.45;
}

.evidence-lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.lane {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfc;
}

.lane-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  margin-bottom: 12px;
  color: white;
  font-weight: 900;
}

.lane-info .lane-icon {
  background: var(--info);
}

.lane-recipient .lane-icon {
  background: var(--recipient);
}

.lane-cpp .lane-icon {
  background: var(--cpp);
}

.lane p {
  min-height: 54px;
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.evidence-pill {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  margin: 8px 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 7px;
  background: white;
  text-align: left;
  cursor: pointer;
}

.evidence-pill.information {
  border-left-color: var(--info);
}

.evidence-pill.recipient {
  border-left-color: var(--recipient);
}

.evidence-pill.cpp {
  border-left-color: var(--cpp);
}

.evidence-pill span {
  font-weight: 800;
  font-size: 13px;
}

.evidence-pill b {
  color: var(--muted);
  font-size: 12px;
}

.evidence-pill small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.setting-panel,
.panel {
  padding: 16px;
}

.setting-flow {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.setting-flow div {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 9px;
  align-items: center;
}

.setting-flow strong {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
}

.setting-flow span {
  font-weight: 800;
}

dl {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 9px 12px;
  margin: 0;
  font-size: 13px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.explorer {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
}

.scenario-list {
  height: calc(100vh - 132px);
  overflow: auto;
  padding: 12px;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 8px;
  margin-bottom: 10px;
}

input,
select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 0 10px;
}

.scenario-row {
  display: grid;
  width: 100%;
  gap: 3px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.scenario-row.is-active {
  border-color: var(--ink);
  box-shadow: inset 4px 0 0 var(--ink);
}

.scenario-row span,
.scenario-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.three-panels {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.1fr) minmax(260px, 0.8fr);
  gap: 12px;
  margin-top: 12px;
}

.tag-section {
  margin-bottom: 14px;
}

.source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.source-view {
  min-height: 520px;
  max-height: 65vh;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef3f4;
  color: var(--ink);
}

mark {
  border-radius: 3px;
  background: var(--mark);
  color: #231d04;
  padding: 1px 2px;
}

mark.active-mark {
  outline: 2px solid #f2a900;
  box-shadow: 0 0 0 5px rgba(255, 230, 128, 0.4);
}

.persona-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.case-source-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--ink);
  border-radius: 8px;
  background: white;
  padding: 13px;
  margin-bottom: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #243036;
  font-size: 13px;
  line-height: 1.55;
}

.persona-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #243036;
  font-size: 13px;
  line-height: 1.6;
}

.chat-row {
  display: flex;
  margin: 10px 0;
}

.chat-row.agent {
  justify-content: flex-start;
}

.chat-row.user {
  justify-content: flex-end;
}

.chat-bubble {
  width: min(78%, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: #233036;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-row.user .chat-bubble {
  border-color: rgba(15, 127, 140, 0.24);
  background: #e8f6f7;
}

.chat-row.agent .chat-bubble {
  border-color: rgba(91, 111, 202, 0.22);
  background: #f6f7fd;
}

.bubble-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.bubble-head strong {
  color: var(--ink);
}

.score-chip {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  margin: 3px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef1fb;
  color: var(--cpp);
  font-size: 12px;
  font-weight: 800;
}

.input-block {
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.database-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.db-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.db-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
  padding: 11px;
}

.db-card p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.db-card span {
  color: var(--muted);
  font-size: 11px;
}

.cpp-row {
  display: grid;
  grid-template-columns: 150px 1fr 44px;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
}

.cpp-row div {
  height: 12px;
  border-radius: 999px;
  background: #e4e9ef;
  overflow: hidden;
}

.cpp-row i {
  display: block;
  height: 100%;
  background: var(--cpp);
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .hero-grid,
  .explorer,
  .three-panels,
  .database-shell,
  .evidence-lanes {
    grid-template-columns: 1fr;
  }

  .scenario-list {
    height: auto;
    max-height: 420px;
  }
}

@media (max-width: 720px) {
  .shell-head {
    align-items: start;
    flex-direction: column;
    padding: 18px 16px 12px;
  }

  main {
    padding: 16px;
  }

  .decision-card,
  .filter-row {
    grid-template-columns: 1fr;
  }
}
