:root {
  --bg: #071116;
  --panel: #091821;
  --head: #030a12;
  --table: #07131b;
  --table-hover: #102633;
  --line: rgba(78, 112, 132, 0.32);
  --line-bright: rgba(71, 99, 117, 0.34);
  --text: #c9d4db;
  --text-strong: #dfe7eb;
  --text-table-head: #b4bfc5;
  --text-tag: #ccd6dc;
  --text-expand-label: #a0c4db;
  --muted: #8c9aa6;
  --muted-soft: #6d7e89;
  --blue: #66ade4;
  --orange: #e7971c;
  --green: #69bd4f;
  --red: #f85149;
  --font-base: 14px;
  --font-title: 28px;
  --font-table-head: 16px;
  --font-table-body: 17px;
  --line-table-head: 18px;
  --line-table-body: 19px;
  --line-expand-value: 20px;
  --font-usage: 15px;
  --font-tag: 12px;
  --font-footer: 12px;
  --line-footer: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  padding: 8px 12px !important;
  color: var(--text);
  background:
    radial-gradient(circle at 84% 0%, rgba(61, 148, 205, 0.22), transparent 34%),
    radial-gradient(circle at 10% 6%, rgba(96, 180, 255, 0.08), transparent 28%),
    var(--bg);
  font-family: "DIN Alternate", "Bahnschrift", system-ui, sans-serif;
  font-size: var(--font-base);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: auto;
  caret-color: transparent;
  cursor: default;
  user-select: none;
}

.status-console {
  width: min(1280px, calc(100vw - 24px));
  margin: 0 auto;
  border: 1px solid rgba(76, 135, 170, 0.58);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(4, 12, 18, 0.98), rgba(7, 19, 27, 0.96)),
    var(--panel);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(112, 191, 246, 0.045);
  overflow: hidden;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 2px 26px;
  border-bottom: 1px solid var(--line-bright);
  background: var(--head);
}

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

.brand h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: var(--font-title);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.console-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  line-height: 1;
  white-space: nowrap;
}

#utc-clock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-left: 10px;
  border-left: 1px solid rgba(180, 190, 199, 0.34);
  color: var(--text);
  font-size: var(--font-table-body);
  font-weight: 500;
  line-height: var(--line-table-body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.utc-time {
  color: inherit;
}

#updated {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: var(--font-table-body);
  line-height: var(--line-table-body);
}

.loading-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: rgba(33, 46, 54, 0.92);
}

.loading-notice i {
  color: var(--blue);
}

.table-shell {
  overflow-x: hidden;
}

.status-table {
  width: 100%;
  min-width: 0;
  margin: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  table-layout: fixed;
  background: transparent !important;
}

.col-status {
  width: 30px;
}

.col-node {
  width: 144px;
}

.col-uptime {
  width: 98px;
}

.col-load {
  width: 70px;
}

.col-network,
.col-month {
  width: 190px;
}

.col-cpu,
.col-memory,
.col-hdd {
  width: 80px;
}

.col-ping {
  width: 200px;
}

