:root {
  --as-ink: #0c1f17;
  --as-ink-2: #2a4036;
  --as-muted: #5c7368;
  --as-line: #d7e4dc;
  --as-bg: #f3f7f4;
  --as-panel: #ffffff;
  --as-green: #1a8a4e;
  --as-green-dark: #0f6b3b;
  --as-green-soft: #e7f5ec;
  --as-accent: #0d9488;
  --as-radius: 16px;
  --as-shadow: 0 18px 50px rgba(12, 31, 23, 0.08);
  --as-font: "DM Sans", "Segoe UI", sans-serif;
  --as-display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.as-body {
  margin: 0;
  font-family: var(--as-font);
  color: var(--as-ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(26, 138, 78, 0.14), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(13, 148, 136, 0.12), transparent 50%),
    linear-gradient(180deg, #eef5f0 0%, var(--as-bg) 40%, #e8f0eb 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.as-wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 64px; }
.as-crumbs { padding: 18px 0 8px; font-size: 0.88rem; color: var(--as-muted); }
.as-crumbs a { color: var(--as-muted); text-decoration: none; }
.as-crumbs a:hover { color: var(--as-green-dark); }

.as-hero {
  padding: 28px 0 18px;
  display: grid;
  gap: 10px;
  max-width: 720px;
}
.as-hero .eyebrow {
  display: inline-flex;
  width: fit-content;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--as-green-dark);
  background: var(--as-green-soft);
  padding: 0.4em 0.9em;
  border-radius: 999px;
}
.as-hero h1 {
  margin: 0;
  font-family: var(--as-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 2.85rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--as-ink);
}
.as-hero p {
  margin: 0;
  color: var(--as-ink-2);
  font-size: 1.05rem;
  max-width: 54ch;
}

.as-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 22px;
  align-items: start;
  margin-top: 18px;
}

.as-panel {
  background: var(--as-panel);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius);
  box-shadow: var(--as-shadow);
  overflow: hidden;
}

.as-panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--as-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #fff, #f8fbf9);
}
.as-panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.as-steps {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.as-step-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef3f0;
  color: var(--as-muted);
}
.as-step-pill.on {
  background: var(--as-green);
  color: #fff;
}

.as-panel-body { padding: 18px; }

.as-verticals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: min(58vh, 520px);
  overflow: auto;
  padding-right: 4px;
}
.as-vert {
  text-align: left;
  border: 1px solid var(--as-line);
  background: #fbfdfc;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
  font: inherit;
  color: inherit;
}
.as-vert:hover { border-color: var(--as-green); transform: translateY(-1px); }
.as-vert.on {
  border-color: var(--as-green);
  background: var(--as-green-soft);
  box-shadow: inset 0 0 0 1px rgba(26, 138, 78, 0.25);
}
.as-vert .ico { font-size: 1.6rem; display: block; margin-bottom: 6px; }
.as-vert strong { display: block; font-size: 0.98rem; }
.as-vert small { display: block; margin-top: 4px; color: var(--as-muted); line-height: 1.35; }

.as-field { margin-bottom: 14px; }
.as-field label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--as-ink-2);
}
.as-field input,
.as-field select,
.as-field textarea {
  width: 100%;
  border: 1px solid var(--as-line);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
  color: var(--as-ink);
}
.as-field textarea { min-height: 88px; resize: vertical; }
.as-field input:focus,
.as-field select:focus,
.as-field textarea:focus {
  outline: 2px solid rgba(26, 138, 78, 0.25);
  border-color: var(--as-green);
}

