:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e4e7ec;
  --text: #1a1d21;
  --muted: #6b7280;
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --danger: #ef4444;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.logo { font-size: 20px; }

.tabs { display: flex; gap: 4px; }
.tab {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}
.tab:hover { background: #f0f2f5; }
.tab.active { background: var(--accent); color: #fff; }

main { max-width: 1100px; margin: 24px auto; padding: 0 20px; }

.panel { display: none; }
.panel.active { display: block; }

.ask-box { display: flex; gap: 12px; align-items: flex-end; }
textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  min-height: 52px;
}
textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
button.primary:hover { background: var(--accent-strong); }
button.primary:disabled { opacity: 0.6; cursor: not-allowed; }

.status { color: var(--muted); margin: 12px 0; font-size: 14px; }
.status.error { color: var(--danger); }

.answer {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}
.answer-text { font-size: 15px; white-space: pre-wrap; }

.citations { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.citations h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.citation {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 14px;
}
.citation .meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.citation .meta b { color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; }
.card .num { font-size: 26px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }

.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 60px; gap: 8px; align-items: center; font-size: 13px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { background: #eef1f5; border-radius: 6px; height: 14px; overflow: hidden; }
.bar-row .fill { background: var(--accent); height: 100%; border-radius: 6px; }
.bar-row .val { color: var(--muted); text-align: right; }

.muted { color: var(--muted); font-size: 13px; }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 14px; }
