:root {
  --ink: #17191f;
  --muted: #687080;
  --line: #dfe2e7;
  --paper: #ffffff;
  --canvas: #f5f6f8;
  --mustard: #ff9d1b;
  --mustard-dark: #cb6800;
  --blue: #2948ff;
  --success: #16834b;
  --warning: #a45b00;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, textarea { font: inherit; letter-spacing: 0; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.home { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 12px; font-weight: 750; font-size: 18px; }
.mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--mustard); border: 1px solid #d97b00; font-weight: 900; }
.mode { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.account-bar { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.text-button { padding: 7px 9px; border: 1px solid #cfd3da; background: #fff; color: var(--ink); border-radius: 4px; }
.text-button:hover { border-color: #8d95a3; }

main { width: min(1180px, calc(100% - 48px)); margin: 40px auto 72px; }
.login { width: min(460px, 100%); margin: 80px auto; background: var(--paper); border: 1px solid var(--line); padding: 40px; }
.login > p:not(.eyebrow) { margin: 14px 0 28px; color: var(--muted); }
.login #login-button { min-width: 120px; min-height: 46px; padding: 0 18px; background: var(--mustard); border: 1px solid #dc7900; font-weight: 800; border-radius: 4px; }
#login-status { color: var(--muted); font-size: 13px; }
#login-status.error { color: #b42318; }
.ask { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(420px, 1.2fr); gap: 56px; background: var(--paper); border: 1px solid var(--line); padding: 40px; }
.eyebrow { margin: 0 0 10px; color: var(--mustard-dark); font-weight: 800; font-size: 12px; }
h1, h2 { margin: 0; line-height: 1.08; }
h1 { font-size: 36px; }
h2 { font-size: 24px; }
.ask-copy > p:last-child { margin: 16px 0 0; max-width: 420px; color: var(--muted); line-height: 1.55; }

form { display: grid; gap: 10px; }
label { margin-top: 4px; font-size: 12px; font-weight: 800; color: #343946; text-transform: uppercase; }
input, textarea { width: 100%; border: 1px solid #cfd3da; background: #fff; padding: 14px 15px; color: var(--ink); outline: none; border-radius: 4px; }
textarea { resize: vertical; min-height: 116px; line-height: 1.45; }
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(41, 72, 255, .1); }
.form-footer { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 4px; }
#form-status { color: var(--muted); font-size: 13px; }
#form-status.error { color: #b42318; }
button { border: 0; cursor: pointer; }
#ask-button { min-width: 156px; min-height: 46px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: space-between; gap: 18px; background: var(--mustard); color: #111; border: 1px solid #dc7900; font-weight: 800; border-radius: 4px; }
#ask-button:hover { background: #ffab3b; }
#ask-button:disabled { cursor: wait; opacity: .65; }

.history { margin-top: 28px; background: var(--paper); border: 1px solid var(--line); }
.history-head { display: flex; align-items: center; justify-content: space-between; padding: 28px 30px; border-bottom: 1px solid var(--line); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #cfd3da; background: #fff; color: var(--ink); font-size: 21px; border-radius: 4px; }
.icon-button:hover { border-color: #8d95a3; }
.question-filters {
  display: flex;
  gap: 8px;
  padding: 14px 30px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.question-filter {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #cfd3da;
  border-radius: 4px;
  background: #fff;
  color: #4f5868;
  font-size: 13px;
  font-weight: 750;
}
.question-filter:hover { border-color: #8d95a3; color: var(--ink); }
.question-filter[aria-pressed="true"] { border-color: #dc7900; background: var(--mustard); color: #111; }
.question-filter-count {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 3px;
  background: #eef0f4;
  color: #596170;
  font-size: 11px;
  font-weight: 850;
}
.question-filter[aria-pressed="true"] .question-filter-count { background: rgba(255, 255, 255, .72); color: #111; }
.question-list { display: grid; }
.question-card { min-width: 0; padding: 26px 30px 28px; border-bottom: 1px solid var(--line); }
.question-card:last-child { border-bottom: 0; }
.question-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.person { color: var(--ink); font-weight: 750; }
.badge { padding: 3px 7px; border-radius: 3px; background: #eef0f4; color: #596170; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.badge.done { color: var(--success); background: #e9f7ef; }
.badge.error { color: #b42318; background: #ffefed; }
.badge.processing { color: var(--warning); background: #fff3df; }
.question-text { margin: 0; font-weight: 750; font-size: 17px; line-height: 1.45; white-space: pre-wrap; }
.answer-overview { margin-top: 20px; padding: 18px 20px 19px; background: #fff8ec; border: 1px solid #f1d8b3; }
.answer-label { margin: 0 0 9px; color: var(--mustard-dark); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.answer { color: #343946; line-height: 1.62; overflow-wrap: anywhere; }
.answer-primary { color: var(--ink); }
.answer-chart {
  width: 100%;
  max-width: 100%;
  margin: 12px 0 0;
  padding: 18px 18px 12px;
  border: 1px solid var(--line);
  background: #fff;
  overflow-x: auto;
}
.answer-chart svg { display: block; width: 100%; min-width: 680px; height: auto; }
.answer-chart-title { fill: var(--ink); font-size: 17px; font-weight: 800; }
.answer-chart-axis { fill: var(--muted); font-size: 11px; }
.answer-chart-grid { stroke: #e4e7eb; stroke-width: 1; }
.answer-chart-line { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.answer-chart-point { fill: #fff; stroke: var(--blue); stroke-width: 2; }
.answer-chart-fallback { margin: 0; white-space: pre-wrap; color: var(--muted); font-size: 12px; }
.answer p { margin: 0 0 10px; }
.answer p:last-child { margin-bottom: 0; }
.answer ul { margin: 8px 0 12px; padding-left: 22px; }
.answer a { color: var(--blue); }
.answer-details { margin-top: 10px; border-top: 1px solid var(--line); }
.answer-details summary { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #4f5868; font-size: 14px; font-weight: 750; cursor: pointer; list-style: none; }
.answer-details summary::-webkit-details-marker { display: none; }
.answer-details summary:hover { color: var(--ink); }
.details-chevron { flex: 0 0 auto; font-size: 22px; line-height: 1; transform: rotate(90deg); transition: transform .16s ease; }
.answer-details[open] .details-chevron { transform: rotate(-90deg); }
.answer-detail-body { padding: 4px 0 8px 18px; border-left: 3px solid var(--mustard); }
.pending { margin-top: 16px; color: var(--muted); display: flex; align-items: center; gap: 9px; font-size: 14px; }
.spinner { width: 14px; height: 14px; border: 2px solid #d6d9df; border-top-color: var(--mustard-dark); border-radius: 50%; animation: spin .9s linear infinite; }
.empty { min-height: 210px; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 6px; }
.empty strong { color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 800px) {
  .topbar { padding: 0 18px; }
  main { width: min(100% - 28px, 680px); margin-top: 20px; }
  .ask { grid-template-columns: 1fr; gap: 28px; padding: 26px 22px; }
  h1 { font-size: 30px; }
  .history-head, .question-filters, .question-card { padding-left: 22px; padding-right: 22px; }
  .answer-overview { padding: 16px; }
  .answer-chart { padding: 14px 12px 10px; }
  .form-footer { align-items: stretch; flex-direction: column; }
  #ask-button { width: 100%; }
  .mode { display: none; }
  .login { margin-top: 20px; padding: 28px 22px; }
}
