:root {
  --bg: #000000;
  --bg-elev: #070000;
  --red: #ff1f1f;
  --red-bright: #ff4d4d;
  --red-deep: #9a0000;
  --red-glow: rgba(255, 31, 31, 0.55);
  --red-soft: rgba(255, 31, 31, 0.18);
  --text: #f4f4f4;
  --muted: #9b9b9b;
  --line: #ff1f1f;
  --header-h: 64px;
  --gap: 14px;
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  --mono: "Consolas", "Courier New", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input {
  font-family: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

#fx-root {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#grid-canvas {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.55;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: scan-drift 8s linear infinite;
  mix-blend-mode: overlay;
}

.vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.72) 100%),
    linear-gradient(180deg, rgba(255, 20, 20, 0.06), transparent 18%, transparent 82%, rgba(255, 20, 20, 0.08));
}

@keyframes scan-drift {
  from { background-position: 0 0; }
  to { background-position: 0 120px; }
}

.view {
  position: relative;
  z-index: 1;
  min-height: 100%;
}

.hud-frame {
  position: relative;
  border: 1px solid var(--red);
  box-shadow:
    0 0 0 1px rgba(255, 31, 31, 0.08) inset,
    0 0 18px rgba(255, 31, 31, 0.18);
}

.hud-frame::before,
.hud-frame::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 2;
}

.hud-frame::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--red-bright);
  border-left: 2px solid var(--red-bright);
  box-shadow: 0 0 8px var(--red-glow);
}

.hud-frame::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid var(--red-bright);
  border-bottom: 2px solid var(--red-bright);
  box-shadow: 0 0 8px var(--red-glow);
}

.hud-frame .hud-tr,
.hud-frame .hud-bl {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 2;
}

.hud-frame .hud-tr {
  top: -1px;
  right: -1px;
  border-top: 2px solid var(--red-bright);
  border-right: 2px solid var(--red-bright);
  box-shadow: 0 0 8px var(--red-glow);
}

.hud-frame .hud-bl {
  left: -1px;
  bottom: -1px;
  border-left: 2px solid var(--red-bright);
  border-bottom: 2px solid var(--red-bright);
  box-shadow: 0 0 8px var(--red-glow);
}

.view-login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-wrap {
  width: min(440px, 100%);
  animation: boot-in 0.7s ease both;
}

@keyframes boot-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.login-card {
  background: linear-gradient(180deg, rgba(18, 0, 0, 0.88), rgba(0, 0, 0, 0.92));
  padding: 36px 32px 22px;
  overflow: hidden;
}

.login-card-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 40, 40, 0.12) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: sheen 4.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sheen {
  0%, 60% { background-position: 120% 0; }
  100% { background-position: -20% 0; }
}

.login-head {
  text-align: center;
  margin-bottom: 28px;
}

.login-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  position: relative;
  display: grid;
  place-items: center;
}

.pulse-core {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 16px var(--red-glow);
  z-index: 1;
}

.pulse-ring {
  position: absolute;
  inset: 0;
  border: 1px solid var(--red);
  border-radius: 50%;
  animation: ping 2.2s ease-out infinite;
}

.pulse-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 31, 31, 0.45);
  border-radius: 50%;
}

@keyframes ping {
  0% { transform: scale(0.82); opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}

.login-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--red-bright);
  margin-bottom: 8px;
}

.login-head h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-shadow: 0 0 18px var(--red-glow);
}

.login-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--red-bright);
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  height: 44px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 31, 31, 0.55);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field input:focus {
  border-color: var(--red-bright);
  background: rgba(40, 0, 0, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 31, 31, 0.25), 0 0 18px rgba(255, 31, 31, 0.2);
}

.field input::placeholder {
  color: #666;
}