.status-table > thead > tr > th {
  height: 28px;
  padding: 2px 8px !important;
  border: 0 !important;
  border-right: 1px solid rgba(82, 132, 164, 0.04) !important;
  border-bottom: 1px solid rgba(72, 102, 117, 0.24) !important;
  color: var(--text-table-head);
  background: linear-gradient(180deg, #2c383d 0%, #192125 100%) !important;
  font-size: var(--font-table-head) !important;
  font-weight: 700;
  line-height: var(--line-table-head) !important;
  padding-left: 8px !important;
  box-shadow:
    inset 0 1px 0 rgba(138, 159, 168, 0.18),
    inset 0 -1px 0 rgba(4, 6, 7, 0.58);
  text-align: center;
  vertical-align: middle !important;
}

.status-table > tbody > tr > td {
  height: 35px;
  padding: 0 8px !important;
  border: 0 !important;
  border-right: 1px solid rgba(82, 132, 164, 0.035) !important;
  border-bottom: 1px solid rgba(82, 132, 164, 0.19) !important;
  color: var(--text);
  background: var(--table) !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  font-size: var(--font-table-body) !important;
  line-height: var(--line-table-body);
  font-weight: 500;
  overflow: hidden;
  text-overflow: clip;
}

.status-table > thead > tr,
.status-table > tbody > tr,
.status-table > thead > tr > th,
.status-table > tbody > tr > td,
.node-name,
.pill,
.flow,
.carrier {
  white-space: nowrap !important;
}

.status-table > tbody > tr:hover > td {
  background: var(--table-hover) !important;
}

.expandRow > td {
  height: auto !important;
  padding: 0 !important;
}

td[data-cell="status"] {
  padding-right: 0 !important;
  padding-left: 0 !important;
  text-align: center;
}

td[data-cell="name"] {
  padding-left: 8px !important;
  text-align: left;
}

td[data-cell="uptime"] {
  color: var(--text) !important;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

td[data-cell="load"] {
  color: #6dd2df;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

td[data-cell="network"],
td[data-cell="month_traffic"] {
  color: #6dd2df;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
}

td[data-cell="ping"] {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-right: 8px !important;
  padding-left: 8px !important;
}

.status-dot {
  display: block;
  position: relative;
  width: 12px;
  height: 12px;
  margin: 0 auto;
  border: 1px solid transparent;
  border-radius: 50%;
}

.dot-on {
  border-color: rgba(146, 185, 123, 0.42);
  background: #5f9e47;
  box-shadow: none;
}

.dot-off {
  border-color: #ec6670;
  background: #d9434f;
  box-shadow: none;
}

.node-pack {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: 6px;
  line-height: 1;
  overflow: visible;
}

.node-name {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-size: var(--font-table-body);
  font-weight: 500;
  line-height: var(--line-table-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-row {
  display: inline-flex;
  flex: 0 0 40px;
  gap: 0;
  width: 40px;
  margin-right: 0;
  margin-left: auto;
  align-items: center;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 34px;
  width: 36px;
  max-width: 36px;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid rgba(180, 196, 205, 0.18);
  color: var(--text-tag);
  font-size: var(--font-tag);
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.pill-line {
  width: 40px;
  max-width: 40px;
  height: 19px;
  padding-right: 3px;
  padding-left: 3px;
  border-color: rgba(85, 118, 155, 0.412);
  color: var(--text-tag);
  background: linear-gradient(180deg, #3a5078, #24344e);
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.333);
}

.load-value {
  display: inline-block;
  min-width: 34px;
  color: var(--green);
  text-align: center;
}

.load-ok {
  color: var(--green);
}

.load-warn {
  color: var(--orange);
}

.load-bad {
  color: var(--red);
}

.warn-text {
  color: var(--orange);
}

.usage-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 24px;
  border: 1px solid rgba(91, 132, 156, 0.18);
  border-radius: 3px;
  background: rgba(4, 14, 20, 0.72);
  overflow: hidden;
  isolation: isolate;
}

.usage-fill {
  position: absolute;
  z-index: 0;
  inset: 0 auto 0 0;
  width: var(--usage);
  transition: width 250ms ease-out, background-color 150ms ease-out;
}

.usage-text {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-size: var(--font-usage);
  font-weight: 600;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.usage-ok .usage-fill {
  background: rgba(95, 158, 71, 0.48);
}

.usage-warn .usage-fill {
  background: rgba(226, 162, 73, 0.62);
}

.usage-bad .usage-fill {
  background: rgba(224, 82, 94, 0.68);
}

.flow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.flow-down {
  color: var(--blue);
}

.flow-up {
  color: var(--orange);
}

td[data-cell="network"] .flow {
  color: var(--orange);
}

td[data-cell="network"] .flow.speed-low {
  color: var(--text);
}

td[data-cell="network"] .flow.speed-ok {
  color: var(--green);
}

td[data-cell="network"] .flow.speed-warn {
  color: var(--orange);
}

td[data-cell="network"] .flow.speed-bad {
  color: var(--red);
}

td[data-cell="month_traffic"] .flow {
  color: var(--blue);
}

.flow-sep {
  display: inline-block;
  width: 2px;
  height: 14px;
  margin: 0 9px;
  vertical-align: -2px;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent, rgba(214, 221, 225, 0.38), transparent);
}

.carrier {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 0;
  padding-top: 1px;
  color: var(--green);
  font-size: var(--font-table-body);
  line-height: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: clip;
}

.carrier.hot {
  color: var(--red);
}

.carrier.warn {
  color: var(--orange);
}

.carrier.missing {
  color: var(--muted-soft);
}

.ping-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  width: 100%;
  min-width: 0;
}

td[data-cell="ping"] .ping-grid {
  height: 24px;
  padding: 0 2px;
  border: 1px solid rgba(116, 158, 184, 0.20);
  border-radius: 3px;
  background: rgba(9, 24, 34, 0.58);
}

.ping-head {
  color: var(--text-table-head);
  font-size: var(--font-table-head);
  font-weight: 600;
  line-height: var(--line-table-head);
}

.ping-grid > span {
  position: relative;
}

.ping-grid > span + span::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 2px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent, rgba(168, 194, 210, 0.34), transparent);
  content: "";
  transform: translateY(-50%);
}

.danger-text {
  color: var(--red);
  font-weight: 600;
}

.muted {
  color: var(--muted-soft);
}

.accordian-body {
  max-height: 0;
  padding: 0 12px;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(4, 12, 18, 0.98), rgba(8, 22, 32, 0.96));
  text-align: left;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-3px);
  transition: max-height 170ms ease-out, opacity 130ms ease-out, padding 170ms ease-out, transform 170ms ease-out;
}

.accordian-body.is-open {
  max-height: 190px;
  padding-top: 10px;
  padding-bottom: 10px;
  opacity: 1;
  transform: translateY(0);
}

