:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #172033;
  background: #f4f6f8;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 280px;
  background:
    radial-gradient(circle at 90% 0%, rgba(7, 193, 96, 0.08), transparent 260px),
    #f4f6f8;
}

button, textarea { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 440px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 14px 32px;
}

.app-header, .section-heading, .id-row, .editor-meta, .button-row {
  display: flex;
  align-items: center;
}

.app-header {
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 18px;
}

.eyebrow, .step {
  margin: 0 0 5px;
  color: #8a93a3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: 24px; letter-spacing: -0.03em; }
h2 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #dfe5e2;
  border-radius: 999px;
  background: rgba(255,255,255,0.75);
  color: #5c6676;
  font-size: 11px;
  font-weight: 600;
}

.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #07c160; box-shadow: 0 0 0 3px rgba(7,193,96,.12); }
.status-pill.error i { background: #e5484d; box-shadow: 0 0 0 3px rgba(229,72,77,.12); }

.runtime-banner { margin: -6px 0 12px; padding: 11px 13px; border: 1px solid #f0c8ca; border-radius: 11px; background: #fff5f5; color: #a52a2f; font-size: 11px; line-height: 1.55; }
.runtime-banner.hidden { display: none; }

.card {
  margin-bottom: 12px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(31, 42, 61, 0.07);
  border-radius: 16px;
  background: rgba(255,255,255,0.94);
  box-shadow: 0 5px 20px rgba(23,32,51,.035);
}

.section-heading { justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.section-heading.compact { margin-bottom: 12px; }

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #e6f9ee, #d8f5e5);
  color: #078846;
  font-weight: 700;
}

.id-row {
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f6f8fa;
  color: #8a93a3;
  font-size: 11px;
}

.id-row code { overflow: hidden; color: #4c586a; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; text-overflow: ellipsis; }
.count { color: #9ba3b1; font-size: 11px; }

.chat-list { display: flex; flex-direction: column; gap: 12px; }
.message { display: flex; flex-direction: column; align-items: flex-start; }
.message.agent { align-items: flex-end; }
.message-meta { margin: 0 4px 5px; color: #9ba3b1; font-size: 10px; }
.bubble { max-width: 88%; padding: 10px 12px; border-radius: 4px 14px 14px; background: #f1f3f5; color: #334055; font-size: 13px; line-height: 1.55; }
.agent .bubble { border-radius: 14px 4px 14px 14px; background: #e7f8ee; color: #176d42; }

.summary-box { display: flex; gap: 10px; padding: 13px; border: 1px solid #dcefe5; border-radius: 12px; background: linear-gradient(135deg, #f3fbf7, #f8fcfa); }
.summary-box p { margin: 0; color: #2b4c3a; font-size: 13px; font-weight: 600; line-height: 1.6; }
.sparkle { color: #07c160; font-size: 16px; }

.primary-button, .secondary-button, .send-button {
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}

.primary-button:active, .secondary-button:active, .send-button:active { transform: scale(.98); }
.primary-button:disabled, .secondary-button:disabled, .send-button:disabled { cursor: wait; opacity: .65; }
.primary-button { width: 100%; padding: 13px 16px; background: #07c160; color: #fff; box-shadow: 0 7px 16px rgba(7,193,96,.18); }
.primary-button span { margin-right: 6px; }

.reply-editor { margin-top: 14px; }
.reply-editor.hidden { display: none; }
.reply-editor label { display: flex; justify-content: space-between; margin-bottom: 8px; color: #475268; font-size: 12px; font-weight: 700; }
.reply-editor label span { color: #9ba3b1; font-weight: 500; }
textarea { width: 100%; resize: vertical; min-height: 180px; padding: 13px; border: 1px solid #dfe4e9; outline: none; border-radius: 12px; background: #fbfcfd; color: #263247; font-size: 13px; line-height: 1.65; transition: border-color .15s ease, box-shadow .15s ease; }
textarea:focus { border-color: #58cf8f; box-shadow: 0 0 0 3px rgba(7,193,96,.1); background: #fff; }
.editor-meta { justify-content: space-between; padding: 7px 2px 12px; color: #9ba3b1; font-size: 10px; }
.button-row { gap: 9px; }
.secondary-button, .send-button { flex: 1; padding: 12px; }
.secondary-button { border: 1px solid #e0e5e9; background: #fff; color: #596477; }
.send-button { background: #1e293b; color: #fff; }
.footnote { margin: 15px 0 0; color: #a0a8b5; font-size: 10px; text-align: center; }

.toast { position: fixed; right: 16px; bottom: 20px; left: 16px; z-index: 10; max-width: 400px; margin: auto; padding: 12px 16px; transform: translateY(24px); border-radius: 12px; background: #172033; color: #fff; box-shadow: 0 10px 30px rgba(23,32,51,.25); font-size: 12px; text-align: center; opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 340px) {
  .app-shell { padding-inline: 10px; }
  .card { padding: 14px; border-radius: 14px; }
  .status-pill { display: none; }
}