.login-error {
  min-height: 20px;
  font-size: 13px;
  color: var(--red-bright);
  margin-bottom: 10px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.login-card.is-denied {
  animation: glitch 0.42s steps(2, end);
}

@keyframes glitch {
  0% { transform: translate(0); filter: none; }
  20% { transform: translate(-4px, 1px); filter: hue-rotate(-20deg); }
  40% { transform: translate(4px, -1px); }
  60% { transform: translate(-2px, 0); filter: contrast(1.4); }
  80% { transform: translate(2px, 1px); }
  100% { transform: none; filter: none; }
}

.btn-access {
  position: relative;
  width: 100%;
  height: 46px;
  overflow: hidden;
  border: 1px solid var(--red);
  background: linear-gradient(180deg, rgba(255, 31, 31, 0.28), rgba(90, 0, 0, 0.45));
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  transition: box-shadow 0.2s, background 0.2s, transform 0.15s;
}

.btn-access:hover {
  background: linear-gradient(180deg, rgba(255, 31, 31, 0.5), rgba(120, 0, 0, 0.6));
  box-shadow: 0 0 22px var(--red-glow);
}

.btn-access:active {
  transform: scale(0.985);
}

.btn-access.is-busy {
  pointer-events: none;
  letter-spacing: 0.12em;
}

.btn-access-scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: translateX(-120%);
  animation: btn-scan 2.4s ease-in-out infinite;
}

@keyframes btn-scan {
  0%, 40% { transform: translateX(-120%); }
  70%, 100% { transform: translateX(120%); }
}

.login-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 11px;
  color: #777;
  letter-spacing: 0.08em;
}

.dot-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22ff88;
  box-shadow: 0 0 8px #22ff88;
  animation: blink 1.6s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.sep {
  color: var(--red);
}

.view-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 12px;
}

.app-header {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px 8px 10px;
  background: rgba(8, 0, 0, 0.72);
  animation: boot-in 0.45s ease both;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.nav-item {
  position: relative;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--red);
  background: transparent;
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.04em;
  overflow: hidden;
  transition: color 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: var(--red);
  transition: height 0.22s ease;
  z-index: 0;
}

.nav-item:hover {
  box-shadow: 0 0 14px var(--red-glow);
  color: #fff;
}

.nav-item:hover::before {
  height: 100%;
  opacity: 0.35;
}

.nav-item.is-active {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 16px var(--red-glow);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
}

.nav-item.is-active::before {
  display: none;
}

.nav-item > * ,
.nav-item {
  z-index: 1;
}

.app-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red);
  display: grid;
  place-items: center;
  box-shadow: 0 0 12px var(--red-glow);
}

.user-name {
  font-size: 14px;
  letter-spacing: 0.04em;
}

.logout-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--red);
  background: transparent;
  color: #fff;
  font-size: 13px;
  transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}

.logout-btn:hover {
  background: var(--red);
  box-shadow: 0 0 12px var(--red-glow);
}

.workspace {
  flex: 1;
  min-height: 0;
  background: rgba(5, 0, 0, 0.55);
  position: relative;
  overflow: hidden;
  animation: boot-in 0.55s ease 0.08s both;
}

.workspace-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 80px;
  top: -80px;
  background: linear-gradient(180deg, transparent, rgba(255, 31, 31, 0.18), transparent);
  pointer-events: none;
  z-index: 3;
}

.workspace.is-switching .workspace-scan {
  animation: sweep 0.48s ease-out;
}

@keyframes sweep {
  from { top: -80px; }
  to { top: 110%; }
}

.panel {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  text-align: center;
  padding: 24px;
}

.panel.is-active {
  display: grid;
  animation: panel-in 0.4s ease both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: scale(0.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.panel-en {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.42em;
  color: var(--red-bright);
  margin-bottom: 10px;
}

.panel h2 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-shadow: 0 0 22px var(--red-glow);
}

.panel-hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.panel::before {
  content: "";
  width: 120px;
  height: 120px;
  margin: 0 auto 18px;
  border: 1px solid var(--red);
  border-radius: 50%;
  box-shadow: 0 0 24px var(--red-soft), inset 0 0 24px var(--red-soft);
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 31, 31, 0.18) 0 8deg, transparent 8deg 18deg),
    radial-gradient(circle, rgba(255, 31, 31, 0.35) 0 6px, transparent 7px 42%, rgba(255, 31, 31, 0.2) 43% 44%, transparent 45%);
  animation: radar 6s linear infinite;
  justify-self: center;
}

@keyframes radar {
  to { transform: rotate(360deg); }
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.auth-box {
  width: min(420px, calc(100% - 32px));
  padding: 28px 24px 22px;
  background: rgba(8, 0, 0, 0.92);
}

.auth-radar {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border: 1px solid var(--red);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 18px var(--red-glow);
}

.auth-radar::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 60%, var(--red));
  animation: radar 1.1s linear infinite;
  mask: radial-gradient(circle, transparent 52%, #000 54%);
}

.auth-title {
  text-align: center;
  letter-spacing: 0.28em;
  margin-bottom: 14px;
}

