:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #dbe3ea;
  --text: #17212b;
  --muted: #657385;
  --accent: #0f6bff;
  --accent-soft: #eaf2ff;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #16a34a;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.1);
  --shadow-card: 0 12px 34px rgba(15, 23, 42, 0.08);
  --glass: rgba(255, 255, 255, 0.78);
  --ink: var(--text);
  --panel: var(--surface);
  --panel-soft: var(--surface-soft);
  --stage-bg: #ffffff;
  --diagram-bg: #edf3f8;
  --line: var(--border);
  --yellow: #f7c948;
  --blue: var(--accent);
  --green: var(--success);
  --coal: #243142;
  --shadow: var(--shadow-soft);
}

body[data-theme="dark"] {
  --bg: #0c1118;
  --surface: #121a24;
  --surface-soft: #0f1720;
  --border: #263447;
  --text: #eef5ff;
  --muted: #a3b0c2;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --danger: #f87171;
  --warning: #fbbf24;
  --success: #4ade80;
  --shadow-soft: 0 22px 60px rgba(0, 0, 0, 0.42);
  --shadow-card: 0 14px 38px rgba(0, 0, 0, 0.34);
  --glass: rgba(18, 26, 36, 0.76);
  --ink: var(--text);
  --panel: var(--surface);
  --panel-soft: var(--surface-soft);
  --stage-bg: #f7fafc;
  --diagram-bg: #0a1017;
  --line: var(--border);
  --yellow: #f7c948;
  --blue: var(--accent);
  --green: var(--success);
  --coal: #e8f0ec;
  --shadow: var(--shadow-soft);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(244, 246, 243, 0.94)),
    repeating-linear-gradient(90deg, rgba(21, 94, 239, 0.06) 0 1px, transparent 1px 76px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="dark"] {
  background:
    linear-gradient(180deg, rgba(15, 24, 22, 0.96), rgba(9, 14, 13, 0.98)),
    repeating-linear-gradient(90deg, rgba(100, 213, 138, 0.08) 0 1px, transparent 1px 76px);
}

button,
a,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

.is-hidden {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.app-shell {
  width: min(100%, 1800px);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 4px 12px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  object-position: center;
  border-radius: 14px;
  flex: 0 0 auto;
  background: #ffffff;
  filter: drop-shadow(0 10px 22px rgba(15, 78, 168, 0.12));
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  line-height: 1.05;
}

.brand-subtitle {
  max-width: min(620px, 52vw);
  margin: 0.25rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-logo.is-hidden {
  display: none;
}

body.brand-logo-missing .brand-block {
  gap: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: 0;
}

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

.status-pill {
  flex: 0 0 auto;
  border: 1px solid #dfb13a;
  border-radius: 999px;
  padding: 9px 14px;
  background: #fff8df;
  color: #6d4b00;
  font-size: 0.88rem;
  font-weight: 850;
}

body[data-theme="dark"] .status-pill {
  border-color: rgba(247, 201, 72, 0.5);
  background: rgba(247, 201, 72, 0.12);
  color: #fde68a;
}

.theme-toggle,
.tool-button,
.stream-button,
.unit-tab,
.equipment-tab,
.section-equipment-button {
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(23, 32, 31, 0.08);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.theme-toggle-icon {
  position: relative;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: inset -8px -7px 0 rgba(255, 255, 255, 0.52);
}

body[data-theme="dark"] .theme-toggle-icon {
  background: #dbe8ff;
  box-shadow: inset -9px -7px 0 #17221f;
}

.unit-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 30px rgba(23, 32, 31, 0.08);
}

body[data-theme="dark"] .unit-tabs {
  background: rgba(23, 34, 31, 0.9);
}

.unit-tab {
  display: grid;
  gap: 1px;
  min-width: 124px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 15px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.unit-tab strong,
.unit-tab span {
  display: block;
}

.unit-tab strong {
  font-size: 0.92rem;
}

.unit-tab span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.unit-tab:hover,
.unit-tab:focus-visible,
.unit-tab.is-active {
  border-color: var(--blue);
  background: #eef4ff;
  transform: translateY(-1px);
}

body[data-theme="dark"] .unit-tab:hover,
body[data-theme="dark"] .unit-tab:focus-visible,
body[data-theme="dark"] .unit-tab.is-active {
  background: #20322d;
}

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

.workspace.detail-closed {
  grid-template-columns: minmax(0, 1fr);
}

.diagram-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

body[data-theme="dark"] .diagram-panel,
body[data-theme="dark"] .detail-panel {
  background: rgba(23, 34, 31, 0.96);
}

.diagram-panel {
  min-width: 0;
  overflow: hidden;
}

.diagram-panel:fullscreen {
  width: 100vw;
  height: 100vh;
  padding: 12px;
  overflow: auto;
  background: var(--bg);
}

.diagram-panel:fullscreen .diagram-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.diagram-panel:fullscreen .diagram-scroll {
  max-height: calc(100vh - 250px);
}

.diagram-toolbar {
  display: grid;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-row-secondary {
  align-items: start;
}

.viewer-more-panel {
  min-height: 40px;
}

.diagram-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--panel);
  flex-shrink: 0;
}

.diagram-mode-toggle .mode-button {
  min-width: 76px;
  height: 30px;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 0.78rem;
}

body.viewer-minimal .viewer-more-panel:not(.is-open) .viewer-advanced {
  display: none !important;
}

body.viewer-minimal .search-control .viewer-advanced {
  display: none !important;
}

body.viewer-minimal #calibrationToggle {
  display: none !important;
}

body.viewer-minimal .viewer-more-panel {
  justify-content: flex-end;
}

body.viewer-minimal #fullscreenToggle .button-label,
body.viewer-minimal #presentationToggle .button-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

body.viewer-minimal .toolbar-row > #fullscreenToggle,
body.viewer-minimal .toolbar-row > #presentationToggle {
  min-width: 38px;
}

body.viewer-minimal #equipmentSections {
  display: none;
}

body.viewer-minimal .viewer-more-panel.is-open {
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

body.viewer-minimal .viewer-more-panel.is-open .stream-description {
  display: block !important;
  width: 100%;
  margin: 0;
}

body.focus-selected-mode.has-selected-equipment .hotspot:not(.is-active),
body.focus-selected-mode.has-selected-equipment .schematic-node:not(.is-active),
body.focus-selected-mode.has-selected-equipment .equipment-tab:not(.is-active),
body.focus-selected-mode.has-selected-equipment .section-equipment-button:not(.is-active) {
  opacity: 0.36;
  filter: saturate(0.65);
}

body.focus-selected-mode.has-selected-equipment .stream-path:not(.is-active) {
  opacity: 0.08;
}

body.focus-selected-mode.has-selected-equipment .hotspot.is-active,
body.focus-selected-mode.has-selected-equipment .schematic-node.is-active {
  opacity: 1;
  filter: drop-shadow(0 7px 18px rgba(15, 107, 255, 0.28));
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 9px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  font-weight: 900;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.tool-button svg,
.stream-button svg,
.toggle-box svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.button-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.tool-button:hover,
.tool-button:focus-visible {
  border-color: var(--blue);
  background: #eef4ff;
  box-shadow: 0 8px 18px rgba(21, 94, 239, 0.12);
  transform: translateY(-1px);
}

body[data-theme="dark"] .tool-button:hover,
body[data-theme="dark"] .tool-button:focus-visible {
  background: #20322d;
}

.tool-button.is-active,
.stream-button.is-active {
  border-color: var(--blue);
  color: #0b3a8f;
  background: #eef4ff;
}

body[data-theme="dark"] .tool-button.is-active,
body[data-theme="dark"] .stream-button.is-active {
  color: var(--ink);
  background: #20322d;
}

.tool-button:disabled,
.stream-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.fit-button {
  min-width: 38px;
}

.zoom-readout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--panel);
  font-size: 0.82rem;
  font-weight: 900;
}

.search-control {
  display: grid;
  grid-template-columns: minmax(220px, 420px) auto auto;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.search-control input[type="search"] {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--panel);
  font-size: 0.9rem;
  outline: none;
}