.expand-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.expand-item {
  grid-column: span 2;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid rgba(88, 164, 220, 0.18);
  border-radius: 3px;
  background: rgba(9, 30, 43, 0.78);
  box-shadow: inset 0 1px 0 rgba(151, 211, 255, 0.045);
}

.expand-label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-expand-label);
  font-size: var(--font-table-head);
  font-weight: 600;
  line-height: var(--line-table-head);
}

.expand-value {
  display: block;
  color: var(--text);
  font-size: var(--font-table-head);
  line-height: var(--line-expand-value);
  font-variant-numeric: tabular-nums;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.expiry-good {
  color: var(--green);
}

.expiry-warn {
  color: var(--orange);
}

.expiry-danger {
  color: var(--red);
}

.expand-spec {
  grid-column: span 8;
}

.expand-spec-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.expand-spec-heading .expand-label {
  flex-shrink: 0;
  margin-bottom: 0;
}

.expand-cpu-model {
  min-width: 0;
  color: #d8bc72;
  font-size: var(--font-table-head);
  line-height: var(--line-table-head);
  text-align: right;
  overflow-wrap: anywhere;
}

.expand-date {
  grid-column: span 2;
}

.expand-ping {
  grid-column: span 2;
  padding-right: 4px;
  padding-left: 4px;
}

.expand-provider {
  grid-column: span 2;
}

.expand-ping .expand-value {
  white-space: nowrap;
}

.console-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 30px;
  padding: 7px 18px 8px;
  border-top: 1px solid var(--line);
  color: rgba(210, 217, 220, 0.58);
  background: var(--head);
  font-size: var(--font-footer);
  font-weight: 500;
  line-height: var(--line-footer);
  letter-spacing: 0.2px;
}

@media (max-width: 760px) {
  :root {
    --font-title: 26px;
    --font-table-head: 15px;
    --font-table-body: 16px;
    --line-table-head: 17px;
    --line-table-body: 18px;
    --line-expand-value: 19px;
  }

  .status-table > tbody > tr > td {
    height: 34px;
  }
}

@media (min-width: 761px) and (max-width: 1279px),
       (max-width: 760px) and (orientation: landscape) {
  .accordian-body.is-open {
    max-height: 280px;
  }

  .expand-item {
    grid-column: span 4;
  }

  .expand-provider,
  .expand-date {
    grid-column: span 3;
  }

  .expand-spec {
    grid-column: span 6;
  }

  .col-cpu,
  .col-memory,
  .col-hdd,
  th#cpu,
  th#memory,
  th#hdd,
  td[data-cell="cpu"],
  td[data-cell="memory"],
  td[data-cell="hdd"] {
    display: none !important;
  }

  .col-status {
    width: 4%;
  }

  .col-node {
    width: 20%;
  }

  .col-uptime {
    width: 10%;
  }

  .col-load {
    width: 8%;
  }

  .col-network {
    width: 19%;
  }

  .col-month {
    width: 19%;
  }

  .col-ping {
    width: 20%;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .accordian-body.is-open {
    max-height: 300px;
  }

  .expand-ping {
    grid-column: span 6;
  }

  .col-node {
    width: 18%;
  }

  .col-network,
  .col-month {
    width: 18%;
  }

  .col-ping {
    width: 24%;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  body {
    padding: 0 !important;
    background: var(--bg);
  }

  .status-console {
    width: 100vw;
    min-height: 100vh;
    border-radius: 0;
    border-right: 0;
    border-left: 0;
  }

  .console-header {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    min-height: 54px;
    padding: 10px 12px;
  }

  .brand {
    flex: 0 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .brand h1 {
    white-space: nowrap;
  }

  .console-meta {
    display: grid;
    grid-template-columns: max-content max-content;
    width: auto;
    flex: 0 0 auto;
    justify-content: end;
    align-items: center;
    column-gap: 6px;
    white-space: nowrap;
  }

  .status-table {
    table-layout: fixed;
  }

  .col-uptime,
  .col-cpu,
  .col-memory,
  .col-hdd,
  .col-ping,
  th#uptime,
  th#cpu,
  th#memory,
  th#hdd,
  th#ping,
  td[data-cell="uptime"],
  td[data-cell="cpu"],
  td[data-cell="memory"],
  td[data-cell="hdd"],
  td[data-cell="ping"] {
    display: none !important;
  }

  .col-status {
    width: 6%;
  }

  .col-node {
    width: 20%;
  }

  .col-load {
    width: 13%;
  }

  .col-network {
    width: 30.5%;
  }

  .col-month {
    width: 30.5%;
  }

  th#name {
    padding-left: 5px !important;
  }

  .status-table > thead > tr > th,
  .status-table > tbody > tr > td {
    padding-right: 5px !important;
    padding-left: 5px !important;
  }

  td[data-cell="name"] {
    padding-left: 5px !important;
  }

  .tag-row {
    display: none;
    margin-right: 0;
  }

  .node-name {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  .flow-sep {
    margin: 0 6px;
  }

  .expandRow {
    display: none !important;
  }
}
