:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --muted: #667085;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-border: #c7d2fe;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --ok-border: #abefc6;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* header */
.top {
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; font-weight: 700; font-size: 16px; display: grid; place-items: center;
}
.brand > div:last-child { display: flex; flex-direction: column; min-width: 0; }
.name { font-weight: 650; font-size: 14px; letter-spacing: -0.01em; }
.sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: 11.5px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot.amber { background: #f59e0b; }
.dot.green { background: #12b76a; }
.dot.red { background: #f04438; }

/* main */
.app { max-width: 720px; margin: 0 auto; padding: 28px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
.ask h1 { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.lead { font-size: 13.5px; color: var(--text-2); margin-top: 6px; max-width: 560px; }

.input-row { margin-top: 16px; }
#query {
  width: 100%; resize: vertical; min-height: 84px;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 15px; font: inherit; color: var(--text); background: var(--surface);
  outline: none; transition: border-color .12s, box-shadow .12s;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
#query:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
#query::placeholder { color: #98a2b3; }

.actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.primary, .ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.primary {
  margin-left: auto; background: var(--accent); color: #fff;
  border: 1px solid var(--accent); padding: 10px 22px; font-size: 14px;
}
.primary:hover { background: var(--accent-hover); }
.primary:disabled { opacity: .55; cursor: default; }
.ghost {
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); padding: 9px 14px; font-size: 13px;
}
.ghost:hover { border-color: var(--border-strong); color: var(--text); }
.ghost svg { width: 16px; height: 16px; }
.ghost.rec { color: #b42318; border-color: #fda29b; background: #fef3f2; }
.ghost:disabled { opacity: .55; cursor: default; }
.asr { font-size: 11.5px; color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.examples { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.ex-label { font-size: 11.5px; color: var(--muted); }
.ex {
  font-size: 11.5px; color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; cursor: pointer;
  transition: border-color .12s, color .12s;
}
.ex:hover { border-color: var(--accent-border); color: var(--accent); }

/* answer card */
.answer-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
  padding: 18px;
  animation: rise .25s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ac-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.label {
  font-size: 11px; font-weight: 650; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.status { font-size: 11.5px; color: var(--muted); }
.status .dot { margin-right: 6px; vertical-align: 1px; }
.answer { font-size: 14.5px; color: var(--text); white-space: pre-wrap; }

.src-row { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.src-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.src-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 11px;
  color: var(--ok); background: var(--ok-soft); border: 1px solid var(--ok-border);
  border-radius: 7px; padding: 3px 9px;
}
.play { margin-top: 14px; }
.error {
  background: #fef3f2; border: 1px solid #fda29b; color: #b42318;
  border-radius: 12px; padding: 12px 14px; font-size: 13px;
}

/* excerpts */
.sources { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; background: #fafafa; }
.sources summary {
  cursor: pointer; padding: 10px 13px; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); list-style: none; display: flex; align-items: center;
}
.sources summary::before { content: '▸'; margin-right: 8px; transition: transform .12s; color: var(--muted); }
.sources[open] summary::before { transform: rotate(90deg); }
.ex-list { border-top: 1px solid var(--border); padding: 6px 13px 12px; display: flex; flex-direction: column; gap: 10px; }
.ex-item { border-left: 3px solid var(--accent-border); background: var(--surface); border-radius: 0 8px 8px 0; padding: 10px 12px; }
.ex-meta { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-bottom: 4px; }
.ex-text { font-size: 12.5px; color: var(--text-2); }

.foot { max-width: 720px; margin: 0 auto; padding: 0 20px 26px; font-size: 11px; color: var(--muted); text-align: center; }

@media (max-width: 480px) {
  .top { padding: 10px 12px; }
  .sub { display: none; }
  .app { padding: 20px 12px 32px; }
  .foot { padding: 0 12px 22px; }
  .ask h1 { font-size: 18px; }
}
