/* FinTechCo review portal - Stripe-inspired design system */
:root {
  --bg: #f6f9fc;
  --surface: #ffffff;
  --surface-2: #f6f9fc;
  --ink: #0a2540;
  --muted: #425466;
  --accent: #635bff;
  --accent-ink: #ffffff;
  --border: #e6ebf1;
  --prio-a: #df1b41;
  --prio-b: #d97706;
  --prio-c: #1a936f;
  --pass: #1a936f;
  --fail: #df1b41;
  --skip: #d97706;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(10, 37, 64, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
[data-theme="dark"] {
  --bg: #0b1523;
  --surface: #16243a;
  --surface-2: #101c30;
  --ink: #e6ebf1;
  --muted: #9aa9bd;
  --accent: #8f88ff;
  --accent-ink: #0b1523;
  --border: #24344d;
  --shadow: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; overflow-y: scroll; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  transition: background 0.2s, color 0.2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header / nav */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 24px; height: 60px;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; }
.brand .brand-accent { color: var(--accent); }
a.brand { text-decoration: none; }
a.brand:hover { text-decoration: none; color: var(--accent); }
.nav {
  display: flex; gap: 4px; flex: 1; flex-wrap: nowrap; min-width: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 6px 12px; border-radius: var(--radius); color: var(--muted);
  font-size: 14px; font-weight: 500; white-space: nowrap; flex: 0 0 auto;
}
.nav a:hover { color: var(--ink); text-decoration: none; background: var(--surface-2); }
.nav a.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--muted); cursor: pointer; padding: 6px 10px; font-size: 14px; line-height: 1;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--accent); }
.utility-menu { position: relative; flex: 0 0 auto; }
.utility-toggle {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--muted); cursor: pointer; padding: 6px 10px; font-size: 14px; line-height: 1;
}
.utility-toggle:hover { color: var(--ink); border-color: var(--accent); }
.utility-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  min-width: 140px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.utility-dropdown a {
  display: block; padding: 8px 14px; font-size: 14px; font-weight: 500;
  color: var(--ink); white-space: nowrap;
}
.utility-dropdown a:hover { background: var(--surface-2); text-decoration: none; color: var(--accent); }
@media (max-width: 480px) {
  .header-inner { gap: 12px; padding: 0 14px; }
}

/* Layout */
.container { max-width: 1080px; margin: 0 auto; padding: 40px 24px 80px; }
.container.narrow { max-width: 780px; }
h1 { font-size: 32px; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 22px; letter-spacing: -0.01em; margin: 40px 0 12px; }
h3 { font-size: 17px; margin: 28px 0 8px; }
p.lede { color: var(--muted); font-size: 18px; margin: 0 0 28px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; }
pre code { background: none; border: none; padding: 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
@media (max-width: 640px) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Badges */
.badge {
  display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px;
  padding: 2px 10px; line-height: 1.6; vertical-align: middle;
}
.badge-a { background: color-mix(in srgb, var(--prio-a) 12%, transparent); color: var(--prio-a); }
.badge-b { background: color-mix(in srgb, var(--prio-b) 12%, transparent); color: var(--prio-b); }
.badge-c { background: color-mix(in srgb, var(--prio-c) 12%, transparent); color: var(--prio-c); }
.badge-pass { background: color-mix(in srgb, var(--pass) 12%, transparent); color: var(--pass); }
.badge-fail { background: color-mix(in srgb, var(--fail) 12%, transparent); color: var(--fail); }
.badge-skip { background: color-mix(in srgb, var(--skip) 12%, transparent); color: var(--skip); }
.badge-neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* Buttons & forms */
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: var(--radius); padding: 9px 18px; font-size: 14px;
  font-weight: 600; cursor: pointer; font-family: var(--font);
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
input, textarea, select {
  font-family: var(--font); font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin: 12px 0 4px; }
.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; }
.form-note { font-size: 13px; color: var(--muted); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { max-width: 380px; width: 100%; }
.login-card .brand { font-size: 20px; display: block; margin-bottom: 4px; }

/* Docs */
.docs-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; }
.docs-layout > * { min-width: 0; }
@media (max-width: 860px) { .docs-layout { grid-template-columns: minmax(0, 1fr); } }
.docs-toc { position: sticky; top: 80px; align-self: start; font-size: 14px; }
.docs-toc a { display: block; padding: 4px 10px; color: var(--muted); border-left: 2px solid var(--border); }
.docs-toc a.active, .docs-toc a:hover { color: var(--accent); border-left-color: var(--accent); text-decoration: none; }
.doc-body img, .doc-body svg { max-width: 100%; }
.mermaid-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; overflow-x: auto; text-align: center; }

