@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:    #0c0e11;
  --s1:    #131518;
  --s2:    #1a1d21;
  --s3:    #21252a;
  --b1:    #1f2328;
  --b2:    #2d3238;
  --b3:    #3d4450;
  --t1:    #f1f3f6;
  --t2:    #8b95a1;
  --t3:    #4a5260;
  --ok:    #3dd68c;
  --ok-d:  rgba(61,214,140,0.10);
  --ok-b:  rgba(61,214,140,0.22);
  --warn:  #f5a623;
  --warn-d:rgba(245,166,35,0.10);
  --warn-b:rgba(245,166,35,0.22);
  --bad:   #f56565;
  --bad-d: rgba(245,101,101,0.10);
  --bad-b: rgba(245,101,101,0.22);
  --maint: #7c83fd;
  --maint-d:rgba(124,131,253,0.10);
  --maint-b:rgba(124,131,253,0.22);
  --off:   #4a5260;
  --off-d: rgba(74,82,96,0.10);
  --off-b: rgba(74,82,96,0.22);
  --r: 8px;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--t1);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

a { color: inherit; text-decoration: none; }

/* ── LAYOUT ──────────────────────────────────── */
.wrap {
  display: grid;
  grid-template-rows: 52px 1fr 36px;
  height: 100vh;
  overflow: hidden;
}

/* ── NAV ─────────────────────────────────────── */
.nav {
  background: var(--s1);
  border-bottom: 1px solid var(--b1);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}

.brand-hex {
  width: 28px;
  height: 28px;
  background: var(--warn);
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-x {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: #0c0e11;
}

.brand-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.brand-sep {
  width: 1px;
  height: 16px;
  background: var(--b2);
}

.brand-sub {
  font-size: 11px;
  color: var(--t3);
  letter-spacing: 0.04em;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 2s ease-in-out infinite;
  flex-shrink: 0;
}

.nav-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--t3);
  flex-shrink: 0;
}

.nav-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--t3);
  padding: 5px 12px;
  border: 1px solid var(--b2);
  border-radius: 6px;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.nav-link:hover { border-color: var(--b3); color: var(--t1); }

/* ── BODY ────────────────────────────────────── */
.body {
  display: grid;
  grid-template-columns: 1fr 310px;
  overflow: hidden;
}

/* ── LEFT ────────────────────────────────────── */
.left {
  display: grid;
  grid-template-rows: 72px 1fr;
  border-right: 1px solid var(--b1);
  overflow: hidden;
}

/* Stats strip */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--b1);
  flex-shrink: 0;
}

.stat {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  border-right: 1px solid var(--b1);
}
.stat:last-child { border-right: none; }

.stat-lbl {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--t3);
  text-transform: uppercase;
}

.stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.1;
}

.stat-note {
  font-size: 10px;
  color: var(--t3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Services grid */
.svcs {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 10px;
  overflow: hidden;
  align-content: start;
}

.svc {
  background: var(--s1);
  border: 1px solid var(--b1);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s;
}
.svc:hover { border-color: var(--b2); }

.svc-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--r) var(--r) 0 0;
}

.svc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.svc-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--t1);
  letter-spacing: 0.02em;
}

.svc-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--b2);
  color: var(--t3);
  background: var(--s2);
  flex-shrink: 0;
  white-space: nowrap;
}

.svc-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  margin-bottom: 8px;
}

.svc-sdot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: blink 2s ease-in-out infinite;
}

.svc-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.svc-meta-i {
  font-size: 10px;
  color: var(--t3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.svc-meta-i::before {
  content: '';
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--b3);
  flex-shrink: 0;
}

.svc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--b1);
}

.svc-ft-lbl {
  font-size: 9px;
  color: var(--t3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.svc-upt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
}

/* ── RIGHT ───────────────────────────────────── */
.right {
  display: grid;
  grid-template-rows: 1fr 1fr;
  overflow: hidden;
}

.panel {
  display: grid;
  grid-template-rows: 40px 1fr;
  overflow: hidden;
}
.panel + .panel { border-top: 1px solid var(--b1); }

.ph {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--b1);
  flex-shrink: 0;
}

