:root {
  --bg: #0b1020; --border: rgba(255,255,255,0.08); --text: #e8edf8; --muted: #9ca7c2;
  --accent: #8fb4ff; --accent-2: #6b8cff; --user: #1d2745; --assistant: #121a2f;
  --shadow: 0 12px 40px rgba(0,0,0,0.35); --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; min-height:100%; background:
  radial-gradient(circle at top left, rgba(107,140,255,0.16), transparent 28%),
  radial-gradient(circle at bottom right, rgba(143,180,255,0.12), transparent 26%), var(--bg); color:var(--text); font-family:var(--font);}
a { color: inherit; text-decoration:none; }
.landing-body, .app-body, .admin-body { min-height:100vh; }
.landing-shell, .admin-shell { max-width:1180px; margin:0 auto; padding:28px; }
.landing-topbar, .admin-topbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:40px; gap:16px; }
.topbar-actions { display:flex; gap:12px; flex-wrap:wrap; }
.brand-lockup { display:flex; align-items:center; gap:14px; }
.brand-mark { width:42px; height:42px; border-radius:14px; display:grid; place-items:center; background:linear-gradient(135deg,var(--accent-2),var(--accent)); color:#08101f; font-weight:800; box-shadow:var(--shadow);}
.brand-name { font-size:18px; font-weight:700; } .brand-sub { color:var(--muted); font-size:13px; }
.hero-card, .admin-panel, .admin-login-card { background:rgba(17,23,42,0.82); border:1px solid var(--border); border-radius:28px; padding:32px; box-shadow:var(--shadow); backdrop-filter:blur(10px);}
.eyebrow { display:inline-block; padding:8px 12px; border-radius:999px; background:rgba(143,180,255,0.12); color:var(--accent); font-size:13px; margin-bottom:18px; }
.hero-card h1 { margin:0 0 14px; font-size:clamp(38px, 6vw, 64px); line-height:1.02; max-width:780px; }
.hero-text { max-width:760px; color:var(--muted); font-size:18px; line-height:1.65; margin-bottom:28px; }
.hero-actions { display:flex; gap:16px; flex-wrap:wrap; }
.primary-btn, .secondary-btn, .ghost-btn, .new-chat-btn, #sendBtn, .upload-btn, .quick-action, .mode-chip, .admin-btn {
  border:0; cursor:pointer; transition:180ms ease;
}
.primary-btn, #sendBtn, .admin-btn { background:linear-gradient(135deg,var(--accent),var(--accent-2)); color:#08101f; font-weight:700; border-radius:16px; padding:14px 18px; box-shadow:var(--shadow); }
.secondary-btn, .ghost-btn, .new-chat-btn, .quick-action, .mode-chip { background:rgba(255,255,255,0.03); border:1px solid var(--border); color:var(--text); border-radius:16px; padding:14px 18px; }
.feature-grid { margin-top:22px; display:flex; gap:16px; flex-wrap:wrap; }
.feature-card { flex:1 1 280px; background:rgba(17,23,42,0.72); border:1px solid var(--border); border-radius:24px; padding:24px; min-height:170px; }
.app-shell { display:grid; grid-template-columns:290px 1fr; min-height:100vh; }
.sidebar { padding:22px; border-right:1px solid var(--border); background:rgba(10,14,26,0.88); display:flex; flex-direction:column; gap:18px; backdrop-filter:blur(12px);}
.sidebar-section { border:1px solid var(--border); background:rgba(255,255,255,0.02); border-radius:18px; padding:16px; }
.sidebar-label { font-size:12px; text-transform:uppercase; letter-spacing:0.08em; color:var(--muted); margin-bottom:8px; }
.sidebar-note { line-height:1.55; }
.status-pill { display:inline-flex; padding:8px 12px; border-radius:999px; background:rgba(143,180,255,0.12); color:var(--accent); font-size:13px; }
.quick-action-list { display:flex; flex-direction:column; gap:10px; }
.quick-action { width:100%; text-align:left; padding:12px 14px; font-size:14px; }
.sidebar-footer { margin-top:auto; }
.sidebar-link { color:var(--muted); font-size:14px; }
.select-field, .input-field { width:100%; padding:12px 14px; border-radius:14px; border:1px solid var(--border); background:rgba(255,255,255,0.04); color:var(--text); font:inherit; }
.select-field option { color:#111; }
.chat-main { display:flex; flex-direction:column; min-width:0; }
.chat-header { padding:26px 32px 10px; }
.chat-header h1 { margin:0 0 8px; font-size:30px; }
.chat-header p { margin:0; color:var(--muted); }
.transparency-banner { margin:0 32px 10px; padding:14px 16px; border-radius:18px; background:rgba(255,210,122,0.12); color:#ffe5af; border:1px solid rgba(255,210,122,0.22); line-height:1.55; font-size:14px; }
.messages { flex:1; overflow-y:auto; padding:12px 32px 24px; }
.message-row { display:flex; gap:14px; align-items:flex-start; margin:0 auto 18px; max-width:920px; }
.avatar { width:38px; height:38px; border-radius:14px; display:grid; place-items:center; font-weight:700; flex:0 0 auto; }
.message-row.assistant .avatar { background:linear-gradient(135deg,var(--accent-2),var(--accent)); color:#08101f; }
.message-row.user .avatar { background:rgba(255,255,255,0.08); color:var(--text); }
.message-bubble { width:100%; border:1px solid var(--border); border-radius:22px; padding:16px 18px; box-shadow:var(--shadow); }
.message-row.assistant .message-bubble { background:var(--assistant); }
.message-row.user .message-bubble { background:var(--user); }
.message-meta { font-size:13px; font-weight:700; color:var(--muted); margin-bottom:8px; }
.message-text { white-space:pre-wrap; line-height:1.7; }
.tag-wrap { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.message-file, .message-mode, .message-warning { display:inline-flex; padding:8px 12px; border-radius:999px; font-size:13px; }
.message-file { background:rgba(143,180,255,0.12); color:var(--accent); }
.message-mode { background:rgba(255,255,255,0.06); color:var(--text); }
.message-warning { background:rgba(255,210,122,0.14); color:#ffe2a1; }
.composer-wrap { padding:0 32px 28px; }
.mode-bar { max-width:920px; margin:0 auto 12px; display:flex; flex-wrap:wrap; gap:10px; }
.mode-chip.active { background:rgba(143,180,255,0.14); color:var(--accent); border-color:rgba(143,180,255,0.32); }
.composer { max-width:920px; margin:0 auto; display:grid; grid-template-columns:auto 1fr auto; gap:12px; align-items:end; padding:12px; background:rgba(17,23,42,0.92); border:1px solid var(--border); border-radius:24px; box-shadow:var(--shadow); }
.upload-btn { width:48px; height:48px; border-radius:16px; display:grid; place-items:center; background:rgba(255,255,255,0.03); border:1px solid var(--border); color:var(--text); font-size:24px; line-height:1; }
.upload-btn input { display:none; }
.composer-input-wrap { min-width:0; }
textarea { width:100%; min-height:56px; max-height:220px; resize:none; border:0; outline:none; background:transparent; color:var(--text); font:inherit; padding:10px 8px; line-height:1.5; }
textarea::placeholder { color:var(--muted); }
.file-info { margin-top:6px; padding:8px 12px; border-radius:12px; background:rgba(143,180,255,0.12); color:var(--accent); font-size:13px; }
.hidden { display:none; }
#sendBtn[disabled] { opacity:0.6; cursor:wait; }
.stats-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:16px; margin-bottom:24px; }
.stat-card { background:rgba(17,23,42,0.82); border:1px solid var(--border); border-radius:22px; padding:20px; box-shadow:var(--shadow); }
.stat-number { font-size:32px; font-weight:800; margin-bottom:6px; }
.stat-label { color:var(--muted); }
.admin-panels { display:grid; gap:20px; }
.table-wrap { overflow:auto; }
.admin-table { width:100%; border-collapse:collapse; }
.admin-table th, .admin-table td { text-align:left; padding:12px 10px; border-bottom:1px solid var(--border); vertical-align:top; font-size:14px; }
.admin-table th { color:var(--muted); font-weight:700; }
.decision-pill { display:inline-flex; padding:6px 10px; border-radius:999px; font-size:12px; text-transform:uppercase; }
.decision-allow { background:rgba(143,180,255,0.12); color:var(--accent); }
.decision-warn { background:rgba(255,210,122,0.14); color:#ffe2a1; }
.decision-block { background:rgba(255,117,117,0.14); color:#ffb0b0; }
.truncate-cell { max-width:380px; word-break:break-word; }
.admin-login-card { max-width:460px; margin:10vh auto 0; }
.admin-form { display:grid; gap:14px; margin-top:18px; }
.admin-error { margin-top:12px; color:#ffb0b0; }
.setup-success { margin-top:14px; padding:14px 16px; border-radius:16px; background:rgba(143,180,255,0.12); color:var(--text); }
.setup-help, .form-links { margin-top:14px; color:var(--muted); }
.form-links a { color:var(--accent); }

@media (max-width: 1100px) { .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 960px) {
  .app-shell { grid-template-columns:1fr; }
  .sidebar { display:none; }
  .chat-header, .messages, .composer-wrap { padding-left:18px; padding-right:18px; }
  .transparency-banner { margin-left:18px; margin-right:18px; }
  .landing-topbar, .admin-topbar { align-items:flex-start; flex-direction:column; }
  .composer { grid-template-columns:auto 1fr; }
  #sendBtn { grid-column:1 / -1; }
  .stats-grid { grid-template-columns:1fr; }
}
