:root {
  --bg: #f3ede2;
  --bg-strong: #e7ddcf;
  --card: rgba(252, 249, 243, 0.84);
  --card-strong: rgba(247, 241, 231, 0.96);
  --border: rgba(22, 37, 46, 0.12);
  --ink: #18242d;
  --muted: #5f6b72;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --alert: #9a3412;
  --warning: #92400e;
  --shadow: 0 24px 60px rgba(17, 24, 39, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --display-font: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --body-font: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body-font);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(154, 52, 18, 0.1), transparent 30%),
    linear-gradient(180deg, #f7f1e7 0%, var(--bg) 48%, #efe5d5 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(24, 36, 45, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 36, 45, 0.02) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black, transparent 90%);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

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

.brand {
  display: grid;
  gap: 6px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand h1 {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(2.2rem, 4vw, 4.4rem);
  font-weight: 700;
  line-height: 0.98;
}

.brand p {
  margin: 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.55;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(22, 37, 46, 0.08);
  color: var(--muted);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.nav a {
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(22, 37, 46, 0.08);
  color: var(--muted);
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.nav a:hover {
  transform: translateY(-2px);
}

.nav a.active {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.92), rgba(17, 94, 89, 0.96));
  color: #f8fafc;
  border-color: transparent;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border-radius: var(--radius-xl);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  animation: rise-in 420ms ease both;
}

.card::after {
  content: "";
  position: absolute;
  inset: auto -18% -60% auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.18), transparent 66%);
}

.card h2,
.card h3 {
  margin: 0 0 10px;
  font-family: var(--display-font);
  font-weight: 700;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-copy {
  display: grid;
  gap: 16px;
}

.hero-copy h2 {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(1.6rem, 2.4vw, 2.6rem);
  line-height: 1.05;
}

.hero-meta,
.summary-grid,
.stat-grid,
.section-grid,
.section-stack,
.detail-grid,
.button-row,
.list-stack {
  display: grid;
  gap: 14px;
}

.hero-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

.section-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.section-stack {
  margin-bottom: 18px;
}

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

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

.mini-card,
.list-item,
.metric,
.status-panel {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--card-strong);
  border: 1px solid rgba(22, 37, 46, 0.08);
}

.mini-card h3,
.list-item h3,
.metric h3,
.status-panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-family: var(--body-font);
  font-weight: 700;
}

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.big-number {
  font-family: var(--display-font);
  font-size: 2.3rem;
  line-height: 1;
}

.state-badge,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.state-active {
  background: rgba(21, 128, 61, 0.12);
  color: #166534;
}

.state-exact {
  background: rgba(21, 128, 61, 0.12);
  color: #166534;
}

.state-fresh {
  background: rgba(21, 128, 61, 0.12);
  color: #166534;
}

.state-ready {
  background: rgba(21, 128, 61, 0.12);
  color: #166534;
}

.state-completed {
  background: rgba(21, 128, 61, 0.12);
  color: #166534;
}

.state-stale {
  background: rgba(146, 64, 14, 0.12);
  color: #92400e;
}

.state-blocked {
  background: rgba(154, 52, 18, 0.12);
  color: #9a3412;
}

.state-degraded {
  background: rgba(154, 52, 18, 0.12);
  color: #9a3412;
}

.state-needs-human {
  background: rgba(21, 94, 117, 0.12);
  color: #155e75;
}

.state-needs-approval {
  background: rgba(146, 64, 14, 0.12);
  color: #92400e;
}

.state-ready-to-close {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent-strong);
}

.state-ready-for-review {
  background: rgba(146, 64, 14, 0.12);
  color: var(--warning);
}

.state-closed {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent-strong);
}

.state-service-ready {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent-strong);
}

.state-runtime-backed {
  background: rgba(15, 118, 110, 0.14);
  color: var(--accent-strong);
}

.state-curated {
  background: rgba(21, 94, 117, 0.12);
  color: #155e75;
}

.state-partial {
  background: rgba(146, 64, 14, 0.12);
  color: var(--warning);
}

.state-planned {
  background: rgba(24, 36, 45, 0.08);
  color: var(--ink);
}

.state-not-yet-surfaced {
  background: rgba(24, 36, 45, 0.08);
  color: var(--ink);
}

.state-operator-confirmed {
  background: rgba(21, 94, 117, 0.12);
  color: #155e75;
}

.state-sleeping {
  background: rgba(21, 94, 117, 0.08);
  color: #155e75;
}

.state-not-instrumented {
  background: rgba(24, 36, 45, 0.08);
  color: var(--ink);
}