.auth-log {
  list-style: none;
  min-height: 92px;
  font-family: var(--mono);
  font-size: 13px;
  color: #d0d0d0;
  line-height: 1.8;
}

.auth-log li::before {
  content: "> ";
  color: var(--red-bright);
}

.auth-bar {
  height: 3px;
  background: rgba(255, 31, 31, 0.2);
  overflow: hidden;
  margin-top: 10px;
}

.auth-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
  animation: loadbar 1.35s ease forwards;
}

@keyframes loadbar {
  to { width: 100%; }
}

.panel.panel-page {
  place-content: stretch;
  text-align: left;
  padding: 12px;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.panel.panel-page::before {
  display: none;
}

.device-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.df-field {
  display: grid;
  gap: 5px;
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  flex: 0 0 120px;
}

.df-field span {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--red-bright);
  font-family: var(--mono);
}

.df-field input,
.df-field select {
  height: 34px;
  width: 120px;
  max-width: 120px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--red);
  color: #fff;
  padding: 0 10px;
  outline: none;
  font-size: 13px;
  color-scheme: dark;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.df-field input:focus,
.df-field select:focus {
  box-shadow: 0 0 10px var(--red-glow);
  border-color: var(--red-bright);
}

.df-field select option {
  background: #000;
}

.df-range {
  width: auto;
  min-width: 0;
  max-width: none;
  flex: 0 0 auto;
}

.df-range-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.df-range-sep {
  color: var(--red-bright);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.df-range input {
  width: 132px;
  max-width: 132px;
}

.df-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.df-btn {
  height: 34px;
  min-width: 72px;
  padding: 0 14px;
  border: 1px solid var(--red);
  background: transparent;
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.12em;
  transition: background 0.2s, box-shadow 0.2s;
}

.df-btn:hover,
.df-search {
  background: rgba(255, 31, 31, 0.22);
  box-shadow: 0 0 12px var(--red-glow);
}

.df-search:hover {
  background: var(--red);
}

.device-table-wrap {
  position: relative;
  min-height: 0;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.45);
  scrollbar-width: thin;
  scrollbar-color: #ff2a2a #120000;
}

.device-table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 0;
}

.device-table-wrap::-webkit-scrollbar:horizontal {
  height: 0;
  display: none;
}

.device-table-wrap::-webkit-scrollbar-track {
  background:
    linear-gradient(90deg, rgba(255, 31, 31, 0.12), transparent 40%),
    #0a0000;
  border-left: 1px solid rgba(255, 31, 31, 0.55);
  box-shadow: inset 0 0 10px rgba(255, 31, 31, 0.18);
}

.device-table-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ff5a5a, #ff1f1f 45%, #7a0000);
  border: 1px solid #ff4d4d;
  box-shadow: 0 0 10px rgba(255, 31, 31, 0.65), inset 0 0 6px rgba(255, 180, 180, 0.35);
}

.device-table-wrap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ff8080, #ff2a2a 50%, #b00000);
  box-shadow: 0 0 14px rgba(255, 60, 60, 0.9);
}

.device-table-wrap::-webkit-scrollbar-corner {
  background: #000;
  display: none;
}

.device-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 12px;
}

.device-table col.col-id { width: 44px; }
.device-table col.col-account { width: 78px; }
.device-table col.col-app { width: 78px; }
.device-table col.col-ip { width: 96px; }
.device-table col.col-country { width: 64px; }
.device-table col.col-net { width: 72px; }
.device-table col.col-android { width: 72px; }
.device-table col.col-brand { width: 72px; }
.device-table col.col-model { width: 96px; }
.device-table col.col-battery { width: 56px; }
.device-table col.col-screen { width: 68px; }
.device-table col.col-acc { width: 60px; }
.device-table col.col-days { width: 68px; }
.device-table col.col-wall { width: 52px; }
.device-table col.col-remark { width: 72px; }
.device-table col.col-ops { width: 300px; }

.device-table th,
.device-table td {
  border: 1px solid rgba(255, 31, 31, 0.85);
  padding: 8px 10px;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(40, 0, 0, 0.94);
  color: #fff;
  font-weight: 500;
  letter-spacing: 0.04em;
  box-shadow: 0 1px 0 var(--red);
}

.device-table tbody tr {
  transition: background 0.18s, box-shadow 0.18s;
}

