:root {
  color-scheme: dark;
  --page: #0b0d10;
  --surface: #13161b;
  --surface-soft: #181c22;
  --surface-raised: #1f242c;
  --ink: #e6e9ef;
  --ink-soft: #a8b0bd;
  --muted: #636b78;
  --line: #272c36;
  --line-strong: #323844;
  --accent: #5b9cf5;
  --accent-deep: #3b7dd8;
  --accent-soft: rgba(91, 156, 245, 0.12);
  --accent-glow: rgba(91, 156, 245, 0.22);
  --accent-border: rgba(91, 156, 245, 0.32);
  --accent-border-strong: rgba(91, 156, 245, 0.5);
  --on-accent: #f8fafc;
  --gold: var(--accent);
  --gold-deep: var(--accent-deep);
  --gold-soft: var(--accent-soft);
  --gold-glow: var(--accent-glow);
  --gold-border: var(--accent-border);
  --gold-border-strong: var(--accent-border-strong);
  --teal: #34d399;
  --teal-soft: rgba(52, 211, 153, 0.12);
  --blue: var(--accent);
  --blue-soft: var(--accent-soft);
  --amber: #e8a838;
  --amber-soft: rgba(232, 168, 56, 0.14);
  --red: #ef6b6b;
  --red-soft: rgba(239, 107, 107, 0.12);
  --violet: #9d8cff;
  --idle: #525867;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--page);
  background-image: radial-gradient(ellipse 120% 70% at 50% -18%, rgba(91, 156, 245, 0.07), transparent 55%);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.app-nav {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.nav-brand {
  align-items: center;
  display: flex;
  gap: 10px;
  padding: 4px 6px 12px;
}

.nav-brand .brand-logo {
  display: block;
  height: auto;
  max-height: 54px;
  object-fit: contain;
  width: min(174px, 100%);
}

.nav-brand strong {
  display: block;
  font-size: 15px;
}

.nav-brand > div > span:not(.nav-tagline) {
  color: var(--muted);
  font-size: 12px;
}

.nav-tabs {
  display: grid;
  gap: 4px;
}

.nav-tab {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--ink-soft);
  display: inline-flex;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.nav-tab-icon {
  flex-shrink: 0;
  height: 18px;
  opacity: 0.72;
  width: 18px;
}

.nav-tab span {
  line-height: 1.2;
}

.nav-tab:hover .nav-tab-icon,
.nav-tab.active .nav-tab-icon {
  opacity: 1;
}

.nav-tab:hover {
  background: var(--surface-soft);
}

.nav-tab.active {
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 600;
}

.nav-footer {
  margin-top: auto;
}

.locale-select-wrap select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  font: inherit;
  min-height: 32px;
  padding: 0 8px;
  width: 100%;
}

.sr-only {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.page-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tab-panel.active {
  display: flex;
}

.port-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 360px;
}

.port-badge {
  align-items: center;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  gap: 4px;
  letter-spacing: 0.02em;
  padding: 3px 7px;
  text-transform: uppercase;
}

.port-badge b {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.port-badge.good {
  background: var(--teal-soft);
  border-color: var(--gold-border);
  color: var(--teal);
}

.port-badge.good b {
  color: var(--teal);
}

.port-badge.bad {
  background: var(--red-soft);
  border-color: rgba(224, 92, 92, 0.4);
  color: var(--red);
}

.port-badge.preview {
  text-transform: none;
}

.sensor-table td:first-child {
  white-space: normal;
}

.sensor-table .url-line {
  display: block;
  margin-top: 2px;
}

.config-dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  max-height: calc(100vh - 32px);
  max-width: min(1100px, calc(100vw - 32px));
  overflow: hidden;
  padding: 0;
  width: 1040px;
}

.config-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.config-dialog-head {
  background: var(--surface-soft);
}

.config-dialog-body {
  max-height: calc(100vh - 180px);
  overflow: auto;
  padding: 14px 16px;
}

.config-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.validation-pill {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
}

.validation-pill.ok {
  background: var(--teal-soft);
  border-color: var(--gold-border);
  color: var(--teal);
}

.config-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  margin-top: 12px;
}

