/* ── Reset & Root ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface-2:   #1c2128;
  --border:      #30363d;
  --text:        #c9d1d9;
  --text-muted:  #8b949e;
  --text-dim:    #484f58;
  --green:       #3fb950;
  --green-dim:   #1a4126;
  --red:         #f85149;
  --red-dim:     #3d1a1a;
  --amber:       #d29922;
  --blue:        #58a6ff;
  --font-mono:   "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --font-ui:     -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --radius:      6px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────── */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Header ───────────────────────────────────────── */
.header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title h1 {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}

.header-title .badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 20px;
  padding: 2px 8px;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.sync-time {
  font-family: var(--font-mono);
}

.sync-warning {
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s ease-in-out infinite;
  display: inline-block;
  margin-right: 6px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Main two-column ──────────────────────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 12px;
}

/* ── Panels ───────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
}

.panel-header h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-header .panel-meta {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ── Stats panel ──────────────────────────────────── */
.stats-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-section h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  color: var(--text-muted);
  font-size: 13px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-value.zero {
  color: var(--text-dim);
}

/* ── Live Feed ────────────────────────────────────── */
.feed-body {
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow-y: auto;
}

.feed-body::-webkit-scrollbar { width: 4px; }
.feed-body::-webkit-scrollbar-track { background: transparent; }
.feed-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.feed-event {
  padding: 8px 16px;
  border-left: 3px solid transparent;
  transition: background 0.1s;
}

.feed-event:hover {
  background: var(--surface-2);
}

.feed-event.ok  { border-left-color: var(--green); }
.feed-event.err { border-left-color: var(--red); }

.feed-event-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  min-width: 42px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.ok  { background: var(--green); }
.status-dot.err { background: var(--red); }

.feed-job {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.feed-action {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 2px;
}

.feed-detail {
  margin-top: 3px;
  margin-left: 57px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.feed-detail.err-text {
  color: var(--red);
  opacity: 0.8;
}

.feed-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 16px;
  opacity: 0.5;
}

/* ── Schedule strip ───────────────────────────────── */
.schedule-body {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 180px 1fr 90px 120px 24px;
  align-items: center;
  gap: 12px;
}

.sched-job {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

.sched-bar-wrap {
  background: var(--surface-2);
  border-radius: 3px;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.sched-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width 0.4s ease;
}

.sched-bar.error {
  background: var(--red);
}

.sched-bar.idle {
  background: var(--text-dim);
  width: 0% !important;
}

.sched-cron {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
}

.sched-next {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.sched-status {
  display: flex;
  justify-content: center;
}

.sched-divider {
  height: 1px;
  background: var(--border);
  opacity: 0.4;
}

/* ── Countdown badge ──────────────────────────────── */
.next-run-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
  background: rgba(210, 153, 34, 0.1);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-radius: 3px;
  padding: 1px 7px;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  .main-grid { grid-template-columns: 1fr; }
  .schedule-row { grid-template-columns: 140px 1fr 60px; }
  .sched-next { display: none; }
}
