/* ═══════════════════════════════════════════════════
   ROOT & TOKENS (Exact Sysrevai Design System)
═══════════════════════════════════════════════════ */
:root {
  --bg:            #f6f8fa;
  --card:          #ffffff;
  --ink:           #1a2332;
  --muted:         #5a6a7e;
  --accent:        #0f6b6b;
  --accent-hover:  #0b5555;
  --accent-light:  #e3f2f2;
  --accent-border: #99f6e4;
  --warn:          #b45309;
  --warn-bg:       #fef3c7;
  --good:          #15803d;
  --good-bg:       #ecfdf5;
  --good-border:   #86efac;
  --danger:        #dc2626;
  --danger-bg:     #fef2f2;
  --danger-border: #fecaca;
  --border:        #d8dee6;
  --border-subtle: #edf0f4;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.05);
  --shadow-md:     0 4px 14px rgba(15,107,107,.08);

  /* Compatibility aliases */
  --primary:        #0f6b6b;
  --primary-hover:  #0b5555;
  --primary-light:  #e3f2f2;
  --secondary:      #0f6b6b;
  --secondary-hover:#0b5555;
  --secondary-light:#e3f2f2;
  --text-primary:   #1a2332;
  --text-secondary: #334155;
  --text-muted:     #5a6a7e;
  --border-color:   #d8dee6;
  --bg-app:         #f6f8fa;
  --bg-card:        #ffffff;
  --bg-subtle:      #f8fafb;
}

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

html {
  scroll-behavior: smooth;
}

body {
  /* Font: Arial strictly as mandated by Section 2 */
  font-family: Arial, 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════════
   HEADER — Exact Sysrevai Colors, Photo Size & Style
═══════════════════════════════════════════════════ */
.hdr {
  background: linear-gradient(135deg, #0f6b6b, #0a4a4a);
  color: #fff;
  padding: 20px 20px;
  box-shadow: 0 2px 10px rgba(10, 74, 74, 0.15);
}

.hdr-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1140px;
  margin: 0 auto;
  gap: 20px;
}

.hdr-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.hdr-center {
  flex: 1;
  text-align: center;
}

.hdr-center h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.hdr-center p {
  opacity: .92;
  font-size: .90rem;
  margin-top: 3px;
  font-style: italic;
}

.hdr-right {
  flex-shrink: 0;
}

.title-main {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #fff;
  display: flex;
  align-items: center;
}

.version-badge {
  display: inline-block;
  background: rgba(255,255,255,.20);
  border: 1px solid rgba(255,255,255,.40);
  color: #fff;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  margin-left: 8px;
  vertical-align: middle;
}

.author-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .95rem;
  font-weight: 500;
  color: rgba(255,255,255,.95);
  font-style: italic;
  white-space: nowrap;
}

.author-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.5);
}

/* ═══════════════════════════════════════════════════
   MAIN LAYOUT CONTAINER (.solo matching Sysrevai)
═══════════════════════════════════════════════════ */
.solo {
  max-width: 1080px;
  margin: 24px auto;
  padding: 0 16px;
  width: 100%;
  flex: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════
   PIPELINE STEPPER (Strict Single-Line Sysrevai Style)
═══════════════════════════════════════════════════ */
.pipeline-stepper {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch;
  gap: 0;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #f8fafb;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.pipeline-step-item {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 10px;
  border-right: 1px solid var(--border);
  background: #f8fafb;
  transition: all .2s;
  box-sizing: border-box;
}

.pipeline-step-item:last-child {
  border-right: none;
}

.pipeline-step-item.active {
  background: var(--accent-light);
}

.pipeline-step-item.done {
  background: var(--good-bg);
}

.pipeline-step-tag {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 3px;
  white-space: nowrap;
}

.pipeline-step-tag.active { color: var(--accent); }
.pipeline-step-tag.done   { color: var(--good); }
.pipeline-step-tag.muted  { color: var(--muted); }

.pipeline-step-title {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.pipeline-step-item:not(.active):not(.done) .pipeline-step-title {
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════
   PILLS, TYPOGRAPHY & FORMS
═══════════════════════════════════════════════════ */
.pill {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 12px;
}

.pill-good   { color: var(--good); background: var(--good-bg); }
.pill-warn   { color: var(--warn); background: var(--warn-bg); }
.pill-danger { color: var(--danger); background: var(--danger-bg); }

.sec-h {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 18px 0 8px;
  color: var(--ink);
}

.hint {
  color: var(--muted);
  font-size: .88rem;
  margin-bottom: 14px;
  line-height: 1.5;
}

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 11px 14px;
  font-size: .95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  line-height: 1.5;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}

textarea:focus, input:focus, select:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(15,107,107,.15);
}

/* ═══════════════════════════════════════════════════
   BUTTONS (Sysrevai Theme)
═══════════════════════════════════════════════════ */
button.primary, .btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  font-size: .96rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, transform .1s;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(15,107,107,.2);
}