.search-control input[type="search"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.12);
}

.search-all-toggle,
.icon-opacity-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.compact-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.toggle-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--panel);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.compact-toggle:hover .toggle-box,
.compact-toggle:focus-within .toggle-box,
.compact-toggle input:checked + .toggle-box {
  border-color: var(--blue);
  color: #0b3a8f;
  background: #eef4ff;
  box-shadow: 0 8px 18px rgba(21, 94, 239, 0.12);
}

body[data-theme="dark"] .compact-toggle:hover .toggle-box,
body[data-theme="dark"] .compact-toggle:focus-within .toggle-box,
body[data-theme="dark"] .compact-toggle input:checked + .toggle-box {
  color: var(--ink);
  background: #20322d;
}

.toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

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

.step-counter {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(36, 147, 72, 0.36);
  border-radius: 999px;
  padding: 5px 10px;
  color: #14532d;
  background: #dcfce7;
  font-size: 0.82rem;
  font-weight: 900;
}

body[data-theme="dark"] .step-counter {
  color: #bbf7d0;
  background: rgba(36, 147, 72, 0.18);
}

.stream-controls {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--panel);
  flex-wrap: wrap;
}

.stream-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 64px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 850;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.stream-button:hover,
.stream-button:focus-visible,
.stream-button.is-active {
  border-color: var(--blue);
  background: #eef4ff;
  transform: translateY(-1px);
}

body[data-theme="dark"] .stream-button:hover,
body[data-theme="dark"] .stream-button:focus-visible,
body[data-theme="dark"] .stream-button.is-active {
  background: #20322d;
}

.action-button {
  min-width: auto;
  white-space: nowrap;
}

.diagram-scroll {
  overflow: auto;
  padding: 12px;
  background: var(--diagram-bg);
}

.diagram-scroll.is-pannable {
  cursor: grab;
}

.diagram-scroll.is-panning {
  cursor: grabbing;
  user-select: none;
}

.diagram-stage {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1672 / 941;
  background:
    linear-gradient(45deg, rgba(0, 0, 0, 0.025) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0, 0, 0, 0.025) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.025) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.025) 75%),
    var(--stage-bg);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  border: 1px solid #d9dfda;
  border-radius: 6px;
  overflow: hidden;
  transition: width 180ms ease;
}

.diagram-stage.is-fit {
  width: 100%;
}

.diagram-stage.is-calibrating {
  cursor: crosshair;
}

.diagram-stage.is-calibrating .stream-overlay {
  pointer-events: auto;
}

.diagram-stage.stream-hidden .stream-overlay {
  display: none;
}

.diagram-stage.stream-hidden .schematic-stream-group {
  display: none;
}

.diagram-mode-layer {
  position: absolute;
  inset: 0;
}

.image-diagram-layer {
  z-index: 1;
}

.schematic-diagram-layer {
  z-index: 2;
  background:
    linear-gradient(135deg, rgba(15, 107, 255, 0.04), rgba(34, 211, 238, 0.03)),
    var(--stage-bg);
}

.schematic-canvas {
  width: 100%;
  height: 100%;
}

.flow-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
}

.stream-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.98;
  z-index: 1;
}

.schematic-stream-path {
  stroke-width: 0.4;
  opacity: 0.6;
}

.schematic-node {
  cursor: pointer;
}

.schematic-node-card {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 180ms ease, filter 180ms ease;
}

.schematic-node rect {
  fill: rgba(255, 255, 255, 0.95);
  stroke: rgba(15, 23, 42, 0.2);
  stroke-width: 0.26;
  rx: 2.2;
}

body[data-theme="dark"] .schematic-node rect {
  fill: rgba(15, 23, 42, 0.92);
  stroke: rgba(148, 163, 184, 0.34);
}

.schematic-node-tag {
  fill: var(--text);
  font-size: 1.1px;
  font-weight: 900;
}

.schematic-node-name {
  fill: var(--muted);
  font-size: 0.9px;
  font-weight: 700;
}

.schematic-node-note {
  fill: rgba(71, 85, 105, 0.72);
  font-size: 0.72px;
  font-weight: 700;
}

.schematic-node-icon-bg {
  fill: rgba(21, 94, 239, 0.1);
  stroke: rgba(21, 94, 239, 0.22);
  stroke-width: 0.16;
}

.schematic-node-icon {
  fill: var(--accent);
  font-size: 0.95px;
  font-weight: 900;
  pointer-events: none;
}

body[data-theme="dark"] .schematic-node-note {
  fill: rgba(203, 213, 225, 0.72);
}

body[data-theme="dark"] .schematic-node-icon-bg {
  fill: rgba(56, 189, 248, 0.12);
  stroke: rgba(56, 189, 248, 0.28);
}

.schematic-node-status {
  fill: #94a3b8;
  stroke: #fff;
  stroke-width: 0.26;
}

.schematic-node-resize {
  display: none;
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 0.18;
  cursor: nwse-resize;
  filter: drop-shadow(0 2px 7px rgba(21, 94, 239, 0.24));
}

body.is-edit-mode .diagram-stage.is-schematic-mode .schematic-node-resize {
  display: block;
}

.schematic-node.status-normal .schematic-node-status {
  fill: var(--success);
}

.schematic-node.status-warning .schematic-node-status {
  fill: var(--warning);
}

.schematic-node.status-critical .schematic-node-status {
  fill: var(--danger);
}

.schematic-node.status-maintenance .schematic-node-status {
  fill: #8b5cf6;
}

.schematic-node.status-offline .schematic-node-status {
  fill: #64748b;
}

.schematic-node:hover .schematic-node-card,
.schematic-node:focus-visible .schematic-node-card,
.schematic-node.is-active .schematic-node-card {
  transform: scale(1.03);
  filter: drop-shadow(0 4px 14px rgba(15, 107, 255, 0.24));
}

.schematic-node:focus-visible rect {
  stroke: var(--accent);
  stroke-width: 0.44;
}

.schematic-node.is-active rect {
  stroke: var(--accent);
  stroke-width: 0.34;
}

.stream-path {
  fill: none;
  opacity: 0.18;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 0.22;
  transition: opacity 180ms ease, stroke-width 180ms ease, filter 180ms ease;
}

.stream-hit-path {
  fill: none;
  stroke: rgba(21, 94, 239, 0.001);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  pointer-events: none;
}

.diagram-stage.is-calibrating .stream-path,
.diagram-stage.is-stream-path-editing .stream-path {
  pointer-events: stroke;
  cursor: copy;
}

.diagram-stage.is-calibrating .stream-hit-path,
.diagram-stage.is-stream-path-editing .stream-hit-path {
  pointer-events: stroke;
  cursor: grab;
}

.diagram-stage.is-calibrating .stream-hit-path:active,
.diagram-stage.is-stream-path-editing .stream-hit-path:active {
  cursor: grabbing;
}

.stream-point {
  opacity: 0;
  pointer-events: none;
}

.diagram-stage.is-calibrating .stream-point,
.diagram-stage.is-stream-path-editing .stream-point {
  opacity: 0.92;
  pointer-events: all;
  cursor: move;
  stroke: #ffffff;
  stroke-width: 0.18;
  filter: drop-shadow(0 0 0.12rem rgba(0, 0, 0, 0.32));
}

.diagram-stage.is-calibrating .stream-point.stream-liquid,
.diagram-stage.is-stream-path-editing .stream-point.stream-liquid {
  fill: #111827;
}

.diagram-stage.is-calibrating .stream-point.stream-water,
.diagram-stage.is-stream-path-editing .stream-point.stream-water {
  fill: #155eef;
}

.diagram-stage.is-calibrating .stream-point.stream-gas,
.diagram-stage.is-stream-path-editing .stream-point.stream-gas {
  fill: #e79b00;
}

.diagram-stage.is-calibrating .stream-point.stream-air,
.diagram-stage.is-stream-path-editing .stream-point.stream-air {
  fill: #249348;
}