.ph-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--t3);
  text-transform: uppercase;
}

.pb {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: hidden;
}

#timeline {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-right: 4px;
}

#timeline::-webkit-scrollbar {
  width: 8px;
}

#timeline::-webkit-scrollbar-track {
  background: transparent;
}

#timeline::-webkit-scrollbar-thumb {
  background: var(--b2);
  border-radius: 999px;
}

#timeline::-webkit-scrollbar-thumb:hover {
  background: var(--b3);
}

.incident-note {
  padding: 12px 13px;
  border-radius: 8px;
  border: 1px solid var(--b1);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.00)), var(--s1);
  font-size: 11px;
  line-height: 1.5;
  color: var(--t2);
  margin-bottom: 8px;
}

#metrics {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Metrics */
.mrow { display: grid; gap: 4px; }

.mh {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.m-lbl { font-size: 11px; color: var(--t2); }

.m-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

.mbar {
  height: 3px;
  background: var(--b1);
  border-radius: 99px;
  overflow: hidden;
}

.mfill {
  height: 100%;
  border-radius: 99px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Timeline */
.tli {
  padding: 8px 10px;
  background: var(--s1);
  border: 1px solid var(--b1);
  border-radius: 6px;
  display: grid;
  gap: 3px;
  flex-shrink: 0;
}

.tli-resolved {
  opacity: 0.8;
}

.tli-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tli-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.tli-title {
  font-size: 11px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--t1);
}

.tli-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--t3);
  flex-shrink: 0;
}

.tli-text {
  font-size: 10px;
  color: var(--t3);
  padding-left: 11px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.tli-meta {
  font-size: 9px;
  color: var(--t3);
  padding-left: 11px;
  font-family: 'JetBrains Mono', monospace;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ── FOOTER ──────────────────────────────────── */
.footer {
  background: var(--s1);
  border-top: 1px solid var(--b1);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
}

.f-notice {
  font-size: 10px;
  color: var(--t3);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

.f-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.f-links a {
  font-size: 10px;
  color: var(--t3);
  font-family: 'JetBrains Mono', monospace;
  transition: color 0.15s;
}
.f-links a:hover { color: var(--t1); }

.f-dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--b3);
}

/* ── STATE COLOURS ───────────────────────────── */
.ok    { color: var(--ok); }
.warn  { color: var(--warn); }
.bad   { color: var(--bad); }
.maint { color: var(--maint); }
.off   { color: var(--off); }

/* ── ANIMATIONS ──────────────────────────────── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.svc { animation: fadeUp 0.4s ease both; }

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(61,214,140,0.16); transform: translateY(0); }
  50% { box-shadow: 0 0 0 10px rgba(61,214,140,0.00); transform: translateY(-1px); }
  100% { box-shadow: 0 0 0 0 rgba(61,214,140,0.00); transform: translateY(0); }
}

@keyframes newEventReveal {
  from { opacity: 0; transform: translateY(8px); border-color: var(--ok-b); }
  to { opacity: 1; transform: translateY(0); border-color: var(--b1); }
}

.live-updated {
  animation: livePulse 0.55s ease;
}

.tli-new {
  animation: newEventReveal 0.55s ease;
}

@media (max-width: 1100px) {
  html, body {
    overflow: auto;
  }

  .wrap {
    grid-template-rows: auto 1fr auto;
    height: auto;
    min-height: 100vh;
  }

  .body {
    grid-template-columns: 1fr;
  }

  .left {
    border-right: none;
    border-bottom: 1px solid var(--b1);
  }

  .svcs {
    grid-template-columns: 1fr 1fr;
    overflow: visible;
  }

  .right {
    grid-template-rows: auto auto;
  }
}

@media (max-width: 720px) {
  .nav {
    padding: 12px 14px;
    height: auto;
    flex-wrap: wrap;
  }

  .wrap {
    grid-template-rows: auto auto auto;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .svcs {
    grid-template-columns: 1fr;
  }

  .footer {
    padding: 10px 14px;
    height: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .f-notice {
    white-space: normal;
  }
}
