/* Components: article cards, filters, date picker, journal select, settings, task sidebar, stats. */
.task-history-row + .task-history-row { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.task-history-row p { margin: 6px 0; }

/* Shared publication-date picker */
.date-range-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}
.sidebar-dates { grid-template-columns: minmax(0, 1fr); }
.date-trigger {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
  color: var(--ink-secondary);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.date-trigger:hover:not(:disabled) { border-color: var(--accent-border); background: var(--control-hover-bg); }
.date-trigger[aria-expanded="true"], .date-trigger:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.date-trigger:disabled { cursor: default; opacity: .65; }
.date-trigger-copy { display: grid; gap: 5px; min-width: 0; flex: 1; }
.date-trigger-label { font-size: var(--fs-xs); line-height: 1; color: var(--muted); font-weight: 500; }
.date-trigger-value { font-size: var(--fs-md); font-weight: 600; line-height: var(--lh-body); font-variant-numeric: tabular-nums; }
.date-calendar-icon {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1.5px solid var(--faint);
  border-radius: 4px;
}
.date-calendar-icon::before { content: ''; position: absolute; left: -1px; right: -1px; top: 4px; border-top: 1.5px solid var(--faint); }
.date-calendar-icon::after { content: ''; position: absolute; width: 6px; height: 4px; left: 3px; top: -3px; border-left: 1.5px solid var(--faint); border-right: 1.5px solid var(--faint); }
.date-chevron { width: 6px; height: 6px; flex: 0 0 6px; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(45deg); margin: 0 2px 4px; }
.date-range-hint { grid-column: 1 / -1; font-size: var(--fs-xs); line-height: var(--lh-body); color: var(--muted); padding: 0 2px; }
.date-popover {
  position: fixed;
  z-index: 2000;
  width: 320px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-popover);
  color: var(--ink);
}
.date-popover-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-size: var(--fs-md); font-weight: 600; }
.date-popover-close { background: transparent; border: 0; border-radius: 6px; width: 26px; height: 26px; color: var(--muted); cursor: pointer; font-size: var(--fs-2xl); line-height: 1; }
.date-popover-close:hover { background: var(--panel-subtle); color: var(--ink); }
.date-select-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.date-select-grid label { display: grid; gap: 7px; color: var(--muted); font-size: var(--fs-xs); min-width: 0; }
.date-select-grid select { width: 100%; min-width: 0; font: 600 var(--fs-md) var(--font-ui); color: var(--ink-secondary); border: 1px solid var(--border); border-radius: 8px; padding: 9px 6px; background: var(--bg); cursor: pointer; }
.date-select-grid select:focus-visible { outline: 2px solid var(--accent-border); border-color: var(--accent); }
.date-selection-preview { margin: 14px 0; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-md); text-align: center; border-radius: 8px; padding: 9px; font-weight: 500; font-variant-numeric: tabular-nums; }
.date-popover-actions { display: flex; justify-content: space-between; gap: 12px; }
.date-popover-actions .btn { min-width: 72px; }

/* Midbar - Facet Filter Row */
.midbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 2px;
  /* Follow the column's own width: detail and compare panes squeeze it regardless of the viewport. */
  container-type: inline-size;
}

/* Matched, compact facet controls with custom listboxes. */
.facet-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
}
.facet { min-width: 0; }
.facet-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  color: var(--ink-secondary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.facet-copy { display: grid; gap: 3px; min-width: 0; }
.facet-label { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; line-height: 1.3; }
.facet-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); font-weight: 600; line-height: var(--lh-body); }
.facet-chevron { flex: 0 0 6px; width: 6px; height: 6px; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(45deg); margin: 0 2px 4px 0; }
.facet-trigger:hover { border-color: var(--accent-border); background: var(--control-hover-bg); }
.facet-trigger:focus-visible, .facet-trigger[aria-expanded="true"] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.facet-trigger[aria-expanded="true"] .facet-chevron { transform: rotate(225deg); margin-top: 6px; }
.facet.has-value .facet-trigger { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent); }
.facet.has-value .facet-label { color: var(--accent); }
.facet-menu {
  position: fixed;
  z-index: 1900;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-menu);
}
.facet-menu-heading { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; padding: 7px 10px 9px; }
.facet-option { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 36px; padding: 8px 10px; border-radius: 7px; color: var(--ink-secondary); font-size: var(--fs-md); line-height: var(--lh-body); cursor: pointer; }
.facet-option.highlighted { background: var(--panel-subtle); }
.facet-option[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.facet-option[aria-selected="true"].highlighted { background: var(--accent-highlight); }
.facet-check { color: var(--accent); font-size: var(--fs-md); visibility: hidden; flex-shrink: 0; }
.facet-option[aria-selected="true"] .facet-check { visibility: visible; }
.reset-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all .15s ease;
}

.reset-all-btn:hover {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
}

/* List toolbar: hint and clear-filters stay left; sort and density sit right. */
#listToolbar .list-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#listToolbar #sortSelect {
  min-height: 28px;
  padding: 3px 8px;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--ink-secondary);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
}

