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

:root {
  --teal: #f97316;
  --teal-dark: #ea6a00;
  --teal-light: #fff3e8;
  --teal-mid: #fdba74;
  --bg: #f2f2f2;
  --surface: #FFFFFF;
  --surface2: #f7f7f7;
  --text: #2a2a2a;
  --muted: #7a7a7a;
  --border: rgba(0,0,0,0.07);
  --border-mid: rgba(0,0,0,0.12);
  --border-soft: rgba(0,0,0,0.06);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Grid background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  cursor: pointer;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--teal);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-name {
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.logo-name span { color: var(--teal); }

.session-badge {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  padding: 3px 10px;
  display: none;
}

.session-badge.visible { display: block; }

nav { display: flex; gap: 24px; align-items: center; }
nav a { font-size: 13px; color: var(--muted); text-decoration: none; transition: color 0.15s; }
nav a:hover { color: var(--text); }

/* ── Hero ── */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 70px 24px 50px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-dark);
  background: var(--teal-light);
  border: 1px solid var(--teal-mid);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 28px;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  background: var(--teal);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.5; transform:scale(0.7); }
}

h1 {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -1.5px;
  max-width: 560px;
  margin-bottom: 16px;
}

h1 strong { font-weight: 500; color: var(--teal); }

.sub {
  font-size: 15px;
  color: var(--muted);
  max-width: 400px;
  line-height: 1.65;
  margin-bottom: 40px;
}

.search-container {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.search-box {
  width: 100%;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.12);
}

.search-icon {
  padding: 0 14px 0 20px;
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

#searchInput {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  padding: 15px 8px;
}

#searchInput::placeholder { color: var(--muted); }

.btn-help {
  margin: 6px;
  padding: 10px 22px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 11px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.btn-help:hover  { background: var(--teal-dark); }
.btn-help:active { transform: scale(0.97); }
.btn-help:disabled { background: var(--muted); cursor: not-allowed; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chip:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-light);
}

/* ── Diagnostic layout ── */
.diagnostic-layout {
  display: none;
  flex: 1;
  grid-template-columns: 1fr 300px;
  grid-template-rows: auto 1fr;
  gap: 0;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 20px 0;
}

.diagnostic-layout.active { display: grid; }

/* Progress bar */
.progress-bar {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.progress-step {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}

.progress-track {
  height: 4px;
  background: var(--border-mid);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 2px;
  transition: width 0.5s ease;
  width: 0%;
}

.progress-stages {
  display: flex;
  justify-content: space-between;
}

.stage {
  font-size: 11px;
  color: var(--muted);
  transition: color 0.3s;
}

.stage.active { color: var(--teal); font-weight: 500; }
.stage.done   { color: var(--text); }

/* ── Chat column ── */
.chat-column {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-right: 16px;
  min-height: 0;
}

.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
}

.agent-avatar {
  width: 36px;
  height: 36px;
  background: var(--teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.agent-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--surface2);
}

.agent-info p { font-size: 14px; font-weight: 500; }
.agent-info span { font-size: 11px; color: var(--muted); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 320px;
 
}

.message { display: flex; gap: 10px; align-items: flex-start; animation: fadein 0.2s ease; }


@keyframes fadein {
  from { opacity:0; transform:translateY(4px); }
  to   { opacity:1; transform:translateY(0); }
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

.message.agent .msg-avatar { background: var(--teal); color: #fff; }
.message.user  .msg-avatar { background: #e2e8e5; color: var(--text); }

.bubble {
  max-width: 82%;
  padding: 11px 14px;
  font-size: 13.5px;
  line-height: 1.1;
  white-space: pre-wrap;
}

.message.agent .bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px 12px 12px 12px;
  color: var(--text);
}

.message.user .bubble {
  background: var(--teal);
  color: #fff;
  border-radius: 12px 4px 12px 12px;
}

/* Tags on messages */
.msg-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.msg-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--teal-light);
  color: var(--teal-dark);
  border: 1px solid var(--teal-mid);
}

/* Typing indicator */
.typing { display: flex; gap: 4px; align-items: center; padding: 13px 14px; }
.typing span {
  width: 7px; height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%,60%,100% { transform:translateY(0); }
  30%          { transform:translateY(-6px); }
}

/* Quick reply buttons */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 18px 14px;
}