.as-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.as-btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.as-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.as-btn-primary { background: var(--as-green); color: #fff; }
.as-btn-primary:hover:not(:disabled) { background: var(--as-green-dark); }
.as-btn-ghost {
  background: transparent;
  color: var(--as-ink-2);
  border: 1px solid var(--as-line);
}
.as-btn-ghost:hover:not(:disabled) { border-color: var(--as-green); color: var(--as-green-dark); }

.as-note {
  margin-top: 12px;
  font-size: 0.86rem;
  color: var(--as-muted);
  line-height: 1.45;
}
.as-alert {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff4e8;
  color: #7a3e00;
  font-size: 0.88rem;
}
.as-alert.ok {
  background: var(--as-green-soft);
  color: var(--as-green-dark);
}

.as-faq-block {
  margin-top: 8px;
}
.as-faq-title {
  margin: 0 0 6px;
  font-size: 0.98rem;
}
.as-faq-item {
  border: 1px solid var(--as-line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fbfdfc;
}
.as-faq-item .as-faq-q {
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--as-ink-2);
  margin-bottom: 6px;
}
.as-faq-item textarea {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--as-line);
  border-radius: 10px;
  padding: 10px 11px;
  font: inherit;
  resize: vertical;
}
.as-faq-item textarea:focus {
  outline: 2px solid rgba(26, 138, 78, 0.25);
  border-color: var(--as-green);
}
.as-profile-card {
  border: 1px solid var(--as-line);
  border-radius: 14px;
  padding: 14px;
  background: #fbfdfc;
  margin-bottom: 14px;
}
.as-profile-card h3 { margin: 0 0 8px; font-size: 0.95rem; }
.as-profile-card p { margin: 0 0 8px; color: var(--as-ink-2); font-size: 0.92rem; }
.as-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.as-tag {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3f0;
  color: var(--as-ink-2);
}

.as-embed {
  margin-top: 12px;
  background: #0c1f17;
  color: #d7efe3;
  border-radius: 12px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  word-break: break-all;
}

/* Preview chat */
.as-preview {
  position: sticky;
  top: 16px;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  z-index: 5;
  isolation: isolate;
}
.as-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0f2033, #123b2a);
  color: #fff;
}
.as-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}
.as-chat-head strong { display: block; font-size: 0.95rem; }
.as-chat-head small { opacity: 0.75; font-size: 0.78rem; }
.as-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f7faf8;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 360px;
  max-height: 460px;
}
.as-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.as-bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--as-line);
  color: var(--as-ink);
  border-bottom-left-radius: 4px;
}
.as-bubble.user {
  align-self: flex-end;
  background: var(--as-green);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.as-bubble--streaming {
  min-height: 1.45em;
}
.as-type-cursor {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--as-accent);
  animation: as-cursor-blink 0.85s step-end infinite;
}
.as-typing-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 88px;
}
.as-typing-label {
  font-size: 0.78rem;
  color: var(--as-muted);
  font-weight: 600;
}
.as-typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.as-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--as-green);
  opacity: 0.35;
  animation: as-typing-dot 1.1s ease-in-out infinite;
}
.as-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.as-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes as-cursor-blink {
  50% { opacity: 0; }
}
@keyframes as-typing-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .as-type-cursor,
  .as-typing-dots span {
    animation: none;
  }
}
.as-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
  background: #f7faf8;
  position: relative;
  z-index: 2;
}
.as-chip {
  border: 1px solid var(--as-line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--as-ink-2);
}
.as-chip:hover { border-color: var(--as-green); color: var(--as-green-dark); }
.as-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--as-line);
  background: #fff;
}
.as-chat-input input {
  flex: 1;
  border: 1px solid var(--as-line);
  border-radius: 999px;
  padding: 11px 14px;
  font: inherit;
}
.as-chat-input button {
  border: none;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--as-green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.as-empty-preview {
  margin: auto;
  text-align: center;
  color: var(--as-muted);
  padding: 40px 20px;
  max-width: 28ch;
  line-height: 1.45;
}

@media (max-width: 920px) {
  .as-layout { grid-template-columns: 1fr; }
  .as-preview { position: static; }
  .as-verticals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .as-verticals { grid-template-columns: 1fr; }
}
