:root {
  color: #ffffff;
  background: #050706;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --green: #24d47e;
  --green-dark: #10985b;
  --bg: #050706;
  --surface: #121514;
  --surface-raised: #1b201e;
  --card: #1a1f1d;
  --card-soft: #202622;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(36, 212, 126, 0.34);
  --text: #ffffff;
  --secondary: #a6aaa8;
  --muted: #737a76;
  --input: #171b19;
  --danger: #e43f5a;
  --warning: #ffc93c;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(36, 212, 126, 0.14), transparent 28%),
    linear-gradient(180deg, #090c0b 0%, var(--bg) 38%, #050706 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.shell {
  min-height: 100vh;
  padding: 22px;
}

.topbar,
.connection-panel,
.controls,
.workspace,
.metrics-grid,
.alert {
  max-width: 1440px;
  margin-right: auto;
  margin-left: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 116px;
  height: 58px;
  padding: 6px 10px;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand h1,
.brand p,
.events h2 {
  margin: 0;
}

.brand h1 {
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.12;
}

.brand p {
  margin-top: 3px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 700;
}

.icon-button,
.actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 800;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.icon-button {
  width: 42px;
  color: var(--green);
  font-size: 17px;
}

.icon-button:hover,
.actions button:hover {
  color: var(--green);
  border-color: var(--border-strong);
  background: #202823;
}

.connection-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.4fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  margin-bottom: 16px;
  background: rgba(26, 31, 29, 0.95);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

label {
  display: grid;
  gap: 7px;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 800;
}

input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}

input::placeholder {
  color: var(--muted);
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36, 212, 126, 0.14);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 98px;
  height: 42px;
  padding: 0 18px;
  color: #06100b;
  background: var(--green);
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(16, 152, 91, 0.32);
}

.primary-button:hover {
  background: #2fea91;
}

.alert {
  padding: 13px 15px;
  margin-bottom: 14px;
  border-radius: 8px;
  border: 1px solid;
  font-weight: 700;
}

.alert.error {
  color: #ffd6dc;
  background: rgba(228, 63, 90, 0.12);
  border-color: rgba(228, 63, 90, 0.5);
}

.alert.success {
  color: #bdffd9;
  background: rgba(36, 212, 126, 0.11);
  border-color: rgba(36, 212, 126, 0.42);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric,
.panel,
.fleet-table {
  background: rgba(26, 31, 29, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.metric {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 98px;
  padding: 16px;
}

.metric-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--green);
  background: rgba(36, 212, 126, 0.12);
  border: 1px solid rgba(36, 212, 126, 0.16);
  border-radius: 8px;
}

.metric span,
.metric small,
.identity span,
td,
dd,
.event p,
.event time {
  color: var(--secondary);
}

.metric strong {
  display: block;
  color: var(--text);
  font-size: 28px;
  font-weight: 900;
  line-height: 1.05;
}

.controls {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.search {
  display: flex;
  align-items: center;
  width: min(520px, 100%);
  padding-left: 12px;
  color: var(--green);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.search input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.segments {
  display: flex;
  padding: 4px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.segments button {
  height: 34px;
  padding: 0 13px;
  color: var(--secondary);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 900;
}

.segments button.active {
  color: #06100b;
  background: var(--green);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.fleet-table {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

th {
  color: var(--secondary);
  font-size: 12px;
  font-weight: 900;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover,
tbody tr.selected {
  background: rgba(36, 212, 126, 0.075);
}

.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--green);
}

.identity > div:first-child {
  width: 11px;
  min-width: 11px;
  height: 11px;
  color: transparent;
  background: var(--green);
  border-radius: 3px;
}

.identity div {
  display: grid;
  min-width: 0;
}

.identity strong,
.identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity strong {
  color: var(--text);
  font-weight: 900;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.status.online {
  color: var(--green);
  background: rgba(36, 212, 126, 0.13);
}

.status.offline {
  color: #ff8fa0;
  background: rgba(228, 63, 90, 0.13);
}

.actions {
  display: flex;
  gap: 6px;
}

.actions button {
  width: auto;
  min-width: 48px;
  padding: 0 10px;
  color: var(--secondary);
  font-size: 12px;
}

.actions.expanded {
  flex-wrap: wrap;
}

.actions.expanded button {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.panel {
  padding: 16px;
}

.details {
  display: grid;
  gap: 14px;
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 14px;
  margin: 0;
}

dt {
  color: var(--secondary);
  font-size: 12px;
  font-weight: 900;
}

dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.events {
  display: grid;
  gap: 12px;
}

.events h2 {
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.event {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.event > div:first-child {
  color: var(--green);
}

.event.critical > div:first-child {
  color: var(--danger);
}

.event.warning > div:first-child {
  color: var(--warning);
}

.event strong,
.event p {
  margin: 0;
}

.event strong {
  color: var(--text);
  font-size: 13px;
}

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

.event time {
  font-size: 12px;
}

.empty {
  padding: 28px;
  color: var(--secondary);
  text-align: center;
}

.spin {
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .shell {
    padding: 16px;
  }

  .connection-panel,
  .workspace {
    grid-template-columns: 1fr;
  }

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

  .controls {
    flex-direction: column;
  }

  .search {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .brand-mark {
    width: 96px;
    height: 50px;
  }

  .brand h1 {
    font-size: 20px;
  }
}
