:root {
  --bg: #050816;
  --panel: #111827;
  --panel-2: #0b1222;
  --line: rgba(148, 163, 184, .18);
  --text: #ffffff;
  --muted: #94a3b8;
  --blue: #2563eb;
  --sky: #38bdf8;
  --success: #22c55e;
  --warning: #facc15;
  --danger: #ef4444;
  --shadow: 0 24px 80px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% -10%, rgba(37, 99, 235, .22), transparent 35%), var(--bg);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.hidden { display: none !important; }

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(20px, 5vw, 72px);
  background: rgba(5, 8, 22, .72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.brand img { width: 38px; height: 38px; }
.nav-links { display: flex; gap: 20px; align-items: center; color: var(--muted); font-size: 14px; }
.nav-links a { color: inherit; text-decoration: none; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; gap: 10px; align-items: center; }
.btn {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(56,189,248,.45); }
.btn.primary { background: linear-gradient(135deg, var(--blue), #1d4ed8); border-color: rgba(56,189,248,.28); box-shadow: 0 12px 34px rgba(37,99,235,.35); }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.35); }
.btn.small { padding: 7px 10px; font-size: 12px; border-radius: 8px; }

.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, .82fr);
  gap: 44px;
  align-items: center;
  padding: clamp(48px, 8vw, 100px) clamp(20px, 5vw, 72px) 56px;
  overflow: hidden;
}
.eyebrow { color: var(--sky); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 800; }
h1 { font-size: clamp(46px, 7vw, 92px); line-height: .94; margin: 18px 0; letter-spacing: 0; }
.hero p { max-width: 760px; color: #cbd5e1; font-size: clamp(17px, 2vw, 22px); line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.trust-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 38px; color: var(--muted); }
.trust-row span { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: rgba(255,255,255,.03); }
.hero-visual { position: relative; min-height: 520px; }
.orbit {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(56,189,248,.2);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(17,24,39,.92), rgba(5,8,22,.72));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.particle { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--sky); box-shadow: 0 0 18px var(--sky); animation: float 8s ease-in-out infinite; }
.doc-card {
  position: absolute;
  width: min(72%, 420px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(15, 23, 42, .9);
  box-shadow: 0 18px 46px rgba(0,0,0,.28);
  animation: rise 9s ease-in-out infinite;
}
.doc-card:nth-child(2) { top: 42px; left: 34px; }
.doc-card:nth-child(3) { top: 200px; right: 28px; animation-delay: -2s; }
.doc-card:nth-child(4) { bottom: 52px; left: 58px; animation-delay: -4s; }
.doc-line { height: 9px; border-radius: 99px; background: rgba(148,163,184,.22); margin: 10px 0; }
.doc-line.short { width: 58%; }
.confidence { color: var(--success); font-weight: 800; font-size: 13px; }
@keyframes float { 0%,100% { transform: translateY(0); opacity:.55; } 50% { transform: translateY(-24px); opacity:1; } }
@keyframes rise { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

.section { padding: 72px clamp(20px, 5vw, 72px); border-top: 1px solid var(--line); }
.section h2 { font-size: clamp(30px, 4vw, 48px); margin: 0 0 14px; }
.section-copy { color: var(--muted); max-width: 760px; line-height: 1.7; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 30px; }
.feature, .price, .faq, .testimonial {
  border: 1px solid var(--line);
  background: rgba(17,24,39,.68);
  border-radius: 8px;
  padding: 20px;
  transition: .18s ease;
}
.feature:hover, .price:hover { transform: translateY(-4px); border-color: rgba(56,189,248,.44); }
.feature strong, .price strong { display: block; margin-bottom: 8px; }
.feature p, .price p, .faq p, .testimonial p { color: var(--muted); line-height: 1.55; margin: 0; }
.price h3 { margin: 6px 0 14px; font-size: 24px; }
.price ul { color:#cbd5e1; margin:0 0 18px; padding-left:18px; line-height:1.7; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
}
.auth-copy { padding: 70px clamp(28px, 6vw, 92px); display: flex; flex-direction: column; justify-content: center; }
.auth-panel { background: rgba(17,24,39,.86); border-left: 1px solid var(--line); padding: 34px; display: flex; flex-direction: column; justify-content: center; }
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 7px; }
.field label { color: #cbd5e1; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  background: rgba(5,8,22,.8);
  color: var(--text);
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(56,189,248,.12); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.notice { color: var(--muted); font-size: 13px; line-height: 1.55; }
.error { color: #fecaca; background: rgba(239,68,68,.11); border: 1px solid rgba(239,68,68,.3); border-radius: 8px; padding: 10px; }
.success { color: #bbf7d0; background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.28); border-radius: 8px; padding: 10px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px 1fr; }
.sidebar { border-right: 1px solid var(--line); background: rgba(5,8,22,.84); padding: 18px; position: sticky; top: 0; height: 100vh; }
.side-nav { display: grid; gap: 6px; margin-top: 24px; }
.side-nav button {
  text-align: left;
  width: 100%;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
}
.side-nav button.active, .side-nav button:hover { background: rgba(37,99,235,.16); border-color: rgba(56,189,248,.16); color: var(--text); }
.main { min-width: 0; }
.topbar { height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: rgba(5,8,22,.64); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(18px); }
.top-search { max-width: 520px; }
.avatar { width: 36px; height: 36px; display:grid; place-items:center; border-radius:50%; background: var(--blue); font-weight:800; }
.content { padding: 24px; }
.view-head { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; margin-bottom: 20px; }
.view-head h2 { margin: 0 0 6px; font-size: 30px; }
.view-head p { margin: 0; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.billing-grid { margin-top: 16px; }
.metric, .panel {
  border: 1px solid var(--line);
  background: rgba(17,24,39,.72);
  border-radius: 8px;
  padding: 18px;
}
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display:block; font-size: 28px; margin-top: 10px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 16px; margin-top: 16px; }
.table { width:100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 12px 8px; text-align:left; color:#dbe4f0; vertical-align: top; }
.table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.tag { display:inline-flex; align-items:center; gap:5px; border:1px solid rgba(56,189,248,.24); color:#bae6fd; border-radius:999px; padding:4px 8px; font-size:12px; margin:2px; }
.danger-tag { color:#fecaca; border-color:rgba(239,68,68,.36); }
.status-pill { display:inline-flex; align-items:center; gap:6px; border-radius:999px; padding:4px 9px; font-size:12px; font-weight:800; }
.status-pill.ready { color:#bbf7d0; background:rgba(34,197,94,.12); border:1px solid rgba(34,197,94,.32); }
.status-pill.ready::before { content:""; width:7px; height:7px; border-radius:50%; background:var(--success); box-shadow:0 0 10px var(--success); }
.status-pill.processing { color:#fef3c7; background:rgba(250,204,21,.1); border:1px solid rgba(250,204,21,.32); }
.status-pill.processing::before { content:""; width:7px; height:7px; border-radius:50%; background:var(--warning); }
.status-pill.failed { color:#fecaca; background:rgba(239,68,68,.11); border:1px solid rgba(239,68,68,.32); }
.status-pill.failed::before { content:""; width:7px; height:7px; border-radius:50%; background:var(--danger); }
button:disabled, textarea:disabled, input:disabled { opacity:.55; cursor:not-allowed; }
.dropzone { border: 1px dashed rgba(56,189,248,.48); background: rgba(56,189,248,.06); border-radius: 8px; padding: 28px; text-align:center; }
.dropzone.drag { background: rgba(37,99,235,.18); }
.progress { height: 8px; border-radius:999px; background:rgba(148,163,184,.18); overflow:hidden; margin-top:10px; }
.progress div { height:100%; background:linear-gradient(90deg,var(--blue),var(--sky)); width:0%; transition:.2s; }
.chat-layout { display:grid; grid-template-columns: 310px minmax(0,1fr); gap:16px; }
.conversation-list { display:grid; gap:8px; }
.conversation-list button { text-align:left; }
.messages { min-height: 430px; max-height: 58vh; overflow:auto; display:grid; gap:12px; padding-right: 4px; }
.message { border:1px solid var(--line); border-radius:8px; padding:14px; background: rgba(5,8,22,.45); }
.message p { white-space: pre-line; }
.message.user { border-color: rgba(37,99,235,.35); }
.message.assistant { border-color: rgba(56,189,248,.26); }
.citation { margin-top:10px; border-left:3px solid var(--sky); padding:8px 10px; color:#cbd5e1; background:rgba(56,189,248,.06); border-radius: 0 8px 8px 0; font-size:13px; }
.source-header { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:10px; margin-bottom:12px; }
.source-header div { border:1px solid var(--line); border-radius:8px; padding:12px; background:rgba(5,8,22,.42); min-width:0; }
.source-header span, .selected-strip span, .selector-line label { display:block; color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.06em; margin-bottom:5px; }
.source-header strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.selected-strip { display:flex; align-items:center; flex-wrap:wrap; gap:6px; padding:10px 0 14px; border-bottom:1px solid var(--line); margin-bottom:14px; }
.suggested-row { display:flex; gap:8px; flex-wrap:wrap; margin:14px 0; }
.chat-form { border-top:1px solid var(--line); padding-top:14px; }
.source-selector { display:grid; gap:10px; border:1px solid var(--line); background:rgba(5,8,22,.34); border-radius:8px; padding:12px; }
.selector-line { display:grid; grid-template-columns: 120px minmax(0,1fr); align-items:center; gap:10px; }
.document-picker { display:grid; gap:8px; max-height:180px; overflow:auto; padding-right:4px; }
.check-row { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:9px; padding:8px; border:1px solid var(--line); border-radius:8px; background:rgba(255,255,255,.025); }
.check-row input { width:auto; }
.check-row span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.selected-label { color:#cbd5e1; font-weight:800; }
.mention-wrap { position:relative; }
.mention-menu { position:absolute; left:10px; right:10px; bottom:calc(100% + 8px); z-index:8; display:grid; gap:4px; max-height:220px; overflow:auto; border:1px solid rgba(56,189,248,.3); border-radius:8px; background:#0b1222; box-shadow:var(--shadow); padding:8px; }
.mention-menu button { text-align:left; border:0; border-radius:7px; padding:9px 10px; background:transparent; color:#dbe4f0; }
.mention-menu button:hover { background:rgba(37,99,235,.18); }
.empty { color: var(--muted); border:1px dashed var(--line); border-radius:8px; padding:24px; text-align:center; }
.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.62); display:grid; place-items:center; z-index:40; }
.modal { width:min(720px, calc(100vw - 28px)); max-height:88vh; overflow:auto; background:#0b1222; border:1px solid var(--line); border-radius:10px; box-shadow:var(--shadow); padding:22px; }
.modal-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:16px; }
.modal-head h3 { margin:0; }

@media (max-width: 980px) {
  .hero, .auth-shell, .app-shell, .two-col, .chat-layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid, .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-header { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .nav-links { display:none; }
}
@media (max-width: 620px) {
  .grid, .metrics, .split { grid-template-columns: 1fr; }
  .source-header, .selector-line { grid-template-columns: 1fr; }
  .hero-visual { min-height: 430px; }
  .topbar, .view-head { flex-direction: column; align-items: stretch; height: auto; }
}
