:root {
  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --indigo-800: #3730a3;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --white: #fff;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.1);
  --font: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--slate-800);
  background: var(--slate-50);
  line-height: 1.6;
}
a { color: var(--indigo-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; color: var(--slate-900); margin: 0 0 0.6em; }
h1 { font-size: clamp(2.1rem, 4vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 2.5vw, 2rem); font-weight: 700; }
p { margin: 0 0 1em; color: var(--slate-600); }

.container { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.container.narrow { width: min(720px, calc(100% - 2rem)); }
.center { text-align: center; }
.hidden { display: none !important; }

.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--slate-200);
}
.nav-inner {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
  min-height: 68px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.logo { font-weight: 700; font-size: 1.35rem; color: var(--indigo-700); text-decoration: none; }
.logo.light { color: #fff; }
.nav-links { display: flex; gap: 1.25rem; font-size: 0.92rem; font-weight: 500; }
.nav-links a { color: var(--slate-700); text-decoration: none; }
.nav-links a:hover { color: var(--indigo-600); }
.nav-admin { opacity: 0.7; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; font-family: inherit; font-weight: 600;
  border-radius: 999px; padding: 0.8rem 1.25rem; text-decoration: none;
  transition: transform .15s, background .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--indigo-600); color: #fff; box-shadow: 0 10px 24px rgba(79,70,229,.28); }
.btn-primary:hover { background: var(--indigo-700); color: #fff; }
.btn-ghost { background: transparent; color: var(--slate-700); border: 1px solid var(--slate-200); }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.88rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.hero {
  background: linear-gradient(180deg, var(--indigo-50), #fff 70%);
  padding: 4.5rem 0 3.5rem;
}
.hero-inner { width: min(800px, calc(100% - 2rem)); margin-inline: auto; text-align: center; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700;
  color: var(--indigo-700); margin-bottom: 0.85rem;
}
.lead { font-size: 1.15rem; max-width: 36rem; margin-inline: auto; }
.quote { color: var(--indigo-700); font-style: italic; font-weight: 500; font-size: 1.05rem; margin: 1.25rem 0 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-bottom: 1.25rem; }
.hero-note { font-size: 0.92rem; color: var(--slate-500); max-width: 34rem; margin-inline: auto; }

.section { padding: 4rem 0; background: #fff; }
.section-alt { background: var(--slate-50); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.5rem; }
.card {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 1.4rem; box-shadow: 0 8px 24px rgba(15,23,42,.04);
}
.card-num { color: var(--indigo-600); font-weight: 700; font-size: 1.25rem; margin-bottom: 0.5rem; }
.card h3 { font-size: 1.1rem; }
.card p { margin: 0; font-size: 0.96rem; }

.agent-section { background: linear-gradient(180deg, #fff, var(--indigo-50)); }
.agent-layout {
  display: grid; grid-template-columns: 0.95fr 1.15fr; gap: 2rem; align-items: start;
}
.checklist { padding-left: 1.1rem; color: var(--slate-600); }
.checklist li { margin: 0.35rem 0; }

.chat-shell {
  background: #fff; border: 1px solid var(--slate-200); border-radius: 20px;
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
  min-height: 560px;
}
.chat-header {
  display: flex; gap: 0.75rem; align-items: center;
  padding: 1rem 1.1rem; border-bottom: 1px solid var(--slate-200); background: #fff;
}
.chat-header span { display: block; font-size: 0.8rem; color: var(--slate-500); }
.avatar {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--indigo-600), var(--indigo-800));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
}
.chat-log {
  flex: 1; overflow-y: auto; padding: 1.1rem; display: flex; flex-direction: column; gap: 0.85rem;
  background: var(--slate-50); max-height: 420px; min-height: 360px;
}
.msg {
  max-width: 92%; padding: 0.8rem 1rem; border-radius: 14px; font-size: 0.96rem;
  white-space: pre-wrap; word-break: break-word;
}
.msg.user {
  align-self: flex-end; background: var(--indigo-600); color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.model {
  align-self: flex-start; background: #fff; border: 1px solid var(--slate-200);
  color: var(--slate-800); border-bottom-left-radius: 4px;
}
.msg.system { align-self: center; background: transparent; color: var(--slate-500); font-size: 0.85rem; }
.msg.typing { color: var(--slate-500); font-style: italic; }

.chat-form {
  display: grid; grid-template-columns: 1fr auto; gap: 0.6rem;
  padding: 0.85rem; border-top: 1px solid var(--slate-200); background: #fff;
}
.chat-form textarea {
  resize: none; border: 1px solid var(--slate-200); border-radius: 12px;
  padding: 0.7rem 0.85rem; font: inherit; color: var(--slate-800);
}
.chat-form textarea:focus { outline: 2px solid rgba(79,70,229,.25); border-color: var(--indigo-600); }
.quick-prompts {
  display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 0.85rem 0.85rem; background: #fff;
}
.quick-prompts button {
  border: 1px solid var(--slate-200); background: var(--slate-50); color: var(--slate-700);
  border-radius: 999px; padding: 0.35rem 0.7rem; font-size: 0.8rem; cursor: pointer; font-family: inherit;
}
.quick-prompts button:hover { border-color: var(--indigo-600); color: var(--indigo-700); }

.agreement-panel {
  margin-top: 1.25rem; background: #fff; border: 1px solid var(--slate-200);
  border-radius: var(--radius); padding: 1rem; box-shadow: 0 8px 24px rgba(15,23,42,.05);
}
.agreement-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.agreement-actions { display: flex; gap: 0.4rem; }
.agreement-text {
  margin: 0; max-height: 280px; overflow: auto; background: var(--slate-50);
  border: 1px solid var(--slate-200); border-radius: 12px; padding: 0.9rem;
  font-size: 0.78rem; line-height: 1.45; white-space: pre-wrap; color: var(--slate-700);
}
.request-meta { font-size: 0.85rem; color: var(--slate-500); margin: 0.6rem 0 0; }

.footer { background: var(--slate-900); color: var(--slate-400); padding: 2.5rem 0; }
.footer a { color: #cbd5e1; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-copy { margin: 0; font-size: 0.85rem; }

/* Admin */
.admin-page { min-height: 100vh; background: var(--slate-50); }
.admin-wrap { width: min(1000px, calc(100% - 2rem)); margin: 2rem auto 3rem; }
.admin-card {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: 0 8px 24px rgba(15,23,42,.05);
}
.admin-card h1 { font-size: 1.5rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; font-weight: 600; font-size: 0.9rem; }
.field input {
  font: inherit; font-weight: 400; padding: 0.7rem 0.85rem; border-radius: 10px;
  border: 1px solid var(--slate-200);
}
table.requests { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.requests th, table.requests td {
  text-align: left; padding: 0.7rem 0.55rem; border-bottom: 1px solid var(--slate-200); vertical-align: top;
}
table.requests th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-500); }
.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px;
  background: var(--indigo-50); color: var(--indigo-700); font-size: 0.75rem; font-weight: 600;
}
.detail-pre {
  white-space: pre-wrap; background: var(--slate-50); border: 1px solid var(--slate-200);
  border-radius: 12px; padding: 1rem; font-size: 0.8rem; max-height: 400px; overflow: auto;
}

@media (max-width: 900px) {
  .cards, .agent-layout { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .chat-shell { min-height: 520px; }
}
