* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f0f4f8; color: #222; }

/* ── Header ── */
header {
  background: #1A3A5C;
  color: white;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}
header h1 { font-size: 1.2rem; font-weight: 700; flex: 1; }
header a  { color: rgba(255,255,255,.75); font-size: .85rem; text-decoration: none; }
header a:hover { color: white; }
#refresh-indicator {
  font-size: .8rem;
  color: rgba(255,255,255,.6);
  display: flex;
  align-items: center;
  gap: 8px;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2ECC71;
  animation: blink 2s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Auth overlay ── */
#auth-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.auth-box {
  background: white;
  border-radius: 12px;
  padding: 32px 36px;
  width: 360px;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.auth-box h2 { color: #1A3A5C; margin-bottom: 8px; }
.auth-box p  { color: #666; font-size: .88rem; margin-bottom: 20px; }
.input-row { display: flex; gap: 8px; }
input[type=password] {
  flex: 1; padding: 10px 14px;
  border: 1px solid #cdd5e0; border-radius: 6px; font-size: .95rem;
}
input[type=password]:focus { outline: none; border-color: #1A3A5C; }
.btn {
  padding: 10px 18px; background: #1A3A5C; color: white;
  border: none; border-radius: 6px; font-size: .9rem;
  cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: #14304e; }
.error-msg { color: #C0392B; font-size: .82rem; margin-top: 8px; }

/* ── Layout ── */
main { max-width: 1300px; margin: 0 auto; padding: 24px; }

/* ── Summary cards ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
}
.stat-card .label { font-size: .78rem; color: #888; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; color: #1A3A5C; }
.stat-card .sub   { font-size: .78rem; color: #aaa; margin-top: 2px; }
.stat-card.green .value { color: #27AE60; }
.stat-card.red   .value { color: #C0392B; }
.stat-card.blue  .value { color: #2980B9; }

/* ── Per-source summary ── */
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.source-card {
  background: white;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  border-left: 4px solid #ccc;
}
.source-card.success { border-color: #27AE60; }
.source-card.failed  { border-color: #C0392B; }
.source-card.running { border-color: #2980B9; }
.source-card.never   { border-color: #ccc; }
.source-card .src-name { font-weight: 700; font-size: .88rem; color: #1A3A5C; margin-bottom: 4px; }
.source-card .src-meta { font-size: .78rem; color: #666; }

/* ── Filters ── */
.filter-bar {
  background: white;
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar label { font-size: .82rem; color: #666; white-space: nowrap; }
select, input[type=text] {
  padding: 7px 10px;
  border: 1px solid #cdd5e0;
  border-radius: 6px;
  font-size: .85rem;
  background: white;
}
select:focus, input[type=text]:focus { outline: none; border-color: #1A3A5C; }
.btn-sm {
  padding: 7px 14px; background: #1A3A5C; color: white;
  border: none; border-radius: 6px; font-size: .82rem;
  cursor: pointer; font-weight: 600;
}
.btn-sm:hover { background: #14304e; }
.count-info { margin-left: auto; font-size: .82rem; color: #888; }

/* ── Log table ── */
.table-wrap {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  background: #1A3A5C; color: white;
  padding: 10px 12px; text-align: left; font-weight: 600;
  white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { background: #14304e; }
tbody td { padding: 9px 12px; border-bottom: 1px solid #f0f4f8; vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfc; }
tbody tr.running td { background: #EBF5FB; }
tbody tr.failed  td { background: #fef9f9; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 2px 9px;
  border-radius: 12px; font-size: .75rem; font-weight: 700;
}
.badge.success { background: #E8F5E9; color: #27AE60; }
.badge.failed  { background: #FDECEA; color: #C0392B; }
.badge.running { background: #E3F2FD; color: #1976D2; }

/* ── Error detail ── */
.err-toggle {
  cursor: pointer; color: #C0392B; font-size: .78rem;
  display: flex; align-items: center; gap: 4px;
}
.err-toggle:hover { text-decoration: underline; }
.err-box {
  display: none; margin-top: 6px;
  background: #fff5f5; border: 1px solid #fcc;
  border-radius: 4px; padding: 8px 10px;
  font-size: .75rem; font-family: monospace;
  white-space: pre-wrap; word-break: break-all;
  max-height: 200px; overflow-y: auto; color: #922;
}
.err-box.open { display: block; }

/* ── Progress bar inline ── */
.dur-bar-wrap { background: #e8f0fb; border-radius: 3px; height: 4px; margin-top: 4px; overflow: hidden; }
.dur-bar { height: 100%; background: #2980B9; border-radius: 3px; }

/* ── Running pulse ── */
.pulse {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #1976D2; animation: pulse 1.2s infinite; vertical-align: middle;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(.8)} }

/* ── Load more ── */
.load-more {
  text-align: center; padding: 16px;
  border-top: 1px solid #f0f4f8;
}
.btn-outline {
  padding: 8px 20px; background: white; color: #1A3A5C;
  border: 2px solid #1A3A5C; border-radius: 6px;
  font-size: .85rem; cursor: pointer; font-weight: 600;
}
.btn-outline:hover { background: #1A3A5C; color: white; }

.loading { color: #888; font-size: .88rem; padding: 20px; text-align: center; }
.empty   { color: #aaa; font-size: .88rem; padding: 24px; text-align: center; }
