:root {
  --ink: #1e1730;
  --muted: #756f80;
  --line: #e8e3ed;
  --surface: #ffffff;
  --surface-soft: #f8f6fa;
  --plum: #4d2f78;
  --plum-dark: #34204f;
  --lilac: #eee6f8;
  --gold: #d9a441;
  --green: #1c7b57;
  --green-soft: #e7f5ef;
  --red: #b0444a;
  --red-soft: #faecee;
  --shadow: 0 20px 60px rgba(38, 24, 57, 0.12);
}
* { box-sizing: border-box; }
html { min-width: 320px; background: #f5f2f7; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #f5f2f7;
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(102, 70, 150, 0.3);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.ambient { position: fixed; pointer-events: none; border-radius: 50%; filter: blur(1px); z-index: 0; }
.ambient-one { width: 460px; height: 460px; left: -210px; top: -170px; background: radial-gradient(circle, rgba(189, 161, 224, .28), transparent 67%); }
.ambient-two { width: 520px; height: 520px; right: -260px; bottom: -250px; background: radial-gradient(circle, rgba(232, 190, 111, .18), transparent 66%); }

.login-shell { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; }
.login-card {
  width: min(440px, 100%);
  padding: 46px 44px 36px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 24px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.brand-mark, .mini-mark {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #65468f, #35204f);
  box-shadow: 0 10px 26px rgba(77, 47, 120, .24);
}
.brand-mark { width: 52px; height: 52px; border-radius: 15px; margin-bottom: 28px; font-size: 24px; }
.mini-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; flex: 0 0 auto; }
.eyebrow { margin: 0 0 8px; color: var(--plum); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .15em; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Manrope, system-ui, sans-serif; }
.login-card h1 { margin-bottom: 10px; font-size: 32px; line-height: 1.15; letter-spacing: -.04em; }
.login-copy { margin-bottom: 30px; color: var(--muted); line-height: 1.55; }
label { display: block; margin: 18px 0 8px; color: #46404f; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #dcd6e2;
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  padding: 0 14px;
  transition: border-color .18s, box-shadow .18s;
}
textarea { min-height: 90px; padding-block: 12px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #8e70b3; box-shadow: 0 0 0 4px rgba(100,70,143,.09); outline: none; }
input::placeholder { color: #aaa4b0; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 64px; }
.text-button { position: absolute; right: 6px; top: 6px; height: 34px; border: 0; background: transparent; color: var(--plum); font-size: 12px; font-weight: 700; cursor: pointer; }
.form-error { margin: 12px 0 0; color: var(--red); font-size: 13px; }
.primary-button, .secondary-button, .danger-button, .logout-button, .icon-button, .filter-button, .pagination-button {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .16s, box-shadow .16s, opacity .16s, background .16s;
}
.primary-button:hover, .danger-button:hover { transform: translateY(-1px); }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 47px; color: #fff; background: linear-gradient(135deg, #5c3989, #3c2559); box-shadow: 0 12px 24px rgba(71,43,105,.2); }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; border: 1px solid #d9d1df; color: var(--plum); background: #fff; }
.secondary-button:hover { background: #f7f3fa; border-color: #c8b8d7; }
.full-button { width: 100%; margin-top: 24px; }
button:disabled { cursor: not-allowed; opacity: .52; transform: none !important; box-shadow: none !important; }
.secure-note { display: flex; justify-content: center; gap: 8px; margin: 24px 0 0; color: #8a8490; font-size: 12px; }
.secure-note span { color: var(--green); font-size: 8px; padding-top: 4px; }

.app-shell { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px 20px; color: #eae1f2; background: #21172f; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 30px; color: #fff; font-family: Manrope, sans-serif; font-size: 17px; font-weight: 800; }
.sidebar nav { flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 10px; color: #bdb2c9; text-decoration: none; font-size: 14px; font-weight: 600; }
.nav-item.active { color: #fff; background: rgba(255,255,255,.1); box-shadow: inset 3px 0 #c6a0e8; }
.nav-item span:first-child { color: #c6a0e8; }
.sidebar-footer { padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.admin-chip { display: flex; align-items: center; gap: 10px; padding: 0 4px 14px; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #36224d; background: #dec8ef; font-weight: 800; }
.admin-chip strong, .admin-chip small { display: block; }
.admin-chip strong { color: #fff; font-size: 13px; }
.admin-chip small { margin-top: 2px; color: #998da6; font-size: 11px; }
.logout-button { width: 100%; min-height: 38px; color: #bdb2c9; background: transparent; text-align: left; padding: 0 8px; font-size: 12px; }
.logout-button:hover { color: #fff; background: rgba(255,255,255,.06); }
.main-column { min-width: 0; min-height: 0; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.82); backdrop-filter: blur(12px); }
.topbar > div { display: flex; align-items: center; gap: 8px; color: #6f6878; font-size: 12px; font-weight: 600; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #31a775; box-shadow: 0 0 0 4px #e6f5ef; }
.icon-button { width: 36px; height: 36px; color: #615968; background: transparent; font-size: 20px; }
.icon-button:hover { background: #f0ecf3; }
.page-content { min-height: 0; padding: 34px 36px 48px; }
.page-content.chat-page { height: calc(100dvh - 64px); display: flex; flex-direction: column; overflow: hidden; padding-bottom: 32px; }
.chat-page .page-heading { flex: 0 0 auto; }
.chat-page .chat-shell { height: auto; min-height: 0; flex: 1 1 auto; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-heading h1 { margin-bottom: 7px; font-size: 28px; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.breadcrumb { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--plum); text-decoration: none; font-size: 13px; font-weight: 700; }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { padding: 19px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 5px 18px rgba(35,22,52,.035); }
.stat-card small { display: block; margin-bottom: 8px; color: var(--muted); font-weight: 600; }
.stat-card strong { font-family: Manrope, sans-serif; font-size: 27px; letter-spacing: -.03em; }
.stat-card .stat-accent { color: var(--green); }
.stat-card .stat-muted { color: var(--red); }

.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 7px 24px rgba(35,22,52,.04); }
.table-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 170px; gap: 12px; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.search-wrap { position: relative; max-width: 430px; }
.search-wrap::before { content: "⌕"; position: absolute; left: 14px; top: 9px; color: #938b9b; font-size: 22px; }
.search-wrap input { padding-left: 42px; min-height: 42px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { height: 45px; padding: 0 18px; color: #837b89; background: #faf9fb; font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
td { padding: 15px 18px; border-top: 1px solid #f0edf2; vertical-align: middle; }
tbody tr { cursor: pointer; transition: background .15s; }
tbody tr:hover { background: #fbf9fd; }
.user-cell { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.user-cell .avatar { width: 35px; height: 35px; color: var(--plum); background: var(--lilac); font-size: 12px; }
.user-cell strong, .user-cell small { display: block; }
.user-cell strong { margin-bottom: 2px; font-size: 13px; }
.user-cell small, .muted-cell { color: var(--muted); }
.user-id { max-width: 148px; overflow: hidden; color: #6f6878; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: capitalize; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { color: var(--green); background: var(--green-soft); }
.status-revoked { color: var(--red); background: var(--red-soft); }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination-actions { display: flex; gap: 7px; }
.pagination-button { min-height: 33px; padding: 0 12px; color: #564e5d; background: #f3f0f5; font-size: 12px; }

.chat-shell { height: calc(100vh - 188px); min-height: 520px; display: grid; grid-template-columns: 340px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 8px 26px rgba(35,22,52,.05); }
.chat-list-panel { min-width: 0; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); background: #fcfbfd; }
.chat-list-heading { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.chat-list-heading strong { display: block; margin-bottom: 3px; font-family: Manrope, sans-serif; font-size: 14px; }
.chat-list-heading span { color: var(--muted); font-size: 11px; }
.chat-list { height: calc(100% - 67px); overflow-y: auto; }
.chat-item { width: 100%; display: block; padding: 15px 17px; border: 0; border-bottom: 1px solid #f0edf2; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.chat-item:hover { background: #f7f3fa; }
.chat-item.active { background: #efe8f6; box-shadow: inset 3px 0 var(--plum); }
.chat-item-top { display: flex; justify-content: space-between; gap: 10px; }
.chat-item strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.chat-item time { flex: 0 0 auto; color: #9a929f; font-size: 10px; }
.chat-item p { margin: 7px 0 8px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.chat-meta { display: flex; align-items: center; justify-content: space-between; color: #938b9b; font-size: 10px; }
.conversation { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.conversation-header { min-height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.conversation-header h2 { margin: 0 0 2px; font-size: 15px; }
.conversation-header p { margin: 0; color: var(--muted); font-size: 11px; }
.conversation-status { color: var(--green); font-size: 11px; font-weight: 700; text-transform: capitalize; }
.messages { min-height: 0; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 24px clamp(20px, 4vw, 52px); background: linear-gradient(180deg, #fdfcfe, #f9f7fb); scrollbar-gutter: stable; }
.message-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 20px; }
.message-row.user { flex-direction: row-reverse; }
.message-avatar { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; background: #62448a; font-size: 10px; font-weight: 800; }
.message-row.user .message-avatar { color: #3e2a55; background: #dfd2eb; }
.message-stack { max-width: min(680px, 78%); }
.message-author { margin: 0 3px 5px; color: #89818f; font-size: 10px; font-weight: 700; }
.message-row.user .message-author { text-align: right; }
.message-bubbles { display: grid; gap: 7px; }
.message-bubble { padding: 12px 15px; border: 1px solid #e7e1eb; border-radius: 6px 15px 15px 15px; color: #3b3540; background: #fff; box-shadow: 0 3px 12px rgba(35,22,52,.035); font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-row.user .message-bubble { border-color: #4c3070; border-radius: 15px 6px 15px 15px; color: #fff; background: #4c3070; }
.message-time { display: block; margin: 5px 4px 0; color: #9b939f; font-size: 10px; }
.message-row.user .message-time { text-align: right; }
.empty-state { min-height: 260px; display: grid; place-items: center; padding: 30px; color: var(--muted); text-align: center; }
.empty-state > div { max-width: 340px; }
.empty-symbol { width: 46px; height: 46px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 14px; color: var(--plum); background: var(--lilac); font-size: 20px; }
.empty-state h3 { margin-bottom: 7px; color: var(--ink); font-size: 15px; }
.empty-state p { margin: 0; font-size: 12px; line-height: 1.5; }
.loading-lines { padding: 20px; }
.loading-line { height: 54px; margin-bottom: 10px; border-radius: 10px; background: linear-gradient(90deg, #f1edf4 25%, #faf8fb 50%, #f1edf4 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.mobile-only { display: none; }

/* Prompt Lab */
.heading-actions, .run-heading-actions, .launch-actions, .form-actions { display: flex; align-items: center; gap: 10px; }
.heading-actions .primary-button, .heading-actions .secondary-button { padding-inline: 18px; }
.lab-editor { margin-bottom: 22px; padding: 24px; overflow: visible; border-color: #cdbadd; box-shadow: 0 15px 40px rgba(72, 43, 105, .08); }
.lab-editor-heading, .section-heading, .lab-run-heading, .lab-transcript-heading, .score-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.lab-editor-heading h2, .lab-launch h2, .section-heading h2, .lab-transcript-heading h2, .score-hero h2 { margin-bottom: 6px; font-size: 19px; }
.lab-form label { text-transform: capitalize; }
.lab-form label small { color: var(--muted); font-weight: 500; text-transform: none; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { justify-content: flex-end; margin-top: 22px; }
.form-actions .primary-button { padding-inline: 22px; }
.lab-launch { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(440px, 1.25fr); gap: 30px; align-items: center; padding: 25px 28px; overflow: visible; background: linear-gradient(135deg, #fff, #faf7fd); }
.lab-launch p, .section-heading p, .lab-transcript-heading p, .score-hero p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.lab-launch-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lab-launch-controls label { margin: 0; }
.lab-launch-controls .launch-actions, .lab-launch-controls .form-error { grid-column: 1 / -1; }
.launch-actions { justify-content: flex-end; }
.launch-actions button { min-width: 150px; }
.lab-section { margin-top: 32px; }
.section-heading { margin-bottom: 14px; }
.run-filter-controls { display: flex; align-items: flex-end; gap: 10px; }
.run-filter-controls label { min-width: 130px; margin: 0; }
.run-filter-controls label:last-child { width: min(390px, 32vw); }
.run-filter-controls select { min-height: 38px; padding-block: 8px; font-size: 11px; }
.version-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.version-card { display: flex; flex-direction: column; min-height: 250px; padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 5px 18px rgba(35,22,52,.035); }
.version-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; color: var(--muted); font-size: 11px; }
.lab-pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; color: #5c3989; background: #eee6f8; font-weight: 800; text-transform: capitalize; }
.lab-pill.secondary { color: #236a52; background: #e7f5ef; }
.version-card h3 { margin-bottom: 8px; font-size: 15px; }
.version-card > p { flex: 1; margin-bottom: 17px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.version-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.version-card dl div { min-width: 0; }
.version-card dt { margin-bottom: 3px; color: #968e9d; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.version-card dd { margin: 0; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.version-card .secondary-button { width: 100%; min-height: 36px; font-size: 11px; }
.run-list { display: grid; }
.run-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px; border: 0; border-bottom: 1px solid var(--line); color: inherit; background: #fff; text-align: left; cursor: pointer; }
.run-row:last-child { border-bottom: 0; }
.run-row:hover { background: #fbf9fd; }
.run-row strong, .run-row small { display: block; }
.run-row strong { margin-bottom: 4px; font-size: 13px; }
.run-row small { color: var(--muted); font-size: 10px; }
.run-result { text-align: right; }
.run-result b { display: block; margin-bottom: 3px; color: var(--plum); font-family: Manrope, sans-serif; font-size: 14px; text-transform: capitalize; }

.page-content.lab-run-page { padding-top: 26px; }
.lab-run-heading { flex: 0 0 auto; margin-bottom: 18px; }
.lab-run-heading h1 { margin-bottom: 5px; font-size: 23px; }
.lab-run-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.run-error { flex: 0 0 auto; padding: 11px 14px; border-radius: 10px; color: var(--red); background: var(--red-soft); font-size: 12px; }
.lab-run-layout { min-height: 0; flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 16px; }
.lab-transcript { min-height: 0; display: flex; flex-direction: column; }
.lab-transcript-heading { flex: 0 0 auto; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.lab-transcript-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; padding: 20px; background: linear-gradient(180deg, #fdfcfe, #f8f5fa); }
.lab-message { max-width: 86%; margin: 0 0 18px; }
.lab-message.user { margin-left: auto; }
.lab-message-meta { display: flex; justify-content: space-between; gap: 12px; margin: 0 3px 6px; color: #8b8391; font-size: 10px; }
.lab-message.user .lab-message-meta { flex-direction: row-reverse; }
.lab-message-part { margin-bottom: 6px; padding: 11px 14px; border: 1px solid #e5dfea; border-radius: 5px 14px 14px 14px; color: #3b3540; background: #fff; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.lab-message.user .lab-message-part { border-color: #4c3070; border-radius: 14px 5px 14px 14px; color: #fff; background: #4c3070; }
.token-line { margin: 5px 4px 0; color: #9c94a2; font-size: 9px; }
.lab-composer { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 14px; border-top: 1px solid var(--line); background: #fff; }
.lab-composer textarea { min-height: 50px; resize: none; }
.lab-composer .primary-button, .lab-composer .secondary-button { min-width: 92px; }
.lab-composer .form-error { grid-column: 1 / -1; margin: 0; }
.empty-transcript { display: grid; place-content: center; min-height: 220px; padding: 32px; text-align: center; color: var(--muted); }
.empty-transcript h3 { margin: 0 0 7px; color: var(--ink); }
.empty-transcript p { max-width: 430px; margin: 0; line-height: 1.55; }
.lab-results { min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 14px; }
.metric-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-strip article, .score-grid article { padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-strip article:nth-child(2n), .score-grid article:nth-child(2n) { border-right: 0; }
.metric-strip article:nth-last-child(-n+2), .score-grid article:nth-last-child(-n+2) { border-bottom: 0; }
.metric-strip small, .score-grid small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; text-transform: capitalize; }
.metric-strip strong, .score-grid strong { font-family: Manrope, sans-serif; font-size: 15px; }
.scorecard { overflow: visible; padding: 20px; }
.score-hero { margin-bottom: 18px; }
.score-hero h2 { color: var(--plum); font-size: 29px; }
.hard-failure { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 800; }
.hard-failure.failed { color: var(--red); background: var(--red-soft); }
.score-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 -20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feedback-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 20px; }
.feedback-grid h3, .evidence-list h3 { margin-bottom: 8px; font-size: 12px; }
.feedback-grid ul { margin: 0; padding-left: 17px; color: #625a68; font-size: 10px; line-height: 1.55; }
.feedback-grid li { margin-bottom: 6px; }
.evidence-list { margin-top: 18px; }
.evidence-list p { padding: 8px 10px; border-radius: 8px; color: #675f6d; background: #f7f4f9; font-size: 10px; line-height: 1.5; }
.pending-score { padding: 35px 24px; color: var(--muted); text-align: center; }
.pending-score h3 { margin-bottom: 6px; color: var(--ink); font-size: 14px; }
.pending-score p { margin: 0; font-size: 11px; line-height: 1.5; }
.spinner { width: 28px; height: 28px; margin: 0 auto 13px; border: 3px solid #e8dff0; border-top-color: var(--plum); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.prompt-snapshot { overflow: visible; }
.prompt-snapshot summary { padding: 14px 16px; color: var(--plum); font-size: 11px; font-weight: 800; cursor: pointer; }
.prompt-snapshot pre { max-height: 420px; overflow: auto; margin: 0; padding: 16px; border-top: 1px solid var(--line); color: #4c4551; background: #faf8fb; font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }

/* Admin manual chats */
.new-chat-setup { padding: 25px; overflow: visible; }
.new-chat-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.new-chat-filters label { margin-top: 0; }
.selected-persona-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin: 20px 0 16px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(135deg, #fbf9fd, #fff); }
.selected-persona-summary h2 { margin: 11px 0 5px; font-size: 20px; }
.selected-persona-summary p { margin: 0; color: var(--muted); font-size: 12px; }
.selected-persona-summary dl { display: grid; grid-template-columns: repeat(3, minmax(82px, 1fr)); gap: 18px; margin: 0; }
.selected-persona-summary dt { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.selected-persona-summary dd { margin: 5px 0 0; font-size: 11px; font-weight: 700; white-space: nowrap; }
.new-chat-prompt { border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.new-chat-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; }
.new-chat-actions p { margin: 0; color: var(--muted); font-size: 11px; }
.new-chat-actions .primary-button { min-width: 150px; padding-inline: 24px; }
.page-link-button { min-width: 142px; padding-inline: 18px; text-decoration: none; }
.admin-chat-list { display: grid; }
.admin-chat-row { width: 100%; display: grid; grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.3fr) minmax(160px, .45fr); align-items: center; gap: 22px; padding: 17px 20px; border: 0; border-bottom: 1px solid var(--line); color: inherit; background: #fff; text-align: left; cursor: pointer; }
.admin-chat-row:last-child { border-bottom: 0; }
.admin-chat-row:hover { background: #fbf9fd; }
.admin-chat-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.admin-chat-identity > span:last-child, .admin-chat-preview { min-width: 0; }
.admin-chat-identity strong, .admin-chat-identity small, .admin-chat-preview strong, .admin-chat-preview small, .admin-chat-activity time, .admin-chat-activity small { display: block; }
.admin-chat-identity strong { overflow: hidden; margin-bottom: 3px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.admin-chat-identity small, .admin-chat-preview small, .admin-chat-activity small { color: var(--muted); font-size: 10px; }
.admin-chat-preview strong { overflow: hidden; margin-bottom: 5px; color: #514a57; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.admin-chat-activity { text-align: right; }
.admin-chat-activity time { margin-bottom: 5px; color: #6f6878; font-size: 10px; }
.fixed-chat-label { display: inline-flex; margin-right: 6px; padding: 3px 7px; border-radius: 999px; color: #5c3989; background: #eee6f8; font-size: 10px; font-weight: 700; }

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 74px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .sidebar-brand { justify-content: center; padding-inline: 0; }
  .sidebar-brand > span:last-child, .nav-item > span:last-child, .admin-chip > span:last-child, .logout-button { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .admin-chip { justify-content: center; }
  .page-content { padding-inline: 24px; }
  .chat-shell { grid-template-columns: 290px minmax(0, 1fr); }
  .version-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-launch { grid-template-columns: 1fr; }
  .lab-run-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .admin-chat-row { grid-template-columns: minmax(210px, .8fr) minmax(230px, 1fr) minmax(140px, .45fr); }
}

@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 20; left: 0; transform: translateX(-100%); width: 238px; transition: transform .2s; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 50px rgba(20,12,29,.28); }
  .sidebar-brand { justify-content: flex-start; }
  .sidebar-brand > span:last-child, .nav-item > span:last-child, .admin-chip > span:last-child, .logout-button { display: initial; }
  .nav-item { justify-content: flex-start; padding: 0 14px; }
  .admin-chip { justify-content: flex-start; }
  .logout-button { display: block; }
  .mobile-only { display: inline-grid; place-items: center; }
  .topbar { padding: 0 18px; }
  .topbar > div { margin-right: auto; margin-left: 10px; }
  .page-content { padding: 25px 16px 36px; }
  .page-heading { margin-bottom: 20px; }
  .page-heading h1 { font-size: 24px; }
  .stats-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
  .stat-card small { margin: 0; }
  .stat-card strong { font-size: 22px; }
  .table-toolbar { grid-template-columns: 1fr; }
  th, td { padding-inline: 13px; }
  .chat-shell { height: auto; min-height: calc(100vh - 170px); grid-template-columns: 1fr; }
  .chat-list-panel { border-right: 0; }
  .chat-list { max-height: calc(100vh - 250px); }
  .conversation { min-height: calc(100vh - 190px); }
  .chat-page .conversation { min-height: 0; }
  .chat-shell.has-selection .chat-list-panel { display: none; }
  .chat-shell:not(.has-selection) .conversation { display: none; }
  .mobile-chat-back { display: inline-grid; }
  .messages { min-height: 420px; padding-inline: 15px; }
  .chat-page .messages { min-height: 0; }
  .message-stack { max-width: 84%; }
  .heading-actions { width: 100%; }
  .page-heading { flex-wrap: wrap; }
  .form-grid.two, .form-grid.three, .lab-launch-controls, .version-grid, .lab-run-layout { grid-template-columns: 1fr; }
  .lab-launch { padding: 20px; }
  .launch-actions { justify-content: stretch; }
  .launch-actions button { min-width: 0; flex: 1; }
  .page-content.lab-run-page { height: auto; overflow: visible; }
  .lab-run-heading { flex-wrap: wrap; }
  .section-heading { flex-direction: column; }
  .run-filter-controls { width: 100%; align-items: stretch; }
  .run-filter-controls label, .run-filter-controls label:last-child { width: 100%; min-width: 0; }
  .lab-run-layout { display: block; }
  .lab-transcript { min-height: 650px; margin-bottom: 14px; }
  .lab-results { overflow: visible; }
  .lab-message { max-width: 92%; }
  .new-chat-filters { grid-template-columns: 1fr; }
  .selected-persona-summary { display: block; }
  .selected-persona-summary dl { margin-top: 18px; }
  .admin-chat-row { grid-template-columns: 1fr; gap: 10px; }
  .admin-chat-activity { text-align: left; }
}

@media (max-width: 480px) {
  .login-card { padding: 36px 24px 28px; border-radius: 19px; }
  .login-card h1 { font-size: 28px; }
  .table-toolbar { padding: 14px; }
  .pagination { align-items: flex-start; gap: 12px; }
}

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