/* Logs page — update history. Tokens come from styles.css; this file only
   adds what the log view needs. Status pills reuse the existing green/amber/
   red badge tokens so light + dark both work without re-tuning by eye. */

/* The topbar stays pinned; the log list itself scrolls. */
.logs-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 32px;
}

/* ---------- freshness banner (pinned at top of the scroll area) ---------- */
.freshness-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text);
}
.freshness-label { color: var(--muted); font-weight: 600; }
.freshness-value {
  font-weight: 700;
  color: var(--accent);
  cursor: help;
}

/* ---------- cycle list ---------- */
.logs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cycle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.cycle-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  flex-wrap: wrap;
}
.cycle-summary:hover { background: var(--row-hover); }

.summary-chevron {
  flex: none;
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.12s ease;
}
.cycle-summary.open .summary-chevron { transform: rotate(90deg); }

.summary-time {
  flex: 0 0 auto;
  min-width: 130px;
  font-weight: 700;
  font-size: 14px;
}

/* ---------- status pills ---------- */
.summary-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.pill-ok { background: var(--green-bg); color: var(--green-text); }
.pill-partial { background: var(--amber-bg); color: var(--amber-text); }
.pill-failed { background: var(--red-bg); color: var(--red-text); }

.summary-added {
  flex: 0 0 auto;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.added-new { font-weight: 700; color: var(--text); }
.added-changed { font-size: 12px; color: var(--muted); font-weight: 500; }

.summary-sources,
.summary-portals {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.summary-portals { margin-left: auto; }
.portal-failed { color: var(--red-text); font-weight: 600; }

/* ---------- per-source detail ---------- */
.cycle-detail {
  border-top: 1px solid var(--border);
  padding: 6px 16px 10px;
  background: var(--row-alt);
}

.src-row {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.src-row:last-child { border-bottom: none; }

.src-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}
.src-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}
.src-portal-tag {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--grey-bg);
  color: var(--grey-text);
  vertical-align: middle;
}
.src-status {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.src-ok .src-status { color: var(--green-text); }
.src-error .src-status { color: var(--red-text); }
.src-skipped .src-status { color: var(--muted); }

.src-body {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.src-metrics { font-variant-numeric: tabular-nums; color: var(--text); }
.src-note { font-style: italic; }
.src-verdict { color: var(--muted); }
.src-verdict-why { color: var(--muted); }

.src-error-msg {
  margin: 6px 0 0;
  padding: 8px 10px;
  background: var(--red-bg);
  color: var(--red-text);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

/* ---------- empty state ---------- */
.logs-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 760px) {
  /* On a phone the pinned topbar would eat half the screen — let the whole
     page scroll instead so the log list gets room. */
  body.logs-page { display: block; overflow-y: auto; }
  .logs-main { overflow: visible; padding: 12px 14px 28px; }
  .freshness-banner { position: static; }
  .summary-portals { margin-left: 0; }
  .summary-time { min-width: 0; }
}