.config-section-head {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.config-section-head h3 {
  font-size: 13px;
  margin: 0;
}

.config-detail {
  align-self: start;
  position: sticky;
  top: 0;
}

.compact-head {
  min-height: 48px;
}

.config-dialog-foot {
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 16px;
}

.json-preview {
  margin-top: 14px;
}

.json-preview summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  margin-bottom: 8px;
}

.json-preview pre {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  margin: 0;
  max-height: 180px;
  overflow: auto;
  padding: 10px;
}

.metric.alert-metric {
  border-color: var(--accent-border);
}

.metric.alert-metric.has-alerts {
  border-color: rgba(224, 92, 92, 0.4);
  background: linear-gradient(180deg, rgba(224, 92, 92, 0.1), var(--surface));
}

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

.topology-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legend-dot {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  gap: 6px;
}

.legend-dot::before {
  border-radius: 50%;
  content: "";
  height: 10px;
  width: 10px;
}

.legend-dot.good::before {
  background: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.legend-dot.alert::before {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.legend-dot.idle::before {
  background: var(--idle);
}

.legend-dot.bad::before {
  background: #9b3d3d;
}

.topology-map {
  padding: 18px;
}

.topology-empty {
  align-items: center;
  color: var(--muted);
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 48px 20px;
  text-align: center;
}

.topology-hub {
  display: grid;
  gap: 20px;
}

.hub-node {
  align-items: center;
  background: linear-gradient(180deg, var(--surface-soft), var(--surface));
  border: 1px solid var(--line);
  border-radius: 12px;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  justify-self: center;
  min-width: 120px;
  padding: 14px 20px;
  position: relative;
}

.hub-node::after {
  background: var(--line-strong);
  bottom: -20px;
  content: "";
  height: 20px;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  width: 2px;
}

.hub-icon {
  align-items: center;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.hub-icon-image {
  display: block;
  height: 40px;
  object-fit: contain;
  width: 40px;
}

.hub-node strong {
  font-size: 14px;
}

.hub-node span {
  color: var(--muted);
  font-size: 12px;
}

.agent-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  position: relative;
}

.agent-grid::before {
  background: var(--line-strong);
  content: "";
  height: 2px;
  left: 8%;
  position: absolute;
  right: 8%;
  top: -10px;
}

.agent-node {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.agent-node.good {
  border-color: var(--gold-border);
}

.agent-node.alert {
  border-color: rgba(224, 92, 92, 0.45);
  box-shadow: 0 0 0 1px var(--red-soft), var(--shadow);
}

.agent-node.bad {
  border-color: rgba(224, 92, 92, 0.35);
}

.agent-node-head {
  align-items: center;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  padding: 12px 14px;
}

.agent-node-status {
  border-radius: 50%;
  flex: 0 0 auto;
  height: 12px;
  width: 12px;
}

.agent-node-status.good {
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}

.agent-node-status.alert {
  animation: alert-pulse 1.6s ease infinite;
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.agent-node-status.idle {
  background: var(--idle);
}

.agent-node-status.bad {
  background: #9b3d3d;
}

.agent-node-info {
  flex: 1;
  min-width: 0;
}

.agent-node-info strong {
  display: block;
  font-size: 14px;
}

.agent-node-info span {
  color: var(--muted);
  font-size: 11px;
}

.agent-node-body {
  display: grid;
  gap: 10px;
  padding: 14px;
  position: relative;
}

.agent-spine {
  background: linear-gradient(180deg, var(--line-strong), transparent);
  height: 8px;
  margin: 0 auto;
  width: 2px;
}

.service-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.service-tile {
  align-items: center;
  background: var(--surface-raised);
  border: 2px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 72px;
  padding: 10px 12px;
  position: relative;
  transition: transform 120ms ease, border-color 120ms ease;
}

.service-tile:hover {
  transform: translateY(-2px);
}

.service-tile.good {
  background: var(--teal-soft);
  border-color: var(--gold-border-strong);
  color: var(--teal);
}

.service-tile.alert {
  animation: alert-pulse 1.6s ease infinite;
  background: var(--red-soft);
  border-color: rgba(224, 92, 92, 0.45);
  color: var(--red);
}

.service-tile.bad {
  background: var(--red-soft);
  border-color: rgba(224, 92, 92, 0.35);
  color: var(--red);
}

.service-tile.idle {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--muted);
}

.service-tile.empty {
  color: var(--muted);
  cursor: default;
  font-size: 12px;
  min-width: auto;
  padding: 12px 16px;
}

.service-tile-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.service-tile-port {
  font-size: 13px;
  font-weight: 700;
}

.service-tile-alert {
  background: var(--red);
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  min-width: 18px;
  padding: 3px 6px;
  position: absolute;
  right: -6px;
  top: -6px;
}

.agent-node-foot {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 8px 14px;
}

.alerts-feed {
  display: grid;
  gap: 8px;
  padding: 12px 14px 14px;
}

.alert-card {
  align-items: center;
  background: var(--red-soft);
  border: 1px solid rgba(224, 92, 92, 0.35);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 8px 12px;
  grid-template-columns: 72px 120px 140px 1fr auto;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.alert-card:hover {
  background: rgba(224, 92, 92, 0.18);
  cursor: pointer;
}

.alert-card-time {
  color: var(--muted);
  font-size: 12px;
  padding-left: 14px;
  position: relative;
}

.alert-card-time::before {
  background: var(--gold);
  border-radius: 50%;
  content: "";
  height: 6px;
  left: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
}

.alert-card-service {
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.alert-card-detail {
  color: var(--ink-soft);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-card-actions {
  display: flex;
  justify-content: flex-end;
}

.alert-card-actions .icon-button {
  min-height: 28px;
  width: 28px;
}

@keyframes alert-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(156, 61, 61, 0.35);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(156, 61, 61, 0);
  }
}

@media (max-width: 720px) {
  .alert-card {
    grid-template-columns: 1fr 1fr;
  }

  .agent-grid::before {
    display: none;
  }

  .hub-node::after {
    display: none;
  }
}

.brand-block {
  align-items: center;
  display: flex;
  gap: 12px;
  min-height: 46px;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(145deg, var(--gold-deep), var(--gold));
  border-radius: 10px;
  box-shadow: 0 0 20px var(--gold-glow);
  color: var(--on-accent);
  display: inline-flex;
  flex: 0 0 auto;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.brand-mark .brand-icon {
  fill: currentColor;
  height: 22px;
  stroke: none;
  width: 22px;
}

.brand-block strong,
.brand-block span {
  display: block;
  line-height: 1.25;
}

.brand-block strong {
  font-size: 16px;
}

.brand-block span,
.eyebrow,
.panel-head span,
.metric span,
.metric small,
.runtime-pill small {
  color: var(--muted);
  font-size: 12px;
}

.mini-state {
  align-items: center;
  display: flex;
  gap: 8px;
}

.mini-state span {
  background: var(--amber);
  border-radius: 50%;
  height: 9px;
  width: 9px;
}

.mini-state.running span {
  background: var(--teal);
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 18px 22px 32px;
}

.eyebrow {
  color: var(--gold);
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.1;
}

.command-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.runtime-pill {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
}

.demo-banner {
  align-items: center;
  background: linear-gradient(90deg, var(--blue-soft), rgba(52, 211, 153, 0.08));
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 14px;
}

.demo-banner[hidden] {
  display: none;
}

.demo-banner strong {
  color: var(--gold);
  flex: 0 0 auto;
  font-size: 13px;
  text-transform: uppercase;
}

.demo-banner span {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

.button,
.icon-button,
.text-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.icon-button {
  padding: 0;
  width: 38px;
}

.icon-button.danger {
  color: var(--red);
}

.icon-button:hover {
  background: var(--surface-raised);
  border-color: var(--line-strong);
}

.icon-button.danger:hover {
  background: var(--red-soft);
  border-color: rgba(224, 92, 92, 0.45);
}

.button.primary {
  background: var(--gold);
  border-color: var(--gold-deep);
  color: #fff;
  font-weight: 600;
}

.button.primary span {
  color: #fff;
}

.button.primary:hover {
  filter: brightness(1.08);
}

.button.danger {
  color: var(--red);
}

.text-button {
  color: var(--blue);
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

body[data-demo-mode="true"] .button:disabled,
body[data-demo-mode="true"] .icon-button:disabled,
body[data-demo-mode="true"] .text-button:disabled {
  cursor: not-allowed;
}

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

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
  min-height: 104px;
  padding: 14px;
}

.metric strong {
  color: var(--gold);
  font-size: 27px;
  line-height: 1.05;
}

.metric.alert-metric.has-alerts strong {
  color: var(--red);
}

.metric.accent {
  border-color: var(--gold-border);
}

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

.config-panel,
.catalog-panel {
  grid-column: 1 / 2;
}

.service-detail {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
}

.monitoring-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.45fr);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 54px;
  padding: 12px 14px;
}

.panel-head h2 {
  font-size: 15px;
}

.deploy-target {
  align-items: center;
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  display: inline-flex;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
}

.deploy-target span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.deploy-target select {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-weight: 600;
  min-width: 140px;
  padding: 6px 0;
}

.deploy-guide {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.deploy-step {
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
  padding: 12px 14px;
}

.deploy-step.done {
  border-color: var(--gold-border);
  background: linear-gradient(180deg, var(--gold-soft) 0%, var(--surface) 100%);
}

.deploy-step.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal);
}

.deploy-step-num {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.deploy-step.done .deploy-step-num {
  background: var(--gold);
  border-color: var(--gold-deep);
  color: var(--on-accent);
}

.deploy-step strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.deploy-step span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.sensor-row {
  cursor: pointer;
}

.sensor-row.selected {
  background: var(--teal-soft);
}

.sensor-row.selected td:first-child strong::after {
  color: var(--teal);
  content: " · cible active";
  font-size: 11px;
  font-weight: 600;
}

.button.compact {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--teal);
}

.advanced-panel {
  border-top: 1px solid var(--line);
  margin: 0 14px 14px;
}

.advanced-panel summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 10px 0;
}

.advanced-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 0 12px;
}

.sensor-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 14px;
}

