:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #1f2523;
  --muted: #69706d;
  --line: #d9d3c8;
  --blue: #2d6cdf;
  --green: #1f8a5f;
  --amber: #b86b15;
  --red: #b84242;
  --teal: #047b83;
  --shadow: 0 14px 40px rgba(43, 39, 33, 0.08);
}

* {
  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,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #efe9df;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #363b38;
  border-radius: 8px;
  color: #ffffff;
  background: #262b29;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
}

.brand-subtitle,
.eyebrow,
.section-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}

.nav-item.active {
  border-color: #c8bfae;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.nav-glyph {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #d7ebe2;
  color: #135f43;
  font-size: 13px;
}

.runtime-card {
  margin-top: auto;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 253, 248, 0.72);
}

.runtime-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.runtime-row,
.runtime-skill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.runtime-row strong,
.runtime-skill strong {
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

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

h2 {
  font-size: 18px;
  line-height: 1.2;
}

h3 {
  font-size: 15px;
}

.topbar-actions,
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.action-row.compact {
  gap: 8px;
}

.solid-button,
.outline-button,
.ghost-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 800;
  white-space: nowrap;
}

.solid-button {
  border: 1px solid #1d2925;
  color: #ffffff;
  background: #1d2925;
}

.outline-button {
  border: 1px solid #b9b0a3;
  color: var(--ink);
  background: var(--surface-strong);
}

.ghost-button {
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
}

.language-button {
  min-width: 54px;
}

.full {
  width: 100%;
}

.view-root {
  min-width: 0;
}

.connection-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fffefa;
  box-shadow: var(--shadow);
}

.connection-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

.two-column-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.three-column-layout,
.public-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.public-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.full-span {
  grid-column: 1 / -1;
}

.work-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading,
.quote-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.flow-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.flow-step {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f5ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.flow-step.active {
  border-color: #345c51;
  color: #193c34;
  background: #d7ebe2;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.request-box {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fffefa;
  line-height: 1.55;
}

.parsed-grid,
.metric-grid,
.quote-grid,
.review-grid,
.tool-grid,
.agent-summary-grid {
  display: grid;
  gap: 12px;
}

.parsed-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.parsed-grid div,
.metric,
.rule-stack div,
.agent-summary-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffefa;
}

.parsed-grid span,
.metric span,
.rule-stack span,
.agent-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.parsed-grid strong,
.rule-stack strong,
.agent-summary-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 14px;
}

.span-2 {
  grid-column: span 2;
}

.quote-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.quote-card,
.review-card,
.event-item,
.tool-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-strong);
}

.tool-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.tool-card p {
  color: #454c49;
  font-size: 13px;
  line-height: 1.45;
}

.tool-card.blocked {
  border-color: #e0b0b0;
  background: #fff8f8;
}

.compact-notice {
  margin-top: 10px;
  padding: 9px;
}

.agent-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.quote-card.selected {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.quote-top span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.quote-price {
  margin: 10px 0;
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.quote-price span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quote-facts {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.compact-list {
  min-height: 78px;
  margin: 12px 0;
  padding-left: 18px;
  color: #39403d;
  font-size: 13px;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  max-width: 100%;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.badge-neutral {
  color: #343a37;
  background: #eee9df;
}

.badge-blue {
  color: #174f9a;
  background: #dfeaff;
}

.badge-green {
  color: #176143;
  background: #d9f0e4;
}

.badge-amber {
  color: #8a4c05;
  background: #f7e1c5;
}

.badge-red {
  color: #8b2525;
  background: #f3d5d5;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid #e6dfd2;
  padding-bottom: 9px;
}

.detail-list.compact {
  gap: 6px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

.notice-box,
.order-draft {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid #d3c0a1;
  border-radius: 8px;
  padding: 12px;
  background: #fff7e8;
  color: #40352b;
  line-height: 1.45;
}

.notice-box span,
.order-draft p {
  color: #5e554c;
  font-size: 13px;
}

.sandbox-wallet {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border: 1px dashed #a9b7c4;
  border-radius: 8px;
  padding: 12px;
  background: #f2f7fb;
  color: #2b3540;
}

.wallet-balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.wallet-balance strong {
  font-size: 24px;
}

.wallet-balance span {
  color: #5b6b7a;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.wallet-note {
  color: #5b6b7a;
  font-size: 12px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.green {
  background: var(--green);
}

.status-dot.amber {
  background: var(--amber);
}

.audit-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding-left: 20px;
  color: #414844;
  font-size: 13px;
}

.agent-trail {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.agent-trail li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffefa;
}

.agent-trail li.denied {
  border-color: #e0b0b0;
  background: #fff8f8;
}

.agent-trail div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.agent-trail span,
.agent-trail p {
  color: var(--muted);
  font-size: 13px;
}

.agent-trail code {
  display: inline-block;
  margin-top: 8px;
  color: #174f9a;
  font-size: 12px;
  word-break: break-all;
}

.agent-trail p {
  margin-top: 8px;
  line-height: 1.45;
}

.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.permission-list span {
  border: 1px solid #d7d0c4;
  border-radius: 999px;
  padding: 3px 7px;
  background: #fffefa;
  color: #39403d;
  font-size: 11px;
  font-weight: 800;
}

.application-list,
.rule-stack,
.event-list,
.runtime-list {
  display: grid;
  gap: 10px;
}

.application-item {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fffefa;
  color: var(--ink);
  text-align: left;
}

.application-item.active {
  border-color: var(--teal);
  background: #e4f4f3;
}

.application-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  background: #f5f1e9;
}

.segmented button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.segmented button.active {
  color: var(--ink);
  background: var(--surface-strong);
}

.review-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.runtime-skill {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fffefa;
}

.runtime-skill em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.runtime-command-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.runtime-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.runtime-skill-card,
.runtime-record,
.selected-skill {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffefa;
}

.runtime-skill-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  color: var(--ink);
  text-align: left;
}

.runtime-skill-card.active {
  border-color: var(--teal);
  background: #e4f4f3;
}

.runtime-record.active {
  border-color: var(--teal);
  background: #f1fbfa;
}

.runtime-skill-card span {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-skill-card strong {
  color: var(--muted);
  font-size: 12px;
}

.panel-heading.tight {
  margin-bottom: 10px;
}

.metric-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  line-height: 1;
}

.metric em {
  display: block;
  margin-top: 5px;
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.metric-blue em {
  color: var(--blue);
}

.metric-green em {
  color: var(--green);
}

.metric-amber em {
  color: var(--amber);
}

.metric-red em {
  color: var(--red);
}

.event-item {
  display: grid;
  gap: 10px;
}

.event-item p {
  color: #454c49;
  font-size: 13px;
  line-height: 1.45;
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-chart div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.bar-chart div::before {
  content: "";
  grid-column: 2;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) calc(var(--value) * 1%), #e1ddd4 0);
}

.bar-chart span {
  grid-column: 1;
  grid-row: 1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.bar-chart strong {
  grid-column: 3;
  grid-row: 1;
  font-size: 13px;
}

.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255, 253, 248, 0.92);
}

.session-bar > div {
  display: grid;
  gap: 3px;
}

.session-bar span,
.demo-label {
  color: var(--muted);
  font-size: 12px;
}

.session-form {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.session-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.session-form input {
  min-height: 38px;
  width: 210px;
  border: 1px solid #b9b0a3;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.credential-form input { width: min(360px, 60vw); }
.demo-label { display: block; margin-top: 4px; }

.task-list {
  display: grid;
  gap: 6px;
  margin: 4px 0;
}