.stream-path.stream-liquid {
  stroke: #111827;
}

.stream-path.stream-water {
  stroke: #155eef;
}

.stream-path.stream-gas {
  stroke: #e79b00;
}

.stream-path.stream-air {
  stroke: #249348;
}

.stream-path.is-active {
  opacity: 0.78;
  stroke-width: 0.44;
  stroke-dasharray: 1.8 1.7;
  animation: flowMove 2.2s linear infinite;
  filter: drop-shadow(0 0 0.12rem rgba(21, 94, 239, 0.26));
}

.stream-path.is-dimmed {
  opacity: 0.025;
  stroke-width: 0.18;
  animation: none;
  filter: none;
}

.diagram-stage.stream-filtering .flow-image {
  opacity: 0.86;
}

@keyframes flowMove {
  to {
    stroke-dashoffset: -12;
  }
}

.hotspot-layer,
.calibration-layer {
  position: absolute;
  inset: 0;
}

.hotspot-layer {
  z-index: 5;
  pointer-events: none;
}

.calibration-layer {
  pointer-events: none;
  z-index: 8;
}

.hotspot {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: max(34px, calc(var(--w) * 1%));
  height: max(34px, calc(var(--h) * 1%));
  border: 0;
  border-radius: 7px;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: opacity 160ms ease, filter 160ms ease;
  pointer-events: auto;
}

.hotspot-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--marker-size, 34px);
  height: var(--marker-size, 34px);
  border: 1px solid rgba(38, 48, 46, 0.28);
  border-radius: 50%;
  color: #12312b;
  background: var(--yellow);
  box-shadow: inset 0 0 0 4px #fff4c7, 0 8px 18px rgba(0, 0, 0, 0.12);
  opacity: 0.72;
  transform: scale(0.55);
  transform-origin: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.hotspot-marker svg {
  width: 58%;
  height: 58%;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-wrap svg,
.detail-icon svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hotspot:hover .hotspot-marker,
.hotspot:focus-visible .hotspot-marker,
.hotspot.is-active .hotspot-marker {
  color: #fff;
  background: var(--blue);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.26),
    0 0 0 3px rgba(56, 189, 248, 0.35),
    0 0 18px rgba(56, 189, 248, 0.55);
  opacity: 1;
  transform: scale(1);
}

.hotspot.is-active .hotspot-marker {
  animation: activePulse 1.45s ease-in-out infinite;
}

.hotspot.is-learning .hotspot-marker {
  background: var(--green);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.24),
    0 0 0 6px rgba(36, 147, 72, 0.25),
    0 16px 28px rgba(0, 0, 0, 0.18);
  opacity: 1;
  transform: scale(1);
}

.hotspot.is-stream-muted,
.equipment-tab.is-stream-muted,
.section-equipment-button.is-stream-muted {
  opacity: 0.38;
  filter: grayscale(0.45);
}

.schematic-node.is-stream-muted {
  opacity: 0.35;
  filter: grayscale(0.6);
}

.hotspot:focus-visible {
  outline: 3px solid rgba(21, 94, 239, 0.38);
  outline-offset: 4px;
}

.hotspot-label {
  position: absolute;
  left: 50%;
  top: calc(50% + 22px);
  display: none;
  transform: translateX(-50%);
  border: 1px solid rgba(21, 32, 31, 0.16);
  border-radius: 999px;
  padding: 2px 6px;
  color: #17201f;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.64rem;
  font-weight: 900;
  white-space: nowrap;
}

.diagram-stage.is-calibrating .hotspot {
  outline: 1px dashed rgba(21, 94, 239, 0.7);
  outline-offset: -1px;
  background: rgba(21, 94, 239, 0.06);
  cursor: move;
}

.diagram-stage.is-calibrating .hotspot-label {
  display: inline-flex;
}

.hotspot-resize {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: none;
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 4px 12px rgba(21, 94, 239, 0.28);
  cursor: nwse-resize;
}

.diagram-stage.is-calibrating .hotspot-resize {
  display: block;
}

.hotspot-tooltip {
  display: none !important;
}

/*
  position: absolute;
  left: 50%;
  bottom: calc(50% + 28px);
  display: grid;
  gap: 3px;
  min-width: 190px;
  max-width: 250px;
  border: 1px solid rgba(21, 32, 31, 0.16);
  border-radius: 7px;
  padding: 9px 10px;
  color: #17201f;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
  white-space: normal;
  z-index: 12;
}
*/

.hotspot-tooltip strong,
.hotspot-tooltip em,
.hotspot-tooltip small {
  display: block;
}

.hotspot-tooltip strong {
  font-size: 0.78rem;
}

.hotspot-tooltip em {
  color: #41504c;
  font-size: 0.76rem;
  font-style: normal;
  line-height: 1.25;
}

.hotspot-tooltip small {
  color: #155eef;
  font-size: 0.72rem;
  font-weight: 900;
}

.hotspot:hover .hotspot-tooltip,
.hotspot:focus-visible .hotspot-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

body[data-theme="dark"] .hotspot-tooltip {
  border-color: #334841;
  color: var(--ink);
  background: #17221f;
}

body[data-theme="dark"] .hotspot-tooltip em {
  color: var(--muted);
}

body[data-theme="dark"] .hotspot-tooltip small {
  color: var(--blue);
}

.hotspot-layer.icons-transparent .hotspot-marker {
  opacity: 0.34;
  background: rgba(241, 185, 11, 0.42);
  box-shadow: none;
}

.hotspot-layer.icons-transparent .hotspot:hover .hotspot-marker,
.hotspot-layer.icons-transparent .hotspot:focus-visible .hotspot-marker,
.hotspot-layer.icons-transparent .hotspot.is-active .hotspot-marker {
  opacity: 1;
  background: var(--blue);
}

@keyframes activePulse {
  0%,
  100% {
    box-shadow:
      inset 0 0 0 4px rgba(255, 255, 255, 0.26),
      0 0 0 3px rgba(56, 189, 248, 0.35),
      0 0 0 0 rgba(21, 94, 239, 0.36);
  }

  55% {
    box-shadow:
      inset 0 0 0 4px rgba(255, 255, 255, 0.26),
      0 0 0 3px rgba(56, 189, 248, 0.35),
      0 0 0 8px rgba(21, 94, 239, 0);
  }
}

.calibration-point {
  position: absolute;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #155eef;
  border-radius: 999px;
  padding: 2px 7px;
  color: #0b3a8f;
  background: #eef4ff;
  box-shadow: 0 8px 18px rgba(21, 94, 239, 0.18);
  font-size: 0.72rem;
  font-weight: 900;
  transform: translate(-50%, -140%);
  white-space: nowrap;
}

.diagram-empty-state {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(21, 94, 239, 0.08), rgba(36, 147, 72, 0.08)),
    rgba(255, 255, 255, 0.9);
  text-align: center;
}

body[data-theme="dark"] .diagram-empty-state {
  background:
    linear-gradient(135deg, rgba(101, 163, 255, 0.12), rgba(100, 213, 138, 0.1)),
    rgba(17, 27, 24, 0.94);
}

.empty-copy {
  max-width: 520px;
}

.empty-copy strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.empty-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.empty-copy small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.equipment-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.equipment-tab {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid #d6ddd8;
  border-radius: 7px;
  padding: 7px 9px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #12312b;
  background: var(--yellow);
  box-shadow: inset 0 0 0 4px #fff4c7;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.equipment-tab .tab-copy strong,
.equipment-tab .tab-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-tab .tab-copy strong {
  font-size: 0.83rem;
}

.equipment-tab .tab-copy span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.72rem;
}

.equipment-tab:hover,
.equipment-tab:focus-visible,
.equipment-tab.is-active,
.section-equipment-button:hover,
.section-equipment-button:focus-visible,
.section-equipment-button.is-active {
  border-color: var(--blue);
  background: #eef4ff;
  box-shadow: inset 3px 0 0 var(--blue);
  transform: translateY(-1px);
}