.sensor-table th:last-child,
.sensor-table td.row-actions {
  text-align: right;
  width: 1%;
}

.sensor-table .action-list {
  justify-content: flex-end;
}

#usersPanel .admin-table th:last-child,
#usersPanel .admin-table td.row-actions {
  text-align: right;
  width: 1%;
}

#usersPanel .admin-table .action-list {
  justify-content: flex-end;
}

.sensor-create {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  width: auto;
}

.sensor-create input {
  min-width: 160px;
  width: 200px;
}

.add-sensor-btn {
  color: #fff;
  flex: 0 0 auto;
  font-weight: 600;
}

.add-sensor-btn svg {
  stroke: #fff;
}

.sensor-command {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 12px 14px;
}

.sensor-command-head {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.sensor-command-head > div {
  min-width: 0;
}

.sensor-command[hidden] {
  display: none;
}

.sensor-command span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.sensor-command pre {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  overflow: auto;
  padding: 10px;
  user-select: all;
  white-space: pre-wrap;
  word-break: break-all;
}

label {
  color: var(--muted);
  display: grid;
  gap: 6px;
  min-width: 0;
}

input,
select {
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  min-height: 36px;
  padding: 7px 9px;
  width: 100%;
}

input:disabled,
input:read-only {
  color: var(--muted);
  cursor: default;
}

input:focus,
select:focus {
  border-color: var(--gold);
  outline: 2px solid var(--gold-soft);
}

.segmented {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  padding: 2px;
}

.segmented button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  min-height: 28px;
  padding: 0 10px;
}

