:root {
  --bg: #f3efe6;
  --paper: #fffcf8;
  --ink: #1c2430;
  --muted: #5d6b78;
  --dim: #8a8176;
  --line: rgba(28, 36, 48, 0.1);
  --teal: #16332f;
  --hn: #c4552a;
  --gt: #146b45;
  --sv: #1a4f86;
  --ok: #1d7a4a;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 10px 28px rgba(48, 36, 22, 0.05);
  --ui: Outfit, "Avenir Next", "Segoe UI", sans-serif;
  --serif: Fraunces, Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(196, 85, 42, 0.06), transparent 50%),
    radial-gradient(800px 480px at 100% 0%, rgba(20, 107, 69, 0.05), transparent 46%),
    var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: none; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
::selection { background: rgba(22, 51, 47, 0.16); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(28, 36, 48, 0.18); border-radius: 99px; }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  overflow: hidden;
}

.top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 0 4px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  box-shadow: 0 8px 18px rgba(225, 6, 0, 0.22);
}
.word {
  font-family: var(--ui);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}
.sub { margin-top: 2px; color: var(--muted); font-family: var(--ui); font-size: 13px; letter-spacing: 0; text-transform: none; }
.product { min-width: 0; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.product-name { margin-top: 2px; font-size: 16px; font-weight: 560; }
.product-name span {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--teal);
}
.kpis { display: flex; align-items: flex-end; gap: 16px; }
.kpi span, .clock span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}
.kpi strong, .clock time {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 500;
}
.clock { padding-left: 16px; border-left: 1px solid var(--line); }

.stage {
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1.4fr) minmax(280px, 0.85fr) 360px;
  grid-template-rows: minmax(0, 1.35fr) minmax(200px, 0.72fr);
  gap: 12px;
}
.pubs { grid-column: 1; grid-row: 1 / span 2; }
.map-panel { grid-column: 2 / span 2; grid-row: 1; }
.chart-panel { grid-column: 2; grid-row: 2; }
.dns-panel { grid-column: 3; grid-row: 2; }
.detail { grid-column: 4; grid-row: 1 / span 2; }

.panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.ph {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 0;
}
.ph h2 {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
.meta { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.pb { padding: 12px 14px 14px; min-height: 0; }
.pubs .pb, .detail .pb { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; }

.pub {
  --c: var(--hn);
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.pub.is-on {
  border-color: rgba(28, 36, 48, 0.28);
  background: #fff;
}
.pub-top { display: flex; gap: 8px; align-items: flex-start; }
.pub-top .grow { flex: 1; min-width: 0; }
.pub-country { display: block; font-weight: 600; font-size: 15px; }
.pub-host { display: block; margin-top: 3px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.pub .dot {
  width: 8px; height: 8px; margin-top: 6px; border-radius: 50%;
  background: #1c2430; flex: none; box-shadow: none;
}
.srv .dot {
  width: 7px; height: 7px; margin: 0; border-radius: 50%;
  background: #1c2430; flex: none;
}
.tag, .pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pub.is-on .tag, .pill {
  color: var(--ok);
  border-color: rgba(29, 122, 74, 0.28);
  background: rgba(29, 122, 74, 0.08);
}
.tag.origin {
  color: var(--hn);
  border-color: rgba(196, 85, 42, 0.3);
  background: rgba(196, 85, 42, 0.08);
}
.bar { height: 3px; margin: 10px 0 8px; border-radius: 99px; background: rgba(28, 36, 48, 0.08); }
.pub .bar > span { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: #1c2430; }
.pub-metrics {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
}
.pub-metrics b { color: var(--ink); font-weight: 500; }

.block h3 {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}
.srv-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.usage { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.spark-top { display: flex; justify-content: space-between; align-items: baseline; }
.spark-top span { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.spark-top strong { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.spark-plot { position: relative; height: 34px; margin-top: 2px; }
.spark-plot canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.srv-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.srv-head h3 { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.srv-region { margin: 8px 0 2px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.srv-list, .dns-table { min-height: 0; }
.dns-table { flex: 1; overflow: auto; }
.srv {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 4px 12px;
  border-top: 1px solid rgba(28, 36, 48, 0.05);
}
.srv.is-on { background: rgba(28, 36, 48, 0.045); }
.srv b { display: block; font-size: 12px; font-weight: 600; line-height: 1.2; }
.srv small { display: block; color: var(--muted); font-family: var(--mono); font-size: 10px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv .role { font-family: var(--mono); font-size: 10px; color: var(--dim); text-align: right; }
.mesh {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 8px 12px 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.mesh b { color: var(--ink); font-weight: 500; }
.dns-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 28px minmax(0, 1fr);
  gap: 6px;
  padding: 3px 12px;
  border-top: 1px solid rgba(28, 36, 48, 0.05);
  font-family: var(--mono);
  font-size: 10.5px;
}
.dns-row span:first-child { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dns-row .typ { color: var(--dim); }
.dns-head { color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; }

.map-wrap, .chart-wrap { position: relative; flex: 1; min-height: 0; }
.map-wrap canvas, .chart-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0 0 16px 16px; }
.map-wrap { cursor: crosshair; margin: 8px; border-radius: 12px; overflow: hidden; background: #d5e6ec; }
.map-hud {
  position: absolute; left: 12px; right: 12px; bottom: 10px;
  display: flex; justify-content: space-between; gap: 12px;
  pointer-events: none;
  font-family: var(--mono); font-size: 11px; color: #3d5160;
}
.legend i {
  display: inline-block; width: 16px; margin-right: 6px;
  border-top: 1px dashed #1a4f86; vertical-align: middle;
}
.tip {
  position: absolute; z-index: 2; min-width: 180px; padding: 8px 10px;
  background: #fffcf8; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.12);
  pointer-events: none;
}
.tip strong { display: block; font-size: 13px; }
.tip span { display: block; margin-top: 3px; color: var(--muted); font-family: var(--mono); font-size: 11px; }

.identity .tag { display: inline-flex; }
.identity h3 { margin-top: 8px; font-family: var(--serif); font-size: 32px; font-weight: 560; letter-spacing: -0.03em; }
.host { margin-top: 4px; font-family: var(--mono); font-size: 13px; color: var(--teal); }
.where { margin-top: 4px; color: var(--muted); }
.gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 14px; justify-items: center; }
.gauge { position: relative; width: 76px; }
.gauge svg { width: 100%; height: auto; display: block; }
.g-track { fill: none; stroke: rgba(28, 36, 48, 0.1); stroke-width: 7; }
.g-val {
  fill: none; stroke: var(--c, var(--teal)); stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 263.89; stroke-dashoffset: 263.89;
  transition: stroke-dashoffset 0.7s linear;
}
.g-copy {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.g-copy strong { font-family: var(--mono); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.g-copy span { font-size: 9px; letter-spacing: 0.08em; color: var(--dim); }
.live-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.live-row span { display: block; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.live-row strong { font-family: var(--mono); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.block { margin-top: 16px; }
.spec { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 10px 0 0; }
.spec div { display: grid; gap: 2px; }
.spec .wide { grid-column: 1 / -1; }
.spec dt { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.spec dd { margin: 0; font-family: var(--mono); font-size: 12.5px; }
.foot { margin-top: 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.seg, .chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.seg button, .chips button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #fff;
}
.seg button[aria-pressed="true"], .chips button[aria-pressed="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: #f7f3ea;
}
.chart-meta {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 8px 14px 0;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.feed { flex: 1; overflow: auto; min-height: 0; padding-bottom: 8px; }
.feed-row { padding: 7px 14px; border-top: 1px solid rgba(28, 36, 48, 0.05); font-size: 12.5px; line-height: 1.4; }
.feed-row time { display: block; font-family: var(--mono); font-size: 10px; color: var(--dim); }
.feed-row .src { font-family: var(--mono); font-size: 11px; margin-right: 6px; }

@media (prefers-reduced-motion: reduce) {
  .g-val { transition: none; }
}

@media (max-width: 1180px) {
  body { overflow: auto; height: auto; }
  .app { height: auto; min-height: 100dvh; overflow: visible; }
  .top, .stage { display: flex; flex-direction: column; }
  .kpis { flex-wrap: wrap; }
  .clock { border: 0; padding: 0; }
  .map-wrap { height: 460px; flex: none; }
  .chart-wrap, .srv-list, .dns-table { height: 240px; flex: none; }
  .pubs .pb, .detail .pb { overflow: visible; }
}
@media (max-width: 720px) {
  .spec, .live-row, .gauges { grid-template-columns: 1fr 1fr; }
  .identity h3 { font-size: 28px; }
}
