/* ============================================================
   Agentive Solutions — elevated dark design system
   ============================================================ */

@font-face { font-family: "Geist"; src: url("/static/fonts/geist-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/static/fonts/geist-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/static/fonts/geist-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/static/fonts/geist-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/static/fonts/geistmono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #0a0a0c;
  --bg-elev: #131317;
  --bg-elev-2: #1a1a20;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #ececed;
  --muted: #9a9aa4;
  --faint: #6a6a74;
  --accent: #46cf9d;
  --accent-2: #2fb98a;
  --accent-ink: #052018;
  --accent-dim: rgba(70, 207, 157, 0.12);
  --danger: #f2777a;
  --radius: 14px;
  --radius-lg: 22px;
  --maxw: 1140px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-dim); }

/* ambient background: one soft accent bloom + faint vignette, fixed & cheap */
.bg-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 55% at 78% -5%, rgba(70, 207, 157, 0.10), transparent 60%),
    radial-gradient(45% 40% at 8% 8%, rgba(70, 207, 157, 0.05), transparent 55%),
    var(--bg);
}
.bg-field::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--line); background: rgba(10, 10, 12, 0.72); backdrop-filter: blur(14px); }
.nav-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; height: 62px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-text { font-size: 15.5px; }
.brand-dim { color: var(--muted); font-weight: 500; }
.nav-links { display: flex; align-items: center; gap: 26px; font-size: 14px; color: var(--muted); font-weight: 500; }
.nav-links a:not(.btn):hover { color: var(--text); }
.nav-cta { margin-left: 2px; }

.main { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- buttons ---------- */
.btn {
  --bg-btn: var(--bg-elev-2);
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg-btn);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 11px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), opacity 0.18s;
}
.btn:hover { border-color: var(--line-strong); background: #212128; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn-primary:hover { background: #55dcaa; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); background: transparent; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn-danger { color: var(--danger); border-color: transparent; background: transparent; padding: 6px 10px; }
.btn-danger:hover { background: rgba(242, 119, 122, 0.1); }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.label, .source-sub { font-size: 12.5px; color: var(--muted); letter-spacing: 0.005em; }
.input, .textarea, select.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 11px 14px;
  color: var(--text);
  font-family: inherit; font-size: 14px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.input:focus, .textarea:focus, select.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ---------- landing ---------- */
.hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; padding: 84px 0 64px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 22px; }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); }
.hero h1 { font-size: clamp(38px, 5vw, 60px); line-height: 1.02; letter-spacing: -0.03em; font-weight: 600; margin: 0 0 22px; }
.hero h1 .hl { color: var(--accent); }
.hero .lead { font-size: 18px; color: var(--muted); max-width: 46ch; margin: 0 0 32px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-trust { margin-top: 26px; font-size: 13px; color: var(--faint); display: flex; gap: 18px; flex-wrap: wrap; }
.hero-trust span { display: inline-flex; align-items: center; gap: 7px; }
.hero-trust svg { color: var(--accent); }

/* hero visual: an answer-with-citations mock */
.answer-card { background: linear-gradient(180deg, var(--bg-elev), var(--bg)); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.7); animation: rise 0.7s var(--ease) both; }
.ac-q { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.ac-q .dot { width: 22px; height: 22px; border-radius: 7px; background: var(--bg-elev-2); border: 1px solid var(--line); flex: none; display: grid; place-items: center; font-size: 11px; color: var(--faint); }
.ac-a { font-size: 14.5px; line-height: 1.65; }
.ac-a .cite { color: var(--accent); font-family: var(--mono); font-size: 11px; vertical-align: super; padding: 0 1px; }
.ac-sources { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; display: inline-flex; align-items: center; gap: 6px; background: var(--bg-elev); }
.chip .num { font-family: var(--mono); color: var(--accent); }

/* how it works */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); margin: 40px 0 90px; }
.step { padding: 30px 26px 30px 0; }
.step + .step { padding-left: 30px; border-left: 1px solid var(--line); }
.step .n { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-bottom: 12px; }
.step h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; }
.step p { font-size: 14px; color: var(--muted); margin: 0; }

/* ---------- page heads ---------- */
.page { padding: 44px 0 80px; }
.page-head { margin-bottom: 30px; max-width: 60ch; }
.page-head h1 { font-size: 27px; letter-spacing: -0.02em; font-weight: 600; margin: 0 0 8px; }
.page-head p { color: var(--muted); margin: 0; font-size: 15px; }
.muted { color: var(--muted); }