.equipment-tab.is-learning,
.section-equipment-button.is-learning {
  border-color: var(--green);
  box-shadow: inset 3px 0 0 var(--green);
}

body[data-theme="dark"] .equipment-tab,
body[data-theme="dark"] .section-equipment-button {
  border-color: var(--line);
}

body[data-theme="dark"] .equipment-tab:hover,
body[data-theme="dark"] .equipment-tab:focus-visible,
body[data-theme="dark"] .equipment-tab.is-active,
body[data-theme="dark"] .section-equipment-button:hover,
body[data-theme="dark"] .section-equipment-button:focus-visible,
body[data-theme="dark"] .section-equipment-button.is-active {
  background: #20322d;
}

.equipment-tab:hover .icon-wrap,
.equipment-tab:focus-visible .icon-wrap,
.equipment-tab.is-active .icon-wrap {
  color: #fff;
  background: var(--blue);
  transform: rotate(-4deg) scale(1.06);
}

.equipment-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.unit-section-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.unit-section-card header {
  padding: 11px 12px 9px;
  border-bottom: 1px solid var(--line);
}

.unit-section-card h3 {
  margin: 0 0 5px;
  font-size: 0.9rem;
}

.unit-section-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.section-equipment-list {
  display: grid;
  gap: 6px;
  padding: 9px;
}

.section-equipment-button {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.section-equipment-button strong,
.section-equipment-button span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-equipment-button strong {
  font-size: 0.82rem;
}

.section-equipment-button span {
  color: var(--muted);
  font-size: 0.72rem;
}

.detail-panel {
  position: sticky;
  top: 16px;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(160px, 240px) minmax(0, 1fr) auto;
  max-height: calc(100vh - 32px);
  align-self: start;
}

.detail-panel.is-hidden {
  display: none;
}

.photo-frame {
  aspect-ratio: 4 / 3;
  background: #dce3df;
  border-bottom: 1px solid var(--line);
}

.photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-copy {
  padding: 18px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-heading {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.detail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #12312b;
  background: #fff3bd;
  border: 1px solid #f2d46b;
}

.detail-icon svg {
  width: 30px;
  height: 30px;
  stroke-width: 2;
}

body[data-theme="dark"] .detail-icon {
  color: #07110f;
  background: #f7c948;
  border-color: #f7c948;
}

.tagline {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.detail-copy h2 {
  margin-bottom: 10px;
  font-size: 1.28rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.detail-copy p {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.process-path {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.path-node {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--ink);
  background: var(--panel-soft);
  font-size: 0.74rem;
  font-weight: 850;
}

.path-node:not(:last-child)::after {
  content: ">";
  margin-left: 7px;
  color: var(--muted);
}

.path-node.is-current {
  border-color: var(--blue);
  background: #eef4ff;
}

body[data-theme="dark"] .path-node.is-current {
  background: #20322d;
}

.detail-section {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.detail-section ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-section li {
  position: relative;
  padding-left: 15px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.38;
}

.detail-section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
}

.detail-copy a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--coal);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--coal);
  text-decoration: none;
  font-weight: 800;
}

.detail-copy a:hover,
.detail-copy a:focus-visible {
  background: var(--coal);
  color: #fff;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}

.meta-grid div {
  padding: 14px 18px;
}

.meta-grid div:nth-child(2n) {
  border-left: 1px solid var(--line);
}

.meta-grid div:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.meta-grid span,
.meta-grid strong {
  display: block;
}

.meta-grid span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.meta-grid strong {
  font-size: 0.95rem;
}

.operation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.operation-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px;
  background: var(--panel);
}

.operation-grid span,
.operation-grid strong {
  display: block;
}

.operation-grid span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.operation-grid strong {
  font-size: 0.96rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.78rem;
}

.status-normal {
  color: #14532d;
  background: #dcfce7;
}

.status-warning {
  color: #713f12;
  background: #fef3c7;
}

.status-alarm {
  color: #7f1d1d;
  background: #fee2e2;
}

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

  .detail-panel {
    position: static;
    display: block;
    max-height: none;
  }

  .detail-copy {
    overflow: visible;
  }

  .photo-frame {
    max-height: 320px;
    aspect-ratio: 16 / 6;
  }

  .toolbar-row,
  .toolbar-row-secondary {
    align-items: stretch;
    flex-direction: column;
  }

  .search-control {
    width: 100%;
    margin-left: 0;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .diagram-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

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

  .brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    object-position: center;
    border-radius: 10px;
  }

  .brand-subtitle {
    display: none;
  }

  .brand-copy h1 {
    font-size: 1.1rem;
  }

  .top-actions,
  .status-pill,
  .theme-toggle {
    width: 100%;
  }

  .top-actions {
    align-items: stretch;
  }

  .status-pill {
    text-align: center;
  }

  .unit-tabs {
    border-radius: 8px;
  }

  .unit-tab {
    min-width: 108px;
  }

  .diagram-stage {
    min-width: 0;
  }

  .zoom-controls {
    display: grid;
    grid-template-columns: 42px 1fr 42px 58px;
  }

  .zoom-readout,
  .tool-button {
    width: 100%;
  }

  .diagram-actions,
  .stream-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .search-control {
    grid-template-columns: 1fr;
  }

  .search-all-toggle,
  .icon-opacity-toggle {
    justify-content: flex-start;
  }

  .operation-grid,
  .meta-grid,
  .equipment-sections {
    grid-template-columns: 1fr;
  }

  .meta-grid div:nth-child(2n) {
    border-left: 0;
  }

  .meta-grid div:nth-child(n + 2) {
    border-top: 1px solid var(--line);
  }

  .photo-frame {
    min-height: 250px;
  }
}

/* Modern refresh layer */
body {
  background:
    radial-gradient(circle at top left, rgba(15, 107, 255, 0.1), transparent 34rem),
    linear-gradient(180deg, var(--bg), #edf2f7);
}

body[data-theme="dark"] {
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.13), transparent 34rem),
    linear-gradient(180deg, var(--bg), #070b10);
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.38);
  outline-offset: 3px;
}

.app-shell {
  padding: clamp(14px, 2vw, 24px);
}

.topbar {
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 2px 14px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

h1 {
  color: var(--text);
  font-weight: 850;
}

.status-pill,
.theme-toggle,
.unit-tabs,
.diagram-panel,
.detail-panel {
  backdrop-filter: blur(14px);
}

.status-pill {
  border-color: rgba(15, 107, 255, 0.22);
  border-radius: 999px;
  background: var(--accent-soft);
  color: #0b4bb3;
  box-shadow: none;
}

body[data-theme="dark"] .status-pill {
  color: #bfdbfe;
  background: rgba(96, 165, 250, 0.13);
}

.theme-toggle,
.tool-button,
.zoom-readout,
.toggle-box,
.stream-button,
.unit-tab,
.equipment-tab,
.section-equipment-button {
  border-color: var(--border);
}

.theme-toggle {
  min-height: 40px;
  background: var(--glass);
  box-shadow: var(--shadow-card);
}

.theme-toggle-icon {
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  box-shadow: inset -8px -7px 0 rgba(255, 255, 255, 0.45);
}

.unit-tabs {
  gap: 6px;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  padding: 6px;
  background: var(--glass);
  box-shadow: var(--shadow-card);
  scrollbar-width: thin;
}

.unit-tab {
  border-radius: 999px;
  padding: 10px 16px;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.unit-tab:hover,
.unit-tab:focus-visible {
  background: var(--surface-soft);
}

.unit-tab.is-active {
  border-color: rgba(15, 107, 255, 0.42);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(15, 107, 255, 0.08);
}

body[data-theme="dark"] .unit-tab.is-active {
  background: var(--accent-soft);
}

.workspace {
  gap: 18px;
}

.diagram-panel,
.detail-panel {
  border-color: rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-lg);
  background: var(--glass);
  box-shadow: var(--shadow-soft);
}

body[data-theme="dark"] .diagram-panel,
body[data-theme="dark"] .detail-panel {
  background: var(--glass);
}

.diagram-toolbar {
  gap: 10px;
  padding: 12px;
  border-color: var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(248, 250, 252, 0.88));
}

