:root {
  --bg: #061015;
  --bg-2: #0a1920;
  --panel: #0d1d25;
  --panel-2: #102630;
  --panel-3: #14323c;
  --line: rgba(116, 211, 196, 0.15);
  --line-strong: rgba(116, 211, 196, 0.3);
  --text: #e9f7f4;
  --muted: #8ca8a6;
  --muted-2: #64807f;
  --accent: #4de0b8;
  --accent-dark: #143d36;
  --accent-2: #5aa9ff;
  --danger: #ff6f81;
  --warn: #ffc857;
  --ok: #45e0a8;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(circle at 15% -10%, rgba(77, 224, 184, 0.14), transparent 38rem),
    radial-gradient(circle at 100% 0%, rgba(90, 169, 255, 0.1), transparent 32rem),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  letter-spacing: -0.035em;
  line-height: 1.1;
}

h2 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.field > span,
.compact-field > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.field em {
  color: var(--muted-2);
  font-style: normal;
  font-weight: 400;
}

.field small {
  color: var(--muted-2);
  font-size: 0.72rem;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(4, 13, 18, 0.7);
  color: var(--text);
  padding: 0.72rem 0.85rem;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

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

input:focus,
select:focus {
  border-color: var(--line-strong);
  background: rgba(4, 13, 18, 0.95);
  box-shadow: 0 0 0 3px rgba(77, 224, 184, 0.12);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.6rem;
  padding: 0.62rem 1rem;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 650;
  font-size: 0.86rem;
  transition: transform 120ms ease, background 150ms ease, border-color 150ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button.primary {
  color: #03231d;
  background: linear-gradient(135deg, #63ebc5, #3bc49e);
  box-shadow: 0 10px 24px rgba(77, 224, 184, 0.18);
}

.button.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #79f5d2, #4dd8ae);
}

.button.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--line);
}

.button.ghost:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
}

.button.danger {
  color: var(--danger);
  border-color: rgba(255, 111, 129, 0.3);
  background: rgba(255, 111, 129, 0.06);
}

.button.wide {
  width: 100%;
}

.button.small {
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 1.05rem;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.form-error {
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(255, 111, 129, 0.3);
  border-radius: 10px;
  color: #ffb3bc;
  background: rgba(255, 111, 129, 0.08);
  font-size: 0.82rem;
}

/* Login */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-shell {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.2rem;
  align-items: stretch;
}

.login-brand,
.login-card {
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.035), transparent 45%),
    rgba(9, 24, 31, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.login-brand {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}

.login-brand::after {
  content: "";
  position: absolute;
  inset: auto -20% -45% 35%;
  height: 26rem;
  border-radius: 50%;
  border: 1px solid rgba(77, 224, 184, 0.14);
  box-shadow: 0 0 0 3.5rem rgba(77, 224, 184, 0.025),
    0 0 0 7rem rgba(77, 224, 184, 0.02),
    0 0 0 10.5rem rgba(77, 224, 184, 0.015);
  pointer-events: none;
}

.login-brand h1 {
  font-size: clamp(2.7rem, 6vw, 4.8rem);
  max-width: 8ch;
}

.login-lead {
  max-width: 34ch;
  color: var(--muted);
  font-size: 1.02rem;
}

.login-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  position: relative;
  z-index: 1;
}

.login-points li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.68rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.14);
  font-size: 0.76rem;
}

.login-points span {
  color: var(--accent);
}

.login-card {
  padding: clamp(1.6rem, 4vw, 2.8rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
}

.login-card-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.login-card-head h2 {
  font-size: 1.65rem;
}

.login-card-head p:last-child,
.login-foot {
  color: var(--muted);
  font-size: 0.85rem;
}

.login-foot {
  text-align: center;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: radial-gradient(circle at 50% 40%, rgba(77, 224, 184, 0.16), transparent 70%);
}

.brand-mark.large {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 18px;
  margin-bottom: 0.5rem;
}

.brand-wave {
  width: 55%;
  height: 55%;
  border: 2px solid var(--accent);
  border-radius: 50%;
  border-right-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(45deg);
  opacity: 0.85;
}

.brand-node {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(77, 224, 184, 0.9);
}

/* Shell */
.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--line);
  background: rgba(6, 17, 22, 0.7);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.3rem;
}