.qr-btn {
  font-size: 12.5px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.qr-btn:hover {
  border-color: var(--teal);
  background: var(--teal-light);
  color: var(--teal-dark);
}

/* Chat input */
.chat-input-area {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toolbar-left {
  display: flex;
  gap: 4px;
}

.toolbar-right {
  display: flex;
  gap: 4px;
}

#chatInput {
  flex: 1;
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  outline: none;
  resize: none;
  min-height: 42px;
  max-height: 100px;
  transition: border-color 0.2s;
  color: var(--text);
  background: var(--surface2);
}

#chatInput:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(29,158,117,0.1);
}

.btn-send {
  width: 42px;
  height: 42px;
  background: var(--teal);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.btn-send:hover    { background: var(--teal-dark); }
.btn-send:disabled { background: var(--muted); cursor: not-allowed; }

.btn-new {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.btn-new:hover { border-color: var(--teal); color: var(--teal); }
.btn-new svg   { flex-shrink: 0; }

/* ── Right panel ── */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-bottom: 20px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Root causes */
.cause-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.cause-label {
  font-size: 12.5px;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.cause-bar-wrap {
  width: 80px;
  height: 5px;
  background: var(--border-mid);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.cause-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.cause-bar.high   { background: #e24b4a; }
.cause-bar.medium { background: #ef9f27; }
.cause-bar.low    { background: #9ca3af; }

.cause-pct {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

/* Context table */
.ctx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.ctx-row:last-child { border-bottom: none; }
.ctx-key   { color: var(--muted); }
.ctx-val   { font-weight: 500; color: var(--text); text-align: right; }
.ctx-val.good { color: var(--teal); }
.ctx-val.warn { color: #ef9f27; }

/* Session stats */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-item { text-align: center; }
.stat-num  { font-family: 'DM Mono', monospace; font-size: 20px; font-weight: 500; color: var(--text); }
.stat-lbl  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat-num.good { color: var(--teal); }

/* Escalate button */
.btn-escalate {
  width: 100%;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-top: 4px;
}

.btn-escalate:hover {
  border-color: var(--teal);
  background: var(--teal-light);
  color: var(--teal-dark);
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  margin-top: 20px;
}

footer p { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); }
.footer-links a { font-size: 12px; color: var(--muted); text-decoration: none; margin-left: 20px; }
.footer-links a:hover { color: var(--text); }

/* ── Login screen ── */
.login-screen { display: none; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; text-align: center; }
.login-screen.active { display: flex; }
.login-card { background: var(--surface); border: 1px solid var(--border-mid); border-radius: 20px; padding: 48px 40px; max-width: 400px; width: 100%; box-shadow: var(--shadow-md); }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 32px; }
.login-logo-icon { width: 40px; height: 40px; background: var(--teal); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.login-logo-name { font-family: 'DM Mono', monospace; font-size: 18px; font-weight: 500; color: var(--text); }
.login-logo-name span { color: var(--teal); }
.login-title { font-size: 22px; font-weight: 500; letter-spacing: -0.4px; margin-bottom: 8px; color: var(--text); }
.login-sub { font-size: 14px; color: var(--muted); margin-bottom: 32px; line-height: 1.6; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 13px 20px; background: var(--surface); border: 1px solid var(--border-mid); border-radius: 12px; font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500; color: var(--text); cursor: pointer; text-decoration: none; transition: border-color 0.15s, background 0.15s; }
.btn-google:hover { border-color: var(--teal); background: var(--teal-light); }
.login-note { font-size: 12px; color: var(--muted); margin-top: 20px; }

/* ── User pill (header) ── */
.user-pill { display: none; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.user-pill.visible { display: flex; }
.user-avatar { width: 26px; height: 26px; background: var(--teal); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; color: #fff; }
.btn-logout { font-size: 12px; color: var(--muted); background: none; border: none; cursor: pointer; padding: 0; font-family: 'DM Sans', sans-serif; }
.btn-logout:hover { color: var(--text); }
.btn-history { font-size: 12px; color: var(--teal); background: none; border: none; cursor: pointer; padding: 0; font-family: 'DM Sans', sans-serif; text-decoration: none; }
.btn-history:hover { text-decoration: underline; }

/* ── File attach & preview ── */
.btn-attach { display: flex; align-items: center; gap: 5px; padding: 5px 10px; background: none; border: 1px solid var(--border-mid); border-radius: 8px; cursor: pointer; color: var(--muted); font-family: 'DM Sans', sans-serif; font-size: 12px; transition: border-color 0.15s, color 0.15s; flex-shrink: 0; }
.btn-attach:hover { border-color: var(--teal); color: var(--teal); }
.btn-attach svg { flex-shrink: 0; }
.file-preview { position: relative; margin: 0 14px 10px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--teal-light); border: 1px solid var(--teal); border-radius: 8px; }
.file-preview img { max-height: 80px; max-width: 120px; border-radius: 6px; display: block; }
.file-preview-name { font-size: 12px; font-family: 'DM Mono', monospace; color: var(--teal); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-size { font-size: 11px; color: var(--muted); }
.file-preview-remove { width: 20px; height: 20px; background: var(--text); color: #fff; border: none; border-radius: 50%; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-icon { width: 32px; height: 32px; background: var(--teal); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 500; color: #fff; font-family: 'DM Mono', monospace; flex-shrink: 0; }
.msg-image { max-width: 240px; border-radius: 8px; margin-bottom: 6px; display: block; }

/* ── Responsive ── */

/* ── Hamburger + mobile menu ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  cursor: pointer;
  padding: 0 9px;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mobile-menu {
  display: none;
  position: fixed;
  top: 57px;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  flex-direction: column;
  padding: 8px 16px 16px;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  font-size: 15px;
  color: var(--muted);
  text-decoration: none;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border-soft);
  transition: color 0.15s;
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover { color: var(--text); }
.mobile-menu a.active { color: var(--teal); font-weight: 500; }
.mobile-menu-divider {
  height: 1px;
  background: var(--border-mid);
  margin: 8px 0;
}
.mobile-menu-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 4px;
}
.mobile-menu-email { font-size: 12px; color: var(--muted); font-family: 'DM Mono', monospace; }
.mobile-menu-signout {
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  padding: 0;
}
.mobile-menu-signout:hover { color: var(--text); }

@media (max-width: 768px) {
  .progress-bar { display: none; }
  .chat-header { display: none; }
  .msg-avatar { display: none; }
  .diagnostic-layout { grid-template-columns: 1fr; padding: 0; }
  .right-panel { display: none; }
  .chat-column { margin-right: 0; }
  header { padding: 12px 16px; }
  nav { display: none; }
  .nav-tabs { display: none; }
  .hamburger { display: flex; }
  footer { padding: 12px 16px; }
  .chat-messages { padding: 0 10px; }
}
    .msg-file{display:inline-flex;align-items:center;gap:8px;padding:6px 10px;background:var(--teal-light);border:1px solid var(--teal);border-radius:8px;font-size:12px;font-family:'DM Mono',monospace;color:var(--teal);margin-bottom:6px}
    .bubble ul,.bubble ol{margin:2px 0 2px 16px;padding:0}
    .bubble li{margin:1px 0;line-height:1}
    .bubble li p{margin:0}
    .bubble h3,.bubble h4{font-size:13px;font-weight:600;margin:8px 0 2px;color:var(--text)}
    .bubble h2{font-size:14px;font-weight:600;margin:8px 0 2px;color:var(--text)}
    .bubble h1{font-size:15px;font-weight:600;margin:8px 0 2px;color:var(--text)}
    .bubble code{font-family:'DM Mono',monospace;font-size:12px;background:var(--bg);padding:1px 5px;border-radius:4px}
    .bubble pre{background:var(--bg);padding:10px 12px;border-radius:8px;overflow-x:auto;font-size:12px;margin:6px 0}
    .bubble pre code{background:none;padding:0}
    .bubble p{margin:2px 0;line-height:1.55}
    .bubble p+p{margin-top:6px}
    .bubble strong{font-weight:600}
    .bubble hr{border:none;border-top:1px solid var(--border-mid);margin:8px 0}
    .bubble table{border-collapse:collapse;font-size:12px;margin:6px 0;width:100%}
    .bubble th,.bubble td{border:1px solid var(--border-mid);padding:4px 8px;text-align:left}
    .bubble th{background:var(--bg);font-weight:600}
    .bubble blockquote{border-left:3px solid var(--teal);padding-left:10px;margin:4px 0;color:var(--muted)}
    .bubble .warning{color:#ef9f27;font-weight:500}
    .bubble>*:first-child{margin-top:0}
    .bubble>*:last-child{margin-bottom:0}
    .btn-expand{width:30px;height:30px;background:none;border:1px solid var(--border-mid);border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--muted);transition:border-color 0.15s,color 0.15s;margin-left:auto;flex-shrink:0}
    .btn-expand:hover{border-color:var(--teal);color:var(--teal)}
    .diagnostic-layout.panel-hidden{grid-template-columns:1fr !important}
    .diagnostic-layout.panel-hidden .right-panel{display:none !important}
    .diagnostic-layout.panel-hidden .chat-column{max-width:100% !important;width:100% !important;grid-column:1/-1 !important;grid-area:unset !important}
    .diagnostic-layout.panel-hidden .progress-bar{grid-column:1/-1 !important;grid-area:unset !important}
    .mermaid-wrap{background:var(--surface);border:1px solid var(--border-mid);border-radius:10px;padding:16px;margin:8px 0;overflow-x:auto;text-align:center}
    .mermaid-wrap svg{max-width:100%;height:auto}
    .mermaid-error{background:#fff5f5;border:1px solid #fca5a5;border-radius:8px;padding:10px 12px;font-size:12px;color:#dc2626;font-family:'DM Mono',monospace}
    .feedback-row{display:flex;align-items:center;gap:6px;margin-top:6px;opacity:0.6;transition:opacity 0.15s}
    .feedback-row:hover{opacity:1}
    .btn-feedback{background:none;border:1px solid var(--border-mid);border-radius:6px;padding:3px 8px;font-size:12px;cursor:pointer;color:var(--muted);transition:all 0.15s;font-family:'DM Sans',sans-serif}
    .btn-feedback:hover{border-color:var(--teal);color:var(--teal)}
    .btn-feedback.active-good{border-color:#22c55e;color:#22c55e;background:#f0fdf4}
    .btn-feedback.active-bad{border-color:#ef4444;color:#ef4444;background:#fef2f2}
    .btn-feedback.active-resolved{border-color:var(--teal);color:var(--teal);background:var(--teal-light)}
    /* Resume popup */
    .resume-popup{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.4);z-index:1000;align-items:center;justify-content:center}
    .resume-popup.active{display:flex}
    .resume-card{background:var(--surface);border:1px solid var(--border-mid);border-radius:16px;padding:28px 32px;max-width:420px;width:90%;box-shadow:var(--shadow-md)}
    .resume-card h3{font-size:16px;font-weight:500;margin-bottom:6px}
    .resume-card p{font-size:13px;color:var(--muted);margin-bottom:20px;line-height:1.5}
    .resume-query{font-size:13px;font-style:italic;color:var(--text);background:var(--bg);padding:8px 12px;border-radius:8px;margin-bottom:20px;border-left:3px solid var(--teal)}
    .resume-btns{display:flex;gap:10px}
    .btn-resume-yes{flex:1;padding:10px;background:var(--teal);color:#fff;border:none;border-radius:10px;font-family:'DM Sans',sans-serif;font-size:14px;font-weight:500;cursor:pointer}
    .btn-resume-no{flex:1;padding:10px;background:none;border:1px solid var(--border-mid);border-radius:10px;font-family:'DM Sans',sans-serif;font-size:14px;cursor:pointer;color:var(--text)}
    /* Recent sessions list */
    .recent-session-item{padding:8px 0;border-bottom:1px solid var(--border-soft);cursor:pointer;transition:color 0.15s}
    .recent-session-item:last-child{border-bottom:none}
    .recent-session-item:hover .rsi-title{color:var(--teal)}
    .rsi-title{font-size:12px;font-weight:500;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:2px}
    .rsi-meta{font-size:11px;color:var(--muted);display:flex;gap:8px}
    .rsi-turns{font-family:'DM Mono',monospace}
/* Mermaid expand button */
.mermaid-inner { position: relative; }
.mermaid-expand-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s, border-color 0.15s, color 0.15s;
}
.mermaid-inner:hover .mermaid-expand-btn { opacity: 1; }
.mermaid-expand-btn:hover { border-color: var(--teal); color: var(--teal); }

/* ── Bubble wrap + action buttons (copy / PDF) ── */
.bubble-wrap { position: relative; display: block; }
.bubble-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.message.agent:hover .bubble-actions,
.bubble-actions:focus-within { opacity: 1; }
@media (hover: none) { .bubble-actions { opacity: 1; } }
.bubble-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
  user-select: none;
}
.bubble-action-btn:hover { color: var(--text); border-color: var(--text); }
.bubble-action-btn.success { color: var(--teal); border-color: var(--teal); }
.bubble-action-btn.loading { opacity: 0.6; pointer-events: none; }
.bubble-action-btn svg { width: 11px; height: 11px; flex-shrink: 0; }

/* ── PDF render container (off-screen) ── */
#pdfRenderRoot {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 820px;
  background: #ffffff;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #1a2b2b;
  padding: 0;
  z-index: -1;
}
