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

:root {
  --bg:        #0f1117;
  --bg2:       #161b27;
  --bg3:       #1e2535;
  --border:    #2a3044;
  --accent:    #4f8ef7;
  --accent2:   #7c5cbf;
  --green:     #22c55e;
  --red:       #ef4444;
  --yellow:    #f59e0b;
  --text:      #e2e8f0;
  --text2:     #8892a4;
  --agent-bg:  #1a2540;
  --expert-bg: #1a2832;
  --radius:    8px;
  --shadow:    0 2px 12px rgba(0,0,0,.4);
  font-size: 14px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.app    { display: flex; height: 100vh; }
.sidebar { width: 220px; min-width: 220px; background: var(--bg2); border-right: 1px solid var(--border);
           display: flex; flex-direction: column; padding: 20px 0; }
.main   { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.logo   { display: flex; align-items: center; gap: 10px; padding: 0 20px 24px;
          font-weight: 700; font-size: 15px; letter-spacing: -.3px; }
.logo-icon { color: var(--accent); font-size: 18px; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.nav-btn {
  background: transparent; border: none; color: var(--text2);
  text-align: left; padding: 9px 12px; border-radius: var(--radius);
  cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s;
}
.nav-btn:hover  { background: var(--bg3); color: var(--text); }
.nav-btn.active { background: var(--bg3); color: var(--accent); }

.status-panel { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--border); }
.status-row   { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.dot          { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.dot.ok       { background: var(--green); }
.dot.err      { background: var(--red); }
.dot.live     { background: var(--green); animation: pulse 2s infinite; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Two column layout ─────────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 380px 1fr; gap: 20px; height: calc(100vh - 48px); }

/* ── Panel ─────────────────────────────────────────────────────────────────── */
.panel {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.panel-transcript { display: flex; flex-direction: column; overflow: hidden; height: 100%; }
.panel-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.panel-desc  { font-size: 13px; color: var(--text2); margin-bottom: 20px; line-height: 1.6; }

/* ── Form Controls ─────────────────────────────────────────────────────────── */
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2);
               margin-bottom: 6px; margin-top: 14px; text-transform: uppercase; letter-spacing: .5px; }
.input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: var(--radius);
  font-size: 13px; font-family: inherit; transition: border .15s;
}
.input:focus { outline: none; border-color: var(--accent); }
.textarea     { resize: vertical; min-height: 60px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text2); }

.btn-row { display: flex; gap: 10px; margin-top: 20px; }
.btn {
  padding: 9px 18px; border-radius: var(--radius); font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn:disabled     { opacity: .4; cursor: not-allowed; }
.btn-primary      { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #3d7de8; }
.btn-danger       { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #dc2626; }
.btn-warning      { background: #f59e0b; color: #fff; }
.btn-warning:hover:not(:disabled) { background: #d97706; }
.btn-success      { background: #10b981; color: #fff; }
.btn-success:hover:not(:disabled) { background: #059669; }
.btn-ghost        { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover  { color: var(--text); border-color: var(--text2); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-col { display: flex; flex-direction: column; }

/* ── Transcript ────────────────────────────────────────────────────────────── */
.transcript-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .5px; }
.badge-idle { background: var(--bg3); color: var(--text2); }
.badge-live { background: #16341a; color: var(--green); }
.badge-ended { background: #2d1a1a; color: var(--red); }

.transcript-box {
  flex: 1; overflow-y: auto; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px;
  min-height: 200px;
}
.transcript-placeholder { color: var(--text2); font-size: 13px; text-align: center; margin: auto; }

.turn { max-width: 88%; border-radius: var(--radius); padding: 10px 14px; font-size: 13px; line-height: 1.6; }
.turn-agent  { background: var(--agent-bg); border-left: 3px solid var(--accent); align-self: flex-start; }
.turn-expert { background: var(--expert-bg); border-left: 3px solid var(--green); align-self: flex-end; }
.turn-label  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; opacity: .6; }
.turn-interim { color: var(--text2); font-style: italic; font-size: 12px; align-self: flex-end; }

/* ── Inject panel ──────────────────────────────────────────────────────────── */
.inject-panel { margin-top: 10px; }
.inject-panel .input { background: var(--bg3); }

/* ── Insights ──────────────────────────────────────────────────────────────── */
.insights-panel { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.insights-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--accent); }
.insights-content { font-size: 13px; line-height: 1.7; color: var(--text2); white-space: pre-wrap; }
.insights-content h1, .insights-content h2, .insights-content h3 { color: var(--text); margin: 12px 0 6px; }
.insights-content strong { color: var(--text); }

/* ── Upload ─────────────────────────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 32px;
  text-align: center; cursor: pointer; transition: border .15s; margin-bottom: 16px;
  position: relative;
}
.upload-area:hover, .upload-area.drag-over { border-color: var(--accent); }
.upload-icon { font-size: 28px; margin-bottom: 10px; color: var(--text2); }
.upload-hint { font-size: 12px; color: var(--text2); margin-top: 6px; }
.file-input  { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-progress { margin-bottom: 16px; }
.progress-bar   { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.progress-fill  { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; width: 0%; }

/* ── Item List ─────────────────────────────────────────────────────────────── */
.item-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.item-placeholder { color: var(--text2); font-size: 13px; padding: 20px 0; text-align: center; }
.item-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
}
.item-info   { display: flex; flex-direction: column; gap: 2px; }
.item-name   { font-size: 13px; font-weight: 500; }
.item-meta   { font-size: 11px; color: var(--text2); }
.item-actions { display: flex; gap: 6px; }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* ── Section title ─────────────────────────────────────────────────────────── */
.section-title { font-size: 13px; font-weight: 600; color: var(--text2); margin: 20px 0 10px;
                 text-transform: uppercase; letter-spacing: .5px; }

/* ── Transcript viewer ─────────────────────────────────────────────────────── */
.transcript-viewer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tabs-inner { display: flex; gap: 8px; margin-bottom: 14px; }
.tab-inner-btn { background: transparent; border: 1px solid var(--border); color: var(--text2);
                 padding: 6px 14px; border-radius: var(--radius); cursor: pointer; font-size: 12px; }
.tab-inner-btn.active { border-color: var(--accent); color: var(--accent); }
.viewer-box { max-height: 500px; overflow-y: auto; }

/* ── Research ──────────────────────────────────────────────────────────────── */
.research-output { margin-top: 20px; }
#research-content { font-size: 13px; color: var(--text2); line-height: 1.7; white-space: pre-wrap; }

/* ── Scrollbars ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }
