/* Outer flex layout: UDB sidebar + main dossier */
.dossierLayout {
  display: flex;
  height: calc(100vh - 140px);
  overflow: hidden;
}

.udbSidebar {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border-color, #e0e0e0);
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #fff);
  overflow: hidden;
  position: relative;
  transition: width 0.2s, min-width 0.2s;
}

.udbSidebarCollapsed {
  width: 36px;
  min-width: 36px;
}

.udbToggle {
  position: absolute;
  top: 8px;
  right: 4px;
  z-index: 2;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  background: var(--bg-card, #fff);
  cursor: pointer;
  font-size: 0.65rem;
  color: var(--text-secondary, #888);
  display: flex;
  align-items: center;
  justify-content: center;
}

.udbToggle:hover {
  background: var(--bg-hover, #f5f5f5);
  color: var(--primary-color, #F25843);
}

.dossier {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Context Selector */
.contextSelector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  flex-shrink: 0;
  align-items: center;
}

.contextChip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, #ddd);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary, #333);
  transition: all 0.15s;
  white-space: nowrap;
}

.contextChip:hover {
  border-color: var(--primary-color, #F25843);
  color: var(--primary-color, #F25843);
}

.contextChipActive {
  background: var(--primary-color, #F25843);
  color: #fff;
  border-color: var(--primary-color, #F25843);
}

.contextChipActive:hover { color: #fff; }

.contextChipIcon {
  font-weight: 700;
  font-size: 0.75rem;
}

.contextChipNew {
  width: 32px;
  height: 32px;
  border: 1px dashed var(--border-color, #ccc);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary, #888);
  flex-shrink: 0;
}

.contextChipNew:hover {
  background: var(--bg-hover, #f5f5f5);
  color: var(--primary-color, #F25843);
}

/* New Context Form */
.newContextForm {
  padding: 1rem;
  background: var(--bg-card, #fff);
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.newContextInput {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--bg-input, #fff);
  color: var(--text-primary, #333);
}

.newContextActions {
  display: flex;
  gap: 0.5rem;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 3rem;
  text-align: center;
  color: var(--text-secondary, #666);
}

.empty h3 { color: var(--text-primary, #333); margin-bottom: 0.5rem; }
.empty p { margin-bottom: 1rem; }

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  flex-shrink: 0;
}

.title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary, #333);
  margin: 0 0 0.25rem;
}

.description {
  font-size: 0.9rem;
  color: var(--text-secondary, #666);
  margin: 0;
}

.headerActions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Buttons */
.btnPrimary {
  padding: 0.5rem 1.25rem;
  background: var(--primary-color, #F25843);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.btnPrimary:hover:not(:disabled) { filter: brightness(1.08); }
.btnPrimary:disabled { background: var(--color-medium-gray, #ccc); color: var(--text-secondary, #888); cursor: not-allowed; opacity: 0.8; }

.btnSecondary {
  padding: 0.5rem 1.25rem;
  background: transparent;
  color: var(--text-primary, #333);
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btnSecondary:hover:not(:disabled) { background: var(--hover-bg, #f5f5f5); border-color: var(--primary-color, #F25843); color: var(--primary-color, #F25843); }

.btnExport {
  padding: 0.4rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-primary, #333);
  text-decoration: none;
  display: inline-block;
}

.btnExport:hover { border-color: var(--primary-color, #F25843); color: var(--primary-color, #F25843); }

.btnArchive {
  padding: 0.4rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-primary, #333);
}

.btnArchive:hover:not(:disabled) { color: var(--error-color, #dc2626); border-color: var(--error-color, #dc2626); }

.btnSmall {
  padding: 0.3rem 0.75rem;
  background: var(--primary-color, #F25843);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.btnSmall:hover:not(:disabled) { filter: brightness(1.08); }

.btnSmallDanger {
  padding: 0.3rem 0.75rem;
  background: transparent;
  color: var(--error-color, #dc2626);
  border: 1px solid var(--error-color, #dc2626);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.btnSmallDanger:hover:not(:disabled) { background: var(--error-color, #dc2626); color: #fff; }

.mutedActive { background: var(--color-medium-gray, #999); color: #fff; border-color: var(--color-medium-gray, #999); }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  flex-shrink: 0;
  padding: 0 1rem;
}

.tab {
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary, #666);
  transition: all 0.15s;
}

.tab:hover { color: var(--text-primary, #333); }

.tabActive {
  color: var(--primary-color, #F25843);
  border-bottom-color: var(--primary-color, #F25843);
}

.tabContent {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.emptyTab { text-align: center; padding: 2rem; color: var(--text-secondary, #888); }

/* ============================================================ */
/* COACHING TAB */
/* ============================================================ */
.coachingTab {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sessionStart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 2rem;
}

.sessionStart p { color: var(--text-secondary, #666); margin-bottom: 1rem; }

.personaSelector { margin-bottom: 1rem; }
.personaLabel { font-size: 0.85rem; font-weight: 500; color: var(--text-primary, #333); display: block; margin-bottom: 0.5rem; }
.personaGrid { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.personaChip {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 20px; background: var(--bg-card, #fff);
  cursor: pointer; font-size: 0.8rem;
  color: var(--text-primary, #333); transition: all 0.15s;
}
.personaChip:hover { border-color: var(--primary-color, #F25843); color: var(--primary-color, #F25843); }
.personaChipActive { background: var(--primary-color, #F25843); color: #fff; border-color: var(--primary-color, #F25843); }
.personaGender { font-size: 1rem; }

.sessionHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--bg-card, #fff);
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  flex-shrink: 0;
}

.sessionLabel { font-size: 0.85rem; font-weight: 500; color: var(--text-primary, #333); }
.sessionActions { display: flex; gap: 0.5rem; }

/* Messages */
.messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message { max-width: 80%; }
.messageUser { align-self: flex-end; }
.messageAssistant { align-self: flex-start; }

.messageBubble {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.messageUser .messageBubble {
  background: var(--primary-color, #F25843);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.messageLive {
  opacity: 0.7;
  font-style: italic;
  border: 1px dashed rgba(255, 255, 255, 0.4);
}

.messageAssistant .messageBubble {
  background: var(--bg-card, #f5f5f5);
  color: var(--text-primary, #333);
  border: 1px solid var(--border-color, #e0e0e0);
  border-bottom-left-radius: 4px;
}

.messageBubble p { margin: 0 0 0.5rem; }
.messageBubble p:last-child { margin-bottom: 0; }

.messageTime {
  font-size: 0.7rem;
  color: var(--text-secondary, #999);
  margin-top: 0.2rem;
  padding: 0 0.25rem;
}

.messageUser .messageTime { text-align: right; }

.typing { color: var(--text-secondary, #888); font-style: italic; }
.typingDots { animation: blink 1.4s infinite both; }
@keyframes blink { 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } }

.agentActivityPanel {
  margin: 0 1rem 0.75rem;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 10px;
  background: var(--bg-card, #fff);
  overflow: hidden;
  flex-shrink: 0;
}

.agentActivityHeader {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: var(--bg-hover, #f8f8f8);
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text-primary, #333);
}

.agentActivityTitle {
  font-size: 0.85rem;
  font-weight: 600;
}

.agentActivityStatus {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--text-secondary, #777);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agentActivityChevron {
  font-size: 0.8rem;
  color: var(--text-secondary, #777);
}

.agentActivityBody {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.8rem 0.9rem;
  max-height: 220px;
  overflow-y: auto;
}

.agentActivityEmpty {
  font-size: 0.8rem;
  color: var(--text-secondary, #777);
}

.agentActivityItem {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-color, #ededed);
  border-radius: 8px;
  background: var(--bg-secondary, #fafafa);
}

.agentActivityItemHeader {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.agentActivityToolName {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary, #333);
}

.agentActivityBadge {
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.agentActivityBadgeRunning {
  background: #e3f2fd;
  color: #1565c0;
}

.agentActivityBadgeSuccess {
  background: #e8f5e9;
  color: #2e7d32;
}

.agentActivityBadgeError {
  background: #fde8e8;
  color: #c62828;
}

.agentActivityMeta {
  font-size: 0.76rem;
  color: var(--text-secondary, #666);
  line-height: 1.45;
  word-break: break-word;
}

/* Input Area */
.inputArea {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color, #e0e0e0);
  background: var(--bg-card, #fff);
  flex-shrink: 0;
}

.textInputRow { display: flex; gap: 0.5rem; align-items: flex-end; }

.textInput {
  flex: 1; min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px; resize: none;
  font-size: 0.9rem; font-family: inherit;
  min-height: 40px; max-height: 120px;
  background: var(--bg-input, #fff);
  color: var(--text-primary, #333);
}

.sendBtn {
  padding: 0.6rem 1.25rem;
  background: var(--primary-color, #F25843);
  color: #fff; border: none; border-radius: 8px;
  cursor: pointer; font-size: 0.85rem; font-weight: 500;
  align-self: flex-end;
}

.sendBtn:hover:not(:disabled) { filter: brightness(1.08); }
.sendBtn:disabled { background: var(--color-medium-gray, #ccc); color: var(--text-secondary, #888); cursor: not-allowed; opacity: 0.8; }

.voiceStatus { display: flex; align-items: center; padding: 0.25rem 0; min-height: 1.5rem; }
.voiceIndicator { font-size: 0.9rem; color: var(--text-secondary, #888); }
.voiceIndicator.voiceActive { color: var(--primary-color, #F25843); font-weight: 500; }

.errorBanner {
  padding: 0.5rem 1rem;
  background: #fde8e8;
  color: var(--color-error, #d32f2f);
  font-size: 0.85rem;
  text-align: center;
  flex-shrink: 0;
}

/* ============================================================ */
/* TASKS */
/* ============================================================ */
.addTaskRow { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

.addTaskInput {
  flex: 1; padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px; font-size: 0.9rem;
  background: var(--bg-input, #fff);
  color: var(--text-primary, #333);
}

.addTaskBtn {
  padding: 0.5rem 1rem;
  background: var(--primary-color, #F25843);
  color: #fff; border: none; border-radius: 6px;
  cursor: pointer; font-size: 0.85rem;
}

.addTaskBtn:hover:not(:disabled) { filter: brightness(1.08); }
.addTaskBtn:disabled { background: var(--color-medium-gray, #ccc); color: var(--text-secondary, #888); cursor: not-allowed; opacity: 0.8; }

.taskList { display: flex; flex-direction: column; gap: 0.5rem; }

.taskItem {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
}

.taskDone { opacity: 0.6; }
.taskDone .taskTitle { text-decoration: line-through; }

.taskCheck {
  width: 28px; height: 28px;
  border: 2px solid var(--border-color, #ccc);
  border-radius: 50%; background: transparent;
  cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--primary-color, #F25843);
}

.taskContent { flex: 1; }
.taskTitle { font-size: 0.9rem; font-weight: 500; color: var(--text-primary, #333); }
.taskDesc { font-size: 0.8rem; color: var(--text-secondary, #666); margin-top: 0.2rem; }
.taskMeta { font-size: 0.75rem; }

.taskPriority { padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.7rem; text-transform: uppercase; }
.priority_high { background: #fde8e8; color: #c62828; }
.priority_medium { background: #fff3e0; color: #e65100; }
.priority_low { background: #e8f5e9; color: #2e7d32; }

.taskDelete {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-secondary, #aaa); font-size: 0.9rem; padding: 0.2rem;
}
.taskDelete:hover { color: var(--error-color, #dc2626); }

/* ============================================================ */
/* SESSIONS */
/* ============================================================ */
.sessionTimeline { display: flex; flex-direction: column; gap: 1rem; }

.sessionItem {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px; padding: 1rem;
}

.sessionItemHeader { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.5rem; }

.sessionStatus { padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500; }
.status_completed { background: #e8f5e9; color: #2e7d32; }
.status_active { background: #e3f2fd; color: #1565c0; }
.status_cancelled { background: #fde8e8; color: #c62828; }

.sessionDate { font-size: 0.8rem; color: var(--text-secondary, #666); }
.sessionScore { font-size: 0.8rem; font-weight: 600; color: var(--primary-color, #F25843); }

.sessionSummary { font-size: 0.85rem; line-height: 1.5; color: var(--text-primary, #333); margin-bottom: 0.5rem; }
.sessionSummary p { margin: 0 0 0.4rem; }

.sessionMeta { font-size: 0.75rem; color: var(--text-secondary, #888); }

.sessionExport { margin-left: 0.5rem; font-size: 0.75rem; color: var(--primary-color, #F25843); text-decoration: none; }
.sessionExport:hover { text-decoration: underline; }

/* ============================================================ */
/* SCORES */
/* ============================================================ */
.scoreList { display: flex; flex-direction: column; gap: 1rem; }

.scoreGroup {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px; padding: 1rem;
}

.scoreDimension { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.scoreDimensionLabel { font-weight: 600; font-size: 0.9rem; flex: 1; }
.scoreLatest { font-weight: 700; font-size: 1rem; color: var(--primary-color, #F25843); }

.scoreTrend { font-size: 0.75rem; }
.trend_improving { color: #2e7d32; }
.trend_stable { color: #e65100; }
.trend_declining { color: #c62828; }

.scoreBar { height: 6px; background: var(--bg-hover, #eee); border-radius: 3px; overflow: hidden; margin-bottom: 0.5rem; }
.scoreBarFill { height: 100%; background: var(--primary-color, #F25843); border-radius: 3px; transition: width 0.3s; }

.scoreEvidence { font-size: 0.8rem; color: var(--text-secondary, #666); line-height: 1.4; }

.scoreHistory { margin-top: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.scoreHistoryLabel { font-size: 0.75rem; color: var(--text-secondary, #888); }
.scoreHistoryPoints { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.scoreHistoryPoint { padding: 0.15rem 0.4rem; background: var(--bg-hover, #f0f0f0); border-radius: 4px; font-size: 0.7rem; color: var(--text-secondary, #666); }

/* ============================================================ */
/* DOCUMENTS */
/* ============================================================ */
.uploadLabel {
  padding: 0.5rem 1rem;
  background: var(--primary-color, #F25843);
  color: #fff; border-radius: 6px;
  cursor: pointer; font-size: 0.85rem;
  display: inline-block;
}

.uploadLabel:hover { filter: brightness(1.08); }

.documentList { display: flex; flex-direction: column; gap: 0.5rem; }

.documentItem {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
}

.documentInfo { flex: 1; }
.documentName { font-size: 0.9rem; font-weight: 500; color: var(--text-primary, #333); }
.documentMeta { font-size: 0.75rem; color: var(--text-secondary, #888); margin-top: 0.2rem; }
.documentSummary { font-size: 0.8rem; color: var(--text-secondary, #666); margin-top: 0.4rem; line-height: 1.4; }
.documentActions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