.segmented button.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  color: var(--blue);
}

.preset-strip {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
}

.preset-chip {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  display: inline-flex;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
}

.preset-chip b {
  background: var(--surface-raised);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 6px;
}

.preset-chip.active {
  background: var(--blue-soft);
  border-color: var(--gold-border);
  color: var(--blue);
}

.warning-list {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}

.warn-item {
  background: var(--amber-soft);
  border: 1px solid rgba(212, 148, 58, 0.35);
  border-radius: 7px;
  color: var(--amber);
  padding: 8px 10px;
}

.warn-item.error {
  background: var(--red-soft);
  border-color: rgba(224, 92, 92, 0.4);
  color: var(--red);
}

.service-grid {
  display: grid;
  gap: 16px;
  padding: 14px;
}

.service-section h3 {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.service-card-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.service-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  min-height: 158px;
  padding: 12px;
}

.service-card:hover,
.service-card.selected {
  border-color: var(--gold-border);
}

.service-card.enabled {
  background: var(--gold-soft);
  border-color: var(--gold-border);
}

.service-card-top,
.service-card-foot {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.service-icon {
  align-items: center;
  background: var(--surface-raised);
  border-radius: 8px;
  color: var(--ink-soft);
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  letter-spacing: -0.02em;
  min-width: 38px;
  padding: 0 8px;
  white-space: nowrap;
  width: auto;
}

.service-card.enabled .service-icon {
  background: var(--teal-soft);
  color: var(--teal);
}

.switch,
.switch-line span {
  background: var(--line-strong);
  border: 0;
  border-radius: 999px;
  height: 22px;
  padding: 0;
  position: relative;
  width: 40px;
}

.switch span,
.switch-line span::after {
  background: #ffffff;
  border-radius: 50%;
  content: "";
  height: 18px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform 140ms ease;
  width: 18px;
}

.switch.on,
.switch-line input:checked + span {
  background: var(--teal);
}

.switch.on span,
.switch-line input:checked + span::after {
  transform: translateX(18px);
}

.switch-line {
  align-items: center;
  display: flex;
}

.switch-line input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.service-card-main {
  display: grid;
  gap: 6px;
}

.service-card-main span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.pill,
.status-chip,
.event-kind {
  border-radius: 6px;
  display: inline-flex;
  font-size: 12px;
  padding: 3px 7px;
}

.pill {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-chip.good,
.event-kind {
  background: var(--teal-soft);
  color: var(--teal);
}

.status-chip.idle {
  background: var(--surface-raised);
  color: var(--muted);
}

.status-chip.bad {
  background: var(--red-soft);
  color: var(--red);
}

.detail-body {
  padding: 14px;
}

.detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-note {
  background: var(--blue-soft);
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  color: var(--blue);
  margin-top: 12px;
  padding: 10px;
}

.empty-state {
  color: var(--muted);
  padding: 8px 0;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.events-table {
  overflow: visible;
}

.events-table tbody tr {
  cursor: pointer;
}

.events-table td:last-child {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-row td {
  color: var(--muted);
  height: 72px;
  text-align: center;
}

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

.event-tools {
  display: grid;
  gap: 8px;
  grid-template-columns: 150px 120px 180px 86px;
}

.event-pagination {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 12px 14px;
}

.event-pagination span {
  color: var(--muted);
  font-size: 12px;
  min-width: 88px;
  text-align: center;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  min-width: 0;
}

.action-list {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: flex-start;
}

.action-list .text-button {
  min-height: 30px;
  padding: 0 8px;
}

.action-list .icon-button {
  min-height: 30px;
  width: 30px;
}

.service-tile .icon-button {
  margin-top: 4px;
  min-height: 24px;
  width: 24px;
}

.service-tile .icon-button svg {
  height: 14px;
  width: 14px;
}

.action-list .selectionne {
  background: var(--blue-soft);
}

.inline-check {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: row;
  gap: 6px;
  min-height: 36px;
}

.inline-check input {
  min-height: auto;
  width: auto;
}

.preview-panel pre,
.event-dialog pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
}

.ok {
  color: var(--teal);
}

.warning {
  color: var(--amber);
}

.danger-text {
  color: var(--red);
}

.docker-command-dialog-body {
  display: grid;
  gap: 0;
}

.docker-command-dialog-body pre {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  user-select: all;
  white-space: pre-wrap;
  word-break: break-all;
}

.dialog-sub {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 400;
  margin-top: 3px;
}

.dialog-head > div {
  min-width: 0;
}

.event-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  max-width: min(860px, calc(100vw - 32px));
  padding: 0;
  width: 780px;
}

.event-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.confirm-dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  max-width: min(440px, calc(100vw - 32px));
  padding: 0;
  width: 420px;
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.confirm-dialog-body {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.confirm-dialog-body p {
  margin: 0;
}

.dialog-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 12px;
}

.toast {
  background: var(--gold-deep);
  border-radius: 8px;
  bottom: 18px;
  color: var(--on-accent);
  font-weight: 600;
  left: 50%;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 40;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1260px) {
  .config-layout {
    grid-template-columns: 1fr;
  }

  .config-detail {
    position: static;
  }
}

@media (max-width: 980px) {
  .metrics-grid,
  .sensor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .app-nav {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    height: auto;
    position: static;
  }

  .nav-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav-footer {
    display: none;
  }
}

.activity-panel {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.6fr);
  padding: 14px;
}

.activity-chart-wrap {
  display: grid;
  gap: 10px;
}

.activity-chart-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.activity-chart {
  align-items: flex-end;
  display: flex;
  gap: 3px;
  height: 88px;
}

.activity-bar {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  border-radius: 3px 3px 0 0;
  flex: 1;
  min-height: 2px;
  opacity: 0.85;
  transition: opacity 120ms ease;
}

.activity-bar:hover {
  opacity: 1;
}

.activity-bar.empty {
  background: var(--surface-raised);
  opacity: 1;
}

.activity-chart-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  height: 88px;
  justify-content: center;
}

