/* ==========================================================================
   shared.css — tokens + componentes comuns
   Tokens vêm do design F2 (static/_mockup_f2.html:9-34).
   ========================================================================== */

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

:root {
  /* -- Surfaces -- */
  --bg:             #fafafa;
  --surface:        #ffffff;
  --surface-soft:   #f8fafc;

  /* -- Text -- */
  --text:           #1e293b;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;

  /* -- Borders -- */
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;

  /* -- Accent (teal) -- */
  --accent:         #0f766e;
  --accent-soft:    #ecfdf5;
  --accent-strong:  #115e59;

  /* -- Intents -- */
  --danger:         #ef4444;
  --danger-soft:    #fef2f2;
  --danger-strong:  #b91c1c;
  --warning:        #f59e0b;
  --warning-soft:   #fef7e6;
  --warning-text:   #92400e;
  --success:        #10b981;
  --success-soft:   #ecfdf5;

  /* -- Neutral dark (course chip, tooltips) -- */
  --neutral-dark:   #1e293b;

  /* -- Notes (pedagogical chip — kept in tokens, not rendered to student) -- */
  --note-bg:        #fef7e6;
  --note-border:    #fde68a;
  --note-text:      #92400e;

  /* -- Typography -- */
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display:  Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  --font-mono:     'SF Mono', Monaco, Consolas, monospace;

  /* -- Layout -- */
  --header-h:             56px;
  --strip-w-compact:      84px;
  --strip-w-expanded:    256px;
  --aulas-w:             288px;

  /* -- Motion -- */
  --t-fast:   0.18s;
  --t-med:    0.28s;
  --t-ease:   cubic-bezier(0.4, 0, 0.2, 1);
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

/* ==========================================================================
   Utility
   ========================================================================== */
.icon { width: 1em; height: 1em; flex-shrink: 0; vertical-align: middle; }
.hidden { display: none !important; }

/* ==========================================================================
   Mobile gate (usado em múltiplas páginas)
   ========================================================================== */
.mobile-gate {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 32px;
  text-align: center;
}
.mobile-gate h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}
.mobile-gate p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 360px;
}
@media (max-width: 767px) {
  body.mobile-aware .mobile-gate { display: flex; }
  body.mobile-aware > :not(.mobile-gate) { display: none !important; }
}

/* ==========================================================================
   Header shell (login out, chat, settings, admin_*)
   ========================================================================== */
.header-shell {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
}
.header-shell h1 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.header-shell .spacer { flex: 1; }
.header-shell .status-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.header-shell .status-chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-muted);
}
.header-shell .status-chip.active .dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}
.header-shell .status-chip.ending .dot { background: var(--warning); }

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary);
  padding: 7px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
}
.icon-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
}
.icon-btn.subtle { color: var(--text-muted); }

/* ==========================================================================
   Admin shell — shared top-bar + nav + page wrapper injected by admin-shell.js

   Uses `position: fixed` rather than `position: sticky` because the global
   `html, body { height: 100% }` rule above caps the containing block of a
   sticky child to the viewport, which makes the shell scroll off-screen
   once content pushes past the first viewport. Fixed positioning combined
   with `.admin-page { padding-top: 56px + normal }` keeps the bar pinned.
   ========================================================================== */
.admin-shell {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding: 0 20px;
  gap: 18px;
}
.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.admin-brand .brand-mark {
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
}
.admin-brand .brand-sub {
  font-family: var(--font);
  font-weight: 600;
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-left: 2px;
}
.admin-nav {
  display: flex;
  gap: 2px;
  align-items: stretch;
}
.admin-tab {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s, background .12s;
}
.admin-tab:hover { color: var(--text); background: var(--surface-soft); }
.admin-tab.active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}
.admin-shell-spacer { flex: 1; }
.admin-shell-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.admin-shell-identity {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.admin-logout {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  transition: all 0.12s;
}
.admin-logout:hover {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--border-strong);
}

/* Page wrapper used by all admin pages.
   Top padding = 56px (shell height) + 32px breathing room. */
.admin-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 88px 24px 64px;
}
.admin-page-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 4px;
}
.admin-page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  max-width: 820px;
  line-height: 1.55;
}

/* Section cards reused across admin pages */
.admin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
}
.admin-section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-section-header h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin: 0;
}
.admin-section-body {
  padding: 18px 20px;
}

