/* ==========================================================================
   Eucalyptus demo — Vibrant SaaS design system
   Soft gradient atmosphere, rounded cards, violet (baseline) / mint (euca).
   Two modes: light (default) and dark. Toggle via [data-theme].
   ========================================================================== */

:root,
[data-theme="light"] {
  --bg: #faf9fd;
  --bg-blob-1: rgba(124, 92, 255, 0.14);
  --bg-blob-2: rgba(18, 184, 134, 0.12);
  --bg-blob-3: rgba(255, 184, 107, 0.10);
  --surface: #ffffff;
  --surface-2: #f5f3fb;
  --surface-hover: #efeafc;
  --sidebar-bg: #ffffff;
  --border: rgba(34, 31, 51, 0.08);
  --border-strong: rgba(34, 31, 51, 0.16);

  --text: #221f33;
  --muted: #736e8a;
  --muted-2: #a49fbb;

  --accent: #7c5cff;
  --accent-strong: #6547e8;
  --accent-dim: rgba(124, 92, 255, 0.12);
  --accent-ink: #4a35b0;
  --accent-shadow: rgba(124, 92, 255, 0.22);

  --euca: #12b886;
  --euca-dim: rgba(18, 184, 134, 0.12);
  --euca-ink: #0a7a58;
  --euca-shadow: rgba(18, 184, 134, 0.20);

  --warn: #e8a317;
  --warn-dim: rgba(232, 163, 23, 0.14);
  --danger: #e2564f;
  --danger-dim: rgba(226, 86, 79, 0.12);

  --btn-fg: #ffffff;
  --shadow-sm: 0 4px 16px rgba(34, 31, 51, 0.06);
  --shadow-md: 0 16px 40px rgba(34, 31, 51, 0.10);
  --shadow-card: 0 12px 36px rgba(34, 31, 51, 0.08);

  --scroll-thumb: rgba(34, 31, 51, 0.18);
  --scroll-thumb-hover: rgba(34, 31, 51, 0.30);
}

[data-theme="dark"] {
  --bg: #12121a;
  --bg-blob-1: rgba(124, 92, 255, 0.18);
  --bg-blob-2: rgba(18, 184, 134, 0.12);
  --bg-blob-3: rgba(255, 184, 107, 0.08);
  --surface: #1a1a26;
  --surface-2: #222233;
  --surface-hover: #2a2a3e;
  --sidebar-bg: #1a1a26;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f0eef8;
  --muted: #9b96b0;
  --muted-2: #6e6a82;

  --accent: #9b82ff;
  --accent-strong: #7c5cff;
  --accent-dim: rgba(155, 130, 255, 0.16);
  --accent-ink: #d4caff;
  --accent-shadow: rgba(124, 92, 255, 0.30);

  --euca: #2dd4a0;
  --euca-dim: rgba(45, 212, 160, 0.14);
  --euca-ink: #a8f0d4;
  --euca-shadow: rgba(45, 212, 160, 0.22);

  --warn: #f0b429;
  --warn-dim: rgba(240, 180, 41, 0.14);
  --danger: #f07167;
  --danger-dim: rgba(240, 113, 103, 0.14);

  --btn-fg: #ffffff;
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 12px 36px rgba(0, 0, 0, 0.30);

  --scroll-thumb: rgba(255, 255, 255, 0.16);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.28);
}

:root {
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --font-ui: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  font-family: var(--font-ui);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
.hidden { display: none !important; }

body {
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(620px 460px at 6% -8%, var(--bg-blob-1), transparent 62%),
    radial-gradient(560px 440px at 98% 2%, var(--bg-blob-2), transparent 62%),
    radial-gradient(760px 540px at 50% 118%, var(--bg-blob-3), transparent 62%);
  background-attachment: fixed;
  transition: background-color .25s ease, color .2s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-dim); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- custom scrollbars ---- */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  background-clip: padding-box;
}

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

