/* ============================================================
   TELEMETRY DASHBOARD — live ops for jaeswift.xyz
   ============================================================ */

:root {
  --tm-green: #00cc33;
  --tm-green-dim: #00cc33aa;
  --tm-green-glow: rgba(0,204,51,0.4);
  --tm-amber: #c9a227;
  --tm-red: #8b0000;
  --tm-red-bright: #ff2d2d;
  --tm-sol: #14F195;
  --tm-bg: #0a0a0a;
  --tm-panel: #111111;
  --tm-panel-alt: #161616;
  --tm-border: #1c1c1c;
  --tm-border-hot: #00cc3333;
  --tm-text: #c9c9c9;
  --tm-muted: #6b6b6b;
}

/* ─── Boot animation ──────────────────────────────── */
.tm-boot {
  position: fixed; inset: 0;
  background: #000;
  z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  color: var(--tm-green);
  gap: 1.2rem;
  text-shadow: 0 0 8px var(--tm-green-glow);
  transition: opacity 0.5s;
}
.tm-boot.hidden { opacity: 0; pointer-events: none; }
.tm-boot-line {
  font-size: 1rem;
  opacity: 0;
  letter-spacing: 0.12em;
  animation: tm-bootfade 0.4s forwards;
}
.tm-boot-line::before { content: '> '; color: var(--tm-green-dim); }
@keyframes tm-bootfade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.tm-boot-bar {
  width: 300px; height: 3px;
  background: #0a2a0a;
  border: 1px solid var(--tm-border-hot);
  position: relative;
  overflow: hidden;
}
.tm-boot-bar::after {
  content: ''; position: absolute;
  top: 0; left: 0; height: 100%; width: 0;
  background: var(--tm-green);
  box-shadow: 0 0 10px var(--tm-green);
  animation: tm-bootbar 1.3s forwards;
}
@keyframes tm-bootbar { to { width: 100%; } }

/* ─── Dashboard container ─────────────────────────── */
.tm-dashboard {
  padding: 0 1.5rem 4rem;
  max-width: 1800px;
  margin: 0 auto;
  font-family: 'JetBrains Mono', monospace;
  color: var(--tm-text);
  position: relative;
}

/* ─── Alert banner ────────────────────────────────── */
.tm-alerts {
  position: sticky; top: calc(var(--nav-height) + 8px);
  z-index: 100;
  display: none;
  margin-bottom: 1rem;
  border: 1px solid var(--tm-red);
  background: rgba(139,0,0,0.15);
  padding: 0.5rem 0.8rem;
  overflow: hidden;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}
.tm-alerts.visible { display: block; animation: tm-pulse-red 2s infinite; }
.tm-alerts.amber {
  border-color: var(--tm-amber);
  background: rgba(201,162,39,0.1);
  animation: none;
}
@keyframes tm-pulse-red {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,45,45,0.3); }
  50%     { box-shadow: 0 0 0 6px rgba(255,45,45,0); }
}
.tm-alerts-content {
  display: inline-block;
  white-space: nowrap;
  animation: tm-marquee 30s linear infinite;
  padding-left: 100%;
}
.tm-alert-item {
  display: inline-block;
  margin-right: 2.5rem;
}
.tm-alert-item.red { color: var(--tm-red-bright); }
.tm-alert-item.amber { color: var(--tm-amber); }
.tm-alert-item.info { color: var(--tm-green); }
.tm-alert-item::before { content: '▲ '; }
@keyframes tm-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* ─── Top status bar (LIVE indicator) ─────────────── */
.tm-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  background: var(--tm-panel);
  border: 1px solid var(--tm-border);
  margin-bottom: 1.2rem;
  font-size: 0.8rem;
}
.tm-live {
  display: flex; align-items: center; gap: 0.6rem;
  letter-spacing: 0.15em;
}
.tm-live-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--tm-green);
  box-shadow: 0 0 12px var(--tm-green);
  animation: tm-blink 1.2s infinite;
}
.tm-live-dot.amber { background: var(--tm-amber); box-shadow: 0 0 8px var(--tm-amber); }
.tm-live-dot.red { background: var(--tm-red-bright); box-shadow: 0 0 12px var(--tm-red-bright); }
@keyframes tm-blink {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.25; }
}
.tm-visitors {
  display: flex; align-items: center; gap: 0.8rem;
  color: var(--tm-muted);
}
.tm-visitors strong {
  color: var(--tm-sol);
  font-size: 1.1rem;
  text-shadow: 0 0 8px rgba(20,241,149,0.5);
}
.tm-sound-toggle {
  background: none; border: 1px solid var(--tm-border);
  color: var(--tm-muted); cursor: pointer;
  padding: 0.3rem 0.6rem;
  font-family: inherit; font-size: 0.75rem;
  transition: all 0.2s;
}
.tm-sound-toggle:hover { color: var(--tm-green); border-color: var(--tm-green); }
.tm-sound-toggle.on { color: var(--tm-green); border-color: var(--tm-green); }

