:root {
  --bg: #070a10;
  --bg-2: #0b1018;
  --panel: #10161f;
  --panel-2: #141c27;
  --line: #1e2733;
  --line-2: #263140;
  --text: #e7eef6;
  --muted: #8496a8;
  --muted-2: #5f7185;

  --accent: #7cf03d;     /* signal green */
  --cyan: #35d0e0;       /* rx */
  --amber: #ffb020;      /* feed A */
  --violet: #a874ff;     /* feed B */
  --danger: #ff5c6c;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1100px 600px at 82% -8%, rgba(124, 240, 61, 0.07), transparent 60%),
    radial-gradient(900px 500px at 5% 0%, rgba(53, 208, 224, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }

h1, h2 { font-family: 'Space Grotesk', sans-serif; margin: 0; letter-spacing: -0.01em; }

/* Faint moving scan line for datacenter vibe */
.scanline {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.014) 0px,
    rgba(255, 255, 255, 0.014) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 1;
  mix-blend-mode: overlay;
}

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 26px;
  background: rgba(7, 10, 16, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(140deg, #10321a, #0a1710);
  border: 1px solid #234b2a;
  display: grid; place-items: center;
  box-shadow: 0 0 22px -6px rgba(124, 240, 61, 0.5);
}
.brand-mark .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 1px var(--accent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px; letter-spacing: 0.28em; font-weight: 700;
}
.brand-text span { font-size: 11px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.site-pill {
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
}
.status-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(124, 240, 61, 0.28);
  background: rgba(124, 240, 61, 0.08);
  color: #c9f7a8;
  font-size: 12.5px; font-weight: 500;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(124, 240, 61, 0.55);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(124, 240, 61, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(124, 240, 61, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 240, 61, 0); }
}

/* ---------------- Layout ---------------- */
.wrap {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 26px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------- Identity ---------------- */
.identity { padding: 26px 28px; overflow: hidden; position: relative; }
.identity::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(600px 200px at 90% -40%, rgba(124, 240, 61, 0.09), transparent 70%);
  pointer-events: none;
}
.identity-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.badge {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: #0a1206;
  background: linear-gradient(135deg, var(--accent), #b6ff6a);
  padding: 4px 10px; border-radius: 6px;
}
.cust-id { color: var(--muted); font-size: 12.5px; letter-spacing: 0.05em; }
.identity h1 { font-size: 30px; font-weight: 700; margin-bottom: 20px; }

.identity-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}
.meta-label {
  display: block;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--muted-2); margin-bottom: 6px;
}
.meta-value { font-size: 13.5px; color: var(--text); line-height: 1.45; }

/* ---------------- Grid 2 ---------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.count-chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line-2);
  padding: 2px 9px; border-radius: 999px;
}

/* Contacts */
.contacts-list { padding: 8px 12px 12px; }
.contact {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}
.contact:hover { background: var(--panel-2); }
.contact + .contact { border-top: 1px solid var(--line); }
.avatar {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 14px;
  color: #0a1206;
  background: linear-gradient(135deg, var(--cyan), #6fe0ec);
}
.contact.primary .avatar { background: linear-gradient(135deg, var(--accent), #b6ff6a); }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.tag-primary {
  font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(124, 240, 61, 0.4);
  border-radius: 4px; padding: 1px 5px; font-weight: 600;
}
.contact-role { font-size: 12px; color: var(--muted); }
.contact-links { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.contact-links a { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--muted); text-decoration: none; }
.contact-links a:hover { color: var(--cyan); }

/* Products */
.products-list {
  padding: 14px;
  display: grid;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
}
.product {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.product:hover { transform: translateX(3px); border-color: var(--line-2); }
.product-name { font-weight: 600; font-size: 13.5px; }
.product-detail { font-size: 11.5px; color: var(--muted); grid-column: 1; }
.product-cat {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--cyan); align-self: start; text-align: right;
}
.product-ref {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted-2);
  grid-column: 2; text-align: right; align-self: end;
}
.pstatus {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; letter-spacing: 0.04em;
}
.pstatus::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.pstatus.active { color: #c9f7a8; }
.pstatus.active::before { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.pstatus.pending { color: var(--amber); }
.pstatus.pending::before { background: var(--amber); box-shadow: 0 0 6px var(--amber); }

/* ---------------- Metric cards ---------------- */
.metric-card { padding: 22px 24px 20px; transition: border-color 0.2s ease; }
.metric-card:hover { border-color: var(--line-2); }

.metric-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 14px;
}
.metric-head h2 { font-size: 16px; font-weight: 600; }
.metric-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 5px; }

.metric-kpis { display: flex; gap: 26px; }
.kpi { text-align: right; }
.kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-2); }
.kpi-value { font-family: 'IBM Plex Mono', monospace; font-size: 19px; font-weight: 600; margin-top: 2px; }
.kpi-value .unit { font-size: 11px; color: var(--muted); margin-left: 3px; font-weight: 400; }
.kpi-value .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* 30-day stat strip */
.stat-strip {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 12px;
}
.stat-chip {
  display: flex; flex-direction: column; gap: 3px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  min-width: 130px;
}
.stat-chip-label {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted-2);
  display: flex; align-items: center; gap: 6px;
}
.stat-chip-label .swatch { width: 8px; height: 8px; border-radius: 2px; }
.stat-chip-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px; font-weight: 600; color: var(--text);
}
.stat-chip-val .unit { font-size: 10.5px; color: var(--muted); margin-left: 3px; font-weight: 400; }