.tag {
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.action-touch-next {
  background: rgba(15, 118, 110, 0.14);
  color: var(--accent-strong);
}

.action-blocked-needs-human {
  background: rgba(154, 52, 18, 0.12);
  color: var(--alert);
}

.action-defer {
  background: rgba(21, 94, 117, 0.1);
  color: #155e75;
}

.action-ready-to-review {
  background: rgba(146, 64, 14, 0.12);
  color: var(--warning);
}

.action-ready-to-close {
  background: rgba(21, 128, 61, 0.12);
  color: #166534;
}

.list-stack {
  margin-top: 14px;
}

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

.list-item-top,
.item-meta,
.split-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.item-meta,
.subtle {
  color: var(--muted);
  font-size: 0.94rem;
}

.section-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.portfolio-sequence-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.portfolio-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.14);
  color: var(--accent-strong);
  font-family: var(--display-font);
  font-size: 1.05rem;
  line-height: 1;
}

.portfolio-sequence-item .status-panel {
  margin-top: 2px;
}

.lane-facts {
  margin-top: 4px;
}

.lane-facts .mini-card {
  padding: 14px;
}

.button-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.button-row-triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.button-row-single {
  grid-template-columns: minmax(0, 1fr);
}

.button-row button,
.link-button {
  padding: 12px 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.94), rgba(17, 94, 89, 1));
  color: #f8fafc;
  text-align: center;
}

.link-button-secondary {
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  border: 1px solid rgba(22, 37, 46, 0.12);
}

.button-row button[disabled] {
  background: rgba(95, 107, 114, 0.18);
  color: rgba(24, 36, 45, 0.52);
  border: 1px solid rgba(22, 37, 46, 0.12);
  cursor: not-allowed;
}

.status-panel-blocked {
  margin-top: 2px;
  background:
    linear-gradient(180deg, rgba(154, 52, 18, 0.08), rgba(247, 241, 231, 0.96)),
    var(--card-strong);
  border-color: rgba(154, 52, 18, 0.16);
}

.status-panel-ready {
  margin-top: 2px;
  background:
    linear-gradient(180deg, rgba(21, 128, 61, 0.08), rgba(241, 248, 244, 0.96)),
    var(--card-strong);
  border-color: rgba(21, 128, 61, 0.16);
}

.field-value {
  display: block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
  word-break: break-word;
  white-space: normal;
}

.action-note {
  margin-top: 12px;
}

.action-feedback-error {
  color: #9a3412;
}

.banner {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.56);
  border: 1px dashed rgba(22, 37, 46, 0.16);
  color: var(--muted);
}

.session-grid {
  align-items: start;
}

.session-transcript,
.session-composer {
  margin-top: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(22, 37, 46, 0.08);
}

.session-transcript {
  display: grid;
  gap: 12px;
}

.chat-bubble {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(22, 37, 46, 0.08);
}

.chat-bubble-shell {
  margin-right: 18%;
}

.chat-bubble-user {
  margin-right: 14%;
  background: rgba(21, 94, 117, 0.08);
  border-color: rgba(21, 94, 117, 0.14);
}

.chat-bubble-assistant {
  margin-left: 10%;
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.16);
}

.chat-bubble-blocked {
  margin-left: 8%;
  background: rgba(154, 52, 18, 0.08);
  border-color: rgba(154, 52, 18, 0.14);
}

.chat-bubble-runtime-note {
  background: rgba(24, 36, 45, 0.04);
}

.transcript-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.transcript-time {
  color: var(--muted);
  font-size: 0.84rem;
}

.chat-bubble p {
  white-space: pre-wrap;
}

.composer-placeholder {
  min-height: 92px;
  margin: 10px 0 14px;
  padding: 16px;
  border-radius: 18px;
  border: 1px dashed rgba(22, 37, 46, 0.16);
  background: rgba(24, 36, 45, 0.03);
  color: var(--muted);
  line-height: 1.6;
}

.session-composer-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.composer-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.session-composer-input {
  width: 100%;
  min-height: 132px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(22, 37, 46, 0.14);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

.operator-session-input {
  min-height: 0;
  padding: 14px 16px;
  resize: none;
}

.session-composer-input:disabled {
  background: rgba(24, 36, 45, 0.03);
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-entry {
  position: relative;
  padding: 0 0 0 22px;
}

.timeline-entry::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-entry::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 20px;
  bottom: -14px;
  width: 1px;
  background: rgba(22, 37, 46, 0.12);
}

.timeline-entry:last-child::after {
  display: none;
}

.replay-step {
  display: grid;
  gap: 8px;
}

.replay-timeline {
  margin-top: 12px;
}

.footer {
  margin-top: 24px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .hero,
  .summary-grid,
  .section-grid,
  .detail-grid,
  .hero-meta,
  .stat-grid,
  .button-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .card,
  .mini-card,
  .list-item,
  .metric,
  .status-panel {
    padding: 18px;
  }

  .nav {
    gap: 8px;
  }

  .nav a {
    width: 100%;
    text-align: center;
  }
}