.brand strong {
  display: block;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.brand span {
  display: block;
  color: var(--muted-2);
  font-size: 0.7rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.72rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-size: 0.86rem;
  font-weight: 550;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.nav-item.active {
  color: var(--text);
  border-color: var(--line);
  background: linear-gradient(90deg, rgba(77, 224, 184, 0.12), rgba(77, 224, 184, 0.025));
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 7px;
  color: var(--accent);
  background: rgba(77, 224, 184, 0.08);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.badge {
  min-width: 1.35rem;
  margin-left: auto;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  color: #03231d;
  background: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: auto;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
}

.sidebar-foot strong,
.sidebar-foot span {
  display: block;
}

.sidebar-foot strong {
  font-size: 0.78rem;
}

.sidebar-foot span {
  color: var(--muted-2);
  font-size: 0.68rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 4px rgba(100, 128, 127, 0.12);
}

.status-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(69, 224, 168, 0.12), 0 0 12px rgba(69, 224, 168, 0.5);
}

.status-dot.bad {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 111, 129, 0.12);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  padding: 0.8rem clamp(1rem, 3vw, 2.3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(6, 16, 21, 0.78);
  backdrop-filter: blur(18px);
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.account {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.account-copy {
  text-align: right;
  margin-right: 0.2rem;
}

.account-copy strong,
.account-copy span {
  display: block;
}

.account-copy strong {
  font-size: 0.8rem;
}

.account-copy span {
  color: var(--muted-2);
  font-size: 0.68rem;
}

.views {
  width: min(1540px, 100%);
  padding: clamp(1.2rem, 3vw, 2.4rem);
}

.view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: fade-in 180ms ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.view-head > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.view-head p:last-child {
  color: var(--muted);
  font-size: 0.86rem;
  max-width: 70ch;
}

.head-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.compact-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.compact-field select {
  min-width: 9.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.live-pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.62rem;
  border: 1px solid rgba(77, 224, 184, 0.24);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(77, 224, 184, 0.06);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.live-pill.neutral {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(77, 224, 184, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(77, 224, 184, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(77, 224, 184, 0);
  }
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 260px;
  max-width: 460px;
  padding: 0 0.72rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(4, 13, 18, 0.6);
}

.search-field.compact {
  max-width: none;
  margin: 0.2rem 0 0.8rem;
}

.search-field > span {
  color: var(--muted-2);
  font-size: 1rem;
}

.search-field input {
  border: 0;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  box-shadow: none;
}

.search-field:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(77, 224, 184, 0.08);
}

.counter {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  white-space: nowrap;
}

/* Messages */
.message-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.message-card {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.028), transparent 50%),
    rgba(11, 29, 37, 0.7);
  transition: border-color 140ms ease, background 140ms ease;
}

.message-card:hover {
  border-color: var(--line-strong);
  background-color: rgba(13, 36, 45, 0.86);
}

.message-card.new {
  animation: message-in 350ms ease;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
    border-color: rgba(77, 224, 184, 0.5);
  }
}

.avatar {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-dark);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.message-main {
  min-width: 0;
}

.message-head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.22rem;
}

.message-head strong {
  font-size: 0.84rem;
}

.message-head .msg-id {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.64rem;
}

.message-head time {
  margin-left: auto;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.66rem;
  white-space: nowrap;
}

.message-text {
  color: #d8ebe7;
  font-size: 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.42rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.13rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.12);
  font-family: var(--mono);
  font-size: 0.61rem;
}

.chip.channel {
  color: var(--accent-2);
  border-color: rgba(90, 169, 255, 0.2);
  background: rgba(90, 169, 255, 0.06);
}

.chip.mqtt {
  color: var(--warn);
  border-color: rgba(255, 200, 87, 0.2);
  background: rgba(255, 200, 87, 0.06);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 3rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted-2);
  text-align: center;
  font-size: 0.86rem;
}

.empty-state strong {
  color: var(--muted);
}

.empty-state.small {
  padding: 1.6rem 1rem;
}

/* Tables and map */
.nodes-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(330px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.table-wrap {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 24, 31, 0.66);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.79rem;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.72rem 0.85rem;
  color: var(--muted-2);
  background: #0b1c24;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 0.62rem 0.85rem;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.node-name {
  font-weight: 650;
}

.node-id {
  display: block;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.64rem;
}

.role-line {
  display: block;
  color: var(--muted-2);
  font-size: 0.64rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.42rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.64rem;
  white-space: nowrap;
}

.pill.rf {
  color: var(--accent);
  border-color: rgba(77, 224, 184, 0.2);
  background: rgba(77, 224, 184, 0.05);
}

.pill.mqtt {
  color: var(--warn);
  border-color: rgba(255, 200, 87, 0.2);
  background: rgba(255, 200, 87, 0.05);
}

.battery {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.7rem;
}

.battery-bar {
  width: 42px;
  height: 4px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
}

.battery-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.map-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #08171d;
}

.map {
  height: 460px;
  background: #08171d;
}

.map-caption {
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 0.66rem;
}

.map-empty {
  position: absolute;
  inset: 0 0 2rem;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--muted-2);
  background: rgba(8, 23, 29, 0.9);
  font-size: 0.82rem;
  text-align: center;
}

.leaflet-container {
  font-family: var(--font);
  background: #08171d;
}

.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.6) !important;
  color: #9ab !important;
}

.leaflet-control-attribution a {
  color: var(--accent) !important;
}

.map-popup {
  min-width: 160px;
}

.map-popup strong {
  display: block;
  margin-bottom: 0.15rem;
}

.map-popup span {
  display: block;
  color: #4a6563;
  font-family: var(--mono);
  font-size: 0.68rem;
}