/* ─── Grid layout ─────────────────────────────────── */
.tm-row {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}
.tm-row.r1 { grid-template-columns: repeat(4, 1fr); }
.tm-row.r2 { grid-template-columns: 1.2fr 1fr; }
.tm-row.r3 { grid-template-columns: 1fr; }
.tm-row.r4 { grid-template-columns: 1.3fr 1fr; }
.tm-row.r5 { grid-template-columns: 1fr 1.3fr; }
.tm-row.r6 { grid-template-columns: 1.3fr 1fr; }
.tm-row.r7 { grid-template-columns: 1fr 1.3fr; }

@media (max-width: 1200px) {
  .tm-row.r1 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .tm-dashboard { padding: 0 0.6rem 3rem; }
  .tm-row,
  .tm-row.r1, .tm-row.r2, .tm-row.r4,
  .tm-row.r5, .tm-row.r6, .tm-row.r7 {
    grid-template-columns: 1fr;
  }
  .tm-alerts { font-size: 0.72rem; }
}

/* ─── Panel base ──────────────────────────────────── */
.tm-panel {
  background: var(--tm-panel);
  border: 1px solid var(--tm-border);
  padding: 0.8rem 1rem 1rem;
  position: relative;
  min-height: 0;
  overflow: hidden;
  transition: border-color 0.3s;
}
.tm-panel:hover { border-color: var(--tm-border-hot); }
.tm-panel-title {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--tm-green-dim);
  margin-bottom: 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--tm-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tm-panel-title::before { content: '▸ '; color: var(--tm-green); }
.tm-panel-title .badge {
  background: rgba(0,204,51,0.1);
  color: var(--tm-green);
  padding: 1px 6px;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  border: 1px solid var(--tm-border-hot);
}

/* ─── Gauges (CPU/MEM) ────────────────────────────── */
.tm-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.tm-gauge-canvas {
  width: 140px; height: 140px;
  max-width: 100%;
}
.tm-gauge-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--tm-green);
  text-shadow: 0 0 10px var(--tm-green-glow);
  letter-spacing: 0.05em;
}
.tm-gauge-value.warn { color: var(--tm-amber); text-shadow: 0 0 10px rgba(201,162,39,0.5); }
.tm-gauge-value.crit { color: var(--tm-red-bright); text-shadow: 0 0 10px rgba(255,45,45,0.6); }
.tm-gauge-label {
  font-size: 0.7rem;
  color: var(--tm-muted);
  letter-spacing: 0.12em;
}
.tm-spark {
  width: 100%; height: 40px;
  margin-top: 0.5rem;
  background: #000;
  border: 1px solid var(--tm-border);
}

/* ─── Disk bars ──────────────────────────────────── */
.tm-disks { display: flex; flex-direction: column; gap: 0.7rem; }
.tm-disk {
  display: flex; flex-direction: column; gap: 0.2rem;
  font-size: 0.72rem;
}
.tm-disk-head {
  display: flex; justify-content: space-between;
  color: var(--tm-text);
}
.tm-disk-head .mount { color: var(--tm-green); }
.tm-disk-bar {
  font-family: 'JetBrains Mono', monospace;
  color: var(--tm-green);
  letter-spacing: -0.5px;
  font-size: 0.9rem;
  line-height: 1;
}
.tm-disk-bar.warn { color: var(--tm-amber); }
.tm-disk-bar.crit { color: var(--tm-red-bright); }

/* ─── Network ────────────────────────────────────── */
.tm-net {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
}
.tm-net-row {
  display: flex; justify-content: space-between;
  align-items: baseline;
  padding: 0.2rem 0;
}
.tm-net-row .label { color: var(--tm-muted); font-size: 0.7rem; letter-spacing: 0.15em; }
.tm-net-row .val {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.25rem;
  color: var(--tm-sol);
  text-shadow: 0 0 8px rgba(20,241,149,0.4);
}
.tm-net-row .val.tx { color: var(--tm-green); text-shadow: 0 0 8px var(--tm-green-glow); }

