:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #182238;
  background: #f4f1ea;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f4f1ea; }
button, input, select, textarea { font: inherit; }

.page-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 32px auto;
}

.product-card {
  background: #fffdf8;
  border: 1px solid rgba(31, 45, 71, 0.12);
  border-radius: 24px;
  box-shadow: 0 18px 60px rgba(31, 45, 71, 0.10);
  overflow: hidden;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px 20px;
}

.eyebrow { font-size: 12px; letter-spacing: .18em; font-weight: 800; color: #876f3f; }
h1 { margin: 4px 0 0; font-size: clamp(28px, 4vw, 42px); }
.subtitle { margin: 8px 0 0; color: #6f7786; }
.status-badge {
  font-size: 12px;
  border-radius: 999px;
  padding: 8px 12px;
  background: #eef3ef;
  color: #3d5a45;
  white-space: nowrap;
}
.status-badge.error { background: #fff0ef; color: #8a4039; }

.notice {
  margin: 0 30px 20px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f0ede5;
  color: #5e6470;
  font-size: 13px;
}

.qa-panel {
  margin: 0 30px 24px;
  border: 1px solid rgba(31, 45, 71, 0.12);
  border-radius: 16px;
  padding: 14px;
  background: #faf8f3;
}
.qa-panel summary { cursor: pointer; font-weight: 700; }
.qa-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.qa-grid label { display: grid; gap: 6px; font-size: 12px; color: #666f7d; }
.qa-grid input, .qa-grid select {
  width: 100%;
  border: 1px solid #d9dce2;
  background: white;
  border-radius: 10px;
  padding: 9px 10px;
  color: #182238;
}
.qa-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.secondary {
  border: 1px solid #ccd2dc;
  background: white;
  color: #26344e;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}
.debug-box {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 11px;
  line-height: 1.45;
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 10px;
  background: #182238;
  color: #edf2fb;
  overflow: auto;
}

.assistant-shell {
  border-top: 1px solid rgba(31, 45, 71, 0.10);
  background: white;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid #eef0f3;
}
.chat-meta { color: #7c8491; font-size: 12px; margin-top: 3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #68a27a; box-shadow: 0 0 0 4px rgba(104, 162, 122, 0.13); }

.messages {
  height: min(52vh, 520px);
  min-height: 320px;
  overflow-y: auto;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fcfbf8;
}
.message { display: flex; }
.message.user { justify-content: flex-end; }
.bubble {
  max-width: min(76%, 720px);
  border-radius: 16px;
  padding: 12px 14px;
  line-height: 1.48;
  white-space: pre-wrap;
  word-break: break-word;
}
.message.assistant .bubble { background: white; border: 1px solid #e7e9ed; }
.message.user .bubble { background: #26344e; color: white; }
.message.error .bubble { background: #fff1ef; border: 1px solid #f0c5bf; color: #7f3a34; }
.message.pending .bubble { color: #737b88; }

.next-action {
  margin: 14px 24px 0;
  padding: 11px 13px;
  border: 1px solid #e2d7bd;
  background: #fbf6e9;
  color: #5e5238;
  border-radius: 12px;
  font-size: 13px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 18px 24px 24px;
}
.composer textarea {
  resize: vertical;
  min-height: 50px;
  max-height: 180px;
  border: 1px solid #d9dce2;
  border-radius: 14px;
  padding: 12px 13px;
  outline: none;
}
.composer textarea:focus { border-color: #8995aa; box-shadow: 0 0 0 3px rgba(59, 75, 105, .08); }
.composer button {
  align-self: end;
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  background: #26344e;
  color: white;
  padding: 0 18px;
  cursor: pointer;
}
.composer button:disabled { opacity: .55; cursor: wait; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 18px, 1080px); margin: 10px auto; }
  .product-card { border-radius: 18px; }
  .brand-row { padding: 20px 18px 16px; flex-direction: column; }
  .notice, .qa-panel { margin-left: 18px; margin-right: 18px; }
  .qa-grid { grid-template-columns: 1fr 1fr; }
  .messages { padding: 16px; height: 52vh; }
  .bubble { max-width: 88%; }
  .composer { grid-template-columns: 1fr; padding: 14px 16px 18px; }
  .composer button { min-height: 44px; }
}

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