/* Commands */
.commands-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.1fr);
  gap: 1rem;
  align-items: start;
}

.catalog-card,
.command-console,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 45%),
    rgba(9, 24, 31, 0.7);
}

.catalog-card {
  padding: 1rem;
  max-height: 690px;
  display: flex;
  flex-direction: column;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.command-catalog {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.command-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.6rem;
  width: 100%;
  padding: 0.58rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.018);
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease;
}

.command-item:hover,
.command-item.selected {
  border-color: var(--line-strong);
  background: rgba(77, 224, 184, 0.06);
}

.command-item strong {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
}

.command-item small {
  grid-column: 1 / -1;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.command-flags {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.flag {
  padding: 0.08rem 0.3rem;
  border-radius: 5px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flag.run {
  color: var(--accent);
  background: rgba(77, 224, 184, 0.08);
}

.flag.doc {
  color: var(--muted);
}

.flag.danger {
  color: var(--danger);
  background: rgba(255, 111, 129, 0.08);
}

.command-console {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.command-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(2, 10, 14, 0.25);
}

.command-doc {
  min-height: 2.4rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.results-head {
  margin-bottom: 0;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.check-field input {
  width: auto;
  accent-color: var(--accent);
}

.command-results {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 330px;
  overflow: auto;
}

.command-result {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
}

.command-result header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.command-result header strong {
  font-family: var(--mono);
  font-size: 0.73rem;
}

.command-result header time {
  margin-left: auto;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.command-result pre {
  margin: 0;
  color: #cfe6e1;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.state {
  padding: 0.08rem 0.34rem;
  border-radius: 5px;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.state.pendiente {
  color: var(--warn);
  background: rgba(255, 200, 87, 0.1);
}

.state.ejecutando {
  color: var(--accent-2);
  background: rgba(90, 169, 255, 0.1);
}

.state.ok {
  color: var(--ok);
  background: rgba(69, 224, 168, 0.1);
}

.state.error,
.state.timeout {
  color: var(--danger);
  background: rgba(255, 111, 129, 0.1);
}

/* Status */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.stat-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(150deg, rgba(77, 224, 184, 0.045), transparent 55%),
    rgba(9, 24, 31, 0.7);
}

.stat-card span {
  display: block;
  color: var(--muted-2);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.stat-card small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.status-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  padding: 1rem;
}

.channel-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.56rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.74rem;
}

.channel-item b {
  display: inline-grid;
  place-items: center;
  min-width: 1.3rem;
  height: 1.3rem;
  border-radius: 5px;
  color: var(--accent);
  background: rgba(77, 224, 184, 0.08);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.meta-list {
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
  gap: 0.45rem 0.9rem;
  margin: 0;
  font-size: 0.76rem;
}

.meta-list dt {
  color: var(--muted-2);
}

.meta-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.7rem;
}

/* Users */
.users-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr);
  gap: 1rem;
  align-items: start;
}

.users-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.temp-password {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 200, 87, 0.25);
  border-radius: 10px;
  background: rgba(255, 200, 87, 0.06);
}

.temp-password span {
  color: var(--warn);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.temp-password code {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.temp-password small {
  color: var(--muted);
  font-size: 0.68rem;
}

.audit-card {
  margin-top: 0.2rem;
}

/* Modal and toast */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 8, 11, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(440px, 100%);
  padding: 1.3rem;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #0c1e26;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.modal-head > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.2rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 120;
  max-width: min(380px, calc(100vw - 2rem));
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--text);
  background: #102630;
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  animation: toast-in 180ms ease;
}

.toast.error {
  border-color: rgba(255, 111, 129, 0.4);
  color: #ffc4ca;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Responsive */
@media (max-width: 1180px) {
  .nodes-layout,
  .commands-layout {
    grid-template-columns: 1fr;
  }

  .catalog-card {
    max-height: 360px;
  }

  .map {
    height: 380px;
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
    padding: 0.7rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .sidebar-foot {
    margin-top: 0;
    margin-left: auto;
  }

  .topbar {
    position: static;
  }

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

  .status-layout,
  .users-layout {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand {
    padding: 2rem;
  }

  .login-points {
    display: none;
  }
}

@media (max-width: 620px) {
  .views {
    padding: 1rem;
  }

  .topbar {
    padding: 0.7rem 1rem;
  }

  .account-copy {
    display: none;
  }

  .view-head {
    align-items: flex-start;
  }

  .head-actions {
    width: 100%;
  }

  .compact-field {
    flex: 1;
  }

  .compact-field select {
    min-width: 0;
  }

  .message-card {
    grid-template-columns: 2.1rem minmax(0, 1fr);
    padding: 0.7rem;
  }

  .avatar {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 0.64rem;
  }

  .message-head time {
    margin-left: 0;
  }

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

  .map {
    height: 300px;
  }

  .data-table {
    font-size: 0.73rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.55rem 0.6rem;
  }

  .sidebar-foot {
    display: none;
  }
}

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