* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f0f2f5; height: 100vh; display: flex; flex-direction: column; }

/* Header */
.header { background: #fff; padding: 12px 24px; display: flex; align-items: center; border-bottom: 2px solid #e8ecf1; gap: 16px; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 36px; height: 36px; background: #1a2b4a; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
.brand-name { font-weight: 700; font-size: 16px; color: #1a2b4a; }
.header-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 16px; }

/* Status */
.status-badge { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot.idle { background: #9ca3af; }
.status-dot.recording { background: #ef4444; animation: pulse 1.2s infinite; }
.status-dot.stopped { background: #22c55e; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* Buttons */
.btn { border: none; padding: 10px 24px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.btn-start { background: #3b5bdb; color: #fff; }
.btn-start:hover { background: #2b4acb; }
.btn-stop { background: #ef4444; color: #fff; }
.btn-stop:hover { background: #dc2626; }
.btn-save { background: #22c55e; color: #fff; display: none; }
.btn-save:hover { background: #16a34a; }
.btn-save-transcript { background: #3b82f6; color: #fff; display: none; }
.btn-save-transcript:hover { background: #2563eb; }
.btn-proceed { background: #f59e0b; color: #fff; display: none; }
.btn-proceed:hover { background: #d97706; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-new { background: #1a2b4a; color: #fff; }
.btn-new:hover { background: #0f1d33; }
.btn-history { background: #f3f4f6; color: #4b5563; padding: 8px 14px; font-size: 13px; }
.btn-history:hover { background: #e5e7eb; }
.btn-pause { background: #f59e0b; color: #fff; }
.btn-pause:hover { background: #d97706; }
.btn-resume-session { background: #7c3aed; color: #fff; margin-top: 10px; font-size: 13px; padding: 8px 16px; width: 100%; justify-content: center; }
.btn-resume-session:hover { background: #6d28d9; }

/* Main layout */
.main { flex: 1; padding: 16px 24px; overflow: hidden; display: flex; gap: 16px; }
.panel { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.panel-header { padding: 16px 20px; font-size: 13px; font-weight: 700; color: #6b7280; letter-spacing: .5px; text-transform: uppercase; border-bottom: 1px solid #f3f4f6; flex-shrink: 0; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px 20px; }

/* Tabs */
.tab-bar { display: flex; border-bottom: 1px solid #e5e7eb; flex-shrink: 0; }
.tab-btn { flex: 1; padding: 10px 0; text-align: center; font-size: 13px; font-weight: 600; color: #9ca3af; background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent; transition: all .15s; }
.tab-btn.active { color: #3b5bdb; border-bottom-color: #3b5bdb; }
.tab-btn:hover:not(.active) { color: #6b7280; }
.tab-content { display: none; }
.tab-content.active { display: block; padding-top: 12px; }

/* Transcript styles */
.transcript { font-family: monospace; font-size: 14px; color: #1f2937; line-height: 1.8; white-space: pre-wrap; }
.transcript-clean { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 15px; line-height: 2; }
.speaker-d { color: #2563eb; font-weight: 700; }
.speaker-p { color: #059669; font-weight: 700; }
.typewriter-cursor { display: inline-block; width: 2px; height: 18px; background: #3b5bdb; margin-left: 2px; animation: blink 0.8s infinite; vertical-align: text-bottom; }
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0; } }
.waiting-msg { color: #9ca3af; font-style: italic; font-size: 14px; }

/* Upload */
.audio-upload { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }
.audio-upload label { font-size: 13px; font-weight: 600; color: #166534; }
.audio-upload input[type="file"] { margin-top: 6px; font-size: 12px; }
.btn-upload { background: #7c3aed; color: #fff; margin-top: 8px; font-size: 13px; padding: 8px 16px; }
.btn-upload:hover { background: #6d28d9; }
.btn-upload:disabled { opacity: .5; cursor: not-allowed; }
.progress-bar { width: 100%; height: 6px; background: #e5e7eb; border-radius: 3px; margin-top: 8px; display: none; }
.progress-fill { height: 100%; background: #7c3aed; border-radius: 3px; width: 0%; transition: width 0.3s; }

/* Clinical fields */
.clinical-fields { display: none; }
.field-group { margin-bottom: 14px; }
.field-label { font-size: 12px; font-weight: 700; color: #4b5563; letter-spacing: .4px; text-transform: uppercase; margin-bottom: 4px; }
.field-input { width: 100%; padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 14px; color: #1f2937; font-family: inherit; line-height: 1.5; resize: none; background: #f8fafc; cursor: default; }
.field-input.has-data { border-left: 4px solid #3b5bdb; }
.field-input.field-updated { animation: fieldHighlight 1.5s ease-out; }
@keyframes fieldHighlight { 0% { background: #eff6ff; border-left-color: #60a5fa; } 100% { background: #f8fafc; border-left-color: #3b5bdb; } }

.panel-body::-webkit-scrollbar { width: 6px; }
.panel-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* History sidebar */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 100; display: none; }
.sidebar-overlay.open { display: block; }
.sidebar { position: fixed; top: 0; right: -380px; width: 380px; height: 100vh; background: #fff; z-index: 101; box-shadow: -4px 0 20px rgba(0,0,0,.15); transition: right .3s ease; display: flex; flex-direction: column; }
.sidebar.open { right: 0; }
.sidebar-header { padding: 16px 20px; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.sidebar-header h3 { font-size: 16px; color: #1a2b4a; margin: 0; }
.sidebar-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #6b7280; padding: 4px 8px; }
.sidebar-close:hover { color: #1f2937; }
.sidebar-list { flex: 1; overflow-y: auto; padding: 12px; }
.session-item { padding: 12px 16px; border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: all .15s; }
.session-item:hover { background: #f8fafc; border-color: #3b5bdb; }
.session-time { font-size: 14px; font-weight: 600; color: #1f2937; }
.sidebar-empty { color: #9ca3af; font-style: italic; text-align: center; padding: 40px 20px; font-size: 14px; }

/* Session view */
.session-view { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.session-view.active { display: flex; }
.session-back { background: none; border: none; font-size: 13px; color: #3b5bdb; cursor: pointer; padding: 12px 20px; text-align: left; font-weight: 600; border-bottom: 1px solid #f3f4f6; flex-shrink: 0; }
.session-back:hover { color: #2b4acb; }
.session-content { flex: 1; overflow-y: auto; padding: 16px 20px; }
.session-section { margin-bottom: 16px; }
.session-section-title { font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.session-section-body { font-size: 13px; color: #1f2937; line-height: 1.7; white-space: pre-wrap; background: #f8fafc; padding: 10px 14px; border-radius: 8px; border: 1px solid #e5e7eb; }
.session-field-label { font-size: 11px; font-weight: 700; color: #4b5563; text-transform: uppercase; margin-top: 10px; margin-bottom: 2px; }
.session-field-val { font-size: 13px; color: #1f2937; padding: 6px 0; }
