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

:root {
  --bg: #0d1117;
  --bg-surface: #161b22;
  --bg-elevated: #21262d;
  --bg-input: #0d1117;
  --border: #30363d;
  --border-focus: #58a6ff;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #484f58;
  --primary: #238636;
  --primary-hover: #2ea043;
  --primary-text: #ffffff;
  --accent: #58a6ff;
  --danger: #da3633;
  --danger-bg: rgba(218,54,51,0.12);
  --success: #3fb950;
  --success-bg: rgba(63,185,80,0.12);
  --warning: #d29922;
  --user-bubble: #1f4a8a;
  --ai-bubble: #1c2128;
  --bg-card: #161b22;
  --editor-bg: #0d1117;      /* code editor / CodeMirror surface */
  --code-block-bg: #0d1117;  /* fenced code blocks inside chat bubbles */
  --radius: 8px;
  --radius-lg: 12px;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Menlo', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --header-h: 56px;
}

/* ── Light theme (F3) — overrides every color variable; toggled via
   <html data-theme="light">. The CodeMirror code editor keeps its dark
   (dracula) theme intentionally, like most light-mode IDEs. */
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-surface: #f6f8fa;
  --bg-elevated: #eaeef2;
  --bg-input: #ffffff;
  --border: #d0d7de;
  --border-focus: #0969da;
  --text: #1f2328;
  --text-muted: #656d76;
  --text-dim: #8c959f;
  --primary: #1f883d;
  --primary-hover: #1a7f37;
  --primary-text: #ffffff;
  --accent: #0969da;
  --danger: #cf222e;
  --danger-bg: rgba(207,34,46,0.10);
  --success: #1a7f37;
  --success-bg: rgba(26,127,55,0.12);
  --warning: #9a6700;
  --user-bubble: #0969da;
  --ai-bubble: #eaeef2;
  --bg-card: #ffffff;
  --editor-bg: #ffffff;
  --code-block-bg: #f6f8fa;
}

html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 14px; line-height: 1.6; }

/* ── App layout ─────────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100vh; }

/* ── Header ─────────────────────────────────────────────── */
.header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-center {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center;
}
.mode-switcher { position: relative; }
.mode-switcher-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 600;
  font-family: var(--font-sans); cursor: pointer;
  padding: 5px 12px; border-radius: 20px;
  transition: background 0.12s, border-color 0.12s;
}
.mode-switcher-btn:hover { background: var(--bg-card); border-color: var(--accent); }
.mode-switcher-btn svg { color: var(--text-muted); }
.mode-switcher-dropdown {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  min-width: 130px; z-index: 200;
}
.mode-switcher-item {
  display: block; width: 100%; text-align: center;
  padding: 9px 16px; background: none; border: none;
  color: var(--text); font-size: 13px; font-family: var(--font-sans); cursor: pointer;
  transition: background 0.1s;
}
.mode-switcher-item:hover { background: var(--bg-elevated); }
.mode-switcher-item.active { color: var(--accent); font-weight: 600; }
.logo-icon { flex-shrink: 0; color: var(--text); cursor: pointer; }
.logo { font-size: 20px; font-family: 'Pacifico', cursive; font-weight: 400; letter-spacing: 0; color: var(--text); cursor: pointer; }
.brand-text { font-family: 'Pacifico', cursive; font-weight: 400; color: var(--text); }
.header-divider { width: 1px; height: 14px; background: rgba(255,255,255,0.15); flex-shrink: 0; }
.subtitle { color: rgba(255,255,255,0.2); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; }
.header-right { display: flex; align-items: center; gap: 8px; }

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-dim); transition: background 0.3s;
}
.status-dot.active { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.loading { background: var(--warning); animation: pulse 1s infinite; }
.status-text { font-size: 12px; color: var(--text-muted); }

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

/* ── Main split ─────────────────────────────────────────── */
.main { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow: hidden;
  transition: width 0.22s ease;
}
.sidebar.collapsed { width: 0; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; min-width: 220px;
}
.sidebar-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-muted);
}

.sidebar-list {
  flex: 1; overflow-y: auto; padding: 6px;
  min-width: 220px;
}
.sidebar-list::-webkit-scrollbar { width: 4px; }
.sidebar-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-empty { text-align: center; color: var(--text-dim); font-size: 12px; padding: 20px 10px; }

.session-item {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 8px; border-radius: 6px; cursor: pointer;
  transition: background 0.12s; margin-bottom: 2px;
  border: 1px solid transparent;
}
.session-item:hover  { background: var(--bg-elevated); }
.session-item.active {
  background: rgba(88,166,255,0.08);
  border-color: rgba(88,166,255,0.2);
}