/* ---------- cards / surfaces ---------- */
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }

/* ---------- upload ---------- */
.dropzone {
  display: block;
  position: relative;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.12s var(--ease);
}
.dropzone:hover { border-color: var(--muted); background: #16161b; }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-dim); transform: scale(1.006); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-icon { width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 13px; background: var(--bg-elev-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--accent); }
.dz-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.dz-sub { font-size: 13px; color: var(--muted); margin-top: 5px; }
.dz-formats { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.fmt { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }

.tabs { display: flex; gap: 4px; margin: 26px 0 18px; border-bottom: 1px solid var(--line); }
.tab { padding: 9px 15px; font-size: 13.5px; font-weight: 500; color: var(--muted); cursor: pointer; border: none; background: transparent; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.status { font-size: 13px; margin-top: 14px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-elev); }
.status.ok { color: var(--accent); border-color: rgba(70, 207, 157, 0.3); background: var(--accent-dim); }
.status.err { color: var(--danger); border-color: rgba(242, 119, 122, 0.3); background: rgba(242, 119, 122, 0.08); }
.status.busy { color: var(--muted); }

.source-list { margin-top: 30px; display: flex; flex-direction: column; gap: 8px; }
.source-list-head { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin-bottom: 4px; }
.source-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elev); transition: border-color 0.15s; }
.source-item:hover { border-color: var(--line-strong); }
.source-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.source-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.badge-warn { color: var(--danger); border-color: rgba(242, 119, 122, 0.4); }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 62px); padding-bottom: 20px; }
.controls { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 14px 2px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.controls label { display: flex; gap: 7px; align-items: center; }
.controls select { width: auto; padding: 6px 10px; font-size: 13px; }
.controls input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }

.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding: 26px 2px; }
.empty { color: var(--faint); text-align: center; margin: auto; max-width: 38ch; font-size: 15px; }
.msg { max-width: 82%; }
.msg.user { align-self: flex-end; background: var(--accent-dim); border: 1px solid rgba(70, 207, 157, 0.22); color: var(--text); padding: 11px 15px; border-radius: 15px 15px 4px 15px; }
.msg.assistant { align-self: flex-start; max-width: 88%; animation: rise 0.4s var(--ease) both; }
.msg.thinking { color: var(--muted); }
.msg.thinking span { display: inline-flex; gap: 5px; align-items: center; }
.msg.thinking span::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }

/* rendered markdown */
.md { white-space: normal; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 11px; }
.md ul, .md ol { margin: 0 0 11px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li::marker { color: var(--faint); }
.md h4 { margin: 15px 0 7px; font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; }
.md strong { font-weight: 600; color: #fff; }
.md code { font-family: var(--mono); background: var(--bg-elev); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 0.88em; }
.md pre { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.md pre code { background: none; border: none; padding: 0; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.tool-step { margin-top: 10px; font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--bg-elev); border-radius: 9px; padding: 6px 11px; }
.meta-badges { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.sources { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.sources ol { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 5px; }
.sources li { counter-increment: s; display: flex; align-items: baseline; gap: 9px; }
.sources li::before { content: counter(s); font-family: var(--mono); font-size: 10.5px; color: var(--accent-ink); background: var(--accent); min-width: 17px; height: 17px; border-radius: 5px; display: inline-grid; place-items: center; flex: none; }

.composer { display: flex; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.composer .input { flex: 1; padding: 13px 16px; border-radius: 13px; }

/* notices */
.notice, .error-banner { position: relative; display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 12px 38px 12px 16px; border-radius: 12px; margin-bottom: 14px; }
.notice { background: var(--bg-elev); border: 1px solid var(--line); color: var(--muted); }
.notice a { color: var(--accent); text-decoration: underline; }
.error-banner { background: rgba(242, 119, 122, 0.08); border: 1px solid rgba(242, 119, 122, 0.3); color: var(--danger); }
.dismiss { position: absolute; top: 8px; right: 10px; background: transparent; border: none; color: inherit; opacity: 0.5; font-size: 17px; line-height: 1; cursor: pointer; padding: 4px; }
.dismiss:hover { opacity: 1; }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 26px 0; margin-top: 40px; font-size: 13px; color: var(--faint); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 0.35; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 56px 0 40px; }
  .hero-visual { order: -1; }
  .steps { grid-template-columns: 1fr; }
  .step, .step + .step { padding: 22px 0; border-left: none; border-top: 1px solid var(--line); }
  .step:first-child { border-top: none; }
  .msg, .msg.assistant { max-width: 100%; }
}