/* Metric cards used on Visão Geral + Uso & Custos */
.admin-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.admin-metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.admin-metric-card .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.admin-metric-card .value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.1;
}
.admin-metric-card .sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.admin-metric-card.tone-warning { border-color: var(--note-border); background: var(--warning-soft); }
.admin-metric-card.tone-warning .value { color: var(--warning-text); }
.admin-metric-card.tone-danger  { border-color: #fecaca; background: var(--danger-soft); }
.admin-metric-card.tone-danger .value { color: var(--danger-strong); }
.admin-metric-card.tone-success { border-color: #a7f3d0; background: var(--success-soft); }
.admin-metric-card.tone-success .value { color: #065f46; }

/* Inbox list (Visão Geral) */
.admin-inbox {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-inbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
}
.admin-inbox-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.admin-inbox-item.tone-warning .dot { background: var(--warning); }
.admin-inbox-item.tone-danger .dot  { background: var(--danger); }
.admin-inbox-item.tone-success .dot { background: var(--success); }
.admin-inbox-item .inbox-body { flex: 1; min-width: 0; }
.admin-inbox-item .inbox-title { font-weight: 600; color: var(--text); }
.admin-inbox-item .inbox-detail { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.admin-inbox-item a.inbox-cta {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-strong);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}
.admin-inbox-item a.inbox-cta:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.admin-inbox-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Data tables reused across admin pages */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.clickable { cursor: pointer; }
.admin-table tr.clickable:hover { background: var(--surface-soft); }
.admin-table td.num,
.admin-table th.num {
  font-family: var(--font-mono);
  text-align: right;
}

/* Confirm modal used across admin pages */
.admin-confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.admin-confirm-overlay.open { opacity: 1; pointer-events: auto; }
.admin-confirm {
  background: var(--surface);
  border-radius: 12px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  padding: 24px 28px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s var(--t-ease);
}
.admin-confirm-overlay.open .admin-confirm { transform: translateY(0) scale(1); }
.admin-confirm h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.admin-confirm p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 20px;
}
.admin-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 32px;
}
.card-lg {
  max-width: 640px;
  width: 100%;
}
.card-sm {
  max-width: 400px;
  width: 100%;
}

.card h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  text-align: center;
}
.card .subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  text-align: center;
}

/* ==========================================================================
   Form fields
   ========================================================================== */
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  outline: none;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
}
.field input:disabled,
.field textarea:disabled,
.field select:disabled {
  background: var(--surface-soft);
  color: var(--text-secondary);
  cursor: not-allowed;
}
.field .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  padding: 11px 18px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.18);
}
.btn-accent:hover:not(:disabled) {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.26);
}
.btn-accent:active:not(:disabled) { transform: translateY(0); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--text);
}

.btn-full { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 7px; }

/* ==========================================================================
   Status badges
   ========================================================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.status-badge.active    { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.status-badge.pending   { background: var(--warning-soft); color: var(--warning-text); border-color: var(--note-border); }
.status-badge.setup     { background: #e0f2fe;              color: #075985; border-color: #bae6fd; }
.status-badge.revoked   { background: var(--danger-soft);   color: var(--danger-strong); border-color: #fecaca; }
.status-badge.admin     { background: var(--neutral-dark);  color: #fff; }
.status-badge.solid     { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.status-badge.shaky     { background: var(--warning-soft); color: var(--warning-text); border-color: var(--note-border); }
.status-badge.weak      { background: #ffedd5;              color: #9a3412; border-color: #fed7aa; }
.status-badge.unseen    { background: var(--surface-soft);  color: var(--text-secondary); border-color: var(--border); }
.status-badge.missing   { background: var(--danger-soft);   color: var(--danger-strong); border-color: #fecaca; }

/* ==========================================================================
   Empty states
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
  max-width: 420px;
  margin: 0 auto;
}
.empty-state h2 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 700;
}

/* ==========================================================================
   Error messages
   ========================================================================== */
.error-msg {
  background: var(--danger-soft);
  color: #991b1b;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid #fecaca;
}
.error-msg:empty { display: none; }

