@import url('/design/system.css');

.nexus-shell {
  background: var(--ds-bg);
  color: var(--ds-text);
  font-family: var(--ds-font);
}

/* ── Page header (inner routes) ── */
.nexus-shell .page-header h2 {
  font-size: var(--ds-text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nexus-shell .panel,
.nexus-shell .stat-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
}

/* ── Dashboard layout ── */
.nx-dashboard {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.nx-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.nx-page-head__eyebrow {
  margin: 0 0 4px;
  font-family: var(--ds-mono);
  font-size: var(--ds-text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ds-primary);
}

.nx-page-head h1 {
  margin: 0;
  font-size: var(--ds-text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.nx-page-head__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: var(--ds-text-sm);
  color: var(--ds-text-muted);
}

.nx-page-head__meta strong {
  color: var(--ds-text-secondary);
  font-weight: 500;
}

/* ── Stat cards row ── */
.nx-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--ds-gutter);
}

@media (max-width: 1100px) {
  .nx-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .nx-stats { grid-template-columns: 1fr; }
}

.nx-stat {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
  padding: 20px;
}

.nx-stat__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.nx-stat__label {
  font-size: var(--ds-text-sm);
  color: var(--ds-text-secondary);
  font-weight: 500;
}

.nx-stat__icon {
  color: var(--ds-text-muted);
}

.nx-stat__icon .material-symbols-outlined { font-size: 20px; }

.nx-stat__value {
  font-size: var(--ds-text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ds-text);
}

.nx-stat__sub {
  margin-top: 8px;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
}

.nx-stat__sub em {
  font-style: normal;
  font-weight: 600;
}

.nx-stat__sub em.ok { color: var(--ds-ok); }
.nx-stat__sub em.err { color: var(--ds-err); }
.nx-stat__sub em.warn { color: var(--ds-warn); }

/* ── Two-column workspace ── */
.nx-workspace {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--ds-gutter);
  align-items: start;
}

@media (max-width: 1024px) {
  .nx-workspace { grid-template-columns: 1fr; }
}

.nx-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
  overflow: hidden;
}

.nx-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ds-border-subtle);
  background: var(--ds-bg-dim);
}

.nx-card__head h2 {
  margin: 0;
  font-size: var(--ds-text-md);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nx-card__body { padding: 0; }

.nx-card__body--pad { padding: 20px; }

.nx-link {
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-primary);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.nx-link:hover { text-decoration: underline; }

/* ── Table ── */
.nx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ds-text-sm);
}

.nx-table th {
  padding: 10px 20px;
  text-align: left;
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ds-text-muted);
  background: var(--ds-surface-high);
  border-bottom: 1px solid var(--ds-border-subtle);
}

.nx-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--ds-border-subtle);
  color: var(--ds-text-secondary);
}

.nx-table tbody tr:last-child td { border-bottom: none; }

.nx-table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

.nx-table td strong { color: var(--ds-text); font-weight: 600; }

.nx-table .mono {
  font-family: var(--ds-mono);
  font-size: var(--ds-text-xs);
}

.nx-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nx-badge--ok {
  background: rgba(110, 231, 183, 0.1);
  color: var(--ds-ok);
}

.nx-badge--off {
  background: rgba(248, 113, 113, 0.1);
  color: var(--ds-err);
}

.nx-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Aside panels ── */
.nx-aside {
  display: flex;
  flex-direction: column;
  gap: var(--ds-gutter);
}

.nx-aside .nx-card__head h2 {
  font-size: var(--ds-text-base);
}

.nx-action-list {
  display: flex;
  flex-direction: column;
}

.nx-action {
  display: block;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ds-border-subtle);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}

.nx-action:last-child { border-bottom: none; }

.nx-action:hover { background: rgba(255, 255, 255, 0.03); }

.nx-action strong {
  display: block;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-text);
  margin-bottom: 2px;
}

.nx-action span {
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
}

.nx-queue-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--ds-border-subtle);
}

.nx-queue-item:last-child { border-bottom: none; }

.nx-queue-item strong {
  display: block;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  margin-bottom: 2px;
}

.nx-queue-item p {
  margin: 0 0 8px;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
}

.nx-queue-count {
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ds-warn);
}

/* ── Activity feed ── */
.nx-feed { margin-top: 8px; }

.nx-feed-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ds-border-subtle);
}

.nx-feed-item:last-child { border-bottom: none; }

.nx-feed-item:hover { background: rgba(255, 255, 255, 0.02); }

.nx-feed-item__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--ds-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ds-surface-high);
  color: var(--ds-text-muted);
}

.nx-feed-item__icon .material-symbols-outlined { font-size: 18px; }

.nx-feed-item__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.nx-feed-item__title strong {
  font-size: var(--ds-text-sm);
  font-weight: 600;
}

.nx-feed-item__tag {
  font-family: var(--ds-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--ds-surface-highest);
  color: var(--ds-text-muted);
}

.nx-feed-item__msg {
  margin: 0;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
}

.nx-feed-item__time {
  text-align: right;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  white-space: nowrap;
}

.nx-feed-item__time small {
  display: block;
  font-size: 10px;
  opacity: 0.8;
}

.nx-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--ds-text-muted);
  font-size: var(--ds-text-sm);
}

.nx-modules-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--ds-gutter);
  padding: 20px;
}

.nx-module-chip {
  padding: 16px;
  border-radius: var(--ds-radius);
  border: 1px solid var(--ds-border-subtle);
  background: var(--ds-surface-low);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s;
}

.nx-module-chip:hover { border-color: rgba(173, 198, 255, 0.35); }

.nx-module-chip strong {
  display: block;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ds-text);
}

.nx-module-chip span {
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
}

/* ── Users / orchestration page ── */
.nx-users {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 48px;
}

.nx-users__head h1 {
  font-size: var(--ds-text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 4px;
  color: var(--ds-text);
}

.nx-users__head p {
  margin: 0;
  font-size: var(--ds-text-base);
  color: var(--ds-text-muted);
}

.nx-stat__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--ds-text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  margin-left: 8px;
}

.nx-stat__badge--live {
  background: rgba(20, 209, 255, 0.12);
  color: #4cd6ff;
}

.nx-stat__badge--crit {
  background: rgba(147, 0, 10, 0.25);
  color: var(--ds-err);
}

.nx-stat__badge--queue {
  background: rgba(239, 103, 25, 0.15);
  color: #ffb595;
}

.nx-stat__spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 48px;
  margin-top: 16px;
  opacity: 0.5;
}

.nx-stat__spark span {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-height: 4px;
}

.nx-stat__spark--primary span { background: rgba(173, 198, 255, 0.25); }
.nx-stat__spark--ok span { background: rgba(20, 209, 255, 0.25); }
.nx-stat__spark--err span { background: rgba(248, 113, 113, 0.25); }
.nx-stat__spark--warn span { background: rgba(255, 181, 149, 0.25); }

.nx-users__workspace {
  display: grid;
  grid-template-columns: 1fr 384px;
  gap: var(--ds-gutter);
  align-items: start;
}

.nx-users__table-card {
  min-width: 0;
}

@media (max-width: 1100px) {
  .nx-users__workspace { grid-template-columns: 1fr; }
}

.nx-users__table-card .nx-card__head {
  padding: 20px 24px;
}

.nx-users__toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nx-btn-ghost {
  padding: 6px 16px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(49, 53, 61, 0.35);
  color: var(--ds-text-secondary);
  font-size: var(--ds-text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.nx-btn-ghost:hover {
  background: rgba(49, 53, 61, 0.55);
}

.nx-btn-primary {
  padding: 6px 16px;
  border-radius: var(--ds-radius-sm);
  border: none;
  background: var(--ds-primary);
  color: #002e69;
  font-size: var(--ds-text-sm);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(75, 142, 255, 0.25);
  transition: filter 0.12s, transform 0.08s;
}

.nx-btn-primary:hover { filter: brightness(1.08); }
.nx-btn-primary:active { transform: scale(0.98); }

.nx-users-table td,
.nx-users-table th {
  padding: 16px 24px;
}

.nx-users-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.nx-users-table {
  min-width: 920px;
}

.nx-users-table .nx-col-compact {
  white-space: nowrap;
  padding-left: 16px;
  padding-right: 16px;
}

.nx-users-table .nx-col-access {
  max-width: 200px;
}

.nx-users-table .nx-col-access .nx-access-ok,
.nx-users-table .nx-col-access .nx-access-warn {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nx-users-table .nx-col-actions,
.nx-users-table th.nx-col-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 132px;
  padding-left: 16px;
  padding-right: 20px;
  background: var(--ds-surface);
  box-shadow: -10px 0 18px rgba(11, 14, 22, 0.28);
}

.nx-users-table thead th.nx-col-actions {
  background: rgba(24, 28, 35, 0.98);
  z-index: 3;
}

.nx-users-table tbody tr:hover td.nx-col-actions {
  background: rgba(28, 32, 40, 0.98);
}

.nx-users-table-wrap:focus-visible {
  outline: 2px solid rgba(173, 198, 255, 0.35);
  outline-offset: -2px;
  border-radius: 0 0 var(--ds-radius-lg) var(--ds-radius-lg);
}

.nx-users-table th {
  font-family: var(--ds-mono);
  font-size: var(--ds-text-xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ds-text-muted);
  background: rgba(24, 28, 35, 0.35);
  border-bottom: 1px solid var(--ds-border-subtle);
}

.nx-users-table td {
  font-size: var(--ds-text-sm);
  color: var(--ds-text-secondary);
  border-bottom: 1px solid var(--ds-border-subtle);
  vertical-align: middle;
}

.nx-users-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.nx-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nx-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.nx-user-avatar--primary {
  background: rgba(173, 198, 255, 0.2);
  color: var(--ds-primary);
}

.nx-user-avatar--secondary {
  background: rgba(20, 209, 255, 0.15);
  color: #14d1ff;
}

.nx-user-avatar--muted {
  background: rgba(65, 71, 85, 0.35);
  color: var(--ds-text-muted);
}

.nx-user-cell strong {
  display: block;
  font-size: var(--ds-text-base);
  font-weight: 600;
  color: var(--ds-text);
}

.nx-user-cell small {
  display: block;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
}

.nx-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.nx-role-badge--admin {
  background: rgba(173, 198, 255, 0.1);
  color: var(--ds-primary);
  border-color: rgba(173, 198, 255, 0.2);
}

.nx-role-badge--org {
  background: rgba(239, 103, 25, 0.1);
  color: #ffb595;
  border-color: rgba(255, 181, 149, 0.2);
}

.nx-role-badge--operator {
  background: rgba(49, 53, 61, 0.45);
  color: var(--ds-text-secondary);
  border-color: var(--ds-border-subtle);
}

.nx-access-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4cd6ff;
  font-size: var(--ds-text-sm);
}

.nx-access-ok .material-symbols-outlined {
  font-size: 16px;
  font-variation-settings: 'FILL' 1;
}

.nx-access-warn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ds-err);
  font-size: var(--ds-text-sm);
}

.nx-access-warn .material-symbols-outlined { font-size: 16px; }

.nx-row-actions {
  display: flex;
  gap: 4px;
}

.nx-icon-btn {
  padding: 4px;
  border: none;
  background: transparent;
  color: var(--ds-text-muted);
  cursor: pointer;
  border-radius: 4px;
  line-height: 0;
  transition: color 0.12s;
}

.nx-icon-btn .material-symbols-outlined { font-size: 18px; }
.nx-icon-btn:hover { color: var(--ds-primary); }
.nx-icon-btn--danger:hover { color: var(--ds-err); }
.nx-icon-btn--warn:hover { color: #ffb595; }
.nx-icon-btn--ok:hover { color: #4cd6ff; }

.nx-table-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-top: 1px solid var(--ds-border-subtle);
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
}

.nx-table-foot__nav {
  display: flex;
  gap: 4px;
}

.nx-table-foot__nav button {
  padding: 4px;
  border: none;
  background: transparent;
  color: var(--ds-text-muted);
  cursor: pointer;
  border-radius: 4px;
}

.nx-table-foot__nav button:hover:not(:disabled) {
  background: rgba(49, 53, 61, 0.5);
}

.nx-table-foot__nav button:disabled {
  opacity: 0.35;
  cursor: default;
}

.nx-cmd-panel .nx-card__head {
  padding: 20px 24px;
}

.nx-cmd-live {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(239, 103, 25, 0.1);
  color: #ffb595;
  border: 1px solid rgba(255, 181, 149, 0.2);
}

.nx-cmd-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 600px;
  overflow-y: auto;
}

.nx-cmd-item {
  padding: 16px;
  border-radius: var(--ds-radius);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(39, 42, 50, 0.5);
  transition: border-color 0.12s;
}

.nx-cmd-item:hover { border-color: rgba(173, 198, 255, 0.35); }
.nx-cmd-item--retry:hover { border-color: rgba(248, 113, 113, 0.45); }

.nx-cmd-item__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.nx-cmd-item__top strong {
  font-size: var(--ds-text-base);
  font-weight: 700;
  color: var(--ds-text);
}

.nx-cmd-item__device {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-family: var(--ds-mono);
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
}

.nx-cmd-item__device .material-symbols-outlined { font-size: 14px; }

.nx-cmd-item__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nx-cmd-status {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--ds-text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nx-cmd-status--running {
  background: rgba(20, 209, 255, 0.12);
  color: #4cd6ff;
}

.nx-cmd-status--pending {
  background: rgba(239, 103, 25, 0.12);
  color: #ffb595;
}

.nx-cmd-status--retry {
  background: rgba(147, 0, 10, 0.25);
  color: var(--ds-err);
}

.nx-cmd-item__by {
  font-size: 10px;
  font-style: italic;
  color: var(--ds-text-muted);
}

.nx-cmd-panel__footer {
  width: 100%;
  padding: 16px;
  border: none;
  border-top: 1px solid var(--ds-border-subtle);
  background: rgba(24, 28, 35, 0.8);
  color: var(--ds-primary);
  font-size: var(--ds-text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
  display: block;
  text-align: center;
}

.nx-cmd-panel__footer:hover { background: rgba(54, 57, 66, 0.35); }

.nx-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(11, 14, 22, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: nx-modal-fade-in 0.18s ease-out;
}

.nx-modal-backdrop.hidden {
  display: none;
}

.nx-modal-backdrop--confirm {
  z-index: 220;
}

.nx-modal--confirm {
  width: min(420px, 100%);
}

.nx-confirm-modal__body {
  padding: 28px 24px 24px;
  text-align: center;
}

.nx-confirm-modal__icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.nx-confirm-modal__icon .material-symbols-outlined {
  font-size: 26px;
}

.nx-confirm-modal__icon--neutral {
  background: rgba(0, 102, 255, 0.14);
  color: var(--ds-primary);
}

.nx-confirm-modal__icon--warn {
  background: rgba(239, 103, 25, 0.14);
  color: #ffb595;
}

.nx-confirm-modal__icon--danger {
  background: rgba(248, 81, 73, 0.14);
  color: var(--ds-err);
}

.nx-confirm-modal__title {
  margin: 0 0 8px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ds-text-primary);
}

.nx-confirm-modal__message {
  margin: 0 0 20px;
  font-size: var(--ds-text-sm);
  line-height: 1.55;
  color: var(--ds-text-secondary);
}

.nx-confirm-modal__user {
  margin: 0 0 20px;
  text-align: left;
}

.nx-confirm-modal__actions {
  display: flex;
  gap: 10px;
}

.nx-confirm-modal__actions .nx-btn-ghost,
.nx-confirm-modal__actions .nx-btn-primary,
.nx-confirm-modal__actions .nx-btn-danger {
  flex: 1;
  justify-content: center;
  padding: 10px 16px;
}

.nx-btn-danger {
  padding: 6px 16px;
  border-radius: var(--ds-radius-sm);
  border: none;
  background: var(--ds-err);
  color: #fff;
  font-size: var(--ds-text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s;
}

.nx-btn-danger:hover {
  background: #da3633;
}

@keyframes nx-modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes nx-modal-slide-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.nx-modal {
  width: min(448px, 100%);
  max-height: min(90vh, 860px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(22, 27, 34, 0.92);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(48, 54, 61, 0.85);
  border-radius: var(--ds-radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  animation: nx-modal-slide-in 0.22s ease-out;
}

.nx-modal--wide {
  width: min(520px, 100%);
}

.nx-modal--users {
  width: min(640px, calc(100vw - 32px));
  max-height: min(90vh, 880px);
}

.nx-modal__content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.nx-modal__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nx-modal__scroll > * {
  flex-shrink: 0;
}

.nx-modal__footer {
  flex-shrink: 0;
  border-top: 1px solid var(--ds-border-subtle);
  background: rgba(24, 28, 35, 0.78);
  padding: 16px 24px 0;
}

.nx-modal__footer .nx-modal__actions {
  padding-top: 0;
  margin-top: 0;
}

.nx-modal__footer .nx-modal__foot-danger {
  padding: 10px 0 16px;
  margin-top: 0;
}

.nx-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--ds-border-subtle);
  background: rgba(24, 28, 35, 0.55);
  flex-shrink: 0;
}

.nx-modal__head h3 {
  margin: 0;
  font-size: var(--ds-text-md);
  font-weight: 600;
  color: var(--ds-text);
  letter-spacing: -0.01em;
}

.nx-modal__body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.nx-modal__body > * {
  flex-shrink: 0;
}

.nx-modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nx-modal-field__label {
  font-family: var(--ds-mono);
  font-size: var(--ds-text-xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ds-text-secondary);
}

.nx-modal-field__input,
.nx-modal-field select {
  width: 100%;
  padding: 8px 16px;
  font: inherit;
  font-size: var(--ds-text-base);
  color: var(--ds-text);
  background: var(--ds-surface-low);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.nx-modal-field__input::placeholder {
  color: var(--ds-text-muted);
}

.nx-modal-field__input:focus,
.nx-modal-field select:focus {
  outline: none;
  border-color: var(--ds-primary);
  box-shadow: 0 0 0 2px rgba(173, 198, 255, 0.12);
}

.nx-modal-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b90a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.nx-modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .nx-modal-row { grid-template-columns: 1fr; }
}

.nx-modal-user-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(39, 42, 50, 0.45);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
}

.nx-modal-user-strip__meta {
  flex: 1;
  min-width: 0;
}

.nx-modal-user-strip__meta strong {
  display: block;
  font-size: var(--ds-text-base);
  font-weight: 600;
  color: var(--ds-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-modal-user-strip__meta small {
  display: block;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  margin-top: 2px;
}

.nx-modal-section {
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
  overflow: visible;
  background: rgba(24, 28, 35, 0.35);
}

.nx-modal-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ds-border-subtle);
  background: rgba(24, 28, 35, 0.45);
}

.nx-modal-section__title {
  display: block;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-text);
  line-height: 1.25;
}

.nx-modal-section__desc {
  display: block;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  margin-top: 2px;
  line-height: 1.35;
}

.nx-modal-section__body {
  padding: 14px 16px 16px;
}

.nx-modal-section__body--compact {
  padding-top: 12px;
}

.nx-modal-section__note {
  margin: 0 0 10px;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  line-height: 1.45;
}

.nx-access-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ds-border-subtle);
  background: rgba(24, 28, 35, 0.45);
}

.nx-access-toolbar__title {
  display: block;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-text);
}

.nx-access-toolbar__meta {
  display: block;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  margin-top: 2px;
}

.nx-access-toolbar__action {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: 999px;
  background: transparent;
  color: var(--ds-primary);
  font-size: var(--ds-text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.nx-access-toolbar__action:hover {
  background: rgba(173, 198, 255, 0.08);
  border-color: rgba(173, 198, 255, 0.35);
}

.nx-access-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  max-height: 260px;
  overflow-y: auto;
}

.nx-modal--users .nx-access-list {
  max-height: none;
  overflow: visible;
}

.nx-modal--users .nx-access-list--modules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.nx-modal--users .nx-access-list--restrict {
  padding: 0;
  gap: 8px;
}

@media (max-width: 560px) {
  .nx-modal--users .nx-access-list--modules {
    grid-template-columns: 1fr;
  }
}

.nx-access-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--ds-radius-lg);
  border: 1px solid transparent;
  background: rgba(24, 28, 35, 0.55);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  user-select: none;
}

.nx-access-item input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.nx-access-item:hover:not(.is-locked) {
  background: rgba(39, 42, 50, 0.75);
  border-color: var(--ds-border-subtle);
}

.nx-access-item.is-selected {
  border-color: rgba(173, 198, 255, 0.42);
  background: rgba(75, 142, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(75, 142, 255, 0.08);
}

.nx-access-item.is-locked {
  opacity: 0.72;
  cursor: default;
}

.nx-access-item__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nx-access-item__icon .material-symbols-outlined {
  font-size: 20px;
}

.nx-access-item__icon--primary {
  background: rgba(75, 142, 255, 0.16);
  color: var(--ds-primary);
}

.nx-access-item__icon--secondary {
  background: rgba(20, 209, 255, 0.12);
  color: #4cd6ff;
}

.nx-access-item__icon--tertiary {
  background: rgba(239, 103, 25, 0.14);
  color: #ffb595;
}

.nx-access-item__icon--muted {
  background: rgba(139, 144, 160, 0.14);
  color: var(--ds-text-muted);
}

.nx-access-item__body {
  flex: 1;
  min-width: 0;
}

.nx-access-item__body strong {
  display: block;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-text);
  line-height: 1.25;
}

.nx-access-item__body span {
  display: block;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  line-height: 1.35;
  margin-top: 2px;
}

.nx-access-item__check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--ds-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s;
}

.nx-access-item__check .material-symbols-outlined {
  font-size: 14px;
  font-weight: 700;
}

.nx-access-item.is-selected .nx-access-item__check {
  border-color: var(--ds-primary);
  background: var(--ds-primary);
  color: #002e69;
  transform: scale(1.02);
}

.nx-access-item--restrict.is-restricted {
  border-color: rgba(255, 107, 107, 0.42);
  background: rgba(255, 107, 107, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.08);
}

.nx-access-item--restrict.is-restricted .nx-access-item__check {
  border-color: var(--ds-err);
  background: var(--ds-err);
  color: #fff;
  transform: scale(1.02);
}

.nx-access-item__icon--warn {
  background: rgba(255, 107, 107, 0.14);
  color: var(--ds-err);
}

.nx-modal-field__hint--tight {
  margin: 4px 0 12px;
}

.nx-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.nx-status-badge .material-symbols-outlined {
  font-size: 14px;
}

.nx-status-badge--active {
  background: rgba(76, 214, 255, 0.1);
  color: #4cd6ff;
  border-color: rgba(76, 214, 255, 0.2);
}

.nx-status-badge--suspended {
  background: rgba(255, 107, 107, 0.1);
  color: var(--ds-err);
  border-color: rgba(255, 107, 107, 0.25);
}

.nx-user-row--suspended td {
  opacity: 0.72;
}

.nx-status-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.nx-status-toggle__option {
  display: block;
  min-width: 0;
  cursor: pointer;
}

.nx-status-toggle__option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.nx-status-toggle__pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid var(--ds-border-subtle);
  background: rgba(24, 28, 35, 0.55);
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-text-secondary);
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.nx-status-toggle__pill .material-symbols-outlined {
  font-size: 18px;
}

.nx-status-toggle__option input:checked + .nx-status-toggle__pill--active {
  border-color: rgba(76, 214, 255, 0.55);
  background: rgba(76, 214, 255, 0.12);
  color: #4cd6ff;
  box-shadow: inset 0 0 0 1px rgba(76, 214, 255, 0.12);
}

.nx-status-toggle__option input:checked + .nx-status-toggle__pill--suspended {
  border-color: rgba(255, 107, 107, 0.55);
  background: rgba(255, 107, 107, 0.12);
  color: var(--ds-err);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.12);
}

.nx-status-toggle__option:hover .nx-status-toggle__pill {
  border-color: rgba(173, 198, 255, 0.28);
}

.nx-modal--users .nx-access-item {
  padding: 12px;
  gap: 10px;
}

.nx-modal--users .nx-access-item__body span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nx-modal--users .nx-access-item__icon {
  width: 34px;
  height: 34px;
}

.nx-access-empty {
  margin: 0;
  padding: 16px 8px;
  text-align: center;
  font-size: var(--ds-text-sm);
  color: var(--ds-text-muted);
}

.nx-modal-field__hint {
  margin: -8px 0 0;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  line-height: 1.45;
}

.nx-modal-section.hidden {
  display: none;
}

.nx-modal-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
}

.nx-modal-toggle-row__label {
  font-size: var(--ds-text-base);
  color: var(--ds-text-secondary);
  line-height: 1.4;
}

.nx-modal-toggle-row__hint {
  display: block;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  margin-top: 2px;
}

.nx-modal-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  cursor: pointer;
}

.nx-modal-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.nx-modal-switch__track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(49, 53, 61, 0.55);
  transition: background 0.18s;
  position: relative;
}

.nx-modal-switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s;
}

.nx-modal-switch input:checked + .nx-modal-switch__track {
  background: var(--ds-primary);
}

.nx-modal-switch input:checked + .nx-modal-switch__track::after {
  transform: translateX(20px);
}

.nx-modal-switch input:focus-visible + .nx-modal-switch__track {
  outline: 2px solid var(--ds-primary);
  outline-offset: 2px;
}

.nx-modal__actions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
  flex-shrink: 0;
}

.nx-modal__actions .nx-btn-ghost,
.nx-modal__actions .nx-btn-primary {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--ds-radius-lg);
  font-size: var(--ds-text-base);
}

.nx-modal__actions .nx-btn-ghost {
  text-align: center;
}

.nx-modal__foot-danger {
  padding: 0 24px 20px;
  margin-top: -4px;
  flex-shrink: 0;
}

.nx-modal-delete-note {
  margin: 0 0 10px;
  font-size: var(--ds-text-sm);
  line-height: 1.45;
  color: var(--ds-text-muted);
}

.nx-modal-delete-note.hidden {
  display: none;
}

.nx-modal__foot-danger button {
  width: 100%;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--ds-err);
  font-size: var(--ds-text-sm);
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--ds-radius);
  transition: background 0.12s;
}

.nx-modal__foot-danger button:hover {
  background: rgba(248, 113, 113, 0.08);
}

/* Device inventory page */
.di-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 48px;
}

.di-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 4px;
}

.di-head__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  font-size: var(--ds-text-sm);
  font-weight: 500;
  color: var(--ds-text-muted);
  text-decoration: none;
  transition: color 0.12s;
}

.di-head__back .material-symbols-outlined {
  font-size: 18px;
}

.di-head__back:hover {
  color: var(--ds-primary);
}

.di-head__profile {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.di-head__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(173, 198, 255, 0.2);
  color: var(--ds-primary);
}

.di-head__avatar--muted {
  background: rgba(65, 71, 85, 0.35);
  color: var(--ds-text-muted);
}

.di-head__avatar--muted .material-symbols-outlined {
  font-size: 22px;
}

.di-head h1 {
  font-size: var(--ds-text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 2px;
  color: var(--ds-text);
}

.di-head__sub {
  margin: 0 0 8px;
  font-size: var(--ds-text-sm);
  color: var(--ds-text-muted);
}

.di-head__stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--ds-text-sm);
  color: var(--ds-text-muted);
}

.di-head__stats strong {
  color: var(--ds-text);
  font-weight: 700;
}

.di-head__dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ds-border-subtle);
}

.di-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid var(--ds-border-subtle);
  background: var(--ds-surface);
}

.di-search .material-symbols-outlined {
  font-size: 18px;
  color: var(--ds-text-muted);
}

.di-search__input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 0;
  font-size: var(--ds-text-sm);
  color: var(--ds-text);
  outline: none;
}

.di-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding: 16px 20px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
}

.di-toolbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  min-width: 200px;
  padding: 0 12px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(24, 28, 35, 0.65);
}

.di-toolbar__search .material-symbols-outlined {
  font-size: 18px;
  color: var(--ds-text-muted);
}

.di-toolbar__search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: var(--ds-text-sm);
  color: var(--ds-text);
  outline: none;
}

.di-toolbar__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.di-toolbar__stats {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-size: var(--ds-text-sm);
  color: var(--ds-text-muted);
  white-space: nowrap;
}

.di-toolbar__stats strong {
  color: var(--ds-text);
  font-weight: 700;
}

.di-toolbar__dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ds-border-subtle);
}

.di-owner-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.di-owner-clear {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--ds-text-muted);
  font-size: var(--ds-text-sm);
  cursor: pointer;
  text-decoration: underline;
}

.di-owner-clear:hover {
  color: var(--ds-text);
}

.di-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.di-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.di-card:hover {
  border-color: rgba(173, 198, 255, 0.2);
}

.di-card.is-online {
  border-left: 3px solid #4cd6ff;
}

.di-card.is-offline {
  border-left: 3px solid rgba(113, 118, 128, 0.5);
  opacity: 0.92;
}

.di-card.is-pushing {
  pointer-events: none;
  opacity: 0.75;
}

.di-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 12px;
}

.di-card__identity {
  display: flex;
  gap: 14px;
  min-width: 0;
}

.di-card__icon {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--ds-radius-sm);
  background: rgba(49, 53, 61, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.di-card__icon .material-symbols-outlined {
  font-size: 22px;
  color: var(--ds-text-secondary);
}

.di-card__status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--ds-surface);
  background: var(--ds-text-muted);
}

.di-card.is-online .di-card__status-dot {
  background: #4cd6ff;
  box-shadow: 0 0 8px rgba(76, 214, 255, 0.5);
}

.di-card__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.di-card__title-row strong {
  font-size: var(--ds-text-md);
  font-weight: 600;
  color: var(--ds-text);
}

.di-card__pending {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(239, 103, 25, 0.15);
  color: #ffb595;
  font-size: var(--ds-text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.di-card__meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: var(--ds-text-sm);
  color: var(--ds-text-muted);
}

.di-card__sep {
  opacity: 0.45;
}

.di-card__aside {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.di-card__seen {
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  white-space: nowrap;
}

.di-card__fleet-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--ds-radius-sm);
  color: var(--ds-text-muted);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.di-card__fleet-link:hover {
  background: rgba(75, 142, 255, 0.12);
  color: var(--ds-primary);
}

.di-card__fleet-link .material-symbols-outlined {
  font-size: 18px;
}

.di-card__cmd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px 20px;
}

.di-card__cmd-icon {
  font-size: 18px;
  color: var(--ds-text-muted);
  flex-shrink: 0;
}

.di-card__cmd-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(24, 28, 35, 0.55);
  color: var(--ds-text);
  font-family: var(--ds-mono);
  font-size: var(--ds-text-sm);
  outline: none;
  transition: border-color 0.12s;
}

.di-card__cmd-input:focus {
  border-color: rgba(173, 198, 255, 0.45);
}

.di-card__cmd-input::placeholder {
  color: var(--ds-text-muted);
  font-family: inherit;
}

.di-card__cmd-run {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-primary);
  color: #002e69;
  font-size: var(--ds-text-sm);
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter 0.12s, opacity 0.12s;
}

.di-card__cmd-run .material-symbols-outlined {
  font-size: 16px;
}

.di-card__cmd-run:hover:not(:disabled) {
  filter: brightness(1.08);
}

.di-card__cmd-run:disabled {
  opacity: 0.55;
  cursor: wait;
}

.di-card__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 14px 20px;
}

.di-card__quick-btn {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--ds-border-subtle);
  background: rgba(49, 53, 61, 0.35);
  color: var(--ds-text-secondary);
  font-family: var(--ds-mono);
  font-size: var(--ds-text-xs);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.di-card__quick-btn:hover:not(:disabled) {
  background: rgba(75, 142, 255, 0.1);
  border-color: rgba(173, 198, 255, 0.25);
  color: var(--ds-text);
}

.di-card__quick-btn--script {
  font-family: inherit;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.di-card__quick-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.di-card__restricted {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.18);
  color: var(--ds-text-muted);
  font-size: var(--ds-text-xs);
}

.di-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 64px 24px;
  text-align: center;
  color: var(--ds-text-muted);
  background: var(--ds-surface);
  border: 1px dashed var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
}

.di-empty .material-symbols-outlined {
  font-size: 40px;
  opacity: 0.45;
}

.di-empty p {
  margin: 0;
  font-size: var(--ds-text-base);
}

/* Legacy device inventory table styles (users page links) */
.nx-device-inventory {
  margin-top: 0;
}

.nx-device-inventory .nx-card__head {
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}

.nx-device-inventory__sub {
  margin: 4px 0 0;
  font-size: var(--ds-text-sm);
  color: var(--ds-text-muted);
  max-width: 52ch;
}

.nx-device-inventory__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: auto;
}

.nx-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nx-filter-field__input {
  min-width: 180px;
  padding: 8px 12px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(24, 28, 35, 0.65);
  color: var(--ds-text);
  font-size: var(--ds-text-sm);
}

.nx-device-inventory__table-wrap {
  overflow-x: auto;
}

.nx-device-table td,
.nx-device-table th {
  padding: 14px 20px;
}

.nx-device-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nx-device-cell .material-symbols-outlined {
  color: var(--ds-text-muted);
  font-size: 20px;
}

.nx-device-cell strong {
  display: block;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-text);
}

.nx-device-cell small {
  display: block;
  font-size: var(--ds-text-xs);
  color: var(--ds-text-muted);
  font-family: var(--ds-mono);
}

.nx-device-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ds-text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.nx-device-status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.nx-device-status.is-online {
  color: #4cd6ff;
}

.nx-device-status.is-online .nx-device-status__dot {
  background: #4cd6ff;
  box-shadow: 0 0 8px rgba(76, 214, 255, 0.55);
}

.nx-device-status.is-offline {
  color: var(--ds-text-muted);
}

.nx-device-status.is-offline .nx-device-status__dot {
  background: var(--ds-text-muted);
}

.nx-device-count {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--ds-border-subtle);
  background: rgba(49, 53, 61, 0.35);
  color: var(--ds-text);
  font-size: var(--ds-text-sm);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}

.nx-device-count:hover {
  background: rgba(75, 142, 255, 0.12);
  border-color: rgba(173, 198, 255, 0.25);
}

.nx-device-count__label {
  font-size: var(--ds-text-xs);
  font-weight: 500;
  color: var(--ds-text-muted);
}

.nx-users__head-link {
  margin: 8px 0 0;
  font-size: var(--ds-text-sm);
}

.nx-users__head-link a {
  color: var(--ds-primary);
  font-weight: 600;
  text-decoration: none;
}

.nx-users__head-link a:hover {
  text-decoration: underline;
}

.nx-device-inventory-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 48px;
}

.nx-owner-summary__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nx-owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(49, 53, 61, 0.35);
  color: var(--ds-text-secondary);
  font-size: var(--ds-text-sm);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.nx-owner-chip:hover {
  background: rgba(75, 142, 255, 0.08);
  border-color: rgba(173, 198, 255, 0.2);
}

.nx-owner-chip.is-active {
  background: rgba(75, 142, 255, 0.15);
  border-color: rgba(173, 198, 255, 0.35);
  color: var(--ds-text);
}

.nx-owner-chip__name {
  font-weight: 500;
}

.nx-owner-chip__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(24, 28, 35, 0.55);
  font-size: var(--ds-text-xs);
  font-weight: 700;
  color: var(--ds-text);
}

.nx-owner-chip.is-active .nx-owner-chip__count {
  background: rgba(75, 142, 255, 0.25);
}

@keyframes nx-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