body[data-theme="dark"] .diagram-toolbar {
  background: linear-gradient(180deg, rgba(18, 26, 36, 0.84), rgba(15, 23, 32, 0.94));
}

.toolbar-row {
  gap: 10px;
  flex-wrap: wrap;
}

.zoom-controls,
.search-control,
.stream-controls,
.diagram-actions {
  min-width: 0;
}

.tool-button,
.zoom-readout,
.toggle-box {
  min-height: 38px;
  border-radius: var(--radius-md);
  background: var(--surface);
}

.icon-button {
  width: 40px;
  min-width: 40px;
}

.tool-button:hover,
.tool-button:focus-visible,
.compact-toggle:hover .toggle-box,
.compact-toggle:focus-within .toggle-box {
  border-color: rgba(15, 107, 255, 0.5);
  background: var(--accent-soft);
  box-shadow: 0 10px 24px rgba(15, 107, 255, 0.12);
}

.tool-button.is-active,
.stream-button.is-active,
.compact-toggle input:checked + .toggle-box {
  border-color: rgba(15, 107, 255, 0.56);
  color: var(--accent);
  background: var(--accent-soft);
}

.tool-button.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.tool-button.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(15, 107, 255, 0.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 760ms linear infinite;
}

.search-control {
  position: relative;
  grid-template-columns: minmax(260px, 460px) auto auto;
  gap: 8px;
}

.search-control input[type="search"] {
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.search-control.is-active input[type="search"],
.search-control input[type="search"]:focus {
  border-color: rgba(15, 107, 255, 0.58);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(15, 107, 255, 0.12);
}

body[data-theme="dark"] .search-control.is-active input[type="search"],
body[data-theme="dark"] .search-control input[type="search"]:focus {
  background: #0f1720;
}

.stream-controls {
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.stream-button {
  min-height: 34px;
  border-radius: 999px;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.step-counter {
  min-height: 36px;
  border-color: rgba(22, 163, 74, 0.22);
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

body[data-theme="dark"] .step-counter {
  color: #bbf7d0;
}

.shortcut-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.diagram-scroll {
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), transparent),
    var(--diagram-bg);
}

.diagram-stage {
  border-color: rgba(148, 163, 184, 0.46);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
}

.stream-path {
  transition: opacity 220ms ease, stroke-width 220ms ease, filter 220ms ease;
}

.stream-path.is-active {
  stroke-dasharray: 1.7 2.2;
  animation: flowMove 3.2s linear infinite;
  filter: drop-shadow(0 0 0.14rem rgba(15, 107, 255, 0.22));
}

.hotspot-marker {
  background: linear-gradient(135deg, #f8d65c, #f59e0b);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.38), 0 10px 22px rgba(15, 23, 42, 0.14);
}

.hotspot:hover .hotspot-marker,
.hotspot:focus-visible .hotspot-marker,
.hotspot.is-active .hotspot-marker {
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.24),
    0 0 0 4px rgba(34, 211, 238, 0.22),
    0 0 22px rgba(15, 107, 255, 0.38);
}

.hotspot-tooltip {
  border-color: rgba(148, 163, 184, 0.38);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-card);
}

.equipment-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px;
  scrollbar-width: thin;
}

.equipment-tab {
  flex: 0 0 210px;
  border-radius: var(--radius-md);
  box-shadow: none;
}

.equipment-sections {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  background: var(--surface);
}

.unit-section-card,
.detail-section,
.operation-grid div,
.section-equipment-button,
.equipment-tab {
  border-radius: var(--radius-md);
}

.unit-section-card {
  background: var(--surface-soft);
}

.search-empty-state {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  min-height: 120px;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
}

.search-empty-state strong {
  color: var(--text);
}

.detail-panel {
  grid-template-rows: minmax(150px, 220px) minmax(0, 1fr) auto;
  animation: none;
}

.detail-panel.is-refreshing {
  animation: none;
}

.detail-panel.is-refreshing .detail-hero,
.detail-panel.is-refreshing .detail-card {
  animation: none;
}

.photo-frame {
  margin: 14px 14px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(15, 107, 255, 0.12), rgba(34, 211, 238, 0.1)),
    var(--surface-soft);
  box-shadow: var(--shadow-card);
}

.photo-frame img {
  opacity: 0;
  transition: none;
}

.photo-frame img.is-loaded,
.photo-frame img.is-placeholder {
  opacity: 1;
}

.detail-heading {
  grid-template-columns: 44px minmax(0, 1fr);
}

.detail-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(15, 107, 255, 0.18);
}

.tagline {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.detail-copy h2 {
  color: var(--text);
  font-size: 1.18rem;
}

.detail-copy p,
.detail-section li {
  color: var(--muted);
}

.detail-section {
  padding: 13px;
  background: var(--surface-soft);
}

.detail-section h3 {
  color: var(--text);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

.operation-grid {
  gap: 10px;
}

.operation-grid div {
  background: var(--surface);
}

.status-normal,
.status-running {
  color: #166534;
  background: #dcfce7;
}

.status-warning {
  color: #92400e;
  background: #fef3c7;
}

.status-alarm,
.status-critical {
  color: #991b1b;
  background: #fee2e2;
}

.meta-grid {
  background: var(--surface-soft);
}

.detail-copy a {
  border-color: var(--border);
  border-radius: var(--radius-md);
  color: var(--accent);
  background: var(--surface);
}

.detail-copy a:hover,
.detail-copy a:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: grid;
  gap: 3px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  color: var(--text);
  background: var(--glass);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  animation: toastIn 220ms ease both;
}

.toast strong {
  font-size: 0.88rem;
}

.toast span {
  color: var(--muted);
  font-size: 0.82rem;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-error {
  border-left-color: var(--danger);
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes detailAppear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes detailRefresh {
  0% {
    opacity: 0.9;
  }
}

/* Lightweight UX additions */
.status-pill.status-normal,
.status-pill.status-running {
  border-color: rgba(22, 163, 74, 0.24);
  color: #166534;
  background: rgba(22, 163, 74, 0.12);
}

.status-pill.status-warning {
  border-color: rgba(217, 119, 6, 0.28);
  color: #92400e;
  background: rgba(251, 191, 36, 0.16);
}

.status-pill.status-success {
  border-color: rgba(22, 163, 74, 0.24);
  color: #166534;
  background: rgba(22, 163, 74, 0.12);
}

.status-pill.status-danger {
  border-color: rgba(220, 38, 38, 0.28);
  color: #991b1b;
  background: rgba(248, 113, 113, 0.16);
}

.status-pill.status-muted,
.status-pill.status-neutral {
  border-color: rgba(100, 116, 139, 0.24);
  color: #475569;
  background: rgba(148, 163, 184, 0.14);
}

.status-pill.status-alarm,
.status-pill.status-critical {
  border-color: rgba(220, 38, 38, 0.28);
  color: #991b1b;
  background: rgba(248, 113, 113, 0.16);
}

body[data-theme="dark"] .status-pill.status-normal,
body[data-theme="dark"] .status-pill.status-running {
  color: #bbf7d0;
  background: rgba(74, 222, 128, 0.13);
}

body[data-theme="dark"] .status-pill.status-warning {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.14);
}

body[data-theme="dark"] .status-pill.status-success {
  color: #bbf7d0;
  background: rgba(74, 222, 128, 0.13);
}

body[data-theme="dark"] .status-pill.status-danger {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.14);
}

body[data-theme="dark"] .status-pill.status-muted,
body[data-theme="dark"] .status-pill.status-neutral {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.14);
}

body[data-theme="dark"] .status-pill.status-alarm,
body[data-theme="dark"] .status-pill.status-critical {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.14);
}

