:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f6f8;
  color: #15181e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

header {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d9dee7;
  display: flex;
  justify-content: space-between;
  padding: 18px 28px;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
}

p {
  margin: 0;
}

header p {
  color: #667085;
  font-size: 14px;
  margin-top: 4px;
}

button {
  background: #1f6feb;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 650;
  min-height: 38px;
  padding: 0 14px;
}

button.secondary {
  background: #eef2f7;
  color: #1d2939;
}

button.danger {
  background: #b42318;
}

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 24px;
}

.stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 22px;
}

.stat,
.item {
  background: #ffffff;
  border: 1px solid #d9dee7;
  border-radius: 8px;
}

.stat {
  padding: 14px;
}

.stat strong {
  display: block;
  font-size: 24px;
  margin-bottom: 4px;
}

.stat span {
  color: #667085;
  font-size: 13px;
}

.queue {
  display: grid;
  gap: 14px;
}

.item {
  padding: 18px;
}

.item-header {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.item h2 {
  font-size: 18px;
  margin: 0 0 8px;
}

.meta {
  color: #667085;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
}

.badge {
  background: #eef2f7;
  border-radius: 999px;
  color: #344054;
  padding: 3px 9px;
}

.script {
  background: #f8fafc;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  line-height: 1.5;
  margin: 14px 0;
  padding: 12px;
  white-space: pre-wrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty,
.error {
  background: #ffffff;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  color: #667085;
  padding: 24px;
}

.error {
  border-color: #fecdca;
  color: #b42318;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.tab {
  background: #eef2f7;
  color: #1d2939;
  font-weight: 600;
}

.tab.active {
  background: #1f6feb;
  color: #ffffff;
}

.hidden {
  display: none;
}

.badge.flag {
  background: #fef3c7;
  color: #92400e;
}

.last-review {
  color: #667085;
  font-size: 13px;
  margin: 8px 0;
}

input.notes {
  border: 1px solid #d9dee7;
  border-radius: 6px;
  flex: 1 1 240px;
  font: inherit;
  min-height: 38px;
  padding: 0 10px;
}

.meta a {
  color: #1f6feb;
  text-decoration: none;
  word-break: break-all;
}

.muted {
  color: #667085;
}

.filters {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.filters label {
  color: #344054;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 4px;
}

.filters select {
  border: 1px solid #d9dee7;
  border-radius: 6px;
  font: inherit;
  min-height: 38px;
  padding: 0 10px;
}

.claims-list {
  margin: 10px 0;
  padding-left: 0;
  list-style: none;
}

.claims-list li {
  border-left: 2px solid #d9dee7;
  margin-bottom: 6px;
  padding: 4px 0 4px 10px;
  font-size: 14px;
}

.claim-risk {
  font-size: 12px;
  margin-right: 6px;
}

.badge.risk-1 { background: #ecfdf3; color: #027a48; }
.badge.risk-2 { background: #eef4ff; color: #175cd3; }
.badge.risk-3 { background: #fef0c7; color: #92400e; }
.badge.risk-4 { background: #fef3c7; color: #b54708; }
.badge.risk-5 { background: #fee4e2; color: #b42318; }

/* ============================================================================
   Research Review Tab v2 — production-grade queue UI (2026-06-19)
   ========================================================================= */

#research-filters {
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}
#research-filters .flag-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #344054;
}
#research-filters .filter-summary {
  flex: 1 1 100%;
  font-size: 12px;
  color: #475467;
  margin-top: 4px;
  line-height: 1.6;
}
#research-filters .res-stat {
  white-space: nowrap;
  padding: 1px 0;
}
#research-filters .res-stat b {
  color: #101828;
  font-weight: 700;
}

/* --- card layout --- */
.research-card.item {
  border-left: 4px solid transparent;
  transition: border-left-color 120ms ease;
}
.research-card.rel-urgent { border-left-color: #b42318; }
.research-card.rel-high   { border-left-color: #d97706; }
.research-card.rel-mid    { border-left-color: #155eef; }
.research-card.rel-low    { border-left-color: #98a2b3; }
.research-card.rel-unknown{ border-left-color: #d0d5dd; }
.research-card.selected   { background: #f0f7ff; box-shadow: 0 0 0 2px #b9ddff inset; }

.research-card .item-header { display: flex; gap: 12px; }
.research-card .card-checkbox { padding-top: 4px; }
.research-card .card-main { display: flex; gap: 12px; flex: 1; min-width: 0; }
.research-card .card-title-block { flex: 1; min-width: 0; }
.research-card .card-title-block h2 { margin: 0; font-size: 16px; line-height: 1.35; word-break: break-word; }

.rel-pill {
  align-self: flex-start;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 14px;
  min-width: 56px;
  text-align: center;
}
.rel-pill.rel-urgent { background: #fef3f2; color: #b42318; }
.rel-pill.rel-high   { background: #fef6ee; color: #b54708; }
.rel-pill.rel-mid    { background: #eff4ff; color: #1849a9; }
.rel-pill.rel-low    { background: #f2f4f7; color: #475467; }
.rel-pill.rel-unknown{ background: #f2f4f7; color: #98a2b3; }

.research-card .src-url a {
  color: #1849a9;
  word-break: break-all;
  font-size: 12px;
}
.research-card .expand-toggle {
  background: transparent;
  border: 1px solid #d0d5dd;
  color: #344054;
  font-weight: 600;
  font-size: 12px;
  padding: 4px 10px;
  height: auto;
  min-height: 28px;
  align-self: flex-start;
  white-space: nowrap;
}

/* --- badges --- */
.badge.ignore   { background: #f2f4f7; color: #667085; }
.badge.alerts   { background: #fef3f2; color: #b42318; font-weight: 700; }
.badge.policy   { background: #f0f7ff; color: #1849a9; font-weight: 700; }
.badge.hi-risk  { background: #fef0c7; color: #93370d; font-weight: 700; }
.badge.tag      { background: #f0f9ff; color: #026aa2; }
.badge.flag     { background: #fff8e1; color: #b54708; }

.badge.risk-5 { background: #fee4e2; color: #912018; font-weight: 800; }
.badge.risk-4 { background: #fef0c7; color: #93370d; font-weight: 700; }
.badge.risk-3 { background: #fff8e1; color: #b54708; font-weight: 600; }
.badge.risk-2 { background: #f0f9ff; color: #026aa2; }
.badge.risk-1 { background: #f2f4f7; color: #475467; }

.badge.claim-fee                { background: #fee4e2; color: #912018; }
.badge.claim-deadline           { background: #fee4e2; color: #912018; }
.badge.claim-eligibility        { background: #fef0c7; color: #93370d; }
.badge.claim-filing_instruction { background: #fef0c7; color: #93370d; }
.badge.claim-form_rule          { background: #f0f9ff; color: #026aa2; }
.badge.claim-processing         { background: #f0f9ff; color: #026aa2; }
.badge.claim-news               { background: #ecfdf3; color: #027a48; }
.badge.claim-general            { background: #f2f4f7; color: #475467; }

/* --- expanded panel --- */
.research-card .expanded {
  border-top: 1px solid #e4e7ec;
  margin-top: 10px;
  padding-top: 10px;
  display: grid;
  gap: 14px;
}
.note-group { background: #f9fafb; border-radius: 6px; padding: 8px 12px; }
.note-group ul { margin: 4px 0 0; padding-left: 20px; }
.note-group li { font-size: 13px; line-height: 1.45; margin: 2px 0; }
.note-group-label { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.note-fact .note-group-label   { color: #027a48; }
.note-review .note-group-label { color: #b54708; }
.note-ignore .note-group-label { color: #98a2b3; }
.note-ignore li { color: #667085; }

.components { background: #fdfdfd; border: 1px solid #e4e7ec; border-radius: 6px; padding: 8px 12px; }
.components-label { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: #344054; }
.components table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 13px; }
.components td { padding: 3px 6px; vertical-align: top; }
.components td.num { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; width: 60px; }

.claims-block { background: #fdfdfd; border: 1px solid #e4e7ec; border-radius: 6px; padding: 8px 12px; }
.claims-table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 13px; }
.claims-table th { text-align: left; font-weight: 700; font-size: 11px; text-transform: uppercase; color: #475467; padding: 4px 6px; border-bottom: 1px solid #e4e7ec; }
.claims-table td { padding: 6px; vertical-align: top; line-height: 1.4; }
.claims-table td.off { font-size: 12px; color: #b42318; white-space: nowrap; width: 70px; }

/* --- bulk action bar (sticky bottom) --- */
.bulk-bar {
  position: sticky;
  bottom: 0;
  margin-top: 18px;
  background: #15181e;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
}
.bulk-bar #bulk-count { font-weight: 700; margin-right: auto; }
.bulk-bar button { background: #1f6feb; }
.bulk-bar button.secondary { background: #344054; color: #ffffff; }
.bulk-bar button.danger    { background: #b42318; }
.bulk-bar button.ghost     { background: transparent; color: #d0d5dd; border: 1px solid #344054; }

.muted { color: #98a2b3; font-size: 12px; }
.status-extracted     { background: #f0f7ff; color: #1849a9; }
.status-needs_review  { background: #fef0c7; color: #93370d; }
.status-accepted      { background: #ecfdf3; color: #027a48; }
.status-rejected      { background: #fee4e2; color: #912018; }
.status-triaged       { background: #f4ebff; color: #6941c6; }

/* --- Pipeline mode pill + mode-aware header --- */
.header-actions { display: flex; gap: 10px; align-items: center; }
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1849a9;
  color: #ffffff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.25);
  min-height: 32px;
}
.mode-pill .mode-label { opacity: 0.7; font-weight: 600; }
.mode-pill[data-mode="image_generation"] {
  background: #b54708;
}
#app-header[data-mode="data_extraction"]  { border-bottom-color: #1849a9; box-shadow: 0 4px 0 -3px #1849a9; }
#app-header[data-mode="image_generation"] { border-bottom-color: #b54708; box-shadow: 0 4px 0 -3px #b54708; background: linear-gradient(to bottom, #fff7ed 0%, #ffffff 60%); }