#listToolbar #densitySwitch { padding: 2px; }
#listToolbar .seg-switch-btn { min-width: 0; padding: 4px 9px; }

/* Issue-month note: dates the publisher assigned to a future issue. */
.article .issue-date {
  font-size: var(--fs-xs);
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  cursor: help;
}

/* Compact density: tighter cards for scanning many entries at a glance. */
.article-list.compact { gap: 5px; }
.article-list.compact .article { padding: 7px 14px; }
.article-list.compact .article .title { font-size: var(--fs-md); }
.article-list.compact .article .meta { margin-top:4px; gap: 4px 10px; font-size: var(--fs-xs); }
.article-list.compact .article .classification-tag { font-size: var(--fs-xs); line-height: 18px; padding: 1px 7px; }

/* Keyboard navigation: cards are focusable and show a ring for arrow/Tab travel. */
.article:focus-visible {
  outline: 2px solid var(--accent-border);
  outline-offset: 2px;
}

/* Compare-pick banner shown above the list while choosing the second article. */
.compare-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 14px;
  border: 1px dashed var(--accent-border);
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-sm);
}

/* Detail title bar: the compare entry sits left of the article title. */
.pane-header { display: flex; align-items: flex-start; gap: 10px; }
.pane-header h2 { flex: 1; min-width: 0; }
.pane-compare {
  flex: none;
  margin-top: 1px;
  padding: 3px 12px;
  border: 1px solid var(--accent-border);
  border-radius: var(--r-full);
  background: var(--panel);
  color: var(--accent);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all .15s ease;
}
.pane-compare:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ==========================================================================
   Article Cards (~125% scaled)
   ========================================================================== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 0 6px;
}

.list-pager .pager-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--panel);
  color: var(--ink-secondary);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all .15s ease;
}

.list-pager .pager-btn:hover:not(:disabled) {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.list-pager .pager-btn:disabled { opacity: .45; cursor: default; }

.list-pager .pager-info { font-size: var(--fs-sm); color: var(--muted); }

.article {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 18px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
  position: relative;
}

.article:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.article.selected {
  border-color: var(--accent);
  background: var(--selected-bg);
  box-shadow: var(--shadow-md);
}

.article.selected::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}

.article .title {
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: var(--lh-title);
  color: var(--ink);
  letter-spacing: -0.15px;
}

.article .meta {
  display: flex;
  gap: 8px 12px;
  margin-top: 10px;
  font-size: var(--fs-sm);
  color: var(--muted);
  flex-wrap: wrap;
  align-items: center;
}

.article .journal-badge {
  font-weight: 500;
  font-size: var(--fs-xs);
  color: var(--muted);
  background: var(--badge-bg);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.article .pub-date {
  color: var(--muted);
  font-size: var(--fs-sm);
}


/* Card Hover Actions */
.article .actions {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.article .btn.analyze-one {
  opacity: 0;
  pointer-events: none;
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--panel);
  font-size: var(--fs-sm);
  padding: 3px 10px;
  transition: opacity .15s ease, background .15s ease;
}

.article:hover .btn.analyze-one {
  opacity: 1;
  pointer-events: auto;
}

.article .btn.analyze-one:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Empty State */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 90px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.empty .empty-icon {
  font-size: var(--fs-2xl);
  stroke-width: 1.4;
  color: var(--faint);
  margin-bottom: 4px;
}

.empty .empty-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--ink-secondary);
}

.empty .empty-sub {
  font-size: var(--fs-md);
  color: var(--muted);
  max-width: 360px;
  line-height: var(--lh-body);
  text-wrap: balance;
}

.pane .dmeta {
  font-size: var(--fs-md);
  color: var(--muted);
  line-height: var(--lh-body);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.pane .dmeta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.pane .authors {
  color: var(--ink-secondary);
  font-size: var(--fs-md);
}

.pane .link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.pane .link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--panel-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--accent);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all .15s ease;
}

.pane .link-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pane .doi-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--panel-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  user-select: text;
}

