:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --bg-soft: rgba(255, 255, 255, 0.72);
  --surface: rgba(255, 252, 246, 0.76);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --line: rgba(28, 34, 43, 0.12);
  --line-strong: rgba(28, 34, 43, 0.18);
  --text: #13202d;
  --muted: #5d6873;
  --accent: #136f63;
  --accent-soft: rgba(19, 111, 99, 0.14);
  --accent-warm: #c86f31;
  --accent-low: #8d3e2a;
  --shadow: 0 24px 60px rgba(18, 32, 45, 0.08);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(19, 111, 99, 0.12), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(200, 111, 49, 0.12), transparent 22%),
    linear-gradient(180deg, #f8f5ef 0%, #f3efe6 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(19, 32, 45, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 32, 45, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 72%);
}

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero,
.composer,
.board {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 32px;
  padding: 32px;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.hero::after,
.composer::after,
.board::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 36%);
}

.hero-copy,
.hero-meter,
.composer,
.board {
  position: relative;
  z-index: 1;
}

.eyebrow,
.meter-kicker,
.context-label,
.summary-label,
.insight-label,
.footer-label,
.field-label {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.eyebrow,
.meter-kicker,
.summary-label,
.context-label,
.insight-label,
.footer-label,
.field-label {
  color: var(--muted);
}

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  width: fit-content;
  margin: 0;
  padding: 0.18em 0.3em 0.48em 0.24em;
  background: linear-gradient(135deg, #173549, #136f63);
  clip-path: polygon(0 0, 100% 0, 100% 80%, 0 100%);
}

.brand-mark-text {
  display: block;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(4.2rem, 10vw, 7.2rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 0.8;
  text-transform: uppercase;
  color: #f8f5ef;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.04em;
}

h1 {
  max-width: 11ch;
  margin-top: 14px;
  font-size: clamp(2.5rem, 6vw, 4.6rem);
  line-height: 0.94;
}

.hero-copy h2 {
  font-size: 1.8rem;
}

.lede {
  max-width: 56ch;
  margin: 18px 0 0;
  font-size: 1.06rem;
  line-height: 1.6;
  color: var(--muted);
}

.hero-actions {
  margin-top: 32px;
  display: grid;
  gap: 12px;
  align-items: start;
}

.primary-button,
.secondary-button,
.sample-pill,
.mode-button {
  border: 0;
  cursor: pointer;
  font: inherit;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

.primary-button {
  width: fit-content;
  padding: 14px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #173549, #136f63);
  color: white;
  box-shadow: 0 16px 40px rgba(19, 111, 99, 0.26);
}

.primary-button:hover,
.secondary-button:hover,
.sample-pill:hover,
.mode-button:hover {
  transform: translateY(-1px);
}

.secondary-button {
  width: fit-content;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.microcopy,
.drawer-note,
.status-message,
.metric-note,
.context-block p,
.footer-block p,
.insight-panel p:last-child,
.summary-copy p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.hero-meter {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  border-radius: calc(var(--radius-xl) - 8px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.3)),
    radial-gradient(circle at 50% 0%, rgba(19, 111, 99, 0.15), transparent 55%);
}

.meter-stack {
  display: grid;
  gap: 22px;
  justify-items: center;
  text-align: center;
}

.mini-meter-ring,
.confidence-meter {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.mini-meter-ring {
  width: 196px;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.95) 0 54%, transparent 55% 100%),
    conic-gradient(var(--meter-color, var(--accent)) 0 var(--meter-progress, 0%), rgba(19, 32, 45, 0.08) 0 100%);
  box-shadow: inset 0 0 0 1px rgba(19, 32, 45, 0.04);
}

.mini-meter-core,
.confidence-core {
  display: grid;
  place-items: center;
  text-align: center;
}

.mini-meter-value,
.confidence-value {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.06em;
}

.mini-meter-value {
  font-size: 2.8rem;
}

.mini-meter-label,
.confidence-caption {
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-meter-text h2 {
  max-width: 14ch;
  margin: 6px auto 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1;
}

.hero-metrics {
  display: flex;
  gap: 10px;
  padding: 0;
  margin: 20px 0 0;
  list-style: none;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-metrics li,
.mode-chip,
.confidence-chip {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
}

.hero-metrics span,
.mode-chip {
  color: var(--muted);
}

.hero-metrics strong,
.confidence-chip {
  font-weight: 600;
}

.workspace {
  margin-top: 22px;
  display: grid;
  gap: 22px;
}

.composer,
.board {
  border-radius: var(--radius-xl);
  padding: 28px;
}

.section-heading {
  max-width: 48rem;
}

.section-heading h2 {
  margin-top: 4px;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.02;
}

.sample-strip,
.footer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sample-strip {
  margin-top: 20px;
}

.sample-strip[hidden] {
  display: none;
}

.sample-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid transparent;
  color: var(--text);
}

.sample-pill.is-selected {
  border-color: rgba(19, 111, 99, 0.4);
  background: var(--accent-soft);
}

.composer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 18px;
  margin-top: 20px;
}

.prompt-panel,
.context-panel,
.summary-panel,
.insight-panel,
.footer-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.prompt-panel,
.context-panel,
.summary-panel {
  padding: 20px;
}

.prompt-panel textarea,
.drawer-field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 16px 18px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
}

.prompt-panel textarea {
  resize: vertical;
  min-height: 160px;
  margin-top: 10px;
  line-height: 1.55;
}

.prompt-panel textarea:focus,
.drawer-field input:focus {
  outline: 2px solid rgba(19, 111, 99, 0.18);
  border-color: rgba(19, 111, 99, 0.4);
}

.composer-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.mode-button {
  padding: 10px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.mode-button.is-active {
  background: var(--text);
  color: white;
}

.settings-drawer {
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
}

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

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

.drawer-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-message {
  min-height: 1.5em;
  margin-top: 12px;
}

.status-message.is-error {
  color: var(--accent-low);
}

.status-message.is-success {
  color: var(--accent);
}

.context-panel {
  display: grid;
  gap: 14px;
}

.history-block {
  display: grid;
  gap: 12px;
}

.workspace-block {
  display: grid;
  gap: 12px;
}

.history-head {
  display: grid;
  gap: 4px;
}

.history-caption,
.history-empty {
  font-size: 0.88rem;
  color: var(--muted);
}

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

.workspace-meta {
  display: grid;
  gap: 6px;
}

.workspace-meta strong {
  font-size: 0.95rem;
}

.workspace-meta code {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(19, 32, 45, 0.06);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.83rem;
}

.workspace-reset {
  justify-self: start;
}

.history-item {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  text-align: left;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.history-item strong {
  font-size: 0.95rem;
}

.history-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-item-title {
  display: grid;
  gap: 4px;
}

.history-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.history-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(19, 111, 99, 0.1);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}

.history-item span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.history-item.is-active {
  border-color: rgba(19, 111, 99, 0.4);
  background: var(--accent-soft);
}

.history-item:hover {
  transform: translateY(-1px);
}

.context-block {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.context-block:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.board-topline,
.summary-head,
.board-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.board-topline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.board-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
  margin-top: 22px;
}

.summary-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  margin-top: 18px;
}

.confidence-meter {
  width: 220px;
  aspect-ratio: 1;
  --band-color: var(--accent);
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.97) 0 56%, transparent 57% 100%),
    conic-gradient(var(--band-color) 0 var(--progress, 0%), rgba(19, 32, 45, 0.08) 0 100%);
  box-shadow:
    inset 0 0 0 1px rgba(19, 32, 45, 0.06),
    0 18px 40px rgba(19, 32, 45, 0.08);
  transform: rotate(-90deg);
}