button.primary:hover, .btn-primary:hover {
  background: var(--accent-hover);
}

button.primary:disabled, .btn-primary:disabled {
  opacity: .55;
  cursor: not-allowed;
}

button.secondary, .btn-secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .15s;
  font-family: inherit;
}

button.secondary:hover, .btn-secondary:hover {
  background: var(--accent-light);
}

.mini-btn {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: .80rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
  font-family: inherit;
}

.mini-btn:hover {
  background: var(--accent-light);
}

.mini-btn-danger {
  color: var(--danger);
  border-color: #fca5a5;
  background: #fff;
}

.mini-btn-danger:hover {
  background: #fee2e2;
}

.mini-btn-good {
  color: var(--good);
  border-color: #86efac;
  background: #fff;
}

.mini-btn-good:hover {
  background: #ecfdf5;
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.chip {
  border: 1px solid var(--border);
  color: var(--ink);
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: .82rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
  font-family: inherit;
}

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

/* ═══════════════════════════════════════════════════
   INPUTS GRID & FORM ITEMS
═══════════════════════════════════════════════════ */
.form-group-full {
  margin-bottom: 14px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.label-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.required {
  color: var(--danger);
  font-weight: 700;
}

.search-input-wrapper {
  display: flex;
  position: relative;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  font-size: 18px;
  pointer-events: none;
}

#topic-input {
  flex: 1;
  padding: 14px 16px 14px 48px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.mandatory-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-bottom: 20px;
}

.grid-span-2 {
  grid-column: span 2;
}

.form-item-full {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.visual-style-btn-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 6px;
}

@media (max-width: 900px) {
  .visual-style-btn-group {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .visual-style-btn-group {
    grid-template-columns: 1fr;
  }
}

.visual-style-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  font-family: inherit;
}

.visual-style-btn:hover {
  border-color: var(--accent);
  background: #f7fafc;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(15,107,107,0.1);
}

.visual-style-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent), 0 3px 8px rgba(15,107,107,0.15);
}

.visual-style-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.visual-style-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.visual-style-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.visual-style-btn.active .visual-style-title {
  color: var(--accent);
}

.visual-style-desc {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

.form-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.form-submit-row, .step-nav-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

/* ═══════════════════════════════════════════════════
   STEP 2 & 3: KEYWORDS & STRATEGY
═══════════════════════════════════════════════════ */
.keyword-editor-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.kw-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.strategy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 16px;
}

.strategy-card {
  background: #fdfefe;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strategy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.strategy-query-box {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 12px;
  background: #ffffff;
  line-height: 1.45;
  color: var(--ink);
}

