/* ── Reset & Tokens ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --azure-blue:    #0078d4;
  --azure-blue-dk: #005a9e;
  --green:         #107c10;
  --green-lt:      #dff6dd;
  --red:           #d13438;
  --red-lt:        #fde7e9;
  --yellow:        #ffa500;
  --yellow-lt:     #fff4ce;
  --grey:          #605e5c;
  --grey-lt:       #f3f2f1;
  --bg:            #faf9f8;
  --surface:       #ffffff;
  --border:        #edebe9;
  --text:          #323130;
  --text-muted:    #605e5c;
  --radius:        8px;
  --shadow:        0 2px 8px rgba(0,0,0,.08);
}

body { font-family: "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.header {
  background: var(--azure-blue);
  color: #fff;
  padding: 0 24px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 16px;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.header-logo  { font-size: 28px; line-height: 1; }
.header-title { font-size: 16px; font-weight: 600; }
.header-subtitle { font-size: 12px; opacity: .8; }
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.last-updated { font-size: 12px; opacity: .85; white-space: nowrap; }

.btn { padding: 7px 16px; border-radius: 4px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: background .15s; }
.btn-primary   { background: #fff; color: var(--azure-blue); }
.btn-primary:hover { background: #e8f3fd; }
.btn-secondary { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); }
.btn-secondary:hover { background: rgba(255,255,255,.15); }

/* ── Main ───────────────────────────────────────────────────────────────────── */
.main { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ── Overall Banner ─────────────────────────────────────────────────────────── */
.overall-banner {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; border-radius: var(--radius);
  margin-bottom: 24px; border-left: 5px solid;
  transition: background .3s, border-color .3s;
}
.overall-banner.overall-pending  { background: var(--grey-lt); border-color: var(--grey); }
.overall-banner.overall-healthy  { background: var(--green-lt); border-color: var(--green); }
.overall-banner.overall-degraded { background: var(--red-lt);   border-color: var(--red); }
.overall-banner.overall-loading  { background: var(--yellow-lt); border-color: var(--yellow); }

.overall-status-dot {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  background: var(--grey);
  .overall-healthy  & { background: var(--green); }
  .overall-degraded & { background: var(--red); }
  .overall-loading  & { background: var(--yellow); animation: pulse 1s infinite; }
}
.overall-title { font-size: 16px; font-weight: 600; }
.overall-sub   { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.overall-ms    { margin-left: auto; font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ── Cards Grid ─────────────────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.card-wide { grid-column: 1 / -1; }

/* ── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: border-color .3s, box-shadow .3s;
}
.card.healthy  { border-top: 4px solid var(--green); }
.card.unhealthy{ border-top: 4px solid var(--red); }
.card.degraded { border-top: 4px solid var(--yellow); }
.card.loading  { border-top: 4px solid var(--yellow); }
.card.pending  { border-top: 4px solid var(--border); }

.card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.card-icon { font-size: 24px; line-height: 1; }
.card-title    { font-size: 14px; font-weight: 600; }
.card-endpoint { font-size: 11px; color: var(--text-muted); font-family: monospace; margin-top: 2px; }
.card-status-badge {
  margin-left: auto; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.card-status-badge.pending   { background: var(--grey-lt);   color: var(--grey); }
.card-status-badge.healthy   { background: var(--green-lt);  color: var(--green); }
.card-status-badge.unhealthy { background: var(--red-lt);    color: var(--red); }
.card-status-badge.degraded  { background: var(--yellow-lt); color: #7a4f00; }
.card-status-badge.loading   { background: var(--yellow-lt); color: #7a4f00; }

.card-body { padding: 12px 16px; flex: 1; }

.metric-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.metric-row:last-child { border-bottom: none; }
.metric-label { color: var(--text-muted); }
.metric-value { font-weight: 500; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.btn-card {
  font-size: 12px; padding: 5px 12px; border-radius: 4px; cursor: pointer;
  background: var(--grey-lt); color: var(--text); border: 1px solid var(--border);
  font-weight: 600; transition: background .15s;
}
.btn-card:hover { background: #e1dfdd; }

.card-error { font-size: 11px; color: var(--red); word-break: break-word; }
.hidden { display: none !important; }

/* ── DNS List ───────────────────────────────────────────────────────────────── */
.dns-list { display: flex; flex-wrap: wrap; gap: 8px; }
.dns-placeholder { font-size: 13px; color: var(--text-muted); }
.dns-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 4px; font-size: 12px; font-family: monospace;
}
.dns-item.ok   { background: var(--green-lt); color: var(--green); }
.dns-item.fail { background: var(--red-lt);   color: var(--red); }
.dns-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dns-item.ok   .dns-dot { background: var(--green); }
.dns-item.fail .dns-dot { background: var(--red); }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.footer { text-align: center; padding: 16px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: 8px; }
.footer a { color: var(--azure-blue); text-decoration: none; }

/* ── Fleet Grid ─────────────────────────────────────────────────────────────── */
.fleet-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.fleet-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 4px; font-size: 12px;
  min-width: 200px;
}
.fleet-item.ok   { background: var(--green-lt); color: var(--green); }
.fleet-item.fail { background: var(--red-lt);   color: var(--red); }
.fleet-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fleet-item.ok   .fleet-dot { background: var(--green); }
.fleet-item.fail .fleet-dot { background: var(--red); }
.fleet-name { font-weight: 600; }
.fleet-role { opacity: .7; font-size: 11px; }
.fleet-ms   { margin-left: auto; opacity: .7; }

/* ── Obs Components ──────────────────────────────────────────────────────────── */
.obs-component {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.obs-component:last-child { border-bottom: none; }
.obs-name { font-weight: 500; }
.obs-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.obs-badge.active   { background: var(--green-lt); color: var(--green); }
.obs-badge.inactive { background: var(--yellow-lt); color: #7a4f00; }
.obs-badge.error    { background: var(--red-lt); color: var(--red); }

/* ── Animations ─────────────────────────────────────────────────────────────── */
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
@keyframes spin   { to { transform: rotate(360deg); } }
.spinning { display: inline-block; animation: spin .8s linear infinite; }