/* ==========================================================================
   App shell — top nav (vibrant) instead of sidebar
   ========================================================================== */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: transparent;
  border-right: none;
  border-bottom: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
  border-radius: 9px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease, transform .1s ease;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.theme-toggle:active { transform: scale(.96); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* ---- page header ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 28px 18px;
  background: transparent;
  border-bottom: none;
  flex-shrink: 0;
  text-align: left;
}
.page-title {
  font-family: var(--font-display);
  font-size: 27px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.speedup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1px;
  padding: 9px 16px 9px 13px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--euca-dim), var(--accent-dim));
  color: var(--euca-ink);
  border: 1px solid var(--euca-shadow);
  box-shadow: 0 6px 20px var(--euca-shadow);
  white-space: nowrap;
  animation: fadeIn .3s ease;
}
.speedup .spark {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--euca);
}
.speedup.hidden { display: none; }

/* ---- top pill nav ---- */
.mode-switch {
  position: relative;
  display: flex;
  flex-direction: row;
  gap: 4px;
  padding: 5px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.tab-indicator {
  position: absolute;
  top: 5px;
  left: 0;
  height: calc(100% - 10px);
  border-radius: var(--radius-pill);
  border-left: none;
  transition: transform .28s cubic-bezier(.4,0,.2,1), width .28s cubic-bezier(.4,0,.2,1);
  z-index: 0;
  opacity: 0;
  background: linear-gradient(135deg, var(--accent), #5b8def);
  box-shadow: 0 6px 16px var(--accent-shadow);
}
.tab-indicator.tint-blue,
.tab-indicator.tint-green,
.tab-indicator.tint-amber {
  background: linear-gradient(135deg, var(--accent), #5b8def);
  border-left-color: transparent;
}
.tab-indicator.tint-green {
  background: linear-gradient(135deg, var(--euca), #2bb673);
  box-shadow: 0 6px 16px var(--euca-shadow);
}

.mode-tab {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s ease;
  white-space: nowrap;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active { color: #fff; }
.mode-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.mode-tab.active .mode-icon { opacity: 1; }

@media (max-width: 820px) {
  .sidebar { padding: 14px 16px; flex-wrap: wrap; }
  .page-header { padding: 4px 16px 14px; }
  .page-title { font-size: 22px; }
  .mode-tab { padding: 9px 14px; }
  .mode-tab span:not(.mode-icon) { /* keep labels on mobile */ }
}

/* ==========================================================================
   Batch page
   ========================================================================== */
.batch-page .main-area { min-height: 0; }

.batch-main {
  flex: 1;
  overflow-y: auto;
  padding: 8px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
}

.batch-progress-wrap {
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.batch-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.batch-phase { font-size: 13px; font-weight: 700; }
.batch-phase-detail {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.progress-wrap {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: none;
}
.progress-bar {
  position: relative;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #5b8def);
  transition: width .35s ease;
  border-radius: 999px;
}
.progress-bar:not(.progress-bar-started)::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.7s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(120%); } }
.batch-progress-section { margin-bottom: 10px; }
.batch-progress-section:last-child { margin-bottom: 0; }
.batch-progress-section.hidden { display: none; }
.progress-wrap-dual { position: relative; }
.progress-bar-started {
  position: absolute;
  top: 0; left: 0;
  background: var(--accent);
  opacity: .3;
  transition: width .3s ease;
}
.progress-bar-completed {
  position: relative;
  background: linear-gradient(90deg, var(--euca), #2bb673);
}

.detail-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.detail-metrics .dm-item { display: flex; justify-content: space-between; font-size: 11.5px; }
.detail-metrics .dm-k { color: var(--muted); }
.detail-metrics .dm-v {
  font-weight: 600;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---- Report cards ---- */
.report-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.report-card {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border-top: 4px solid var(--accent);
  overflow: hidden;
}
.report-card.euca { border-top-color: var(--euca); }
.report-card + .report-card { border-left: none; }
.report-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.report-card.euca .report-card-head { border-bottom-color: var(--border); }
.report-role {
  display: flex;
  align-items: center;
  gap: 12px;
}
.report-role .dot { flex-shrink: 0; }
.role-icon {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim); color: var(--accent);
  flex-shrink: 0;
}
.report-card.euca .role-icon { background: var(--euca-dim); color: var(--euca); }
.role-icon svg { width: 16px; height: 16px; }
.role-name {
  display: block;
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.role-model {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  font-family: var(--font-mono);
}
.report-live {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.report-body {
  flex: 1;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}
.report-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  gap: 10px;
}
.report-empty svg { width: 32px; height: 32px; color: var(--muted-2); }
.report-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 260px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 0 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.hero-stat-value {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.report-card.euca .hero-stat-value { color: var(--euca); }
.hero-stat-label {
  margin-top: 8px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
}

.report-metrics .mp-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 16px;
}
.report-metrics .mp-item .v { font-size: 16px; }

/* Workspace — samples */
.batch-workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-card);
}
.workspace-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.workspace-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px !important;
  border: none !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent !important;
  transition: color .15s ease;
  box-shadow: none !important;
}
.workspace-tab.active {
  color: var(--text) !important;
  border-bottom-color: var(--accent) !important;
}
.tab-badge {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.workspace-tab.active .tab-badge {
  background: var(--accent-dim);
  border-color: transparent;
  color: var(--accent-ink);
}
.workspace-panel { padding: 16px; }

.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.sample-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 14px 16px !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--border) !important;
  background: var(--surface-2) !important;
  color: var(--text) !important;
  cursor: pointer;
  font: inherit;
  font-weight: 400 !important;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
  min-height: 140px;
  box-shadow: none !important;
}
.sample-card:hover {
  background: var(--surface-hover) !important;
  border-color: var(--border-strong) !important;
  transform: translateY(-1px);
}
.sample-card.is-pending { opacity: .78; }
.sample-card.is-error { border-color: rgba(226,86,79,.4) !important; }
.sample-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.sample-num {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--muted);
  letter-spacing: .5px;
}
.sample-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .45px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.sample-status.done {
  color: var(--euca-ink);
  border-color: transparent;
  background: var(--euca-dim);
}
.sample-status.error {
  color: var(--danger);
  border-color: transparent;
  background: var(--danger-dim);
}
.sample-status.running {
  color: var(--accent-ink);
  border-color: transparent;
  background: var(--accent-dim);
  animation: statusPulse 1.3s ease-in-out infinite;
}
.sample-status.cancelled {
  color: var(--muted);
  border-color: var(--border);
  background: transparent;
  text-decoration: line-through;
}
@keyframes statusPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.sample-card-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sample-card-preview {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sample-card-foot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}
.stat-chip {
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  padding: 4px 8px;
  border-radius: 8px;
  border: none;
  background: var(--surface);
}
.stat-chip.baseline { background: var(--accent-dim); color: var(--accent-ink); }
.stat-chip.euca { background: var(--euca-dim); color: var(--euca-ink); }

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px !important;
  margin-bottom: 16px;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border) !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: color .15s, border-color .15s;
  box-shadow: none !important;
}
.detail-back svg { width: 16px; height: 16px; }
.detail-back:hover {
  color: var(--text) !important;
  border-color: var(--border-strong) !important;
}
.detail-back:focus-visible,
.workspace-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.detail-header { margin-bottom: 12px; }
.detail-id {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.detail-title {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}
.detail-prompt {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  white-space: pre-wrap;
}
.detail-responses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}
.detail-response {
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.detail-response + .detail-response { border-left: 1px solid var(--border); }
.detail-response header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 2px solid var(--accent);
  background: var(--surface);
}
.detail-response.euca header { border-bottom-color: var(--euca); }
.detail-response-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.detail-response-stats {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.detail-response-body {
  padding: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 320px;
  overflow-y: auto;
}

.batch-composer { flex-shrink: 0; }
.batch-composer-row {
  flex-wrap: wrap;
  align-items: flex-end;
}
.batch-controls {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  min-width: 0;
}
.batch-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}
.batch-field.narrow { min-width: 88px; }
.field-label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
}
.batch-field select,
.batch-field input[type=number] {
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.batch-field select:focus,
.batch-field input[type=number]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.batch-field select:disabled,
.batch-field input:disabled { opacity: .5; }

@media (max-width: 820px) {
  .report-cards,
  .detail-responses { grid-template-columns: 1fr; }
  .report-card + .report-card { border-left: none; }
  .detail-response + .detail-response { border-left: 1px solid var(--border); }
  .report-metrics .mp-grid { grid-template-columns: 1fr 1fr; }
  .batch-controls { width: 100%; }
  .composer-actions { width: 100%; justify-content: flex-end; }
  .hero-stat-value { font-size: 30px; }
  .role-icon { display: none; }
  .batch-main { padding: 8px 16px 16px; }
}

/* ==========================================================================
   Live chat — panes as separate vibrant cards
   ========================================================================== */
.panes {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 0 28px 16px;
  min-height: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border-top: 4px solid var(--accent);
  overflow: hidden;
}
.pane.euca { border-top-color: var(--euca); }
.pane + .pane { border-left: none; }

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.pane.euca .pane-head { border-bottom-color: var(--border); }
.title { display: flex; align-items: center; gap: 10px; }
.title h2 {
  font-family: var(--font-display);
  font-size: 15.5px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.tag {
  font-size: 11px;
  color: var(--muted);
  border: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  background: var(--surface-2);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn);
  flex-shrink: 0;
  transition: background .2s ease;
}
.dot.ready { background: var(--euca); }
.dot.busy { background: var(--accent); animation: dotPulse 1.1s ease-in-out infinite; }
.dot.err { background: var(--danger); }
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.live {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---- messages ---- */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 20px;
  min-height: 100%;
}
.chat-empty svg { width: 30px; height: 30px; color: var(--muted-2); }
.chat-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 220px;
}
.msg {
  max-width: 92%;
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: none;
  animation: fadeIn .2s ease both;
}
.msg.user {
  align-self: flex-end;
  background: var(--surface-2);
  color: var(--muted);
  font-style: italic;
  font-size: 13.5px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--accent-dim);
  color: var(--text);
}
.pane.euca .msg.assistant { background: var(--euca-dim); }
.msg .role {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 700;
  font-style: normal;
}
.msg.assistant .role { color: var(--accent); }
.pane.euca .msg.assistant .role { color: var(--euca); }
.msg .cursor {
  display: inline-block;
  width: 7px; height: 14px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: -2px;
  animation: blink 1s steps(2) infinite;
}
.pane.euca .msg .cursor { background: var(--euca); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.15} }
.think {
  color: var(--muted);
  font-style: italic;
  border-left: 2px solid var(--border);
  padding-left: 8px;
}

