:root {
  color-scheme: light;
  --panel: rgba(255, 252, 247, 0.94);
  --panel-strong: #fffaf2;
  --ink: #1f2933;
  --muted: #6b7280;
  --accent: #ee6c4d;
  --accent-soft: rgba(238, 108, 77, 0.18);
  --graph-node: rgba(255, 251, 245, 0.96);
  --shadow: 0 18px 40px rgba(74, 58, 42, 0.1);
  --title-font: "Space Grotesk", "Segoe UI", sans-serif;
  --body-font: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 214, 165, 0.4), transparent 28%),
    linear-gradient(180deg, #fbf7f2 0%, #f3ede5 100%);
}

.page-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
  margin-bottom: 18px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b45309;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--title-font);
}

h1 {
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero-copy,
.panel-note {
  margin: 8px 0 0;
  max-width: 52ch;
  color: var(--muted);
  line-height: 1.5;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.current-state-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.current-state-chip-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.current-state-chip strong {
  font-size: 1.25rem;
  font-family: var(--title-font);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(42, 157, 143, 0.15);
  color: #17665e;
  font-size: 0.92rem;
  font-weight: 700;
}

.status-pill.offline {
  background: rgba(141, 153, 174, 0.16);
  color: #475569;
}

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

.status-meta div {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.status-meta dt {
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.status-meta dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-heading h3 {
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}

.compact-heading {
  margin-bottom: 12px;
}

.sidebar-stack {
  display: grid;
  gap: 18px;
  align-content: start;
}

.status-card {
  padding: 20px;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-groups {
  display: grid;
  gap: 14px;
}

.settings-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 250, 244, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.settings-group-heading h4 {
  margin: 0 0 4px;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.settings-group-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

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

.settings-field {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.settings-field span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.settings-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  font-weight: 500;
}

.settings-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
}

.settings-field input:focus {
  outline: 2px solid rgba(238, 108, 77, 0.22);
  outline-offset: 1px;
  border-color: rgba(238, 108, 77, 0.45);
}

.settings-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.settings-feedback {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.settings-feedback[data-tone="success"] {
  color: #17665e;
}

.settings-feedback[data-tone="error"] {
  color: #b42318;
}

.settings-feedback[data-tone="pending"] {
  color: #9a3412;
}

.settings-save-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #ee6c4d, #f4a261);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 26px rgba(238, 108, 77, 0.2);
}

.settings-save-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.graph-scroll {
  overflow-x: auto;
  padding-bottom: 2px;
}

.graph-stage {
  position: relative;
  min-width: 920px;
  min-height: 560px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 250, 244, 0.92));
  border: 1px solid rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.graph-edges,
.graph-nodes {
  position: absolute;
  inset: 0;
}

.graph-edges {
  width: 100%;
  height: 100%;
}

.graph-nodes {
  pointer-events: none;
}

.graph-edge {
  stroke: rgba(148, 163, 184, 0.7);
  stroke-width: 4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  marker-end: url(#edge-arrow);
}

.graph-edge.active {
  stroke: rgba(238, 108, 77, 0.9);
  marker-end: url(#edge-arrow-active);
}

#edge-arrow path {
  fill: rgba(148, 163, 184, 0.88);
}

#edge-arrow-active path {
  fill: rgba(238, 108, 77, 0.96);
}

.graph-node {
  position: absolute;
  width: 210px;
  min-height: 128px;
  padding: 16px 18px;
  transform: translate(-50%, -50%);
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--graph-node);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.graph-node h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-family: var(--title-font);
  letter-spacing: -0.03em;
}

.graph-node p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.88rem;
}

.graph-node.active {
  transform: translate(-50%, -50%) scale(1.03);
  border-color: rgba(238, 108, 77, 0.85);
  background: linear-gradient(180deg, rgba(255, 242, 233, 0.98), rgba(255, 251, 245, 0.98));
  box-shadow: 0 18px 38px rgba(238, 108, 77, 0.18);
}

.graph-node.active h4 {
  color: #9a3412;
}

.graph-node.active::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 24px;
  border: 2px solid var(--accent-soft);
}

.transition-list,
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.transition-list li,
.history-list li {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.transition-list strong,
.history-list strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.98rem;
  font-family: var(--title-font);
}

.transition-list span,
.history-list span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.transition-empty,
.history-empty {
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .topbar,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .topbar-summary {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 16px 14px 24px;
  }

  .panel,
  .status-card {
    padding: 16px;
  }

  .status-meta {
    grid-template-columns: 1fr;
  }

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

  .topbar-summary {
    align-items: stretch;
  }

  .current-state-chip {
    width: 100%;
    min-width: 0;
  }

  .settings-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