.search-feedback {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  min-height: 16px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.stream-description {
  align-self: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.diagram-scroll {
  position: relative;
}

.selected-summary {
  position: absolute;
  top: 26px;
  left: 26px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: min(560px, calc(100% - 24px));
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  padding: 7px 8px 7px 10px;
  color: var(--text);
  background: var(--glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
}

.selected-summary.status-normal,
.selected-summary.status-running,
.selected-summary.status-warning,
.selected-summary.status-alarm,
.selected-summary.status-critical,
.selected-summary.status-success,
.selected-summary.status-danger,
.selected-summary.status-muted,
.selected-summary.status-neutral {
  color: var(--text);
  background: var(--glass);
}

.summary-status {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.summary-status.status-warning {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.14);
}

.summary-status.status-success {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.summary-status.status-danger {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
}

.summary-status.status-muted,
.summary-status.status-neutral {
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.12);
}

.summary-status.status-alarm,
.summary-status.status-critical {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
}

.summary-copy {
  display: grid;
  min-width: 0;
}

.summary-copy strong,
.summary-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-copy strong {
  font-size: 0.82rem;
}

.summary-copy span {
  max-width: 220px;
  color: var(--muted);
  font-size: 0.72rem;
}

.summary-chip,
.summary-button {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 850;
}

.summary-button {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.summary-button:hover,
.summary-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.hotspot.status-warning.is-active .hotspot-marker,
.hotspot.status-warning.is-pulsing .hotspot-marker {
  background: linear-gradient(135deg, #fbbf24, #f97316);
}

.hotspot.status-success.is-active .hotspot-marker,
.hotspot.status-success.is-pulsing .hotspot-marker {
  background: linear-gradient(135deg, #22c55e, #0891b2);
}

.hotspot.status-danger.is-active .hotspot-marker,
.hotspot.status-danger.is-pulsing .hotspot-marker {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.hotspot.status-muted.is-active .hotspot-marker,
.hotspot.status-muted.is-pulsing .hotspot-marker,
.hotspot.status-neutral.is-active .hotspot-marker,
.hotspot.status-neutral.is-pulsing .hotspot-marker {
  background: linear-gradient(135deg, #64748b, #0f6bff);
}

.hotspot.status-alarm.is-active .hotspot-marker,
.hotspot.status-alarm.is-pulsing .hotspot-marker {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.hotspot.is-pulsing .hotspot-marker {
  animation: focusPulse 1.6s ease-out 1;
}

.hotspot.status-normal,
.hotspot.status-running,
.hotspot.status-warning,
.hotspot.status-alarm,
.hotspot.status-critical {
  color: inherit;
  background: transparent;
}

.hotspot-tooltip span {
  display: block;
}

.hotspot-tooltip small {
  color: var(--muted);
}

.tooltip-status {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 0.7rem;
  font-weight: 900;
}

.photo-frame {
  position: relative;
}

.photo-frame.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent),
    linear-gradient(135deg, rgba(15, 107, 255, 0.08), rgba(34, 211, 238, 0.06));
  background-size: 220% 100%, auto;
  animation: skeletonSweep 1.2s ease-in-out infinite;
}

.detail-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

.detail-section-toggle::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.9rem;
}

.detail-collapsible.is-open .detail-section-toggle::after {
  content: "-";
}

.detail-section-body {
  display: none;
  padding-top: 10px;
}

.detail-collapsible.is-open .detail-section-body {
  display: block;
}

@keyframes focusPulse {
  0% {
    transform: scale(1);
    box-shadow:
      inset 0 0 0 4px rgba(255, 255, 255, 0.24),
      0 0 0 0 rgba(34, 211, 238, 0.42),
      0 0 18px rgba(15, 107, 255, 0.34);
  }

  70% {
    transform: scale(1.12);
    box-shadow:
      inset 0 0 0 4px rgba(255, 255, 255, 0.24),
      0 0 0 14px rgba(34, 211, 238, 0),
      0 0 26px rgba(15, 107, 255, 0.38);
  }
}

@keyframes skeletonSweep {
  to {
    background-position: -220% 0, 0 0;
  }
}

@media (max-width: 1180px) {
  .detail-panel {
    display: grid;
    grid-template-rows: auto auto auto;
  }

  .detail-copy {
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 12px;
  }

  .unit-tabs {
    border-radius: var(--radius-lg);
  }

  .diagram-toolbar {
    padding: 10px;
  }

  .search-control {
    grid-template-columns: 1fr auto;
  }

  .search-all-toggle {
    grid-column: 1 / -1;
  }

  .stream-controls {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    width: 100%;
  }

  .stream-button {
    flex: 0 0 auto;
  }

  .stream-description {
    width: 100%;
  }

  .diagram-actions {
    display: flex;
    width: 100%;
  }

  .equipment-tab {
    flex-basis: 190px;
  }

  .photo-frame {
    margin: 12px 12px 0;
    min-height: 210px;
    aspect-ratio: 16 / 9;
  }

  .toast-root {
    right: 50%;
    bottom: 14px;
    transform: translateX(50%);
  }

  .selected-summary {
    top: 8px;
    left: 8px;
    max-width: calc(100% - 12px);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
  }

  .summary-copy {
    flex: 1 1 170px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Detail panel and fullscreen equipment card refinement */
.detail-panel {
  display: block;
  padding: 12px;
  overflow: auto;
  scrollbar-width: thin;
}

.detail-close-button {
  position: sticky;
  top: 0;
  right: 0;
  z-index: 8;
  float: right;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0 0 -34px auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.detail-close-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-close-button:hover,
.detail-close-button:focus-visible {
  border-color: rgba(15, 107, 255, 0.48);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.detail-panel.is-hidden {
  display: none;
}

.detail-panel.is-updating {
  opacity: 0.78;
  transform: translateY(4px);
}

.detail-hero,
.detail-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

body[data-theme="dark"] .detail-hero,
body[data-theme="dark"] .detail-card {
  background: rgba(18, 26, 36, 0.78);
}

.detail-hero {
  display: grid;
  gap: 14px;
  padding: 12px;
}

.detail-panel .photo-frame {
  margin: 0;
  aspect-ratio: 16 / 9;
  min-height: 0;
  max-height: none;
  border-radius: 14px;
}

.detail-heading {
  margin: 0;
}

.detail-title-block {
  min-width: 0;
}

.detail-title-block .status-chip {
  margin-top: 7px;
}

.detail-description {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.detail-copy {
  display: grid;
  gap: 12px;
  padding: 12px 0 0;
  overflow: visible;
}

.detail-card {
  padding: 14px;
}

.detail-card h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.operation-data-section {
  margin: 0;
}

.operation-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.operation-metric,
.operation-grid div {
  border-radius: 12px;
  padding: 12px;
  background: var(--surface);
}

.operation-metric span,
.operation-grid span {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.operation-metric strong,
.operation-grid strong {
  color: var(--text);
  font-size: 1rem;
}

.detail-section {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  padding: 14px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

.chevron {
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.6;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.detail-section.is-open .chevron {
  transform: rotate(225deg);
}

.detail-section-body {
  display: none;
  padding: 0 14px 14px;
}

.detail-section.is-open .detail-section-body {
  display: block;
}

.detail-list,
.fullscreen-card-function ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li,
.fullscreen-card-function li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.detail-list li::before,
.fullscreen-card-function li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
}

.detail-meta-card {
  display: grid;
  gap: 12px;
}

.detail-meta-card .meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border: 0;
  background: transparent;
}

.detail-meta-card .meta-grid div {
  border: 1px solid var(--border) !important;
  border-radius: 12px;
  padding: 10px;
  background: var(--surface);
}

.source-link {
  width: fit-content;
  min-height: 32px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.process-path {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.path-node.is-current {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(15, 107, 255, 0.16);
}

.status-chip.status-success,
.status-success {
  color: #166534;
  background: #dcfce7;
}

.status-chip.status-warning,
.status-warning {
  color: #92400e;
  background: #fef3c7;
}

.status-chip.status-danger,
.status-danger {
  color: #991b1b;
  background: #fee2e2;
}

.status-chip.status-muted,
.status-muted {
  color: #475569;
  background: #e2e8f0;
}

.status-chip.status-neutral,
.status-neutral {
  color: #334155;
  background: #e0f2fe;
}

body[data-theme="dark"] .status-chip.status-success,
body[data-theme="dark"] .summary-chip.status-success,
body[data-theme="dark"] .tooltip-status.status-success {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
}

body[data-theme="dark"] .status-chip.status-warning,
body[data-theme="dark"] .summary-chip.status-warning,
body[data-theme="dark"] .tooltip-status.status-warning {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.16);
}

body[data-theme="dark"] .status-chip.status-danger,
body[data-theme="dark"] .summary-chip.status-danger,
body[data-theme="dark"] .tooltip-status.status-danger {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.16);
}

body[data-theme="dark"] .status-chip.status-muted,
body[data-theme="dark"] .status-chip.status-neutral,
body[data-theme="dark"] .summary-chip.status-muted,
body[data-theme="dark"] .summary-chip.status-neutral,
body[data-theme="dark"] .tooltip-status.status-muted,
body[data-theme="dark"] .tooltip-status.status-neutral {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.16);
}

.hotspot.status-success,
.hotspot.status-warning,
.hotspot.status-danger,
.hotspot.status-muted,
.hotspot.status-neutral {
  color: inherit;
  background: transparent;
}

.fullscreen-equipment-card {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 14px;
  width: min(420px, calc(100vw - 44px));
  max-height: min(520px, calc(100vh - 120px));
  border: 1px solid rgba(148, 163, 184, 0.44);
  border-radius: 20px;
  padding: 14px;
  color: var(--text);
  background: var(--glass);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(18px);
  pointer-events: auto;
  animation: fullscreenCardIn 180ms ease both;
}

.fullscreen-equipment-card.is-hidden {
  display: none;
}

.fullscreen-card-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.1rem;
}

.fullscreen-card-image-wrap {
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface-soft);
}

.fullscreen-card-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 132px;
  object-fit: cover;
}

.fullscreen-card-content {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding-right: 28px;
  overflow: auto;
}

.fullscreen-card-tag {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.fullscreen-card-content h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.22;
}

.fullscreen-card-function {
  display: grid;
  gap: 7px;
  margin-top: 4px;
}

.fullscreen-card-function h4 {
  margin: 0;
  color: var(--text);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@keyframes fullscreenCardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (max-width: 1180px) {
  .detail-panel {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .operation-grid,
  .detail-meta-card .meta-grid {
    grid-template-columns: 1fr;
  }

  .fullscreen-equipment-card {
    left: 12px;
    right: 12px;
    bottom: 12px;
    grid-template-columns: 88px minmax(0, 1fr);
    width: auto;
    max-height: 55vh;
    border-radius: 18px;
    padding: 12px;
  }

  .fullscreen-card-image-wrap img {
    min-height: 96px;
  }
}

/* Admin/editor layer */
.admin-secret-trigger {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 90;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  cursor: pointer;
  opacity: 0.36;
  transition: opacity 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.admin-secret-trigger:hover,
.admin-secret-trigger:focus-visible {
  opacity: 1;
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
}

.admin-status-indicator {
  position: fixed;
  right: 56px;
  bottom: 14px;
  z-index: 91;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(22, 163, 74, 0.28);
  border-radius: 999px;
  padding: 7px 8px 7px 12px;
  color: #166534;
  background: rgba(220, 252, 231, 0.9);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  font-size: 0.78rem;
  font-weight: 900;
}

.admin-save-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  color: #14532d;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  letter-spacing: 0.01em;
}

.admin-save-indicator.is-saved {
  color: #14532d;
  background: rgba(240, 253, 244, 0.86);
}

.admin-save-indicator.is-dirty {
  color: #92400e;
  background: rgba(254, 243, 199, 0.88);
}

.admin-save-indicator.is-saving {
  color: #075985;
  background: rgba(224, 242, 254, 0.88);
}

body[data-theme="dark"] .admin-save-indicator {
  color: #bbf7d0;
  background: rgba(15, 23, 42, 0.5);
}

body[data-theme="dark"] .admin-save-indicator.is-dirty {
  color: #fde68a;
  background: rgba(146, 64, 14, 0.34);
}

body[data-theme="dark"] .admin-save-indicator.is-saving {
  color: #bae6fd;
  background: rgba(7, 89, 133, 0.34);
}

body[data-theme="dark"] .admin-status-indicator {
  color: #bbf7d0;
  background: rgba(22, 101, 52, 0.5);
}

.admin-mini-button,
.admin-close-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.admin-mini-button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 900;
}

.admin-close-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 1.2rem;
}

.admin-login-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(10px);
}

.admin-login-dialog {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.28);
}

.admin-login-dialog .admin-close-button {
  position: absolute;
  top: 12px;
  right: 12px;
}

.admin-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.admin-login-dialog h2,
.admin-drawer-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.admin-login-error {
  margin: 0;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: 12px;
  padding: 9px 10px;
  color: #991b1b;
  background: #fee2e2;
  font-size: 0.82rem;
  font-weight: 850;
}

.admin-drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 110;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text);
  background: var(--glass);
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.admin-drawer-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 12px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  padding: 0 18px 14px;
  overflow-x: auto;
}

.admin-tab {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 900;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.admin-tab:hover,
.admin-tab:focus-visible,
.admin-tab.is-active {
  border-color: rgba(15, 107, 255, 0.4);
  color: var(--accent);
  background: var(--accent-soft);
}

.admin-panel-body {
  min-height: 0;
  overflow: auto;
  padding: 0 18px 18px;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-field {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
}

.admin-field span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.admin-field input,
.admin-field select,
.admin-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 11px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.admin-field textarea {
  resize: vertical;
  min-height: 84px;
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 107, 255, 0.12);
}

.admin-grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-upload-preview {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}

.admin-upload-preview img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.admin-upload-preview.wide img {
  height: 210px;
  object-fit: contain;
  background: #fff;
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.admin-form-actions.compact {
  padding-top: 0;
}

.admin-path-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.admin-path-editor strong {
  display: block;
  color: var(--text);
}

.admin-path-editor span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-advanced-block {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 8px 10px 10px;
}

.admin-advanced-block summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.admin-advanced-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.ghost-button {
  color: var(--text);
  background: var(--surface);
}

.tool-button:disabled,
.admin-tab:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

#calibrationToggle.is-locked {
  opacity: 0.58;
}

#calibrationToggle.is-locked:hover {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}

.stream-path.is-preview {
  opacity: 0.95;
  stroke-dasharray: 2 1.4;
  animation: flowMove 2.4s linear infinite;
  filter: drop-shadow(0 0 0.18rem rgba(15, 107, 255, 0.38));
}

body.is-admin .diagram-stage.is-calibrating::after {
  content: "Admin calibration";
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 12;
  border-radius: 999px;
  padding: 6px 10px;
  color: #92400e;
  background: rgba(254, 243, 199, 0.94);
  font-size: 0.72rem;
  font-weight: 950;
}

body[data-theme="dark"] .admin-login-dialog,
body[data-theme="dark"] .admin-field input,
body[data-theme="dark"] .admin-field select,
body[data-theme="dark"] .admin-field textarea,
body[data-theme="dark"] .admin-mini-button,
body[data-theme="dark"] .admin-close-button,
body[data-theme="dark"] .admin-tab,
body[data-theme="dark"] .ghost-button {
  background: var(--surface);
}

@media (max-width: 760px) {
  .admin-drawer {
    inset: auto 10px 10px;
    top: 10px;
    width: auto;
    border-radius: 20px;
  }

  .admin-status-indicator {
    left: 12px;
    right: 54px;
    justify-content: space-between;
  }

  .admin-grid-two {
    grid-template-columns: 1fr;
  }

  .admin-form-actions {
    flex-direction: column;
  }

  .admin-form-actions .tool-button {
    width: 100%;
  }
}

/* Visual enhancement layer */
body.layer-hotspots-hidden .hotspot-layer {
  display: none;
}

body.layer-hotspots-hidden .schematic-node-group {
  display: none;
}

body.layer-stream-labels-hidden .stream-label,
.stream-label.is-hidden {
  display: none;
}

body.layer-status-hidden .hotspot-status-badge {
  display: none;
}

body.layer-calibration-hidden .calibration-layer {
  display: none;
}

body.layer-tooltip-hidden .equipment-tooltip {
  display: none !important;
}

body.layer-process-path-hidden .process-path {
  display: none !important;
}

.stream-label {
  fill: var(--text);
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 0.18px;
  paint-order: stroke;
  font-size: 1.45px;
  font-weight: 900;
  pointer-events: none;
  opacity: 0.72;
}

.stream-label.is-dimmed {
  opacity: 0.12;
}

.hotspot-status-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.08);
}

.hotspot.status-normal .hotspot-status-badge,
.equipment-tab.status-normal .icon-wrap::after {
  background: var(--success);
}

.hotspot.status-warning .hotspot-status-badge,
.equipment-tab.status-warning .icon-wrap::after {
  background: var(--warning);
}

.hotspot.status-critical .hotspot-status-badge,
.equipment-tab.status-critical .icon-wrap::after {
  background: var(--danger);
}

.hotspot.status-maintenance .hotspot-status-badge,
.equipment-tab.status-maintenance .icon-wrap::after {
  background: #8b5cf6;
}

.hotspot.status-offline .hotspot-status-badge,
.equipment-tab.status-offline .icon-wrap::after {
  background: #64748b;
}

.hotspot.status-warning .hotspot-marker,
.hotspot.status-critical .hotspot-marker {
  animation: statusPulse 2.2s ease-in-out infinite;
}

.schematic-node.status-warning,
.schematic-node.status-critical {
  animation: statusPulse 2.2s ease-in-out infinite;
}

.schematic-node.is-pulsing {
  animation: activePulse 1.45s ease-in-out 1;
}

@keyframes statusPulse {
  50% {
    box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.12);
  }
}

.equipment-tab .icon-wrap {
  position: relative;
}

.equipment-tab .icon-wrap::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 7px;
  height: 7px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: #94a3b8;
}

.hotspot.is-search-match .hotspot-marker,
.equipment-tab.is-search-match {
  outline: 2px solid rgba(15, 107, 255, 0.42);
  outline-offset: 3px;
}

.equipment-tooltip {
  position: absolute;
  z-index: 55;
  display: grid;
  gap: 3px;
  min-width: 132px;
  max-width: 220px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--glass);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.equipment-tooltip strong,
.equipment-tooltip span,
.equipment-tooltip small {
  display: block;
}

.equipment-tooltip span,
.equipment-tooltip small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.28;
}