.pane .doi-copy-feedback {
  flex-basis: 100%;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.pane .doi-copy-feedback:empty {
  display: none;
}

.pane .doi-copy-feedback[data-state="error"] {
  color: var(--danger);
}

.pane .doi-chip:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

/* Structured AI Analysis Section */
.analysis-box {
  background: var(--panel-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
}

.analysis-box h4 {
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .5px;
  margin-bottom: 10px;
}

.chips {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.chip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-md);
}

.chip .chip-label {
  display: flex;
  flex-direction: column;
}

.chip .chip-label b {
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.chip .chip-label span {
  color: var(--ink);
  font-weight: 600;
  margin-top: 2px;
}

.chip .chip-prob {
  font-size: var(--fs-sm);
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2.5px 8px;
  border-radius: var(--r-full);
  font-weight: 600;
}

/* Scholarly Abstract View */
.abstract-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.abstract-container h4 {
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .5px;
}

.abstract {
  font-family: var(--font-serif);
  /* Body copy (正文) rides the md step per the usage table, not the value-band lg. */
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--ink-abstract);
  /* Justify opens wide gaps in narrow English panes without hyphenation. */
  text-align: left;
  background: var(--panel);
  padding: 14px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

/* ==========================================================================
   Settings Modal Overlay
   ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
  animation: fadeIn .15s ease;
}

.settings.wide-card {
  background: var(--panel);
  border-radius: var(--r-lg);
  max-width: 1200px;
  width: 100%;
  height: min(860px, 92vh);
  height: min(860px, 92dvh);
  max-height: calc(100dvh - 32px);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-header h2 { font-size: var(--fs-lg); font-weight: 700; }
.settings .hint { font-size: var(--fs-sm); line-height: var(--lh-body); color: var(--muted); font-weight: 400; }

.settings-close {
  flex-shrink: 0;
  border: 0;
  background: var(--panel-subtle);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--fs-xl);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
  z-index: 5;
}

.settings-close:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.settings-body {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

/* Settings Tabs Rail */
.settings-tabs {
  width: 168px;
  flex-shrink: 0;
  background: var(--panel-subtle);
  border-right: 1px solid var(--border);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stab {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all .15s ease;
}

.stab:hover {
  background: var(--panel);
  color: var(--ink);
}

.stab.active {
  background: var(--panel);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

/* Settings Panels Content */
.settings-panels {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  min-width: 0;
  min-height: 0;
  overscroll-behavior: contain;
}

.spanel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.spanel h3 {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--ink);
}

.spanel > .hint {
  font-size: var(--fs-md);
  color: var(--muted);
  line-height: var(--lh-body);
}

.settings-card {
  background: var(--panel-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.settings-card.task-card {
  background: var(--panel);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}

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

.task-actions .btn { min-height: 38px; flex: 1 1 150px; }
.task-card .stop-task, .task-card .resume-task { margin-top: 0; }
.task-card .resume-task { align-self: flex-start; width: auto; max-width: 100%; }
.backfill-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.backfill-row .btn { min-height: 38px; }
.field.field-compact { width: 180px; max-width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: end; }

.provider-list { display: flex; flex-direction: column; gap: 12px; }
.provider-row {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.provider-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.provider-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-md); font-weight: 600; color: var(--ink-secondary); cursor: pointer; user-select: none;
}
.provider-tools { display: flex; gap: 6px; }
.provider-tools .btn { padding: 3px 10px; font-size: var(--fs-sm); min-height: 26px; }
.provider-actions .btn { max-width: 180px; }

.settings-card-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
}

/* Collapsible card explanation: a quiet "ⓘ 说明" toggle on the title row;
   when open, the explanation drops to its own full-width line. */
.card-help { display: flex; flex-direction: column; align-items: flex-end; }
.card-help > summary {
  list-style: none; cursor: pointer; user-select: none; white-space: nowrap;
  font-size: var(--fs-sm); font-weight: 400; color: var(--muted);
  padding: 2px 6px; border-radius: var(--r-sm);
}
.card-help > summary::-webkit-details-marker { display: none; }
.card-help > summary:hover { color: var(--accent); }
.card-help > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.card-help[open] { flex-basis: 100%; }
.card-help[open] > summary { color: var(--accent); }
.card-help[open] > .hint { align-self: stretch; margin: 2px 0 0; }


.settings :is(button, input, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#cfgJournals, #cfgDailyJournals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

#cfgJournals label, #cfgDailyJournals label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  cursor: pointer;
  min-width: 0;
  overflow-wrap: anywhere;
}

#cfgJournals input, #cfgDailyJournals input { flex-shrink: 0; accent-color: var(--accent); }

/* Progress bar inside settings */
.abs-progress {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-md);
  flex-wrap: wrap;
  gap: 6px 12px;
}

/* The Chinese label carries its own full-width colon; the English one needs a space after it. */
:lang(en) .progress-header b { margin-right: 0.3em; }
.progress-percent { font-weight: 600; color: var(--accent); }

.progress-bar-bg {
  width: 100%;
  height: 7px;
  background: var(--panel-subtle);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width .3s ease;
}

/* Channel Test Grid */
.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.test-src-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all .15s ease;
}

.test-src-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.test-result {
  margin-top: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: var(--fs-md);
  line-height: var(--lh-body);
}

.tr-head.ok { color: var(--good); font-weight: 600; }
.tr-head.fail { color: var(--danger); font-weight: 600; }
.tr-meta { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }
.tr-abs { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; font-style: italic; }

/* Stats Tab */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  text-align: center;
  padding: 14px 8px;
  border-radius: var(--r-md);
  background: var(--panel-subtle);
  border: 1px solid var(--border);
}

.stat span {
  font-size: var(--fs-2xl);
  font-weight: 700;
  display: block;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.stat label {
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 500;
}

.stat.accent {
  background: var(--good-soft);
  border-color: var(--good-border);
}

.stat.accent span {
  color: var(--good);
}

.stats-table-wrap {
  min-width: 0;
  max-width: 100%;
  max-height: min(440px, 48dvh);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.stats-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-md);
  background: var(--panel);
  border-radius: var(--r-md);
  overflow: visible;
  border: 0;
}

