:root {
  --bg-app: #F7F5FB;
  --bg-raised: #FFFFFF;
  --surface-lavender: #B8A6FF;
  --surface-sky: #9EC9F0;
  --surface-mint: #7DD4A8;
  --surface-peach: #FFB59E;
  --surface-pink: #F5B8D0;
  --surface-lemon: #F5D77A;
  --action-primary: #FF7A6B;
  --action-on: #FFFFFF;
  --text-strong: #2E2A3F;
  --text-muted: #6B6580;
  --border-color: #C9B5FF;
  --code-bg: #201933;
  --code-text: #C9C0E8;
  --r-card: 28px;
  --r-button: 18px;
  --r-chip: 999px;
  --r-input: 16px;

  --mono: ui-monospace, 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;

  --shadow-white: 8px 8px 22px rgba(140,108,255,0.16), -8px -8px 20px rgba(255,255,255,0.85), inset 3px 3px 6px rgba(255,255,255,0.7), inset -5px -5px 10px rgba(140,108,255,0.10);
  --shadow-pressed: inset 4px 4px 8px rgba(140,108,255,0.20), inset -4px -4px 8px rgba(255,255,255,0.75);
  --shadow-sm: 4px 4px 12px rgba(140,108,255,0.18), -3px -3px 10px rgba(255,255,255,0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

body {
  font-family: 'Quicksand', 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-strong);
  background: var(--bg-app);
  min-height: 100vh;
  padding: 22px 16px 48px;
  overflow-x: hidden;
}

.monitor-container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

body.stats-stale .ov-value,
body.stats-stale .rps-value,
body.stats-stale .stat-value,
body.stats-stale .stat-sub,
body.stats-stale .http-count,
body.stats-stale .sched-row span:last-child {
  opacity: 0.45;
  transition: opacity 0.3s ease;
}

.scroll-reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-button);
  background: var(--bg-raised);
  box-shadow: var(--shadow-white);
  color: var(--text-strong);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease;
}
.back-link:hover { transform: translateY(-2px); color: var(--action-primary); }
.back-link:active { transform: scale(0.97); box-shadow: var(--shadow-pressed); }

.conn-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-chip);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.conn-dot.conn-connecting,
.conn-dot.conn-reconnecting { background: var(--surface-lemon); box-shadow: 0 0 0 3px rgba(245,215,122,0.35); animation: pulse 1.2s ease-in-out infinite; }
.conn-dot.conn-live { background: var(--surface-mint); box-shadow: 0 0 0 3px rgba(125,212,168,0.35); }
.conn-dot.conn-offline { background: var(--action-primary); box-shadow: 0 0 0 3px rgba(255,122,107,0.3); }

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

.title-group { padding: 4px 2px; }
.title-group h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-strong);
}
.title-group h1 span { color: var(--action-primary); }
.title-group p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.overview-card {
  background: var(--bg-raised);
  border-radius: var(--r-input);
  box-shadow: var(--shadow-white);
  padding: 16px 18px;
}
.ov-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.ov-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-strong);
  font-family: var(--mono);
}
.ov-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.ov-dot.ov-online { background: var(--surface-mint); box-shadow: 0 0 0 3px rgba(125,212,168,0.3); }
.ov-dot.ov-offline { background: var(--action-primary); box-shadow: 0 0 0 3px rgba(255,122,107,0.3); }
.ov-dot.ov-unknown { background: var(--border-color); }

.chart-section,
.section-block,
.scheduler-card,
.feed-section {
  background: var(--bg-raised);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-white);
  padding: 20px 22px;
}
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 16px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.chart-title { font-size: 1.05rem; font-weight: 700; color: var(--text-strong); }
.chart-total { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); font-family: var(--mono); }