.protocol-bar-wrap {
  display: grid;
  gap: 10px;
}

.protocol-bar {
  background: var(--surface-raised);
  border-radius: 6px;
  display: flex;
  height: 14px;
  overflow: hidden;
}

.protocol-segment {
  min-width: 2px;
  transition: opacity 120ms ease;
}

.protocol-segment:hover {
  opacity: 0.8;
}

.protocol-legend {
  display: grid;
  gap: 6px;
}

.protocol-legend-item {
  align-items: center;
  background: var(--protocol-bg);
  border: 1px solid var(--protocol-border);
  border-radius: 6px;
  color: var(--ink-soft);
  display: flex;
  font-size: 11px;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
  padding: 5px 7px;
}

.protocol-name {
  align-items: center;
  color: var(--protocol-color);
  display: flex;
  font-weight: 700;
  gap: 7px;
  min-width: 0;
}

.protocol-legend-item b {
  color: var(--protocol-color);
  font-size: 11px;
  font-weight: 800;
}

.protocol-dot {
  background: var(--protocol-color);
  border-radius: 50%;
  flex: 0 0 auto;
  height: 8px;
  width: 8px;
}

.nav-tagline {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-style: italic;
  margin-top: 1px;
}

.status-active-pill {
  align-items: center;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 999px;
  color: #4ade80;
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  gap: 5px;
  letter-spacing: 0.04em;
  margin-top: 10px;
  padding: 4px 10px;
  text-transform: uppercase;
}