.confidence-core {
  transform: rotate(90deg);
}

.confidence-value {
  font-size: 3.6rem;
}

.summary-copy h3 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.96;
}

.summary-copy p {
  margin-top: 12px;
  font-size: 1.02rem;
}

.metric-rail {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.metric-row {
  display: grid;
  gap: 8px;
}

.metric-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.98rem;
}

.metric-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(19, 32, 45, 0.08);
  overflow: hidden;
}

.metric-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #31a78d);
  transition: width 640ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.insight-panel,
.footer-block {
  padding: 18px;
}

.insight-panel {
  min-height: 188px;
  opacity: 0;
  transform: translateY(12px);
  animation: riseIn 520ms ease forwards;
}

.insight-panel:nth-child(2) {
  animation-delay: 60ms;
}

.insight-panel:nth-child(3) {
  animation-delay: 120ms;
}

.insight-panel:nth-child(4) {
  animation-delay: 180ms;
}

.insight-label {
  margin: 0 0 12px;
}

.board-footer {
  margin-top: 18px;
  align-items: stretch;
}

.footer-block {
  flex: 1;
}

.footer-block-actions {
  max-width: 360px;
}

.hidden {
  display: none;
}

.confidence-low {
  --band-color: var(--accent-low);
}

.confidence-medium {
  --band-color: var(--accent-warm);
}

.confidence-high {
  --band-color: var(--accent);
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .hero,
  .composer-grid,
  .board-grid,
  .summary-layout,
  .board-footer {
    grid-template-columns: 1fr;
  }

  .hero-meter {
    min-height: auto;
    padding: 24px 0;
  }

  .composer-footer,
  .board-topline,
  .summary-head,
  .board-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .drawer-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .footer-block-actions {
    max-width: none;
  }
}

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

  .hero,
  .composer,
  .board {
    padding: 20px;
    border-radius: 24px;
  }

  h1 {
    margin-top: 10px;
    font-size: 2.6rem;
  }

  .brand-mark {
    padding: 0.18em 0.24em 0.42em 0.18em;
  }

  .brand-mark-text {
    font-size: clamp(3.4rem, 15vw, 5.1rem);
    letter-spacing: 0.05em;
  }

  .section-heading h2,
  .summary-copy h3 {
    font-size: 1.8rem;
  }

  .confidence-meter {
    width: min(74vw, 220px);
  }

  .summary-layout {
    justify-items: center;
  }
}
