:root {
  --primary:      #2563eb;
  --accent:       #1e40af;
  --bg:           #0f172a;
  --surface:      #1e293b;
  --surface-2:    #334155;
  --text:         #f1f5f9;
  --text-muted:   #94a3b8;
  --border:       rgba(255, 255, 255, 0.07);
  --ok:           #22c55e;
  --warning:      #f59e0b;
  --error:        #ef4444;
  --radius:       12px;
  --gap:          20px;
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background:  var(--bg);
  color:       var(--text);
  min-height:  100vh;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  position:         sticky;
  top:              0;
  z-index:          10;
  background:       rgba(15, 23, 42, 0.85);
  backdrop-filter:  blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom:    1px solid var(--border);
}

.topbar-inner {
  max-width:  1400px;
  margin:     0 auto;
  padding:    16px 24px;
  display:    flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo         { height: 32px; width: auto; }
.logo.hidden  { display: none; }

.brand-name {
  font-size:      1.05rem;
  font-weight:    600;
  letter-spacing: -0.01em;
  color:          var(--text);
}

.last-updated {
  font-size:  0.78rem;
  color:      var(--text-muted);
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

main {
  max-width: 1400px;
  margin:    0 auto;
  padding:   32px 24px;
}

.cards-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap:                   var(--gap);
  align-items:           start;
}

/* ── State messages ──────────────────────────────────────────────────────── */

.state-msg {
  text-align: center;
  padding:    80px 24px;
  color:      var(--text-muted);
  font-size:  0.9rem;
}
.state-msg.hidden { display: none; }

/* ── Base card ───────────────────────────────────────────────────────────── */

.card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       24px;
  transition:    box-shadow 0.2s ease;
}
.card:hover   { box-shadow: 0 4px 28px rgba(0, 0, 0, 0.35); }
.card.pinned  { border-color: var(--primary); }

.card-header {
  display:         flex;
  align-items:     flex-start;
  justify-content: space-between;
  margin-bottom:   16px;
  gap:             12px;
}

.card-title {
  font-size:      0.72rem;
  font-weight:    700;
  color:          var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.card-meta {
  display:     flex;
  align-items: center;
  gap:         8px;
  flex-shrink: 0;
}

.pin-badge {
  font-size:      0.68rem;
  font-weight:    700;
  color:          var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-ts {
  font-size:   0.75rem;
  color:       var(--text-muted);
  white-space: nowrap;
}

/* ── Metric card ─────────────────────────────────────────────────────────── */

.card-metric .metric-value {
  font-size:      2.8rem;
  font-weight:    700;
  letter-spacing: -0.03em;
  color:          var(--text);
  line-height:    1;
}

.card-metric .metric-unit {
  font-size:   0.82rem;
  color:       var(--text-muted);
  margin-top:  6px;
}

.card-metric .metric-delta {
  display:       inline-flex;
  align-items:   center;
  margin-top:    14px;
  font-size:     0.78rem;
  font-weight:   600;
  padding:       4px 10px;
  border-radius: 99px;
  background:    rgba(34, 197, 94, 0.12);
  color:         var(--ok);
}

.card-metric .metric-delta.down {
  background: rgba(239, 68, 68, 0.12);
  color:      var(--error);
}

/* ── Content card ────────────────────────────────────────────────────────── */

.card-content .card-body {
  font-size:   0.9rem;
  line-height: 1.75;
  color:       var(--text);
}

/* ── Status card ─────────────────────────────────────────────────────────── */

.card-status .status-row {
  display:       flex;
  align-items:   center;
  gap:           10px;
  margin-bottom: 12px;
}

.status-dot {
  width:        10px;
  height:       10px;
  border-radius: 50%;
  flex-shrink:  0;
}
.status-dot.ok      { background: var(--ok);      box-shadow: 0 0 8px var(--ok); }
.status-dot.warning { background: var(--warning);  box-shadow: 0 0 8px var(--warning); }
.status-dot.error   { background: var(--error);    box-shadow: 0 0 8px var(--error); }

.status-label {
  font-size:      0.82rem;
  font-weight:    600;
  text-transform: capitalize;
}
.status-label.ok      { color: var(--ok); }
.status-label.warning { color: var(--warning); }
.status-label.error   { color: var(--error); }

.card-status .card-body {
  font-size:   0.875rem;
  color:       var(--text-muted);
  line-height: 1.6;
}

/* ── Action card ─────────────────────────────────────────────────────────── */

.card-action .action-list {
  list-style: none;
  display:    flex;
  flex-direction: column;
  gap:        8px;
}

.action-item {
  display:       flex;
  align-items:   flex-start;
  gap:           10px;
  font-size:     0.875rem;
  color:         var(--text);
  padding:       10px 14px;
  background:    var(--surface-2);
  border-radius: 8px;
  line-height:   1.5;
}

.action-item-icon {
  width:        16px;
  height:       16px;
  border-radius: 4px;
  border:       2px solid var(--primary);
  flex-shrink:  0;
  margin-top:   2px;
}

/* ── Tags ────────────────────────────────────────────────────────────────── */

.card-tags {
  display:    flex;
  flex-wrap:  wrap;
  gap:        6px;
  margin-top: 16px;
}

.tag {
  font-size:      0.68rem;
  font-weight:    500;
  padding:        3px 9px;
  border-radius:  99px;
  background:     var(--surface-2);
  color:          var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .topbar-inner { padding: 14px 16px; }
  main          { padding: 20px 16px; }
  .cards-grid   { grid-template-columns: 1fr; }
  .card         { padding: 20px; }
  .card-metric .metric-value { font-size: 2.2rem; }
}