.device-table tbody tr:hover td {
  background: rgba(255, 31, 31, 0.1);
  box-shadow: inset 0 0 12px rgba(255, 31, 31, 0.12);
}

.device-table th:nth-child(1),
.device-table td.device-id {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 8px 2px;
  overflow: hidden;
}

.device-id {
  font-family: var(--mono);
  color: #ffb3b3;
}

.cell-on {
  color: #3dff8a;
  text-shadow: 0 0 8px rgba(61, 255, 138, 0.45);
}

.cell-off {
  color: #888;
}

.wall-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border: 1px solid var(--red);
  display: inline-block;
  vertical-align: middle;
}

.device-table td:last-child {
  overflow: hidden;
  white-space: normal;
}

.op-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.op-chip {
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  line-height: 24px;
  white-space: nowrap;
  box-shadow: 0 0 8px rgba(255, 31, 31, 0.12);
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}

.op-chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.12);
  box-shadow: 0 0 12px var(--red-glow);
}

.op-chip.console { background: #2f6bff; }
.op-chip.detail { background: #7b4dff; }
.op-chip.log { background: #1aa7a0; }
.op-chip.remark { background: #3d8bfd; }
.op-chip.group { background: #e8942a; }
.op-chip.remove { background: #e23b3b; }
.op-chip.edit { background: #7b4dff; }
.op-chip.pass { background: #1aa7a0; }

.account-table {
  min-width: 0;
}

.account-table col.col-id { width: 44px; }
.account-table col.col-acc-name { width: 140px; }
.account-table col.col-acc-email { width: auto; }
.account-table col.col-acc-role { width: 90px; }
.account-table col.col-acc-dev { width: 80px; }
.account-table col.col-acc-expire { width: 120px; }
.account-table col.col-acc-created { width: 150px; }
.account-table col.col-acc-remark { width: auto; }
.account-table col.col-acc-ops { width: 280px; min-width: 280px; }

.role-tag {
  display: inline-block;
  min-width: 52px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 31, 31, 0.45);
  letter-spacing: 0.08em;
  font-size: 12px;
}

.role-tag.admin { color: #ff6b6b; border-color: rgba(255, 80, 80, 0.7); }
.role-tag.client { color: #3dff8a; border-color: rgba(61, 255, 138, 0.45); }
.role-tag.supervisor { color: #6cb6ff; border-color: rgba(61, 139, 255, 0.55); }

.acct-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.acct-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.acct-field.acct-span {
  grid-column: 1 / -1;
}

.acct-field span {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--red-bright);
  font-family: var(--mono);
}

.acct-field input,
.acct-field select {
  height: 36px;
  width: 100%;
  background: #000;
  border: 1px solid var(--red);
  color: #fff;
  padding: 0 10px;
  outline: none;
}

.acct-field input[readonly] {
  color: #aaa;
}

.hud-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.hud-modal-card {
  width: min(820px, 100%);
  max-height: min(82vh, 760px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(18, 0, 0, 0.94), rgba(0, 0, 0, 0.94));
  padding: 18px 18px 16px;
}

#hud-modal-body {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

#hud-modal-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.hud-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.hud-modal-head h3 {
  letter-spacing: 0.16em;
  font-size: 16px;
}

.hud-close {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--red);
  background: transparent;
  color: #fff;
}

.hud-close:hover {
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.kv {
  border: 1px solid rgba(255, 31, 31, 0.45);
  padding: 8px 10px;
  min-width: 0;
}

.kv b {
  display: block;
  color: var(--red-bright);
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 500;
  margin-bottom: 4px;
  font-family: var(--mono);
}

.kv span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-list {
  list-style: none;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  max-height: 420px;
  overflow: auto;
  scrollbar-width: none;
}

.log-list::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.log-list li {
  border-bottom: 1px solid rgba(255, 31, 31, 0.2);
  padding: 6px 0;
}

.log-list time {
  color: var(--red-bright);
  margin-right: 8px;
}

.group-form {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.group-form .df-field {
  width: 100%;
  min-width: 0;
  max-width: none;
  flex: none;
}

.group-form input {
  width: 100%;
  max-width: none;
  height: 40px;
  background: #000;
  border: 1px solid var(--red);
  color: #fff;
  padding: 0 12px;
}

.hud-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: #666;
}

.status-dot.on {
  background: #22ff88;
  box-shadow: 0 0 8px #22ff88;
}

.device-empty {
  position: absolute;
  inset: 42px 0 0 0;
  display: none;
  place-items: center;
  color: var(--muted);
  letter-spacing: 0.28em;
  font-size: 16px;
  pointer-events: none;
  text-shadow: 0 0 12px var(--red-soft);
}

.device-empty.is-show {
  display: grid;
}

.panel.panel-page.panel-ai {
  display: none;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
}

.panel.panel-page.panel-ai.is-active {
  display: grid;
}

.ai-chat,
.ai-mod {
  min-height: 0;
  background: rgba(0, 0, 0, 0.45);
}

.ai-chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
}

.ai-main {
  display: grid;
  grid-template-rows: minmax(170px, 0.72fr) minmax(280px, 1.4fr);
  gap: 10px;
  min-height: 0;
  height: 100%;
}

.ai-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  min-height: 0;
  align-items: stretch;
}

.ai-bottom .ai-mod {
  min-height: 280px;
}

.ai-mod {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 10px;
}

.ai-mod-head {
  position: relative;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 31, 31, 0.35);
}

.ai-mod-head p {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--red-bright);
}

.ai-mod-head h3 {
  font-size: 15px;
  letter-spacing: 0.12em;
  text-shadow: 0 0 10px var(--red-glow);
}

.ai-live {
  position: absolute;
  right: 0;
  top: 2px;
  font-family: var(--mono);
  font-size: 10px;
  color: #22ff88;
  letter-spacing: 0.14em;
}

.ai-live::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #22ff88;
  box-shadow: 0 0 8px #22ff88;
  animation: blink 1.6s ease-in-out infinite;
}

.ai-chat-log {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px;
}

.ai-msg {
  max-width: 92%;
  padding: 8px 10px;
  border: 1px solid rgba(255, 31, 31, 0.45);
  font-size: 12px;
  line-height: 1.55;
  background: rgba(255, 31, 31, 0.05);
}

.ai-msg.sys {
  color: var(--red-bright);
  font-family: var(--mono);
  font-size: 11px;
}

.ai-msg.bot {
  align-self: flex-start;
}

.ai-msg.user {
  align-self: flex-end;
  background: rgba(255, 31, 31, 0.18);
  box-shadow: 0 0 12px rgba(255, 31, 31, 0.12);
}

.ai-chat-input {
  display: flex;
  gap: 6px;
  padding: 6px;
}

.ai-chat-input input {
  flex: 1;
  min-width: 0;
  height: 34px;
  background: #000;
  border: 1px solid var(--red);
  color: #fff;
  padding: 0 10px;
}

.ai-send {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--red);
  background: rgba(255, 31, 31, 0.25);
  color: #fff;
  letter-spacing: 0.12em;
}

.ai-send:hover {
  background: var(--red);
  box-shadow: 0 0 12px var(--red-glow);
}

.ai-top-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(160px, 0.9fr);
  gap: 10px;
  min-height: 0;
}

.ai-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: stretch;
}