.equipment-tooltip strong {
  font-size: 0.82rem;
  font-weight: 900;
}

.mini-map {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 28;
  width: 180px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  background: var(--glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
}

.mini-map.is-collapsed {
  width: auto;
  padding: 6px;
}

.mini-map.is-collapsed .mini-map-stage {
  display: none;
}

.mini-map-toggle {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}

.mini-map-stage {
  position: relative;
  height: 92px;
  margin-top: 6px;
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15, 107, 255, 0.08), rgba(34, 211, 238, 0.05)),
    var(--surface-soft);
}

.mini-map-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: var(--accent);
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.mini-map-dot.is-active {
  width: 11px;
  height: 11px;
  background: var(--warning);
}

.mini-map-viewport {
  position: absolute;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: rgba(15, 107, 255, 0.09);
  pointer-events: none;
}

.layer-panel {
  position: fixed;
  right: 18px;
  top: 96px;
  z-index: 95;
  width: min(320px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  color: var(--text);
  background: var(--glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

.layer-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.layer-control-list {
  display: grid;
  gap: 8px;
}

.layer-toggle,
.admin-inline-toggle,
.admin-import-label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px;
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 850;
}

.admin-import-label input {
  display: none;
}

.admin-utility-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  background: var(--surface-soft);
}

.admin-edit-state {
  border-radius: 999px;
  padding: 8px 10px;
  color: #64748b;
  background: rgba(148, 163, 184, 0.14);
  font-size: 0.78rem;
  font-weight: 950;
}

.admin-edit-state.is-on,
.admin-mini-button.is-active {
  color: #92400e;
  background: #fef3c7;
}

.admin-header-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.admin-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.validation-panel {
  display: grid;
  gap: 10px;
}

.validation-issue {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 12px;
  padding: 10px;
  background: var(--surface);
}

.validation-issue.severity-error {
  border-left-color: var(--danger);
}

.validation-issue.severity-warning {
  border-left-color: var(--warning);
}

.validation-issue.severity-info {
  border-left-color: var(--accent);
}

.presentation-equipment-overlay {
  position: absolute;
  z-index: 56;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 7px;
  width: min(360px, calc(100% - 20px));
  max-width: 360px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 13px;
  color: var(--text);
  background: var(--glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
}

.presentation-overlay-media {
  width: 78px;
  min-height: 88px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-soft);
}

.presentation-overlay-media img {
  width: 100%;
  height: 100%;
  min-height: 88px;
  display: block;
  object-fit: cover;
}

.presentation-overlay-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.presentation-equipment-overlay.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.presentation-equipment-overlay h3,
.presentation-equipment-overlay p {
  margin: 0;
}

.presentation-equipment-overlay p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.presentation-meta {
  font-size: 0.76rem !important;
  font-weight: 850;
}

.presentation-overlay-close {
  position: absolute;
  right: 8px;
  top: 8px;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}

body.is-presentation-mode .admin-drawer,
body.is-presentation-mode .topbar,
body.is-presentation-mode .unit-tabs,
body.is-presentation-mode .detail-panel,
body.is-presentation-mode .fullscreen-equipment-card,
body.is-presentation-mode .selected-summary,
body.is-presentation-mode #equipmentSections,
body.is-presentation-mode #equipmentStrip,
body.is-presentation-mode .search-control {
  display: none !important;
}

body.is-presentation-mode .workspace {
  grid-template-columns: 1fr;
}

body.is-presentation-mode .app-shell {
  max-width: none;
  padding: 8px;
}

body.is-presentation-mode .diagram-panel {
  min-height: calc(100vh - 160px);
}

body.is-presentation-mode .diagram-scroll {
  min-height: 70vh;
}

body.is-presentation-mode .diagram-scroll::before {
  content: "RefineryMap Presentation · Map the process. Understand the flow.";
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 34;
  max-width: min(430px, calc(100% - 28px));
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--text);
  background: var(--glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  font-size: 0.76rem;
  font-weight: 900;
  pointer-events: none;
}

body.is-presentation-mode .diagram-toolbar {
  position: sticky;
  top: 8px;
  z-index: 60;
}

body.is-presentation-mode .diagram-actions .tour-control,
body.is-presentation-mode .diagram-actions #processRun,
body.is-presentation-mode .diagram-actions #visualToggle,
body.is-presentation-mode .diagram-actions #fullscreenToggle,
body.is-presentation-mode .diagram-actions #presentationToggle {
  display: inline-flex;
}

body.is-presentation-mode .diagram-actions #calibrationToggle,
body.is-presentation-mode .diagram-actions #exportPng,
body.is-presentation-mode .diagram-actions #fitSelected,
body.is-presentation-mode .diagram-actions #layerToggle,
body.is-presentation-mode .icon-opacity-toggle {
  display: none;
}

body.is-presentation-mode.layer-presentation-search .search-control {
  display: grid !important;
}

@media (max-width: 760px) {
  .mini-map {
    width: 132px;
    right: 8px;
    bottom: 8px;
  }

  .mini-map-stage {
    height: 68px;
  }

  .admin-utility-bar {
    grid-template-columns: 1fr;
  }

  .layer-panel {
    right: 10px;
    left: 10px;
    top: auto;
    bottom: 10px;
    width: auto;
  }

  .presentation-equipment-overlay {
    grid-template-columns: 70px minmax(0, 1fr);
    max-width: 320px;
  }

  .presentation-overlay-media {
    width: 70px;
    min-height: 78px;
  }

  .presentation-overlay-media img {
    min-height: 78px;
  }
}