.stats-table th {
  text-align: left;
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 600;
  padding: 10px 14px;
  background: var(--panel-subtle);
  border-bottom: 1px solid var(--border);
}

.stats-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-secondary);
}

.stats-table tr:last-child td {
  border-bottom: 0;
}

.stats-table td:nth-child(n+2),
.stats-table th:nth-child(n+2) {
  text-align: right;
}

/* Settings Modal Footer Bar */
.settings-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.settings-footer .save-feedback {
  font-size: var(--fs-md);
  color: var(--good);
  margin-right: auto;
  opacity: 0;
  transition: opacity .2s ease;
  min-width: 0;
  overflow-wrap: anywhere;
}

.settings-footer .save-feedback[data-state="error"] { color: var(--danger); }
.settings-footer .save-feedback[data-state="saving"] { color: var(--muted); }
.settings-footer .save-feedback[data-state="dirty"] { color: var(--warn); }
.settings-footer > button { flex-shrink: 0; }

.settings-footer .save-feedback.show {
  opacity: 1;
}

/* Unsaved-change markers (Task 15): warn dot on the owning tab, emphasis on the field. */
.stab.has-unsaved { position: relative; color: var(--warn); }
.stab.has-unsaved.active { color: var(--accent); }
.stab.has-unsaved::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 2px var(--panel-subtle);
}
/* Channel rows carry the bar on their collapsed <details>; plain inputs on their .field. */
.field-dirty { box-shadow: inset 3px 0 0 var(--warn); }
label.field.field-dirty > span:first-child,
details.channel-config.field-dirty > summary .channel-name { color: var(--warn); font-weight: 600; }
details.channel-config.field-dirty { border-color: var(--warn-border); }
input[type="checkbox"].field-dirty, input[type="time"].field-dirty {
  outline: 2px solid var(--warn);
  outline-offset: 1px;
  box-shadow: none;
}

/* Close-confirm bar: sits directly above the footer while unsaved edits block closing. */
.close-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 20px;
  border-top: 1px solid var(--warn-border);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--fs-md);
  font-weight: 600;
  flex-shrink: 0;
}
.close-confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* Inline guard under a task button: the run would use the saved config, so ask first. */
.unsaved-guard {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  border: 1px dashed var(--warn-border);
  border-radius: var(--r-md);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--fs-md);
  padding: 10px 12px;
}
.unsaved-guard-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.unsaved-guard .btn { min-height: 32px; }

/* Pending / Report Column */
.pending-col {
  width: clamp(300px, 27vw, 352px);
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--panel-subtle);
  min-height: 0;
  min-width: 0;
}

.pending-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  padding: 16px 18px;
  font-size: var(--fs-md);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.pending-count {
  font-size: var(--fs-sm);
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: var(--r-full);
  max-width: 100%;
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

.pending-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  min-height: 0;
  overscroll-behavior: contain;
}