.status-active-pill::before {
  background: #4ade80;
  border-radius: 50%;
  content: "";
  height: 6px;
  width: 6px;
}

.status-active-pill.inactive {
  background: rgba(99, 107, 120, 0.1);
  border-color: rgba(99, 107, 120, 0.25);
  color: var(--muted);
}

.status-active-pill.inactive::before {
  background: var(--muted);
}

.admin-create {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 100px auto;
  width: min(760px, 100%);
}

.admin-access-panel {
  display: grid;
  gap: 12px;
  max-width: 480px;
}

.admin-login-form {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.admin-login-form label {
  display: grid;
  gap: 6px;
}

.admin-main .page-head {
  margin-bottom: 20px;
}

.invite-shell {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: center;
  margin: 0 auto;
  max-width: 520px;
  min-height: 100vh;
  padding: 32px 20px;
}

.invite-shell .brand-logo {
  max-height: 54px;
  width: min(174px, 100%);
}

.invite-meta {
  display: grid;
  gap: 10px;
  margin: 12px 0 4px;
}

.invite-meta dt {
  color: var(--muted);
  font-size: 12px;
}

.invite-meta dd {
  margin: 0;
}

.superadmin-login-panel {
  margin-top: 24px;
  max-width: 420px;
}

.admin-table td:nth-child(4),
.admin-table .url-line {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
  width: 100%;
}

.nav-user strong {
  font-size: 13px;
}

.nav-user span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.nav-footer {
  align-items: stretch;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.nav-logout-button {
  background: #dc2626;
  border-color: rgba(248, 113, 113, 0.9);
  box-shadow: 0 12px 26px rgba(220, 38, 38, 0.24);
  color: #fff;
  font-weight: 700;
  justify-content: center;
  min-height: 40px;
  width: 100%;
}

.nav-logout-button:hover {
  background: #ef4444;
  filter: none;
}

.nav-logout-button svg {
  height: 17px;
  width: 17px;
}

.login-dialog {
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  color: var(--ink);
  max-width: 400px;
  padding: 0;
  width: calc(100vw - 32px);
}

.login-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.login-form {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.login-head {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
}

.login-logo {
  display: block;
  height: auto;
  max-height: 48px;
  object-fit: contain;
  width: min(190px, 100%);
}

.notification-form-grid .full-width {
  grid-column: 1 / -1;
}

.multi-select {
  position: relative;
  width: 100%;
}

.multi-select-trigger {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-height: 36px;
  padding: 7px 9px;
  text-align: left;
  width: 100%;
}

.multi-select-trigger:focus {
  border-color: var(--gold);
  outline: 2px solid var(--gold-soft);
}

.multi-select-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-select-chevron {
  flex-shrink: 0;
  height: 16px;
  opacity: 0.7;
  width: 16px;
}

.multi-select-menu {
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 2px;
  left: 0;
  margin-top: 4px;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 30;
}

.multi-select-menu.is-fixed {
  margin-top: 0;
  position: fixed;
  right: auto;
}

.multi-select-option {
  align-items: center;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  padding: 6px 8px;
}

.multi-select-option:hover {
  background: var(--surface-soft);
}

.multi-select-option input {
  margin: 0;
  min-height: auto;
  width: auto;
}

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

  .admin-create {
    grid-template-columns: 1fr;
    width: 100%;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 12px;
  }

  .demo-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .demo-banner span {
    text-align: left;
  }

  .panel-head,
  .event-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .event-tools,
  .sensor-create {
    justify-content: stretch;
    width: 100%;
  }

  .sensor-create input {
    flex: 1 1 auto;
    width: auto;
  }

  .metrics-grid,
  .sensor-grid,
  .detail-grid,
  .advanced-grid {
    grid-template-columns: 1fr;
  }

  .action-list {
    flex-wrap: wrap;
  }
}