/* ---- metrics popup ---- */
.metrics-popup {
  position: absolute;
  left: 14px; right: 14px; bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-md);
  animation: fadeIn .2s ease;
  z-index: 5;
}
.metrics-popup.hidden { display: none; }
.metrics-popup .mp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.metrics-popup .mp-head b { font-size: 13px; }
.metrics-popup .close {
  cursor: pointer;
  color: var(--muted);
  border: 1px solid var(--border);
  background: transparent;
  font-size: 14px;
  width: 22px; height: 22px;
  border-radius: var(--radius-sm);
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s ease, border-color .15s ease;
  box-shadow: none;
}
.metrics-popup .close:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.mp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; }
.mp-item { display: flex; flex-direction: column; }
.mp-item .k {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
}
.mp-item .v {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.mp-item .v small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  font-family: var(--font-ui);
}

/* ---- composer ---- */
.composer {
  flex-shrink: 0;
  padding: 0 28px 22px;
  border-top: none;
  background: transparent;
}
.composer-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: var(--surface);
  border-radius: 20px;
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}
#prompt {
  flex: 1;
  resize: none;
  max-height: 180px;
  padding: 10px 12px;
  font-size: 14.5px;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  line-height: 1.45;
  transition: none;
}
#prompt:focus { outline: none; border: none; box-shadow: none; }
#prompt::placeholder { color: var(--muted-2); }
.composer-actions { display: flex; align-items: center; gap: 10px; }
.maxtok {
  font-size: 10.5px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-weight: 700;
}
.maxtok input {
  width: 76px;
  padding: 8px 9px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-mono);
}
.think-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  user-select: none;
  cursor: pointer;
  white-space: nowrap;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}