.pending-item {
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.pending-list > .hint, .pending-list > .task-error { padding: 14px 4px; font-size: var(--fs-md); line-height: var(--lh-body); }

.pending-group { display: flex; flex-direction: column; }
.pending-group + .pending-group { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.pending-group .pending-head { padding: 2px 0 4px; background: transparent; }
.pending-group > .hint { padding: 2px 4px 8px; font-size: var(--fs-sm); }

.pending-item .pm {
  display: block;
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 3px;
}

.report-box {
  max-height: 40%;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  background: var(--panel);
}

.report-head {
  font-size: var(--fs-sm);
  font-weight: 700;
  padding: 4px 6px 8px;
  color: var(--ink);
}

.report-item {
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  padding: 5px 6px;
  border-bottom: 1px dashed var(--border);
}

.report-item.ok { color: var(--good); }
.report-item.fail { color: var(--danger); }
.report-item .via { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 1px; }

.daily-progress-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px; }
.daily-steps { list-style: none; margin: 0; padding: 0; }
.daily-step { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 10px; color: var(--muted); }
.daily-step + .daily-step { margin-top: 5px; }
.daily-step-number { display: flex; align-items: center; justify-content: center; flex: 0 0 25px; width: 25px; height: 25px; border-radius: 50%; background: var(--border); font-size: var(--fs-sm); font-weight: 700; }
.daily-step b { display: block; font-size: var(--fs-md); line-height: var(--lh-body); }
.daily-step div > span { display: block; font-size: var(--fs-xs); line-height: var(--lh-body); margin-top: 3px; }
.daily-step.running { background: var(--accent-soft); color: var(--accent); }
.daily-step.running .daily-step-number { background: var(--accent); color: var(--on-accent); }
.daily-step.complete .daily-step-number { background: var(--good-step); color: var(--good); }
.daily-step.complete b, .daily-step.paused b { color: var(--ink); }
.daily-live-message { padding: 10px; margin: 8px 0; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; font-size: var(--fs-sm); line-height: var(--lh-body); overflow-wrap: anywhere; }
.daily-run-counts { display: grid; gap: 5px; padding: 12px 10px; font-size: var(--fs-sm); color: var(--muted); line-height: var(--lh-body); }
.daily-run-counts b { color: var(--ink); }
.daily-results { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.daily-queue { margin-top: 8px; padding: 0 2px; }
.daily-view-row { margin: 10px -14px 0; }
.daily-queue .pending-group { padding: 2px 8px 6px; }
.daily-results .report-item { overflow-wrap: anywhere; }
.daily-results .hint, .daily-empty { padding: 10px; font-size: var(--fs-sm); line-height: var(--lh-body); }

@media (max-width: 1050px) {
  .settings-body { display: grid; grid-template-columns: 154px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .settings-tabs { width: auto; grid-column: 1; grid-row: 1 / 3; }
  .settings-panels { grid-column: 2; grid-row: 1; padding: 18px; }
  .pending-col { grid-column: 2; grid-row: 2; width: auto; height: min(190px, 27dvh); border-left: 0; border-top: 1px solid var(--border); }
  .pending-head { flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px 16px; }
  .pending-list { padding: 4px 12px; }
  .pending-item { padding: 7px 4px; }
  .daily-progress-body { padding: 10px 12px; }
  .daily-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .daily-step { flex-direction: column; gap: 4px; padding: 6px; }
  .daily-step + .daily-step { margin-top: 0; }
  .daily-step b { font-size: var(--fs-sm); }
}

@media (max-width: 700px) {
  .overlay { padding: 8px; }
  .settings.wide-card { height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .settings-header { padding: 10px 14px; gap: 8px; }
  .settings-body { display: flex; flex-direction: column; }
  .settings-tabs { flex-direction: row; padding: 8px; gap: 4px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .stab { width: auto; flex-shrink: 0; white-space: nowrap; padding: 8px 12px; font-size: var(--fs-md); }
  .settings-panels { padding: 16px 12px; flex: 1 1 0; }
  .settings-card { padding: 14px; }
  .pending-col { flex: 0 0 auto; height: min(180px, 25dvh); }
  .settings-footer { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .settings-footer .save-feedback { flex: 1 0 100%; min-height: 1.4em; }
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-table { font-size: var(--fs-sm); }
  .stats-table th, .stats-table td { padding: 8px; }
  #cfgJournals, #cfgDailyJournals { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 420px) {
  .task-actions .btn { flex-basis: 100%; }
  .date-range-control { grid-template-columns: minmax(0, 1fr); }
  .pending-head { gap: 4px; }
}

@media (max-height: 560px) {
  .overlay { padding-top: 8px; padding-bottom: 8px; }
  .settings.wide-card { height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .settings-header { padding-top: 6px; padding-bottom: 6px; }
  .settings-footer { padding-top: 6px; padding-bottom: 6px; }
  .pending-col { max-height: 100%; }
}

.task-error { color: var(--danger); }
#cfgJournals .journal-group, #cfgDailyJournals .journal-group { grid-column: 1 / -1; }

/* Reports and statistics */
.report-summary {
  position: sticky;
  top: -10px;
  z-index: 1;
  margin: -10px -14px 8px;
  padding: 10px 14px 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.report-summary .report-head { padding-bottom: 3px; }
.report-summary .hint { margin: 0; padding: 0 6px; line-height: var(--lh-body); }
.daily-results > .report-summary { top: -16px; background: var(--panel-subtle); }
.daily-results .report-summary .report-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.report-item.jump-flash { animation: jump-flash 1.4s ease-out 1; }
@keyframes jump-flash {
  0%, 55% { background-color: var(--warn-soft); box-shadow: inset 0 0 0 1px var(--warn-border); }
  100% { background-color: transparent; box-shadow: none; }
}
.report-item.report-card {
  padding: 10px;
  margin: 6px 0;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink);
}
.report-item-head { display: flex; align-items: flex-start; gap: 8px; }
.report-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  line-height: var(--lh-title);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.report-status { flex: 0 0 auto; padding: 2px 6px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 600; background: var(--panel-subtle); color: var(--muted); }
.report-card.ok .report-status { color: var(--good); background: var(--good-soft); }
.report-card.fail .report-status { color: var(--danger); background: var(--danger-soft); }
.report-reason { margin: 5px 0 0; font-size: var(--fs-xs); line-height: var(--lh-body); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-item-expand summary { list-style: none; cursor: pointer; }
.report-item-expand summary::-webkit-details-marker { display: none; }
.report-item-expand summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.report-toggle { flex: 0 0 auto; width: 0; height: 0; margin-top: 5px; border-left: 4px solid var(--muted); border-top: 3px solid transparent; border-bottom: 3px solid transparent; transition: transform .15s ease; }
.report-item-expand[open] .report-toggle { transform: rotate(90deg); }
.report-item-meta { margin-top: 6px; padding: 7px 9px; background: var(--panel-subtle); border-radius: 6px; }
.report-meta-title { margin: 0; font-size: var(--fs-sm); font-weight: 600; line-height: var(--lh-body); color: var(--ink); overflow-wrap: anywhere; }
.report-meta-line { margin: 3px 0 0; font-size: var(--fs-xs); line-height: var(--lh-body); color: var(--muted); }
.report-details { margin-top: 5px; color: var(--muted); font-size: var(--fs-xs); }
.report-details summary { cursor: pointer; width: fit-content; padding: 3px 0; }
.report-details summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.report-details[open] summary { color: var(--accent); }
.report-details pre { margin: 5px 0 0; padding: 8px; background: var(--panel-subtle); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: var(--lh-body); }
/* Stats panel fills the modal; the table takes the leftover height instead of a fixed cap. */
@media (min-width: 701px) {
  .spanel[data-panel="stats"] { height: 100%; min-height: 0; }
  .spanel[data-panel="stats"] .stats-table-wrap { flex: 1 1 auto; min-height: 220px; max-height: none; }
}
.stats-table thead th { position: sticky; top: 0; z-index: 1; background: var(--panel-subtle); }
.stats-table td:nth-child(n+2) { font-variant-numeric: tabular-nums; }
.stats-table tbody tr:hover td { background: var(--panel-subtle); }
.coverage-cell { width: 100%; min-width: 70px; max-width: 150px; margin-left: auto; }
.coverage-values { display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; white-space: nowrap; }
.coverage-values b { font-weight: 600; color: var(--ink); }
.coverage-values > span { font-size: var(--fs-xs); color: var(--muted); min-width: 36px; }
.coverage-track { display: block; height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: 5px; }
.coverage-track > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); opacity: .65; }
@media (max-width: 1050px) {
  .daily-results > .report-summary { top: -10px; }
}
@media (max-width: 700px) {
  .stats-table-wrap { max-height: 40dvh; }
  .coverage-cell { min-width: 60px; }
  .coverage-values { gap: 4px; }
  .coverage-values > span { font-size: var(--fs-xs); min-width: 30px; }
}

/* Settings details: channel tests, busy banner, credentials, key warnings */
.tr-head.warn { color: var(--caution); }
.source-test-attempts { margin-top:12px; border-top:1px solid var(--border); padding-top:10px; }
.source-test-attempts summary { cursor:pointer; color:var(--accent); font-size: var(--fs-sm); }
.source-test-attempts ol { max-height:280px; overflow:auto; padding-left:22px; }
.source-test-attempts li { padding:9px 6px; border-bottom:1px solid var(--border-soft); font-size: var(--fs-sm); overflow-wrap:anywhere; }
.source-test-attempts li p { margin:5px 0 0; color:var(--ink-secondary); }
.settings-title-group { min-width: 0; display: grid; gap: 6px; }
.settings-busy { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 10px; color: var(--accent); font-size: var(--fs-xs); line-height: var(--lh-body); }
.settings-busy > span::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 1px; }
.settings-busy button { flex-shrink: 0; padding: 2px 7px; border: 1px solid var(--accent-border); border-radius: 5px; color: var(--accent); background: var(--accent-soft); font: inherit; cursor: pointer; }
.settings-panels .seg-capsules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.test-src-btn:disabled, .test-src-btn:disabled:hover { opacity: .55; background: var(--panel-subtle); border-color: var(--border); color: var(--muted); cursor: not-allowed; }
.channel-busy-hint { color: var(--muted); padding: 8px 10px; border-radius: 7px; font-size: var(--fs-sm); background: var(--panel-subtle); }
.channel-config { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--panel); }
.channel-config + .channel-config { margin-top: 8px; }
.channel-config > summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; list-style: none; cursor: pointer; }
.channel-config > summary::-webkit-details-marker { display: none; }
.channel-config > summary:hover { background: var(--bg); }
.channel-config > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: var(--r-md); }
.channel-config > summary::after { content: ''; flex: 0 0 6px; width: 6px; height: 6px; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(45deg); margin-left: 2px; }
.channel-config[open] > summary::after { transform: rotate(225deg); }
.channel-name { flex: 1; min-width: 0; font-size: var(--fs-md); font-weight: 600; color: var(--ink-secondary); }
.channel-status { flex-shrink: 0; border-radius: var(--r-full); padding: 2px 8px; font-size: var(--fs-xs); line-height: var(--lh-body); color: var(--muted); background: var(--panel-subtle); }
.channel-status[data-state="已配置"] { color: var(--good); background: var(--good-soft); }
.channel-status[data-state="待保存"] { color: var(--warn); background: var(--warn-soft); }
.channel-status[data-state="待清空"] { color: var(--danger); background: var(--danger-soft); }
.channel-fields { padding: 14px; border-top: 1px solid var(--border); }
.credential-input-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.credential-input-row input { flex: 1; min-width: 0; }
.credential-input-row .clear-credential { flex: 0 0 60px; min-width: 60px; margin: 0; }
@media (max-width: 700px) {
  .settings-busy { font-size: var(--fs-xs); }
  .channel-config > summary { padding: 10px; gap: 6px; }
  .channel-fields { padding: 10px; }
}
/* Failing API key prompt: sits between the header and the panels, visible on every tab. */
.key-warnings { flex-shrink: 0; max-height: 30%; overflow-y: auto; padding: 10px 20px; border-bottom: 1px solid var(--warn-border); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-sm); line-height: var(--lh-body); }
.key-warnings-title { font-weight: 600; margin-bottom: 4px; }
.key-warning-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 4px 0; }
.key-warning-row > span { flex: 1; min-width: 200px; overflow-wrap: anywhere; }
.key-warning-row .btn.small { margin: 0; }
.key-warning-row .key-delete { color: var(--danger); border-color: var(--danger-border); }
@media (max-width: 700px) { .key-warnings { padding: 8px 12px; } }
/* Read-only viewer port: no way into settings. */
[data-mode="viewer"] #settingsBtn, [data-mode="viewer"] #settingsOverlay { display: none; }

