* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; color: #333; height: 100vh; display: flex; flex-direction: column; }
header { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; background: #fff; border-bottom: 1px solid #ddd; }
.header-left { display: flex; align-items: center; gap: 8px; }
header h1 { font-size: 15px; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 8px; }
#stage-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 8px; border-radius: 10px; background: #f3f4f6; color: #6b7280; display: none; }
button { padding: 5px 10px; border: 1px solid #ccc; border-radius: 5px; background: #fff; cursor: pointer; font-size: 12px; transition: all 0.15s; }
button:hover { background: #f0f0f0; border-color: #aaa; }
#btn-mic { background: #fef3c7; border-color: #f59e0b; }
#btn-mic:hover { background: #fde68a; }
#btn-demo { background: #dbeafe; border-color: #3b82f6; }
#btn-demo:hover { background: #bfdbfe; }
#btn-reset { background: #fee2e2; border-color: #ef4444; }
#btn-reset:hover { background: #fecaca; }
/* Mode toggle (Note | Exchange) */
.mode-toggle { position: relative; display: inline-flex; background: #f3f4f6; border-radius: 8px; padding: 2px; cursor: pointer; user-select: none; }
.mode-option { position: relative; z-index: 1; padding: 4px 14px; font-size: 11px; font-weight: 500; color: #6b7280; border-radius: 6px; transition: color 0.2s; white-space: nowrap; }
.mode-option.active { color: #fff; font-weight: 600; }
.mode-slider { position: absolute; top: 2px; left: 2px; height: calc(100% - 4px); width: calc(50% - 2px); background: #2563eb; border-radius: 6px; transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3); }
.mode-toggle.note-active .mode-slider { transform: translateX(0); }
.mode-toggle.exchange-active .mode-slider { transform: translateX(100%); }
#btn-report { background: #e5e7eb; border-color: #9ca3af; color: #9ca3af; cursor: not-allowed; }
#btn-report:not(:disabled) { background: #d1fae5; border-color: #059669; color: #059669; cursor: pointer; font-weight: 600; }
#btn-report:not(:disabled):hover { background: #a7f3d0; }
.status-inline { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #666; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #999; flex-shrink: 0; }

main { display: grid; grid-template-columns: 420px 1fr 320px; gap: 1px; background: #ddd; flex: 1; min-height: 0; }
.left-panel { background: #fff; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.transcript-panel { background: #fff; padding: 12px; overflow-y: auto; }
.section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #888; margin-bottom: 8px; }

/* Chat bubbles */
#transcript { font-size: 13px; line-height: 1.5; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 16px; position: relative; word-wrap: break-word; }
.bubble .speaker-name { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px; display: block; }
.bubble-unknown { align-self: center; background: #f3f4f6; color: #6b7280; border-radius: 12px; font-style: italic; max-width: 90%; }
.bubble-rep { align-self: flex-start; background: #dbeafe; color: #1e3a5f; border-bottom-left-radius: 4px; }
.bubble-rep .speaker-name { color: #2563eb; }
.bubble-client { align-self: flex-end; background: #f3f4f6; color: #1a1a1a; border-bottom-right-radius: 4px; }
.bubble-client .speaker-name { color: #dc2626; }
.bubble-note { align-self: flex-start; background: #f0fdf4; color: #166534; border-radius: 12px; max-width: 90%; }

/* Questions in left panel — compact sticky-note prompts */
#questions { display: flex; flex-direction: column; gap: 4px; }
.question-card { background: #fafafa; border-radius: 6px; padding: 6px 8px; font-size: 12px; border-left: 3px solid #3b82f6; line-height: 1.35; }
.question-card.priority-critical { border-left-color: #ef4444; background: #fef2f2; }
.question-card.priority-high { border-left-color: #f59e0b; background: #fffbeb; }
.question-card.priority-medium { border-left-color: #3b82f6; }
.question-card .q-text { font-weight: 600; }
.question-card .q-reasoning { font-size: 11px; color: #6b7280; margin-top: 3px; font-weight: 400; }

/* Cost table */
.cost-panel { margin-top: auto; border-top: 1px solid #eee; padding-top: 10px; }
.cost-table { width: 100%; font-family: 'SF Mono', 'Consolas', monospace; font-size: 11px; border-collapse: collapse; }
.cost-table td { padding: 2px 0; }
.cost-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.cost-table .cost-label { color: #888; }
.cost-table .cost-val { color: #333; font-weight: 500; }
.cost-table .cost-total { border-top: 1px solid #ddd; padding-top: 4px; font-weight: 700; }
.cost-table .cost-total .cost-val { color: #059669; font-size: 13px; }
.cost-rate { font-size: 10px; color: #9ca3af; text-align: right; margin-top: 4px; }

.empty { color: #aaa; font-style: italic; font-size: 12px; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Conflict resolution panel */
/* Facts panel (right column) */
.facts-panel { background: #fff; padding: 12px; overflow-y: auto; }
.facts-list { display: flex; flex-direction: column; gap: 3px; }
.fact-item {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 8px; border-radius: 6px; background: #f9fafb;
    font-size: 12px; transition: background 0.3s;
    cursor: default; min-height: 28px;
}
.fact-item.fact-new { animation: fact-flash 1.2s ease-out; }
@keyframes fact-flash { from { background: #dbeafe; } to { background: #f9fafb; } }

/* Fact type icon */
.fact-icon { flex-shrink: 0; width: 18px; height: 18px; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 10px; line-height: 1; }
.fact-icon-form { background: #dbeafe; color: #1d4ed8; }
.fact-icon-insight { background: #f3e8ff; color: #7c3aed; border-radius: 50%; }

/* Fact content — memo style, compact */
.fact-memo { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; line-height: 1.3; }
.fact-expanded .fact-memo { white-space: normal; }
.fact-clickable { cursor: pointer; }
.fact-clickable:hover { background: #f0f4ff; }
.fact-memo .fact-key { color: #6b7280; }
.fact-memo .fact-val { font-weight: 600; color: #111; }

/* Conflict warning on a fact */
/* Update badge */
.fact-badge-update {
    flex-shrink: 0; font-size: 8px; font-weight: 700; text-transform: uppercase;
    background: #e0e7ff; color: #3730a3; padding: 1px 4px; border-radius: 3px;
}
.fact-badge-prefill {
    flex-shrink: 0; font-size: 8px; font-weight: 700; text-transform: uppercase;
    background: #f3f4f6; color: #6b7280; padding: 1px 4px; border-radius: 3px;
}
.fact-badge-conflict {
    flex-shrink: 0; font-size: 8px; font-weight: 700; text-transform: uppercase;
    background: #fef2f2; color: #dc2626; padding: 1px 4px; border-radius: 3px;
}
.fact-badge-confirmed {
    flex-shrink: 0; font-size: 8px; font-weight: 700; text-transform: uppercase;
    background: #f0fdf4; color: #059669; padding: 1px 4px; border-radius: 3px;
}
.fact-val-old {
    text-decoration: line-through; color: #9ca3af; font-weight: 400; margin-right: 4px;
}

/* Group labels in facts panel */
.facts-group-label {
    font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: #9ca3af; padding: 4px 0 2px; border-bottom: 1px solid #f3f4f6; margin-bottom: 2px;
}

/* Missing fields */
.fact-missing { opacity: 0.5; }
.fact-icon-missing {
    flex-shrink: 0; width: 18px; height: 18px; border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; line-height: 1;
    background: #fef2f2; color: #ef4444; font-weight: 700;
}
