/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:          #D70321;
  --red-dark:     #b8021b;
  --red-light:    #fef2f3;
  --grey-900:     #1A1A1A;
  --grey-800:     #2A2A2A;
  --grey-700:     #3D3D3D;
  --grey-600:     #6B6B6B;
  --grey-500:     #8C8C8C;
  --grey-400:     #BCBCBC;
  --grey-300:     #D0D0D0;
  --grey-200:     #E8E8E8;
  --grey-100:     #F5F5F5;
  --white:        #FFFFFF;
  --green:        #5B9C3A;
  --sidebar-bg:   #1A1A1A;
  --sidebar-item: #242424;
  --sidebar-hover:#2E2E2E;
  --text:         #2A2A2A;
  --text-muted:   #6B6B6B;
  --border:       #E8E8E8;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.13);
  --radius-sm:    4px;
  --radius-md:    6px;
  --radius-lg:    10px;
  --sidebar-w:    260px;
  --docs-w:       300px;
  --topbar-h:     56px;
  --font:         'Arial', 'Helvetica Neue', Helvetica, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--grey-100);
  color: var(--text);
  overflow: hidden;
  font-size: 14px;
}
body { display: flex; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 20px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-logo img,
.sidebar-logo svg { width: 160px; height: auto; }

.sidebar-actions { padding: 12px 12px 8px; flex-shrink: 0; }

.btn-new-chat {
  width: 100%;
  padding: 9px 12px;
  background: rgba(215,3,33,0.12);
  border: 1px solid rgba(215,3,33,0.25);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.btn-new-chat:hover { background: rgba(215,3,33,0.22); }
.btn-new-chat svg { color: var(--red); flex-shrink: 0; }

/* Session list */
.session-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}
.session-list-container::-webkit-scrollbar { width: 3px; }
.session-list-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.session-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.25);
  padding: 10px 6px 4px;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
  border-left: 2px solid transparent;
}
.session-item:hover { background: var(--sidebar-hover); }
.session-item.active {
  background: var(--sidebar-item);
  border-left-color: var(--red);
}

.session-item-body { flex: 1; min-width: 0; }
.session-item-title {
  font-size: 12.5px;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}
.session-item.active .session-item-title { color: rgba(255,255,255,0.92); font-weight: 500; }

.session-item-meta { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.session-item-date { font-size: 10px; color: rgba(255,255,255,0.3); }
.session-doc-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  background: rgba(215,3,33,0.2);
  border-radius: 3px;
  font-size: 9.5px;
  color: #ff6b7a;
  font-weight: 600;
}

.session-item-actions { display: none; gap: 2px; flex-shrink: 0; }
.session-item:hover .session-item-actions { display: flex; }

.session-action-btn {
  width: 22px; height: 22px;
  background: none; border: none;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px;
  transition: color 0.12s, background 0.12s;
}
.session-action-btn:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.08); }
.session-action-btn.delete:hover { color: var(--red); background: rgba(215,3,33,0.12); }

.session-list-empty {
  padding: 28px 14px;
  text-align: center;
  color: rgba(255,255,255,0.25);
  font-size: 12px;
  line-height: 1.7;
}

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-hint { font-size: 10px; color: rgba(255,255,255,0.2); display: flex; align-items: center; gap: 4px; }
.version-badge { font-size: 10px; color: rgba(255,255,255,0.2); }

/* ===== MAIN ===== */
.main { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; min-width: 0; }

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
  gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.mobile-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
}

.topbar-title-group { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.topbar-title {
  font-size: 14px; font-weight: 700;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.topbar-subtitle { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.session-indicator { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-muted); }
.session-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--grey-300); transition: background 0.3s; }
.session-dot.active { background: var(--green); }

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.btn-docs-toggle {
  padding: 6px 11px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: all 0.12s;
}
.btn-docs-toggle:hover { border-color: var(--grey-300); color: var(--text); }
.btn-docs-toggle.active { background: var(--text); color: var(--white); border-color: var(--text); }

