:root {
  --ink: #0f1c24;
  --paper: #f4f7f8;
  --line: #d5dee3;
  --accent: #1a6b6b;
  --muted: #5c6b73;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.brand {
  display: grid;
  gap: 0.05rem;
  line-height: 1.05;
}

.brand__comita {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand__line {
  font-size: 0.68rem;
  letter-spacing: 0.42em;
  text-indent: 0.12em;
  text-transform: uppercase;
}

.brand__sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: 0.45rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.gate {
  max-width: 36rem;
  margin: 4rem auto;
  padding: 0 1.25rem;
}

.lede {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.45;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(18rem, 24rem) 1fr;
  min-height: 0;
}

.chat {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fff;
  min-height: 0;
}

.chat__meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
}

.chat__log {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bubble {
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  background: var(--paper);
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.4;
}

.bubble--user {
  border-color: var(--accent);
  background: #e8f3f3;
}

.bubble--assistant {
  background: #fff;
}

.bubble--error {
  border-color: #a33;
  color: #7a1f1f;
}

.chat__form {
  display: grid;
  gap: 0.5rem;
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--line);
}

.chat__form textarea {
  width: 100%;
  resize: vertical;
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
}

.preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper);
}

.preview__bar {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.preview__root {
  overflow: auto;
  padding: 2rem 1.5rem 3rem;
}

.preview-hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.15;
  max-width: 18em;
  margin: 0.4rem 0 0.75rem;
}

.preview-hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted);
}

.preview-section {
  margin-top: 2rem;
  max-width: 42rem;
}

.preview-section h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  margin: 0.35rem 0 0.5rem;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .chat {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 45vh;
  }
}