/* Sparkline */
.spark-row { position: relative; }
.spark-wrap {
  position: relative;
  height: 54px;
  cursor: crosshair;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.spark-wrap:hover { border-color: var(--line-2); background: rgba(255, 255, 255, 0.012); }
.spark-wrap canvas { display: block; }
.spark-hint {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted-2);
  letter-spacing: 0.03em;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(7, 10, 16, 0.6);
  border: 1px solid var(--line);
  opacity: 0.85; transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.hint-arrow { color: var(--accent); }
.metric-card.open .spark-hint { opacity: 0; }

/* Expand region */
.expand {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease, margin-top 0.3s ease;
  margin-top: 0;
}
.metric-card.open .expand {
  max-height: 460px;
  opacity: 1;
  margin-top: 16px;
}
.expand-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}
.range-group { display: inline-flex; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.range-group button {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px; font-weight: 500;
  color: var(--muted);
  background: transparent; border: none; cursor: pointer;
  padding: 5px 12px; border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.range-group button:hover { color: var(--text); }
.range-group button.active { color: #0a1206; background: var(--accent); }
.pin-btn {
  font-size: 12px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 12px; cursor: pointer;
  transition: all 0.15s ease;
}
.pin-btn:hover { color: var(--text); border-color: var(--line-2); }
.pin-btn.pinned { color: var(--accent); border-color: rgba(124, 240, 61, 0.4); background: rgba(124, 240, 61, 0.08); }

.big-chart { height: 300px; position: relative; }

/* ---------------- Footer ---------------- */
.foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 4px; margin-top: 4px;
  font-size: 11px; color: var(--muted-2);
}

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .identity-meta { grid-template-columns: 1fr 1fr; }
  .metric-kpis { gap: 18px; }
}
@media (max-width: 560px) {
  .wrap { padding: 18px 14px 48px; }
  .topbar { padding: 12px 16px; }
  .site-pill { display: none; }
  .identity-meta { grid-template-columns: 1fr; }
  .identity h1 { font-size: 23px; }
  .metric-head { flex-direction: column; }
  .kpi { text-align: left; }
}

/* Loading shimmer */
.skeleton { color: transparent !important; position: relative; overflow: hidden; border-radius: 6px; background: var(--panel-2); }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
