:root {
  --bg: #efe7d8;
  --paper: #fffaf1;
  --paper-strong: #f8efdf;
  --ink: #1d1a15;
  --muted: #6b6256;
  --accent: #8d4f2b;
  --accent-strong: #5e2e12;
  --line: rgba(29, 26, 21, 0.12);
  --shadow: 0 20px 50px rgba(48, 31, 10, 0.12);
  --user: #213d63;
  --assistant: #f6e9d6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(141, 79, 43, 0.18), transparent 25%),
    linear-gradient(135deg, #f5efe2, #eadfcb 45%, #e4d8c8);
  min-height: 100vh;
}

.shell {
  display: grid;
  grid-template-columns: 390px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.82);
  backdrop-filter: blur(14px);
}

.brand h1,
.chat-header h2,
.panel h2 {
  font-family: "IBM Plex Serif", Georgia, serif;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent-strong);
}

.lede,
.muted {
  color: var(--muted);
}

.panel {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

label,
.panel h2 {
  display: block;
  margin: 0 0 12px;
  font-size: 0.95rem;
}

select,
textarea,
button {
  font: inherit;
}

input[type="file"],
input[type="text"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}

#pinned-summary {
  margin: 12px 0 0;
}

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

.participant-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  cursor: pointer;
}

.participant-copy {
  display: grid;
  gap: 4px;
}

.participant-role,
.participant-summary {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.card-grid div {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.card-grid dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
}

.card-grid dd {
  margin: 6px 0 0;
  color: var(--muted);
}

.feed-list {
  padding-left: 18px;
  margin: 0;
  color: var(--muted);
}

.forge-block h3 {
  margin: 12px 0 8px;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
}

.chat-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

.chat-header {
  display: flex;
  justify-content: flex-start;
  align-items: end;
  padding: 28px 32px 18px;
}

.mode-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(141, 79, 43, 0.12);
  color: var(--accent-strong);
  font-size: 0.82rem;
}

.composer-pill {
  grid-column: 1 / -1;
  justify-self: start;
  margin-bottom: -2px;
}

.closeout-panel {
  grid-column: 1 / -1;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 241, 0.92);
  box-shadow: var(--shadow);
}

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

.closeout-grid div {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.closeout-grid dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
}

.closeout-grid dd {
  margin: 6px 0 0;
  line-height: 1.5;
}

#closeout-question {
  margin: 12px 0 0;
}

.progress-panel {
  grid-column: 1 / -1;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(248, 239, 223, 0.9);
  box-shadow: var(--shadow);
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.progress-copy .eyebrow,
.progress-copy .muted {
  margin: 0;
}

.progress-bar {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 10px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(141, 79, 43, 0.12);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b76632, #8d4f2b 50%, #5e2e12);
  transition: width 220ms ease;
}

.progress-fill.progress-live {
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.18) 0%,
      rgba(255, 255, 255, 0.36) 16%,
      rgba(183, 102, 50, 0.92) 16%,
      rgba(141, 79, 43, 0.98) 50%,
      rgba(94, 46, 18, 0.98) 84%,
      rgba(255, 255, 255, 0.18) 100%
    );
  background-size: 220% 100%;
  animation: progress-sweep 1.2s linear infinite;
}

.progress-fill.progress-queued {
  background: linear-gradient(90deg, #d8b774, #b98f47 60%, #8d4f2b);
}

.progress-fill.progress-idle {
  background: linear-gradient(90deg, #c8b69c, #ab9b86 60%, #8c7f70);
}

.runtime-panel {
  background: rgba(255, 250, 241, 0.94);
}

.runtime-stack {
  display: flex;
  overflow: hidden;
  width: 100%;
  height: 12px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(29, 26, 21, 0.08);
}

.runtime-segment {
  height: 100%;
  width: 0%;
  transition: width 220ms ease;
}

.runtime-completed {
  background: #577b46;
}

.runtime-active {
  background: #b76632;
}

.runtime-pending {
  background: #d8b774;
}

.runtime-blocked {
  background: #8b2d2d;
}

@keyframes progress-sweep {
  0% {
    background-position: 220% 0;
  }
  100% {
    background-position: -40% 0;
  }
}

#runtime-next {
  margin: 12px 0 0;
}

.messages {
  padding: 12px 32px 24px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  max-width: 820px;
  padding: 16px 18px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.message.user {
  align-self: end;
  background: var(--user);
  color: #f5f8ff;
}

.message.assistant {
  align-self: start;
  background: var(--assistant);
}

.message-role {
  margin: 0 0 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.message-body {
  margin: 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 20px 32px 30px;
}

button {
  align-self: end;
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  background: var(--accent);
  color: #fff7f0;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  width: 100%;
  margin-top: 12px;
  background: #eadbc6;
  color: var(--accent-strong);
}

#upload-status {
  margin: 12px 0 0;
}

.troubleshooting-body {
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.troubleshooting-shell {
  width: min(860px, 100%);
  display: grid;
  gap: 20px;
}

.troubleshooting-hero {
  padding: 10px 4px 0;
}

.troubleshooting-hero h1 {
  margin: 0 0 12px;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.troubleshooting-hero .lede {
  max-width: 62ch;
  line-height: 1.6;
}

.troubleshooting-panel {
  padding: 24px;
}

.troubleshooting-form {
  display: grid;
  gap: 14px;
}

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

.troubleshooting-grid-wide {
  grid-column: 1 / -1;
}

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

.upload-tip {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(248, 239, 223, 0.9);
  color: var(--muted);
}

.upload-results {
  margin: 0;
  padding-left: 0;
  list-style: none;
  color: var(--muted);
  display: grid;
  gap: 12px;
}

.upload-result-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.95);
}

.upload-result-title {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.upload-result-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.upload-result-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(141, 79, 43, 0.12);
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
}

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

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

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

  .chat-header,
  .messages,
  .composer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .troubleshooting-shell {
    width: min(100%, 760px);
  }
}

@media (max-width: 720px) {
  .troubleshooting-body {
    padding: 18px 12px 28px;
  }

  .troubleshooting-panel {
    padding: 18px;
    border-radius: 20px;
  }

  .troubleshooting-grid,
  .upload-tip-grid {
    grid-template-columns: 1fr;
  }

  .troubleshooting-hero h1 {
    font-size: clamp(1.7rem, 10vw, 2.4rem);
  }

  .upload-result-links {
    flex-direction: column;
  }

  .upload-result-links a,
  button {
    width: 100%;
    justify-content: center;
  }
}
