@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Serif:wght@500;600&display=swap");

:root {
  --bg: #0f1419;
  --bg-elev: #1a222c;
  --bg-card: #151c24;
  --ink: #e8eef4;
  --muted: #8b9aab;
  --line: #2a3544;
  --accent: #3d9a7a;
  --ok: #3d9a7a;
  --failed: #d45d4a;
  --missed: #c9a227;
  --running: #4a8fd4;
  --off: #6b7785;
  --font-display: "IBM Plex Serif", "Source Serif 4", Georgia, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1c3a32 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1a2a3d 0%, transparent 50%),
    var(--bg);
}

.top {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 80%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.top a:not(.brand) { color: var(--muted); text-decoration: none; }
.top a:not(.brand):hover { color: var(--ink); }
.logout { margin-left: auto; }
.logout button, .inline button, .login button {
  background: var(--accent);
  color: #06130e;
  border: 0;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.logout button { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.inline button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.inline button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.actions .inline { margin-top: 0; }
.flash { margin: 0.75rem 0 0; color: var(--accent); font-size: 0.95rem; }

.live-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  70% { box-shadow: 0 0 0 0.55rem transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

main { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }

.hero-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.hero-copy { min-width: min(100%, 18rem); }
.hero-strip h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 0.35rem;
  letter-spacing: -0.03em;
}
.hero-strip p { margin: 0; color: var(--muted); }
.job-hero .actions { margin-top: 0; }
.lede { color: var(--muted); }

.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.stat {
  min-width: 4.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
}
.stat:nth-child(1) { border-left-color: var(--ok); }
.stat:nth-child(2) { border-left-color: var(--running); }
.stat:nth-child(3) { border-left-color: var(--failed); }
.stat:nth-child(4) { border-left-color: var(--missed); }
.stat-n {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.1;
}
.stat-n.ok { color: var(--ok); }
.stat-n.running { color: var(--running); }
.stat-n.failed { color: var(--failed); }
.stat-n.missed { color: var(--missed); }
.stat-l {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
  margin-bottom: 2rem;
}
.job-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line);
  padding: 1rem 1.05rem 1.1rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.job-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--bg-elev) 70%, var(--bg-card));
}
.job-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.job-card.status-ok { border-top-color: var(--ok); }
.job-card.status-failed { border-top-color: var(--failed); }
.job-card.status-missed { border-top-color: var(--missed); }
.job-card.status-running { border-top-color: var(--running); }
.job-card.status-never,
.job-card.status-other { border-top-color: var(--off); }

.job-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}
.job-card-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.job-meta {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
}
.job-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
  margin: 0;
}
.job-facts dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.job-facts dd {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
}

.presence {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--off);
  flex-shrink: 0;
}
.presence.on { background: var(--ok); }
.presence.off { background: var(--failed); }

.panel h2,
.chart h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.panel {
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem;
  background: color-mix(in srgb, var(--bg-elev) 55%, transparent);
  border: 1px solid var(--line);
}

.table-wrap { overflow-x: auto; margin-bottom: 0.5rem; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
a { color: var(--accent); }
code, .path { font-family: var(--font-mono); font-size: 0.85em; }
.muted { color: var(--muted); }
.error { color: var(--failed); }

.pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pill.ok { background: color-mix(in srgb, var(--ok) 25%, transparent); color: var(--ok); }
.pill.off { background: color-mix(in srgb, var(--off) 25%, transparent); color: var(--off); }

.status {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
.status.ok { color: var(--ok); }
.status.failed { color: var(--failed); }
.status.missed { color: var(--missed); }
.status.running { color: var(--running); }
.status.never, .status.other { color: var(--off); }

.login {
  max-width: 360px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.login h1 { font-family: var(--font-display); margin-top: 0; }
.login label { display: block; margin-bottom: 0.9rem; color: var(--muted); font-size: 0.85rem; }
.login input {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
}
.login button { width: 100%; margin-top: 0.5rem; }

.chart { margin-bottom: 1.5rem; }
.bars {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 140px;
  padding: 0.5rem 0;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}
.bar {
  width: 100%;
  max-width: 28px;
  background: linear-gradient(180deg, var(--accent), #1e5c48);
  min-height: 2px;
}
.bar-col span {
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  white-space: nowrap;
}

.log-row pre {
  margin: 0;
  padding: 0.75rem;
  background: var(--bg-elev);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  white-space: pre-wrap;
  max-height: 200px;
  overflow: auto;
  color: var(--muted);
}
.error-cell { color: var(--failed); max-width: 240px; word-break: break-word; }
.inline { margin-top: 0.75rem; }

@media (max-width: 720px) {
  main { padding: 1rem; }
  .job-facts { grid-template-columns: 1fr; }
  th:nth-child(7), td:nth-child(7) { display: none; }
}