.doc-count-badge {
  background: var(--red);
  color: var(--white);
  border-radius: 3px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

.btn-report {
  padding: 6px 12px;
  background: var(--red);
  color: var(--white);
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: background 0.12s;
  letter-spacing: 0.01em;
}
.btn-report:hover { background: var(--red-dark); }
.btn-report-pdf {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-report-pdf:hover { border-color: var(--grey-300); color: var(--text); background: var(--grey-100); }

/* ===== CONTENT AREA ===== */
.content-area { flex: 1; display: flex; overflow: hidden; position: relative; }

/* ===== CHAT COLUMN ===== */
.chat-column { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.chat-container {
  flex: 1; overflow-y: auto;
  padding: 32px 24px 8px;
  scroll-behavior: smooth;
}
.chat-container::-webkit-scrollbar { width: 5px; }
.chat-container::-webkit-scrollbar-thumb { background: var(--grey-200); border-radius: 3px; }

/* ===== WELCOME ===== */
.welcome-screen {
  max-width: 620px;
  margin: 12px auto 0;
  animation: fadeIn 0.3s ease;
}

.welcome-logo-wrap {
  margin-bottom: 28px;
}
.welcome-logo-wrap img,
.welcome-logo-wrap svg { height: 56px; width: auto; }

.welcome-title {
  font-size: 22px; font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.welcome-subtitle {
  font-size: 12px;
  color: var(--red);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.welcome-description {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 28px;
}

.welcome-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.welcome-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  box-shadow: var(--shadow-sm);
}
.welcome-card:hover {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(215,3,33,0.06), var(--shadow-sm);
  transform: translateY(-1px);
}
.card-icon {
  width: 36px; height: 36px;
  background: var(--red-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  color: var(--red);
}
.card-label { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; letter-spacing: -0.01em; }
.card-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

/* ===== MESSAGES ===== */
.messages {
  max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 20px;
  padding-bottom: 8px;
}

.message { display: flex; gap: 12px; align-items: flex-start; animation: fadeIn 0.2s ease; }
.message.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
.message.user .msg-avatar { background: var(--red); color: var(--white); }
.message.assistant .msg-avatar { background: var(--grey-200); color: var(--grey-700); }

.msg-bubble {
  max-width: 74%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px; line-height: 1.68;
}
.message.user .msg-bubble {
  background: var(--red);
  color: var(--white);
  border-bottom-right-radius: 2px;
}
.message.assistant .msg-bubble {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
  box-shadow: var(--shadow-sm);
}

/* Markdown in bubbles */
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 { color: var(--text); margin: 14px 0 5px; font-weight: 700; }
.msg-bubble h1 { font-size: 15px; border-bottom: 2px solid var(--red); padding-bottom: 4px; }
.msg-bubble h2 { font-size: 13.5px; padding: 5px 8px; border-left: 3px solid var(--red); background: var(--red-light); margin: 14px 0 4px; }
.msg-bubble h3 { font-size: 13px; }
.msg-bubble p { margin-bottom: 7px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { padding-left: 18px; margin-bottom: 7px; }
.msg-bubble li { margin-bottom: 3px; }
.msg-bubble strong { font-weight: 700; }
.message.user .msg-bubble strong { color: rgba(255,255,255,0.9); }
.msg-bubble em { font-style: italic; }
.msg-bubble hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.msg-bubble code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 3px; font-size: 12px; font-family: 'Courier New', monospace; }
.msg-bubble pre { background: var(--grey-100); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; margin: 7px 0; font-size: 12px; }
.message.user .msg-bubble code { background: rgba(255,255,255,0.18); }

.msg-bubble table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12px; }
.msg-bubble th { background: var(--text); color: var(--white); padding: 6px 9px; text-align: left; font-weight: 700; font-size: 11px; letter-spacing: 0.02em; }
.msg-bubble td { padding: 5px 9px; border-bottom: 1px solid var(--border); vertical-align: top; }
.msg-bubble tr:nth-child(even) td { background: var(--grey-100); }
.msg-bubble tr:hover td { background: var(--red-light); }

.cursor { display: inline-block; width: 2px; height: 13px; background: var(--red); margin-left: 2px; vertical-align: middle; animation: blink 0.8s step-end infinite; }
.loading-dots { display: inline-flex; gap: 4px; align-items: center; padding: 3px 0; }
.loading-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--grey-300); animation: bounce 1.2s ease-in-out infinite; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

.msg-attachments { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.msg-attachment-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.message.user .msg-attachment-chip { background: rgba(255,255,255,0.18); color: rgba(255,255,255,0.9); }
.message.assistant .msg-attachment-chip { background: var(--red-light); color: var(--red); border: 1px solid rgba(215,3,33,0.15); }

/* ===== INPUT AREA ===== */
.input-area {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 12px 24px 14px;
  flex-shrink: 0;
}

.file-staging { max-width: 760px; margin: 0 auto 8px; }
.file-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.file-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 9px 4px 7px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 11.5px; color: var(--text);
  max-width: 210px; box-shadow: var(--shadow-sm); animation: fadeIn 0.18s ease;
}
.file-chip.uploading { border-color: #93c5fd; background: #eff6ff; }
.file-chip.ready     { border-color: #86efac; background: #f0fdf4; }
.file-chip.error     { border-color: #fca5a5; background: #fef2f2; }
.file-chip-icon { font-size: 13px; flex-shrink: 0; }
.file-chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.file-chip-meta { font-size: 9.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.file-chip-remove { background: none; border: none; cursor: pointer; color: var(--grey-300); padding: 0; display: flex; align-items: center; flex-shrink: 0; transition: color 0.12s; }
.file-chip-remove:hover { color: var(--red); }

.input-wrapper {
  max-width: 760px; margin: 0 auto;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; align-items: flex-end; gap: 6px;
  padding: 9px 9px 9px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.input-wrapper:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(215,3,33,0.06);
}

.attach-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px 5px;
  display: flex; align-items: center;
  border-radius: var(--radius-sm); flex-shrink: 0;
  transition: color 0.12s, background 0.12s;
}
.attach-btn:hover { color: var(--red); background: var(--red-light); }
.attach-btn.has-files { color: var(--red); }

.chat-input {
  flex: 1; border: none; outline: none; resize: none;
  font-family: var(--font);
  font-size: 13.5px; line-height: 1.55;
  color: var(--text); background: transparent;
  max-height: 150px; min-height: 21px; overflow-y: auto;
}
.chat-input::placeholder { color: var(--grey-300); }

.send-btn {
  width: 32px; height: 32px;
  background: var(--red); color: var(--white);
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.12s, transform 0.1s;
}
.send-btn:hover:not(:disabled) { background: var(--red-dark); transform: scale(1.04); }
.send-btn:disabled { background: var(--grey-200); cursor: not-allowed; }
.send-btn:active:not(:disabled) { transform: scale(0.96); }

.input-hint { max-width: 760px; margin: 6px auto 0; font-size: 10.5px; color: var(--grey-300); text-align: center; }

/* ===== ASSESS PANEL ===== */
.assess-panel {
  width: 300px;
  min-width: 300px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--grey-100);
  overflow: hidden;
  flex-shrink: 0;
}

/* Header — same height as topbar */
.assess-header {
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  background: var(--white);
  gap: 9px;
}
.assess-header-icon {
  width: 26px; height: 26px;
  background: var(--red-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--red); flex-shrink: 0;
}
.assess-title {
  font-size: 13px; font-weight: 700;
  color: var(--text); letter-spacing: -0.01em; margin: 0;
}

/* Scrollable body */
.assess-body {
  flex: 1; overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 0;
}
.assess-body::-webkit-scrollbar { width: 3px; }
.assess-body::-webkit-scrollbar-thumb { background: var(--grey-200); border-radius: 2px; }

/* ── Upload card ── */
.assess-upload-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.assess-card-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.assess-card-label-text {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}
.assess-add-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  background: var(--red-light);
  border: none; border-radius: 3px;
  color: var(--red); font-family: var(--font);
  font-size: 10.5px; font-weight: 700;
  cursor: pointer; transition: background 0.12s;
}
.assess-add-btn:hover { background: rgba(215,3,33,0.12); }

.assess-drop-zone {
  padding: 22px 16px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px dashed transparent;
}
.assess-drop-zone:hover,
.assess-drop-zone.drag-over {
  background: var(--red-light);
}
.assess-drop-zone:hover .assess-drop-icon { color: var(--red); }
.assess-drop-icon { color: var(--grey-300); transition: color 0.15s; }
.assess-drop-text {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted); margin: 0;
}
.assess-drop-sub { font-size: 10px; color: var(--grey-400); margin: 0; }

/* File items */
.assess-file-list { display: flex; flex-direction: column; }

.assess-file-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  transition: background 0.1s;
}
.assess-file-item:hover { background: var(--grey-100); }

.assess-file-thumb {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  background: var(--grey-100);
  border: 1px solid var(--border);
}
.assess-file-thumb.pdf   { background: #fff5f5; border-color: #fecaca; }
.assess-file-thumb.word  { background: #eff6ff; border-color: #bfdbfe; }
.assess-file-thumb.img   { background: #f0fdf4; border-color: #bbf7d0; }
.assess-file-thumb.sheet { background: #f0fdf4; border-color: #bbf7d0; }

.assess-file-info { flex: 1; min-width: 0; }
.assess-file-name {
  font-size: 11.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.assess-file-meta { font-size: 10px; color: var(--text-muted); margin-top: 1px; display: flex; align-items: center; gap: 4px; }
.assess-file-ok   { color: #16a34a; font-weight: 700; }
.assess-file-err  { color: var(--red); font-weight: 700; }

.assess-file-remove {
  flex-shrink: 0;
  width: 20px; height: 20px;
  background: none; border: none; cursor: pointer;
  color: var(--grey-300); padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px; transition: color 0.12s, background 0.12s;
}
.assess-file-remove:hover { color: var(--red); background: var(--red-light); }

/* ── Generate buttons ── */
.assess-actions {
  flex-shrink: 0;
  padding: 10px 12px 12px;
  display: flex; flex-direction: column; gap: 7px;
  border-top: 1px solid var(--border);
  background: var(--white);
}
.assess-actions-row { display: flex; gap: 6px; }
.assess-actions-hint {
  font-size: 10px; color: var(--grey-400);
  text-align: center; line-height: 1.4;
}

.assess-btn {
  flex: 1; padding: 9px 8px;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 12px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: all 0.12s; letter-spacing: 0.01em;
}
.assess-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.assess-btn-word { background: var(--red); color: var(--white); }
.assess-btn-word:hover:not(:disabled) { background: var(--red-dark); }
.assess-btn-pdf  { background: var(--white); border: 1px solid var(--border); color: var(--text-muted); }
.assess-btn-pdf:hover:not(:disabled)  { background: var(--grey-100); color: var(--text); border-color: var(--grey-300); }

/* ── Results card ── */
.assess-results-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.assess-results-list { display: flex; flex-direction: column; }

.assess-result-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  transition: background 0.1s;
  animation: fadeIn 0.2s ease;
}
.assess-result-item:first-child { border-top: none; }
.assess-result-item:hover { background: var(--grey-100); }

.assess-result-thumb {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.assess-result-thumb.word { background: #eff6ff; border: 1px solid #bfdbfe; }
.assess-result-thumb.pdf  { background: #fff5f5; border: 1px solid #fecaca; }

.assess-result-info { flex: 1; min-width: 0; }
.assess-result-title {
  font-size: 11.5px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.assess-result-meta { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

.assess-result-dl {
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: var(--red); color: var(--white);
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.assess-result-dl:hover { background: var(--red-dark); }
.assess-result-dl.pdf-dl {
  background: var(--white); border: 1px solid var(--border); color: var(--text-muted);
}
.assess-result-dl.pdf-dl:hover { background: var(--grey-100); color: var(--text); }

/* Loading result item */
.assess-result-item.loading {
  animation: fadeIn 0.2s ease, loadingPulse 1.8s ease infinite;
}
.assess-result-loading-text {
  font-size: 11px; color: var(--red); font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}

.doc-card {
  background: var(--grey-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  animation: fadeIn 0.2s ease;
  transition: box-shadow 0.12s;
}
.doc-card:hover { box-shadow: var(--shadow-sm); background: var(--white); }

.doc-card-top { display: flex; align-items: flex-start; gap: 9px; }
.doc-card-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--red-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--red);
}
.doc-card-info { flex: 1; min-width: 0; }
.doc-card-title { font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-card-filename { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.doc-card-date { font-size: 10px; color: var(--text-muted); }

.doc-card-actions { display: flex; gap: 5px; }
.doc-download-btn {
  flex: 1; padding: 6px 8px;
  background: var(--red); color: var(--white);
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 11px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px;
  transition: background 0.12s;
  text-decoration: none; letter-spacing: 0.01em;
}
.doc-download-btn:hover { background: var(--red-dark); }
.doc-download-btn.pdf {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.doc-download-btn.pdf:hover { background: var(--grey-100); color: var(--text); }

.docs-panel-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 12px; line-height: 1.65; flex: 1; }
.docs-empty-icon { width: 40px; height: 40px; background: var(--grey-100); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; color: var(--grey-300); }
.docs-empty-sub { margin-top: 6px; font-size: 11px; line-height: 1.55; }

@keyframes docPulse { 0%,100% { background: var(--grey-100); } 50% { background: var(--red-light); border-color: var(--red); } }
.doc-card.new { animation: fadeIn 0.3s ease, docPulse 1.6s ease 0.3s; }

@keyframes loadingPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.doc-card-loading {
  border-color: var(--red);
  background: var(--red-light);
  animation: fadeIn 0.2s ease, loadingPulse 1.8s ease infinite;
}
.doc-loading-status {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--red); font-weight: 600;
}
.doc-loading-status .spinner {
  width: 10px; height: 10px;
  border-width: 1.5px;
  border-color: var(--red);
  border-top-color: transparent;
}

/* ===== USER MENU ===== */
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 9px 5px 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer; font-family: var(--font);
  font-size: 12px; font-weight: 500;
  color: var(--text);
  transition: border-color 0.12s, background 0.12s;
}
.user-btn:hover { background: var(--grey-100); border-color: var(--grey-300); }

.user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--red); color: var(--white);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name { max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  min-width: 200px; z-index: 200; overflow: hidden;
  animation: fadeIn 0.12s ease;
}
.user-dropdown-info { padding: 12px 14px 10px; }
.user-dropdown-email { font-size: 12.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-dropdown-role { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.user-dropdown-divider { height: 1px; background: var(--border); }
.user-dropdown-item {
  width: 100%; padding: 10px 14px;
  background: none; border: none;
  font-family: var(--font); font-size: 12.5px;
  color: var(--text); cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 8px;
  transition: background 0.1s;
}
.user-dropdown-item:hover { background: var(--grey-100); }
.user-dropdown-item.logout { color: var(--red); }
.user-dropdown-item.logout:hover { background: var(--red-light); }

/* ===== DROP OVERLAY ===== */
.drop-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.18); backdrop-filter: blur(3px);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; transition: opacity 0.18s;
}
.drop-overlay.active { opacity: 1; pointer-events: all; }
.drop-box {
  background: var(--white);
  border: 2px dashed var(--red);
  border-radius: var(--radius-lg);
  padding: 48px 64px; text-align: center;
  box-shadow: var(--shadow-lg);
}
.drop-box-icon { color: var(--red); margin-bottom: 12px; display: flex; justify-content: center; }
.drop-box-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: -0.02em; }
.drop-box-sub { font-size: 12.5px; color: var(--text-muted); }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--grey-900); color: var(--white);
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 500;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.22s, transform 0.22s;
  pointer-events: none; z-index: 999;
  box-shadow: var(--shadow-lg); max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error   { background: var(--red); }
.toast.success { background: var(--green); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 900;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 24px; width: 360px; box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 16px; letter-spacing: -0.02em; }
.modal-input {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13.5px; outline: none;
  transition: border-color 0.15s;
}
.modal-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(215,3,33,0.06); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-btn-cancel {
  padding: 8px 16px; background: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; cursor: pointer; color: var(--text-muted);
}
.modal-btn-cancel:hover { background: var(--grey-100); }
.modal-btn-ok {
  padding: 8px 16px; background: var(--red); color: var(--white);
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: background 0.12s;
}
.modal-btn-ok:hover { background: var(--red-dark); }

/* ===== SESSION SEARCH ===== */
.session-search-wrap {
  padding: 6px 10px 4px;
  flex-shrink: 0;
}
.session-search-inner {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  transition: border-color 0.15s, background 0.15s;
}
.session-search-inner:focus-within {
  border-color: rgba(215,3,33,0.4);
  background: rgba(255,255,255,0.09);
}
.session-search-inner i { color: rgba(255,255,255,0.3); flex-shrink: 0; }
.session-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  min-width: 0;
}
.session-search-input::placeholder { color: rgba(255,255,255,0.28); }
.session-search-clear {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.35); padding: 0; display: flex;
  transition: color 0.12s;
}
.session-search-clear:hover { color: rgba(255,255,255,0.7); }
.session-search-meta {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  padding: 6px 6px 2px;
  letter-spacing: 0.02em;
}

/* ===== SPINNER ===== */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 11px; height: 11px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.6s linear infinite; flex-shrink: 0; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); height: 100vh; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .mobile-menu-btn { display: flex; }
  .welcome-cards { grid-template-columns: 1fr; }
  .msg-bubble { max-width: 88%; }
  .assess-panel { display: none !important; }
}
