*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #222634;
  --border: #2a2e3d;
  --text: #e4e6ed;
  --text-dim: #8b8fa3;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --success: #22c55e;
  --warning: #f59e0b;
  --agent-bg: #1e2235;
  --user-bg: #2d1b69;
}

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

/* ─── Layout ──────────────────────────────── */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.main { flex: 1; display: flex; flex-direction: column; }

/* ─── Top Navigation ─────────────────────── */
.top-nav {
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.nav-home-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.nav-home-btn:hover {
  color: var(--text);
  background: var(--bg);
}
.nav-session-label {
  font-size: 11px;
  color: var(--text-dim);
}

/* ─── Sidebar ─────────────────────────────── */
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-header h2 { font-size: 16px; font-weight: 600; }
.sidebar-header p { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ─── Progress Ring ──────────────────────── */
.progress-ring-container {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.progress-ring-fill {
  transition: stroke-dashoffset 0.6s ease;
}
.progress-ring-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

.progress-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.progress-section h3 { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }

.dept-item {
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dept-item.active { border-left: 3px solid var(--accent); }
.dept-item.completed { border-left: 3px solid var(--success); opacity: 0.7; }
.dept-item .count { margin-left: auto; color: var(--text-dim); font-size: 12px; }

/* ─── Department Item Icons ──────────────── */
.dept-item-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.dept-item-icon svg {
  width: 14px;
  height: 14px;
}

.stats {
  padding: 16px 20px;
}
.stat { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.stat-value { color: var(--accent); font-weight: 600; }

/* ─── Chat Area ───────────────────────────── */
.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.chat-header h2 { font-size: 15px; display: flex; align-items: center; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.message {
  max-width: 75%;
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  animation: fadeIn 0.3s ease;
}
.message.agent {
  background: var(--agent-bg);
  border: 1px solid var(--border);
  margin-right: auto;
}
.message.user {
  background: var(--user-bg);
  margin-left: auto;
  text-align: right;
}
.message .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.message .extraction {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.message .extraction span { color: var(--success); }

/* ─── Topic Banner ───────────────────────── */
.topic-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--agent-bg) 100%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  animation: slideDown 0.4s ease;
  transition: opacity 0.5s ease;
}
.topic-banner.fading {
  opacity: 0;
}
.topic-banner-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.topic-banner-icon svg {
  width: 28px;
  height: 28px;
}
.topic-banner-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.topic-banner-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ─── Input Area ──────────────────────────── */
.input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.input-area input {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.input-area input:focus { border-color: var(--accent); }
.input-area input::placeholder { color: var(--text-dim); }

/* ─── Shortcut Hint ──────────────────────── */
.shortcut-hint {
  text-align: center;
  padding: 6px 24px;
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.shortcut-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--accent);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-mic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-mic:hover { border-color: var(--accent); color: var(--accent); }
.btn-mic.listening {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
  animation: pulse 1.5s infinite;
}
.btn-mic.speaking {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ─── Department Selection ────────────────── */
.dept-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  overflow-y: auto;
}
.dept-select h1 { font-size: 24px; margin-bottom: 8px; }
.dept-select p { color: var(--text-dim); margin-bottom: 32px; font-size: 14px; }

.dept-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 720px;
  width: 100%;
}
.dept-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.dept-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.dept-card.selected { border-color: var(--accent); background: #1e1b4b; }
.dept-card h3 { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.dept-card p { font-size: 11px; color: var(--text-dim); }

/* ─── Department Card Icons ──────────────── */
.dept-card-icon {
  margin-bottom: 8px;
  opacity: 0.8;
}
.dept-card-icon svg {
  width: 24px;
  height: 24px;
}

/* ─── Saved Sessions ─────────────────────── */
.saved-sessions {
  max-width: 720px;
  width: 100%;
  margin-bottom: 24px;
}
.saved-sessions-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.sessions-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.session-card {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.session-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.session-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.session-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
}
.session-status.in-progress {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}
.session-status.complete {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}
.session-time {
  font-size: 11px;
  color: var(--text-dim);
}
.session-depts {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}
.session-stats {
  font-size: 12px;
  color: var(--text-dim);
}
.divider {
  text-align: center;
  margin: 20px 0 16px;
  border-bottom: 1px solid var(--border);
  line-height: 0;
}
.divider span {
  background: var(--bg);
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.start-controls { margin-top: 24px; display: flex; gap: 12px; align-items: center; }
.start-controls select {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
}

/* ─── Summary View ────────────────────────── */
.summary {
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
  overflow-y: auto;
}
.summary h1 { margin-bottom: 24px; }
.summary-dept { margin-bottom: 24px; }
.summary-dept h3 { font-size: 16px; margin-bottom: 12px; color: var(--accent); display: flex; align-items: center; }
.summary-field {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.summary-field .field-name { width: 240px; color: var(--text-dim); flex-shrink: 0; }
.summary-field .field-value { flex: 1; }

/* ─── Loading ─────────────────────────────── */
.loading {
  display: inline-flex;
  gap: 4px;
  padding: 14px 18px;
}
.loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: bounce 1.4s infinite ease-in-out;
}
.loading span:nth-child(2) { animation-delay: 0.16s; }
.loading span:nth-child(3) { animation-delay: 0.32s; }

/* ─── Animations ─────────────────────────── */
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Intake Screen ──────────────────────── */
.intake-screen {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 48px 24px 60px;
}
.intake-wrap {
  width: 100%;
  max-width: 680px;
}
.intake-header {
  text-align: center;
  margin-bottom: 36px;
}
.intake-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.intake-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.intake-header p {
  font-size: 14px;
  color: var(--text-dim);
}

.intake-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}
.intake-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.intake-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.intake-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.intake-field .required { color: var(--accent); }
.intake-field .optional { color: #555; font-weight: 400; text-transform: none; letter-spacing: 0; }
.intake-field input,
.intake-field select {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
  -webkit-appearance: none;
}
.intake-field input::placeholder { color: #444; }
.intake-field input:focus,
.intake-field select:focus { border-color: var(--accent); }
.intake-field select option { background: var(--surface); }

.intake-actions {
  margin-top: 28px;
  display: flex;
  justify-content: flex-end;
}
.btn-lg {
  padding: 13px 28px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ─── Dept Select Header with project badge ─ */
.dept-select-header {
  text-align: center;
  margin-bottom: 28px;
}
.dept-select-header h1 { font-size: 22px; margin-bottom: 6px; }
.dept-select-header p { font-size: 13px; color: var(--text-dim); }
.project-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  margin-bottom: 14px;
}
.badge-company { font-weight: 700; color: var(--text); }
.badge-sep     { color: var(--border); }
.badge-industry{ color: var(--text-dim); }
.badge-contact { color: var(--text-dim); }
.btn-back {
  margin-top: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-back:hover { color: var(--text); }

/* ─── Session Card — company name primary ── */
.session-company {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.session-meta {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 2px;
}

/* ─── Responsive intake ───────────────────── */
@media (max-width: 600px) {
  .intake-row { grid-template-columns: 1fr; }
  .intake-form { padding: 20px; }
}

/* ─── Intake title powered-by line ──────── */
.intake-powered {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 4px;
  margin-bottom: 10px;
}
.intake-sub {
  font-size: 14px;
  color: var(--text-dim);
}
