:root {
  color-scheme: dark;
  --bg: #10110f;
  --panel: #181a17;
  --panel-2: #20231f;
  --line: #363b33;
  --text: #e7e2d5;
  --muted: #a9aa9c;
  --accent: #73b7a5;
  --accent-2: #d2b15f;
  --danger: #d96d65;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
textarea {
  font: inherit;
}

.classification {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 20;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: var(--line);
  background: #0b0c0a;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
}

.classification-top {
  top: 0;
  border-bottom: 1px solid var(--line);
}

.classification-bottom {
  bottom: 0;
  border-top: 1px solid var(--line);
}

.shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 52px 0 58px;
}

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--line);
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 58px);
  line-height: 0.95;
}

h2 {
  font-size: 18px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(74px, 1fr));
  gap: 1px;
  min-width: min(100%, 520px);
  margin: 0;
  border: 1px solid var(--line);
  background: var(--line);
}

.status-grid div {
  min-width: 0;
  padding: 10px 12px;
  background: var(--panel);
}

.status-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.status-grid dd {
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.rfi-panel,
.brief-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.rfi-panel {
  display: grid;
  grid-template-columns: minmax(310px, 0.82fr) minmax(0, 1.18fr);
  min-height: 440px;
}

.rfi-workspace {
  min-width: 0;
}

.rfi-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.rfi-form label,
.stream-head,
.section-head {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}

.query-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
}

textarea {
  width: 100%;
  min-height: 74px;
  max-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  background: #0e100d;
  color: var(--text);
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(115, 183, 165, 0.16);
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 14px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#submitButton {
  min-width: 96px;
  background: #24362f;
  color: #f2fff9;
}

.examples,
.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.examples button,
.history-list button {
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
}

.history-block {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}

.history-empty {
  color: #737869;
  font-family: var(--sans);
  font-size: 13px;
  text-transform: none;
}

.stream-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 45px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #131511;
}

#streamStatus {
  color: var(--accent);
}

.phase-row,
.product-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #171915;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

#sourceCountText,
#copyStatus {
  color: var(--accent);
}

.coverage-warning {
  padding: 10px 16px;
  border-bottom: 1px solid #5d4a28;
  background: #211c12;
  color: var(--accent-2);
  font-size: 13px;
}

.product {
  margin: 0;
  padding: 18px;
  overflow: auto;
  color: #eee9dc;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.product-stream {
  height: 330px;
}

.product-actions {
  justify-content: flex-start;
  border-top: 1px solid var(--line);
}

.source-deck {
  border-top: 1px solid var(--line);
  background: #151711;
}

.source-deck summary {
  min-height: 42px;
  padding: 12px 16px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}

.source-list {
  display: grid;
  gap: 1px;
  max-height: 390px;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.source-item,
.source-empty {
  padding: 14px 16px;
  background: var(--panel);
}

.source-item h3 {
  margin: 7px 0;
  font-size: 14px;
  line-height: 1.25;
}

.source-item p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.source-item a {
  color: var(--accent);
  font-size: 13px;
}

.source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 11px;
}

.brief-panel .product {
  max-height: 720px;
}

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 20px, 720px);
    padding-top: 46px;
  }

  .masthead {
    display: block;
  }

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

  .rfi-panel {
    grid-template-columns: 1fr;
  }

  .rfi-form {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .query-row {
    grid-template-columns: 1fr;
  }

  #submitButton {
    min-height: 44px;
  }

  .product-stream {
    height: 48vh;
    min-height: 300px;
  }

  .phase-row,
  .product-actions {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 9px 14px;
  }
}

@media (max-width: 460px) {
  .shell {
    width: calc(100vw - 14px);
  }

  h1 {
    font-size: 34px;
  }

  .rfi-form,
  .product {
    padding: 14px;
  }

  .classification {
    font-size: 11px;
  }
}