.session-item-body { flex: 1; min-width: 0; }
.session-name {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.session-meta { display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.session-status {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  padding: 1px 5px; border-radius: 8px; letter-spacing: 0.3px; flex-shrink: 0;
}
.status-completed   { background: var(--success-bg); color: var(--success); }
.status-in-progress { background: rgba(210,153,34,0.12); color: var(--warning); }
.status-failing     { background: var(--danger-bg); color: #f85149; }
.status-neutral     { background: rgba(139,148,158,0.1); color: var(--text-dim); }
.session-date { font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: hidden; }

.session-item-actions { flex-shrink: 0; align-self: flex-start; padding-top: 2px; }

/* Problem list inside session items */
.session-problems { display: flex; flex-direction: column; gap: 3px; margin: 4px 0 2px; }
.session-problem-item {
  display: flex; align-items: center; gap: 5px;
}
.session-problem-name {
  flex: 1; font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-problem-item .session-status {
  font-size: 8px; padding: 1px 4px;
}

/* Status dot in problem dropdown and session problem list */
.prob-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-dim);
}
/* Slightly larger dot in the trigger button */
#problemSelectDot { width: 8px; height: 8px; }
.session-menu-trigger {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 3px 5px; border-radius: 4px;
  font-size: 15px; line-height: 1; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.session-item:hover .session-menu-trigger,
.session-item.active .session-menu-trigger,
.session-menu-trigger.open { opacity: 1; }
.session-menu-trigger:hover,
.session-menu-trigger.open { background: var(--bg-elevated); color: var(--text); }

/* Shared context menu (fixed-positioned) */
.session-menu {
  position: fixed; z-index: 200;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 148px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  overflow: hidden;
}
.session-menu[hidden] { display: none; }
.session-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; background: none; border: none;
  color: var(--text); font-size: 12px; font-family: var(--font-sans);
  text-align: left; padding: 9px 13px;
  cursor: pointer; transition: background 0.1s;
}
.session-menu-item:hover { background: rgba(255,255,255,0.05); }
.session-menu-item:disabled { color: var(--text-dim); cursor: default; }
.session-menu-item:disabled:hover { background: none; }
.session-menu-item.danger { color: #f85149; }
.session-menu-item.danger:hover { background: var(--danger-bg); }

/* Sidebar section labels + divider */
.sidebar-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-dim);
  padding: 10px 8px 4px;
}
.sidebar-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* Problem history items */
.problem-track-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 6px; margin-bottom: 1px;
}
.problem-track-item:hover { background: var(--bg-elevated); }
.problem-track-name {
  flex: 1; font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.problem-track-chip {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  padding: 1px 5px; border-radius: 8px; flex-shrink: 0; letter-spacing: 0.3px;
}
.chip-reviewed { background: var(--success-bg); color: var(--success); }
.chip-count    { background: var(--bg-elevated); color: var(--text-dim); border: 1px solid var(--border); }

/* ── Resize handle ──────────────────────────────────────── */
.resize-handle {
  width: 4px;
  flex-shrink: 0;
  background: var(--border);
  cursor: col-resize;
  position: relative;
  transition: background 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.resize-handle:hover,
.resize-handle.dragging { background: var(--accent); }

/* Wider invisible hit-target */
.resize-handle::before {
  content: ''; position: absolute;
  top: 0; bottom: 0; left: -6px; right: -6px;
}

/* Grip dots */
.resize-grip {
  display: flex; flex-direction: column; gap: 3px;
  pointer-events: none;
}
.resize-grip::before,
.resize-grip::after {
  content: '';
  width: 2px; height: 2px; border-radius: 50%;
  background: var(--text-dim);
  display: block;
}
.resize-handle:hover .resize-grip::before,
.resize-handle:hover .resize-grip::after,
.resize-handle.dragging .resize-grip::before,
.resize-handle.dragging .resize-grip::after {
  background: var(--accent);
}

/* ── Left panel tabs ────────────────────────────────────── */
.left-panel-tabs {
  display: flex; flex-shrink: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.left-tab {
  flex: 1; background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 12px; font-weight: 600;
  padding: 9px 16px; cursor: pointer; font-family: var(--font-sans);
  transition: all 0.15s; margin-bottom: -1px;
}
.left-tab:hover { color: var(--text); }
.left-tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* Description view inside left panel */
.left-desc-view {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
  min-height: 0;
}
.left-desc-view::-webkit-scrollbar { width: 6px; }
.left-desc-view::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.left-desc-body { padding: 20px; }
.left-desc-empty {
  color: var(--text-dim); font-size: 13px; padding: 40px 20px;
  text-align: center;
}
.left-desc-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
/* Reuse modal-body markdown styles for description view */
.left-desc-body h1,.left-desc-body h2 { font-size: 18px; margin: 0 0 12px; color: var(--text); }
.left-desc-body h3 { font-size: 15px; margin: 16px 0 6px; color: var(--accent); }
.left-desc-body p { margin: 0 0 10px; line-height: 1.7; }
.left-desc-body ul,.left-desc-body ol { padding-left: 20px; margin: 8px 0; }
.left-desc-body li { margin: 4px 0; }
.left-desc-body strong { color: var(--text); }
.left-desc-body code { font-family: var(--font-mono); background: rgba(110,118,129,0.15); padding: 1px 5px; border-radius: 4px; font-size: 13px; color: #f0883e; }
.left-desc-body pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow-x: auto; margin: 10px 0; }
.left-desc-body pre code { background: none; padding: 0; color: var(--text); font-size: 12px; }

/* ── Report header ───────────────────────────────────────── */
.report-header {
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.report-brand {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.report-logo { font-family: 'Pacifico', cursive; font-size: 18px; color: var(--text); }
.report-brand-divider { width: 1px; height: 14px; background: rgba(255,255,255,0.2); }
.report-algo { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: rgba(255,255,255,0.25); }
.report-type { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.report-date { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.report-assess-meta {
  display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap;
}
.report-assess-chip {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 2px 8px; border-radius: 6px;
  background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border);
}
.report-problems { display: flex; gap: 6px; flex-wrap: wrap; }
.report-problem-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 5px;
  background: rgba(88,166,255,0.1); color: var(--accent);
  border: 1px solid rgba(88,166,255,0.2);
}

/* ── Chat panel ─────────────────────────────────────────── */
.chat-panel {
  width: 44%; min-width: 280px; max-width: calc(100% - 340px);
  display: flex; flex-direction: column;
  background: var(--bg);
}

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Welcome */
.welcome-message {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  gap: 16px; margin: auto; padding: 40px 20px;
}
.welcome-brand-title { font-size: 40px; line-height: 1; }
.welcome-message p { color: var(--text-muted); max-width: 300px; }

.welcome-problem-picker {
  display: flex; flex-direction: column; align-items: stretch;
  width: 260px; text-align: left;
}
.welcome-problem-picker label {
  font-size: 11px; font-weight: 500; letter-spacing: .3px;
  color: var(--text-muted); margin-bottom: 5px;
  text-transform: uppercase;
}
.welcome-problem-select {
  background: var(--bg-elevated, #1c2128);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
  width: 100%;
}
.welcome-problem-select:focus { border-color: var(--accent); }
.welcome-problem-select option, .welcome-problem-select optgroup {
  background: var(--bg-card, #161b22);
  color: var(--text);
}

/* Messages */
.message { display: flex; gap: 10px; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.message.user { flex-direction: row-reverse; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; margin-top: 2px;
}
.message.user .avatar { background: var(--accent); }
.message.ai .avatar { background: var(--bg-elevated); border: 1px solid var(--border); }

.bubble {
  max-width: 80%; padding: 10px 14px;
  border-radius: var(--radius-lg); line-height: 1.65; word-break: break-word;
}
.message.user .bubble { background: var(--user-bubble); border-bottom-right-radius: 4px; color: #cde; }
.message.ai .bubble { background: var(--ai-bubble); border: 1px solid var(--border); border-bottom-left-radius: 4px; }

/* Markdown inside bubble */
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin-bottom: 0; }
.bubble h1,.bubble h2,.bubble h3 { margin: 12px 0 6px; font-size: 1em; color: var(--accent); }
.bubble ul,.bubble ol { padding-left: 20px; margin: 6px 0; }
.bubble li { margin: 2px 0; }
.bubble code { font-family: var(--font-mono); background: rgba(110,118,129,0.15); padding: 1px 5px; border-radius: 4px; font-size: 12px; color: #f0883e; }
.bubble pre { background: var(--code-block-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow-x: auto; margin: 8px 0; }
.bubble pre code { background: none; padding: 0; color: var(--text); font-size: 12px; line-height: 1.6; }

/* Typing indicator */
.typing-indicator .bubble { display: flex; gap: 4px; align-items: center; padding: 12px 16px; }
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); animation: typingBounce 1.2s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* Streaming cursor */
.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.8s step-end infinite;
}
@keyframes cursorBlink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* The plain-text span shown while a response is streaming */
.message.ai .bubble span[style] {
  line-height: 1.65;
  color: var(--text);
}

/* Chat input */
.chat-input-area { border-top: 1px solid var(--border); padding: 12px 16px; background: var(--bg-surface); flex-shrink: 0; }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-family: var(--font-sans);
  font-size: 14px; padding: 10px 14px; resize: none; outline: none;
  transition: border-color 0.2s; max-height: 140px; overflow-y: auto; line-height: 1.5;
}
.chat-input:focus { border-color: var(--border-focus); }
.chat-input::placeholder { color: var(--text-dim); }
.send-btn { width: 42px; height: 42px; flex-shrink: 0; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); }
.chat-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* ── Editor panel ───────────────────────────────────────── */
/* min-width guarantees the editor never gets starved of space when the
   sidebar and live-feedback panel are both open — .chat-panel's width is a
   % of the full row (not what's left after siblings), so without this floor
   it would happily take 44% and leave the editor with whatever scraps remain.
   440px (not just "wide enough for the code") because .editor-header's own
   row (language tabs + Clear + Run Tests) needs ~386px just by itself before
   any code is visible — below that it silently clips instead of wrapping. */
.editor-panel { flex: 1; display: flex; flex-direction: column; background: var(--editor-bg); overflow: hidden; min-width: 440px; }

/* ── Live Feedback panel ────────────────────────────────── */
.live-feedback-panel {
  flex: 0 0 260px; display: flex; flex-direction: column;
  background: var(--bg); border-left: 1px solid var(--border);
}
.live-feedback-panel[hidden] { display: none; }
.live-feedback-header {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.live-feedback-title-row { display: flex; align-items: center; justify-content: space-between; }
.live-feedback-title { font-size: 13px; font-weight: 600; color: var(--text); }
.lf-status { display: flex; align-items: center; gap: 6px; }
.lf-status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim);
  transition: background 0.2s, box-shadow 0.2s;
}
.lf-status-dot.active { background: var(--success); box-shadow: 0 0 6px var(--success); }
.lf-status-text {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
  color: var(--text-muted);
}
.lf-status-text.active { color: var(--success); }

.live-feedback-toggles { display: flex; flex-direction: column; gap: 8px; }
.lf-toggle-row { display: flex; align-items: center; justify-content: space-between; }
.lf-toggle-label { font-size: 12.5px; color: var(--text); }

/* Real switch control — track + sliding knob, not just a color change */
.lf-switch {
  width: 34px; height: 20px; flex-shrink: 0; padding: 2px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.lf-switch-knob {
  display: block; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-muted); transition: transform 0.15s, background 0.15s;
  transform: translateX(0);
}
.lf-switch.active { background: var(--success-bg); border-color: var(--success); }
.lf-switch.active .lf-switch-knob { background: var(--success); transform: translateX(14px); }

.lf-startstop-btn { width: 100%; justify-content: center; }

.live-feedback-stream {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.live-feedback-stream .lf-entry {
  max-width: 90%; background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 12.5px; padding: 8px 12px; border-radius: var(--radius); align-self: flex-start;
}
/* User (typed / spoken) bubbles: blue, right-aligned. Agent stays gray (default above). */
.live-feedback-stream .lf-entry.lf-user {
  background: var(--user-bubble); border-color: var(--user-bubble); color: #eaf1ff;
  align-self: flex-end;
}
/* Interim (still-being-spoken) caption — slightly faded until finalized */
.live-feedback-stream .lf-entry.lf-interim { opacity: 0.6; font-style: italic; }

/* Text-input footer */
.live-feedback-input {
  display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border);
}
.live-feedback-input input {
  flex: 1; min-width: 0; background: var(--bg-input, var(--bg)); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-size: 12.5px; padding: 7px 10px; outline: none;
}
.live-feedback-input input:focus { border-color: var(--accent); }
.live-feedback-input .btn { flex-shrink: 0; }
/* Mute mic button in the bottom bar: shows a mic icon; when muted, a mic-off
   icon in danger red. */
.lf-mute-btn { padding: 5px 8px; }
.lf-mute-btn .lf-mic-off { display: none; }
.lf-mute-btn.muted { color: var(--danger); }
.lf-mute-btn.muted .lf-mic-on  { display: none; }
.lf-mute-btn.muted .lf-mic-off { display: inline-flex; }
/* Flashing text, not bouncing dots — dots read as "composing a reply right
   now," which is misleading for a mostly-idle watch/listen state. Reuses the
   existing pulse keyframe (see .status-dot.loading). */
.live-feedback-stream .lf-entry.lf-pending {
  width: fit-content; padding: 10px 14px; color: var(--text-muted);
  font-style: italic; animation: pulse 1.4s ease-in-out infinite;
}
.lf-notice {
  font-size: 12px; color: var(--text-muted); padding: 8px 10px;
  border: 1px dashed var(--border); border-radius: var(--radius);
}

/* Header control is icon-only (see .btn-icon) — the header row is already at
   capacity, and .header-center is absolutely-positioned independent of flex
   flow, so any wider control here risks overlapping it at moderate widths. */
#liveFeedbackToggleBtn { position: relative; }
#liveFeedbackToggleBtn.active { background: rgba(88,166,255,0.12); border-color: var(--accent); color: var(--accent); }
.lf-header-dot {
  position: absolute; top: 3px; right: 3px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim);
  transition: background 0.2s, box-shadow 0.2s;
}
.lf-header-dot.active { background: var(--success); box-shadow: 0 0 5px var(--success); }

/* Problem bar */
.problem-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 46px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.problem-bar[hidden] { display: none; }
.problem-bar-left {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0; overflow: hidden;  /* flex:1 bounds left so it can NEVER push into right */
}
.problem-select-wrapper { min-width: 80px; overflow: hidden; flex-shrink: 1; }
.difficulty-badge { flex-shrink: 0; }
.problem-badge {
  font-size: 10px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
  background: rgba(88,166,255,0.15); color: var(--accent);
  padding: 2px 7px; border-radius: 4px; border: 1px solid rgba(88,166,255,0.25);
  flex-shrink: 0;
}
.problem-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.problem-bar-right { display: flex; gap: 6px; flex-shrink: 0; margin-left: 8px; }

/* Difficulty badge */
.difficulty-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  padding: 2px 7px; border-radius: 8px; letter-spacing: 0.4px; flex-shrink: 0;
}
.diff-easy   { background: var(--success-bg); color: var(--success); }
.diff-medium { background: rgba(210,153,34,0.12); color: var(--warning); }
.diff-hard   { background: var(--danger-bg); color: #f85149; }

/* Compact problem bar: hide button labels, keep icons only */
.problem-bar.compact .btn-text { display: none; }
.problem-bar.compact .problem-bar-right .btn { padding: 5px 7px; }

.problem-select-wrapper { position: relative; display: flex; align-items: center; }
#problemSelectWrapper[hidden] { display: none !important; }

.problem-select-btn {
  display: flex; align-items: center; gap: 5px;
  background: none; border: none; outline: none;
  color: var(--text); font-size: 13px; font-weight: 600;
  font-family: var(--font-sans); cursor: pointer;
  padding: 3px 6px; border-radius: 5px;
  transition: background 0.12s, color 0.12s;
  max-width: 260px;
}
.problem-select-btn:hover { background: var(--bg-elevated); }
.problem-select-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.problem-select-btn svg { color: var(--text-muted); flex-shrink: 0; }

.problem-dropdown {
  position: fixed; z-index: 200;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 180px; max-width: 300px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  overflow: hidden;
}
.problem-dropdown[hidden] { display: none; }

.problem-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; background: none; border: none;
  color: var(--text); font-size: 12px; font-family: var(--font-sans);
  text-align: left; padding: 9px 13px;
  cursor: pointer; transition: background 0.1s;
}
.problem-dropdown-item:hover { background: rgba(255,255,255,0.05); }
.problem-dropdown-item .check-icon {
  width: 14px; height: 14px; flex-shrink: 0; color: var(--accent);
  display: flex; align-items: center;
}
.problem-dropdown-item .item-label {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Editor header */
.editor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 44px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.editor-tabs { display: flex; gap: 2px; }
.tab { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px 14px; border-radius: 6px; font-size: 13px; font-family: var(--font-sans); transition: all 0.15s; }
.tab:hover { color: var(--text); background: var(--bg-elevated); }
.tab.active { color: var(--text); background: var(--bg-elevated); }

/* Language dropdown (replaces the language tabs) */
.lang-switcher { position: relative; }
.lang-switcher-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 600;
  font-family: var(--font-sans); cursor: pointer;
  padding: 5px 12px; border-radius: 7px;
  transition: background 0.12s, border-color 0.12s;
}
.lang-switcher-btn:hover { background: var(--bg-card); border-color: var(--accent); }
.lang-switcher-btn svg { color: var(--text-muted); }
.lang-switcher-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  min-width: 150px; z-index: 200;
}
.lang-switcher-dropdown[hidden] { display: none; }
.lang-switcher-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 16px; background: none; border: none;
  color: var(--text); font-size: 13px; font-family: var(--font-sans); cursor: pointer;
  transition: background 0.1s;
}
.lang-switcher-item:hover { background: var(--bg-elevated); }
.lang-switcher-item.active { color: var(--accent); font-weight: 600; }
.editor-actions { display: flex; gap: 8px; }

/* CodeMirror */
.editor-wrapper { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.CodeMirror { height: 100% !important; font-family: var(--font-mono) !important; font-size: 13px !important; line-height: 1.7 !important; background: var(--editor-bg) !important; }
.CodeMirror-scroll { height: 100%; }
.CodeMirror-gutters { background: var(--editor-bg) !important; border-right: 1px solid var(--border) !important; }
.CodeMirror-linenumber { color: var(--text-dim) !important; }
.CodeMirror-cursor { border-left: 2px solid var(--accent) !important; }
.editor-frozen .CodeMirror-cursor { animation: none !important; }

/* Test results panel */
.test-results {
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
  max-height: 220px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.test-results[hidden] { display: none; }
.test-results-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.test-results-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.test-results-body { overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.test-results-body::-webkit-scrollbar { width: 4px; }
.test-results-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Test result summary */
.test-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 6px;
  margin-bottom: 4px; font-size: 13px; font-weight: 600;
}
.test-summary.all-pass { background: var(--success-bg); color: var(--success); }
.test-summary.some-fail { background: var(--danger-bg); color: var(--danger); }

/* Individual test case row */
.test-case {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 10px; border-radius: 6px;
  font-size: 12px; font-family: var(--font-mono);
  border: 1px solid transparent;
}
.test-case.pass { background: rgba(63,185,80,0.06); border-color: rgba(63,185,80,0.2); }
.test-case.fail { background: rgba(218,54,51,0.06); border-color: rgba(218,54,51,0.2); }
.test-case-header { display: flex; align-items: center; gap: 8px; }
.test-icon { font-size: 13px; }
.test-desc { color: var(--text-muted); font-family: var(--font-sans); font-size: 12px; }
.test-detail { color: var(--text-dim); font-size: 11px; padding-left: 22px; }
.test-detail span { color: var(--text-muted); }
.test-error { color: var(--danger); font-size: 11px; padding-left: 22px; }

/* Test running state */
.test-running { display: flex; align-items: center; gap: 8px; padding: 10px; color: var(--text-muted); font-size: 13px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Editor footer */
.editor-footer { border-top: 1px solid var(--border); padding: 6px 16px; background: var(--bg-surface); flex-shrink: 0; }
.editor-hint { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }

/* ── Description modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 680px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 600; }

.modal-body {
  overflow-y: auto; padding: 20px;
  line-height: 1.7; color: var(--text);
}
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Report-an-issue modal fields */
.report-context { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; padding: 8px 10px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); }
.report-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted);
  margin: 12px 0 5px; text-transform: uppercase; letter-spacing: .3px; }
.report-input { width: 100%; background: var(--bg-input, var(--bg)); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-size: 13px; padding: 8px 10px; outline: none;
  font-family: var(--font-sans); box-sizing: border-box; }
.report-input:focus { border-color: var(--accent); }
textarea.report-input { resize: vertical; min-height: 72px; }
.report-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.report-msg { margin-top: 12px; font-size: 13px; padding: 8px 10px; border-radius: var(--radius); }
.report-msg-ok    { background: var(--success-bg); color: var(--success); }
.report-msg-error { background: var(--danger-bg);  color: #f85149; }

/* Theme toggle icon: show the icon for the theme you'd switch TO (F3) */
#themeToggleBtn .theme-icon-light { display: none; }
#themeToggleBtn .theme-icon-dark  { display: inline-flex; }
:root[data-theme="light"] #themeToggleBtn .theme-icon-light { display: inline-flex; }
:root[data-theme="light"] #themeToggleBtn .theme-icon-dark  { display: none; }

/* Hide-attempted toggle in the sidebar header (F6) */
.hide-attempted-row {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 6px 12px; font-size: 12px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); user-select: none;
}
.hide-attempted-row input { accent-color: var(--accent); cursor: pointer; }
.hide-attempted-row:hover { color: var(--text); }

/* Markdown in modal */
.modal-body h1,.modal-body h2 { font-size: 18px; margin: 0 0 12px; color: var(--text); }
.modal-body h3 { font-size: 15px; margin: 16px 0 6px; color: var(--accent); }
.modal-body p { margin: 0 0 10px; }
.modal-body ul,.modal-body ol { padding-left: 20px; margin: 8px 0; }
.modal-body li { margin: 4px 0; }
.modal-body strong { color: var(--text); }
.modal-body code { font-family: var(--font-mono); background: rgba(110,118,129,0.15); padding: 1px 5px; border-radius: 4px; font-size: 13px; color: #f0883e; }
.modal-body pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow-x: auto; margin: 10px 0; }
.modal-body pre code { background: none; padding: 0; color: var(--text); font-size: 13px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: var(--radius);
  cursor: pointer; font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  padding: 8px 16px; transition: all 0.15s; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--bg-elevated); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-elevated); color: var(--text); }