.ai-metric {
  border: 1px solid rgba(255, 31, 31, 0.5);
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255, 31, 31, 0.08), transparent);
  display: grid;
  align-content: center;
}

.ai-metric b {
  display: block;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px var(--red-glow);
}

.ai-metric span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.ai-stream {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 31, 31, 0.45);
  background:
    linear-gradient(rgba(255, 31, 31, 0.08) 1px, transparent 1px) 0 0 / 100% 14px,
    linear-gradient(90deg, rgba(255, 31, 31, 0.08) 1px, transparent 1px) 0 0 / 18px 100%;
}

.ai-wave {
  position: absolute;
  inset: 20% 8%;
  border-radius: 40% 60%;
  border: 1px solid rgba(255, 80, 80, 0.55);
  box-shadow: 0 0 18px rgba(255, 31, 31, 0.25), inset 0 0 18px rgba(255, 31, 31, 0.18);
  animation: radar 8s linear infinite;
}

.ai-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 18px;
  background: linear-gradient(180deg, transparent, rgba(255, 31, 31, 0.35), transparent);
  animation: sweep 2.8s linear infinite;
}

.ai-mod-body {
  min-height: 0;
  overflow: auto;
}

.ai-standby {
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
  color: var(--muted);
}

.ai-hex {
  width: 42px;
  height: 42px;
  margin: 0 auto 6px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  border: 1px solid var(--red);
  box-shadow: 0 0 14px var(--red-soft);
  background: repeating-linear-gradient(-45deg, rgba(255, 31, 31, 0.25) 0 4px, transparent 4px 8px);
}

