*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #1a365d; --primary-light: #2a4a7f; --accent: #e53e3e;
    --bg: #f7fafc; --surface: #ffffff; --text: #1a202c; --text-light: #718096;
    --border: #e2e8f0; --success: #38a169; --error: #e53e3e; --warning: #d69e2e;
    --radius: 6px; --shadow: 0 1px 3px rgba(0,0,0,0.12);
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }
.disclosure-banner { background: #fffbeb; border-bottom: 1px solid #fefcbf; padding: 0.4rem 1rem; text-align: center; font-size: 0.78rem; color: #975a16; }
.header { background: var(--primary); color: #fff; padding: 0 2rem; height: 60px; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.header-brand { font-size: 1.4rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 0.5rem; }
.header-brand:hover { color: #e2e8f0; }
.header-brand small { font-size: 0.65rem; font-weight: 400; opacity: 0.8; }
.header-nav { display: flex; align-items: center; gap: 1.25rem; }
.header-nav a { color: rgba(255,255,255,0.9); font-size: 0.85rem; }
.header-nav a:hover { color: #fff; }
.role-badge { background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 12px; font-size: 0.7rem; text-transform: uppercase; color: #fff; }
.main { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.5rem; }
.card h2 { margin-bottom: 1rem; font-size: 1.25rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem 1.25rem; border: none; border-radius: var(--radius); font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e0; }
.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #c53030; color: #fff; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-weight: 500; font-size: 0.9rem; }
.form-control { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,54,93,0.1); }
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #f0fff4; border: 1px solid #c6f6d5; color: #276749; }
.alert-error { background: #fff5f5; border: 1px solid #fed7d7; color: #9b2c2c; }
.alert-warning { background: #fffbeb; border: 1px solid #fefcbf; color: #975a16; }
.alert-info { background: #ebf8ff; border: 1px solid #bee3f8; color: #2b6cb0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.text-center { text-align: center; }
.text-light { color: var(--text-light); }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.footer { text-align: center; padding: 2rem; color: var(--text-light); font-size: 0.8rem; border-top: 1px solid var(--border); }

/* Legal AI Q&A */
.legal-answer { white-space: pre-wrap; line-height: 1.8; font-size: 0.95rem; }
.legal-answer strong { color: var(--primary); }
.legal-answer blockquote, .legal-context-block { background: #f7fafc; border-left: 3px solid var(--primary); padding: 0.75rem 1rem; margin: 0.75rem 0; font-size: 0.9rem; color: var(--text); border-radius: 0 var(--radius) var(--radius) 0; }
.citation-table { width: 100%; font-size: 0.85rem; border-collapse: collapse; }
.citation-table th { text-align: left; padding: 0.5rem; border-bottom: 2px solid var(--border); }
.citation-table td { padding: 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.citation-type { display: inline-block; background: var(--primary); color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 0.7rem; text-transform: uppercase; }
.example-questions li { margin-bottom: 0.25rem; }
.rag-info { font-size: 0.8rem; color: var(--text-light); margin-top: 0.5rem; }

/* Chat / Conversation Thread */
.conversation-thread { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.chat-message { display: flex; }
.chat-user { justify-content: flex-end; }
.chat-assistant { justify-content: flex-start; }
.chat-system { justify-content: center; }
.chat-bubble { max-width: 85%; padding: 1rem 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.chat-bubble-user { background: var(--primary); color: #fff; border-bottom-right-radius: 2px; }
.chat-bubble-assistant { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 2px; }
.chat-bubble-system { background: #f7fafc; border: 1px dashed var(--border); font-size: 0.85rem; color: var(--text-light); text-align: center; max-width: 60%; }
.chat-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.8rem; }
.chat-bubble-user .chat-header { color: rgba(255,255,255,0.75); }
.chat-bubble-assistant .chat-header { color: var(--text-light); }
.chat-role { font-weight: 600; }
.chat-time { font-size: 0.75rem; opacity: 0.7; }
.chat-model { font-size: 0.7rem; background: rgba(0,0,0,0.05); padding: 1px 6px; border-radius: 8px; }
.chat-content { line-height: 1.7; font-size: 0.92rem; }
.chat-bubble-user .chat-content { color: #fff; }
.chat-bubble-user .chat-content strong { color: #e2e8f0; }

/* Spinner */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: middle; margin-right: 0.3rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading state for form */
.form-loading { opacity: 0.6; pointer-events: none; }
.form-loading .btn-primary { background: var(--text-light); }

/* Stat cards responsive grid override */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card { text-align: center; border-top: 3px solid var(--primary); padding: 1.25rem 1rem; }
.stat-number { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.82rem; color: var(--text-light); margin-top: 0.25rem; }

/* AI comparison result */
.ai-analysis { background: #f0f7ff; border-left: 4px solid var(--primary); padding: 1.25rem 1.5rem; border-radius: 0 var(--radius) var(--radius) 0; margin-top: 1rem; font-size: 0.92rem; line-height: 1.7; white-space: pre-wrap; }
.ai-analysis strong { color: var(--primary); }
.ai-analysis h3, .ai-analysis h4 { color: var(--primary); margin-top: 0.75rem; margin-bottom: 0.4rem; }

/* Semantic search badge */
.search-strategy { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.7rem; text-transform: uppercase; font-weight: 600; }
.strategy-hybrid { background: #805ad5; color: #fff; }
.strategy-fulltext { background: var(--success); color: #fff; }
.strategy-keyword { background: var(--text-light); color: #fff; }

/* Similarity score indicator */
.similarity-score { display: inline-block; background: #ebf8ff; color: #2b6cb0; padding: 1px 6px; border-radius: 8px; font-size: 0.7rem; }

/* Password strength indicator */
.password-strength { margin-top: 0.3rem; font-size: 0.8rem; }
.strength-weak { color: var(--error); }
.strength-medium { color: var(--warning); }
.strength-strong { color: var(--success); }