.strategy-filters {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.filters-tag {
  color: var(--accent);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════
   STEP 4: RETRIEVAL PROGRESS & ALERTS
═══════════════════════════════════════════════════ */
.processing-indicator-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 20px;
}

.processing-text-primary {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.prog-bar-bg {
  width: 100%;
  max-width: 480px;
  height: 8px;
  background: var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.prog-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .4s ease;
}

.alert-box {
  border-radius: 8px;
  padding: 14px 18px;
  margin: 12px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.alert-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 5px solid #f59e0b;
  color: #92400e;
}

.alert-title {
  font-size: .95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-reason {
  font-size: .86rem;
  line-height: 1.45;
}

.disclaimer-callout {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 0.84rem;
  color: #92400e;
  line-height: 1.55;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.metric-card {
  background: #fdfefe;
  padding: 14px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--border);
}

.metric-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}

.metric-val.text-teal { color: var(--accent); }
.metric-val.text-blue { color: #0284c7; }
.metric-val.text-purple { color: #7c3aed; }

.metric-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════
   STEP 6: PAPER REVIEW CARDS (Sysrevai Theme)
═══════════════════════════════════════════════════ */
.section-header-split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  background: #f8fafb;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.papers-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.paper-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 14px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paper-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.paper-card.is-essential {
  border-left: 5px solid #d97706;
  background: #fffdf5;
}

.paper-card.is-background {
  border-left: 5px solid #0284c7;
  background: #f8fafc;
}

.paper-card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.paper-badges-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: .75rem;
  font-weight: 700;
}

/* Source Badges */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: .72rem;
  font-weight: 700;
}

.source-epmc, .badge-pmc {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.source-s2, .badge-s2 {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.source-openalex, .badge-openalex {
  background: #fdf2f8;
  color: #9d174d;
  border: 1px solid #fbcfe8;
}

.source-crossref, .badge-crossref {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.source-both, .badge-both {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-relevance {
  background: var(--good-bg);
  color: var(--good);
  border: 1px solid var(--good-border);
}

.badge-essential {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-background {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.paper-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.4;
}

.paper-authors-journal {
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.45;
}

.paper-identifiers {
  font-size: 11px;
  color: var(--muted);
}

.paper-snippet {
  font-size: .88rem;
  color: var(--ink);
  line-height: 1.6;
  background: #f8fafb;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.paper-note-box {
  background: #fdfefe;
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  font-size: 12px;
  font-style: italic;
  color: var(--ink);
}

.paper-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 10px;
}

.paper-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-chip {
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.15s;
}

.btn-chip:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-chip.btn-chip-danger {
  color: var(--danger);
  border-color: #fca5a5;
}

.btn-chip.btn-chip-danger:hover {
  background: #fee2e2;
}

.btn-chip.active-gold {
  background: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
}

.btn-chip.active-blue {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #38bdf8;
}

.paper-links-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.paper-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════
   PROMPT 10: CONCISE EVIDENCE-BASED SYNTHESIS PLAN & GAPS
═══════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════
   PROMPT 13: PRE-EXPORT VALIDATION GATE
═══════════════════════════════════════════════════ */
.validation-gate-card {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.validation-checklist-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 900px) {
  .validation-checklist-grid {
    grid-template-columns: 1fr;
  }
}

.validation-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f8fafb;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}

.validation-item.passed {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.validation-item.failed {
  border-color: #fecaca;
  background: #fef2f2;
}

.val-item-icon {
  font-size: 14px;
  line-height: 1;
  margin-top: 1px;
}

.validation-item.passed .val-item-icon {
  color: #15803d;
}

.validation-item.failed .val-item-icon {
  color: #b91c1c;
}

.val-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.val-item-title {
  font-weight: 700;
  color: var(--ink);
}

.val-item-detail {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.synthesis-plan-card {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.plan-header-row, .gaps-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.plan-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

.plan-scope-text {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 18px;
}

.synthesis-themes-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.theme-card {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.theme-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-title-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.theme-scope-text {
  font-size: 12px;
  color: var(--muted);
}

.theme-columns-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 768px) {
  .theme-columns-split {
    grid-template-columns: 1fr;
  }
}

.theme-box {
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
}

.theme-box-established {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.theme-box-unresolved {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}

.theme-box-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.theme-box-established .theme-box-label {
  color: #166534;
}

.theme-box-unresolved .theme-box-label {
  color: #92400e;
}

.gaps-card, .outline-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 20px;
}

.gaps-title, .outline-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.gaps-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.gaps-list {
  padding-left: 20px;
  font-size: 13px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.outline-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.outline-chip {
  background: #f8fafb;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--ink);
}

/* ═══════════════════════════════════════════════════
   STEP 8: SLIDE DECK (16:9 Presentation Specification)
═══════════════════════════════════════════════════ */
.slide-nav-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 14px;
  margin-bottom: 16px;
}

.slide-nav-tab {
  padding: 6px 14px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--muted);
  transition: all 0.15s;
}

.slide-nav-tab:hover, .slide-nav-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.slides-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.slide-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.slide-header {
  background: linear-gradient(135deg, #0f6b6b, #0a4a4a);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slide-header-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.slide-header-num {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #99f6e4;
  margin-bottom: 2px;
}

.slide-category-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.slide-body {
  padding: 22px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.slide-field-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slide-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.slide-field-val {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}

/* 5. On-Slide Text (Single coherent text box) */
.slide-onslide-textbox {
  background: #fdfefe;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 14px 16px;
}

.slide-onslide-content {
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-line;
  color: var(--ink);
}

/* 6 & 7 Visual suggestion */
.slide-visual-box {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 13px;
  color: #0f766e;
}

/* 8. Speaker notes */
.slide-speaker-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 14px 16px;
}

.slide-speaker-script {
  font-size: 13px;
  color: #1e3a8a;
  line-height: 1.6;
}

/* 9. Interactive question */
.slide-question-box {
  background: #fffbeb;
  border-left: 4px solid var(--warn);
  padding: 10px 14px;
  font-size: 13px;
  color: #92400e;
  border-radius: 0 6px 6px 0;
}

/* 10. Transition */
.slide-transition-box {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  padding: 6px 0;
}

/* Slide Copyright Footer (Mandatory Rule) */
.slide-footer-copyright-row {
  border-top: 1px solid var(--border-subtle);
  padding: 8px 16px;
  background: #ffffff;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.slide-copyright-text {
  font-family: Arial, sans-serif;
  font-size: 9pt;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════
   MODAL & TOAST
═══════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: #ffffff;
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
}

.modal-body {
  padding: 20px 24px;
  font-size: 13px;
  line-height: 1.6;
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

.modal-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.modal-abstract-text {
  color: var(--ink);
  white-space: pre-line;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafb;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0a4a4a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  font-size: 13px;
  font-weight: 500;
  z-index: 2000;
  animation: slideUp 0.3s ease;
}

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

/* ═══════════════════════════════════════════════════
   FOOTER (Exact Sysrevai Style)
═══════════════════════════════════════════════════ */
footer {
  background: #0a4a4a;
  color: rgba(255,255,255,.8);
  font-size: .82rem;
  text-align: center;
  padding: 18px 20px;
  line-height: 1.6;
  margin-top: auto;
}

footer a {
  color: #fff;
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE DESIGN (< 640px)
═══════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .hdr { padding: 14px; }
  .hdr-inner { flex-direction: column; align-items: stretch; gap: 8px; }
  .hdr-left { width: 100%; justify-content: space-between; }
  .hdr-center { text-align: center; margin: 4px 0; }
  .hdr-center h1 { font-size: 1.1rem; }
  .hdr-right { width: 100%; display: flex; justify-content: center; }

  .pipeline-stepper {
    flex-direction: row !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .pipeline-step-item {
    border-right: 1px solid var(--border) !important;
    border-bottom: none !important;
    flex: 0 0 auto;
    min-width: 105px;
    max-width: 135px;
    padding: 6px 8px;
  }

  .pipeline-step-tag {
    font-size: .60rem;
    letter-spacing: .02em;
  }

  .pipeline-step-title {
    font-size: .70rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pipeline-step-item:last-child {
    border-right: none !important;
  }

  .mandatory-inputs-grid {
    grid-template-columns: 1fr;
  }

  .grid-span-2 {
    grid-column: span 1;
  }

  .strategy-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════
   INLINE NOTE EDITOR & LINK POLISH (BUG-5 & POLISH-8)
═══════════════════════════════════════════════════ */
.paper-link-fulltext {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #bfdbfe !important;
  font-weight: 600 !important;
}

.inline-note-editor {
  margin: 10px 0;
  padding: 12px;
  background: #f8fafc;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.2s ease-in-out;
}

.inline-note-input {
  width: 100%;
  min-height: 70px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}

.inline-note-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 107, 107, 0.15);
}


/* Study design badge (audit D-06) */
.badge-design { background: #f1f5f9; color: #334155; font-weight: 600; }
/* Relevance score bands (audit D-05) */
.badge-relevance.rel-high { background: #dcfce7; color: #166534; }
.badge-relevance.rel-mid { background: #fef9c3; color: #854d0e; }
.badge-relevance.rel-low { background: #fee2e2; color: #991b1b; }
.badge-offtopic { background: #fee2e2; color: #991b1b; font-weight: 600; }

/* =====================================================================
   Audit Step 9 — readability, accessibility and new UI elements
   ===================================================================== */
/* Minimum text sizes (audit typography: 10.9–11.5 px helper text was too small) */
.input-hint { font-size: 12.5px; line-height: 1.45; }
.pipeline-step-tag { font-size: 0.75rem; }
.pipeline-step-title { font-size: 0.82rem; }
.visual-style-desc { font-size: 0.8rem; line-height: 1.4; }

/* Inline field errors */
.field-error { color: #b91c1c; font-size: 13px; font-weight: 600; margin-top: 4px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: #b91c1c !important; box-shadow: 0 0 0 3px rgba(185, 28, 28, .15); }

/* Session restore and undo bars */
.session-restore-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; padding: 12px 16px; border-radius: 10px; }
.session-restore-bar span { flex: 1 1 260px; font-weight: 600; }
.undo-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000; display: flex; gap: 12px; align-items: center; background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px); font-size: 14px; }
.undo-bar button { min-height: 32px; padding: 4px 14px; }

/* Slide cards: plain labels, collapsible details, edit */
.slide-header-actions { display: flex; align-items: center; gap: 8px; }
.slide-header-actions .btn-edit-slide { min-height: 32px; padding: 4px 14px; font-size: 13px; }
.slide-field-label { font-size: 12.5px; letter-spacing: .02em; text-transform: none; }
.slide-evidence-line { font-size: 13px; font-weight: 600; color: var(--accent); background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 6px; padding: 6px 12px; margin-top: 4px; }
.slide-details { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.slide-details > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); padding: 4px 0; }
.slide-details[open] > summary { margin-bottom: 8px; }
.slide-editor { display: grid; gap: 10px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.slide-editor label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.slide-editor-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Mobile: compact header, readable stepper with a scroll cue */
@media (max-width: 640px) {
  .hdr { padding: 10px 14px; }
  .hdr-center p, .hdr-right { display: none; }
  .hdr-center h1 { font-size: 1rem; }
  .pipeline-stepper { position: relative; scroll-snap-type: x proximity; mask-image: linear-gradient(to right, #000 85%, transparent); -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); }
  .pipeline-step-item { scroll-snap-align: start; min-width: 120px; max-width: 150px; }
  .pipeline-step-tag { font-size: .7rem; }
  .pipeline-step-title { font-size: .78rem; }
}

/* Visible focus for all interactive elements */
button:focus-visible, a:focus-visible, summary:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}
.slide-main-message { font-weight: 700; color: var(--primary, #0f6b6b); font-size: 15px; }
