:root {
  color-scheme: dark;
  --bg: #0f172a;
  --card: #1e293b;
  --card-2: #162033;
  --border: #334155;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 1180px;
  background:
    radial-gradient(circle at 20% 0%, rgba(16, 185, 129, 0.08), transparent 28rem),
    linear-gradient(180deg, #111c31 0%, var(--bg) 26rem);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--text);
  font-size: 26px;
  font-weight: 760;
  letter-spacing: 0;
}

h2 {
  color: var(--text);
  font-size: 16px;
  font-weight: 720;
  letter-spacing: 0;
}

p,
span,
dt {
  color: var(--muted);
}

.mono,
.num,
strong,
td.num,
th.num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.shell {
  width: min(1800px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 20px 0 30px;
}

.top,
.panelHead,
.statusRow,
.cardTitleRow,
.switchCard,
.progressCard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.top {
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  background: rgba(30, 41, 59, 0.96);
  box-shadow: var(--shadow);
}

.top p {
  margin-top: 5px;
  font-size: 13px;
}

.readonly,
.pill {
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 740;
  line-height: 1;
  white-space: nowrap;
}

.readonly {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.14);
  color: var(--muted);
}

.pill.ok {
  border: 1px solid rgba(16, 185, 129, 0.32);
  background: rgba(16, 185, 129, 0.13);
  color: var(--success);
}

.pill.watch,
.pill.warn,
.pill.idle {
  border: 1px solid rgba(245, 158, 11, 0.34);
  background: rgba(245, 158, 11, 0.14);
  color: var(--warning);
}

.pill.danger,
.pill.stopped {
  border: 1px solid rgba(239, 68, 68, 0.34);
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
}

.grid,
.digest {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.digest {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.metricCard,
.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.96);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.metricCard:hover,
.panel:hover {
  transform: translateY(-2px);
  border-color: #475569;
  background: rgba(30, 41, 59, 1);
}

.metricCard,
.panel {
  padding: 16px;
}

.metricCard span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.metricCard strong {
  display: block;
  margin-top: 9px;
  color: var(--text);
  font-size: 25px;
  line-height: 1.16;
  text-align: right;
  overflow-wrap: anywhere;
}

.metricCard p {
  margin-top: 8px;
  min-height: 18px;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.progressCard strong,
.cardTitleRow + strong {
  text-align: left;
}

.ringProgress {
  --progress: 0%;
  position: relative;
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: conic-gradient(var(--success) var(--progress), #334155 0);
}

.ringProgress::before {
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: inherit;
  background: var(--card);
  content: "";
}

.ringProgress span {
  position: relative;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.barTrack,
.rangeTrack {
  overflow: hidden;
  border-radius: 999px;
  background: #334155;
}

.barTrack {
  height: 9px;
  margin-top: 13px;
}

.barTrack span,
.rangeTrack span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), #38bdf8);
}

.statusDot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.62);
}

.statusDot.ok {
  background: var(--success);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.72);
}

.statusDot.danger,
.statusDot.stopped {
  background: var(--danger);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.66);
}

.switch {
  position: relative;
  width: 54px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: #475569;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5e1;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.34);
  content: "";
  transition: left 0.18s ease, background 0.18s ease;
}

.switch.on {
  border-color: rgba(16, 185, 129, 0.5);
  background: var(--success);
}

.switch.on::after {
  left: 27px;
  background: #ecfdf5;
}

.positive {
  color: var(--success) !important;
}

.negative {
  color: var(--danger) !important;
}

.livePanel {
  min-height: 438px;
}

.panelHead {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.panelHead p {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.sectionTitle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sectionTitle p {
  max-width: 62%;
  text-align: right;
  font-size: 12px;
  line-height: 1.42;
}

.priceBlock {
  margin-top: 20px;
}

.priceBlock > span {
  display: block;
  font-size: 12px;
  font-weight: 720;
}

.priceBlock strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
}

.rangeBlock {
  margin-top: 20px;
}

.rangeText {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.rangeTrack {
  position: relative;
  height: 12px;
  overflow: visible;
}

.rangeTrack span {
  width: 0;
  min-width: 0;
}

.rangeTrack i {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 22px;
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 0 14px rgba(226, 232, 240, 0.52);
  transform: translate(-50%, -50%);
}

.liveStats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.liveStats > div {
  min-width: 0;
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-radius: 10px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.34);
}

.liveStats span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.liveStats strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.positionBars {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.positionBars div {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #334155;
}

.positionBars span {
  position: absolute;
  top: -3px;
  left: 0;
  z-index: 1;
  width: 16px;
  font-size: 10px;
  line-height: 1;
}

.positionBars b {
  display: block;
  height: 100%;
  border-radius: inherit;
}

#longBar {
  background: var(--success);
}

#shortBar {
  background: var(--danger);
}

.longText {
  color: var(--success);
}

.shortText {
  color: var(--danger);
}

.warnBar {
  margin-top: 16px;
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  font-size: 13px;
  line-height: 1.42;
}

.warnBar.ok {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.satelliteGrid,
.logicList {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.satelliteItem,
.logicItem,
.coverageBox {
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.28);
}

.satelliteItem {
  padding: 12px;
}

.satelliteItemHead,
.logicItemHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.satelliteItem h3,
.logicItem h3,
.coverageBox h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
}

.satelliteItem dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 0;
}

.satelliteItem div {
  min-width: 0;
}

.satelliteItem dt,
.satelliteItem dd {
  margin: 0;
}

.satelliteItem dt {
  font-size: 11px;
  color: var(--muted);
}

.satelliteItem dd {
  margin-top: 4px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 720;
  text-align: right;
}

.logicItem {
  padding: 12px;
}

.logicItemHead strong {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.logicFlow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.logicMetric {
  border: 1px solid rgba(51, 65, 85, 0.88);
  border-radius: 8px;
  padding: 9px;
  background: rgba(30, 41, 59, 0.62);
}

.logicMetric span {
  display: block;
  font-size: 11px;
}

.logicMetric b {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  text-align: right;
}

.logicArrow {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.logicReason {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.coverageBox {
  margin-top: 14px;
  padding: 13px;
}

.coverageBox p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.fullPanel {
  margin-top: 14px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 12px;
  font-size: 12px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #162033;
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0;
  white-space: nowrap;
}

th,
td {
  height: 42px;
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

th:first-child,
td:first-child,
th.text,
td.text {
  text-align: left;
}

td {
  color: var(--text);
}

td.num,
th.num {
  text-align: right;
}

tbody tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.3);
}

tbody tr:hover td {
  background: rgba(51, 65, 85, 0.4);
}

.scrollTable {
  max-height: 464px;
  overflow: auto;
}

.scrollTable table {
  margin-top: 0;
}

.empty {
  margin-top: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  padding: 18px;
  background: rgba(15, 23, 42, 0.28);
  color: var(--muted);
}

.empty table {
  margin-top: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 4px 8px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
}

.badge.ok {
  border: 1px solid rgba(16, 185, 129, 0.28);
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.badge.warn {
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.badge.danger {
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

@media (max-width: 1300px) {
  body {
    min-width: 0;
  }

  .shell {
    width: min(100vw - 24px, 1240px);
  }

  .digest,
  .metrics,
  .two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .liveStats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 720px);
    padding-top: 12px;
  }

  .top,
  .panelHead,
  .progressCard,
  .switchCard {
    align-items: flex-start;
    flex-direction: column;
  }

  .statusRow {
    width: 100%;
    justify-content: flex-start;
  }

  .digest,
  .metrics,
  .two,
  .liveStats {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