.ai-standby small {
  font-family: var(--mono);
  letter-spacing: 0.16em;
  color: var(--red-bright);
  font-size: 10px;
}

.ai-link-list {
  list-style: none;
  font-size: 13px;
}

.ai-link-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 31, 31, 0.2);
}

.ai-link-list span {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.ai-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
}

.ai-dot.on {
  background: #22ff88;
  box-shadow: 0 0 8px #22ff88;
}

.ai-dot.warn {
  background: var(--red-bright);
  box-shadow: 0 0 8px var(--red-glow);
}

.panel.panel-page.panel-ov {
  display: none;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.panel.panel-page.panel-ov.is-active {
  display: grid;
}

.ov-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(140px, 180px);
  gap: 8px;
}

.ov-kpi {
  position: relative;
  overflow: hidden;
  text-align: left;
  padding: 10px 12px 12px;
  border: 1px solid rgba(255, 31, 31, 0.7);
  background: linear-gradient(180deg, rgba(255, 31, 31, 0.12), rgba(0, 0, 0, 0.4));
  color: #fff;
  min-height: 86px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.ov-kpi:hover,
.ov-kpi:focus-visible {
  transform: translateY(-2px);
  border-color: var(--red-bright);
  box-shadow: 0 0 18px var(--red-glow);
}

.ov-kpi:active {
  transform: translateY(0) scale(0.99);
}

.ov-kpi-en {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--red-bright);
}

.ov-kpi b {
  display: block;
  margin-top: 4px;
  font-size: 28px;
  letter-spacing: 0.06em;
  text-shadow: 0 0 14px var(--red-glow);
}

.ov-kpi > span:last-of-type {
  color: var(--muted);
  font-size: 12px;
}

.ov-kpi i {
  position: absolute;
  left: -40%;
  top: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 80, 80, 0.22), transparent);
  animation: ov-sheen 3.6s linear infinite;
  pointer-events: none;
}

.ov-kpi:nth-child(2) i { animation-delay: 0.4s; }
.ov-kpi:nth-child(3) i { animation-delay: 0.8s; }
.ov-kpi:nth-child(4) i { animation-delay: 1.2s; }
.ov-kpi:nth-child(5) i { animation-delay: 1.6s; }

@keyframes ov-sheen {
  to { left: 140%; }
}

.ov-clock {
  display: grid;
  align-content: center;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.45);
}

.ov-clock p {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--red-bright);
}

.ov-clock b {
  font-size: 22px;
  letter-spacing: 0.12em;
  text-shadow: 0 0 12px var(--red-glow);
}

.ov-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.15fr 0.95fr;
  grid-template-rows: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.ov-mod {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.45);
}

.ov-feed {
  grid-row: 1 / 3;
  grid-column: 3;
}

.ov-radar-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  cursor: crosshair;
  background:
    radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 31, 31, 0.18), transparent 42%),
    repeating-radial-gradient(circle at 50% 52%, rgba(255, 31, 31, 0.08) 0 1px, transparent 1px 18px);
}

.ov-radar-stage.is-pulse .ov-core-dot {
  animation: ov-hit 0.55s ease-out;
}

@keyframes ov-hit {
  50% { transform: translate(-50%, -50%) scale(1.8); box-shadow: 0 0 28px #fff; }
}

.ov-ring {
  position: absolute;
  left: 50%;
  top: 52%;
  border: 1px solid rgba(255, 31, 31, 0.45);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(255, 31, 31, 0.12);
}

.ov-ring.r1 { width: 34%; aspect-ratio: 1; }
.ov-ring.r2 { width: 56%; aspect-ratio: 1; animation: ov-breathe 3.4s ease-in-out infinite; }
.ov-ring.r3 { width: 78%; aspect-ratio: 1; }

@keyframes ov-breathe {
  50% { transform: translate(-50%, -50%) scale(1.04); opacity: 0.7; }
}

.ov-cross::before,
.ov-cross::after {
  content: "";
  position: absolute;
  background: rgba(255, 31, 31, 0.28);
}

.ov-cross::before {
  left: 8%;
  right: 8%;
  top: 52%;
  height: 1px;
}

.ov-cross::after {
  top: 10%;
  bottom: 10%;
  left: 50%;
  width: 1px;
}

.ov-sweep {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 78%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: conic-gradient(from 0deg, rgba(255, 31, 31, 0.4), transparent 78deg, transparent);
  animation: ov-spin 3.2s linear infinite;
  pointer-events: none;
  border-radius: 50%;
}

@keyframes ov-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.ov-core-dot {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 16px var(--red-glow);
  transform: translate(-50%, -50%);
}

#ov-radar-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ov-radar-meta {
  position: absolute;
  right: 10px;
  bottom: 8px;
  text-align: right;
}

.ov-radar-meta b {
  display: block;
  font-size: 22px;
  text-shadow: 0 0 12px var(--red-glow);
}

.ov-radar-meta span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.ov-load {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.ov-bars {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 4px 2px;
}

.ov-bar {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.ov-bar span {
  color: var(--muted);
}

.ov-bar b {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--red-bright);
  text-align: right;
}

.ov-bar-track {
  height: 8px;
  border: 1px solid rgba(255, 31, 31, 0.5);
  background: rgba(255, 31, 31, 0.06);
  overflow: hidden;
}

.ov-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7a0000, var(--red-bright));
  box-shadow: 0 0 10px var(--red-glow);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.ov-stream {
  margin-top: 8px;
  height: 42px;
  overflow: hidden;
  border: 1px solid rgba(255, 31, 31, 0.3);
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(255, 80, 80, 0.7);
  letter-spacing: 0.18em;
  white-space: nowrap;
  line-height: 42px;
}

.ov-stream::after {
  content: "0x7A  SYNC  1101  PACKET  OK  VECTOR  INDEX  GATEWAY  HEARTBEAT  CHANNEL  ALIVE  0x7A  SYNC  1101  PACKET  OK  ";
  display: inline-block;
  animation: ov-marquee 12s linear infinite;
}

@keyframes ov-marquee {
  to { transform: translateX(-50%); }
}

.ov-feed-list {
  list-style: none;
  overflow: auto;
  min-height: 0;
  scrollbar-width: none;
  font-size: 12px;
}

.ov-feed-list::-webkit-scrollbar { display: none; }

.ov-feed-list li {
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 31, 31, 0.2);
  animation: ov-row-in 0.45s ease both;
}

.ov-feed-list li:hover {
  background: rgba(255, 31, 31, 0.1);
}

@keyframes ov-row-in {
  from { opacity: 0; transform: translateX(8px); }
}

.ov-feed-list time {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--red-bright);
}

.ov-feed-list em {
  color: var(--muted);
  font-style: normal;
  margin-right: 6px;
}

.ov-regions {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 4px 2px;
}

.ov-region {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.ov-region .ov-bar-track { height: 10px; cursor: pointer; }
.ov-region:hover .ov-bar-fill { filter: brightness(1.25); }

.ov-nodes {
  list-style: none;
  overflow: auto;
  min-height: 0;
  scrollbar-width: none;
}

.ov-nodes::-webkit-scrollbar { display: none; }

.ov-nodes li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 31, 31, 0.2);
  cursor: pointer;
  transition: background 0.18s;
}

.ov-nodes li:hover {
  background: rgba(255, 31, 31, 0.1);
  box-shadow: inset 0 0 12px rgba(255, 31, 31, 0.12);
}

.ov-nodes small {
  color: var(--muted);
  font-size: 11px;
}

.ov-empty {
  color: var(--muted);
  letter-spacing: 0.16em;
  font-size: 12px;
  padding: 16px 4px;
}

@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
  }

  .app-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .nav-item {
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .app-user {
    justify-content: flex-end;
  }

  .df-actions {
    margin-left: 0;
    width: 100%;
  }

  .df-btn {
    flex: 1;
  }

  .panel.panel-page.panel-ai {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .ov-kpis,
  .ov-grid {
    grid-template-columns: 1fr;
  }

  .ov-feed {
    grid-row: auto;
    grid-column: auto;
    min-height: 240px;
  }

  .ov-radar-stage {
    min-height: 220px;
  }

  .ai-bottom,
  .ai-top-body {
    grid-template-columns: 1fr;
  }

  .ai-chat {
    min-height: 280px;
  }
}

@media (max-width: 560px) {
  .login-card {
    padding: 28px 18px 18px;
  }

  .login-head h1 {
    font-size: 22px;
    letter-spacing: 0.08em;
  }

  .view-app {
    padding: 8px;
    gap: 8px;
  }

  .panel h2 {
    letter-spacing: 0.08em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
