:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0d1018;
  color: #f5f0e8;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(77, 93, 150, 0.42) 0, transparent 34rem),
    linear-gradient(135deg, #0d1018 0%, #12192a 52%, #0b0e15 100%);
}

button,
input,
textarea {
  border: 0;
  border-radius: 14px;
  font: inherit;
}

button {
  background: #e5b567;
  color: #16110a;
  cursor: pointer;
  font-weight: 700;
  padding: 0.75rem 1rem;
  transition: filter 160ms ease, transform 160ms ease;
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

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

input,
textarea {
  background: #171d2b;
  border: 1px solid #31394f;
  color: #f5f0e8;
  padding: 0.75rem 1rem;
  width: 100%;
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

p,
h1,
h2,
h3 {
  margin-top: 0;
}

.hero {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1280px;
  padding: 2rem 1rem 1rem;
}

.hero h1 {
  margin: 0.25rem 0;
}

.hero p:last-child {
  margin-bottom: 0;
}

.hero-actions,
.inline-actions,
.quick-actions,
.chat-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.eyebrow,
.hint,
.empty,
small {
  color: #aab2c7;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.domain,
.top-nav a {
  border: 1px solid #e5b567;
  border-radius: 999px;
  color: #e5b567;
  padding: 0.6rem 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 auto;
  max-width: 1280px;
  padding: 0 1rem 1rem;
}

.top-nav a {
  background: rgba(18, 23, 35, 0.72);
  border-color: #31394f;
  color: #f5f0e8;
}

.notice {
  border-radius: 18px;
  margin: 0 auto 1rem;
  max-width: 1280px;
  padding: 0.85rem 1rem;
}

.notice.success {
  background: rgba(52, 168, 83, 0.14);
  border: 1px solid rgba(99, 210, 132, 0.48);
  color: #c9f7d5;
}

.notice.error {
  background: rgba(224, 92, 92, 0.14);
  border: 1px solid rgba(255, 128, 128, 0.5);
  color: #ffcaca;
}

.product-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(18rem, 0.9fr) minmax(0, 1.4fr);
  margin: 0 auto;
  max-width: 1280px;
  padding: 0 1rem 2rem;
}

.card {
  background: rgba(18, 23, 35, 0.92);
  border: 1px solid #2b3348;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  padding: 1rem;
}

.wide,
.chat-card {
  grid-column: span 2;
}

.section-head,
.card-row {
  align-items: flex-start;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.section-head h2,
.section-head h3 {
  margin-bottom: 0;
}

.section-head.compact {
  margin-bottom: 0.75rem;
}

.role-card,
.session-card,
.message,
.image-task,
.cache-panel,
.provider-card,
.context-box,
.editor-panel,
.mapping-panel,
.snapshot-panel,
.task-history,
.action-panel {
  background: #111724;
  border: 1px solid #283149;
  border-radius: 18px;
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
  padding: 0.85rem;
}

.role-card.selected,
.session-card.selected {
  border-color: #e5b567;
  box-shadow: inset 0 0 0 1px rgba(229, 181, 103, 0.25);
}

.subdued-panel {
  background: rgba(17, 23, 36, 0.65);
  border-style: dashed;
}

.role-list,
.session-list,
.provider-status,
.image-tasks,
.messages {
  display: grid;
  gap: 0.75rem;
}

.messages {
  max-height: 32rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.message {
  margin-top: 0;
}

.message.user {
  background: #172338;
  margin-left: 12%;
}

.message.assistant {
  margin-right: 12%;
}

.chat-meta {
  color: #aab2c7;
  margin: 0.75rem 0;
}

.chat-meta span,
.status-pill,
.chip-button,
.checkbox-row {
  background: rgba(49, 57, 79, 0.58);
  border: 1px solid #3a445d;
  border-radius: 999px;
  color: #d9e0f2;
  font-size: 0.86rem;
  padding: 0.38rem 0.68rem;
}

.status-pill.success,
.status-pill.succeeded {
  background: rgba(52, 168, 83, 0.14);
  border-color: rgba(99, 210, 132, 0.48);
  color: #c9f7d5;
}

.status-pill.failed {
  background: rgba(224, 92, 92, 0.14);
  border-color: rgba(255, 128, 128, 0.5);
  color: #ffcaca;
}

.status-pill.running,
.status-pill.queued,
.status-pill.remote_only,
.status-pill.caching {
  background: rgba(229, 181, 103, 0.14);
  border-color: rgba(229, 181, 103, 0.5);
  color: #f7dfb2;
}

.status-pill.cached {
  background: rgba(52, 168, 83, 0.14);
  border-color: rgba(99, 210, 132, 0.48);
  color: #c9f7d5;
}

.cache-panel {
  background: rgba(13, 16, 24, 0.58);
  margin-top: 0;
}

.cache-panel code {
  background: rgba(229, 181, 103, 0.12);
  border: 1px solid rgba(229, 181, 103, 0.34);
  border-radius: 8px;
  color: #f7dfb2;
  padding: 0.08rem 0.28rem;
}

.row-form,
.image-form {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 1rem;
}

.image-form {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.stack-form {
  display: grid;
  gap: 0.75rem;
}

.stack-form label {
  color: #aab2c7;
  display: grid;
  gap: 0.35rem;
}

.checkbox-row {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 0.45rem;
  justify-content: center;
}

.checkbox-row input {
  accent-color: #e5b567;
  width: auto;
}

.secondary-button,
.ghost-button,
.chip-button {
  background: transparent;
  border: 1px solid #3a445d;
  color: #f5f0e8;
}

.ghost-button {
  color: #e5b567;
}

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

.memory-list li + li {
  margin-top: 0.35rem;
}

.mapping-panel {
  background: rgba(13, 16, 24, 0.58);
}

.mapping-panel code {
  background: rgba(229, 181, 103, 0.12);
  border: 1px solid rgba(229, 181, 103, 0.34);
  border-radius: 8px;
  color: #f7dfb2;
  padding: 0.08rem 0.28rem;
}

.mapping-panel li + li {
  margin-top: 0.35rem;
}

.context-box pre {
  background: #0d1018;
  border: 1px solid #283149;
  border-radius: 14px;
  color: #d9e0f2;
  overflow: auto;
  padding: 0.85rem;
  white-space: pre-wrap;
}

.snapshot-panel,
.task-history,
.action-panel {
  background: rgba(13, 16, 24, 0.58);
}

.snapshot-panel summary,
.task-history summary {
  color: #e5b567;
  cursor: pointer;
  font-weight: 800;
  min-height: 2.5rem;
  padding: 0.35rem 0;
  touch-action: manipulation;
}

.snapshot-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.snapshot-grid div {
  background: rgba(23, 29, 43, 0.75);
  border: 1px solid #31394f;
  border-radius: 14px;
  padding: 0.75rem;
}

.snapshot-grid p {
  margin-bottom: 0;
}

.task-history ol {
  display: grid;
  gap: 0.45rem;
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}

.task-history li {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.image-placeholder {
  background: linear-gradient(135deg, #2a3149, #473657);
  border: 1px dashed #e5b567;
  border-radius: 16px;
  color: #f7dfb2;
  padding: 1rem;
  word-break: break-word;
}

.error-text {
  color: #ffcaca;
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .hero,
  .product-layout,
  .row-form,
  .image-form,
  .memory-grid,
  .snapshot-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .wide,
  .chat-card {
    grid-column: span 1;
  }

  .message.user,
  .message.assistant {
    margin-left: 0;
    margin-right: 0;
  }
}
