:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --surface: #111620;
  --surface-2: #171d28;
  --line: #283140;
  --line-soft: #202734;
  --text: #f5f7fa;
  --muted: #929dad;
  --green: #8fe36f;
  --green-dark: #193422;
  --amber: #ffbf5b;
  --amber-dark: #392a16;
  --red: #ff6b67;
  --red-dark: #3c1d22;
  --blue: #76a9ff;
  --cyan: #65d5d0;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: var(--bg); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }
.skip-link { position: fixed; top: -50px; left: 16px; z-index: 100; padding: 10px 14px; background: var(--text); color: var(--bg); border-radius: 8px; }
.skip-link:focus { top: 12px; }

.topbar { height: 72px; padding: 0 max(24px, calc((100vw - 1440px) / 2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); background: rgba(11,14,20,.94); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-size: 14px; letter-spacing: .18em; }
.brand strong { font-weight: 700; color: var(--green); }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--green); color: #0a140c; border-radius: 10px; }
.brand-mark svg { width: 25px; fill: currentColor; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.environment { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 61px; }
.icon-button, .close-button { border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; }
.icon-button:hover { border-color: #566274; background: var(--surface-2); }
.icon-button:active { transform: scale(.94); }
.icon-button.loading svg { animation: spin 1s linear infinite; }
.icon-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

main { width: min(1440px, 100%); margin: 0 auto; padding: 48px 24px 72px; }
.hero { min-height: 250px; display: flex; align-items: center; justify-content: space-between; gap: 40px; border-bottom: 1px solid var(--line-soft); }
.hero-copy { max-width: 820px; }
.eyebrow { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 5px rgba(146,157,173,.08); }
.live-dot.healthy { background: var(--green); box-shadow: 0 0 0 5px rgba(143,227,111,.1); }
.live-dot.degraded { background: var(--amber); box-shadow: 0 0 0 5px rgba(255,191,91,.1); }
.live-dot.unhealthy { background: var(--red); box-shadow: 0 0 0 5px rgba(255,107,103,.1); }
h1 { margin: 0; font-size: clamp(36px, 5.5vw, 72px); line-height: .98; letter-spacing: -.055em; font-weight: 650; max-width: 850px; }
.hero-copy > p:not(.eyebrow) { margin: 22px 0 0; max-width: 690px; color: var(--muted); font-size: 17px; line-height: 1.55; }
.freshness { margin-top: 20px; display: flex; align-items: center; gap: 9px; color: #707b8b; font-size: 12px; }
.system-score { display: flex; align-items: center; gap: 18px; min-width: 240px; }
.system-score > div:last-child { display: flex; flex-direction: column; gap: 5px; }
.system-score strong { font-size: 14px; }
.system-score span { color: var(--muted); font-size: 12px; }
.score-ring { --score: 0; --score-color: var(--muted); width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--score-color) calc(var(--score) * 1%), var(--line-soft) 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 7px; background: var(--bg); border-radius: 50%; }
.score-ring span { position: relative; color: var(--text); font-size: 25px; font-weight: 650; font-variant-numeric: tabular-nums; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 76px; border: 1px solid var(--line-soft); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.metric-card { min-height: 145px; padding: 25px 28px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line-soft); background: #0e1219; }
.metric-card:last-child { border-right: 0; }
.metric-card strong { margin: 8px 0 4px; font-size: 31px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-card > span:last-child { color: var(--muted); font-size: 12px; }
.metric-label { color: #b3bdc9; font-size: 12px; font-weight: 600; }
.accent-card { background: #101b18; }
.accent-card strong { color: var(--green); }

.section-block { margin-bottom: 64px; }
.section-heading, .panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.section-heading { margin-bottom: 22px; }
.section-heading .eyebrow, .panel-heading .eyebrow { margin-bottom: 8px; }
h2 { margin: 0; font-size: 24px; letter-spacing: -.025em; font-weight: 620; }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.segmented button { border: 0; padding: 7px 11px; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.segmented button.active { background: #293240; color: var(--text); }
.segmented span { min-width: 18px; margin-left: 4px; padding: 1px 5px; border-radius: 999px; background: var(--line); font-size: 10px; }

.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.service-card { min-height: 260px; display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); transition: border-color .2s, transform .2s; overflow: hidden; position: relative; }
.service-card::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 2px; background: var(--status-color, var(--muted)); opacity: .85; }
.service-card:hover { border-color: #364153; transform: translateY(-2px); }
.service-head { display: flex; justify-content: space-between; gap: 18px; }
.service-identity { display: flex; align-items: center; gap: 13px; }
.service-monogram { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #202735; color: #d8dee8; font-weight: 700; font-size: 13px; }
.service-title h3 { margin: 0 0 5px; font-size: 17px; letter-spacing: -.02em; }
.service-title p { margin: 0; color: var(--muted); font-size: 11px; }
.status-pill { height: fit-content; display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid currentColor; border-radius: 999px; color: var(--status-color); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.service-description { min-height: 42px; margin: 22px 0 18px; color: #a7b1bf; font-size: 13px; line-height: 1.55; }
.service-observation { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.observation-item { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.observation-item span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.observation-item strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.sparkline { width: 100%; height: 25px; overflow: visible; }
.sparkline polyline { fill: none; stroke: var(--status-color); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.service-foot { margin-top: auto; padding-top: 17px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.otel-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.otel-badge::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--badge-color, var(--muted)); }
.card-actions { display: flex; gap: 8px; }
.card-link, .detail-button { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: #cbd2dc; text-decoration: none; font-size: 11px; cursor: pointer; }
.card-link:hover, .detail-button:hover { background: var(--surface-2); border-color: #495669; }

.skeleton-card { height: 260px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: linear-gradient(100deg, var(--surface) 30%, #1b2230 45%, var(--surface) 60%); background-size: 300% 100%; animation: shimmer 1.7s infinite; }
.empty-state { grid-column: 1 / -1; padding: 50px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

.lower-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 14px; }
.panel { padding: 25px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); }
.panel-hint { color: var(--muted); font-size: 11px; }
.dependency-map { margin-top: 28px; display: flex; flex-direction: column; gap: 10px; }
.dependency-row { display: grid; grid-template-columns: minmax(130px, .8fr) 30px minmax(180px, 1.2fr); align-items: center; gap: 10px; }
.dependency-node { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #0f141d; font-size: 12px; }
.dependency-node strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dependency-node::before { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--status-color); }
.dependency-arrow { color: #586475; text-align: center; }
.dependency-targets { display: flex; flex-wrap: wrap; gap: 7px; }
.dependency-targets .dependency-node { flex: 1 1 120px; }
.telemetry-links { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.telemetry-link { min-height: 76px; padding: 13px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 11px; text-decoration: none; background: #0f141d; transition: border-color .2s, background .2s; }
.telemetry-link:hover { border-color: var(--blue); background: #131a26; }
.telemetry-link span { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.telemetry-link strong { font-size: 13px; }
.telemetry-placeholder { color: var(--muted); font-size: 12px; }
.protocol-link { margin-top: 18px; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line-soft); text-decoration: none; }
.protocol-link span { display: flex; flex-direction: column; gap: 5px; }
.protocol-link strong { font-size: 12px; }
.protocol-link small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.protocol-link svg { width: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; }

footer { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 36px; display: flex; justify-content: space-between; border-top: 1px solid var(--line-soft); color: #667181; font-size: 11px; }

dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid #394658; border-radius: 20px; color: var(--text); background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.55); }
dialog::backdrop { background: rgba(3,5,8,.72); backdrop-filter: blur(5px); }
.dialog-head { padding: 25px 25px 18px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.close-button { width: 34px; height: 34px; border-radius: 10px; font-size: 22px; line-height: 1; }
.dialog-description { margin: 0; padding: 20px 25px 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.dialog-status { margin: 18px 25px 0; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--status-color); border-radius: 9px; color: #cbd3dd; font-size: 12px; }
.detail-list { margin: 20px 25px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; }
.detail-list div { padding: 11px 13px; border-bottom: 1px solid var(--line-soft); }
.detail-list div:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.detail-list dt { margin-bottom: 4px; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; }
.dialog-actions { padding: 18px 25px 24px; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line-soft); }
.dialog-actions a { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; font-size: 12px; }
.dialog-actions a.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.toast { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: 360px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 10px; background: #1b2330; color: var(--text); font-size: 12px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card:nth-child(2) { border-right: 0; }
  .metric-card:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .lower-grid { grid-template-columns: 1fr; }
  .service-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .topbar { padding-inline: 16px; }
  .environment, .clock { display: none; }
  main { padding: 32px 16px 56px; }
  .hero { min-height: 0; padding: 32px 0 40px; display: block; }
  .system-score { margin-top: 32px; }
  .metric-grid { margin-bottom: 54px; }
  .metric-card { min-height: 120px; padding: 20px; }
  .metric-card strong { font-size: 25px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .segmented { align-self: stretch; }
  .segmented button { flex: 1; }
  .service-card { padding: 19px; }
  .service-observation { grid-template-columns: 1fr 1fr; }
  .observation-item:last-child { grid-column: 1 / -1; }
  .service-foot { align-items: flex-start; flex-direction: column; }
  .card-actions { width: 100%; }
  .card-actions > * { flex: 1; text-align: center; }
  .panel { padding: 20px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .dependency-row { grid-template-columns: 1fr 22px 1fr; }
  .dependency-targets { display: grid; }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list div:nth-child(odd) { border-right: 0; }
  footer { width: calc(100% - 32px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