/* Status badge: a button that opens the settings on the task's panel. The base
   look lives in layout.css; tones and button chrome live here. */
.status-badge { font-family: inherit; cursor: pointer; }
.status-badge:disabled { cursor: default; }
.status-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* A warn tone flags the last failed/partial/interrupted run (or a lost connection). */
.status-badge.warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.status-badge.warn .status-dot { background: var(--warn); }

/* Narrow columns and phones */
@container (max-width: 420px) {
  .article { padding: 12px 14px; }
  .facet-trigger { gap: 6px; padding: 8px; }
}
@media (max-width: 760px) {
  .midbar { gap: 7px; }
  #listToolbar .list-tools { gap: 7px; }
  .facet-group { max-width: none; }
  .facet-trigger { min-height: 51px; }
  .article-list { gap: 9px; }
  .article { padding: 13px 14px; }
}

/* Journal multiselect */
.journal-multiselect { min-width:0; width:100%; margin:6px 0 14px; border:1px solid var(--select-border); border-radius:12px; background:var(--panel); }
.journal-multiselect > summary { display:flex; align-items:center; gap:12px; padding:12px 14px; cursor:pointer; list-style:none; color:var(--ink-secondary); font-weight:500; }
.journal-multiselect > summary::-webkit-details-marker { display:none; }
.journal-multiselect > summary span { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.journal-multiselect > summary::after { content:''; width:7px; height:7px; border-right:1.5px solid var(--chevron); border-bottom:1.5px solid var(--chevron); transform:rotate(45deg); margin:0 3px 4px; }
.journal-multiselect[open] > summary { border-bottom:1px solid var(--select-divider); color:var(--accent); background:var(--select-open-bg); border-radius:12px 12px 0 0; }
.journal-multiselect[open] > summary::after { transform:rotate(225deg); margin-bottom:0; }
.journal-multiselect summary:focus-visible, .journal-all:focus-visible { outline:2px solid var(--accent-border); outline-offset:2px; }
.journal-options { max-height:300px; overflow:auto; padding:0 8px 8px; }
.journal-options-toolbar { position:sticky; top:0; z-index:1; display:flex; align-items:center; flex-wrap:wrap; gap:8px; background:var(--panel); padding:9px 3px; border-bottom:1px solid var(--select-toolbar-border); }
.journal-all { cursor:pointer; padding:6px 10px; border:1px solid var(--border); border-radius:8px; background:var(--panel); color:var(--muted); font:inherit; font-size: var(--fs-sm); }
.journal-all[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent); border-color:var(--accent-border); }
.journal-options-toolbar .hint { margin:0; font-size: var(--fs-xs); }
.journal-option { display:flex; gap:10px; align-items:center; padding:10px; border-radius:8px; cursor:pointer; font-size: var(--fs-md); color:var(--option-text); line-height: var(--lh-body); }
.journal-option:hover { background:var(--option-hover); }
.journal-option:has(input:checked) { background:var(--accent-soft); color:var(--accent-hover); }
.journal-option input { width:15px; height:15px; flex:none; margin:0; accent-color:var(--accent); }
.journal-options .journal-group { margin:12px 10px 5px; }
.journal-filter-label { display:block; margin-top:14px; color:var(--muted); font-size: var(--fs-md); }