/* ─── Tables (services, crons) ─────────────────────── */
.tm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
}
.tm-table th {
  text-align: left;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--tm-border);
  color: var(--tm-muted);
  letter-spacing: 0.1em;
  font-weight: 400;
}
.tm-table td {
  padding: 0.4rem;
  border-bottom: 1px dashed #1a1a1a;
}
.tm-table tr:hover td { background: rgba(0,204,51,0.04); }
.tm-table .svc-name { color: var(--tm-text); font-weight: 500; }
.tm-table .dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.dot.up { background: var(--tm-green); box-shadow: 0 0 8px var(--tm-green); animation: tm-blink 1.6s infinite; }
.dot.down { background: var(--tm-red-bright); box-shadow: 0 0 8px var(--tm-red-bright); }
.dot.unknown { background: var(--tm-muted); }
.dot.warn { background: var(--tm-amber); box-shadow: 0 0 6px var(--tm-amber); }

.tm-table .cron-status.ok { color: var(--tm-green); }
.tm-table .cron-status.fail { color: var(--tm-red-bright); }
.tm-table .cron-status.unknown { color: var(--tm-muted); }

.tm-expandable { cursor: pointer; }
.tm-expanded-row {
  background: #0d0d0d;
  padding: 0.6rem 0.8rem;
  color: var(--tm-muted);
  font-size: 0.68rem;
  white-space: pre-wrap;
  max-height: 160px;
  overflow: auto;
}

/* ─── Nginx stats ────────────────────────────────── */
.tm-nginx-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
@media (max-width: 768px) { .tm-nginx-grid { grid-template-columns: repeat(2, 1fr); } }
.tm-stat {
  background: var(--tm-panel-alt);
  padding: 0.6rem 0.8rem;
  border-left: 2px solid var(--tm-green);
  text-align: left;
}
.tm-stat .v {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  color: var(--tm-green);
  text-shadow: 0 0 6px var(--tm-green-glow);
  display: block;
}
.tm-stat .l {
  font-size: 0.65rem;
  color: var(--tm-muted);
  letter-spacing: 0.1em;
  margin-top: 0.2rem;
}
.tm-stat.err { border-left-color: var(--tm-red-bright); }
.tm-stat.err .v { color: var(--tm-red-bright); text-shadow: 0 0 6px rgba(255,45,45,0.4); }

.tm-toppages {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  font-size: 0.72rem;
}
@media (max-width: 768px) { .tm-toppages { grid-template-columns: 1fr; } }
.tm-toppages ul { list-style: none; padding: 0; margin: 0; }
.tm-toppages li {
  display: flex; justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px dashed #1a1a1a;
}
.tm-toppages li .path {
  color: var(--tm-text);
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}
.tm-toppages li .c {
  color: var(--tm-sol);
  font-family: 'Orbitron', sans-serif;
}
.tm-toppages h4 {
  color: var(--tm-green-dim);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  margin: 0 0 0.3rem;
  font-weight: 400;
}

/* ─── Security / SSL panels ───────────────────────── */
.tm-security-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.tm-jails {
  font-size: 0.72rem;
  margin-top: 0.5rem;
}
.tm-jails .jail {
  display: flex; justify-content: space-between;
  padding: 0.2rem 0;
  border-bottom: 1px dashed #1a1a1a;
}
.tm-ssl { font-size: 0.74rem; }
.tm-ssl .ssl-row {
  display: flex; justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px dashed #1a1a1a;
}
.tm-ssl .days {
  font-family: 'Orbitron', sans-serif;
  color: var(--tm-green);
}
.tm-ssl .days.warn { color: var(--tm-amber); }
.tm-ssl .days.crit { color: var(--tm-red-bright); }
.tm-ssl .days.fail { color: var(--tm-muted); }

/* ─── Stack inventory ─────────────────────────────── */
.tm-stack {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}
.tm-stack-item {
  background: var(--tm-panel-alt);
  border: 1px solid var(--tm-border);
  padding: 0.45rem 0.6rem;
  font-size: 0.72rem;
}
.tm-stack-item .k {
  color: var(--tm-muted); font-size: 0.62rem;
  letter-spacing: 0.1em; display: block;
}
.tm-stack-item .v {
  color: var(--tm-green);
  font-family: 'Orbitron', sans-serif;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  margin-top: 0.15rem;
}

/* ─── Repos ───────────────────────────────────────── */
.tm-repo {
  background: var(--tm-panel-alt);
  padding: 0.6rem 0.8rem;
  border-left: 2px solid var(--tm-sol);
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
}
.tm-repo-head {
  display: flex; justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}