.think-toggle input {
  width: 14px; height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}
.think-toggle:has(input:checked) {
  color: var(--text);
  border-color: transparent;
  background: var(--accent-dim);
}
button {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  border: none;
  background: linear-gradient(135deg, var(--accent), #5b8def);
  color: var(--btn-fg);
  box-shadow: 0 8px 20px var(--accent-shadow);
  transition: transform .1s ease, opacity .15s ease, box-shadow .15s ease;
  font-family: inherit;
}
button:hover:not(:disabled) {
  box-shadow: 0 10px 24px var(--accent-shadow);
  transform: translateY(-1px);
}
button:active:not(:disabled) { transform: scale(.98); }
button:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  box-shadow: none;
}
button.ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: none;
  box-shadow: none;
}
button.ghost:active:not(:disabled) { transform: scale(.98); }
.status {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  padding-left: 4px;
}

.batch-composer .composer-row {
  align-items: flex-end;
}

@media (max-width: 820px) {
  .panes { grid-template-columns: 1fr; margin: 0 16px 12px; }
  .pane + .pane { border-left: none; }
  .composer { padding: 0 16px 16px; }
  .composer-row { flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .detail-metrics { grid-template-columns: 1fr; }
  .brand-logo { height: 24px; }
  .page-title { font-size: 20px; }
  .maxtok { display: none; }
  .think-toggle span { display: none; }
}

/* ==========================================================================
   Refinement layer — winner treatment, comparison bars, popup icons, motion
   Visual only: driven entirely by metrics the backend already returns.
   ========================================================================== */

/* ---- Winner "Faster" badge + glow (chat panes & batch report cards) ---- */
.winner-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 3px 9px 3px 7px;
  border-radius: var(--radius-pill);
  color: var(--euca-ink);
  background: var(--euca-dim);
  border: 1px solid var(--euca-shadow);
  white-space: nowrap;
  animation: badgePop .35s cubic-bezier(.34,1.56,.64,1) both;
}
.winner-badge svg { width: 12px; height: 12px; flex-shrink: 0; }
@keyframes badgePop {
  0% { opacity: 0; transform: scale(.7); }
  100% { opacity: 1; transform: scale(1); }
}