.rps-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.rps-item {
  text-align: center;
  padding: 14px 8px;
  border-radius: var(--r-input);
  background: var(--bg-app);
  box-shadow: var(--shadow-pressed);
}
.rps-item.rps-main { background: rgba(158,201,240,0.25); }
.rps-value { font-size: 1.5rem; font-weight: 700; color: var(--text-strong); font-family: var(--mono); }
.rps-main .rps-value { color: #2f76b8; }
.rps-label {
  margin-top: 4px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.chart-canvas {
  display: block;
  width: 100%;
  height: 90px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.stat-card {
  padding: 16px 18px;
  border-radius: var(--r-input);
  background: var(--bg-app);
  box-shadow: var(--shadow-pressed);
}
.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text-strong); font-family: var(--mono); }

.stat-bar {
  margin: 10px 0 6px;
  height: 12px;
  border-radius: var(--r-chip);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pressed);
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--r-chip);
  background: linear-gradient(90deg, var(--surface-mint), #4fb883);
  transition: width 0.5s ease;
}
.stat-bar-fill.warn { background: linear-gradient(90deg, var(--surface-lemon), #e0a93f); }
.stat-bar-fill.danger { background: linear-gradient(90deg, var(--surface-peach), var(--action-primary)); }
.stat-sub { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); font-family: var(--mono); }

.stat-rows { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.stat-row, .sched-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
}
.stat-row span:first-child, .sched-row span:first-child { color: var(--text-muted); }
.stat-row span:last-child, .sched-row span:last-child { color: var(--text-strong); font-family: var(--mono); }

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.health-card {
  padding: 16px 18px;
  border-radius: var(--r-input);
  background: var(--bg-app);
  box-shadow: var(--shadow-pressed);
}
.health-name { font-size: 0.9rem; font-weight: 700; color: var(--text-strong); margin-bottom: 10px; }
.health-status { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-strong); }
.health-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; background: var(--border-color); }
.health-dot.health-ok { background: var(--surface-mint); box-shadow: 0 0 0 3px rgba(125,212,168,0.3); }
.health-dot.health-bad { background: var(--action-primary); box-shadow: 0 0 0 3px rgba(255,122,107,0.3); }
.health-dot.health-unknown { background: var(--border-color); }
.health-sub { margin-top: 6px; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); font-family: var(--mono); }

.sched-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sched-queue .stat-label { margin-bottom: 6px; }

.http-status-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 12px;
}
.http-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: var(--r-input);
  box-shadow: var(--shadow-sm);
}
.http-count { font-size: 1.4rem; font-weight: 700; font-family: var(--mono); color: var(--text-strong); }
.http-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.5px; color: var(--text-muted); }
.http-2xx { background: rgba(125,212,168,0.3); }
.http-4xx { background: rgba(245,215,122,0.35); }
.http-5xx { background: rgba(255,122,107,0.28); }
.http-429 { background: rgba(255,181,158,0.35); }
.http-503 { background: rgba(184,166,255,0.3); }

.feed-section { padding: 0; overflow: hidden; }
.feed-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--code-bg);
  border-bottom: 1px solid rgba(201,192,232,0.15);
}
.terminal-dots { display: flex; gap: 7px; }
.terminal-dots .dot { width: 12px; height: 12px; border-radius: 50%; }
.terminal-dots .dot.red { background: #ff5f56; }
.terminal-dots .dot.yellow { background: #ffbd2e; }
.terminal-dots .dot.green { background: #27c93f; }
.feed-title { font-size: 0.85rem; font-weight: 700; color: var(--code-text); font-family: var(--mono); }
.feed-count { margin-left: auto; font-size: 0.75rem; font-weight: 600; color: #8a82a8; font-family: var(--mono); }

.feed-body {
  background: var(--code-bg);
  max-height: 340px;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.9;
}
.feed-empty { color: #8a82a8; text-align: center; padding: 20px; }

.feed-line {
  white-space: nowrap;
  overflow-x: auto;
  color: var(--code-text);
  border-bottom: 1px dashed rgba(201,192,232,0.08);
  padding: 1px 0;
  animation: feed-line-in 0.35s ease both;
}
@keyframes feed-line-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
.feed-line::-webkit-scrollbar { height: 0; }
.fl-time { color: #8a82a8; }
.fl-method { font-weight: 700; }
.fl-method.get { color: #7ec8f0; }
.fl-method.post { color: #7dd4a8; }
.fl-method.put { color: #f5d77a; }
.fl-method.delete { color: #ff8a7a; }
.fl-url { color: var(--code-text); }
.fl-category { color: #b8a6ff; }
.fl-status { font-weight: 700; }
.fl-status.status-2xx { color: #7dd4a8; }
.fl-status.status-3xx { color: #7ec8f0; }
.fl-status.status-4xx { color: #f5d77a; }
.fl-status.status-5xx { color: #ff8a7a; }
.fl-status.status-unknown { color: #8a82a8; }

.site-footer {
  margin-top: 2rem;
  padding: 24px 12px;
  background: transparent;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 24px;
}
.footer-brand-name {
  font-family: 'Quicksand', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-strong);
}
.footer-brand-tag {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: color 0.15s ease;
  padding: 0;
  border-radius: 0;
  background: transparent;
}
.footer-links a:hover {
  background: transparent;
  color: var(--action-primary);
}
.footer-copy {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

@media (min-width: 769px) {
  body { padding: 32px 24px 64px; }
  .title-group h1 { font-size: 2.3rem; }
  .chart-canvas { height: 110px; }
}