.tm-repo-head .name { color: var(--tm-sol); font-weight: 600; }
.tm-repo-head .sha {
  font-family: 'JetBrains Mono', monospace;
  color: var(--tm-amber);
  background: rgba(201,162,39,0.08);
  padding: 1px 6px;
  font-size: 0.68rem;
}
.tm-repo .msg { color: var(--tm-text); margin-bottom: 0.2rem; }
.tm-repo .meta { color: var(--tm-muted); font-size: 0.68rem; }
.tm-repo .dirty-badge {
  color: var(--tm-red-bright);
  margin-left: 0.5rem;
  animation: tm-blink 1.4s infinite;
}

/* ─── Geo map ─────────────────────────────────────── */
.tm-geo {
  width: 100%;
  min-height: 280px;
  position: relative;
}
.tm-geo svg { width: 100%; height: auto; display: block; }
.tm-geo .country { fill: #1a2a1a; stroke: #0a0a0a; stroke-width: 0.5; transition: fill 0.3s; }
.tm-geo .country.hot { fill: var(--tm-green); }
.tm-geo .country:hover { fill: var(--tm-sol); cursor: pointer; }
.tm-geo-legend {
  position: absolute;
  bottom: 0.5rem; left: 0.5rem;
  font-size: 0.65rem;
  color: var(--tm-muted);
  background: rgba(0,0,0,0.7);
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--tm-border);
}
.tm-geo-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--tm-muted);
  font-size: 0.75rem;
}
.tm-geo-top {
  margin-top: 0.6rem;
  font-size: 0.7rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.3rem;
}
.tm-geo-top .c-item {
  display: flex; justify-content: space-between;
  padding: 0.15rem 0.4rem;
  background: rgba(0,204,51,0.05);
  border-left: 2px solid var(--tm-green);
}
.tm-geo-top .c-item .n { color: var(--tm-green); font-family: 'Orbitron', sans-serif; }

/* ─── Terminal tail ────────────────────────────────── */
.tm-tail {
  background: #000;
  border: 1px solid var(--tm-border);
  padding: 0.6rem;
  min-height: 280px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.7rem;
  line-height: 1.4;
  font-family: 'JetBrains Mono', monospace;
}
.tm-tail::-webkit-scrollbar { width: 6px; }
.tm-tail::-webkit-scrollbar-thumb { background: #1a2a1a; }
.tm-tail-line {
  opacity: 0;
  animation: tm-fadein 0.4s forwards;
  padding: 1px 0;
  border-bottom: 1px dotted #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes tm-fadein {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}
.tm-tail-line .st-2xx { color: var(--tm-green); }
.tm-tail-line .st-3xx { color: var(--tm-sol); }
.tm-tail-line .st-4xx { color: var(--tm-amber); }
.tm-tail-line .st-5xx { color: var(--tm-red-bright); }
.tm-tail-line .method { color: var(--tm-green-dim); }
.tm-tail-line .path { color: var(--tm-text); }
.tm-tail-line .ip { color: var(--tm-muted); }
.tm-tail-line .time { color: #3a3a3a; font-size: 0.62rem; }

/* ─── Burn rate / deploys ─────────────────────────── */
.tm-burn {
  font-size: 0.85rem;
  color: var(--tm-text);
  line-height: 1.9;
}
.tm-burn .big {
  font-family: 'Orbitron', sans-serif;
  color: var(--tm-amber);
  font-size: 1.1rem;
  text-shadow: 0 0 6px rgba(201,162,39,0.4);
}
.tm-burn .label { color: var(--tm-muted); font-size: 0.72rem; letter-spacing: 0.1em; display: block; }

.tm-ticker {
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 0.4rem 0;
}
.tm-ticker-inner {
  display: inline-block;
  animation: tm-marquee 60s linear infinite;
  padding-left: 100%;
}
.tm-ticker-item {
  display: inline-block;
  margin-right: 2rem;
  color: var(--tm-text);
}
.tm-ticker-item .sha {
  color: var(--tm-amber);
  font-family: 'JetBrains Mono', monospace;
  margin-right: 0.5rem;
}
.tm-ticker-item .iso { color: var(--tm-muted); margin-left: 0.6rem; font-size: 0.65rem; }

/* ─── Loading & error states ──────────────────────── */
.tm-loading {
  color: var(--tm-muted);
  font-size: 0.72rem;
  padding: 1rem 0;
  text-align: center;
  letter-spacing: 0.1em;
}
.tm-loading::after {
  content: '...';
  animation: tm-dots 1.4s infinite;
}
@keyframes tm-dots {
  0%,20% { content: '.'; }
  40%    { content: '..'; }
  60%    { content: '...'; }
  80%,100% { content: '....'; }
}
.tm-err { color: var(--tm-red-bright); font-size: 0.72rem; padding: 0.5rem 0; }
