/* ===================================================
   University Staff Chatbot — Main Stylesheet
   =================================================== */

:root {
  --navy: #1a3a6c;
  --navy-dark: #112850;
  --navy-light: #2a4f8c;
  --gold: #c8a44a;
  --gold-light: #e8c875;
  --bg: #f0f3f8;
  --bg-card: #ffffff;
  --border: #dce2ec;
  --text: #1a2340;
  --text-muted: #6b7897;
  --text-light: #9aa3bc;
  --success: #18794e;
  --success-bg: #e8f5ee;
  --warning: #8a5e00;
  --warning-bg: #fff8e6;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --info: #1e5fa4;
  --info-bg: #e8f0fb;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 4px rgba(26,58,108,0.08), 0 2px 12px rgba(26,58,108,0.06);
  --shadow-lg: 0 4px 24px rgba(26,58,108,0.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ── */
.navbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  text-decoration: none;
}
.navbar-brand svg { color: var(--gold); flex-shrink: 0; }
.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.navbar-links a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: all 0.15s;
}
.navbar-links a:hover, .navbar-links a.active { color: #fff; background: rgba(255,255,255,0.12); }
.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid rgba(255,255,255,0.15);
}
.user-email { font-size: 0.82rem; color: rgba(255,255,255,0.7); }
.btn-link { color: rgba(255,255,255,0.65); font-size: 0.82rem; text-decoration: none; padding: 0.2rem 0.4rem; border-radius: 4px; }
.btn-link:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* ── Main content ── */
.main-content { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ── Flash messages ── */
.flash-container { padding: 0.75rem 1.5rem 0; display: flex; flex-direction: column; gap: 0.5rem; }
.flash {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.flash-success { background: var(--success-bg); color: var(--success); border-color: #b7e4cc; }
.flash-error   { background: var(--danger-bg);  color: var(--danger);  border-color: #fecaca; }
.flash-warning { background: var(--warning-bg); color: var(--warning); border-color: #fde68a; }
.flash-info    { background: var(--info-bg);    color: var(--info);    border-color: #bfdbfe; }
.flash-close { background: none; border: none; cursor: pointer; font-size: 1.2rem; line-height: 1; opacity: 0.6; padding: 0; flex-shrink: 0; }
.flash-close:hover { opacity: 1; }

/* ── Auth pages ── */
.auth-page { background: var(--navy); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-container { width: 100%; max-width: 440px; padding: 1rem; }
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  color: var(--gold);
}
.auth-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--navy); margin-bottom: 0.5rem; }
.auth-header p { color: var(--text-muted); font-size: 0.9rem; }
.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }
.auth-footer { text-align: center; font-size: 0.82rem; color: var(--text-muted); margin-top: 1.5rem; line-height: 1.7; }
.setup-notice {
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--warning);
  margin-bottom: 1.5rem;
}

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
label { font-size: 0.875rem; font-weight: 500; color: var(--text); }
label small { font-weight: 400; color: var(--text-muted); }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(26,58,108,0.1);
}
textarea { resize: vertical; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.required { color: var(--danger); }
.form-actions { display: flex; gap: 0.75rem; align-items: center; padding-top: 0.5rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-light); }
.btn-ghost     { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-warning   { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-full      { width: 100%; justify-content: center; }
.btn-sm        { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.mb-2 { margin-bottom: 0.5rem !important; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-admin   { background: #e8f0fb; color: #1e5fa4; }
.badge-staff   { background: #f0fdf4; color: #166534; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-muted   { background: #f1f5f9; color: var(--text-muted); }

/* ── Alerts ── */
.alert {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.alert strong { font-weight: 600; }
.alert a { text-decoration: underline; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #fde68a; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: #bfdbfe; }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: #fecaca; }
.mb-4 { margin-bottom: 1.5rem !important; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-warning { border-color: #fde68a; background: var(--warning-bg); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfd;
}
.card-header h2 { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.card-link { font-size: 0.82rem; color: var(--navy-light); text-decoration: none; }
.card-link:hover { text-decoration: underline; }
.card-body { padding: 1.25rem; }
.card-body-table { padding: 0; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th {
  text-align: left; padding: 0.75rem 1.25rem;
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 0.75rem 1.25rem; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafbfd; }
.table-muted td { color: var(--text-muted); }
.row-muted td { opacity: 0.6; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-muted { color: var(--text-muted) !important; }
.text-small { font-size: 0.82rem; }
.text-nowrap { white-space: nowrap; }

/* ── Page layout ── */
.page-container { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-container.narrow { max-width: 560px; }
.page-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.page-date { font-size: 0.85rem; color: var(--text-muted); }
.back-link { display: block; font-size: 0.82rem; color: var(--text-muted); text-decoration: none; margin-bottom: 0.25rem; }
.back-link:hover { color: var(--navy); }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }

/* ── Stats grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-top: 0.35rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-sub { font-size: 0.78rem; color: var(--text-light); margin-top: 0.25rem; }

/* ── Progress bars ── */
.progress-group { display: flex; flex-direction: column; gap: 0.5rem; }
.progress-label { display: flex; justify-content: space-between; align-items: center; font-size: 0.875rem; }
.progress-bar-wrap { height: 8px; background: #e8edf5; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--navy); border-radius: 999px; transition: width 0.4s; min-width: 4px; }
.progress-bar.progress-warning { background: #d97706; }
.progress-bar.progress-danger  { background: var(--danger); }
.progress-note { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }

/* ── Dashboard grid ── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-muted); font-size: 0.9rem;
}
.empty-state a { color: var(--navy); text-decoration: underline; }

/* ── Pagination ── */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: 0.875rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ── Search ── */
.search-form { display: flex; align-items: center; gap: 0.5rem; }
.search-input { width: 260px; }

/* ── File upload ── */
.file-upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.file-upload-area:hover { border-color: var(--navy-light); background: #f8fafd; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-upload-label {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  color: var(--text-muted); pointer-events: none;
}
.file-upload-label svg { color: var(--navy-light); }
.file-upload-label span { font-size: 0.9rem; color: var(--navy); font-weight: 500; }
.file-upload-label small { font-size: 0.8rem; }

/* ── Scan notice ── */
.scan-notice {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.875rem 1rem;
  background: var(--info-bg);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--info);
  margin: 1.25rem 0;
}
.scan-notice svg { flex-shrink: 0; margin-top: 2px; }

/* ── File badge ── */
.file-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  background: #e8edf5;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--navy);
  letter-spacing: 0.04em;
}

/* ── Doc title link ── */
.doc-title-link { color: var(--navy); text-decoration: none; font-weight: 500; }
.doc-title-link:hover { text-decoration: underline; }

/* ── Actions cell ── */
.actions-cell { white-space: nowrap; display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

/* ── Content preview ── */
.content-preview {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
  background: #f8fafc;
  padding: 1rem;
  border-radius: var(--radius);
}

/* ── DL grid / list ── */
.dl-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.5rem; font-size: 0.875rem; }
.dl-grid dt { font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.dl-list { display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.875rem; }
.dl-list dt { font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.dl-list dd { color: var(--text); }

/* ── Doc detail grid ── */
.doc-detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.25rem; }
@media (max-width: 900px) { .doc-detail-grid { grid-template-columns: 1fr; } }

/* ── Two col grid ── */
.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .two-col-grid { grid-template-columns: 1fr; } }

/* ── Inline form ── */
.inline-form { display: flex; gap: 0.5rem; align-items: center; }
.inline-form input { flex: 1; }

/* ── Action badges ── */
.action-badge {
  display: inline-flex; padding: 0.15rem 0.5rem; border-radius: 4px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.03em; white-space: nowrap;
}
.action-document { background: #e8edf5; color: var(--navy); }
.action-pii { background: var(--warning-bg); color: #92400e; }
.action-user { background: #f0fdf4; color: #166534; }
.action-settings { background: #f5f3ff; color: #5b21b6; }
.action-whitelist { background: #fdf4ff; color: #7e22ce; }

/* ── PII Review ── */
.pii-finding {
  border: 1px solid var(--border);
}
.pii-finding-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1.25rem;
  background: #fafbfd;
  border-bottom: 1px solid var(--border);
}
.pii-category { display: flex; align-items: center; gap: 0.75rem; }
.finding-number { font-size: 0.8rem; color: var(--text-muted); }
.finding-location { font-size: 0.8rem; font-weight: 600; color: var(--navy); background: #edf2fb; padding: 0.2rem 0.55rem; border-radius: 4px; }
.pii-finding-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.pii-excerpt label, .pii-context label, .pii-actions label, .pii-ferpa-reason label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.35rem; display: block; }
.pii-text { border-left: 3px solid var(--danger); padding: 0.5rem 0.75rem; background: var(--danger-bg); font-family: var(--font-mono); font-size: 0.875rem; color: var(--danger); border-radius: 0 var(--radius) var(--radius) 0; }
.context-sentence { font-size: 0.875rem; color: var(--text-muted); font-style: italic; line-height: 1.6; }
.pii-ferpa-reason { background: #fffbeb; border: 1px solid #f6d860; border-radius: var(--radius); padding: 0.75rem 1rem; }
.ferpa-reason-text { font-size: 0.875rem; color: #7a5c00; line-height: 1.6; margin: 0; }
.resolution-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.resolution-option { cursor: pointer; }
.resolution-option input { display: none; }
.resolution-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem;
  transition: all 0.15s;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.resolution-card strong { font-size: 0.9rem; color: var(--text); }
.resolution-card span { font-size: 0.8rem; color: var(--text-muted); }
.resolution-option input:checked + .resolution-card {
  border-color: var(--navy);
  background: #f0f4fb;
}
.justification-field { margin-top: 0.75rem; }
.category-badge {
  display: inline-flex; padding: 0.2rem 0.6rem; border-radius: 4px;
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  background: var(--danger-bg); color: var(--danger);
}
.sticky-actions {
  position: sticky; bottom: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  z-index: 10;
}

/* ── Admin layout ── */
.admin-layout { display: flex; flex: 1; min-height: 0; }
.admin-sidebar {
  width: 220px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  padding: 1.25rem 0.75rem;
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
}
.admin-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.admin-nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.875rem; color: var(--text-muted); text-decoration: none;
  transition: all 0.15s;
}
.admin-nav-item:hover { background: var(--bg); color: var(--text); }
.admin-nav-item.active { background: #e8edf5; color: var(--navy); font-weight: 600; }
.admin-content { flex: 1; padding: 2rem 1.75rem; overflow-y: auto; min-width: 0; }

/* ── Chat layout ── */
.chat-layout { display: flex; flex: 1; min-height: 0; height: calc(100vh - 56px); }
.chat-sidebar {
  width: 280px; flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 1.5rem;
  overflow-y: auto;
}
.chat-sidebar-header h2 { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 0.4rem; }
.chat-sidebar-header p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }
.chat-sidebar-notice {
  display: flex; gap: 0.6rem; align-items: flex-start;
  margin-top: 1.25rem;
  padding: 0.875rem;
  background: var(--info-bg);
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--info);
  line-height: 1.5;
}
.chat-sidebar-notice svg { flex-shrink: 0; margin-top: 2px; }
.chat-suggestions { margin-top: 1.5rem; }
.suggestions-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.6rem; }
.suggestion-chip {
  display: block; width: 100%;
  text-align: left;
  padding: 0.6rem 0.875rem;
  margin-bottom: 0.5rem;
  background: #f0f4fb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}
.suggestion-chip:hover { background: #e8edf5; border-color: var(--navy-light); }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.chat-welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; text-align: center; padding: 3rem 2rem; color: var(--text-muted);
}
.welcome-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  margin-bottom: 1.25rem;
}
.chat-welcome h3 { font-size: 1.25rem; font-weight: 700; color: var(--navy); margin-bottom: 0.5rem; }
.chat-welcome p { font-size: 0.9rem; max-width: 340px; line-height: 1.6; }

/* Messages */
.message { display: flex; gap: 0.875rem; max-width: 820px; animation: fadeSlide 0.2s ease; }
.message.user { flex-direction: row-reverse; margin-left: auto; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.message-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  flex-shrink: 0;
}
.message.user .message-avatar { background: var(--navy); color: #fff; }
.message.bot .message-avatar { background: linear-gradient(135deg, var(--navy), var(--navy-light)); color: var(--gold); }
.message-bubble {
  padding: 0.875rem 1.1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.7;
  max-width: 680px;
}
.message.user .message-bubble { background: var(--navy); color: #fff; border-radius: 12px 4px 12px 12px; }
.message.bot .message-bubble { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; }
.message-bubble p { margin: 0 0 0.5rem; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble strong { font-weight: 600; }
.message-bubble em { font-style: italic; }

/* Streaming cursor */
.typing-cursor::after { content: '▋'; animation: blink 1s step-end infinite; color: var(--navy-light); }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

.message-error .message-bubble { background: var(--danger-bg); border-color: #fecaca; color: var(--danger); }

/* KB update banner */
.kb-update-banner {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.65rem 1.25rem;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.85rem;
  animation: fadeSlide 0.25s ease;
}
.kb-update-banner svg { flex-shrink: 0; color: #d97706; }
.kb-update-banner span { flex: 1; }
.kb-update-btn {
  padding: 0.3rem 0.85rem;
  background: #d97706; color: #fff;
  border: none; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s;
}
.kb-update-btn:hover { background: #b45309; }
.kb-update-dismiss {
  background: none; border: none;
  color: #92400e; cursor: pointer;
  font-size: 0.85rem; padding: 0 0.2rem;
  opacity: 0.6; line-height: 1;
}
.kb-update-dismiss:hover { opacity: 1; }

/* Chat input */
.chat-input-area {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-input-row { display: flex; gap: 0.75rem; align-items: flex-end; }
.chat-input-row textarea {
  flex: 1;
  resize: none;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  max-height: 160px;
  overflow-y: auto;
}
.chat-input-row textarea:focus { border-color: var(--navy-light); }
.btn-send {
  width: 42px; height: 42px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-send:hover:not(:disabled) { background: var(--navy-light); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-input-hint { font-size: 0.75rem; color: var(--text-light); margin-top: 0.4rem; display: flex; gap: 0.5rem; align-items: center; }
.chat-input-hint kbd {
  display: inline-block; padding: 0.1rem 0.35rem;
  background: #e8edf5; border-radius: 4px;
  font-size: 0.7rem; font-family: var(--font-mono);
  border: 1px solid var(--border);
}

/* PWA install banner */
.pwa-install-banner {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--navy);
  color: #fff;
  padding: 0.75rem 1rem 0.75rem 0.9rem;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.22);
  max-width: min(420px, calc(100vw - 2rem));
  width: 100%;
  animation: pwa-slide-up 0.3s ease;
}
@keyframes pwa-slide-up {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.pwa-install-icon {
  flex-shrink: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
}
.pwa-install-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.pwa-install-text strong { font-size: 0.88rem; white-space: nowrap; }
.pwa-install-text span  { font-size: 0.76rem; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pwa-install-btn {
  flex-shrink: 0;
  background: #fff;
  color: var(--navy);
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.pwa-install-btn:hover { opacity: 0.88; }
.pwa-install-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
  transition: color 0.15s;
}
.pwa-install-dismiss:hover { color: #fff; }