/* ==========================================================================
   Toast container + toasts
   ========================================================================== */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  right: 16px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 360px;
}
.toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 280px;
  animation: toast-in 0.22s var(--t-ease);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast.leaving {
  animation: toast-out 0.2s var(--t-ease) forwards;
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}
.toast .toast-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.toast.evaluating .toast-icon {
  background: var(--neutral-dark);
}
.toast.evaluating .toast-icon svg {
  animation: toast-spin 1s linear infinite;
}
@keyframes toast-spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}
.toast.success .toast-icon  { background: var(--success); }
.toast.error   .toast-icon  { background: var(--danger); }
.toast.info    .toast-icon  { background: var(--accent); }
.toast-body { flex: 1; min-width: 0; }
.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.toast-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.toast-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  margin-top: 6px;
  cursor: pointer;
  font-family: var(--font);
}
.toast-link:hover { color: var(--accent-strong); text-decoration: underline; }
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  align-self: flex-start;
}
.toast-close:hover { color: var(--text); }

/* ==========================================================================
   Modal overlay + container
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 20px;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-container {
  background: var(--surface);
  border-radius: 16px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.22s var(--t-ease);
}
.modal-overlay.open .modal-container {
  transform: translateY(0) scale(1);
}
.modal-header {
  padding: 28px 32px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.modal-header .sub {
  font-size: 13px;
  color: var(--text-secondary);
}
.modal-body {
  padding: 20px 32px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 16px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  position: absolute;
  top: 16px;
  right: 16px;
}
.modal-close:hover { color: var(--text); }

/* ==========================================================================
   Post-session evaluation modal (full-screen overlay, used by index.html
   when a session ends). Source of truth: specs/fast-eval-pipeline.md.
   Mock reference: static/mock_eval_modal.html.
   ========================================================================== */

.eval-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--t-ease);
}
.eval-overlay.open     { opacity: 1; pointer-events: auto; }
.eval-overlay.minimized { opacity: 0; pointer-events: none; }

/* Floating chip shown when the modal is minimized so the student can reopen. */
.eval-floating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  display: none;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
}
.eval-floating.visible { display: inline-flex; }
.eval-floating:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.22);
}
.eval-floating .fl-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: eval-spinner-rotate 0.9s linear infinite;
}
.eval-floating .fl-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 12px;
}
.eval-floating .fl-body  { display: flex; flex-direction: column; line-height: 1.3; }
.eval-floating .fl-title { font-weight: 600; font-size: 13px; }
.eval-floating .fl-sub   { font-size: 11.5px; color: var(--text-muted); }

.eval-modal {
  background: var(--surface);
  border-radius: 18px;
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.32);
  transform: translateY(12px) scale(0.985);
  transition: transform 0.26s var(--t-ease);
  overflow: hidden;
}
.eval-overlay.open .eval-modal { transform: translateY(0) scale(1); }

.eval-modal-header {
  padding: 28px 36px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  position: relative;
}
.eval-modal-header .eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.eval-modal-header h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.2;
}
.eval-modal-header .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 640px;
}
.eval-minimize {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s;
}
.eval-minimize:hover {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--border-strong);
}

.phase-tracker {
  display: flex;
  gap: 0;
  margin-top: 20px;
  position: relative;
}
.phase-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  padding-right: 14px;
}
.phase-step:last-child { padding-right: 0; }
.phase-step .phase-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  position: relative;
}
.phase-step .phase-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s var(--t-ease);
}
.phase-step.done .phase-bar::after { transform: scaleX(1); }
.phase-step.active .phase-bar::after {
  transform: scaleX(0.35);
  animation: phase-pulse 1.8s ease-in-out infinite;
}
@keyframes phase-pulse {
  0%, 100% { transform: scaleX(0.35); opacity: 1; }
  50%      { transform: scaleX(0.75); opacity: 0.8; }
}
.phase-step .phase-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.phase-step.active .phase-label { color: var(--accent-strong); }
.phase-step.done   .phase-label { color: var(--text); }
.phase-step .phase-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.phase-step.active .phase-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.18);
}
.phase-step.done .phase-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.eval-modal-body {
  padding: 24px 36px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.running-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
}
.running-status .rs-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.running-spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: eval-spinner-rotate 0.9s linear infinite;
  flex-shrink: 0;
}
@keyframes eval-spinner-rotate {
  to { transform: rotate(360deg); }
}
.running-status .rs-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.running-status .rs-title strong {
  color: var(--accent-strong);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.running-status .rs-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.running-status .rs-elapsed {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.reconnect-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--warning-soft);
  border: 1px solid var(--note-border, #fde68a);
  color: var(--warning-text);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
.reconnect-banner.visible { display: flex; }
.reconnect-banner .rb-dots { display: inline-flex; gap: 4px; }
.reconnect-banner .rb-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--warning);
  animation: rb-pulse 1.1s infinite ease-in-out;
}
.reconnect-banner .rb-dots span:nth-child(2) { animation-delay: 0.15s; }
.reconnect-banner .rb-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes rb-pulse {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-2px); }
}

