:root {
  --bg: #0b0d17;
  --bg-soft: #12162a;
  --card: #161b33;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef0fb;
  --text-dim: #9aa0c3;
  --accent: #7c8cff;
  --accent-2: #35d6c0;
  --danger: #ff6b81;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  position: relative;
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  isolation: isolate;
  overflow: hidden;
}

.aurora .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
}

.aurora .b1 { width: 480px; height: 480px; background: #5b6dff; top: -120px; left: -100px; }
.aurora .b2 { width: 420px; height: 420px; background: #35d6c0; bottom: -140px; right: -80px; }
.aurora .b3 { width: 360px; height: 360px; background: #ff6bd8; top: 40%; left: 55%; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  max-width: 1080px;
  margin: 0 auto;
}

.brand {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent);
}

.topbar nav a {
  color: var(--text-dim);
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.92rem;
}

.topbar nav a:hover { color: var(--text); }

main.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 32px 80px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

h1 { font-size: 2.2rem; margin-bottom: 8px; }
h2 { font-size: 1.3rem; margin-top: 0; }
p.lede { color: var(--text-dim); font-size: 1.05rem; max-width: 620px; }

.chat-shell {
  margin-top: 32px;
  max-width: 720px;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 220px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 6px 4px 12px;
}

.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg .bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 0.96rem;
  white-space: pre-wrap;
}
.msg.user .bubble { background: var(--accent); color: #0b0d17; border-bottom-right-radius: 4px; }
.msg.bot .bubble { background: var(--bg-soft); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.bot .bubble.pending { color: var(--text-dim); font-style: italic; }

.chat-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.chat-form textarea {
  flex: 1;
  resize: none;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: inherit;
}

.chat-form textarea:focus { outline: 2px solid var(--accent); }

button, .btn {
  background: var(--accent);
  color: #0b0d17;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.92rem;
  text-decoration: none;
  display: inline-block;
}

button:hover, .btn:hover { filter: brightness(1.08); }
button.secondary, .btn.secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
button.danger, .btn.danger { background: var(--danger); color: #21050b; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.hint { color: var(--text-dim); font-size: 0.82rem; margin-top: 10px; }

form.stacked { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
form.stacked input, form.stacked select, form.stacked textarea {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
}
form.stacked label { font-size: 0.85rem; color: var(--text-dim); margin-bottom: -6px; }

.error-box {
  background: rgba(255, 107, 129, 0.12);
  border: 1px solid rgba(255, 107, 129, 0.4);
  color: #ffb0ba;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.success-box {
  background: rgba(53, 214, 192, 0.12);
  border: 1px solid rgba(53, 214, 192, 0.4);
  color: #a6f3e8;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th { color: var(--text-dim); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
table.data tr:hover td { background: rgba(255,255,255,0.02); }

.admin-nav { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
}
.admin-nav a.active, .admin-nav a:hover { color: var(--text); background: var(--bg-soft); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat-card .num { font-size: 1.6rem; font-weight: 700; }
.stat-card .label { color: var(--text-dim); font-size: 0.8rem; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.pending { background: rgba(255, 193, 7, 0.15); color: #ffd166; }
.badge.validated { background: rgba(53, 214, 192, 0.15); color: #a6f3e8; }
.badge.corrected { background: rgba(124, 140, 255, 0.15); color: #b6bfff; }
.badge.ok { background: rgba(255,255,255,0.08); color: var(--text-dim); }

.key-reveal {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-soft);
  border: 1px dashed var(--accent-2);
  padding: 12px;
  border-radius: 10px;
  word-break: break-all;
  font-size: 0.85rem;
}

.tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.tab-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  padding: 10px 22px;
  font-weight: 600;
  cursor: pointer;
}
.tab-btn.active { color: var(--text); background: var(--card); border-bottom-color: var(--card); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.search-hero { text-align: center; padding: 40px 0 24px; }
.search-hero h1 { font-size: 2.6rem; }
.search-hero .lede { margin: 0 auto 24px; }
.search-form {
  display: flex;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
}
.search-form input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: 14px 20px;
  font-size: 1rem;
}
.search-form input:focus { outline: 2px solid var(--accent); }
.search-form button { border-radius: 999px; }

.search-results { list-style: none; margin: 24px auto 0; padding: 0; max-width: 720px; }
.search-result { padding: 16px 0; border-bottom: 1px solid var(--border); }
.search-result .result-title { color: var(--accent-2); font-size: 1.05rem; text-decoration: none; font-weight: 600; }
.search-result .result-title:hover { text-decoration: underline; }
.search-result .result-url { color: var(--text-dim); font-size: 0.8rem; margin: 2px 0 6px; word-break: break-all; }
.search-result .result-snippet { color: var(--text); font-size: 0.9rem; line-height: 1.5; margin: 0; white-space: pre-line; }

.progress-bar { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; height: 10px; overflow: hidden; margin: 10px 0; }
.progress-bar .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.4s ease; }

footer.site {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 30px 0;
}
