.gcode-z-overlay {
  position: absolute;
  top: 0;
  right: 12px;
  z-index: 6;
  pointer-events: none;
  display: block;
  opacity: 1;
  transform: translateZ(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.gcode-z-overlay.is-hidden {
  opacity: 0;
  transform: translateY(-6px);
}

.gcode-z-overlay__panel {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.92));
  box-shadow:
    0 12px 28px rgba(15, 23, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.gcode-z-overlay__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(245, 248, 253, 0.76));
  color: #0f172a;
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.gcode-z-overlay__title-badge {
  min-width: 38px;
  text-align: center;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: #334155;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.gcode-z-overlay__body {
  display: flex;
  flex-direction: column;
  height: calc(100% - 31px);
}

.gcode-z-overlay__stage {
  flex: 1 1 auto;
  min-height: 0;
  padding: 6px 8px 4px;
}

.gcode-z-overlay__svg {
  width: 100%;
  height: 100%;
  display: block;
}

.gcode-z-overlay__hud {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px 8px 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(248, 250, 252, 0.78);
}

.gcode-z-overlay__hud-cell {
  min-width: 0;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.78);
}

.gcode-z-overlay__hud-label {
  display: block;
  margin-bottom: 3px;
  font-size: 9px;
  line-height: 1;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gcode-z-overlay__hud-value {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  line-height: 1.15;
  color: #0f172a;
  font-weight: 700;
}

.gcode-z-overlay__hud-value--dim {
  color: #475569;
}

.gcode-z-overlay .z-bg {
  fill: url(#gcodeZBgGradient);
  stroke: rgba(148, 163, 184, 0.34);
  stroke-width: 1;
}

.gcode-z-overlay .z-track-grid line {
  stroke: rgba(148, 163, 184, 0.28);
  stroke-width: 0.8;
  stroke-dasharray: 3 5;
}

.gcode-z-overlay .z-base {
  fill: #171717;
  opacity: 0.9;
}

.gcode-z-overlay .z-table-fill {
  fill: #c7d2fe;
  opacity: 0.12;
}

.gcode-z-overlay .z-table-line {
  stroke: #334155;
  stroke-width: 2.1;
}

.gcode-z-overlay .z-sheet {
  fill: #f4e8b2;
  stroke: #9a7b28;
  stroke-width: 1.1;
}

.gcode-z-overlay .z-sheet-hatch {
  stroke: rgba(118, 83, 18, 0.55);
  stroke-width: 1.2;
  stroke-linecap: round;
  opacity: 0.7;
}

.gcode-z-overlay .z-sheet-top-line {
  stroke: #8b5e1a;
  stroke-width: 1.5;
  stroke-dasharray: none;
}

.gcode-z-overlay .z-depth-guide {
  stroke: rgba(30, 41, 59, 0.35);
  stroke-width: 1;
  stroke-dasharray: 5 4;
}

.gcode-z-overlay .z-depth-tip {
  fill: #ef4444;
  opacity: 0.9;
}

.gcode-z-overlay .z-chips {
  pointer-events: none;
}

.gcode-z-overlay .z-chip-streak {
  stroke: #1f2937;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.gcode-z-overlay .z-chip-dot {
  fill: #111827;
  stroke: rgba(15, 23, 42, 0.75);
  stroke-width: 0.7;
}

.gcode-z-overlay .z-tool-shadow {
  fill: rgba(15, 23, 42, 0.14);
}

.gcode-z-overlay .z-gantry {
  fill: #0f172a;
  stroke: #020617;
  stroke-width: 1.1;
}

.gcode-z-overlay .z-carriage {
  fill: #06b6d4;
  stroke: #0e7490;
  stroke-width: 1.2;
}

.gcode-z-overlay .z-spindle-body {
  fill: #94a3b8;
  stroke: #475569;
  stroke-width: 1.1;
}

.gcode-z-overlay .z-spindle-nose {
  fill: #64748b;
  stroke: #334155;
  stroke-width: 1;
}

.gcode-z-overlay .z-bit {
  fill: #6b5d5d;
  stroke: #3f3b3b;
  stroke-width: 1;
}

.gcode-z-overlay.is-lifting .gcode-z-overlay__title-badge {
  background: rgba(14, 165, 233, 0.14);
  color: #0369a1;
}

.gcode-z-overlay.is-lowering .gcode-z-overlay__title-badge {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
}

.gcode-z-overlay.is-cutting .gcode-z-overlay__hud-value--z {
  color: #b91c1c;
}

.gcode-z-overlay.is-rapid .gcode-z-overlay__hud-value--z {
  color: #0f766e;
}

.gcode-z-overlay.is-waiting .z-depth-guide {
  stroke: rgba(15, 23, 42, 0.2);
  stroke-dasharray: 2 4;
}