/* Task sidebar: a fixed summary and one scrolling detail view in each manual panel. */
.manual-task-col { overflow: hidden; }
.task-progress-summary { flex: 0 0 auto; padding: 18px; background: var(--panel); border-bottom: 1px solid var(--border); }
.task-progress-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: var(--fs-md); }
.task-state { flex-shrink: 0; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); background: var(--panel-subtle); border-radius: 20px; padding: 3px 8px; }
.task-state.running { color: var(--accent); background: var(--accent-soft); }
/* A statistic number: the usage table puts stats on 2xl even though the old value sat in the xl band. */
.task-progress-value { margin: 12px 0 7px; font-size: var(--fs-2xl); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.task-progress-bar { display: block; appearance: none; width: 100%; height: 5px; border: 0; border-radius: 8px; overflow: hidden; background: var(--border); accent-color: var(--accent); }
.task-progress-bar::-webkit-progress-bar { background: var(--border); border-radius: 8px; }
.task-progress-bar::-webkit-progress-value { background: var(--accent); border-radius: 8px; }
.task-progress-bar::-moz-progress-bar { background: var(--accent); border-radius: 8px; }
.task-counter-row { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 9px; color: var(--muted); font-size: var(--fs-sm); }
.task-counter-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.task-live-message { margin: 10px 0 0; font-size: var(--fs-sm); line-height: var(--lh-body); color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.task-view-row { display: flex; align-items: stretch; flex: 0 0 auto; border-bottom: 1px solid var(--border); }
.task-view-tabs { display: flex; flex: 1; min-width: 0; gap: 4px; padding: 10px 6px 10px 12px; }
.task-view-tabs button { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 7px 5px; border: 1px solid transparent; background: transparent; border-radius: 8px; color: var(--muted); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.task-view-tabs button[aria-selected="true"] { color: var(--accent); background: var(--panel); border-color: var(--border); box-shadow: var(--shadow-sm); font-weight: 600; }
.task-view-tabs button:focus-visible, .task-new-results:focus-visible, .task-next-anomaly:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-next-anomaly { flex: 0 0 auto; align-self: center; margin-right: 12px; padding: 5px 9px; border: 1px solid var(--warn-border); border-radius: 8px; background: var(--warn-soft); color: var(--warn); font: inherit; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; cursor: pointer; }
.task-next-anomaly:hover { border-color: var(--warn); color: var(--warn); filter: brightness(0.97); }
.task-view-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.manual-task-col .report-box { flex: 1; min-height: 0; max-height: none; border-top: 0; background: transparent; overscroll-behavior: contain; overflow-anchor: none; }
.manual-task-col .pending-head { flex-direction: column; padding: 10px 16px; gap: 5px; background: transparent; font-size: var(--fs-sm); }
.manual-task-col .pending-count { padding: 0; background: transparent; font-size: var(--fs-sm); font-weight: 500; }
.manual-task-col .pending-list { padding: 6px 12px; }
.pending-item.next { color: var(--ink); font-weight: 600; }
.pending-next { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 600; line-height: 18px; vertical-align: 1px; }
.task-new-results { margin: 8px 14px 0; padding: 7px 10px; border: 1px solid var(--accent-border); border-radius: 8px; background: var(--accent-soft); color: var(--accent); cursor: pointer; font-size: var(--fs-sm); flex-shrink: 0; }
.task-results-empty { margin: 8px 4px; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-body); }
@media (max-width: 1050px) {
  .manual-task-col { height: clamp(260px, 40dvh, 360px); }
  .task-progress-summary { padding: 10px 16px; }
  .task-progress-value { font-size: var(--fs-lg); margin: 7px 0 5px; }
  .task-live-message { margin-top: 5px; -webkit-line-clamp: 1; }
  .task-counter-row { margin-top: 5px; }
  .task-view-tabs { padding: 6px 12px; }
}
@media (max-width: 700px) {
  .manual-task-col { height: clamp(260px, 43dvh, 350px); }
  .task-progress-title { font-size: var(--fs-md); }
}
@media (max-height: 560px) and (max-width: 1050px) {
  .manual-task-col { height: 48dvh; min-height: 175px; }
  .task-progress-summary { padding: 7px 12px; }
  .task-progress-value { margin-top: 4px; }
  .task-counter-row, .task-live-message { font-size: var(--fs-xs); }
  .task-view-tabs { padding: 4px 10px; }
}

/* Classification filters and chips */
.facet-group .facet,.facet-group .facet-trigger {min-width:0;width:100%;}
.selected-facets {display:flex;flex-wrap:wrap;gap:6px;padding:0 16px 10px;}
.selected-facet {border:1px solid var(--chip-selected-border);background:var(--chip-selected-bg);color:var(--chip-selected-text);border-radius:14px;padding:4px 9px;font:inherit;font-size: var(--fs-sm);cursor:pointer;}
/* Hint row reserves the toolbar's height so toggling the reset button never shifts the list. */
.facet-hint {display:flex;flex-wrap:wrap;align-items:center;column-gap:14px;row-gap:6px;min-height:30px;font-size: var(--fs-xs);color:var(--muted);padding:0 0 4px 2px;}
.facet-hint .reset-all-btn {padding:4px 11px;font-size: var(--fs-sm);}
.classification-groups {display:grid;gap:8px;}
.classification-group {display:flex;gap:10px;align-items:flex-start;}
.classification-label {flex:0 0 56px;font-size: var(--fs-sm);color:var(--muted);line-height:24px;}
.classification-values {display:flex;flex-wrap:wrap;gap:5px;min-width:0;}
/* Outside-taxonomy text gets its own line so it never wraps between chips. */
.classification-outside {flex-basis:100%;font-size: var(--fs-sm);line-height: var(--lh-body);color:var(--muted);}
.outside-label {display:inline-block;margin-right:6px;padding:0 6px;border:1px dashed var(--border);border-radius:5px;font-size: var(--fs-xs);line-height:18px;color:var(--muted);vertical-align:1px;}
.classification-more,.classification-empty {font-size: var(--fs-sm);line-height:24px;color:var(--muted);}
.classification-groups.compact {margin-top:9px;gap:4px;}
.compact .classification-label {font-size: var(--fs-xs);}
@container (max-width:560px){.facet-group{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:420px){.facet-group{grid-template-columns:1fr;}.classification-label{flex-basis:52px;}}