.pane.is-winner,
.report-card.is-winner {
  box-shadow: var(--shadow-card), 0 0 0 1.5px var(--euca-shadow),
              0 10px 34px var(--euca-shadow);
}
.pane.is-winner { border-top-color: var(--euca); }

/* ---- Inline comparison bars (grow to value) ---- */
.cmp {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.cmp-row { display: flex; align-items: center; gap: 10px; }
.cmp-name {
  width: 62px;
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
}
.cmp-track {
  flex: 1;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
}
.cmp-fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), #5b8def);
  transition: width .7s cubic-bezier(.4, 0, .2, 1);
}
.cmp-fill.euca { background: linear-gradient(90deg, var(--euca), #2bb673); }
.cmp-val {
  width: 74px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ---- Metrics popup: SVG icon chips instead of emoji ---- */
.mp-item .k {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mp-item .k svg {
  width: 12px;
  height: 12px;
  color: var(--muted-2);
  flex-shrink: 0;
}
.metrics-popup .mp-head b {
  font-family: var(--font-display);
  font-weight: 700;
}

/* ---- Staggered reveal for sample cards ---- */
.sample-card {
  animation: cardReveal .32s ease both;
}
.sample-grid .sample-card:nth-child(1) { animation-delay: .02s; }
.sample-grid .sample-card:nth-child(2) { animation-delay: .05s; }
.sample-grid .sample-card:nth-child(3) { animation-delay: .08s; }
.sample-grid .sample-card:nth-child(4) { animation-delay: .11s; }
.sample-grid .sample-card:nth-child(5) { animation-delay: .14s; }
.sample-grid .sample-card:nth-child(6) { animation-delay: .17s; }
.sample-grid .sample-card:nth-child(7) { animation-delay: .20s; }
.sample-grid .sample-card:nth-child(8) { animation-delay: .23s; }
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero stat gets the display face for a stronger headline number */
.hero-stat-value { font-family: var(--font-mono); }
.hero-stat-label { font-family: var(--font-display); }

/* ---- Login / admin (session UI only) ---- */
.logout-btn {
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
}
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 28px 28px 32px;
}
.auth-card-wide { max-width: 560px; }
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.auth-card h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: -0.03em;
}
.auth-lead {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.auth-field input {
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
}
.auth-field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
.auth-error {
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 13px;
}
.auth-ok {
  margin: 0 0 12px;
  color: var(--euca-ink);
  font-size: 13px;
}
.auth-card button[type="submit"] { width: 100%; margin-top: 4px; }
.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.admin-section { margin-top: 22px; }
.admin-section h2 {
  margin: 0 0 10px;
  font-size: 15px;
}
.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.user-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.user-list li:last-child { border-bottom: 0; }
.user-role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.user-list .muted { color: var(--muted); }
.user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.user-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}
.user-actions .ghost {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
.danger-ghost { color: var(--danger); }
.admin-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
a.logout-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}
a.logout-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.auth-dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 22px 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
  max-width: 400px;
  width: calc(100% - 32px);
}
.auth-dialog::backdrop { background: rgba(18, 18, 26, 0.45); }
.auth-dialog h2 { margin: 0 0 6px; font-size: 18px; }
.auth-dialog .admin-head-actions { justify-content: flex-end; margin-top: 8px; }
.auth-dialog button[type="submit"] { width: auto; }

/* ---- Global demo status (header chip + wait modal) ---- */
.header-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-width: min(420px, 52%);
}
.demo-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  max-width: 100%;
  padding: 10px 14px 10px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.demo-status-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted-2);
  box-shadow: 0 0 0 4px var(--border);
}
.demo-status-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
  opacity: .85;
}
.demo-status-icon svg { width: 18px; height: 18px; display: block; }
.demo-status-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.demo-status-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.demo-status-detail {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.demo-status.is-ready {
  border-color: var(--euca-shadow);
  background: linear-gradient(135deg, var(--euca-dim), var(--surface));
}
.demo-status.is-ready .demo-status-pulse { background: var(--euca); box-shadow: 0 0 0 4px var(--euca-dim); }
.demo-status.is-ready .demo-status-label { color: var(--euca-ink); }
.demo-status.is-cold {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.demo-status.is-cold .demo-status-pulse { background: var(--muted); }
.demo-status.is-starting {
  border-color: var(--accent-shadow);
  background: linear-gradient(135deg, var(--accent-dim), var(--surface));
}
.demo-status.is-starting .demo-status-pulse {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
  animation: statusPulse 1.3s ease-in-out infinite;
}
.demo-status.is-starting .demo-status-label { color: var(--accent-ink); }
.demo-status.is-live {
  border-color: var(--euca-shadow);
  background: linear-gradient(135deg, var(--euca-dim), var(--accent-dim));
}
.demo-status.is-live .demo-status-pulse {
  background: var(--euca);
  box-shadow: 0 0 0 4px var(--euca-dim);
  animation: statusPulse 1.1s ease-in-out infinite;
}
.demo-status.is-live .demo-status-label { color: var(--euca-ink); }
.demo-status.is-wait {
  border-color: var(--warn);
  background: var(--warn-dim);
}
.demo-status.is-wait .demo-status-pulse {
  background: var(--warn);
  box-shadow: 0 0 0 4px var(--warn-dim);
  animation: statusPulse 1.3s ease-in-out infinite;
}
.demo-status.is-checking .demo-status-pulse { animation: statusPulse 1.6s ease-in-out infinite; }
button.is-wait {
  background: var(--warn-dim) !important;
  color: var(--text) !important;
  box-shadow: none !important;
  border: 1px solid var(--warn);
}
button.is-wait:hover:not(:disabled) {
  transform: none;
  box-shadow: none !important;
}
.demo-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 18, 26, 0.45);
  padding: 20px;
  backdrop-filter: blur(6px);
}
.demo-modal-card {
  max-width: 420px;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 26px 24px 20px;
  text-align: center;
}
.demo-modal-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--warn-dim);
  color: var(--warn);
}
.demo-modal-icon svg { width: 22px; height: 22px; }
.demo-modal-card h3 { margin: 0 0 8px; font-size: 18px; font-family: var(--font-display); }
.demo-modal-card p { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }
.demo-modal-card button { width: auto; min-width: 96px; }

@media (max-width: 820px) {
  .header-aside { max-width: 100%; align-items: stretch; }
  .demo-status { min-width: 0; }
}