.btn-end { background: rgba(218,54,51,0.12); border: 1px solid rgba(218,54,51,0.3); color: #f85149; }
.btn-end:hover:not(:disabled) { background: rgba(218,54,51,0.2); border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

/* ── Summary modal ──────────────────────────────────────── */
.modal-wide { max-width: 780px; }

.summary-loading {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; padding: 60px 20px; color: var(--text-muted);
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

/* Top row: score circle + verdict */
.summary-top {
  display: flex; gap: 24px; align-items: flex-start;
  margin-bottom: 24px;
}
.summary-score { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.score-circle {
  width: 88px; height: 88px; border-radius: 50%;
  background: conic-gradient(var(--accent) 0%, var(--bg-elevated) 0%);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  box-shadow: 0 0 0 3px var(--bg-surface), 0 0 0 5px var(--border);
}
.score-circle-inner {
  width: 68px; height: 68px; border-radius: 50%;
  background: var(--bg-surface);
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 1px;
}
.score-number { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.score-max { font-size: 11px; color: var(--text-muted); line-height: 1; margin-top: 6px; }
.score-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.summary-verdict { flex: 1; }
.verdict-badge {
  display: inline-block; font-size: 13px; font-weight: 700;
  padding: 4px 14px; border-radius: 20px; margin-bottom: 10px;
  letter-spacing: 0.3px;
}
.verdict-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(63,185,80,0.35); }
.verdict-accent  { background: rgba(88,166,255,0.12); color: var(--accent); border: 1px solid rgba(88,166,255,0.35); }
.verdict-strong  { background: rgba(63,185,80,0.2); color: #56d364; border: 1px solid rgba(63,185,80,0.5); }
.verdict-danger  { background: var(--danger-bg); color: #f85149; border: 1px solid rgba(218,54,51,0.35); }
.summary-narrative { color: var(--text-muted); font-size: 13px; line-height: 1.65; }

/* Category bars */
.summary-categories { margin-bottom: 24px; }
.summary-categories h3, .summary-feedback h3 {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 12px;
}
.category-row { margin-bottom: 12px; }
.category-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.category-name { font-size: 13px; color: var(--text); }
.category-score { font-size: 13px; font-weight: 600; font-family: var(--font-mono); color: var(--text-muted); }
.score-bar-track { height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.category-note { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

/* Strengths / improvements */
.summary-feedback { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.feedback-col ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feedback-col li {
  font-size: 13px; color: var(--text-muted); padding: 6px 10px;
  border-radius: 6px; background: var(--bg-elevated);
  border-left: 3px solid var(--border);
  line-height: 1.5;
}
.feedback-col.strengths li { border-left-color: var(--success); }
.feedback-col.improvements li { border-left-color: var(--warning); }

/* Confirm / small modal */
.modal-sm { max-width: 380px; }
.modal-body-sm { padding: 16px 20px; color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Tooltip ────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text); font-size: 11px; padding: 3px 8px; border-radius: 4px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 10;
}
[data-tooltip]:hover::after { opacity: 1; }

/* icon-only button used in modal header */
.btn-icon {
  width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
}

/* ── Misc ───────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ── Assessment mode ────────────────────────────────────── */
/* Assessment mode: hide chat tab + input, always show description */
body.mode-assessment .left-panel-tabs { display: none; }
body.mode-assessment .chat-input-area { display: none; }

/* Sidebar mode tabs */
.sidebar-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; min-width: 220px; }
.sidebar-mode-tabs { display: flex; gap: 3px; flex: 1; }
.sidebar-mode-tab {
  flex: 1; background: none; border: none; border-radius: 5px;
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  padding: 5px 6px; cursor: pointer; text-align: center;
  transition: all 0.15s; font-family: var(--font-sans); letter-spacing: 0.2px;
}
.sidebar-mode-tab:hover { color: var(--text); background: var(--bg-elevated); }
.sidebar-mode-tab.active { color: var(--text); background: var(--bg-elevated); }
.sidebar-header-row { display: flex; align-items: center; justify-content: space-between; }

/* Timer in header */
.timer-display {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px;
}
.timer-display[hidden] { display: none; }
.timer-icon { color: var(--text-muted); display: flex; align-items: center; }
.timer-text {
  font-size: 13px; font-weight: 700; font-family: var(--font-mono);
  color: var(--text); letter-spacing: 0.03em; min-width: 38px; text-align: center;
}
.timer-display.timer-urgent { border-color: rgba(218,54,51,0.4); }
.timer-display.timer-urgent .timer-text { color: var(--danger); }
.timer-display.timer-urgent .timer-icon { color: var(--danger); }
.timer-toggle-btn { width: 22px; height: 22px; padding: 0; border-radius: 4px; }

/* Assessment problem dropdown in problem bar */
.assess-tabs[hidden] { display: none; }

/* New assessment modal */
.assess-modal { max-width: 460px !important; }
.assess-modal-body { display: flex; flex-direction: column; gap: 18px; padding: 20px !important; overflow-y: auto; }
.assess-option-group { display: flex; flex-direction: column; gap: 7px; }
.assess-option-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
}
.assess-option-row { display: flex; gap: 6px; flex-wrap: wrap; }
.assess-option-btn {
  flex: 1; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-muted); font-size: 12px;
  padding: 7px 6px; cursor: pointer; text-align: center;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  font-family: var(--font-sans); white-space: nowrap;
}
.assess-option-btn:hover { border-color: var(--accent); color: var(--text); }
.assess-option-btn.selected {
  background: rgba(88,166,255,0.1); border-color: var(--accent); color: var(--accent);
}
.assess-option-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Time input row */
.assess-time-row { display: flex; align-items: center; gap: 10px; }
.assess-time-input {
  width: 80px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px; font-family: var(--font-sans);
  padding: 6px 10px; outline: none; transition: border-color 0.12s;
}
.assess-time-input:focus { border-color: var(--accent); }
.assess-time-hint { font-size: 11px; color: var(--text-dim); }

/* Strict timer note */
.assess-strict-note {
  font-size: 11px; color: var(--text-muted); line-height: 1.5;
  background: rgba(88,166,255,0.06); border: 1px solid rgba(88,166,255,0.2);
  border-radius: 5px; padding: 6px 10px;
}

/* Focus chips */
.assess-focus-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.assess-focus-chip {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-muted); font-size: 11.5px;
  font-family: var(--font-sans); padding: 4px 10px; cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.assess-focus-chip:hover { border-color: var(--accent); color: var(--text); }
.assess-focus-chip.selected {
  background: rgba(88,166,255,0.12); border-color: var(--accent); color: var(--accent);
}
.assess-focus-input {
  width: 100%; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 12.5px; font-family: var(--font-sans);
  padding: 7px 10px; outline: none; transition: border-color 0.12s;
  margin-top: 4px; box-sizing: border-box;
}
.assess-focus-input:focus { border-color: var(--accent); }
.assess-focus-input::placeholder { color: var(--text-dim); }

/* Assessment items in sidebar */
.assess-timer-line { font-size: 10px; color: var(--text-dim); margin-top: 1px; }
.assess-badge {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  padding: 1px 5px; border-radius: 8px; letter-spacing: 0.3px;
  background: rgba(88,166,255,0.12); color: var(--accent); flex-shrink: 0;
}

/* Assessment empty state in sidebar */
.assess-empty-start {
  padding: 12px 6px;
}
.assess-empty-start .btn { width: 100%; justify-content: center; }

/* ── PDF export theme ───────────────────────────────────── */
/* All colors explicit — no CSS variable references so html2canvas always resolves correctly */
.report-for-pdf {
  background: #1e1e1e !important;
  color: #e0e0e0 !important;
}
/* Report header */
.report-for-pdf .report-logo        { color: #ffffff !important; }
.report-for-pdf .report-brand svg   { stroke: #ffffff !important; }
.report-for-pdf .report-brand-divider { background: rgba(255,255,255,0.2) !important; }
.report-for-pdf .report-algo        { color: rgba(255,255,255,0.3) !important; }
.report-for-pdf .report-type        { color: #c0c0c0 !important; }
.report-for-pdf .report-date        { color: #888888 !important; }
.report-for-pdf .report-assess-chip { background: #2d2d2d !important; color: #b0b0b0 !important; border-color: #444 !important; }
.report-for-pdf .report-problem-chip { background: rgba(88,166,255,0.15) !important; color: #58a6ff !important; border-color: rgba(88,166,255,0.3) !important; }
/* Score section */
.report-for-pdf .score-circle-inner { background: #1e1e1e !important; }
.report-for-pdf .score-number       { color: #ffffff !important; }
.report-for-pdf .score-max          { color: #888888 !important; }
.report-for-pdf .score-label        { color: #888888 !important; }
/* Verdict */
.report-for-pdf .summary-narrative  { color: #c0c0c0 !important; }
/* Categories */
.report-for-pdf .summary-categories h3,
.report-for-pdf .summary-feedback h3 { color: #999999 !important; }
.report-for-pdf .category-name      { color: #e0e0e0 !important; }
.report-for-pdf .category-score     { color: #aaaaaa !important; }
.report-for-pdf .score-bar-track    { background: #3a3a3a !important; }
.report-for-pdf .category-note      { color: #777777 !important; }
/* Feedback */
.report-for-pdf .feedback-col li    { background: #2a2a2a !important; color: #d0d0d0 !important; }

/* ── Interview type switcher ────────────────────────────── */
.interview-type-switcher { position: relative; }
.interview-type-btn {
  display: flex; align-items: center; gap: 5px;
  background: none; border: none;
  color: var(--text-muted); font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  font-family: var(--font-sans); cursor: pointer;
  padding: 3px 6px; border-radius: 5px;
  transition: background 0.12s, color 0.12s;
}
.interview-type-btn:hover { background: var(--bg-elevated); color: var(--text); }
.interview-type-btn svg { color: var(--text-dim); }
.interview-type-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  min-width: 130px; z-index: 200;
}
.interview-type-dropdown[hidden] { display: none; }
.interview-type-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 14px; background: none; border: none;
  color: var(--text); font-size: 13px; font-family: var(--font-sans); cursor: pointer;
  transition: background 0.1s;
}
.interview-type-item:hover { background: var(--bg-elevated); }
.interview-type-item.active { color: var(--accent); font-weight: 600; }

/* ── Behavioral panel ───────────────────────────────────── */
.behavioral-panel {
  width: 38%; min-width: 260px; max-width: 560px;
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
}
.behavioral-panel[hidden] { display: none; }

.behavioral-question-area {
  padding: 28px 24px;
  display: flex; flex-direction: column; gap: 14px;
}

.behavioral-q-number {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--accent);
}

.behavioral-q-text {
  font-size: 15px; line-height: 1.75; color: var(--text);
  font-weight: 400;
}

.behavioral-followups {
  border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
  padding-top: 12px; margin-top: 4px;
}
.behavioral-followups[hidden] { display: none; }
.behavioral-followup-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 8px;
}
.behavioral-followup-item {
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 8px; font-size: 13px; line-height: 1.6; color: var(--text);
}
.behavioral-followup-item:last-child { margin-bottom: 0; }
.behavioral-followup-num {
  flex-shrink: 0; font-size: 11px; font-weight: 700;
  color: var(--accent); margin-top: 2px; min-width: 16px;
}

.behavioral-nav-btns {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
}
.behavioral-next-btn,
.behavioral-prev-btn,
.behavioral-followup-btn {
  display: flex; align-items: center; gap: 5px;
}
.behavioral-next-btn[hidden],
.behavioral-prev-btn[hidden],
.behavioral-followup-btn[hidden] { display: none; }

/* ── Behavioral question nav ─────────────────────────────── */
.behavioral-q-nav {
  border-bottom: 1px solid var(--border);
}
.behavioral-q-nav-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: none; border: none;
  color: var(--text-dim); font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer; transition: color 0.15s, background 0.15s;
}
.behavioral-q-nav-toggle:hover { background: var(--bg-elevated); color: var(--text); }
.behavioral-q-nav-toggle svg { transition: transform 0.2s; }
.behavioral-q-nav-toggle.open svg { transform: rotate(180deg); }
.behavioral-q-nav-list {}
.behavioral-q-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 20px; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
  transition: background 0.1s;
}
.behavioral-q-item:last-child { border-bottom: none; }
.behavioral-q-item.current { background: rgba(88,166,255,0.06); }
.behavioral-q-check {
  flex-shrink: 0; width: 16px; height: 16px; margin-top: 2px;
  font-size: 12px; color: var(--success, #3fb950); font-weight: 700;
}
.behavioral-q-preview {
  font-size: 12px; line-height: 1.6; color: var(--text-dim);
}
.behavioral-q-item.answered .behavioral-q-preview { color: var(--text-muted, #666); text-decoration: line-through; }
.behavioral-q-item.current .behavioral-q-preview { color: var(--text); text-decoration: none; }
.behavioral-q-item.clickable { cursor: pointer; }
.behavioral-q-item.clickable:hover { background: rgba(88,166,255,0.08); }
.behavioral-q-item.clickable.current:hover { background: rgba(88,166,255,0.12); }
.behavioral-q-item.locked { opacity: 0.45; cursor: default; }
.behavioral-q-item.locked .behavioral-q-preview { color: var(--text-muted); font-style: italic; }

/* ── Behavioral mode layout overrides ───────────────────── */
body.mode-behavioral .editor-panel  { display: none; }
/* Resize handle stays visible so the user can resize the chat vs question panels */
body.mode-behavioral .behavioral-panel {
  /* Let it fill the remaining space so dragging the handle actually works */
  flex: 1 !important;
  width: auto !important;
  max-width: none !important;
}
body.mode-behavioral #problemSelectWrapper { display: none !important; }
body.mode-behavioral .left-panel-tabs { display: none; }
body.mode-behavioral #leftDescView    { display: none !important; }
body.mode-behavioral .chat-actions    { display: none; }
/* Behavioral assessment still needs the chat box to answer questions */
body.mode-behavioral.mode-assessment .chat-input-area { display: block; }

@media (max-width: 768px) {
  .main { flex-direction: column; }
  .chat-panel { width: 100%; height: 50vh; border-right: none; border-bottom: 1px solid var(--border); }
  .editor-panel { height: 50vh; }
  .subtitle { display: none; }
}

/* ── Home Panel ──────────────────────────────────────────── */
.home-panel {
  flex: 1; display: none; flex-direction: column;
  background: var(--bg); overflow: hidden; min-width: 0;
}
.home-panel[hidden] { display: none !important; }
body.itype-home .home-panel     { display: flex; }
body.itype-home .chat-panel     { display: none; }
body.itype-home .editor-panel   { display: none; }
body.itype-home .behavioral-panel { display: none; }
body.itype-home .sysdesign-panel  { display: none; }
body.itype-home .resize-handle    { display: none; }
body.itype-home .sidebar          { display: none; }
body.itype-home #endInterviewBtn  { display: none; }
body.itype-home #resetBtn         { display: none; }
body.itype-home #timerDisplay     { display: none !important; }
body.itype-home .mode-switcher    { display: none; }
body.itype-home #statusDot        { display: none; }
body.itype-home #statusText       { display: none; }
body.itype-home #sidebarToggle    { display: none; }
body.itype-home #liveFeedbackToggleBtn { display: none; }
body.itype-home #sessionIdChip    { display: none; }
body.itype-home #sessionIdDivider { display: none; }
body.itype-home #creditDividerLeft { display: none; }
body.itype-home .live-feedback-panel { display: none; }

.home-scroll {
  flex: 1; overflow-y: auto; padding: 48px 40px 80px;
}

/* Hero */
.home-hero { text-align: center; margin-bottom: 48px; }
.home-brand {
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
  color: var(--text);
}
.home-brand-name {
  font-family: 'Pacifico', cursive; font-size: 26px; font-weight: 400;
  color: var(--text);
}
.home-title {
  font-size: clamp(32px, 5vw, 52px); font-weight: 800;
  letter-spacing: -1.5px; margin-bottom: 12px; line-height: 1.1;
}
.home-sub {
  color: var(--text-muted); font-size: 16px; margin: 0;
}

/* Mode cards */
.home-modes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 48px;
}
@media (max-width: 1100px) { .home-modes { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .home-modes { grid-template-columns: repeat(2, 1fr); } }

.home-mode-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 16px 16px;
  cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  position: relative;
  font-family: var(--font-sans);
  color: var(--text);
}
.home-mode-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0,0,0,0.4);
  border-color: var(--hmc);
}
.home-mode-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--hmc-dim); color: var(--hmc);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.home-mode-name { font-size: 14px; font-weight: 700; }
.home-mode-desc { color: var(--text-muted); font-size: 12px; line-height: 1.5; flex: 1; }
.home-mode-arrow {
  color: var(--hmc); opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  align-self: flex-end;
}
.home-mode-card:hover .home-mode-arrow { opacity: 1; transform: translateX(3px); }

.home-card-blue   { --hmc: #58a6ff; --hmc-dim: rgba(88,166,255,0.12);  }
.home-card-green  { --hmc: #3fb950; --hmc-dim: rgba(63,185,80,0.12);   }
.home-card-orange { --hmc: #ffa657; --hmc-dim: rgba(255,166,87,0.12);  }
.home-card-purple { --hmc: #bc8cff; --hmc-dim: rgba(188,140,255,0.12); }
.home-card-red    { --hmc: #ff7b72; --hmc-dim: rgba(255,123,114,0.12); }

/* Recent sessions */
.home-recent-header {
  font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px;
}
.home-recent-header::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.home-recent-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) { .home-recent-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .home-recent-grid { grid-template-columns: repeat(2, 1fr); } }

.home-recent-col {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.home-recent-col-header {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.home-recent-col-title {
  font-size: 12px; font-weight: 700; color: var(--hmc);
}
.home-recent-col-link {
  font-size: 11px; color: var(--text-muted); background: none; border: none;
  cursor: pointer; font-family: var(--font-sans); padding: 0;
  transition: color 0.12s;
}
.home-recent-col-link:hover { color: var(--text); }
.home-recent-items { padding: 6px 0; }
.home-recent-empty {
  padding: 16px 14px; color: var(--text-dim); font-size: 12px; text-align: center;
}
.home-recent-item {
  padding: 8px 14px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background 0.12s;
  border: none; background: none; width: 100%; text-align: left;
  font-family: var(--font-sans); color: var(--text);
}
.home-recent-item:hover { background: var(--bg-elevated); }
.home-recent-item-body { flex: 1; min-width: 0; }
.home-recent-item-name {
  font-size: 12px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--text);
}
.home-recent-item-meta {
  display: flex; align-items: center; gap: 6px; margin-top: 2px;
}
.home-recent-item-date { font-size: 11px; color: var(--text-muted); }
.home-recent-item .session-status {
  font-size: 10px; padding: 1px 6px;
}

/* Interview-type separator in dropdown */
.interview-type-sep {
  height: 1px; background: var(--border); margin: 4px 8px;
}

/* ── System Design Panel ─────────────────────────────────── */
.sysdesign-panel {
  flex: 1; display: none; flex-direction: column;
  background: var(--bg); overflow: hidden; min-width: 0;
}

/* Layout overrides when sysdesign is active */
body.itype-sysdesign .sysdesign-panel  { display: flex; }
body.itype-sysdesign .editor-panel     { display: none; }
body.itype-sysdesign .behavioral-panel { display: none; }
body.itype-sysdesign .chat-panel {
  width: 38%; min-width: 280px; max-width: calc(100% - 340px);
}
/* Show chat input and tabs in sysdesign regardless of mode */
body.itype-sysdesign .chat-input-area  { display: flex !important; flex-direction: column; }
body.itype-sysdesign .left-panel-tabs  { display: flex !important; }
/* Hide algo-specific chat buttons */
body.itype-sysdesign #submitCodeBtn,
body.itype-sysdesign #hintBtn,
body.itype-sysdesign #newProblemBtn,
body.itype-sysdesign #sampleProblemBtn { display: none; }

/* Layout overrides when mldesign is active (identical canvas layout) */
body.itype-mldesign .sysdesign-panel  { display: flex; }
body.itype-mldesign .editor-panel     { display: none; }
body.itype-mldesign .behavioral-panel { display: none; }
body.itype-mldesign .chat-panel {
  width: 38%; min-width: 280px; max-width: calc(100% - 340px);
}
body.itype-mldesign .chat-input-area  { display: flex !important; flex-direction: column; }
body.itype-mldesign .left-panel-tabs  { display: flex !important; }
body.itype-mldesign #submitCodeBtn,
body.itype-mldesign #hintBtn,
body.itype-mldesign #newProblemBtn,
body.itype-mldesign #sampleProblemBtn { display: none; }

/* Show the correct toolbar group based on active canvas mode */
body.itype-sysdesign #sdToolsMldesign { display: none; }
body.itype-mldesign  #sdToolsSysdesign { display: none; }

/* ── Canvas toolbar ──────────────────────────────────────── */
.sysdesign-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; height: 44px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 8px;
}
.sd-tools { display: flex; align-items: center; gap: 2px; }
.sd-divider {
  width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex-shrink: 0;
}
.sd-tool-btn {
  width: 32px; height: 32px;
  background: none; border: none; border-radius: 6px;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s; flex-shrink: 0;
}
.sd-tool-btn:hover  { background: var(--bg-elevated); color: var(--text); }
.sd-tool-btn.active { background: rgba(88,166,255,0.12); color: var(--accent); }
.sd-tool-btn.arrow-pending {
  background: rgba(88,166,255,0.2); color: var(--accent);
  animation: pulse 1s infinite;
}
.sysdesign-toolbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ── Canvas wrapper ──────────────────────────────────────── */
.sysdesign-canvas-wrapper {
  flex: 1; overflow: hidden; position: relative;
  cursor: default;
}
.sysdesign-canvas-wrapper.cursor-crosshair { cursor: crosshair; }
.sysdesign-canvas-wrapper.cursor-grab      { cursor: grab; }
.sysdesign-canvas-wrapper.cursor-grabbing  { cursor: grabbing; }
#sdCanvas { display: block; }

/* ── Floating label editor ───────────────────────────────── */
.sd-edit-popup {
  position: absolute; z-index: 20;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; gap: 4px;
  padding: 4px 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  pointer-events: all;
}
.sd-edit-popup[hidden] { display: none; }
.sd-edit-input {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text); font-size: 12px;
  font-family: var(--font-sans); padding: 4px 8px; outline: none;
  width: 140px; transition: border-color 0.15s;
}
.sd-edit-input:focus { border-color: var(--accent); }

/* ── Edge style bar ──────────────────────────────────────── */
.sd-edge-bar {
  position: absolute; z-index: 25;
  display: flex; align-items: center; gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 7px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.55);
  pointer-events: none; /* container doesn't steal canvas clicks */
  transform: translateX(-50%);
  white-space: nowrap;
}
.sd-edge-bar-btn { pointer-events: auto; } /* buttons still clickable */
.sd-edge-bar[hidden] { display: none; }
.sd-edge-bar-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 0 3px 0 2px; flex-shrink: 0;
}
.sd-edge-bar-btn {
  width: 28px; height: 26px;
  background: none; border: 1px solid transparent; border-radius: 5px;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  flex-shrink: 0;
}
.sd-edge-bar-btn:hover { background: var(--bg-elevated); color: var(--text); }
.sd-edge-bar-btn.active {
  background: rgba(88,166,255,0.14);
  border-color: rgba(88,166,255,0.4);
  color: var(--accent);
}
.sd-edge-bar-sep {
  width: 1px; height: 18px;
  background: var(--border); margin: 0 4px; flex-shrink: 0;
}

/* ── Sysdesign sidebar items ─────────────────────────────── */
.sd-q-chip {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  padding: 1px 5px; border-radius: 5px; letter-spacing: 0.3px;
  background: rgba(86,211,200,0.12); color: #56d3c2; flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   ML / Notebook panel
   ══════════════════════════════════════════════════════════ */

/* Default: ml-panel is hidden (controlled by hidden attribute + js) */
.ml-panel[hidden] { display: none; }

/* Layout overrides when ML mode is active */
body.itype-ml .editor-panel   { display: none !important; }
body.itype-ml .ml-panel       { display: flex; }
/* Show chat input and tabs in ml mode */
body.itype-ml .chat-input-area { display: flex !important; flex-direction: column; }
body.itype-ml .left-panel-tabs { display: flex !important; }
/* Hide algo-specific chat buttons */
body.itype-ml #submitCodeBtn,
body.itype-ml #hintBtn,
body.itype-ml #newProblemBtn,
body.itype-ml #sampleProblemBtn { display: none; }

/* The ML panel fills the space left by the hidden editor panel */
.ml-panel {
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
}

/* ── ML Toolbar ─────────────────────────────────────────── */
.ml-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ml-toolbar-left  { display: flex; align-items: center; gap: 4px; }
.ml-toolbar-right { display: flex; align-items: center; gap: 6px; }
.ml-toolbar-sep   { width: 1px; height: 18px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

.ml-kernel-status {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 10px;
  user-select: none;
}
.ml-kernel-status.busy { color: var(--warning); }
.ml-kernel-status.error { color: var(--danger); }

/* ── Notebook wrapper ───────────────────────────────────── */
.ml-notebook-wrapper {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 12px 0 40px 0;
}

.ml-notebook {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Individual cells ───────────────────────────────────── */
.ml-cell {
  display: flex;
  align-items: stretch;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: border-color 0.15s;
  background: var(--surface);
}
.ml-cell:hover,
.ml-cell:focus-within {
  border-color: var(--border);
}
.ml-cell.ml-cell-selected {
  border-color: var(--accent);
}

/* Gutter (exec count + type indicator) */
.ml-cell-gutter {
  width: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 10px 6px 0 4px;
  user-select: none;
}
.ml-exec-count {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Cell body (editor + output) */
.ml-cell-body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Code cell editor wrapper */
.ml-cell-editor-wrap {
  /* Always fully bordered (incl. bottom) so the code box reads as a complete,
     clearly-bounded element at rest — the actions row below it only shows its
     own border on hover, and output is hidden entirely until the cell runs,
     so neither could be relied on to draw a visible bottom edge otherwise. */
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}
.ml-cell-editor-wrap .CodeMirror {
  font-size: 13px;
  font-family: var(--font-mono);
  height: auto;
  min-height: 36px;
  background: transparent;
  color: var(--text);
}
.ml-cell-editor-wrap .CodeMirror-scroll {
  min-height: 36px;
}

/* Cell action row (run, delete, etc.) */
.ml-cell-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.ml-cell:hover .ml-cell-actions,
.ml-cell:focus-within .ml-cell-actions {
  opacity: 1;
}
.ml-cell-actions button {
  font-size: 11px;
  padding: 1px 7px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
}
.ml-cell-actions button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.ml-cell-actions .ml-cell-delete {
  margin-left: auto;
}
.ml-cell-actions .ml-cell-delete:hover {
  background: var(--danger);
  border-color: var(--danger);
}

/* Cell output area */
.ml-cell-output {
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 6px 10px;
  border-radius: 0 0 4px 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  min-height: 0;
  max-height: 400px;
  overflow-y: auto;
  color: var(--text);
}
.ml-cell-output:empty { display: none; }
.ml-cell-output.ml-out-empty { display: none; }
.ml-cell-output.ml-out-running { color: var(--text-muted); font-style: italic; }
.ml-cell-output.ml-out-error   { color: var(--danger); background: rgba(239,68,68,0.06); }
.ml-cell-output.ml-out-stdout  { color: var(--text); }

/* ── Markdown cells ─────────────────────────────────────── */
.ml-cell-md-display {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: text;
  color: var(--text);
  line-height: 1.6;
}
.ml-cell-md-display:hover {
  border-color: var(--border);
}
.ml-cell-md-display p { margin: 0 0 6px 0; }
.ml-cell-md-display h1,.ml-cell-md-display h2,.ml-cell-md-display h3 {
  margin: 4px 0 4px 0; font-weight: 600;
}
.ml-cell-md-display code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--surface); padding: 1px 4px; border-radius: 3px;
}

.ml-cell-md-textarea {
  width: 100%;
  min-height: 60px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 8px;
  resize: vertical;
  box-sizing: border-box;
}

/* ── Add cell footer ────────────────────────────────────── */
.ml-add-footer {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}
.ml-add-footer button {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 4px 20px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
}
.ml-add-footer button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── ML sidebar chip ────────────────────────────────────── */
.ml-sess-chip {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  padding: 1px 5px; border-radius: 5px; letter-spacing: 0.3px;
  background: rgba(168,85,247,0.15); color: #a855f7; flex-shrink: 0;
}

/* ── ML welcome screen ──────────────────────────────────── */
.ml-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 24px;
  text-align: center;
}
.ml-welcome h2 { font-size: 22px; font-weight: 700; margin: 0; }
.ml-welcome p  { color: var(--text-muted); max-width: 420px; margin: 0; }

.ml-sample-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  margin-top: 8px;
}
.ml-sample-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
}
.ml-sample-card:hover { border-color: var(--accent); }
.ml-sample-card-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}
.ml-sample-card-desc {
  font-size: 11px;
  color: var(--text-muted);
}
