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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
  background: #fff;
  border-right: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}
.sidebar-header h1 { font-size: 15px; font-weight: 600; }
.conv-list { list-style: none; overflow-y: auto; flex: 1; }
.conv-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.1s;
}
.conv-item:hover { background: #f5f5f5; }
.conv-item.active { background: #eef2ff; border-left: 3px solid #6366f1; padding-left: 13px; }
.conv-title {
  display: block;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-meta { display: block; font-size: 11px; color: #888; margin-top: 2px; }
.empty { padding: 24px 16px; font-size: 13px; color: #888; text-align: center; line-height: 1.6; }

/* ── Transcript Panel ── */
#transcript-panel { overflow-y: auto; background: #fafafa; display: flex; flex-direction: column; }
.transcript-header {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  flex-shrink: 0;
}
.transcript-title { flex: 1; min-width: 0; }
.transcript-title h2 { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grok-link { font-size: 11px; color: #6366f1; text-decoration: none; }
.grok-link:hover { text-decoration: underline; }
.transcript-meta { font-size: 11px; color: #888; white-space: nowrap; }
#review-btn {
  padding: 5px 12px;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
#review-btn:hover { background: #4f46e5; }

/* ── Turns ── */
.turns-container {
  padding: 16px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}
.turn { padding: 12px 16px; border-radius: 14px; max-width: 78%; }
.turn-user { background: #e9e9eb; align-self: flex-end; }
.turn-assistant { background: #fff; border: 1px solid #e5e5e5; align-self: flex-start; }
.turn-text { font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.turn-audio { display: block; margin-top: 10px; width: 100%; height: 32px; }
.no-audio { display: inline-block; margin-top: 8px; font-size: 11px; color: #bbb; }

/* ── Review Mode ── */
.review-header {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
}
.review-back {
  padding: 5px 10px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}
.review-back:hover { background: #f5f5f5; }
.review-progress { flex: 1; text-align: center; font-size: 12px; color: #888; }
.review-container {
  padding: 32px 24px 80px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.review-context { opacity: 0.55; max-width: 100%; }
.review-main { max-width: 100%; font-size: 15px; padding: 18px 22px; }
.review-hints {
  position: fixed;
  bottom: 0;
  left: 280px;
  right: 0;
  text-align: center;
  padding: 10px;
  background: rgba(255,255,255,0.9);
  font-size: 11px;
  color: #aaa;
  border-top: 1px solid #eee;
}
.review-hints kbd {
  background: #f0f0f0;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: monospace;
}

/* ── Empty state ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #888;
  font-size: 14px;
  gap: 8px;
  text-align: center;
}
.empty-state .hint { font-size: 12px; color: #aaa; line-height: 1.6; }