.concepts-running {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.concept-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  transition: all 0.25s var(--t-ease);
  min-width: 0;
}
.concept-chip.done {
  background: var(--accent-soft);
  border-color: #99f6e4;
  color: var(--accent-strong);
  animation: chip-pop 0.38s var(--t-ease);
}
@keyframes chip-pop {
  0%   { transform: scale(0.96); background: var(--surface); }
  60%  { transform: scale(1.02); }
  100% { transform: scale(1);    background: var(--accent-soft); }
}
.concept-chip .chip-mark {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s;
}
.concept-chip.done .chip-mark {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.concept-chip .chip-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reveal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--success-soft);
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  margin-bottom: 20px;
}
.reveal-check {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  animation: reveal-pop 0.45s var(--t-ease);
}
@keyframes reveal-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.1); }
  100% { transform: scale(1);   opacity: 1; }
}
.reveal-header .rh-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #065f46;
  margin-bottom: 2px;
}
.reveal-header .rh-sub {
  font-size: 13px;
  color: #047857;
}
.reveal-header .rh-sub strong { font-variant-numeric: tabular-nums; }

.scores-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.summary-pill strong { color: var(--text); font-weight: 700; }
.summary-pill.up    { border-color: #a7f3d0; background: var(--success-soft); color: #065f46; }
.summary-pill.down  { border-color: #fecaca; background: var(--danger-soft);  color: var(--danger-strong); }
.summary-pill.flat  { border-color: var(--border); background: var(--surface-soft); color: var(--text-secondary); }

.score-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.score-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.score-row:hover      { border-color: var(--border-strong); }
.score-row.open       { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06); }
.score-row-head {
  width: 100%;
  background: none;
  border: none;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  color: var(--text);
}
.score-row-head:hover { background: var(--surface-soft); }
.sr-id {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sr-delta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.sr-delta .arrow  { font-weight: 700; letter-spacing: -0.02em; }
.sr-delta .amount { font-weight: 700; }
.sr-delta.up      { color: #065f46; }
.sr-delta.down    { color: var(--danger-strong); }
.sr-delta.flat    { color: var(--text-muted); }
.sr-caret {
  color: var(--text-muted);
  font-size: 14px;
  transition: transform 0.18s;
  justify-self: end;
}
.score-row.open .sr-caret { transform: rotate(180deg); }

.score-row-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s var(--t-ease);
  border-top: 1px solid transparent;
}
.score-row.open .score-row-body {
  max-height: 240px;
  border-top-color: var(--border);
}
.score-row-inner {
  padding: 14px 16px;
  background: var(--surface-soft);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.score-row-inner .sri-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.score-row-inner .sri-note {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.eval-error-state {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px 8px;
}
.eval-error-state.visible { display: flex; }
.eval-error-state .err-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 14px;
  border: 1px solid #fecaca;
}
.eval-error-state h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.eval-error-state p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 520px;
  margin-bottom: 4px;
}
.eval-error-state .err-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-soft);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-top: 14px;
}

.eval-modal-footer {
  padding: 18px 36px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: var(--surface-soft);
}
.eval-modal-footer .footer-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
}
.eval-modal-footer .footer-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .eval-overlay         { padding: 12px; }
  .eval-modal-header    { padding: 22px 22px 16px; }
  .eval-modal-header h2 { font-size: 22px; }
  .eval-modal-body      { padding: 20px 22px; }
  .eval-modal-footer    { padding: 14px 22px; flex-direction: column; align-items: stretch; }
  .eval-modal-footer .footer-actions { justify-content: flex-end; }
  .phase-tracker        { flex-wrap: wrap; gap: 10px; }
  .phase-step           { flex: 1 1 45%; padding-right: 0; }
  .phase-step .phase-label { font-size: 11.5px; }
  .concepts-running     { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .eval-modal-header .eyebrow { font-size: 9.5px; }
  .eval-modal-header h2       { font-size: 20px; }
  .running-status             { flex-direction: column; align-items: stretch; }
  .running-status .rs-elapsed { align-self: flex-end; }
}