/* Tests */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 720px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.stat .num { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.passbar { height: 10px; border-radius: 999px; overflow: hidden; display: flex; background: var(--surface-2); border: 1px solid var(--border); }
.passbar > div { height: 100%; }
.test-row { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; cursor: pointer; }
.test-row .t-name { flex: 1; }
.test-row .t-dur { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.test-detail { background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; margin: 4px 0 10px; font-size: 13px; }
.test-detail pre { margin: 8px 0 0; font-size: 12px; }

/* Recommendations */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 20px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.rec-card { margin-bottom: 12px; }
.rec-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.rec-head .rec-title { font-weight: 600; flex: 1; font-size: 15px; }
.rec-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) {
  .rec-head { flex-wrap: wrap; }
  .rec-meta { white-space: normal; }
}
.rec-body { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; font-size: 14px; }
.rec-body h4 { margin: 12px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.thread { margin-top: 12px; }
.comment { border-left: 2px solid var(--border); padding: 6px 12px; margin: 8px 0; font-size: 14px; }
.comment .c-meta { font-size: 12px; color: var(--muted); }
.triage-bar { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.audit-log { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Chat */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 300px); min-height: 420px; }
.chat-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.chat-toolbar #chat-status { flex: 1; min-width: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 10px 2px; }
.msg {
  max-width: 82%; margin: 0 0 12px; padding: 10px 14px;
  border-radius: 12px; font-size: 14px; line-height: 1.55;
}
.msg.user {
  background: var(--accent); color: var(--accent-ink); margin-left: auto;
  border-bottom-right-radius: 4px; white-space: pre-wrap; max-width: 72%;
}
.msg.assistant {
  background: var(--surface-2); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.assistant p { margin: 0 0 10px; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant .m-h {
  font-weight: 700; font-size: 14px; letter-spacing: -0.005em;
  margin: 14px 0 6px; color: var(--ink);
}
.msg.assistant .m-h:first-child { margin-top: 0; }
.msg.assistant ul, .msg.assistant ol { margin: 0 0 10px; padding-left: 22px; }
.msg.assistant ul:last-child, .msg.assistant ol:last-child { margin-bottom: 0; }
.msg.assistant li { margin: 3px 0; }
.msg.assistant li::marker { color: var(--accent); }
.msg.assistant code {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; font-size: 0.86em;
}
.msg.assistant .m-hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.msg .m-model {
  display: block; font-size: 11px; color: var(--muted); margin-top: 8px;
  padding-top: 6px; border-top: 1px solid var(--border);
}
.msg.thinking { display: flex; align-items: center; gap: 10px; }
.think-label { font-size: 13px; color: var(--muted); }
.think-dots { display: inline-flex; gap: 5px; align-items: center; }
.think-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: think-pulse 1.2s infinite ease-in-out;
}
.think-dots span:nth-child(2) { animation-delay: 0.2s; }
.think-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes think-pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.75); }
  40% { opacity: 1; transform: scale(1); }
}
.chat-input { display: flex; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-input textarea { resize: none; height: 44px; flex: 1; min-width: 0; }
.chat-input .btn { flex: 0 0 auto; height: 44px; }
.model-field { flex: 0 0 auto; }
.model-field label {
  margin: 0 0 4px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.05em;
}
.model-field select { width: auto; max-width: 200px; height: 44px; font-size: 13px; cursor: pointer; }
@media (max-width: 640px) {
  .chat-input { flex-wrap: wrap; }
  .model-field { order: 3; }
  .msg, .msg.user { max-width: 92%; }
}

/* FAQ */
details.faq { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 10px; }
details.faq summary { font-weight: 600; cursor: pointer; font-size: 15px; }
details.faq p { color: var(--muted); font-size: 14px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border); color: var(--muted); font-size: 13px;
  text-align: center; padding: 24px; background: var(--surface);
}
.notice {
  background: color-mix(in srgb, var(--prio-b) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--prio-b) 30%, transparent);
  border-radius: var(--radius); padding: 10px 16px; font-size: 13px; color: var(--muted);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }
