/* All selectors below are scoped to the XGRIDS frontend contribution. */
.xgrids-k1-plugin {
.device-workspace__grid {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(23rem, 0.78fr) minmax(34rem, 1.22fr);
  align-items: start;
  gap: 0.85rem;
}

.device-workspace__side {
  display: grid;
  min-width: 0;
  gap: 0.85rem;
}

.connection-panel,
.status-panel,
.latency-panel,
.session-panel {
  background: var(--station-panel);
}

.error-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  border-radius: 1rem;
  background: rgb(255 255 255 / 0.045);
  color: var(--nodedc-text-primary);
  padding: 0.85rem 1rem;
}

.error-banner__dot {
  width: 0.46rem;
  height: 0.46rem;
  align-self: start;
  margin-top: 0.28rem;
  border-radius: 50%;
  background: rgb(var(--nodedc-danger-rgb));
}

.error-banner strong,
.error-banner p {
  margin: 0;
}

.error-banner strong {
  color: var(--nodedc-text-primary);
  font-size: 0.76rem;
}

.error-banner p {
  margin-top: 0.2rem;
  color: var(--nodedc-text-secondary);
  font-size: 0.68rem;
  line-height: 1.45;
}

.error-banner__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.wizard-list {
  display: grid;
  margin-top: 1.4rem;
}

.configuration-anchor {
  display: grid;
  gap: 0.55rem;
  margin-top: 1.2rem;
  border-radius: 0.95rem;
  background: rgb(255 255 255 / 0.028);
  padding: 0.8rem;
}

.configuration-anchor .nodedc-select-anchor,
.configuration-field .nodedc-select-anchor {
  width: 100%;
}

.wizard-step {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 0.75rem;
}

.wizard-step__rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.wizard-step__rail::after {
  position: absolute;
  top: 2rem;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--station-hairline);
  content: "";
}

.wizard-step:last-child .wizard-step__rail::after {
  display: none;
}

.wizard-step__rail span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: #27272a;
  color: var(--nodedc-text-secondary);
  font-size: 0.59rem;
  font-weight: 800;
}

.wizard-step__content {
  min-width: 0;
  padding: 0.08rem 0 1.5rem;
}

.wizard-step:last-child .wizard-step__content {
  padding-bottom: 0;
}

.wizard-step__content > header {
  display: flex;
  min-height: 2rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.75rem;
}

.wizard-step__content h3 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 710;
}

.step-copy,
.safety-note,
.live-instruction {
  margin: 0 0 0.72rem;
  color: var(--nodedc-text-muted);
  font-size: 0.65rem;
  line-height: 1.48;
}

.safety-note,
.live-instruction {
  margin: 0.7rem 0 0;
}

.device-list {
  display: grid;
  max-height: 20rem;
  gap: 0.48rem;
  margin-top: 0.72rem;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.device-row {
  display: grid;
  gap: 0.62rem;
  border-radius: 0.95rem;
  background: rgb(255 255 255 / 0.035);
  padding: 0.72rem;
}

.device-row[data-selected="true"] {
  background: rgb(255 255 255 / 0.065);
  box-shadow: none;
}

.device-row__identity,
.device-row__action {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.device-row__identity {
  justify-content: flex-start;
}

.device-row__identity > div {
  display: grid;
  min-width: 0;
  gap: 0.2rem;
}

.device-row__name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.42rem;
}

.device-row__name small {
  flex: 0 0 auto;
  color: var(--nodedc-text-muted);
  font-size: 0.47rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.device-row__identity strong {
  overflow: hidden;
  font-size: 0.69rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-row code,
.detail-row code {
  overflow: hidden;
  color: var(--nodedc-text-muted);
  font-size: 0.58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-row__signal {
  width: 0.58rem;
  height: 0.58rem;
  flex: 0 0 0.58rem;
  border-radius: 50%;
  background: var(--nodedc-text-muted);
}

.device-row[data-compatible="true"] .device-row__signal {
  background: rgb(var(--nodedc-success-rgb));
}

.device-row__action > span {
  color: var(--nodedc-text-muted);
  font-size: 0.62rem;
}

.empty-device-list {
  border-radius: 0.95rem;
  background: rgb(255 255 255 / 0.025);
  color: var(--nodedc-text-muted);
  padding: 0.9rem;
  font-size: 0.65rem;
  line-height: 1.45;
}

.field-stack,
.session-form {
  display: grid;
  gap: 0.85rem;
}

.connection-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.72rem 0;
  border-radius: 0.85rem;
  background: rgb(255 255 255 / 0.03);
  padding: 0.62rem 0.75rem;
  font-size: 0.65rem;
}

.connection-summary span {
  color: var(--nodedc-text-muted);
}

.connection-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-panel > .nodedc-segmented {
  margin-top: 1.2rem;
}

.session-form {
  margin-top: 1rem;
}

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

.configuration-field {
  display: grid;
  min-width: 0;
  gap: 0.45rem;
}

.start-confirmation-note {
  margin: -0.25rem 0 0;
  color: var(--nodedc-text-muted);
  font-size: 0.6rem;
  line-height: 1.45;
}

.session-form--replay {
  grid-template-columns: minmax(0, 1.55fr) minmax(8rem, 0.45fr);
}

.session-form--replay > :first-child {
  grid-column: 1 / -1;
}

.session-form--replay > .nodedc-button {
  align-self: end;
}

.session-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
}

.session-footer p {
  max-width: 30rem;
  margin: 0;
  color: var(--nodedc-text-muted);
  font-size: 0.62rem;
  line-height: 1.45;
}

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

.detail-list {
  display: grid;
  margin: 0.9rem 0 0;
}

.detail-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(7rem, 0.72fr) minmax(0, 1.28fr);
  gap: 1rem;
  padding: 0.7rem 0;
}

.detail-row dt,
.detail-row dd {
  min-width: 0;
  margin: 0;
  font-size: 0.65rem;
}

.detail-row dt {
  color: var(--nodedc-text-muted);
}

.detail-row dd {
  overflow: hidden;
  color: var(--nodedc-text-secondary);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-state {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.inline-state::before {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--nodedc-text-muted);
  content: "";
}

.inline-state[data-state="open"]::before { background: rgb(var(--nodedc-success-rgb)); }
.inline-state[data-state="error"]::before,
.inline-state[data-state="closed"]::before { background: rgb(var(--nodedc-danger-rgb)); }

.latency-now {
  color: var(--nodedc-text-primary);
  font-size: 1.2rem;
  font-weight: 660;
  letter-spacing: -0.04em;
}

.latency-now span {
  color: var(--nodedc-text-muted);
  font-size: 0.61rem;
  letter-spacing: 0;
}

.latency-trace {
  display: flex;
  height: 7rem;
  align-items: end;
  gap: 0.2rem;
  margin-top: 1rem;
  border-radius: 0.85rem;
  background: rgb(255 255 255 / 0.018);
  padding: 0.7rem;
}

.latency-trace span {
  min-width: 0.16rem;
  flex: 1 1 0;
  border-radius: 999px 999px 0.12rem 0.12rem;
  background: var(--nodedc-text-primary);
}

.latency-trace p {
  align-self: center;
  margin: auto;
  color: var(--nodedc-text-muted);
  font-size: 0.62rem;
  line-height: 1.45;
  text-align: center;
}

.latency-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 0.38rem;
  color: var(--nodedc-text-muted);
  font-size: 0.54rem;
}
}

@media (max-width: 1480px) {
  .xgrids-k1-plugin .device-workspace__grid {
    grid-template-columns: minmax(21rem, 0.76fr) minmax(30rem, 1.24fr);
  }
}

@media (max-width: 1280px) {
  .xgrids-k1-plugin .device-workspace__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1040px) {
  .xgrids-k1-plugin .diagnostics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .xgrids-k1-plugin .scan-configuration-grid {
    grid-template-columns: 1fr;
  }

  .xgrids-k1-plugin .session-form--replay {
    grid-template-columns: 1fr;
  }

  .xgrids-k1-plugin .session-form--replay > :first-child {
    grid-column: auto;
  }

  .xgrids-k1-plugin .session-footer,
  .xgrids-k1-plugin .error-banner {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .xgrids-k1-plugin .error-banner {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .xgrids-k1-plugin .error-banner__actions {
    grid-column: 2;
    justify-content: flex-end;
  }

  .xgrids-k1-plugin .device-row__action {
    align-items: stretch;
    flex-direction: column;
  }
}

.xgrids-k1-spatial-controls {
  display: flex;
  min-width: min(42rem, 100%);
  max-width: 100%;
  align-items: center;
  gap: 0.85rem;
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 1rem;
  background: rgb(9 10 13 / 0.88);
  padding: 0.55rem 0.65rem 0.55rem 0.75rem;
  color: var(--nodedc-text-primary);
  box-shadow: 0 0.9rem 2.4rem rgb(0 0 0 / 0.3);
  backdrop-filter: blur(20px);
}

.xgrids-k1-spatial-controls__phase {
  display: flex;
  min-width: 11rem;
  flex: 1 1 15rem;
  align-items: center;
  gap: 0.58rem;
}

.xgrids-k1-spatial-controls__phase > span:last-child {
  display: grid;
  min-width: 0;
  gap: 0.15rem;
}

.xgrids-k1-spatial-controls__phase strong,
.xgrids-k1-spatial-controls__phase small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xgrids-k1-spatial-controls__phase strong {
  font-size: 0.66rem;
}

.xgrids-k1-spatial-controls__phase small {
  color: var(--nodedc-text-muted);
  font-size: 0.53rem;
}

.xgrids-k1-spatial-controls__spinner {
  width: 0.82rem;
  height: 0.82rem;
  flex: 0 0 0.82rem;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-top-color: var(--nodedc-text-primary);
  border-radius: 50%;
  animation: xgrids-k1-spin 900ms linear infinite;
}

.xgrids-k1-spatial-controls__telemetry {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 0.65rem;
}

.xgrids-k1-spatial-controls__telemetry > span {
  display: grid;
  gap: 0.12rem;
  white-space: nowrap;
}

.xgrids-k1-spatial-controls__telemetry small {
  color: var(--nodedc-text-muted);
  font-size: 0.48rem;
}

.xgrids-k1-spatial-controls__telemetry strong {
  font-size: 0.61rem;
}

.xgrids-k1-spatial-controls__error {
  display: grid;
  max-width: 17rem;
  gap: 0.12rem;
  color: rgb(var(--nodedc-danger-rgb));
}

.xgrids-k1-spatial-controls__error strong {
  font-size: 0.61rem;
}

.xgrids-k1-spatial-controls__error small {
  overflow: hidden;
  color: var(--nodedc-text-secondary);
  font-size: 0.51rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

@media (max-width: 960px) {
  .xgrids-k1-spatial-controls {
    min-width: 0;
  }

  .xgrids-k1-spatial-controls__phase small,
  .xgrids-k1-spatial-controls__telemetry,
  .xgrids-k1-spatial-controls__error small {
    display: none;
  }
}
