@layer tokens, base, nodes, hud, modals;

/* === 01-base-tokens.css (base) === */
@layer base {
/**
 * Gridspace Master Stylesheet
 * Strict Engineering Standards:
 * - Zero `!important` declarations
 * - Zero `margin` for layout spacing (100% Flexbox/Grid `gap` and `padding`)
 * - GPU-accelerated compositing (`translate3d`, `scale`, `will-change: transform`)
 * - All UI colors, surfaces, borders, and grid tokens are reactive via StyleController
 */

:root {
  /* Category 1: Canvas & Grid Tokens (Default: Miro Daylight) */
  --bg-canvas: #f5f6f8;
  --grid-minor-color: rgba(15, 23, 42, 0.05);
  --grid-major-color: rgba(15, 23, 42, 0.11);
  --origin-color: #000000;
  --origin-axis-color: rgba(0, 0, 0, 0.4);

  /* Category 2: UI Containers & Panels */
  --bg-panel: rgba(255, 255, 255, 0.94);
  --bg-panel-solid: #ffffff;
  --bg-panel-hover: #f1f5f9;
  --border-subtle: rgba(15, 23, 42, 0.10);
  --panel-blur: 10px;
  --panel-radius: 0px;
  --panel-height: 34px;
  --viewport-edge-pad-base: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --viewport-edge-pad: calc(var(--viewport-edge-pad-base) + var(--safe-left));
  --viewport-edge-pad-top: calc(var(--viewport-edge-pad-base) + var(--safe-top));
  --viewport-edge-pad-right: calc(var(--viewport-edge-pad-base) + var(--safe-right));
  --viewport-edge-pad-bottom: calc(var(--viewport-edge-pad-base) + var(--safe-bottom));
  --viewport-edge-pad-left: calc(var(--viewport-edge-pad-base) + var(--safe-left));

  /* Category 3: Typography & Icons */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Category 4: Tools, Nodes & Connections */
  --accent-primary: #2563eb;
  --accent-text: #ffffff;
  --accent-glow: rgba(37, 99, 235, 0.22);
  --border-focus: rgba(37, 99, 235, 0.6);
  --node-surface: #ffffff;
  --node-border: #cbd5e1;
  --node-radius: 0px;
  --arrow-default: #334155;

  /* Universal Element Border System (Unselected Resting State) */
  --element-border-width: 1px;
  --element-border-style: solid;
  --element-border-color: #cbd5e1;
  --element-radius: var(--node-radius, 0px);

  /* Universal Bounding Box & Transform Handles (Selected State) */
  --bounding-box-width: 2px;
  --bounding-box-color: var(--accent-primary);
  --handle-size: 10px;
  --handle-bg: #ffffff;
  --handle-border-width: 2px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Category 5: Standardized Z-Index Layer Scale */
  --z-node-base: 1;
  --z-node-badge: 25;
  --z-node-handles: 50;
  --z-node-toolbar: 200;
  --z-node-flyout: 500;
  --z-connections: 90000;
  --z-connection-labels: 92000;
  --z-drawings: 95000;
  --z-node-elevated: 99990;
  --z-drawings-overlay: 99999;
  --z-ui-chrome: 100000;
  --z-ui-floating: 100050;
  --z-ui-drawer: 100100;
  --z-ui-modal: 100200;
  --z-ui-toast: 100300;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
h1,
h2,
h3,
p {
  margin: 0;
  padding: 0;
}

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-primary, #2563eb);
  outline-offset: 2px;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* Material Symbols Base Standard */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

/* Root Application Shell */
.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Top Floating Header Bar */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-ui-chrome, 100000) + 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--viewport-edge-pad-top, 14px);
  padding-right: var(--viewport-edge-pad-right, 14px);
  padding-bottom: 0px;
  padding-left: var(--viewport-edge-pad-left, 14px);
  pointer-events: none;
}

.top-bar-left,
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: var(--panel-height, 34px);
  padding: 0 11px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
}

.brand-badge.is-active {
  border-color: var(--accent-primary);
  box-shadow: none;
}

.brand-icon {
  color: var(--accent-primary);
  font-size: 18px;
}

.brand-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* Top-Left Project Switcher & Save Bar */
.project-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--panel-height, 34px);
  padding: 4px;
  box-sizing: border-box;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
}

.project-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 7px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid transparent;
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.project-selector-btn:hover,
.project-selector-btn.is-active {
  background: var(--bg-panel-hover);
  border-color: var(--border-subtle);
}

.project-folder-icon {
  color: var(--accent-primary);
  font-size: 15px;
}

.project-name-text {
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-chevron {
  font-size: 16px;
  color: var(--text-muted);
}

.save-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 6px;
  border-radius: 0;
  font-size: 10px;
  color: var(--text-secondary);
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.save-status-pill[data-state="dirty"] .save-dot,
.save-status-pill[data-state="saving"] .save-dot {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.save-status-pill[data-state="error"] .save-dot {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.controls-hint {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hint-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  box-shadow: none;
}

.hint-chip .material-symbols-outlined {
  font-size: 15px;
  color: var(--text-muted);
}

/* Studio & Project Tools Container (Relocated inside Workspace Settings Modal) */
.style-dock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.top-action-btn,
.style-dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--panel-height, 34px);
  padding: 0 11px;
  background: var(--bg-panel-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.top-action-btn .material-symbols-outlined,
.style-dock-btn .material-symbols-outlined {
  color: var(--accent-primary);
  font-size: 16px;
}

.top-action-btn:hover,
.top-action-btn.is-active,
.style-dock-btn:hover,
.style-dock-btn.is-active {
  background: var(--bg-panel-hover);
  border-color: var(--border-focus);
}

/* Infinite Viewport Surface */
.viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: default;
  outline: none;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.viewport.is-panning {
  cursor: grabbing;
}

.viewport.is-panning #world,
.viewport.is-touch-pinching #world {
  pointer-events: none;
}

.viewport.is-space-ready {
  cursor: grab;
}

.viewport.is-space-ready.is-panning {
  cursor: grabbing;
}

.viewport.is-space-ready.is-panning #world {
  pointer-events: none;
}

/* Multi-Scale Background Grid & Screen-Space Canvas */
.grid-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: repeat;
  overflow: hidden;
}

.grid-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

body.is-logged-off .grid-canvas,
body.is-project-space-mode .grid-canvas {
  display: none;
}

/* GPU-Accelerated World Plane */
.world-plane {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  transform: translate3d(0px, 0px, 0px) scale(1);
  will-change: auto;
}

.viewport.is-panning .world-plane,
.viewport.is-touch-pinching .world-plane,
.world-plane.is-interacting {
  will-change: transform;
}

body.is-mobile-constrained .world-plane,
body.is-mobile-constrained .viewport.is-panning .world-plane,
body.is-mobile-constrained .viewport.is-touch-pinching .world-plane {
  transform: translate(0px, 0px) scale(1);
  will-change: auto;
}

/* World Origin (0, 0) Crosshair Marker (Hidden by Default, Toggleable in Style Configurator) */
.origin-marker {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  display: none;
  pointer-events: none;
}

.origin-axis {
  position: absolute;
  background: var(--origin-color, #000000);
}

.origin-axis-x {
  width: 36px;
  height: 1px;
  left: -18px;
  top: 0;
}

.origin-axis-y {
  width: 1px;
  height: 36px;
  left: 0;
  top: -18px;
}

.origin-label {
  position: absolute;
  left: 6px;
  top: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--origin-color, #000000);
  white-space: nowrap;
}

/* Viewport Telemetry & Zoom Controls Bar (Relocated inside Workspace Settings Modal) */
.hud-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: var(--panel-height, 34px);
  padding: 4px;
  box-sizing: border-box;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
}

.coords-readout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 6px;
  color: var(--text-secondary);
  font-size: 11px;
}

.coords-icon {
  font-size: 14px;
  color: var(--accent-primary);
}

.mono-text {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hud-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
}

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

.hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 24px;
  width: 24px;
  padding: 0;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.hud-btn:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-subtle);
}

.hud-btn:active {
  transform: translateY(1px);
}

.hud-btn-with-label {
  width: auto;
  padding: 0 8px;
}

.hud-zoom-pill {
  height: 24px;
  min-width: 50px;
  padding: 0 6px;
  background: var(--bg-panel-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.hud-zoom-pill:hover {
  border-color: var(--border-focus);
}

/* ==========================================================================
   TABLET & IPAD TOUCH OPTIMIZATION (ZERO MARGIN STANDARD)
   ========================================================================== */
body.is-touch-device {
  height: 100dvh;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
}

body.is-touch-device .app-shell,
body.is-touch-device .viewport {
  height: 100dvh;
}

body.is-touch-device .viewport,
body.is-touch-device .world {
  touch-action: none;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body.is-touch-device .grid-node img,
body.is-touch-device .grid-node video,
body.is-touch-device .grid-node canvas {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

body.is-touch-device .resize-handle::after {
  content: "";
  position: absolute;
  inset: -10px;
}

body.is-touch-device .conn-hit-path {
  stroke-width: 32px;
}

@media (max-width: 1080px) {
  :root {
    --panel-height: 42px;
  }

  .top-bar {
    gap: 8px;
  }

  .top-bar-left,
  .top-bar-right {
    gap: 6px;
  }

  .brand-badge {
    padding: 0 10px;
    gap: 6px;
  }

  .brand-title {
    font-size: 13px;
  }

  .style-dock-btn,
  .top-action-btn {
    padding: 0 10px;
  }

  .hud-btn {
    width: 34px;
    height: 34px;
  }

  .coords-readout {
    display: none;
  }
}
}

/* === 04-nodes-core.css (nodes) === */
@layer nodes {
/* ==========================================================================
   STAGE 3: GPU BOARD NODES, 8-WAY RESIZE HANDLES, MARQUEE & TOOL DOCK
   ========================================================================== */

.viewport.is-pan-tool {
  cursor: grab;
}

.viewport.is-pan-tool.is-panning {
  cursor: grabbing;
}

/* Marquee Box-Selection Overlay */
.marquee-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: var(--z-ui-chrome, 100000);
  background: var(--accent-glow);
  border: 1.5px solid var(--accent-primary);
  border-radius: 0;
  display: none;
  will-change: auto;
}

.marquee-box.is-frame-draw {
  background: rgba(255, 255, 255, 0.15);
  border: 2px dashed #ffffff;
  border-radius: 0;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.35);
}

.marquee-box.is-card-draw {
  background: rgba(99, 102, 241, 0.16);
  border: 2px dashed var(--accent-primary, #6366f1);
  border-radius: 0;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.25);
}

.marquee-box.is-timer-draw {
  background: rgba(16, 185, 129, 0.16);
  border: 2px dashed #10b981;
  border-radius: 0;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}

.marquee-box.is-audio-draw {
  background: rgba(239, 68, 68, 0.16);
  border: 2px dashed #ef4444;
  border-radius: 0;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.25);
}

.marquee-box.is-textbox-draw {
  background: rgba(255, 255, 255, 0.15);
  border: 2px dashed var(--node-border);
  border-radius: var(--node-radius);
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.2);
}

.marquee-box.is-active {
  display: block;
  will-change: transform;
}

.marquee-box.is-interacting {
  will-change: transform;
}

/* Shared Horizontal Divider (used inside floating Pen & Arrow sub-panels) */
.dock-divider {
  width: 20px;
  height: 1px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

/* GPU-Accelerated Board Node Card */
/* Text Card (Shortcut T) enforces strict 600px minimum width floor */
.grid-node.node-type-card {
  min-width: 600px;
}

.grid-node.node-type-card .node-body {
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
}

.grid-node.node-type-card.is-editing .node-body {
  overflow-y: auto;
}

.grid-node {
  position: absolute;
  top: 0;
  left: 0;
  z-index: var(--node-z, 1);
  display: flex;
  flex-direction: column;
  background: var(--node-surface);
  color: var(--text-primary);
  border-width: var(--element-border-width);
  border-style: var(--element-border-style);
  border-color: var(--element-border-color);
  border-radius: var(--element-radius);
  box-sizing: border-box;
  box-shadow: none;
  cursor: grab;
  contain: layout style;
}

.grid-node:hover {
  transition: border-color 0.1s ease, box-shadow 0.12s ease;
}

.grid-node.has-open-flyout {
  z-index: var(--z-node-elevated, 99990);
}

.grid-node.has-open-flyout .node-header {
  position: relative;
  z-index: var(--z-node-toolbar, 200);
}

.grid-node.is-culled {
  visibility: hidden;
  pointer-events: none;
}

body.is-mobile-constrained[data-grid-overview-lod="true"] .grid-node:not(.node-type-frame) .node-header,
body.is-mobile-constrained[data-grid-overview-lod="true"] .grid-node .node-resize-handle,
body.is-mobile-constrained[data-grid-overview-lod="true"] .grid-node .purpose-selector-container,
body.is-mobile-constrained[data-grid-overview-lod="true"] .grid-node .media-transport-bar,
body.is-mobile-constrained[data-grid-overview-lod="true"] .grid-node.node-type-card .node-body {
  visibility: hidden;
}

.grid-node.is-interacting {
  cursor: grabbing;
  opacity: 1;
  user-select: none;
  will-change: transform;
}

.grid-node.is-selected {
  border-color: var(--bounding-box-color);
  box-shadow: none;
  opacity: 1;
  transition: border-color 0.1s ease;
}

.grid-node.is-selected:focus-within {
  opacity: 1;
}

.grid-node.node-type-frame {
  opacity: 1;
}

.node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(128, 128, 128, 0.04);
  border-top-left-radius: var(--node-radius);
  border-top-right-radius: var(--node-radius);
}

.node-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.node-drag-icon {
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.node-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  border-radius: var(--node-radius);
  padding: 1px 0;
}

.node-title[contenteditable="true"] {
  background: var(--bg-panel-solid);
  outline: 1.5px solid var(--accent-primary);
  outline-offset: 2px;
  cursor: text;
  user-select: text;
}

.node-coords-badge {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.node-body {
  flex: 1;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
}

.grid-node.is-editing .node-body {
  overflow: auto;
}

.grid-node:not(.is-editing) .node-body,
.grid-node:not(.is-editing) .node-title {
  user-select: none;
  cursor: grab;
}

.node-body[contenteditable="true"] {
  color: var(--text-primary);
  background: transparent;
  cursor: text;
  user-select: text;
}

/* ==========================================================================
   UNIVERSAL GRID TOOL SUBTOOL INTERACTIVE GUARD (MASTER SYSTEM RULE)
   Subtools inside any tool container can be interacted with ONLY when the
   container is active in Editing Mode (.is-editing), entered via double-click / Alt+Click.
   ========================================================================== */
.grid-node:not(.is-editing):not(.is-ghost-active) .node-header-right button,
.grid-node:not(.is-editing):not(.is-ghost-active) .purpose-selector-container,
.grid-node:not(.is-editing):not(.is-ghost-active) .node-header-btn,
.grid-node:not(.is-editing):not(.is-ghost-active) .frame-action-btn,
.grid-node:not(.is-editing):not(.is-ghost-active) .frame-header-actions,
.grid-node:not(.is-editing):not(.is-ghost-active) .frame-color-picker-label,
.grid-node:not(.is-editing):not(.is-ghost-active) .audio-studio-body button,
.grid-node:not(.is-editing):not(.is-ghost-active) .shape-floating-bar,
.grid-node:not(.is-editing):not(.is-ghost-active) .textbox-floating-bar,
.grid-node:not(.is-editing):not(.is-ghost-active) .timer-controls-row button,
.grid-node:not(.is-editing):not(.is-ghost-active) .timer-ctrl-btn,
.grid-node:not(.is-editing):not(.is-ghost-active) .timer-mode-switcher,
.grid-node:not(.is-editing):not(.is-ghost-active) .timer-date-chip,
.grid-node:not(.is-editing):not(.is-ghost-active) .timer-worker-btn,
.grid-node:not(.is-editing):not(.is-ghost-active) .timer-rate-wrap,
.grid-node:not(.is-editing):not(.is-ghost-active) .timer-rate-input,
.grid-node:not(.is-editing):not(.is-ghost-active) .timer-config-drawer {
  pointer-events: none;
  transition: none;
}

.grid-node:not(.is-editing):not(.is-ghost-active) .node-header-right,
.grid-node:not(.is-editing):not(.is-ghost-active) .frame-header-actions,
.grid-node:not(.is-editing) .timer-controls-row,
.grid-node:not(.is-editing):not(.is-ghost-active) .timer-mode-switcher,
.grid-node:not(.is-editing):not(.is-ghost-active) .timer-header-right {
  opacity: 0.6;
  transition: none;
}

.grid-node.is-editing .node-header-right button,
.grid-node.is-editing .purpose-selector-container,
.grid-node.is-editing .node-header-btn,
.grid-node.is-editing .frame-action-btn,
.grid-node.is-editing .frame-header-actions,
.grid-node.is-editing .frame-color-picker-label,
.grid-node.is-editing .audio-studio-body button,
.grid-node.is-editing .shape-floating-bar,
.grid-node.is-editing .textbox-floating-bar,
.grid-node.is-editing .timer-controls-row button,
.grid-node.is-editing .timer-ctrl-btn,
.grid-node.is-editing .timer-mode-switcher,
.grid-node.is-editing .timer-date-chip,
.grid-node.is-editing .timer-worker-btn,
.grid-node.is-editing .timer-rate-wrap,
.grid-node.is-editing .timer-rate-input,
.grid-node.is-editing .timer-config-drawer {
  pointer-events: auto;
  transition: none;
}

.grid-node.is-editing .node-header-right,
.grid-node.is-editing .frame-header-actions,
.grid-node.is-editing .timer-controls-row,
.grid-node.is-editing .timer-mode-switcher,
.grid-node.is-editing .timer-header-right {
  opacity: 1;
  transition: none;
}

/* 8-Way Resize Handles (Visible when Node is Selected) */
.node-resize-handles {
  display: none;
  position: absolute;
  inset: calc(-0.5 * var(--bounding-box-width, 2px));
  pointer-events: none;
  z-index: var(--z-node-handles, 50);
}

.grid-node.is-selected.is-editing .node-resize-handles {
  display: block;
}

.resize-handle {
  position: absolute;
  width: var(--handle-size, 10px);
  height: var(--handle-size, 10px);
  background: var(--handle-bg, #ffffff);
  border: var(--handle-border-width, 2px) solid var(--bounding-box-color, var(--accent-primary));
  border-radius: 0;
  box-sizing: border-box;
  pointer-events: auto;
  z-index: var(--z-node-handles, 50);
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease, background-color 0.1s ease;
}

.resize-handle:hover {
  background: var(--bounding-box-color, var(--accent-primary));
  transform: translate(-50%, -50%) scale(1.2);
}

.handle-nw { top: 0; left: 0; cursor: nwse-resize; }
.handle-n  { top: 0; left: 50%; cursor: ns-resize; }
.handle-ne { top: 0; left: 100%; cursor: nesw-resize; }
.handle-e  { top: 50%; left: 100%; cursor: ew-resize; }
.handle-se { top: 100%; left: 100%; cursor: nwse-resize; }
.handle-s  { top: 100%; left: 50%; cursor: ns-resize; }
.handle-sw { top: 100%; left: 0; cursor: nesw-resize; }
.handle-w  { top: 50%; left: 0; cursor: ew-resize; }


.grid-node.is-ghost-active .node-header-right button,
.grid-node.is-ghost-active .purpose-selector-container,
.grid-node.is-ghost-active .node-header-btn,
.grid-node.is-ghost-active .frame-action-btn,
.grid-node.is-ghost-active .frame-header-actions,
.grid-node.is-ghost-active .frame-color-picker-label,
.grid-node.is-ghost-active .audio-studio-body button,
.grid-node.is-ghost-active .shape-floating-bar,
.grid-node.is-ghost-active .textbox-floating-bar,
.grid-node.is-ghost-active .timer-ctrl-btn,
.grid-node.is-ghost-active .timer-date-chip,
.grid-node.is-ghost-active .timer-rate-wrap,
.grid-node.is-ghost-active .timer-rate-input {
  pointer-events: auto;
  transition: none;
}

.grid-node.is-ghost-active .node-header-right,
.grid-node.is-ghost-active .frame-header-actions,
.grid-node.is-ghost-active .timer-header-right {
  opacity: 1;
  transition: none;
}

.grid-node.is-ghost-active:not(.is-selected) {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2);
}

}

/* === 05-nodes-media.css (nodes) === */
@layer nodes {
/* ==========================================================================
   STAGE 4 & 5: DROPZONE OVERLAY, MEDIA NODES (IMAGE/GIF/VIDEO), STICKY & FRAME
   ========================================================================== */

/* Fullscreen Drag-and-Drop Overlay */
.dropzone-overlay {
  position: absolute;
  inset: 16px;
  z-index: var(--z-ui-modal, 100200);
  background: rgba(15, 17, 21, 0.72);
  border: 2px dashed var(--accent-primary);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.dropzone-overlay.is-active {
  opacity: 1;
}

.dropzone-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 36px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-focus);
  border-radius: var(--panel-radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.dropzone-icon {
  font-size: 42px;
  color: var(--accent-primary);
}

.dropzone-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.dropzone-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Image, GIF, Video & YouTube Nodes */
.grid-node.node-type-image,
.grid-node.node-type-video,
.grid-node.node-type-youtube {
  padding: 0;
  overflow: visible;
  background: var(--node-surface, #ffffff);
  border-width: var(--element-border-width);
  border-style: var(--element-border-style);
  border-color: var(--element-border-color);
  border-radius: var(--element-radius);
}

.grid-node.node-type-image.is-selected,
.grid-node.node-type-video.is-selected,
.grid-node.node-type-youtube.is-selected {
  border-color: var(--bounding-box-color);
  box-shadow: none;
}

.media-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--element-radius);
  overflow: hidden;
  background: rgba(15, 23, 42, 0.04);
}

.node-media-img,
.node-media-video {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.node-media-img:not([src]) {
  opacity: 0;
}

/* Zoom-Out Media Density & Climax Limiter Freeze */
.node-media-freeze-canvas {
  display: none;
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  object-fit: cover;
  pointer-events: none;
}

.media-container.is-media-frozen .node-media-img {
  display: none;
}

.media-container.is-media-frozen .node-media-freeze-canvas {
  display: block;
}

.media-caption-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--node-surface);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  user-select: none;
}

.media-caption-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.media-caption-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  flex-shrink: 0;
}

.media-caption-btn:hover {
  background: var(--bg-panel-hover);
  color: var(--text-primary);
}

.media-caption-btn .material-symbols-outlined {
  font-size: 15px;
}

.media-type-icon {
  font-size: 15px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

/* ==========================================================================
   VIDEO NODE TRANSPORT & SCRUBBER CONTROLS
   Zero !important, Zero margin (100% Flex gap & padding)
   ========================================================================== */
.video-media-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: auto;
  padding: 10px;
  box-sizing: border-box;
  gap: 8px;
  background: var(--node-surface, #ffffff);
  overflow: hidden;
  position: relative;
}

.video-media-container .node-media-video {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: cover;
  background: #000000;
  display: block;
}

.video-transport-overlay {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
  flex-shrink: 0;
  user-select: none;
  z-index: 10;
}

.video-scrubber-track {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(128, 128, 128, 0.2);
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.video-scrubber-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent-primary, #6366f1);
  pointer-events: none;
  border-radius: 0;
}

.video-scrubber-thumb {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.24);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: transform 0.12s ease;
}

.video-scrubber-track:hover .video-scrubber-thumb {
  transform: translate(-50%, -50%) scale(1.35);
}

.video-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  min-height: 24px;
}

.video-controls-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.video-controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.video-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
  flex-shrink: 0;
}

.video-control-btn:hover {
  background: var(--bg-panel-hover, rgba(255, 255, 255, 0.08));
  color: var(--text-primary);
}

.video-control-btn .material-symbols-outlined {
  font-size: 16px;
}

.video-time-display {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0 4px;
}

.grid-node.node-type-video .video-title-label,
.grid-node.node-type-youtube .video-title-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
  cursor: text;
}

.grid-node.node-type-video .video-title-label:hover,
.grid-node.node-type-youtube .video-title-label:hover {
  color: var(--text-primary);
}

.grid-node.node-type-video .video-title-label[contenteditable="true"],
.grid-node.node-type-youtube .video-title-label[contenteditable="true"] {
  background: var(--bg-panel-solid);
  color: var(--text-primary);
  outline: 1.5px solid var(--accent-primary);
  outline-offset: 2px;
  padding: 0 4px;
  overflow: visible;
  text-overflow: clip;
  cursor: text;
  user-select: text;
}

.video-type-badge {
  font-size: 15px;
  color: var(--accent-primary, #6366f1);
  flex-shrink: 0;
}

/* Integrated #hashtag header inside Video & YouTube containers (C above B inside A) */
.grid-node.node-type-video > .node-corner-step-pill,
.grid-node.node-type-video.has-purpose > .node-corner-step-pill,
.grid-node.node-type-youtube > .node-corner-step-pill,
.grid-node.node-type-youtube.has-purpose > .node-corner-step-pill {
  position: static;
  order: -1;
  flex: 0 0 auto;
  width: 100%;
  left: auto;
  right: auto;
  bottom: auto;
  border: none;
  border-bottom: 1px solid var(--step-border, rgba(0, 0, 0, 0.12));
  box-shadow: none;
  cursor: grab;
}

.grid-node.node-type-video > .node-corner-step-pill:hover,
.grid-node.node-type-youtube > .node-corner-step-pill:hover {
  box-shadow: none;
}

.grid-node.node-type-video.is-interacting > .node-corner-step-pill,
.grid-node.node-type-youtube.is-interacting > .node-corner-step-pill {
  cursor: grabbing;
}

/* Video & YouTube Head Navigation Bar (matches Text Box / Shape floating bar) */
.grid-node.node-type-video.is-selected.is-editing .video-floating-bar,
.grid-node.node-type-youtube.is-selected.is-editing .video-floating-bar {
  display: flex;
}

.grid-node.node-type-video.has-purpose.is-editing .video-floating-bar,
.grid-node.node-type-youtube.has-purpose.is-editing .video-floating-bar {
  top: -68px;
}

.grid-node.node-type-video .node-purpose-badge,
.grid-node.node-type-youtube .node-purpose-badge {
  cursor: pointer;
}

/* ==========================================================================
   YOUTUBE STREAMING CONTAINER (Click-to-Play Facade + Live Embed Iframe)
   ========================================================================== */
.youtube-media-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: auto;
  padding: 10px;
  box-sizing: border-box;
  gap: 8px;
  background: var(--node-surface, #ffffff);
  overflow: hidden;
  position: relative;
}

.youtube-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background: #0f1117;
  overflow: hidden;
}

.youtube-facade {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.youtube-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

.youtube-play-btn {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: #ff0033;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.youtube-play-btn:hover {
  filter: brightness(1.08);
  transform: scale(1.06);
}

.youtube-play-btn .material-symbols-outlined {
  font-size: 32px;
}

.youtube-start-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 6px;
  background: rgba(15, 17, 21, 0.86);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.youtube-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000000;
}

.grid-node.node-type-youtube.is-youtube-playing .youtube-facade {
  display: none;
}

.youtube-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  min-height: 24px;
  flex-shrink: 0;
  user-select: none;
}

.youtube-brand-icon {
  font-size: 16px;
  color: #ff0033;
  flex-shrink: 0;
}

/* Shield canvas drag, resize, pan, and drawing tools from iframe pointer capture */
.world.is-canvas-interacting .youtube-iframe,
.viewport.is-panning .youtube-iframe,
.viewport.is-space-ready .youtube-iframe,
.viewport.is-pan-tool .youtube-iframe,
.viewport.is-touch-pinching .youtube-iframe,
.viewport.is-arrow-tool .youtube-iframe,
.viewport.is-pen-tool .youtube-iframe,
.viewport.is-eraser-tool .youtube-iframe,
.viewport.is-frame-tool .youtube-iframe,
.viewport.is-card-tool .youtube-iframe,
.viewport.is-audio-tool .youtube-iframe,
.viewport.is-code-tool .youtube-iframe,
.viewport.is-textbox-tool .youtube-iframe,
.viewport.is-timer-tool .youtube-iframe,
.viewport.is-polygon-tool .youtube-iframe,
.viewport.is-cutout-tool .youtube-iframe,
.grid-node.is-interacting .youtube-iframe {
  pointer-events: none;
}

/* Section Frame / Board Nodes (Solid Fill, Default White #ffffff) */
.grid-node.node-type-frame {
  --node-custom-color: #ffffff;
  background: var(--node-custom-color);
  border-width: var(--element-border-width);
  border-style: var(--element-border-style);
  border-color: var(--element-border-color);
  border-radius: var(--element-radius);
}

.grid-node.node-type-frame.is-selected {
  border-color: var(--bounding-box-color);
  box-shadow: none;
}

.grid-node.node-type-frame.is-locked,
.grid-node.node-type-frame.is-locked.is-selected {
  border-color: var(--node-border);
  box-shadow: none;
}

/* Locked Frame State */
.grid-node.node-type-frame.is-locked {
  cursor: default;
}

.grid-node.node-type-frame.is-locked .resize-handle {
  display: none;
}

.grid-node.node-type-frame.is-locked .frame-backdrop-area {
  pointer-events: auto;
  cursor: default;
}

/* When a frame is locked, its children inside the frame are also locked and cannot be dragged or resized */
.grid-node[data-parent-locked="true"] {
  cursor: default;
}

.grid-node[data-parent-locked="true"] .resize-handle {
  display: none;
}

.grid-node.node-type-frame.is-locked .frame-action-btn:not(.btn-toggle-lock):not(.btn-ai-snapshot) {
  pointer-events: none;
  opacity: 0.35;
}

.grid-node.node-type-frame.is-locked:not(.is-editing):not(.is-ghost-active) .frame-action-btn.btn-toggle-lock,
.grid-node.node-type-frame.is-locked .frame-action-btn.btn-toggle-lock.is-locked-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  pointer-events: auto;
}

.frame-action-btn.btn-toggle-lock {
  color: var(--text-secondary);
}

.frame-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  background: var(--bg-panel-solid);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  border-top-left-radius: var(--node-radius);
  border-top-right-radius: var(--node-radius);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.frame-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.frame-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.frame-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 20px;
  padding: 0;
  border-radius: 0;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease;
}

.frame-action-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.frame-action-btn:active {
  background: rgba(255, 255, 255, 0.13);
}

.frame-action-btn.is-active-btn {
  background: rgba(99, 102, 241, 0.18);
  color: var(--accent-primary, #6366f1);
  border-color: rgba(99, 102, 241, 0.4);
}

.frame-action-btn.is-busy-btn {
  opacity: 0.5;
  pointer-events: none;
}

.frame-action-btn.is-copied-btn {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.45);
}

.frame-action-btn.is-error-btn {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.45);
}

.frame-action-btn .material-symbols-outlined {
  font-size: 14px;
}

.frame-action-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  display: block;
  shape-rendering: geometricPrecision;
}

.frame-color-picker-label {
  position: relative;
  overflow: hidden;
}

.frame-color-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  padding: 0;
  border: none;
  cursor: pointer;
}

.frame-icon {
  font-size: 16px;
  color: var(--text-secondary);
}

.frame-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-primary);
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame-title[contenteditable="true"] {
  outline: none;
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  user-select: text;
  cursor: text;
}

.frame-backdrop-area {
  flex: 1;
  background-color: var(--node-custom-color);
  border-bottom-left-radius: var(--node-radius);
  border-bottom-right-radius: var(--node-radius);
  position: relative;
  overflow: hidden;
}

/* Subtle, very low opacity internal grid for Section Board / Frame */
.grid-node.node-type-frame.has-frame-grid .frame-backdrop-area {
  background-image: 
    linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
}


/* Frame Drop-Target Border Highlight & Child Count Badge */
.grid-node.node-type-frame.is-drop-target {
  border-color: #10b981;
}

.frame-children-badge {
  display: var(--frame-badge-display, none);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--node-radius);
  background: var(--accent-glow);
  color: var(--accent-primary);
  border: 1px solid var(--border-focus);
  flex-shrink: 0;
}


}

/* === 06-connections-pen.css (nodes) === */
@layer nodes {
/* ==========================================================================
   STAGE 6: FREEFORM CLICK-TO-CLICK ARROW MODE (A), HOVER ENDPOINT CIRCLES,
            WHOLE-ARROW DRAG & TOP-HEADER ARROW STYLE BAR
   ========================================================================== */

/* Top-Header Arrow Settings Bar (Weight, Head Size, Color) */
.arrow-header-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--panel-height, 34px);
  padding: 4px 8px;
  box-sizing: border-box;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
  pointer-events: auto;
}

.arrow-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  color: var(--accent-primary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.arrow-header-badge:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-subtle);
}

.arrow-header-badge:active {
  transform: translateY(1px);
}

.arrow-header-badge.is-hard,
.arrow-header-badge.is-hard-point {
  color: var(--accent-primary);
}

.arrow-header-icon {
  font-size: 16px;
}

.arrow-edge-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  border: none;
}

.arrow-header-badge.is-hard .arrow-edge-pill,
.arrow-header-badge.is-round .arrow-edge-pill {
  background: transparent;
  color: var(--text-primary);
  border: none;
}

.arrow-setting-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.arrow-range-input {
  width: 84px;
  height: 20px;
  transform: rotate(-90deg);
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.arrow-weight-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.arrow-number-input {
  width: 34px;
  padding: 2px 0;
  background: rgba(128, 128, 128, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--element-radius, 4px);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  outline: none;
  cursor: text;
  -moz-appearance: textfield;
}

.arrow-number-input::-webkit-outer-spin-button,
.arrow-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.arrow-number-input:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-focus);
}

.arrow-number-input:focus {
  background: var(--bg-panel-solid);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.arrow-weight-unit {
  font-size: 10px;
  color: var(--text-muted);
  user-select: none;
}

.arrow-readout {
  font-size: 11px;
  color: var(--text-primary);
  min-width: 32px;
  text-align: right;
}

.arrow-color-picker {
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

/* Draggable Floating Arrow Tool Widget (A Shortcut) */
.floating-arrow-widget {
  position: fixed;
  top: 180px;
  right: 24px;
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  touch-action: none;
}

body.is-logged-off .floating-arrow-widget,
body.is-logged-off #floating-arrow-widget {
  display: none;
}

.floating-arrow-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  box-sizing: border-box;
  background: #ffffff;
  border: 1.5px solid var(--border-subtle, #e2e8f0);
  border-radius: 50%;
  color: var(--text-primary, #0f172a);
  box-shadow: none;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

.floating-arrow-trigger:active,
.floating-arrow-widget.is-dragging .floating-arrow-trigger {
  cursor: grabbing;
}

.floating-arrow-widget.is-active-tool .floating-arrow-trigger,
.floating-arrow-trigger.is-active {
  background: #000000;
  border-color: #000000;
  color: #ffffff;
  box-shadow: none;
}

.floating-arrow-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  color: var(--text-primary, #0f172a);
  pointer-events: none;
}

.floating-arrow-widget.is-active-tool .floating-arrow-trigger-icon,
.floating-arrow-trigger.is-active .floating-arrow-trigger-icon {
  color: #ffffff;
}

.floating-arrow-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 44px;
  gap: 8px;
  padding: 8px 4px;
  box-sizing: border-box;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius, 8px);
  box-shadow: none;
  pointer-events: auto;
}

.floating-arrow-widget.is-expanded .floating-arrow-panel {
  display: flex;
}

.floating-arrow-weight-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.floating-arrow-slider-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 92px;
}

/* Draggable Floating Pen & Brush Controller Widget */
.floating-pen-widget {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  touch-action: none;
}

body.is-logged-off .floating-pen-widget,
body.is-logged-off #floating-pen-widget {
  display: none;
}

.floating-pen-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  box-sizing: border-box;
  background: #ffffff;
  border: 1.5px solid var(--border-subtle, #e2e8f0);
  border-radius: 50%;
  color: var(--text-primary, #0f172a);
  box-shadow: none;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

.floating-pen-trigger:active,
.floating-pen-widget.is-dragging .floating-pen-trigger {
  cursor: grabbing;
}

.floating-pen-widget.is-active-tool .floating-pen-trigger,
.floating-pen-trigger.is-active {
  background: #000000;
  border-color: #000000;
  color: #ffffff;
  box-shadow: none;
}

.floating-pen-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  color: var(--text-primary, #0f172a);
  pointer-events: none;
}

.floating-pen-svg-icon {
  display: block;
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.floating-pen-eraser-icon {
  display: none;
  font-size: 21px;
}

.floating-pen-trigger-icon.is-eraser .floating-pen-svg-icon {
  display: none;
}

.floating-pen-trigger-icon.is-eraser .floating-pen-eraser-icon {
  display: inline-flex;
}

.floating-pen-widget.is-active-tool .floating-pen-trigger-icon,
.floating-pen-trigger.is-active .floating-pen-trigger-icon {
  color: #ffffff;
}

.floating-pen-color-ring {
  display: none;
}

.floating-pen-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 44px;
  gap: 8px;
  padding: 8px 4px;
  box-sizing: border-box;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius, 8px);
  box-shadow: none;
  pointer-events: auto;
}

.floating-pen-widget.is-expanded .floating-pen-panel {
  display: flex;
}

.floating-pen-widget.is-active-tool .floating-pen-panel {
  border-color: var(--border-subtle, #e2e8f0);
}

.floating-pen-tool-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--element-radius, 4px);
  color: var(--text-secondary);
  cursor: pointer;
}

.floating-pen-tool-btn .material-symbols-outlined {
  font-size: 18px;
}

.floating-pen-tool-btn.is-active {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #ffffff;
}

.floating-pen-tool-btn.is-disabled {
  opacity: 0.5;
}

.pen-strength-badge {
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  color: #fda4af;
  pointer-events: none;
}

.floating-pen-tool-btn.is-active .pen-strength-badge {
  color: #ffffff;
}

.floating-pen-smoothing-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.pen-smoothing-flyout {
  position: absolute;
  left: calc(100% + 8px);
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #0f172a);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--panel-radius, 8px);
  z-index: calc(var(--z-ui-floating, 100050) + 10);
  white-space: nowrap;
  pointer-events: auto;
}

.pen-smoothing-flyout.is-hidden {
  display: none;
}

.pen-smoothing-flyout-header {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  letter-spacing: 0.02em;
  padding: 0 2px;
}

.pen-smoothing-flyout-header .flyout-header-icon {
  font-size: 14px;
  color: #f43f5e;
}

.pen-smoothing-options-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pen-smooth-opt-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 8px;
  box-sizing: border-box;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--element-radius, 4px);
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
}

.pen-smooth-opt-pill.is-active {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #ffffff;
  font-weight: 600;
}

.floating-pen-size-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.floating-pen-slider-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 92px;
}

.drawing-setting-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.drawing-range-input {
  width: 84px;
  height: 20px;
  transform: rotate(-90deg);
  accent-color: #f43f5e;
  cursor: pointer;
}

.drawing-size-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.drawing-number-input {
  width: 34px;
  padding: 2px 0;
  background: rgba(128, 128, 128, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--element-radius, 4px);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  outline: none;
  cursor: text;
  -moz-appearance: textfield;
}

.drawing-number-input::-webkit-outer-spin-button,
.drawing-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.drawing-number-input:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-focus);
}

.drawing-number-input:focus {
  background: var(--bg-panel-solid);
  border-color: #f43f5e;
  box-shadow: 0 0 0 1px #f43f5e;
}

.drawing-size-unit {
  font-size: 10px;
  color: var(--text-muted);
  user-select: none;
}

.drawing-color-picker {
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.drawing-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--element-radius, 4px);
  color: var(--text-secondary);
  cursor: pointer;
}

.drawing-clear-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
}

.drawing-clear-btn .material-symbols-outlined {
  font-size: 18px;
}

.viewport.is-arrow-tool,
.viewport.is-arrow-tool .grid-node {
  cursor: crosshair;
}

.viewport.is-pen-tool,
.viewport.is-pen-tool .grid-node {
  cursor: crosshair;
}

.viewport.is-eraser-tool,
.viewport.is-eraser-tool .grid-node {
  cursor: crosshair;
}

.viewport.is-frame-tool,
.viewport.is-frame-tool .grid-node,
.viewport.is-card-tool,
.viewport.is-card-tool .grid-node,
.viewport.is-audio-tool,
.viewport.is-audio-tool .grid-node,
.viewport.is-textbox-tool,
.viewport.is-textbox-tool .grid-node,
.viewport.is-timer-tool,
.viewport.is-timer-tool .grid-node {
  cursor: crosshair;
}

/* Infinite Vector SVG Layer & Midpoint Labels Layer inside #world */
.connections-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: var(--z-connections, 90000);
  contain: layout style;
}

.connection-labels-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
  z-index: var(--z-connection-labels, 92000);
  contain: layout style;
}

/* Stage 7: Real-time Freehand Raster & Vector Drawing Layer inside #world */
.drawing-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: var(--z-drawings, 95000);
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

.drawing-canvas.is-interacting {
  will-change: transform;
}

body.is-mobile-constrained .drawing-canvas,
body.is-mobile-constrained .drawing-canvas.is-interacting {
  transform: translate(0px, 0px);
  will-change: auto;
}

body.is-mobile-constrained .drawing-layer,
body.is-viewer-mode .drawing-layer,
body.is-mobile-constrained #floating-pen-widget,
body.is-mobile-constrained #layers-drawer {
  display: none;
}

.drawing-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: calc(var(--z-drawings, 95000) + 1);
}

.drawing-item {
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.drawing-stroke {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawing-eraser-cursor {
  fill: transparent;
  stroke: rgba(0, 0, 0, 0.25);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

/* Individual SVG Arrow Groups */
.conn-group {
  pointer-events: none;
  cursor: grab;
  transition: filter 0.15s ease;
}

.conn-group.is-selected {
  opacity: 1;
}

.conn-group.is-dragging {
  cursor: grabbing;
  opacity: 1;
}

.world-plane.is-drawing-arrow .conn-group {
  pointer-events: none;
}

.conn-hit-path {
  fill: none;
  stroke: transparent;
  stroke-width: 16px;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: stroke;
  cursor: grab;
}

.conn-group.is-dragging .conn-hit-path {
  cursor: grabbing;
}

.conn-outline-path {
  fill: none;
  stroke: rgba(0, 0, 0, 0.3);
  stroke-linecap: var(--conn-line-cap, round);
  stroke-linejoin: var(--conn-line-join, round);
  pointer-events: none;
}

.conn-shell-path {
  fill: none;
  stroke: #ffffff;
  stroke-width: 18px;
  stroke-linecap: var(--conn-line-cap, round);
  stroke-linejoin: var(--conn-line-join, round);
  pointer-events: none;
}

.conn-visible-path {
  fill: none;
  stroke: var(--arrow-default);
  stroke-width: 12px;
  stroke-linecap: var(--conn-line-cap, round);
  stroke-linejoin: var(--conn-line-join, round);
  pointer-events: none;
}

/* Endpoint Drag Hit Circles (Bulletpoints) layered on top of the arrow */
.conn-endpoint-handle {
  fill: #ffffff;
  stroke: var(--accent-primary, #6366f1);
  stroke-width: 2.5px;
  pointer-events: all;
  cursor: grab;
  opacity: 0;
  transform-origin: center;
  transition: opacity 0.16s ease, transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), stroke-color 0.12s ease;
}

.conn-endpoint-handle:active,
.conn-group.is-dragging .conn-endpoint-handle {
  cursor: grabbing;
}

/* Display bulletpoints on hover of the arrow, or when selected/dragging */
.conn-group:hover .conn-endpoint-handle,
.conn-group.is-selected .conn-endpoint-handle,
.conn-group.is-dragging .conn-endpoint-handle {
  opacity: 1;
}

.conn-endpoint-handle:hover {
  stroke: #ffffff;
  fill: var(--accent-primary, #6366f1);
  filter: drop-shadow(0 0 3px rgba(99, 102, 241, 0.6));
}

/* Voice Note Callout Pointer Arrows */
.viewport.is-placing-voice-pointer,
.viewport.is-placing-voice-pointer .grid-node {
  cursor: crosshair;
}

.grid-node.is-pointer-target-hover {
  outline: 2px dashed #ef4444;
  outline-offset: 2px;
}

.conn-group.is-voice-pointer .conn-endpoint-start {
  display: none;
  pointer-events: none;
}

.conn-group.is-voice-pointer .conn-endpoint-end {
  stroke: #ef4444;
}

.conn-group.is-voice-pointer.is-source-active .conn-endpoint-end {
  opacity: 1;
}

.conn-group.is-voice-pointer .conn-endpoint-end:hover {
  stroke: #ffffff;
  fill: #ef4444;
  filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.65));
}

/* Live 2-Click Guide Arrow in Arrow Mode (`A`) */
.conn-guide-group {
  pointer-events: none;
}

.conn-draft-outline-path {
  fill: none;
  stroke: rgba(0, 0, 0, 0.3);
  stroke-linecap: var(--conn-line-cap, round);
  stroke-linejoin: var(--conn-line-join, round);
  pointer-events: none;
}

.conn-draft-shell-path {
  fill: none;
  stroke: #ffffff;
  stroke-width: 18px;
  stroke-linecap: var(--conn-line-cap, round);
  stroke-linejoin: var(--conn-line-join, round);
  pointer-events: none;
}

.conn-draft-path {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 12px;
  stroke-linecap: var(--conn-line-cap, round);
  pointer-events: none;
}

.conn-guide-start-dot,
.conn-guide-end-ring {
  display: none;
}

/* Midpoint Connection Label Pill */
.conn-label-pill {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  background: var(--bg-panel-solid);
  color: var(--text-primary);
  border: 1.5px solid var(--conn-accent, var(--arrow-default));
  border-radius: var(--node-radius);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: auto;
  cursor: grab;
  outline: none;
  translate: -50% -50%;
}

.conn-label-pill.has-label {
  display: inline-flex;
}

.conn-label-pill.is-selected {
  border-color: var(--accent-primary);
}

.conn-label-pill.is-editing {
  cursor: text;
  user-select: text;
  min-width: 54px;
  background: var(--bg-panel-solid);
  border-color: var(--accent-primary);
}

/* Arrow Tag Picker Popover (8 Architecture Boundary Tags + None + Custom Input) */
.arrow-tag-picker {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-ui-drawer, 100100);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 292px;
  padding: 8px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius, 0px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  font-family: var(--font-sans);
  color: var(--text-primary);
}

.arrow-tag-picker.is-hidden {
  display: none;
}

.arrow-tag-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.arrow-tag-custom-input {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius, 0px);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  outline: none;
}

.arrow-tag-custom-input:focus {
  background: var(--bg-panel-solid);
  border-color: var(--accent-primary);
}

.arrow-tag-apply-btn {
  padding: 5px 10px;
  background: var(--accent-primary);
  color: var(--accent-text, #ffffff);
  border: 1px solid transparent;
  border-radius: var(--panel-radius, 0px);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.arrow-tag-apply-btn:hover {
  opacity: 0.92;
}

.arrow-tag-divider {
  height: 1px;
  background: var(--border-subtle);
}

.arrow-tag-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 296px;
  overflow-y: auto;
}

.arrow-tag-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--panel-radius, 0px);
  color: var(--text-primary);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
}

.arrow-tag-option:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-subtle);
}

.arrow-tag-option.is-active {
  background: var(--accent-glow, rgba(37, 99, 235, 0.14));
  border-color: var(--accent-primary);
}

.arrow-tag-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.arrow-tag-option.is-none-option .arrow-tag-name {
  color: var(--text-secondary);
  font-weight: 600;
}

.arrow-tag-rel {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arrow-color-picker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--element-radius, 4px);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  box-sizing: border-box;
}

.drawing-color-picker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--element-radius, 4px);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  box-sizing: border-box;
}

.arrow-color-picker-btn:hover,
.drawing-color-picker-btn:hover {
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.1);
}

.arrow-color-swatch-dot,
.pen-color-swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-sizing: border-box;
}

/* ==========================================================================
   DRAWING LAYERS WINDOW & DRAWER (NO MARGIN, ZERO !IMPORTANT)
   ========================================================================== */

.drawing-layers-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--element-radius, 4px);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
}

.drawing-layers-btn .material-symbols-outlined {
  font-size: 18px;
}

.drawing-layers-btn:hover {
  background: var(--bg-panel-hover, rgba(255, 255, 255, 0.1));
  border-color: var(--accent-primary);
}

.drawing-layers-btn.is-active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.drawing-layers-count-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1;
  padding: 1px 3px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 3px;
}

.layers-drawer {
  position: absolute;
  top: calc(var(--viewport-edge-pad-top, 16px) + var(--panel-height, 34px) + 10px);
  right: var(--viewport-edge-pad-right, 16px);
  bottom: calc(var(--viewport-edge-pad-bottom, 16px) + var(--panel-height, 34px) + 10px);
  width: 310px;
  z-index: var(--z-ui-drawer, 100100);
  display: flex;
  flex-direction: column;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
  transform: translate3d(360px, 0, 0);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
  overflow: hidden;
}

.layers-drawer.is-open {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  pointer-events: auto;
}

.layers-drawer .drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 12px;
  box-sizing: border-box;
}

.layers-drawer .drawer-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}

.layers-drawer .drawer-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.layers-drawer #btn-add-layer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: auto;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--element-radius, 4px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  box-sizing: border-box;
}

.layers-drawer #btn-add-layer:hover {
  background: var(--bg-panel-hover, rgba(255, 255, 255, 0.12));
  border-color: var(--accent-primary);
}

.layers-drawer #btn-add-layer .material-symbols-outlined {
  font-size: 15px;
}

.layers-drawer #btn-close-layers-drawer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: var(--element-radius, 4px);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  box-sizing: border-box;
}

.layers-drawer #btn-close-layers-drawer:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.layers-drawer-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 12px;
  box-sizing: border-box;
}

.layers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layer-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--element-radius, 4px);
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
}

.layer-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.layer-card.is-active {
  background: rgba(37, 99, 235, 0.12);
  border-color: var(--accent-primary);
}

.layer-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.layer-card-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.layer-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.layer-title-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-title-input {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-panel-solid);
  border: 1px solid var(--accent-primary);
  border-radius: 3px;
  padding: 2px 4px;
  width: 100%;
  box-sizing: border-box;
}

.layer-tools-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.layer-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-secondary);
  cursor: pointer;
  box-sizing: border-box;
}

.layer-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.layer-icon-btn.is-active {
  color: var(--accent-primary);
}

.layer-icon-btn.is-muted {
  opacity: 0.4;
}

.layer-card-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.layer-opacity-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.layer-opacity-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.layer-opacity-slider {
  flex: 1;
  accent-color: var(--accent-primary);
  height: 4px;
}


.drawing-layer-selection-box {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  border: var(--bounding-box-width, 2px) solid var(--bounding-box-color, var(--accent-primary));
  border-radius: 0;
  box-sizing: border-box;
  z-index: calc(var(--z-drawings, 95000) + 2);
  display: none;
}

.drawing-layer-selection-box.is-visible {
  display: block;
}

.drawing-layer-selection-handle {
  position: absolute;
  width: var(--handle-size, 10px);
  height: var(--handle-size, 10px);
  background: var(--handle-bg, #ffffff);
  border: var(--handle-border-width, 2px) solid var(--bounding-box-color, var(--accent-primary));
  border-radius: 0;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
}

.drawing-layer-selection-handle.handle-nw { top: 0; left: 0; }
.drawing-layer-selection-handle.handle-ne { top: 0; left: 100%; }
.drawing-layer-selection-handle.handle-sw { top: 100%; left: 0; }
.drawing-layer-selection-handle.handle-se { top: 100%; left: 100%; }

/* Brush-mode dynamic zoom (Shift + Space + drag) */
.viewport.is-dynamic-zoom,
.viewport.is-dynamic-zoom.is-space-ready {
  cursor: zoom-in;
}

body.is-mobile-constrained[data-grid-overview-lod="true"] .connections-labels-layer,
body.is-mobile-constrained[data-grid-overview-lod="true"] .conn-endpoint-circle {
  visibility: hidden;
}

/* ==========================================================================
   ILLUSTRATOR / PHOTOSHOP PEN PATH ARROW OVERLAY & FOOTER TIER
   ========================================================================== */

.arrow-options-tier {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: auto;
}

.arrow-options-tier.is-hidden {
  display: none;
}

.arrow-submode-btn.is-active,
.arrow-dashed-btn.is-active {
  background: var(--bg-surface-hover, #f8fafc);
  border-color: var(--accent-primary, #3b82f6);
  color: var(--text-primary, #0f172a);
}

.conn-group.is-path-arrow .conn-endpoint-handle {
  display: none;
}

.conn-pen-overlay-group {
  pointer-events: none;
}

.pen-guide-spine {
  fill: none;
  stroke: var(--accent-primary, #3b82f6);
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
  pointer-events: none;
}

.pen-handle-arm {
  stroke: var(--accent-primary, #3b82f6);
  opacity: 0.85;
  pointer-events: none;
}

.pen-handle-knob {
  fill: var(--accent-primary, #3b82f6);
  stroke: #ffffff;
  pointer-events: none;
}

.pen-handle-group.is-subtle .pen-handle-arm {
  opacity: 0.45;
}

.pen-handle-group.is-subtle .pen-handle-knob {
  fill: #ffffff;
  stroke: var(--accent-primary, #3b82f6);
  opacity: 0.78;
}

.pen-stub-arm {
  stroke: var(--accent-primary, #3b82f6);
  opacity: 0.55;
  pointer-events: none;
}

.pen-stub-knob {
  fill: #ffffff;
  stroke: var(--accent-primary, #3b82f6);
  opacity: 0.85;
  pointer-events: none;
}

.pen-anchor-sq {
  fill: #ffffff;
  stroke: var(--accent-primary, #3b82f6);
  pointer-events: none;
}

.pen-anchor-sq.is-selected {
  fill: var(--accent-primary, #3b82f6);
  stroke: #ffffff;
}

.pen-anchor-sq.is-retract-hover {
  fill: #f59e0b;
  stroke: #ffffff;
}

.pen-hit-target {
  fill: transparent;
  stroke: none;
  pointer-events: all;
  cursor: move;
}

.pen-handle-hit {
  cursor: grab;
}

.pen-handle-hit:active {
  cursor: grabbing;
}

.pen-insert-preview-dot {
  fill: #ffffff;
  stroke: var(--accent-primary, #3b82f6);
  pointer-events: none;
}

body.is-pen-dragging-handle,
body.is-pen-dragging-handle .viewport,
body.is-pen-dragging-handle .viewport.is-arrow-tool,
body.is-pen-dragging-handle .viewport .grid-node,
body.is-pen-dragging-handle .pen-hit-target,
body.is-pen-dragging-handle .pen-handle-hit,
body.is-pen-dragging-handle .conn-hit-path {
  cursor: grabbing;
}

body.is-pen-dragging-anchor,
body.is-pen-dragging-anchor .viewport,
body.is-pen-dragging-anchor .viewport.is-arrow-tool,
body.is-pen-dragging-anchor .viewport .grid-node,
body.is-pen-dragging-anchor .pen-hit-target,
body.is-pen-dragging-anchor .pen-handle-hit,
body.is-pen-dragging-anchor .conn-hit-path {
  cursor: move;
}

}

/* === 08-nodes-audio-shape.css (nodes) === */
@layer nodes {
/* ==========================================================================
   AUDIO CARD / SOUND RECORDER NODE (type === 'audio')
   ========================================================================== */
.grid-node.node-type-audio {
  display: flex;
  flex-direction: column;
  background: var(--node-surface);
  border-width: var(--element-border-width);
  border-style: var(--element-border-style);
  border-color: var(--element-border-color);
  border-radius: var(--element-radius);
  box-shadow: none;
  overflow: visible;
  user-select: none;
}

.grid-node.node-type-audio.is-selected {
  border-color: var(--bounding-box-color);
  box-shadow: none;
}

.audio-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 2px 12px;
  background: transparent;
  border-bottom: none;
}

.audio-mic-icon {
  font-size: 16px;
  color: #ef4444;
}

.audio-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.audio-duration-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.audio-pointer-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  background: rgba(128, 128, 128, 0.1);
  color: var(--text-secondary);
  cursor: crosshair;
  pointer-events: auto;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.audio-pointer-handle .material-symbols-outlined {
  font-size: 14px;
  pointer-events: none;
}

.audio-pointer-handle:hover,
.audio-pointer-handle.is-active {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.65);
  color: #ef4444;
}

.audio-pointer-handle:active {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

.grid-node.node-type-audio.is-locked .audio-pointer-handle,
.grid-node.node-type-audio[data-parent-locked="true"] .audio-pointer-handle {
  opacity: 0.35;
  pointer-events: none;
}

.audio-studio-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-height: 0;
  padding: 4px 12px 10px 12px;
  background: transparent;
  border-bottom-left-radius: var(--node-radius);
  border-bottom-right-radius: var(--node-radius);
}

.audio-studio-body .is-hidden {
  display: none;
}

.audio-state-record {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 0 0;
}

.audio-action-btn.btn-retry-record-save,
.audio-action-btn.btn-download-record-backup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.audio-action-btn.btn-retry-record-save {
  border: 1px solid rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.14);
  color: #a5b4fc;
}

.audio-action-btn.btn-retry-record-save:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.8);
  color: #ffffff;
}

.audio-action-btn.btn-download-record-backup {
  border: 1px solid rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.audio-action-btn.btn-download-record-backup:hover {
  background: rgba(16, 185, 129, 0.24);
  border-color: rgba(16, 185, 129, 0.75);
  color: #ffffff;
}

.audio-action-btn.btn-retry-record-save .material-symbols-outlined,
.audio-action-btn.btn-download-record-backup .material-symbols-outlined {
  font-size: 14px;
}

.audio-studio-body .audio-action-btn.is-hidden {
  display: none;
}

.audio-action-btn.btn-start-record {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 0;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.audio-action-btn.btn-start-record:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.7);
  transform: translateY(-1px);
}

.audio-record-dot {
  font-size: 13px;
  color: #ef4444;
}

.audio-state-live {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0 0 0;
}

.audio-live-hud {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #ef4444;
}

.rec-dot-pulsing {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: recPulseAnim 1s infinite alternate ease-in-out;
}

@keyframes recPulseAnim {
  0% { transform: scale(0.85); opacity: 0.6; }
  100% { transform: scale(1.25); opacity: 1; }
}

.audio-rec-wave-anim {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.audio-rec-wave-anim span {
  width: 3px;
  height: 100%;
  background: #ef4444;
  border-radius: 0;
  animation: waveBarBounce 0.8s infinite ease-in-out alternate;
}

.audio-rec-wave-anim span:nth-child(2) { animation-delay: 0.15s; }
.audio-rec-wave-anim span:nth-child(3) { animation-delay: 0.3s; }
.audio-rec-wave-anim span:nth-child(4) { animation-delay: 0.45s; }
.audio-rec-wave-anim span:nth-child(5) { animation-delay: 0.2s; }
.audio-rec-wave-anim span:nth-child(6) { animation-delay: 0.35s; }
.audio-rec-wave-anim span:nth-child(7) { animation-delay: 0.1s; }
.audio-rec-wave-anim span:nth-child(8) { animation-delay: 0.25s; }

@keyframes waveBarBounce {
  0% { height: 4px; }
  100% { height: 16px; }
}

.audio-action-btn.btn-stop-record {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 0;
  border: 1px solid #ef4444;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.audio-action-btn.btn-stop-record:hover {
  background: #dc2626;
}

.audio-action-btn.btn-stop-record .material-symbols-outlined {
  font-size: 15px;
}

.audio-state-player {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audio-player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-playback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 0;
  border: 1px solid var(--border-subtle);
  background: rgba(128, 128, 128, 0.1);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.audio-playback-btn:hover {
  background: var(--accent-primary, #6366f1);
  border-color: var(--accent-primary, #6366f1);
  color: #ffffff;
}

.audio-playback-btn .material-symbols-outlined {
  font-size: 16px;
}

.audio-playback-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  display: block;
  shape-rendering: geometricPrecision;
}

.audio-playback-btn.is-busy-btn {
  opacity: 0.5;
  pointer-events: none;
}

.audio-playback-btn.is-copied-btn {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.45);
}

.audio-playback-btn.is-error-btn {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.45);
}

.audio-time-readout {
  font-size: 11px;
  color: var(--text-secondary);
  flex: 1;
}

.btn-audio-rerecord {
  border-radius: 0;
  width: 24px;
  height: 24px;
}

.btn-audio-rerecord:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
}

.audio-scrubber-track {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(128, 128, 128, 0.2);
  border-radius: 0;
  cursor: pointer;
}

.audio-scrubber-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent-primary, #6366f1);
  border-radius: 0;
  pointer-events: none;
}

.audio-scrubber-handle {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.audio-scrubber-track:hover .audio-scrubber-handle {
  opacity: 1;
}

@keyframes audioSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.audio-spinning {
  display: inline-block;
  animation: audioSpin 0.9s infinite linear;
}

.audio-playback-btn:disabled,
.audio-action-btn:disabled {
  opacity: 0.55;
  cursor: wait;
  pointer-events: none;
}

/* ==========================================================================
   SQUARE & RECTANGLE SHAPE NODES (type === 'shape')
   ========================================================================== */
.grid-node.node-type-shape {
  display: flex;
  flex-direction: column;
  position: absolute;
  box-sizing: border-box;
  background-color: var(--node-bg, var(--shape-fill, #6366f1));
  border: var(--node-border, var(--shape-border-width, 0px) var(--shape-border-style, solid) var(--shape-border-color, transparent));
  border-radius: var(--node-radius, var(--shape-radius, 0px));
  overflow: visible;
  user-select: none;
  cursor: grab;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.grid-node.node-type-shape.is-selected {
  border: var(--node-border, var(--shape-border-width, 0px) var(--shape-border-style, solid) var(--shape-border-color, transparent));
  box-shadow: none;
}

.grid-node.node-type-shape.is-selected.is-editing {
  outline: 1.5px solid var(--bounding-box-color, var(--accent-primary));
  outline-offset: -1px;
}

/* Floating Quick Action Bar (Top of Shape when Selected & in Editing Mode) */
.shape-floating-bar {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #181b22);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 0;
  box-shadow: none;
  z-index: var(--z-node-toolbar, 200);
  pointer-events: auto;
  white-space: nowrap;
}

.grid-node.node-type-shape.is-selected.is-editing .shape-floating-bar {
  display: flex;
}

.grid-node.node-type-shape.has-purpose.is-editing .shape-floating-bar,
.grid-node.node-type-shape.has-step-number.is-editing .shape-floating-bar {
  top: -68px;
}

.grid-node.node-type-shape.has-purpose.has-step-number.is-editing .shape-floating-bar {
  top: -96px;
}

.grid-node.node-type-shape .node-purpose-badge {
  cursor: pointer;
}

.shape-swatch-list {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.shape-swatch-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.shape-swatch-btn[data-color="#ffffff" i] {
  border: 1px solid #d1d5db;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.shape-swatch-btn:hover {
  transform: scale(1.25);
  border-color: #ffffff;
}

.shape-swatch-btn[data-color="#ffffff" i]:hover {
  border-color: #9ca3af;
}

.shape-swatch-btn.is-active {
  border-color: #ffffff;
  box-shadow: 0 0 0 1.5px var(--accent-primary, #6366f1);
}

.shape-swatch-btn[data-color="#ffffff" i].is-active {
  border-color: #d1d5db;
  box-shadow: 0 0 0 1.5px var(--accent-primary, #6366f1);
}

.shape-floating-divider {
  width: 1px;
  height: 14px;
  background: var(--border-subtle, rgba(255, 255, 255, 0.15));
  flex-shrink: 0;
}

.shape-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary, #9ca3af);
  cursor: pointer;
  transition: all 0.12s ease;
}

.shape-action-btn:hover {
  background: var(--bg-panel-hover, rgba(255, 255, 255, 0.08));
  color: var(--text-primary, #ffffff);
}

.shape-action-btn .material-symbols-outlined {
  font-size: 15px;
}

.shape-color-picker-label {
  position: relative;
  overflow: hidden;
}

.shape-color-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  cursor: pointer;
}

/* ==========================================================================
   BACKGROUND VOICE RECORDER LIVE HUD & DOCK INDICATOR (* SHORTCUT)
   Zero !important, Zero margin, Zero backdrop-filter
   ========================================================================== */
#btn-add-audio.is-recording {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

#btn-add-audio.is-recording .material-symbols-outlined { color: #ffffff; }

.voice-recorder-hud {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-panel-solid, #181b22);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: var(--panel-radius, 10px);
  color: var(--text-primary, #f3f4f6);
  pointer-events: auto;
  user-select: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.voice-recorder-hud.is-hidden,
body.is-logged-off .voice-recorder-hud { display: none; }

.voice-rec-indicator { display: inline-flex; align-items: center; gap: 6px; }

.voice-rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: recPulseAnim 0.9s infinite alternate ease-in-out;
}

.voice-rec-badge { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: #ef4444; }

.voice-rec-meter { display: flex; align-items: center; gap: 3px; height: 20px; padding: 0 2px; }

.voice-rec-bar {
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: rgba(239, 68, 68, 0.45);
  transition: height 0.08s ease-out, background-color 0.2s ease;
}

.voice-recorder-hud.is-speaking .voice-rec-bar { background: #ef4444; }

.voice-rec-readout { display: flex; flex-direction: column; gap: 1px; min-width: 84px; }
.voice-rec-clock { font-size: 13px; font-weight: 700; line-height: 1.1; color: var(--text-primary, #f3f4f6); }
.voice-rec-state-label { font-size: 10px; font-weight: 600; letter-spacing: 0.03em; line-height: 1.1; color: var(--text-muted, #9ca3af); transition: color 0.25s ease; }
.voice-recorder-hud.is-speaking .voice-rec-state-label { color: #10b981; }

.voice-rec-actions { display: inline-flex; align-items: center; gap: 6px; }

.voice-rec-stop-btn,
.voice-rec-discard-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  border-radius: var(--panel-radius, 8px);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.voice-rec-stop-btn { padding: 0 9px; background: #ef4444; border: 1px solid #ef4444; color: #ffffff; }
.voice-rec-stop-btn:hover { background: #dc2626; border-color: #dc2626; }

.voice-rec-stop-btn .material-symbols-outlined,
.voice-rec-discard-btn .material-symbols-outlined { font-size: 15px; }

.voice-rec-kbd { padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); font-size: 11px; line-height: 1.2; }

.voice-rec-discard-btn {
  width: 28px;
  padding: 0;
  background: var(--bg-panel-hover, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  color: var(--text-secondary, #9ca3af);
}

.voice-rec-discard-btn:hover { color: #ef4444; border-color: rgba(239, 68, 68, 0.45); }

/* Draggable Floating Voice Recorder Quick Trigger Widget (* Shortcut) */
.floating-voice-widget {
  position: fixed;
  top: 126px;
  right: 24px;
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  touch-action: none;
}

body.is-logged-off .floating-voice-widget,
body.is-logged-off #floating-voice-widget {
  display: none;
}

.floating-voice-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  box-sizing: border-box;
  background: #ffffff;
  border: 1.5px solid var(--border-subtle, #e2e8f0);
  border-radius: 50%;
  color: #1f1f1f;
  box-shadow: none;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.floating-voice-trigger:active,
.floating-voice-widget.is-dragging .floating-voice-trigger {
  cursor: grabbing;
}

.floating-voice-widget.is-recording .floating-voice-trigger,
.floating-voice-trigger.is-recording {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.22);
}

.floating-voice-trigger-icon {
  width: 21px;
  height: 21px;
  display: block;
  pointer-events: none;
}

}

/* === 09-nodes-purpose.css (nodes) === */
@layer nodes {
/* ==========================================================================
   CONTAINER PURPOSE & INTENT BADGES (Question, Idea, Warning, Task)
   ========================================================================== */
.node-purpose-badge {
  position: absolute;
  bottom: 100%;
  left: calc(-1 * var(--bounding-box-width, 2px));
  right: calc(-1 * var(--bounding-box-width, 2px));
  z-index: var(--z-node-badge, 25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px calc(12px + var(--bounding-box-width, 2px));
  box-sizing: border-box;
  border-radius: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  user-select: none;
  cursor: default;
  pointer-events: none;
  box-shadow: none;
  line-height: 1;
}

.node-purpose-badge .material-symbols-outlined {
  font-size: 15px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.node-purpose-badge .purpose-badge-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-purpose-badge.purpose-question {
  background: #f59e0b;
  color: #0f172a;
  box-shadow: none;
}

.node-purpose-badge.purpose-answer {
  background: #0d9488;
  color: #ffffff;
  box-shadow: none;
}

.node-purpose-badge.purpose-idea {
  background: #10b981;
  color: #0f172a;
  box-shadow: none;
}

.node-purpose-badge.purpose-warning {
  background: #ef4444;
  color: #ffffff;
  box-shadow: none;
}

.node-purpose-badge.purpose-task {
  background: #0284c7;
  color: #ffffff;
  box-shadow: none;
}

.node-purpose-badge.purpose-bug {
  background: #e11d48;
  color: #ffffff;
  box-shadow: none;
}

.node-purpose-badge.purpose-marketing {
  background: #8b5cf6;
  color: #ffffff;
  box-shadow: none;
}

.node-purpose-badge.purpose-video {
  background: #ec4899;
  color: #ffffff;
  box-shadow: none;
}

.node-purpose-badge.purpose-photography {
  background: #0891b2;
  color: #ffffff;
  box-shadow: none;
}

.node-purpose-badge.purpose-levelup {
  background: #f97316;
  color: #ffffff;
  box-shadow: none;
}

/* Container accent border and header styling when purpose tag is assigned */
.grid-node.has-purpose {
  --tag-header-text: #ffffff;
  border-width: var(--bounding-box-width);
  border-style: solid;
  box-shadow: none;
}

.grid-node.has-purpose.purpose-question {
  --tag-color: #f59e0b;
  --tag-header-text: #0f172a;
  border-color: var(--tag-color);
  box-shadow: none;
}

.grid-node.has-purpose.purpose-answer {
  --tag-color: #0d9488;
  --tag-header-text: #ffffff;
  border-color: var(--tag-color);
  box-shadow: none;
}

.grid-node.has-purpose.purpose-idea {
  --tag-color: #10b981;
  --tag-header-text: #ffffff;
  border-color: var(--tag-color);
  box-shadow: none;
}

.grid-node.has-purpose.purpose-warning {
  --tag-color: #ef4444;
  --tag-header-text: #ffffff;
  border-color: var(--tag-color);
  box-shadow: none;
}

.grid-node.has-purpose.purpose-task {
  --tag-color: #0284c7;
  --tag-header-text: #ffffff;
  border-color: var(--tag-color);
  box-shadow: none;
}

.grid-node.has-purpose.purpose-bug {
  --tag-color: #e11d48;
  --tag-header-text: #ffffff;
  border-color: var(--tag-color);
  box-shadow: none;
}

.grid-node.has-purpose.purpose-marketing {
  --tag-color: #8b5cf6;
  --tag-header-text: #ffffff;
  border-color: var(--tag-color);
  box-shadow: none;
}

.grid-node.has-purpose.purpose-video {
  --tag-color: #ec4899;
  --tag-header-text: #ffffff;
  border-color: var(--tag-color);
  box-shadow: none;
}

.grid-node.has-purpose.purpose-photography {
  --tag-color: #0891b2;
  --tag-header-text: #ffffff;
  border-color: var(--tag-color);
  box-shadow: none;
}

.grid-node.has-purpose.purpose-levelup {
  --tag-color: #f97316;
  --tag-header-text: #ffffff;
  border-color: var(--tag-color);
  box-shadow: none;
}

/* For Text Cards: Original header becomes the tag header */
.grid-node.node-type-card.has-purpose .node-header {
  background: var(--tag-color);
  border-bottom-color: rgba(0, 0, 0, 0.15);
  color: var(--tag-header-text);
}

.grid-node.node-type-card.has-purpose .node-title {
  color: var(--tag-header-text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.grid-node.node-type-card.has-purpose .node-header-btn {
  color: var(--tag-header-text);
}

.grid-node.node-type-card.has-purpose .node-header-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--tag-header-text);
}

.grid-node.node-type-card.has-purpose .btn-dictate-lang {
  color: var(--tag-header-text);
  border: none;
  opacity: 0.85;
}

.grid-node.node-type-card.has-purpose .btn-dictate-lang:hover {
  background: rgba(255, 255, 255, 0.2);
  opacity: 1;
}

.grid-node.node-type-card .node-purpose-badge {
  display: none;
}

/* Tagged Container Selected State: Bounding Box & Handles match the Tag Color */
.grid-node.has-purpose.is-selected,
.grid-node.node-type-shape.has-purpose.is-selected {
  --bounding-box-color: var(--tag-color);
  border-color: var(--tag-color);
  border-width: var(--bounding-box-width);
  box-shadow: none;
}

/* Purpose Selector Flyout & Action Buttons */
.purpose-selector-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.node-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted, #9ca3af);
  cursor: pointer;
  transition: none;
}

.node-header-btn:hover {
  background: var(--bg-panel-hover, rgba(255, 255, 255, 0.08));
  color: var(--text-primary, #ffffff);
}

.node-header-btn .material-symbols-outlined {
  font-size: 15px;
}

.purpose-dropdown-flyout {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: var(--z-node-flyout, 500);
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #181b22);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  min-width: 120px;
}

.purpose-dropdown-flyout.is-open {
  display: flex;
}

.purpose-option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary, #9ca3af);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.1s ease;
}

.purpose-option-btn:hover {
  background: var(--bg-panel-hover, rgba(255, 255, 255, 0.08));
  color: var(--text-primary, #ffffff);
}

.purpose-option-btn.is-active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary, #6366f1);
  font-weight: 600;
}

.purpose-option-btn .material-symbols-outlined {
  font-size: 15px;
}

.purpose-option-btn[data-purpose="question"] .material-symbols-outlined {
  color: #f59e0b;
}

.purpose-option-btn[data-purpose="answer"] .material-symbols-outlined {
  color: #0d9488;
}

.purpose-option-btn[data-purpose="idea"] .material-symbols-outlined {
  color: #10b981;
}

.purpose-option-btn[data-purpose="warning"] .material-symbols-outlined {
  color: #ef4444;
}

.purpose-option-btn[data-purpose="task"] .material-symbols-outlined {
  color: #0284c7;
}

.purpose-option-btn[data-purpose="bug"] .material-symbols-outlined {
  color: #e11d48;
}

.purpose-option-btn[data-purpose="marketing"] .material-symbols-outlined {
  color: #8b5cf6;
}

.purpose-option-btn[data-purpose="video"] .material-symbols-outlined {
  color: #ec4899;
}

.purpose-option-btn[data-purpose="photography"] .material-symbols-outlined {
  color: #0891b2;
}

.purpose-option-btn[data-purpose="levelup"] .material-symbols-outlined {
  color: #f97316;
}

.purpose-option-btn[data-purpose="ignored"] .purpose-ignore-svg {
  color: #ef4444;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ==========================================================================
   RULED-OUT / IGNORED "X" TAG & OVERLAY (.grid-node.is-ignored)
   ========================================================================== */
.grid-node.is-ignored > .node-body,
.grid-node.is-ignored > .node-media-wrapper,
.grid-node.is-ignored > .audio-card-shell,
.grid-node.is-ignored > .textbox-body,
.grid-node.node-type-shape.is-ignored {
  filter: grayscale(0.45);
  transition: filter 0.15s ease;
}

.grid-node.is-ignored.is-peek-ignored > .node-body,
.grid-node.is-ignored.is-peek-ignored > .node-media-wrapper,
.grid-node.is-ignored.is-peek-ignored > .audio-card-shell,
.grid-node.is-ignored.is-peek-ignored > .textbox-body,
.grid-node.node-type-shape.is-ignored.is-peek-ignored {
  filter: none;
}

.grid-node.is-ignored.is-peek-ignored > .node-ignored-overlay,
.grid-node.is-ignored.is-peek-ignored > .node-ignored-tag {
  opacity: 0;
  pointer-events: none;
}

.node-ignored-overlay {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: inherit;
  transition: opacity 0.12s ease;
  background:
    linear-gradient(
      to top right,
      transparent calc(50% - 1.5px),
      rgba(239, 68, 68, 0.72) calc(50% - 1.5px),
      rgba(239, 68, 68, 0.72) calc(50% + 1.5px),
      transparent calc(50% + 1.5px)
    ),
    linear-gradient(
      to bottom right,
      transparent calc(50% - 1.5px),
      rgba(239, 68, 68, 0.72) calc(50% - 1.5px),
      rgba(239, 68, 68, 0.72) calc(50% + 1.5px),
      transparent calc(50% + 1.5px)
    ),
    rgba(0, 0, 0, 0.8);
}

.node-ignored-center-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(44px, 38%, 112px);
  height: clamp(44px, 38%, 112px);
  aspect-ratio: 1 / 1;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.92);
  border: 2px solid #ef4444;
  color: #ef4444;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.node-ignored-center-mark svg {
  width: 68%;
  height: 68%;
  fill: currentColor;
}

.node-ignored-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 32;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 5px;
  box-sizing: border-box;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #e11d48;
  color: #ffffff;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.35);
  transition: transform 0.12s ease, background 0.12s ease;
}

.grid-node.node-type-card.is-ignored > .node-ignored-tag,
.grid-node.node-type-frame.is-ignored > .node-ignored-tag {
  top: auto;
  bottom: 8px;
  left: 8px;
}

.node-ignored-tag:hover {
  background: #be123c;
  transform: scale(1.04);
}

.node-ignored-tag svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

#btn-node-ignore.is-active {
  background: rgba(225, 29, 72, 0.16);
  border-color: rgba(225, 29, 72, 0.45);
  color: #e11d48;
}

/* Client Question Tracker HUD Pill */
.hud-question-pill {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-weight: 600;
  transition: all 0.15s ease;
}

.hud-question-pill:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fbbf24;
}

.hud-question-pill .question-icon {
  font-size: 15px;
  color: #f59e0b;
}

}

/* === 13-nodes-timer.css (nodes) === */
@layer nodes {
/* ==========================================================================
   TIMER & CHRONO TRACKER NODE (type === 'timer')
   ========================================================================== */
.grid-node.node-type-timer {
  display: flex;
  flex-direction: column;
  background: var(--node-surface, #ffffff);
  border-width: var(--element-border-width, 1px);
  border-style: var(--element-border-style, solid);
  border-color: var(--element-border-color, #e5e7eb);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  user-select: none;
  box-sizing: border-box;
  width: 336px;
  height: 168px;
  min-width: 336px;
  max-width: 336px;
  min-height: 168px;
  max-height: 168px;
}

.grid-node.node-type-timer .resize-handle,
.grid-node.node-type-timer .node-resize-handles {
  display: none;
  pointer-events: none;
}

.grid-node.node-type-timer.is-selected {
  border-color: var(--bounding-box-color, #2563eb);
  box-shadow: none;
}

.timer-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: transparent;
  border-bottom: 1px solid var(--border-subtle, #f3f4f6);
  box-sizing: border-box;
  gap: 8px;
  flex-shrink: 0;
}

.timer-stopwatch-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary, #111827);
  font-size: 16px;
}

.timer-card-header .node-title.timer-title,
.timer-card-header .node-title.timer-title[contenteditable="true"],
.timer-card-header .node-title.timer-title:focus,
.timer-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  outline: none;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  cursor: inherit;
  user-select: none;
  padding: 1px 2px;
}

.grid-node.is-editing .timer-title,
.timer-title[contenteditable="true"] {
  cursor: text;
  user-select: text;
}

.timer-header-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.timer-date-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 8px;
  gap: 4px;
  background: rgba(128, 128, 128, 0.08);
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 0;
  box-sizing: border-box;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary, #4b5563);
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.timer-date-chip:hover {
  background: rgba(128, 128, 128, 0.16);
  border-color: var(--border-medium, #d1d5db);
  color: var(--text-primary, #111827);
}

.timer-date-icon {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
}

.timer-date-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.timer-card-body {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  padding: 0 12px;
  background: transparent;
  box-sizing: border-box;
}

.timer-readout-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
}

.timer-primary-readout {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary, #111827);
  line-height: 1;
  text-align: center;
}

.timer-readout-divider {
  width: 1px;
  height: 16px;
  background: var(--border-subtle, #e5e7eb);
  flex-shrink: 0;
}

.timer-days-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  gap: 4px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-sizing: border-box;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #4b5563);
  letter-spacing: -0.01em;
  line-height: 1;
  transition: color 0.14s ease;
}

.timer-days-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: inherit;
  flex-shrink: 0;
}

.timer-days-badge.has-days {
  color: var(--accent-primary, #2563eb);
}

/* Billing & Hourly Rate Footer */
.timer-card-footer.timer-billing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: transparent;
  border-top: 1px solid var(--border-subtle, #f3f4f6);
  border-bottom: none;
  border-left: none;
  border-right: none;
  box-sizing: border-box;
  gap: 8px;
  flex-shrink: 0;
}

.timer-price-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.timer-price-val {
  font-size: 13px;
  font-weight: 700;
  color: #10b981;
  letter-spacing: -0.01em;
}

.timer-rate-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 6px;
  gap: 4px;
  background: rgba(128, 128, 128, 0.08);
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 0;
  box-sizing: border-box;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary, #4b5563);
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.timer-rate-wrap:hover {
  background: rgba(128, 128, 128, 0.16);
  border-color: var(--border-medium, #d1d5db);
  color: var(--text-primary, #111827);
}

.timer-rate-wrap.is-rate-linked {
  background: rgba(16, 185, 129, 0.10);
  border-color: rgba(16, 185, 129, 0.35);
}

.btn-timer-rate-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-timer-rate-source:hover {
  color: var(--accent-primary, #2563eb);
  background: rgba(128, 128, 128, 0.14);
}

.btn-timer-rate-source.is-linked {
  color: #10b981;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.35);
}

.timer-rate-input[readonly] {
  background: transparent;
  border-color: transparent;
  color: #10b981;
  cursor: default;
}

.timer-rate-label {
  color: var(--text-muted, #6b7280);
}

.timer-currency-symbol {
  color: var(--text-secondary, #4b5563);
  font-weight: 600;
}

.timer-rate-input {
  width: 44px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 0;
  background: var(--bg-surface, #ffffff);
  color: var(--text-primary, #111827);
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  outline: none;
  box-sizing: border-box;
  line-height: 18px;
}

.timer-rate-input:focus {
  border-color: var(--accent-primary, #6366f1);
  background: var(--bg-surface, #ffffff);
}

.timer-rate-unit {
  color: var(--text-muted, #6b7280);
}

/* Controls in Footer Center */
.timer-controls-center {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.timer-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 0;
  border: 1px solid var(--border-subtle, #e5e7eb);
  background: rgba(128, 128, 128, 0.08);
  color: var(--text-primary, #111827);
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.timer-ctrl-btn:hover {
  background: var(--accent-primary, #2563eb);
  border-color: var(--accent-primary, #2563eb);
  color: #ffffff;
}

.timer-ctrl-btn.is-active,
.is-timer-running .btn-timer-play,
.timer-ctrl-btn.btn-timer-play.is-active,
.timer-ctrl-btn.btn-timer-pause.is-active {
  background: var(--accent-primary, #2563eb);
  border-color: var(--accent-primary, #2563eb);
  color: #ffffff;
}

.timer-ctrl-btn .material-symbols-outlined {
  font-size: 15px;
}

.timer-header-right .btn-timer-lock {
  color: var(--text-muted, #6b7280);
}

.timer-header-right .btn-timer-lock .material-symbols-outlined {
  font-size: 14px;
}

.timer-header-right .btn-timer-lock:hover,
.timer-header-right .btn-timer-lock.is-locked {
  background: var(--accent-primary, #6366f1);
  border-color: var(--accent-primary, #6366f1);
  color: #ffffff;
}

/* ==========================================================================
   PROJECT CLOCKS & TIMESHEET AGGREGATOR (Modal Popup Browser)
   ========================================================================== */
.project-clocks-bar {
  position: fixed;
  inset: 0;
  z-index: var(--z-ui-modal, 100200);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.42);
  user-select: none;
}

.project-clocks-bar.is-hidden,
body.is-logged-off #project-clocks-bar,
body.is-project-space-mode #project-clocks-bar {
  display: none;
}

.project-clocks-modal-card {
  width: min(460px, 100%);
  max-height: min(560px, 84vh);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  color: var(--text-primary);
  overflow: hidden;
}

.project-clocks-modal-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-clocks-pill {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--panel-height, 40px);
  padding: 0 12px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.project-clocks-pill:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-focus);
}

.project-clocks-pill.is-active {
  border-color: var(--accent-primary);
  box-shadow: none;
}

.project-clocks-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--panel-height, 40px);
  height: var(--panel-height, 40px);
  padding: 0;
  box-sizing: border-box;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.project-clocks-close-btn:hover {
  background: var(--bg-panel-solid, #ffffff);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.project-clocks-close-btn .material-symbols-outlined {
  font-size: 18px;
}

.clocks-pill-icon {
  font-size: 18px;
  color: var(--accent-primary);
}

.clocks-pill-count {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
}

.clocks-pill-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.clocks-pill-cost {
  color: #10b981;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

.clocks-chevron {
  margin-left: auto;
  font-size: 18px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.project-clocks-pill.is-active .clocks-chevron {
  transform: rotate(180deg);
}

.project-clocks-dropdown {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.project-clocks-dropdown.is-hidden {
  display: none;
}

.clocks-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  box-sizing: border-box;
  background: var(--bg-panel-hover);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.clocks-dropdown-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
}

.clocks-dropdown-title .material-symbols-outlined {
  font-size: 16px;
  color: var(--accent-primary);
}

.clocks-dropdown-total {
  font-size: 12px;
  font-weight: 700;
  color: #10b981;
}

.project-clocks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  box-sizing: border-box;
  overflow-y: auto;
  max-height: 380px;
}

.clocks-date-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  padding: 6px 8px;
  box-sizing: border-box;
}

/* Aligned 3-Column Timesheet Layout */
.clocks-date-header,
.clocks-item-row,
.clocks-subtotal-bar {
  display: grid;
  grid-template-columns: 1fr 72px 72px;
  align-items: center;
  column-gap: 10px;
  box-sizing: border-box;
}

.clocks-date-header {
  padding: 8px 10px;
  background: var(--bg-panel-solid);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.clocks-item-row {
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--panel-radius);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  color: inherit;
  font-family: inherit;
}

.clocks-item-row:hover {
  background: var(--bg-panel-solid);
  border-color: var(--border-subtle);
}

.clocks-row-col-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.clocks-row-col-title .clocks-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: none;
}

.clocks-row-col-title .clocks-date-icon {
  font-size: 15px;
  color: var(--text-muted);
}

.clocks-row-col-title .clocks-item-status {
  font-size: 15px;
  color: var(--text-muted);
}

.clocks-row-col-title .clocks-item-status.is-running {
  color: #10b981;
}

.clocks-row-col-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
}

.clocks-row-col-price {
  font-size: 12px;
  font-weight: 700;
  color: #10b981;
  text-align: right;
  white-space: nowrap;
}

.clocks-subtotal-bar {
  padding: 10px;
  background: var(--bg-panel-hover);
  border-top: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.clocks-subtotal-icon {
  font-size: 16px;
  color: var(--accent-primary);
}

.clocks-subtotal-label {
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text-primary);
}

.clocks-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   EDIT-MODE GUARD & HARD LOCK ISOLATION
   ========================================================================== */
.grid-node.node-type-timer:not(.is-editing):not(.is-ghost-active) .timer-card-header button,
.grid-node.node-type-timer:not(.is-editing):not(.is-ghost-active) .timer-date-chip,
.grid-node.node-type-timer:not(.is-editing):not(.is-ghost-active) .timer-rate-wrap,
.grid-node.node-type-timer:not(.is-editing):not(.is-ghost-active) .btn-timer-rate-source,
.grid-node.node-type-timer:not(.is-editing):not(.is-ghost-active) .timer-rate-input,
.grid-node.node-type-timer:not(.is-editing):not(.is-ghost-active) .timer-ctrl-btn {
  pointer-events: none;
  transition: none;
}

.grid-node.node-type-timer:not(.is-editing):not(.is-ghost-active) .timer-header-right {
  opacity: 0.85;
  transition: none;
}

.grid-node.node-type-timer.is-editing .timer-card-header button,
.grid-node.node-type-timer.is-editing .timer-date-chip,
.grid-node.node-type-timer.is-editing .timer-rate-wrap,
.grid-node.node-type-timer.is-editing .btn-timer-rate-source,
.grid-node.node-type-timer.is-editing .timer-rate-input,
.grid-node.node-type-timer.is-editing .timer-ctrl-btn,
.grid-node.node-type-timer.is-ghost-active .timer-card-header button,
.grid-node.node-type-timer.is-ghost-active .timer-date-chip,
.grid-node.node-type-timer.is-ghost-active .timer-rate-wrap,
.grid-node.node-type-timer.is-ghost-active .btn-timer-rate-source,
.grid-node.node-type-timer.is-ghost-active .timer-rate-input,
.grid-node.node-type-timer.is-ghost-active .timer-ctrl-btn {
  pointer-events: auto;
  transition: none;
}

.grid-node.node-type-timer.is-editing .timer-header-right,
.grid-node.node-type-timer.is-ghost-active .timer-header-right {
  opacity: 1;
  transition: none;
}

/* When timer is locked, disable all interactive subtools EXCEPT the unlock button */
.grid-node.node-type-timer.is-timer-locked :is(button, input, select, .timer-ctrl-btn, .timer-date-chip, .timer-rate-wrap, .btn-timer-rate-source) {
  pointer-events: none;
  user-select: none;
}

.grid-node.node-type-timer.is-timer-locked .timer-controls-center .timer-ctrl-btn {
  opacity: 0.35;
  cursor: not-allowed;
}

.grid-node.node-type-timer.is-timer-locked .timer-date-chip {
  opacity: 0.5;
  cursor: not-allowed;
}

.grid-node.node-type-timer.is-timer-locked .timer-rate-wrap {
  opacity: 0.4;
  cursor: not-allowed;
}

.grid-node.node-type-timer.is-timer-locked .timer-title {
  cursor: default;
}

/* Keep Unlock clickable in 1 click even outside edit mode */
.grid-node.node-type-timer.is-timer-locked .timer-card-header .timer-header-right {
  pointer-events: auto;
  opacity: 1;
}

.grid-node.node-type-timer.is-timer-locked .timer-card-header .timer-ctrl-btn.btn-timer-lock {
  pointer-events: auto;
  cursor: pointer;
  opacity: 1;
}

/* Draggable Floating Timer / Chrono Tracker Trigger Widget */
.floating-timer-widget {
  position: fixed;
  top: 288px;
  right: 24px;
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  touch-action: none;
}

body.is-logged-off .floating-timer-widget,
body.is-logged-off #floating-timer-widget {
  display: none;
}

.floating-timer-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  box-sizing: border-box;
  background: #ffffff;
  border: 1.5px solid var(--border-subtle, #e2e8f0);
  border-radius: 50%;
  color: var(--text-primary, #0f172a);
  box-shadow: none;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

.floating-timer-trigger:active,
.floating-timer-widget.is-dragging .floating-timer-trigger {
  cursor: grabbing;
}

.floating-timer-widget.is-active-tool .floating-timer-trigger,
.floating-timer-trigger.is-active {
  background: #000000;
  border-color: #000000;
  color: #ffffff;
  box-shadow: none;
}

.floating-timer-trigger-icon {
  width: 21px;
  height: 21px;
  display: block;
  pointer-events: none;
}

}

/* === 14-tool-textbox.css (nodes) === */
@layer nodes {
/* ==========================================================================
   GRIDNET TOOL: TEXT BOX (GridNetToolTextBox)
   Single Source of Truth Stylesheet for Text Box Containers
   ========================================================================== */

.grid-node.node-type-textbox {
  display: flex;
  flex-direction: column;
  position: absolute;
  box-sizing: border-box;
  background-color: var(--node-bg, #ffffff);
  border: var(--node-border, 1px solid rgba(0, 0, 0, 0.25));
  border-radius: var(--node-radius, 0px);
  overflow: visible;
  user-select: none;
  cursor: grab;
  transition: none;
}

.grid-node.node-type-textbox.is-selected {
  box-shadow: none;
}

.grid-node.node-type-textbox .textbox-body {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  box-sizing: border-box;
  overflow: hidden;
}

.grid-node.node-type-textbox .textbox-text {
  width: 100%;
  max-height: 100%;
  display: block;
  text-align: center;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  font-weight: var(--node-font-weight, 400);
  line-height: 1.35;
  color: var(--node-fg, #0f172a);
  cursor: grab;
  user-select: none;
  outline: none;
}

.grid-node.node-type-textbox.is-editing .textbox-text {
  cursor: text;
  user-select: text;
}

.grid-node.node-type-textbox:not(.is-editing) .textbox-text:empty::before {
  display: none;
}

.grid-node.node-type-textbox.is-editing .textbox-text:empty::before {
  content: attr(data-placeholder);
  opacity: 0.45;
  font-weight: 400;
  font-style: italic;
  pointer-events: none;
}

.grid-node.node-type-textbox.is-selected.is-editing .shape-floating-bar,
.grid-node.node-type-textbox.is-selected.is-editing .textbox-floating-bar {
  display: flex;
}

.grid-node.node-type-textbox.has-purpose.is-editing .shape-floating-bar,
.grid-node.node-type-textbox.has-purpose.is-editing .textbox-floating-bar,
.grid-node.node-type-textbox.has-step-number.is-editing .shape-floating-bar,
.grid-node.node-type-textbox.has-step-number.is-editing .textbox-floating-bar {
  top: -68px;
}

.grid-node.node-type-textbox.has-purpose.has-step-number.is-editing .shape-floating-bar,
.grid-node.node-type-textbox.has-purpose.has-step-number.is-editing .textbox-floating-bar {
  top: -96px;
}

.grid-node.node-type-textbox .node-purpose-badge {
  cursor: pointer;
}

/* Integrated #hashtag header inside Text Box so tag + text behave as one unified container */
.grid-node.node-type-textbox > .node-corner-step-pill,
.grid-node.node-type-textbox.has-purpose > .node-corner-step-pill {
  position: static;
  order: -1;
  flex: 0 0 auto;
  width: 100%;
  left: auto;
  right: auto;
  bottom: auto;
  border: none;
  border-bottom: 1px solid var(--step-border, rgba(0, 0, 0, 0.12));
  box-shadow: none;
  cursor: grab;
}

.grid-node.node-type-textbox > .node-corner-step-pill:hover {
  box-shadow: none;
}

.grid-node.node-type-textbox.is-interacting > .node-corner-step-pill {
  cursor: grabbing;
}

/* Floating Quick Action Bar for Text Box */
.textbox-floating-bar {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #181b22);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 0;
  box-shadow: none;
  z-index: var(--z-node-toolbar, 200);
  pointer-events: auto;
  white-space: nowrap;
}

.textbox-swatch-list {
  display: flex;
  align-items: center;
  gap: 3px;
}

.textbox-swatch-btn {
  width: 16px;
  height: 16px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  transition: none;
}

.textbox-swatch-btn.is-active {
  border-color: #ffffff;
  outline: 1.5px solid var(--accent-primary, #6366f1);
  outline-offset: 1px;
}

.textbox-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted, #9ca3af);
  cursor: pointer;
  transition: none;
}

.textbox-action-btn:hover,
.textbox-action-btn.is-active {
  background: var(--bg-panel-hover, rgba(255, 255, 255, 0.08));
  color: var(--text-primary, #ffffff);
}

.textbox-floating-divider {
  width: 1px;
  height: 14px;
  background: var(--border-subtle, rgba(255, 255, 255, 0.12));
}

.textbox-floating-bar .btn-textbox-lang {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted, #9ca3af);
}

.textbox-floating-bar .btn-textbox-lang:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--text-primary, #ffffff);
}

.textbox-floating-bar .btn-textbox-spellcheck:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary, #6366f1);
}

.textbox-floating-bar .btn-textbox-spellcheck.is-processing {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary, #6366f1);
}

.textbox-floating-bar .btn-textbox-spellcheck:disabled {
  cursor: wait;
  opacity: 0.8;
}

.grid-node.node-type-textbox.is-ai-polishing {
  outline: 1.5px solid var(--accent-primary, #6366f1);
  outline-offset: 2px;
}

}

/* === 15-nodes-polygon.css (nodes) === */
@layer nodes {
/* ==========================================================================
   GRIDSPACE 15-NODES-POLYGON.CSS
   Custom Point-to-Point Vector Polygons & Interactive Path Tool
   ========================================================================== */

/* Cursor crosshair for polygon mode */
.viewport.is-polygon-tool,
.viewport.is-polygon-tool .grid-node {
  cursor: crosshair;
}

.grid-node.node-type-polygon {
  position: absolute;
  box-sizing: border-box;
  overflow: visible;
  user-select: none;
  cursor: grab;
  background: transparent;
  border: none;
  box-shadow: none;
  contain: layout style;
}

.grid-node.node-type-polygon .polygon-svg-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: visible;
}

.grid-node.node-type-polygon .polygon-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
}

.grid-node.node-type-polygon .polygon-shape {
  cursor: grab;
  pointer-events: auto;
  transition: filter 0.15s ease, stroke-width 0.15s ease;
}

.grid-node.node-type-polygon.is-selected .polygon-shape {
  filter: drop-shadow(0 0 2px var(--accent-primary, #3b82f6));
}

.grid-node.node-type-polygon.is-dragging {
  cursor: grabbing;
}

.grid-node.node-type-polygon.is-dragging .polygon-shape {
  cursor: grabbing;
}

/* ==========================================================================
   FLOATING ACTION BAR ON SELECTION
   ========================================================================== */
.polygon-floating-bar {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #181b22);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 0;
  box-shadow: none;
  z-index: var(--z-node-toolbar, 200);
  pointer-events: auto;
  white-space: nowrap;
}

body:not(.has-void-focus) .grid-node.node-type-polygon.is-selected:not(.is-void-focused) .polygon-floating-bar {
  display: flex;
}

.grid-node.node-type-polygon.has-step-number .polygon-floating-bar {
  top: -72px;
}

.polygon-swatch-list {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.polygon-swatch-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.polygon-swatch-btn[data-color="#ffffff" i] {
  border: 1px solid #d1d5db;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.polygon-swatch-btn:hover {
  transform: scale(1.25);
  border-color: #ffffff;
}

.polygon-swatch-btn[data-color="#ffffff" i]:hover {
  border-color: #9ca3af;
}

.polygon-swatch-btn.is-active {
  border-color: #ffffff;
  box-shadow: 0 0 0 1.5px var(--accent-primary, #6366f1);
}

.polygon-swatch-btn[data-color="#ffffff" i].is-active {
  border-color: #d1d5db;
  box-shadow: 0 0 0 1.5px var(--accent-primary, #6366f1);
}

.polygon-floating-divider {
  width: 1px;
  height: 16px;
  background: var(--border-subtle, rgba(255, 255, 255, 0.15));
  flex-shrink: 0;
}

.polygon-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary, #9ca3af);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.polygon-action-btn:hover {
  background: var(--bg-panel-hover, rgba(255, 255, 255, 0.08));
  color: var(--text-primary, #ffffff);
}

.polygon-action-btn .material-symbols-outlined {
  font-size: 15px;
}

.polygon-pill-readout {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-primary, #3b82f6);
}

.polygon-color-picker-label {
  position: relative;
  overflow: hidden;
  width: 24px;
  padding: 0;
}

.polygon-fill-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  cursor: pointer;
}

/* ==========================================================================
   POPOVERS & MINI FLYOUT PANELS
   ========================================================================== */
.polygon-flyout-container {
  position: relative;
  display: inline-flex;
}

.polygon-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #181b22);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.15));
  border-radius: 0;
  box-shadow: none;
  z-index: var(--z-node-flyout, 500);
  min-width: 200px;
  white-space: nowrap;
}

.polygon-popover[aria-hidden="true"] {
  display: none;
}

.polygon-popover-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #9ca3af);
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  padding-bottom: 4px;
}

.polygon-popover-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.polygon-field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary, #ffffff);
}

.polygon-field-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.polygon-stroke-color-input {
  width: 28px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.2));
  background: transparent;
  cursor: pointer;
}

.polygon-color-hex {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-secondary, #9ca3af);
}

.polygon-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.polygon-slider {
  flex: 1;
  height: 4px;
  accent-color: var(--accent-primary, #3b82f6);
  cursor: pointer;
}

.polygon-slider-val {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary, #ffffff);
  width: 32px;
  text-align: right;
}

.polygon-chip-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.polygon-chip-btn {
  flex: 1;
  height: 20px;
  padding: 0 4px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  color: var(--text-secondary, #9ca3af);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.polygon-chip-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.polygon-chip-btn.is-active {
  background: var(--accent-primary, #3b82f6);
  border-color: var(--accent-primary, #3b82f6);
  color: #ffffff;
}

/* ==========================================================================
   POINT-TO-POINT DRAWING SVG LAYER INSIDE #world
   ========================================================================== */
.polygon-draw-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: var(--z-drawings-overlay, 99999);
}

body.is-mobile-constrained .polygon-draw-layer,
body.is-viewer-mode .polygon-draw-layer {
  display: none;
}

.polygon-draw-preview-fill {
  fill: rgba(59, 130, 246, 0.15);
  stroke: none;
}

.polygon-draw-path {
  stroke: #2563eb;
  stroke-width: 3px;
  stroke-linejoin: round;
  stroke-linecap: round;
  fill: none;
}

.polygon-draw-rubberline {
  stroke: #3b82f6;
  stroke-width: 2px;
  stroke-dasharray: 6, 4;
  opacity: 0.9;
}

.polygon-vertex-group {
  pointer-events: none;
}

.polygon-vertex-square-outer,
.polygon-reshape-square-outer {
  fill: #ffffff;
  stroke: none;
  pointer-events: none;
}

.polygon-vertex-square-inner,
.polygon-reshape-square-inner {
  fill: #000000;
  stroke: none;
  pointer-events: none;
}

.polygon-vertex-square,
.polygon-vertex-square.is-start-dot {
  fill: #000000;
  stroke: #ffffff;
  stroke-width: 1px;
}


/* ==========================================================================
   SCREEN-SPACE CURSOR HELPER BADGE
   ========================================================================== */
.polygon-cursor-badge {
  position: fixed;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
  pointer-events: none;
  z-index: var(--z-ui-chrome, 100000);
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.polygon-cursor-badge.is-hidden {
  display: none;
}

.polygon-cursor-badge.is-near-start {
  background: rgba(6, 78, 59, 0.95);
  border-color: #10b981;
  color: #a7f3d0;
}

.polygon-cursor-badge .badge-icon {
  font-size: 14px;
  color: #38bdf8;
}

.polygon-cursor-badge.is-near-start .badge-icon {
  color: #10b981;
}

/* ==========================================================================
   RESHAPE EDIT MODE (ACTIVE SCULPTING & VERTEX MANIPULATION)
   ========================================================================== */
.polygon-action-btn.btn-polygon-reshape.is-active {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

.polygon-action-btn.btn-polygon-reshape.is-active .polygon-pill-readout {
  color: #ffffff;
}

.grid-node.is-reshaping .resize-handle {
  display: none;
}

.grid-node.is-reshaping {
  outline: none;
}

.polygon-reshape-outline {
  display: none;
}

.polygon-reshape-vertex-group {
  pointer-events: all;
  cursor: grab;
}

.polygon-reshape-vertex-group:active {
  cursor: grabbing;
}

.polygon-reshape-handle-hit {
  fill: transparent;
  stroke: none;
  cursor: grab;
}

.polygon-reshape-square-inner.is-selected {
  fill: #000000;
}

.grid-node.node-type-polygon.is-reshaping .polygon-shape {
  cursor: default;
}


.polygon-reshape-outline-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 24px;
  cursor: crosshair;
  pointer-events: stroke;
}

/* =========================================================================
   VOID FOCUS MODE (Shift + F) — Ambient Darkroom Isolation & Spotlight Cutout
   ========================================================================= */

.void-focus-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: var(--z-drawings-overlay, 99999);
  animation: voidFocusFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.void-focus-backdrop-path {
  cursor: pointer;
  pointer-events: auto;
}

@keyframes voidFocusFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 1. Complete UI Chrome Dissolve to Black */
body.has-void-focus header.top-bar,
body.has-void-focus #floating-tools-home-dock,
body.has-void-focus #floating-history-dock,
body.has-void-focus nav.style-dock,
body.has-void-focus aside.hud-bar,
body.has-void-focus footer.footer-share-bar,
body.has-void-focus .project-hub-trigger-row,
body.has-void-focus .style-drawer,
body.has-void-focus .diagnostic-drawer,
body.has-void-focus .polygon-cursor-badge {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* 2. Complete Vector Connections, Arrows & Drawings Dissolve */
#world.has-void-focus .connections-layer,
#world.has-void-focus .connection-labels-layer,
#world.has-void-focus .drawing-layer,
#world.has-void-focus .drawing-canvas,
#world.has-void-focus .connection-line,
#world.has-void-focus .connection-arrow,
#world.has-void-focus .connection-label-pill,
#world.has-void-focus .drawing-item,
#world.has-void-focus .origin-marker {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* 3. Disable pointer interaction on un-focused nodes outside the cutout */
#world.has-void-focus .grid-node:not(.is-void-focused) {
  pointer-events: none;
}

body.has-void-focus .grid-backdrop {
  opacity: 0.02;
  filter: brightness(0.05);
  transition: opacity 0.25s ease, filter 0.25s ease;
}

/* 4. Guarded Focal Point: Elevated strictly above the void with crisp, zero-noise contour */
.grid-node.is-void-focused {
  z-index: var(--z-ui-chrome, 100000);
  pointer-events: auto;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.grid-node.node-type-polygon.is-void-focused .polygon-shape {
  fill: transparent;
  fill-opacity: 0;
  filter: none;
  transition: fill 0.2s ease, fill-opacity 0.2s ease;
}

.grid-node:not(.node-type-polygon).is-void-focused {
  box-shadow: none;
}

/* 5. In Void Focus: Dissolve floating tool headers, swatches, resize handles, and node chrome */
body.has-void-focus .grid-node.node-type-polygon.is-selected .polygon-floating-bar,
body.has-void-focus .grid-node.node-type-shape.is-selected .shape-floating-bar,
body.has-void-focus .grid-node.node-type-textbox.is-selected .textbox-floating-bar,
body.has-void-focus .grid-node .polygon-floating-bar,
body.has-void-focus .grid-node .shape-floating-bar,
body.has-void-focus .grid-node .textbox-floating-bar,
body.has-void-focus .grid-node .resize-handle,
body.has-void-focus .grid-node .node-header,
body.has-void-focus .grid-node .node-actions,
.grid-node.node-type-polygon.is-void-focused .polygon-floating-bar,
.grid-node.is-void-focused .polygon-floating-bar,
.grid-node.is-void-focused .shape-floating-bar,
.grid-node.is-void-focused .textbox-floating-bar,
.grid-node.is-void-focused .resize-handle {
  display: none;
}

/* 6. Floating Toolbar Void Button */
.polygon-action-btn.btn-polygon-void-focus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.polygon-action-btn.btn-polygon-void-focus.is-active {
  background-color: #0f172a;
  color: #38bdf8;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.polygon-action-btn.btn-polygon-void-focus.is-active .polygon-pill-readout {
  color: #38bdf8;
}

/* ==========================================================================
   FOOTER CENTER POLYGON OPTIONS TIER (SUBMODE & SMOOTHING - TABLET & DESKTOP)
   ========================================================================== */
.polygon-options-tier {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: auto;
}

.polygon-options-tier.is-hidden {
  display: none;
}

.polygon-submode-btn.is-active {
  background: var(--bg-surface-hover, #f8fafc);
  border-color: var(--accent-primary, #3b82f6);
  color: var(--text-primary, #0f172a);
}

.polygon-submode-btn.is-active .share-btn-icon {
  color: var(--accent-primary, #3b82f6);
}

.polygon-smooth-btn.is-active {
  border-color: var(--accent-primary, #3b82f6);
  color: var(--text-primary, #0f172a);
}

.polygon-smooth-btn.is-active .share-btn-icon {
  color: var(--accent-primary, #3b82f6);
}

.polygon-smooth-btn:not(.is-active) {
  opacity: 0.6;
}

.polygon-strength-btn {
  border-color: var(--border-subtle, rgba(15, 23, 42, 0.08));
  color: var(--text-primary, #0f172a);
}

.polygon-strength-btn .share-btn-icon {
  color: var(--accent-primary, #3b82f6);
}

.polygon-strength-btn.is-disabled {
  opacity: 0.5;
}

body.is-touch-device .polygon-submode-btn,
body.is-touch-device .polygon-smooth-btn,
body.is-touch-device .polygon-strength-btn {
  height: 38px;
  padding: 0 14px;
}

/* ==========================================================================
   DRAGGABLE FLOATING CUSTOM MARK / POLYGON HIGHLIGHT WIDGET (P SHORTCUT)
   ========================================================================== */
.floating-polygon-widget {
  position: fixed;
  top: 234px;
  right: 24px;
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  touch-action: none;
}

body.is-logged-off .floating-polygon-widget,
body.is-logged-off #floating-polygon-widget {
  display: none;
}

.floating-polygon-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  box-sizing: border-box;
  background: #ffffff;
  border: 1.5px solid var(--border-subtle, #e2e8f0);
  border-radius: 50%;
  color: #1f1f1f;
  box-shadow: none;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

.floating-polygon-trigger:active,
.floating-polygon-widget.is-dragging .floating-polygon-trigger {
  cursor: grabbing;
}

.floating-polygon-widget.is-active-tool .floating-polygon-trigger,
.floating-polygon-trigger.is-active {
  background: #000000;
  border-color: #000000;
  color: #ffffff;
  box-shadow: none;
}

.floating-polygon-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  pointer-events: none;
}

}

/* === 17-nodes-cutout.css (nodes) === */
@layer nodes {
/* ==========================================================================
   GRIDSPACE 17-NODES-CUTOUT.CSS
   Collage Cutout & Scissors Vector Extraction Tool
   ========================================================================== */

/* Cursor crosshair for cutout mode */
.viewport.is-cutout-tool,
.viewport.is-cutout-tool .grid-node {
  cursor: crosshair;
}

/* Cutout Node DOM Container */
.grid-node.node-type-image.node-type-cutout,
.grid-node[data-node-type="image"].node-type-cutout {
  background: transparent;
  box-shadow: none;
  overflow: visible;
  border: 1px solid transparent;
}

/* Harmonic standard bounding box selection border matching all other tools */
.grid-node.node-type-image.node-type-cutout.is-selected,
.grid-node[data-node-type="image"].node-type-cutout.is-selected {
  border-color: var(--bounding-box-color);
  box-shadow: none;
}

.grid-node.node-type-cutout .media-container {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.grid-node.node-type-cutout .node-media-img {
  background: transparent;
  filter: none;
}

.grid-node.node-type-cutout.is-selected .node-media-img {
  filter: none;
}

.media-container.collage-cutout-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
  background: transparent;
  border-radius: 0;
  display: block;
}

.collage-cutout-svg {
  display: block;
  overflow: visible;
  pointer-events: auto;
  filter: none;
}

.collage-cutout-stroke {
  fill: none;
  stroke: none;
  pointer-events: none;
}

.grid-node.node-type-image.node-type-cutout.is-selected .collage-cutout-svg {
  filter: none;
}

.grid-node.node-type-image.node-type-cutout.is-selected .collage-cutout-stroke {
  stroke: none;
}

/* Drawing Overlay Layer inside #world */
.cutout-draw-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: var(--z-drawings-overlay, 99999);
}

.cutout-draw-preview-fill {
  fill: rgba(244, 63, 94, 0.18);
  stroke: none;
}

.cutout-draw-path {
  stroke: #f43f5e;
  stroke-width: 2.5px;
  stroke-linejoin: round;
  stroke-linecap: round;
  fill: none;
}

.cutout-draw-rubberline {
  stroke: #fb7185;
  stroke-width: 2px;
  stroke-dasharray: 6, 4;
  opacity: 0.9;
}

.cutout-vertex-group {
  pointer-events: none;
}

.cutout-vertex-square-outer {
  fill: #ffffff;
  stroke: none;
  pointer-events: none;
}

.cutout-vertex-square-inner {
  fill: #f43f5e;
  stroke: none;
  pointer-events: none;
}

/* Screen-space Cursor Helper Badge */
.cutout-cursor-badge {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: var(--z-ui-chrome, 100000);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.cutout-cursor-badge.is-hidden {
  display: none;
}

.cutout-cursor-badge.is-near-start {
  background: rgba(244, 63, 94, 0.95);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.cutout-cursor-badge .badge-icon {
  font-size: 14px;
  line-height: 1;
  color: #fda4af;
}

.cutout-cursor-badge.is-near-start .badge-icon {
  color: #ffffff;
}

/* ==========================================================================
   FOOTER CENTER CUTOUT PASTE TIER (TABLET & DESKTOP)
   ========================================================================== */
.cutout-paste-tier {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: auto;
}

.cutout-paste-tier.is-hidden {
  display: none;
}

.cutout-paste-btn {
  border-color: #f43f5e;
  color: var(--text-primary, #0f172a);
}

.cutout-paste-btn:hover {
  background: rgba(244, 63, 94, 0.08);
  border-color: #e11d48;
}

.cutout-paste-icon {
  color: #f43f5e;
}

.cutout-dismiss-btn {
  padding: 0 8px;
  color: var(--text-secondary, #64748b);
}

body.is-touch-device .cutout-paste-btn,
body.is-touch-device .cutout-dismiss-btn {
  height: 38px;
  padding: 0 14px;
}

/* ==========================================================================
   FOOTER CENTER CUTOUT OPTIONS TIER (SUBMODE & SMOOTHING)
   ========================================================================== */
.cutout-options-tier,
.pen-options-tier {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: auto;
}

.cutout-options-tier.is-hidden,
.pen-options-tier.is-hidden {
  display: none;
}

.cutout-submode-btn.is-active {
  background: var(--bg-surface-hover, #f8fafc);
  border-color: #f43f5e;
  color: var(--text-primary, #0f172a);
}

.cutout-submode-btn.is-active .share-btn-icon {
  color: #f43f5e;
}

.cutout-smooth-btn.is-active,
.pen-smooth-btn.is-active {
  border-color: #f43f5e;
  color: var(--text-primary, #0f172a);
}

.cutout-smooth-btn.is-active .share-btn-icon,
.pen-smooth-btn.is-active .share-btn-icon {
  color: #f43f5e;
}

.cutout-smooth-btn:not(.is-active),
.pen-smooth-btn:not(.is-active) {
  opacity: 0.6;
}

.cutout-strength-btn,
.pen-strength-btn {
  border-color: var(--border-subtle, rgba(15, 23, 42, 0.08));
  color: var(--text-primary, #0f172a);
}

.cutout-strength-btn .share-btn-icon,
.pen-strength-btn .share-btn-icon {
  color: #f43f5e;
}

.cutout-strength-btn.is-disabled,
.pen-strength-btn.is-disabled {
  opacity: 0.5;
}

body.is-touch-device .cutout-submode-btn,
body.is-touch-device .cutout-smooth-btn,
body.is-touch-device .cutout-strength-btn,
body.is-touch-device .pen-smooth-btn,
body.is-touch-device .pen-strength-btn {
  height: 38px;
  padding: 0 14px;
}

}

/* === 18-nodes-code.css (nodes) === */
@layer nodes {
/* ==========================================================================
   Gridspace Code Snippet Nodes (Layer 2 GridNetTool)
   Modern Vanilla CSS — Zero !important, Zero layout margins, Flex/Grid gap
   ========================================================================== */

.grid-node.node-type-code {
  background: var(--surface-node, #181a20);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  /* Keep outer box visible so shared .node-resize-handles are never clipped */
  overflow: visible;
  box-sizing: border-box;
}

.grid-node.node-type-code.is-selected {
  border-color: var(--bounding-box-color, var(--accent-primary));
  box-shadow: none;
}

/* Header bar */
.grid-node.node-type-code .code-node-header {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
  gap: 8px;
}

.grid-node.node-type-code .code-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.grid-node.node-type-code .code-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', 'Consolas', monospace);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent-light, #a5b4fc);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 4px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.grid-node.node-type-code .code-header-badge .material-symbols-outlined {
  font-size: 14px;
}

.grid-node.node-type-code .node-title {
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #cbd5e1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
}

.grid-node.node-type-code .code-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.grid-node.node-type-code .code-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 6px;
  gap: 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted, #94a3b8);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.grid-node.node-type-code .code-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

.grid-node.node-type-code .code-action-btn .material-symbols-outlined {
  font-size: 15px;
}

.grid-node.node-type-code .code-action-btn.is-copied {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.1);
}

/* Code viewport container */
.grid-node.node-type-code .code-container {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  overflow: hidden;
  background: #111318;
}

/* Line numbers gutter */
.grid-node.node-type-code .code-gutter {
  width: 36px;
  padding: 8px 6px 8px 0;
  background: rgba(0, 0, 0, 0.25);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  color: rgba(148, 163, 184, 0.4);
  font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', 'Consolas', monospace);
  font-size: 11px;
  line-height: 18px;
  text-align: right;
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
  box-sizing: border-box;
}

.grid-node.node-type-code .code-gutter-line {
  display: block;
  min-height: 18px;
  line-height: 18px;
}

/* Code editable / display area */
.grid-node.node-type-code .code-body {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', 'Consolas', monospace);
  font-size: 12px;
  line-height: 18px;
  color: #e2e8f0;
  white-space: pre;
  word-break: normal;
  tab-size: 2;
  overflow: hidden;
  box-sizing: border-box;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.grid-node.node-type-code.is-wrapped .code-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}

.grid-node.node-type-code.is-editing .code-body {
  overflow: auto;
}

.grid-node.node-type-code .code-body:empty::before {
  content: '// Paste or type code here...';
  color: rgba(148, 163, 184, 0.35);
  font-style: italic;
}

/* Marquee drawing indicator for code snippet tool */
.selection-marquee.is-code-draw {
  border: 2px dashed #6366f1;
  background: rgba(99, 102, 241, 0.12);
}

}

/* === 03-style-studio.css (hud) === */
@layer hud {
/* ==========================================================================
   STYLE & GRID STUDIO DRAWER
   ========================================================================== */

.style-drawer {
  position: absolute;
  top: calc(var(--viewport-edge-pad-top, 16px) + 74px);
  right: var(--viewport-edge-pad-right, 16px);
  bottom: calc(var(--viewport-edge-pad-bottom, 16px) + 74px);
  width: 340px;
  z-index: var(--z-ui-drawer, 100100);
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
  transform: translate3d(400px, 0, 0);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
  overflow: hidden;
}

.style-drawer.is-open {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  pointer-events: auto;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-header-icon {
  color: var(--accent-primary);
  font-size: 22px;
}

.drawer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.drawer-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

.style-status-toast {
  display: none;
  padding: 8px 14px;
  background: var(--accent-glow);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-focus);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.style-status-toast.is-visible {
  display: block;
}

.drawer-scroll-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 16px;
}

.drawer-scroll-body::-webkit-scrollbar {
  width: 6px;
}

.drawer-scroll-body::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 0;
}

.style-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: rgba(128, 128, 128, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-heading .material-symbols-outlined {
  font-size: 16px;
  color: var(--accent-primary);
}

/* Preset Grid & Cards */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  background: var(--bg-panel-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.preset-card:hover {
  background: var(--bg-panel-hover);
}

.preset-card.is-active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.preset-swatch {
  width: 24px;
  height: 24px;
  border-radius: 0;
  border: 2px solid;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preset-swatch-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.preset-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preset-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-meta {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-top: 4px;
}

.user-preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preset-empty-note {
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 8px;
  border: 1px dashed var(--border-subtle);
  border-radius: 0;
  text-align: center;
}

.user-preset-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 4px 6px;
}

.user-preset-row.is-active {
  border-color: var(--accent-primary);
}

.user-preset-apply {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  padding: 4px;
  font-family: var(--font-sans);
}

.user-preset-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 0;
  display: inline-flex;
}

.user-preset-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.preset-save-row,
.preset-share-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.style-text-input {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  background: var(--bg-panel-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  outline: none;
}

.style-text-input:focus {
  border-color: var(--accent-primary);
}

.style-btn {
  flex: 1;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  background: var(--bg-panel-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.style-btn .material-symbols-outlined {
  font-size: 15px;
}

.style-btn:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-focus);
}

.style-btn-primary {
  flex: 0 0 auto;
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

.style-btn-primary:hover {
  filter: brightness(1.08);
  background: var(--accent-primary);
}

/* Individual Token Control Rows */
.control-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.control-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.segmented-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--bg-panel-solid);
  padding: 3px;
  border-radius: 0;
  border: 1px solid var(--border-subtle);
}

.seg-btn {
  height: 26px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn.is-active {
  background: var(--accent-primary);
  color: #ffffff;
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
}

.color-slider-combo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
}

.color-input {
  width: 26px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.range-input {
  flex: 1;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.checkbox-input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.mono-readout {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  min-width: 44px;
  text-align: right;
}


/* Number Input Field Paired with Sliders */
.num-input-wrap {
  display: inline-flex;
  align-items: center;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  gap: 3px;
  box-sizing: border-box;
}

.style-num-input {
  width: 44px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  padding: 0;
  outline: none;
  -moz-appearance: textfield;
}

.style-num-input::-webkit-outer-spin-button,
.style-num-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.unit-suffix,
.unit-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  user-select: none;
}

.style-select {
  background: var(--bg-panel-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .controls-hint {
    display: none;
  }
  .style-drawer {
    width: calc(100vw - 36px);
  }
}


}

/* === 07-diagnostics.css (hud) === */
@layer hud {
/* =========================================================================
   DIAGNOSTIC TELEMETRY, HEALTH PILL & FLIGHT RECORDER DRAWER
   Strict Standards: Zero !important, Zero margin (100% Flex/Grid gap & padding)
   ========================================================================= */

.hud-health-pill {
  width: auto;
  min-width: max-content;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  height: 28px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.hud-health-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.health-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.health-pill-text {
  white-space: nowrap;
  line-height: 1;
}

.hud-health-pill.is-healthy .health-pulse-dot {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.hud-health-pill.is-healthy .health-pill-text {
  color: #34d399;
}

.hud-health-pill.is-warning .health-pulse-dot {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
}

.hud-health-pill.is-warning .health-pill-text {
  color: #fbbf24;
}

.hud-health-pill.is-critical .health-pulse-dot {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.9);
  animation: health-pulse 1.4s infinite;
}

.hud-health-pill.is-critical .health-pill-text {
  color: #f87171;
}

.hud-health-pill.is-offline .health-pulse-dot {
  background: #9ca3af;
  box-shadow: none;
}

.hud-health-pill.is-offline .health-pill-text {
  color: #d1d5db;
}

/* VPS Live Disk Storage Meter Pill */
.hud-storage-pill {
  width: auto;
  min-width: max-content;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  height: 28px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: default;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.hud-storage-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.hud-storage-pill .storage-icon {
  font-size: 15px;
  color: #38bdf8;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.storage-pill-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}

.storage-text {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  line-height: 1.1;
  color: var(--text-primary);
  white-space: nowrap;
}

.storage-mini-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0;
  overflow: hidden;
}

.storage-mini-bar-fill {
  height: 100%;
  background: #38bdf8;
  border-radius: 0;
  transition: width 0.3s ease-out, background 0.2s ease;
}

.hud-storage-pill.is-healthy .storage-icon {
  color: #38bdf8;
}

.hud-storage-pill.is-healthy .storage-mini-bar-fill {
  background: #38bdf8;
}

.hud-storage-pill.is-warning {
  border-color: rgba(245, 158, 11, 0.35);
}

.hud-storage-pill.is-warning .storage-icon {
  color: #fbbf24;
}

.hud-storage-pill.is-warning .storage-mini-bar-fill {
  background: #f59e0b;
}

.hud-storage-pill.is-warning .storage-text {
  color: #fbbf24;
}

.hud-storage-pill.is-critical {
  border-color: rgba(239, 68, 68, 0.5);
  animation: health-pulse 1.4s infinite;
}

.hud-storage-pill.is-critical .storage-icon {
  color: #ef4444;
}

.hud-storage-pill.is-critical .storage-mini-bar-fill {
  background: #ef4444;
}

.hud-storage-pill.is-critical .storage-text {
  color: #f87171;
}

@keyframes health-pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

/* Diagnostic Drawer Floating Panel */
.diagnostic-drawer {
  position: fixed;
  bottom: calc(var(--viewport-edge-pad-bottom, 16px) + 74px);
  right: var(--viewport-edge-pad-right, 16px);
  width: 440px;
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 140px);
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: var(--z-ui-drawer, 100100);
  overflow: hidden;
}

.diagnostic-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.diagnostic-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.diagnostic-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.diagnostic-icon {
  font-size: 24px;
  color: #10b981;
}

.diagnostic-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.diagnostic-subtitle {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
}

.diagnostic-metrics-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.diagnostic-metric-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
}

.metric-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-healthy {
  color: #34d399;
}

.metric-warning {
  color: #fbbf24;
}

.metric-danger {
  color: #f87171;
}

.diagnostic-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.diagnostic-actions-row .style-btn {
  flex: 1;
  min-width: 120px;
  justify-content: center;
  padding: 6px 10px;
  font-size: 11px;
}

.diagnostic-log-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1;
}

.diagnostic-section-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.diagnostic-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.diagnostic-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
}

.diagnostic-empty-state .empty-icon {
  font-size: 28px;
  color: #10b981;
}

.diagnostic-empty-state .empty-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  word-break: break-all;
}

.diagnostic-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-sans);
}

.diagnostic-item.is-item-critical {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.05);
}

.diagnostic-item.is-item-warning {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.05);
}

.diagnostic-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.diagnostic-badge {
  padding: 2px 6px;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-critical {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.diagnostic-type {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.diagnostic-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}

.diagnostic-msg {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.diagnostic-source {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.diagnostic-stack {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 8px;
  border-radius: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 120px;
}


}

/* === 11-upload-dictation.css (hud) === */
@layer hud {
/* ==========================================================================
   IN-CANVAS LIVE UPLOAD PROGRESS CARD & BYTE METER
   Zero !important, Zero margin (100% Flex gap & padding)
   ========================================================================== */
.upload-progress-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-panel-solid, #1e293b);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: var(--node-radius, 12px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  pointer-events: auto;
  user-select: none;
  z-index: var(--z-ui-floating, 100050);
  cursor: grab;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.upload-progress-card.is-dragging {
  cursor: grabbing;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 2px var(--accent-primary, #6366f1);
  z-index: calc(var(--z-ui-floating, 100050) + 10);
}

.upload-card-drag-icon {
  font-size: 16px;
  color: var(--text-muted, #94a3b8);
  flex-shrink: 0;
  opacity: 0.6;
  cursor: grab;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.upload-progress-card:hover .upload-card-drag-icon {
  opacity: 1;
  color: var(--text-secondary, #cbd5e1);
}

.upload-progress-card.is-dragging .upload-card-drag-icon {
  cursor: grabbing;
  color: var(--accent-primary, #818cf8);
}

.upload-progress-card.is-upload-error {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(30, 20, 25, 0.95);
}

.upload-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.upload-card-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.upload-card-icon {
  font-size: 18px;
  color: var(--accent-primary, #6366f1);
  flex-shrink: 0;
}

.upload-progress-card.is-upload-error .upload-card-icon {
  color: #ef4444;
}

.upload-card-filename {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #f8fafc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-card-percent {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-primary, #818cf8);
  flex-shrink: 0;
}

.upload-progress-card.is-upload-error .upload-card-percent {
  color: #ef4444;
}

.upload-card-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 0;
  overflow: hidden;
  position: relative;
}

.upload-card-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #38bdf8 100%);
  border-radius: 0;
  transition: width 0.15s ease-out;
}

.upload-progress-card.is-upload-error .upload-card-fill {
  background: #ef4444;
}

.upload-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.upload-card-bytes {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.upload-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.upload-card-actions .is-hidden {
  display: none;
}

.upload-card-retry-btn,
.upload-card-download-btn,
.upload-card-cancel-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  border-radius: 0;
  color: var(--text-muted, #94a3b8);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.upload-card-retry-btn:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.5);
  color: #a5b4fc;
}

.upload-card-download-btn:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}

.upload-card-cancel-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.upload-card-retry-btn .material-symbols-outlined,
.upload-card-download-btn .material-symbols-outlined,
.upload-card-cancel-btn .material-symbols-outlined {
  font-size: 14px;
}



/* ==========================================================================
   AUDIO TRANSCRIPTION & CARD STAMP PLACEMENT HUD
   ========================================================================== */
.btn-audio-transcribe {
  border-radius: 0;
  width: 24px;
  height: 24px;
}

.btn-audio-transcribe:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary, #6366f1);
  color: var(--accent-primary, #6366f1);
}

.btn-audio-transcribe.is-transcribing {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary, #6366f1);
  color: var(--accent-primary, #6366f1);
}

.viewport.is-placing-transcript,
.viewport.is-placing-transcript * {
  cursor: crosshair;
}

.transcript-placement-pill {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(99, 102, 241, 0.4);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: 0;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-ui-floating, 100050);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.transcript-placement-pill.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.transcript-placement-pill.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.transcript-placement-pill .placement-pill-icon {
  font-size: 18px;
  color: #818cf8;
}

/* ==========================================================================
   LIVE CARD VOICE DICTATION & LANGUAGE SELECTOR
   ========================================================================== */
.node-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-dictate-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.btn-card-dictate {
  width: 22px;
  height: 22px;
  border-radius: 0;
  transition: none;
}

.btn-card-dictate:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary, #6366f1);
}

.btn-card-dictate.is-dictating {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ef4444;
  animation: dictatePulse 1.2s infinite ease-in-out;
}

@keyframes dictatePulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.btn-dictate-lang {
  width: 22px;
  height: 22px;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 0;
  color: var(--text-muted, #9ca3af);
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: none;
}

.btn-dictate-lang:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--text-primary, #ffffff);
}

.btn-card-spellcheck {
  width: 22px;
  height: 22px;
  border-radius: 0;
  transition: none;
}

.btn-card-spellcheck:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary, #6366f1);
}

.btn-card-spellcheck.is-processing {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary, #6366f1);
}

.btn-card-spellcheck:disabled {
  cursor: wait;
  opacity: 0.8;
}

.grid-node.node-type-card.is-ai-polishing {
  outline: 1.5px solid var(--accent-primary, #6366f1);
  outline-offset: 2px;
}

}

/* === 12-flow-timeline.css (hud) === */
@layer hud {
/* =========================================================================
   GUIDED FLOW TIMELINE & STORYLINE TOUR HUD
   Strict Selector Specificity & Modern Container Padding and Flex-Gap Standard
   ========================================================================= */

/* Step Number Pill in Card & Frame Headers */
.node-step-pill {
  display: inline-block;
  height: 20px;
  min-width: 34px;
  max-width: 180px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 0;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: 0.5px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  background: var(--bg-panel-solid, #181b22);
  color: var(--text-primary, #ffffff);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.15));
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

/* Hide redundant tag trigger icon when step pill is active */
.grid-node.has-step-number .btn-card-step,
.grid-node.has-step-number .btn-frame-step {
  display: none;
}

.grid-node.has-step-number .btn-shape-step {
  color: var(--accent-primary, #38bdf8);
  background: var(--bg-panel-hover, rgba(255, 255, 255, 0.08));
}

/* Step Number Pill when Card Header has Purpose / Intent Tag Color */
.grid-node.node-type-card.has-purpose .node-step-pill {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Corner / Centered Top Hashtag Pill for All Stepped Containers */
.grid-node.node-type-timer.has-step-number {
  overflow: visible;
}

.node-corner-step-pill {
  position: absolute;
  bottom: 100%;
  left: calc(-1 * var(--node-border-width, var(--shape-border-width, var(--element-border-width, 1px))));
  right: calc(-1 * var(--node-border-width, var(--shape-border-width, var(--element-border-width, 1px))));
  width: calc(100% + 2 * var(--node-border-width, var(--shape-border-width, var(--element-border-width, 1px))));
  z-index: 26;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 24px;
  min-width: 0;
  padding: 0 8px;
  box-sizing: border-box;
  border-radius: 0;
  background: var(--step-bg, var(--accent-primary, #2563eb));
  color: var(--step-fg, #ffffff);
  border: var(--node-border-width, var(--element-border-width, 1px)) solid var(--node-border-color, var(--shape-border-color, var(--element-border, var(--step-border, rgba(255, 255, 255, 0.36)))));
  border-bottom: none;
  box-shadow: none;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.45px;
  white-space: nowrap;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  outline: none;
}

.node-corner-step-pill:hover {
  box-shadow: none;
}

.grid-node.is-interacting > .node-corner-step-pill {
  cursor: grabbing;
}

.node-corner-step-pill.is-step-selected {
  z-index: 28;
}

.grid-node.has-purpose:not(.node-type-card):not(.node-type-textbox):not(.node-type-video):not(.node-type-youtube) > .node-corner-step-pill {
  bottom: calc(100% + 28px);
}

.node-step-num {
  flex-shrink: 0;
}

.node-step-sep,
.node-step-title-text {
  display: none;
}

.node-corner-step-pill.has-step-title .node-step-sep,
.node-corner-step-pill.is-renaming-title .node-step-sep {
  display: inline;
  opacity: 0.65;
  flex-shrink: 0;
}

.node-corner-step-pill.has-step-title .node-step-title-text {
  display: inline-block;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-weight: 600;
  letter-spacing: 0.1px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-corner-step-pill.is-renaming-title .node-step-title-text {
  display: none;
}

.node-step-title-input {
  flex: 1 1 auto;
  min-width: 48px;
  max-width: 240px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--step-border, rgba(255, 255, 255, 0.45));
  border-radius: 0;
  background: rgba(0, 0, 0, 0.14);
  color: var(--step-fg, #ffffff);
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  outline: none;
  box-sizing: border-box;
  user-select: text;
}

/* Top-Left Guided Tour Bar (Side-by-Side next to Saved Container in .top-bar-left) */
.storyline-tour-bar {
  position: relative;
  z-index: var(--z-ui-chrome, 100000);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--panel-height, 40px);
  padding: 6px;
  box-sizing: border-box;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  box-shadow: none;
  user-select: none;
}

.storyline-tour-bar.is-hidden {
  display: none;
}

/* Workspace hides the header hashtag bar even when hashtags exist; opened via H modal instead */
body:not(.is-viewer-mode) #storyline-tour-bar {
  display: none;
}

/* Navigation Buttons [ ◀ Prev | Next ▶ ] */
.tour-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tour-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  box-sizing: border-box;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.tour-nav-btn:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-subtle);
}

.tour-nav-btn.is-disabled,
.tour-nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.tour-btn-icon {
  font-size: 16px;
}

.tour-focus-btn {
  width: 28px;
  padding: 0;
  color: var(--text-secondary);
}

.tour-focus-btn:hover {
  color: var(--accent-primary);
}

/* Step Counter Badge */
.tour-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  box-sizing: border-box;
  border-radius: 0;
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel-hover);
  color: var(--accent-primary);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.tour-step-badge:hover {
  border-color: var(--border-focus);
}

.tour-step-badge-fraction {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary);
}

/* Step Title Info */
.tour-step-info {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  height: 28px;
  padding: 0 8px;
  box-sizing: border-box;
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.tour-step-info:hover {
  background: var(--bg-panel-hover);
}

.tour-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s ease;
}

.tour-step-info:hover .tour-step-title {
  color: var(--accent-primary);
}

/* Timeline Dropdown (Opens Downward Below Tour Bar) */
.tour-timeline-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  max-height: 380px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--z-ui-floating, 100050);
}

.tour-timeline-dropdown.is-hidden {
  display: none;
}

.tour-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tour-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  box-sizing: border-box;
  overflow-y: auto;
  max-height: 320px;
}

.tour-timeline-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  box-sizing: border-box;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background-color 0.12s ease;
}

.tour-timeline-item:hover {
  background: var(--bg-panel-hover);
}

.tour-timeline-item.is-active {
  background: var(--bg-panel-hover);
  border-left: 3px solid var(--accent-primary);
}

.tour-item-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 0;
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.tour-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.tour-item-title {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.tour-item-type {
  font-size: 10px;
  color: var(--text-muted);
}

.tour-item-icon {
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Step Picker Popover Floating Flyout */
.storyline-step-popover {
  position: fixed;
  z-index: var(--z-ui-floating, 100050);
  width: 280px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.14));
  border-radius: var(--panel-radius, 0px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.storyline-step-popover.is-hidden {
  display: none;
}

.step-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.1));
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  cursor: grab;
  user-select: none;
}

.step-popover-header:active {
  cursor: grabbing;
}

.step-popover-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  box-sizing: border-box;
  border: none;
  background: transparent;
  color: var(--text-secondary, #475569);
  cursor: pointer;
  border-radius: 0;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.step-popover-close-btn:hover {
  background: var(--bg-panel-hover, #f1f5f9);
  color: var(--text-primary, #0f172a);
}

.step-popover-close-btn .material-symbols-outlined {
  font-size: 16px;
}

.step-popover-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  box-sizing: border-box;
}

.step-title-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-title-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary, #475569);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.step-title-input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  box-sizing: border-box;
  background: var(--bg-panel-hover, #f1f5f9);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.18));
  border-radius: 0;
  color: var(--text-primary, #0f172a);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  outline: none;
}

.step-title-input::placeholder {
  color: var(--text-muted, #94a3b8);
  font-weight: 400;
}

.step-title-input:focus {
  background: var(--bg-panel-solid, #ffffff);
  border-color: var(--accent-primary, #2563eb);
  box-shadow: 0 0 0 2px var(--accent-glow, rgba(37, 99, 235, 0.22));
}

.step-next-suggest-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 12px;
  box-sizing: border-box;
  border-radius: 0;
  border: 1px solid var(--border-focus, rgba(37, 99, 235, 0.6));
  background: color-mix(in srgb, var(--accent-primary, #2563eb) 12%, var(--bg-panel-solid, #ffffff));
  color: var(--accent-primary, #2563eb);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.step-next-suggest-btn:hover {
  background: var(--accent-primary, #2563eb);
  border-color: var(--accent-primary, #2563eb);
  color: var(--accent-text, #ffffff);
}

.step-next-suggest-btn .material-symbols-outlined {
  font-size: 16px;
}

.step-grid-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary, #475569);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.step-quick-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.step-quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 0;
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.14));
  background: var(--bg-panel-hover, #f1f5f9);
  color: var(--text-primary, #0f172a);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.step-quick-btn:hover {
  background: var(--bg-panel-solid, #ffffff);
  border-color: var(--accent-primary, #2563eb);
  color: var(--accent-primary, #2563eb);
}

.step-quick-btn.is-current {
  background: var(--accent-primary, #2563eb);
  color: var(--accent-text, #ffffff);
  border-color: var(--accent-primary, #2563eb);
  box-shadow: none;
}

.step-quick-btn.is-taken:not(.is-current) {
  border-style: dashed;
  border-color: var(--border-focus, rgba(37, 99, 235, 0.6));
  color: var(--accent-primary, #2563eb);
}

.step-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  box-sizing: border-box;
  border-top: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.1));
}

.step-custom-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary, #475569);
}

.step-custom-input {
  width: 64px;
  height: 28px;
  padding: 0 6px;
  box-sizing: border-box;
  background: var(--bg-panel-hover, #f1f5f9);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.18));
  border-radius: 0;
  color: var(--text-primary, #0f172a);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.step-custom-input:focus {
  background: var(--bg-panel-solid, #ffffff);
  border-color: var(--accent-primary, #2563eb);
  box-shadow: 0 0 0 2px var(--accent-glow, rgba(37, 99, 235, 0.22));
}

.step-custom-apply-btn {
  flex: 1;
  height: 28px;
  padding: 0 12px;
  box-sizing: border-box;
  border-radius: 0;
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.14));
  background: var(--bg-panel-hover, #f1f5f9);
  color: var(--text-primary, #0f172a);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.step-custom-apply-btn:hover {
  background: var(--accent-primary, #2563eb);
  border-color: var(--accent-primary, #2563eb);
  color: var(--accent-text, #ffffff);
}

.step-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 28px;
  padding: 0;
  box-sizing: border-box;
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: 0;
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.step-clear-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.step-clear-btn .material-symbols-outlined {
  font-size: 15px;
}

/* Active Spotlight Smooth Single-Blink (50% Opacity Dip) on Whole Object */
@keyframes tourObjectBlink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.grid-node.tour-active-spotlight,
.grid-node.has-purpose.tour-active-spotlight,
.grid-node.node-type-shape.tour-active-spotlight,
.grid-node.node-type-frame.tour-active-spotlight,
.grid-node.node-type-audio.is-chameleon-chained.tour-active-spotlight,
.grid-node.node-type-video.is-chameleon-chained.tour-active-spotlight,
.grid-node.node-type-youtube.is-chameleon-chained.tour-active-spotlight {
  box-shadow: none;
  transition: none;
  animation: tourObjectBlink 0.52s ease-in-out forwards;
}

/* =========================================================================
   VANILLA PANNING BASELINE: Zero Easing, Zero Transitions during Pan
   Search Keyword: "VANILLA_PANNING_REFERENCE"
   ========================================================================= */
.viewport.is-panning #world,
.viewport.is-panning .grid-backdrop {
  transition: none;
}

/* ==========================================================================
   CHAMELEON BORDER CHAINING (Recordings touching text notes / cards)
   Zero !important, Zero margin standard
   ========================================================================== */
.grid-node.node-type-audio.is-chameleon-chained,
.grid-node.node-type-video.is-chameleon-chained,
.grid-node.node-type-youtube.is-chameleon-chained {
  --chameleon-color: var(--element-border-color);
  border-color: var(--chameleon-color);
  transition: border-color 0.18s ease;
}

.grid-node.node-type-audio.is-chameleon-chained .audio-mic-icon {
  color: var(--chameleon-color);
}

}

/* === 16-color-tool.css (hud) === */
@layer hud {
/* ==========================================================================
   STAGE 16: UNIFIED COLOR STUDIO & COLOR TOOL POPOVER
   Clean, Modern, High-Precision Palette & Style Studio
   Strict Standards: Zero !important | Zero layout margin | GPU-accelerated
   ========================================================================== */

.gridspace-color-tool {
  position: fixed;
  z-index: var(--z-ui-chrome, 100000);
  width: 280px;
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.12));
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  box-sizing: border-box;
  color: var(--text-primary, #0f172a);
  user-select: none;
  touch-action: none;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1), transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

.gridspace-color-tool.is-open {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.gridspace-color-tool.is-dragging {
  transition: none;
  will-change: transform;
}

.gridspace-color-tool.is-idle .color-tool-sv-wrap,
.gridspace-color-tool.is-idle .color-tool-controls-row,
.gridspace-color-tool.is-idle .color-tool-inputs-container,
.gridspace-color-tool.is-idle .color-tool-border-section,
.gridspace-color-tool.is-idle .color-tool-style-clipboard-row,
.gridspace-color-tool.is-idle .color-tool-swatches-section {
  opacity: 0.4;
  pointer-events: none;
}

.color-tool-idle-banner {
  display: none;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--bg-panel-hover, #f1f5f9);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.08));
  color: var(--text-secondary, #64748b);
  font-size: 11px;
  line-height: 1.35;
}

.gridspace-color-tool.is-idle .color-tool-idle-banner {
  display: block;
}

/* Header & Segmented Tabs */
.color-tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 28px;
  cursor: grab;
}

.gridspace-color-tool.is-dragging .color-tool-header {
  cursor: grabbing;
}

.color-tool-drag-grip {
  font-size: 16px;
  color: var(--text-muted, #94a3b8);
  flex-shrink: 0;
  pointer-events: none;
}

.color-tool-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.color-tool-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #475569);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Modern Segmented Control: Fill / Stroke / Border */
.color-tool-tab-group {
  display: flex;
  align-items: center;
  background: var(--bg-panel-hover, #f1f5f9);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.08));
  box-sizing: border-box;
}

.color-tool-tab-btn {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-secondary, #64748b);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.color-tool-tab-btn:hover {
  color: var(--text-primary, #0f172a);
}

.color-tool-tab-btn.is-active {
  background: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Header Close Button */
.color-tool-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.color-tool-close-btn:hover {
  background: var(--bg-panel-hover, #f1f5f9);
  color: var(--text-primary, #0f172a);
}

.color-tool-close-btn .material-symbols-outlined {
  font-size: 18px;
}

/* 2D Saturation / Value Canvas Field (Hardware Accelerated) */
.color-tool-sv-wrap {
  position: relative;
  width: 100%;
  height: 136px;
  border-radius: 8px;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.10));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
  cursor: crosshair;
  contain: paint layout;
  touch-action: none;
}

.color-tool-sv-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
  pointer-events: none;
}

.color-tool-sv-cursor {
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 5px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  contain: layout paint;
}

/* Controls Row: Eyedropper + Circular Preview Swatch + Sliders Column */
.color-tool-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.color-tool-eyedropper-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.12));
  border-radius: 7px;
  color: var(--text-secondary, #475569);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.color-tool-eyedropper-btn:hover {
  background: var(--bg-panel-solid, #ffffff);
  color: var(--accent-primary, #2563eb);
  border-color: var(--accent-primary, #2563eb);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.15);
}

.color-tool-eyedropper-btn .material-symbols-outlined {
  font-size: 18px;
}

/* Live Preview Swatch (Matches Eyedropper geometry) */
.color-tool-preview-circle-wrap {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.14));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  background-color: #ffffff;
  background-image: 
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}

.color-tool-preview-circle {
  width: 100%;
  height: 100%;
  border-radius: 6px;
}

.color-tool-sliders-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* Hue Slider Track */
.color-tool-hue-track {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right,
    #ff0000 0%,
    #ffff00 17%,
    #00ff00 33%,
    #00ffff 50%,
    #0000ff 67%,
    #ff00ff 83%,
    #ff0000 100%
  );
  cursor: pointer;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.color-tool-hue-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Alpha Opacity Track (Checkerboard + Gradient) */
.color-tool-alpha-track {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background-color: #ffffff;
  background-image: 
    linear-gradient(45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cbd5e1 75%),
    linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
  background-size: 6px 6px;
  background-position: 0 0, 0 3px, 3px -3px, -3px 0;
  cursor: pointer;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: none;
}

.gridspace-color-tool.has-alpha-enabled .color-tool-alpha-track {
  display: block;
}

.color-tool-alpha-gradient {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.color-tool-alpha-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Chrome DevTools-style Inputs Row */
.color-tool-inputs-container {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
}

.color-tool-channels-wrap {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.color-tool-channel-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.color-tool-channel-box {
  width: 100%;
  height: 28px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.12));
  border-radius: 6px;
  color: var(--text-primary, #0f172a);
  font-size: 12px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  text-align: center;
  padding: 0 4px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  -moz-appearance: textfield;
}

.color-tool-channel-box::-webkit-outer-spin-button,
.color-tool-channel-box::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.color-tool-channel-box:focus {
  border-color: var(--accent-primary, #2563eb);
  background: var(--bg-panel-solid, #ffffff);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.color-tool-channel-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
}

/* Hex input box wrapper */
.color-tool-hex-box-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  height: 28px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.12));
  border-radius: 6px;
  padding: 0 8px;
  box-sizing: border-box;
  gap: 4px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.color-tool-hex-box-wrap:focus-within {
  border-color: var(--accent-primary, #2563eb);
  background: var(--bg-panel-solid, #ffffff);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.color-tool-hex-prefix {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
}

.color-tool-hex-input-field {
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  text-transform: uppercase;
  font-family: monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  width: 100%;
  outline: none;
}

/* Format Switcher Button */
.color-tool-format-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.12));
  border-radius: 6px;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.color-tool-format-toggle-btn .material-symbols-outlined {
  font-size: 18px;
}

.color-tool-format-toggle-btn:hover {
  background: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  border-color: var(--accent-primary, #2563eb);
}

/* Border / Stroke Properties Section */
.color-tool-border-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px 10px;
  background: var(--bg-panel-hover, #f8fafc);
  border-radius: 8px;
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.10));
  box-sizing: border-box;
  width: 100%;
}

.color-tool-border-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.color-tool-border-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 36px;
  flex-shrink: 0;
}

.color-tool-border-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.color-tool-border-slider {
  flex: 1;
  min-width: 0;
  height: 4px;
  accent-color: var(--accent-primary, #2563eb);
  cursor: pointer;
}

.color-tool-border-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.12));
  border-radius: 4px;
  padding: 1px 6px;
  text-align: center;
  min-width: 30px;
  flex-shrink: 0;
}

.color-tool-border-chips-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.color-tool-chip-btn {
  flex: 1;
  min-width: 0;
  height: 23px;
  padding: 0 2px;
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.12));
  border-radius: 5px;
  color: var(--text-secondary, #64748b);
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.color-tool-chip-btn:hover {
  background: var(--bg-panel-hover, #f1f5f9);
  color: var(--text-primary, #0f172a);
  border-color: var(--accent-primary, #2563eb);
}

.color-tool-chip-btn.is-active {
  background: var(--accent-primary, #2563eb);
  color: #ffffff;
  border-color: var(--accent-primary, #2563eb);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

/* Copy Style / Paste Style Row */
.color-tool-style-clipboard-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.color-tool-clipboard-btn {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.12));
  border-radius: 6px;
  color: var(--text-secondary, #64748b);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.color-tool-clipboard-btn:hover:not(:disabled) {
  background: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  border-color: var(--accent-primary, #2563eb);
}

.color-tool-clipboard-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.color-tool-clipboard-btn .material-symbols-outlined {
  font-size: 14px;
}

.color-tool-clipboard-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.25));
  flex-shrink: 0;
  display: none;
}

.color-tool-clipboard-swatch.has-swatch {
  display: inline-block;
}

/* Swatches Sections */
.color-tool-swatches-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-tool-swatches-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.color-tool-swatches-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.color-tool-swatch-item {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.14));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.12s ease, box-shadow 0.12s ease, outline 0.12s ease;
}

.color-tool-swatch-item:hover {
  transform: scale(1.15);
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.color-tool-swatch-item.is-selected {
  outline: 2px solid var(--accent-primary, #2563eb);
  outline-offset: 2px;
}

/* Floating Style Action HUD Toast */
.gridspace-shortcut-toast {
  position: fixed;
  bottom: calc(var(--viewport-edge-pad-bottom, 16px) + var(--panel-height, 34px) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: #0f172a;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: var(--z-ui-toast, 100300);
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.gridspace-shortcut-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

}

/* === 19-share-popover.css (hud) === */
@layer hud {
/* ==========================================================================
   SHARE POPOVER & UNAVAILABLE STATE OVERLAY
   Strict Standards: Zero !important, Zero margin, Zero backdrop-filter
   ========================================================================== */

.share-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted, #94a3b8);
  flex-shrink: 0;
}

.share-status-dot.is-active {
  background: #10b981;
}

.share-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  padding: 12px;
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.1));
  border-radius: var(--panel-radius, 0px);
  color: var(--text-primary, #0f172a);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  z-index: var(--z-ui-chrome, 100000);
}

.share-popover.is-hidden {
  display: none;
}

.share-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.share-popover-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.share-popover-icon {
  font-size: 16px;
  color: var(--accent-primary, #2563eb);
}

.share-popover-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.share-popover-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-state-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-panel-hover, #f1f5f9);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.1));
  color: var(--text-secondary, #475569);
}

.share-state-badge.is-active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.share-toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 34px;
  height: 20px;
  padding: 2px;
  background: var(--border-subtle, rgba(15, 23, 42, 0.18));
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.16));
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.share-toggle-switch[aria-checked="true"] {
  background: var(--accent-primary, #2563eb);
  border-color: var(--accent-primary, #2563eb);
}

.share-toggle-switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.share-toggle-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  transform: translateX(0);
  transition: transform 0.15s ease;
}

.share-toggle-switch[aria-checked="true"] .share-toggle-thumb {
  transform: translateX(14px);
}

.share-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary, #475569);
  cursor: pointer;
}

.share-close-btn:hover {
  background: var(--bg-panel-hover, #f1f5f9);
  color: var(--text-primary, #0f172a);
}

.share-close-btn .material-symbols-outlined {
  font-size: 16px;
}

.share-popover-caption {
  padding: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary, #475569);
}

.share-link-section {
  display: flex;
  align-items: stretch;
  gap: 6px;
  transition: opacity 0.15s ease;
}

.share-link-section.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.share-url-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  background: var(--bg-canvas, #f5f6f8);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.12));
  border-radius: var(--panel-radius, 0px);
  color: var(--text-primary, #0f172a);
  font-family: var(--font-mono);
  font-size: 11px;
  outline: none;
}

.share-url-input:focus {
  border-color: var(--accent-primary, #2563eb);
}

.share-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  background: var(--accent-primary, #2563eb);
  border: 1px solid var(--accent-primary, #2563eb);
  border-radius: var(--panel-radius, 0px);
  color: var(--accent-text, #ffffff);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.share-copy-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.share-copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.share-copy-btn .material-symbols-outlined {
  font-size: 14px;
}

.share-popover-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.share-secondary-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  background: var(--bg-panel-hover, #f1f5f9);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.1));
  border-radius: var(--panel-radius, 0px);
  color: var(--text-primary, #0f172a);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.share-secondary-btn:hover:not(:disabled) {
  border-color: var(--accent-primary, #2563eb);
}

.share-secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.share-secondary-btn .material-symbols-outlined {
  font-size: 14px;
}

.share-secondary-btn.is-confirming {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

/* Share Unavailable / Revoked Visitor Overlay */
.share-unavailable-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: transparent;
  z-index: var(--z-ui-modal, 100200);
}

.share-unavailable-overlay.is-hidden {
  display: none;
}

.share-unavailable-card {
  width: 100%;
  max-width: 360px;
  padding: 28px 24px;
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.12));
  border-radius: var(--panel-radius, 0px);
  color: var(--text-primary, #0f172a);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.share-unavailable-icon {
  font-size: 32px;
  color: var(--text-muted, #94a3b8);
}

.share-unavailable-title {
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.share-unavailable-message {
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary, #475569);
}

}

/* === 20-screen-recorder.css (hud) === */
@layer hud {
/* ==========================================================================
   SCREEN VIDEO RECORDER HUD & DOCK INDICATOR
   Strict Standards: Zero !important, Zero margin, Zero backdrop-filter: blur()
   ========================================================================== */

/* Draggable Floating Screen Video Recorder Quick Trigger Widget */
.floating-screen-rec-widget {
  position: fixed;
  top: 342px;
  right: 24px;
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  touch-action: none;
}

body.is-logged-off .floating-screen-rec-widget,
body.is-logged-off #floating-screen-rec-widget {
  display: none;
}

.floating-screen-rec-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  box-sizing: border-box;
  background: #ffffff;
  border: 1.5px solid var(--border-subtle, #e2e8f0);
  border-radius: 50%;
  color: #1f1f1f;
  box-shadow: none;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.floating-screen-rec-trigger:active,
.floating-screen-rec-widget.is-dragging .floating-screen-rec-trigger {
  cursor: grabbing;
}

.floating-screen-rec-widget.is-active .floating-screen-rec-trigger,
.floating-screen-rec-trigger.is-active {
  background: var(--accent-primary, #1f1f1f);
  border-color: var(--accent-primary, #1f1f1f);
  color: #ffffff;
}

.floating-screen-rec-widget.is-recording .floating-screen-rec-trigger,
.floating-screen-rec-trigger.is-recording {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.22);
}

.floating-screen-rec-trigger-icon {
  width: 21px;
  height: 21px;
  display: block;
  pointer-events: none;
}

.screen-recorder-hud {
  position: fixed;
  left: 68px;
  top: 140px;
  width: 264px;
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  color: var(--text-primary);
  pointer-events: auto;
  user-select: none;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.screen-recorder-hud.is-recording {
  width: auto;
  padding: 6px 10px;
}

.screen-recorder-hud.is-dragging {
  will-change: transform;
}

.screen-recorder-hud.is-hidden,
body.is-logged-off .screen-recorder-hud {
  display: none;
}

.screen-recorder-hud .is-hidden {
  display: none;
}

.screen-rec-setup {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.screen-rec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.screen-rec-drag-handle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  cursor: grab;
  color: var(--text-primary);
  touch-action: none;
}

.screen-recorder-hud.is-dragging .screen-rec-drag-handle {
  cursor: grabbing;
}

.screen-rec-drag-handle .material-symbols-outlined {
  font-size: 16px;
  color: var(--text-muted);
}

.screen-rec-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.screen-rec-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--panel-radius);
  color: var(--text-secondary);
  cursor: pointer;
}

.screen-rec-icon-btn:hover {
  background: var(--bg-panel-hover);
  color: var(--text-primary);
}

.screen-rec-icon-btn .material-symbols-outlined {
  font-size: 16px;
}

.screen-rec-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.screen-rec-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.screen-rec-preset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 6px;
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.screen-rec-preset-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.screen-rec-preset-btn.is-active {
  background: var(--accent-glow);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  font-weight: 600;
}

.screen-rec-preset-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.screen-rec-toggles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.screen-rec-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.screen-rec-chip .material-symbols-outlined {
  font-size: 15px;
}

.screen-rec-chip:hover {
  background: var(--bg-panel-hover);
  color: var(--text-primary);
}

.screen-rec-chip.is-on {
  background: var(--bg-panel-hover);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.screen-rec-chip.is-on .material-symbols-outlined {
  color: var(--accent-primary);
}

.screen-rec-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  padding: 0 12px;
  background: #ef4444;
  border: 1px solid #ef4444;
  border-radius: var(--panel-radius);
  color: #ffffff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.screen-rec-start-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.screen-rec-start-btn .material-symbols-outlined {
  font-size: 16px;
}

.screen-rec-live {
  display: flex;
  align-items: center;
  gap: 8px;
}

.screen-rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: screen-rec-pulse 1.1s ease-in-out infinite;
}

.screen-recorder-hud.is-paused .screen-rec-dot {
  animation-play-state: paused;
  opacity: 0.4;
  background: #f59e0b;
}

@keyframes screen-rec-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.screen-rec-clock,
.screen-rec-size {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.screen-rec-size {
  color: var(--text-secondary);
  font-weight: 500;
}

.screen-rec-live-btn,
.screen-rec-stop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border-radius: var(--panel-radius);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.screen-rec-live-btn {
  width: 26px;
  padding: 0;
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.screen-rec-live-btn:hover {
  border-color: var(--border-focus);
}

.screen-rec-live-btn .material-symbols-outlined {
  font-size: 15px;
}

.screen-rec-stop-btn {
  background: #ef4444;
  border: 1px solid #ef4444;
  color: #ffffff;
}

.screen-rec-stop-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.screen-rec-stop-btn .material-symbols-outlined {
  font-size: 15px;
}

.screen-rec-discard-btn:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.45);
}

.screen-rec-status {
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.35;
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  background: var(--bg-panel-hover);
  color: var(--text-secondary);
}

.screen-rec-status.is-error {
  border-color: rgba(239, 68, 68, 0.45);
  color: #ef4444;
}

.screen-rec-status.is-warn {
  border-color: rgba(245, 158, 11, 0.45);
  color: #d97706;
}

}

/* === 22-sticky-video-player.css (hud) === */
@layer hud {
/* ==========================================================================
   STICKY FLOATING BOTTOM-RIGHT VIDEO PLAYER MODAL
   Strict Standards: Zero !important, Zero margin, Zero backdrop-filter: blur()
   ========================================================================== */

.sticky-video-modal {
  position: fixed;
  right: var(--viewport-edge-pad-right, 14px);
  bottom: var(--viewport-edge-pad-bottom, 14px);
  z-index: var(--z-ui-floating, 100050);
  width: min(480px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  box-sizing: border-box;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  color: var(--text-primary);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
  pointer-events: auto;
  user-select: none;
  overflow: hidden;
}

.sticky-video-modal.is-expanded {
  width: min(680px, calc(100vw - 28px));
}

.sticky-video-modal.is-hidden {
  display: none;
}

/* Hide bottom-right settings trigger while sticky player covers that corner */
body.has-sticky-video-player #floating-settings-dock {
  visibility: hidden;
  pointer-events: none;
}

body.is-logged-off .sticky-video-modal,
body.is-project-space-mode .sticky-video-modal {
  display: none;
}

.sticky-video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel-solid);
  min-height: 32px;
}

.sticky-video-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.sticky-video-type-icon {
  font-size: 16px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.sticky-video-title {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.sticky-video-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.sticky-video-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--panel-radius);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

.sticky-video-btn:hover {
  background: var(--bg-panel-hover);
  color: var(--text-primary);
}

.sticky-video-btn-close:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.sticky-video-btn .material-symbols-outlined {
  font-size: 16px;
}

.sticky-video-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--sticky-video-aspect, 16 / 9);
  max-height: min(52vh, 360px);
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sticky-video-modal.is-expanded .sticky-video-stage {
  max-height: min(68vh, 520px);
}

.sticky-video-stage .node-media-video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: auto;
  cursor: pointer;
  background: #000000;
}

.sticky-video-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-panel-solid);
}

.sticky-video-scrubber-track {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(128, 128, 128, 0.24);
  cursor: pointer;
  display: flex;
  align-items: center;
  touch-action: none;
}

.sticky-video-scrubber-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent-primary, #6366f1);
  pointer-events: none;
}

.sticky-video-scrubber-thumb {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.24);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.sticky-video-scrubber-track:hover .sticky-video-scrubber-thumb {
  transform: translate(-50%, -50%) scale(1.3);
}

.sticky-video-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.sticky-video-controls-left,
.sticky-video-controls-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sticky-video-time {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  padding: 0 4px;
}

.sticky-video-speed-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  color: var(--text-primary);
  cursor: pointer;
}

.sticky-video-speed-btn:hover {
  border-color: var(--border-focus);
}

/* Source canvas node placeholder while video is docked in corner player */
.video-sticky-placeholder {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background: #0f1117;
  color: #e2e8f0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  text-align: center;
  box-sizing: border-box;
}

.grid-node.node-type-video.is-sticky-detached .video-sticky-placeholder {
  display: flex;
}

.video-sticky-placeholder-icon {
  font-size: 26px;
  color: var(--accent-primary, #6366f1);
}

.video-sticky-placeholder-text {
  font-size: 11px;
  font-weight: 500;
  color: #cbd5e1;
}

.video-sticky-dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--panel-radius);
  color: #f8fafc;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.video-sticky-dock-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--accent-primary, #6366f1);
}

.video-sticky-dock-btn .material-symbols-outlined {
  font-size: 14px;
}

.grid-node.node-type-video.is-sticky-detached .btn-video-popout {
  color: var(--accent-primary, #6366f1);
}

@media (max-width: 640px) {
  .sticky-video-modal,
  .sticky-video-modal.is-expanded {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 12px;
  }
}

}

/* === 25-floating-home-dock.css (hud) === */
@layer hud {
/* ==========================================================================
   UNIFIED LEFT-EDGE TOOL & MAGNETIC FLOATING TOOLS HOME DOCK
   Left-centered white shell > single-column circular sockets > core + floating tools.
   Standards: Zero !important, Zero margin, Zero backdrop-filter: blur()
   ========================================================================== */

.floating-tools-home-dock {
  --home-shell-bg: #ffffff;
  --home-shell-border: var(--border-subtle, #e2e8f0);
  --home-slot-bg: #f1f5f9;
  --home-slot-border: #e2e8f0;
  --home-btn-bg: #ffffff;
  --home-btn-hover-bg: #f8fafc;
  --home-btn-border: var(--border-subtle, #e2e8f0);
  --home-btn-fg: var(--text-primary, #0f172a);
  --home-btn-active-bg: #2563eb;
  --home-btn-active-fg: #ffffff;
  --home-magnet-accent: #2563eb;
  --dock-slot-size: 48px;
  --dock-btn-size: 40px;
  --dock-slot-gap: 8px;
  --dock-shell-pad: 7px;

  position: fixed;
  left: var(--viewport-edge-pad-left, 18px);
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  touch-action: none;
}

@media (max-height: 860px) {
  .floating-tools-home-dock {
    --dock-slot-size: 42px;
    --dock-btn-size: 34px;
    --dock-slot-gap: 6px;
    --dock-shell-pad: 6px;
  }
}

@media (max-height: 740px) {
  .floating-tools-home-dock {
    --dock-slot-size: 38px;
    --dock-btn-size: 31px;
    --dock-slot-gap: 5px;
    --dock-shell-pad: 5px;
  }
}

body.is-logged-off #floating-tools-home-dock,
body.is-viewer-mode #floating-tools-home-dock,
body.is-project-space-mode #floating-tools-home-dock,
body.is-mobile-preview-system #floating-tools-home-dock,
body.is-mobile-constrained #floating-tools-home-dock,
body.is-logged-off #floating-history-dock,
body.is-viewer-mode #floating-history-dock,
body.is-project-space-mode #floating-history-dock,
body.is-mobile-preview-system #floating-history-dock,
body.is-mobile-constrained #floating-history-dock,
body.is-mobile-constrained #floating-pen-widget {
  display: none;
}

/* ==========================================================================
   TOP-RIGHT FIXED HISTORY PILL (UNDO / REDO — NON-DRAGGABLE HOME DOCK PARITY)
   ========================================================================== */

.floating-history-dock {
  --home-shell-bg: #ffffff;
  --home-shell-border: var(--border-subtle, #e2e8f0);
  --home-slot-bg: #f1f5f9;
  --home-slot-border: #e2e8f0;
  --home-btn-bg: #ffffff;
  --home-btn-hover-bg: #f8fafc;
  --home-btn-border: var(--border-subtle, #e2e8f0);
  --home-btn-fg: var(--text-primary, #0f172a);

  position: fixed;
  top: var(--viewport-edge-pad-top, 16px);
  right: 18px;
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  align-items: center;
  pointer-events: none;
  user-select: none;
}

.floating-history-dock-shell {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 7px;
  background: var(--home-shell-bg);
  border: 1px solid var(--home-shell-border);
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  pointer-events: auto;
}

.history-dock-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--home-slot-bg);
  border: 1.5px solid var(--home-slot-border);
}

.history-dock-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--home-btn-bg, #ffffff);
  border: 1.5px solid var(--home-btn-border, #e2e8f0);
  color: var(--home-btn-fg, #0f172a);
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, opacity 0.14s ease, transform 0.12s ease;
}

.history-dock-btn .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
}

.history-dock-btn:hover:not(:disabled) {
  background: var(--home-btn-hover-bg, #f8fafc);
  border-color: #cbd5e1;
}

.history-dock-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.history-dock-btn:disabled {
  opacity: 0.42;
  color: var(--text-muted, #94a3b8);
  cursor: not-allowed;
}

/* White Outer Unified Single-Column Home Container */
.floating-home-dock-shell {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--dock-slot-gap, 8px);
  padding: var(--dock-shell-pad, 7px);
  background: var(--home-shell-bg);
  border: 1px solid var(--home-shell-border);
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  pointer-events: auto;
}

.home-dock-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--dock-slot-gap, 8px);
}

/* Static Recessed Circular Socket (Core Canvas Tools — History/Settings Parity) */
.home-dock-static-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--dock-slot-size, 48px);
  height: var(--dock-slot-size, 48px);
  padding: 0;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--home-slot-bg);
  border: 1.5px solid var(--home-slot-border);
}

.home-dock-static-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--dock-btn-size, 40px);
  height: var(--dock-btn-size, 40px);
  padding: 0;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--home-btn-bg, #ffffff);
  border: 1.5px solid var(--home-btn-border, #e2e8f0);
  color: var(--home-btn-fg, #0f172a);
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.12s ease;
}

.home-dock-static-btn .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
}

.home-dock-static-btn svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.home-dock-static-btn:hover:not(:disabled):not(.is-active) {
  background: var(--home-btn-hover-bg, #f8fafc);
  border-color: #cbd5e1;
}

.home-dock-static-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.home-dock-static-btn:disabled {
  opacity: 0.42;
  color: var(--text-muted, #94a3b8);
  cursor: not-allowed;
}

.home-dock-static-btn.is-active {
  background: var(--home-btn-active-bg, #2563eb);
  border-color: var(--home-btn-active-bg, #2563eb);
  color: var(--home-btn-active-fg, #ffffff);
}

.home-dock-static-btn.is-active:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: var(--home-btn-active-fg, #ffffff);
}

/* Contextual Node Selection Actions (Paired White Capsule Rail Right of Left Dock) */
.floating-selection-actions-shell {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 7px;
  box-sizing: border-box;
  background: var(--home-shell-bg);
  border: 1px solid var(--home-shell-border);
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  pointer-events: auto;
}

.floating-selection-actions-shell.is-visible {
  display: flex;
}

.selection-dock-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--home-slot-bg);
  border: 1.5px solid var(--home-slot-border);
}

.selection-dock-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--home-btn-bg, #ffffff);
  border: 1.5px solid var(--home-btn-border, #e2e8f0);
  color: var(--home-btn-fg, #0f172a);
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.12s ease;
}

.selection-dock-btn .material-symbols-outlined {
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

.selection-dock-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.selection-dock-btn:hover:not(:disabled):not(.is-active) {
  background: var(--home-btn-hover-bg, #f8fafc);
  border-color: #cbd5e1;
}

.selection-dock-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.selection-dock-btn.is-active {
  background: var(--home-btn-active-bg, #2563eb);
  border-color: var(--home-btn-active-bg, #2563eb);
  color: var(--home-btn-active-fg, #ffffff);
}

.selection-dock-btn.is-active:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: var(--home-btn-active-fg, #ffffff);
}

.selection-dock-btn-danger:hover:not(:disabled) {
  background: #fef2f2;
  border-color: rgba(239, 68, 68, 0.45);
  color: #ef4444;
}

/* Full-Circle Child Container (Home Socket) */
.home-dock-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--dock-slot-size, 48px);
  height: var(--dock-slot-size, 48px);
  padding: 0;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--home-slot-bg);
  border: 1.5px solid var(--home-slot-border);
  color: #64748b;
  pointer-events: auto;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.home-dock-slot.is-occupied {
  cursor: default;
}

.home-dock-slot.is-empty {
  cursor: pointer;
}

.home-dock-slot-ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  color: #475569;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.home-dock-slot.is-empty:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.home-dock-slot.is-empty:hover .home-dock-slot-ghost {
  opacity: 0.6;
}

.home-dock-slot.is-empty:focus-visible {
  outline: 2px solid #94a3b8;
  outline-offset: 2px;
}

.home-dock-slot.is-magnet-target {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.home-dock-slot.is-magnet-target .home-dock-slot-ghost {
  opacity: 0.55;
}

/* Contextual Collect-All Recall Pill (Anchored Below Shell — Zero Layout Shift) */
.home-dock-collect-btn {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--home-shell-border);
  border-radius: 9999px;
  background: var(--home-shell-bg);
  color: #0f172a;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

.home-dock-collect-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateX(-50%) translateY(-1px);
}

.home-dock-collect-btn:active {
  transform: translateX(-50%) scale(0.96);
}

.home-dock-collect-btn.is-hidden {
  display: none;
}

.home-dock-collect-icon {
  display: block;
  flex-shrink: 0;
}

.home-dock-away-count {
  font-size: 11px;
  line-height: 1;
  color: #475569;
}

/* ==========================================================================
   TOOL CONTAINERS (NESTED INSIDE CIRCULAR SLOT WHEN DOCKED, FIXED WHEN FREE)
   ========================================================================== */

#floating-pen-widget,
#floating-voice-widget,
#floating-arrow-widget,
#floating-polygon-widget,
#floating-timer-widget,
#floating-screen-rec-widget,
#floating-emoji-widget {
  position: fixed;
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  touch-action: none;
}

/* True Container-Inside-Container Positioning When Docked Inside Circular Slot */
#floating-pen-widget.is-docked,
#floating-voice-widget.is-docked,
#floating-arrow-widget.is-docked,
#floating-polygon-widget.is-docked,
#floating-timer-widget.is-docked,
#floating-screen-rec-widget.is-docked,
#floating-emoji-widget.is-docked {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  z-index: 1;
}

/* Elevate Actively Dragged Widget Above Home Shell & Other Tools */
.has-home-dock.is-dragging {
  z-index: calc(var(--z-ui-floating, 100050) + 10);
  will-change: left, top;
}

/* GPU FLIP Snap-Home Transition */
.has-home-dock.is-snapping-home {
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

/* Circular Tool Button Inside Dedicated Container (Matches Parent Container Background) */
.floating-pen-trigger,
.floating-voice-trigger,
.floating-arrow-trigger,
.floating-polygon-trigger,
.floating-timer-trigger,
.floating-screen-rec-trigger,
.floating-emoji-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--dock-btn-size, 40px);
  height: var(--dock-btn-size, 40px);
  padding: 0;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--home-btn-bg, #ffffff);
  border: 1.5px solid var(--home-btn-border, #e2e8f0);
  color: var(--home-btn-fg, #0f172a);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

/* Flush Inside Circular Home Socket When Docked */
.has-home-dock.is-docked .floating-pen-trigger,
.has-home-dock.is-docked .floating-voice-trigger,
.has-home-dock.is-docked .floating-arrow-trigger,
.has-home-dock.is-docked .floating-polygon-trigger,
.has-home-dock.is-docked .floating-timer-trigger,
.has-home-dock.is-docked .floating-screen-rec-trigger,
.has-home-dock.is-docked .floating-emoji-trigger {
  box-shadow: none;
}

.floating-pen-trigger:hover,
.floating-voice-trigger:hover,
.floating-arrow-trigger:hover,
.floating-polygon-trigger:hover,
.floating-timer-trigger:hover,
.floating-screen-rec-trigger:hover,
.floating-emoji-trigger:hover {
  background: var(--home-btn-hover-bg, #f8fafc);
  border-color: #cbd5e1;
}

.has-home-dock.is-dragging .floating-pen-trigger,
.has-home-dock.is-dragging .floating-voice-trigger,
.has-home-dock.is-dragging .floating-arrow-trigger,
.has-home-dock.is-dragging .floating-polygon-trigger,
.has-home-dock.is-dragging .floating-timer-trigger,
.has-home-dock.is-dragging .floating-screen-rec-trigger,
.has-home-dock.is-dragging .floating-emoji-trigger {
  cursor: grabbing;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.20);
}

/* Crisp Icon Inheritance Across All 7 Triggers */
.floating-pen-trigger-icon,
.floating-arrow-trigger-icon,
.floating-polygon-trigger-icon,
.floating-voice-trigger-icon,
.floating-timer-trigger-icon,
.floating-screen-rec-trigger-icon,
.floating-emoji-trigger-icon {
  color: inherit;
  pointer-events: none;
}

.floating-emoji-trigger-icon {
  font-size: 20px;
  line-height: 1;
}

/* Pen / Eraser SVG Toggle (Immune to unlayered Google Fonts display overrides) */
.floating-pen-svg-icon,
.floating-pen-eraser-icon {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.floating-pen-svg-icon {
  display: block;
}

.floating-pen-eraser-icon {
  display: none;
}

.floating-pen-trigger-icon.is-eraser .floating-pen-svg-icon {
  display: none;
}

.floating-pen-trigger-icon.is-eraser .floating-pen-eraser-icon {
  display: block;
}

/* Active Tool States */
.floating-pen-widget.is-active-tool .floating-pen-trigger,
.floating-pen-trigger.is-active,
.floating-arrow-widget.is-active-tool .floating-arrow-trigger,
.floating-arrow-trigger.is-active,
.floating-polygon-widget.is-active-tool .floating-polygon-trigger,
.floating-polygon-trigger.is-active,
.floating-timer-widget.is-active-tool .floating-timer-trigger,
.floating-timer-trigger.is-active,
.floating-screen-rec-widget.is-active .floating-screen-rec-trigger,
.floating-screen-rec-trigger.is-active,
.floating-emoji-trigger.is-active {
  background: var(--home-btn-active-bg, #2563eb);
  border-color: var(--home-btn-active-bg, #2563eb);
  color: var(--home-btn-active-fg, #ffffff);
}

.floating-pen-widget.is-active-tool .floating-pen-trigger:hover,
.floating-pen-trigger.is-active:hover,
.floating-arrow-widget.is-active-tool .floating-arrow-trigger:hover,
.floating-arrow-trigger.is-active:hover,
.floating-polygon-widget.is-active-tool .floating-polygon-trigger:hover,
.floating-polygon-trigger.is-active:hover,
.floating-timer-widget.is-active-tool .floating-timer-trigger:hover,
.floating-timer-trigger.is-active:hover,
.floating-screen-rec-widget.is-active .floating-screen-rec-trigger:hover,
.floating-screen-rec-trigger.is-active:hover,
.floating-emoji-trigger.is-active:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: var(--home-btn-active-fg, #ffffff);
}

/* Project Clock Count Badge on Floating Timer Trigger */
.floating-timer-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: var(--home-btn-active-bg, #2563eb);
  border: 1.5px solid #ffffff;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.floating-timer-count-badge.is-hidden {
  display: none;
}

.floating-timer-widget.is-active-tool .floating-timer-count-badge,
.floating-timer-trigger.is-active .floating-timer-count-badge {
  background: #0f172a;
  border-color: #ffffff;
  color: #ffffff;
}

/* Active Recording States (Voice & Screen Recorder) */
.floating-voice-widget.is-recording .floating-voice-trigger,
.floating-voice-trigger.is-recording,
.floating-screen-rec-widget.is-recording .floating-screen-rec-trigger,
.floating-screen-rec-trigger.is-recording {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25);
}

/* ==========================================================================
   DOCKED SUB-PANEL FLYOUTS (OPEN RIGHT OF WHITE LEFT-EDGE SHELL)
   ========================================================================== */

.floating-pen-widget.is-docked .floating-pen-panel,
.floating-arrow-widget.is-docked .floating-arrow-panel {
  position: absolute;
  left: calc(100% + 18px);
  right: auto;
  top: -4px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
}

.floating-pen-widget.is-docked .pen-smoothing-flyout {
  left: calc(100% + 8px);
  right: auto;
}

}

/* === 26-custom-hotkeys.css (hud) === */
@layer hud {
/* ==========================================================================
   ZBRUSH-STYLE CUSTOM HOTKEYS LISTENING BANNER & STYLE STUDIO MANAGER
   Standards: Zero !important, Zero layout margin, Zero backdrop-filter: blur()
   ========================================================================== */

/* Top-Center Live Hotkey Listening Banner */
.hotkey-listen-banner {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-ui-toast, 100400);
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(92vw, 680px);
  padding: 10px 14px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #3b82f6;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
  pointer-events: auto;
  user-select: none;
}

.hotkey-listen-banner.is-hidden {
  display: none;
}

.hotkey-listen-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hotkey-listen-icon {
  font-size: 18px;
  color: #60a5fa;
  flex-shrink: 0;
}

.hotkey-listen-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12.5px;
  line-height: 1.35;
  color: #e2e8f0;
}

.hotkey-listen-target {
  color: #ffffff;
  font-weight: 600;
  padding: 2px 7px;
  background: rgba(59, 130, 246, 0.24);
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 6px;
}

.hotkey-listen-hints {
  color: #94a3b8;
  font-size: 11.5px;
}

.hotkey-listen-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.hotkey-listen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  cursor: pointer;
}

.hotkey-listen-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.hotkey-listen-unbind {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(239, 68, 68, 0.16);
}

.hotkey-listen-unbind:hover {
  background: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}

.hotkey-listen-unbind.is-hidden {
  display: none;
}

.hotkey-listen-warning {
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: #fef08a;
  background: rgba(234, 179, 8, 0.16);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 8px;
}

.hotkey-listen-warning.is-hidden {
  display: none;
}

/* Active Listening Highlight Ring on Target UI Button */
.is-hotkey-listening {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.28);
}

/* Compact Hotkeys Manager Section inside Style Studio Drawer */
.hotkeys-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hotkeys-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hotkeys-count-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary, #2563eb);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 999px;
}

.hotkeys-tip {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-secondary, #64748b);
}

.hotkeys-kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  background: var(--bg-panel-hover, #f1f5f9);
  border: 1px solid var(--border-subtle, #cbd5e1);
  border-radius: 4px;
}

.hotkeys-assigned-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
  padding: 2px 0;
}

.hotkeys-empty-note {
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted, #64748b);
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px dashed var(--border-subtle, #cbd5e1);
  border-radius: 8px;
}

.hotkeys-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 8px;
}

.hotkeys-row.is-unknown-id {
  opacity: 0.78;
}

.hotkeys-row-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.hotkeys-row-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hotkeys-row-unknown-tag {
  flex-shrink: 0;
  padding: 1px 5px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  background: rgba(148, 163, 184, 0.16);
  border-radius: 4px;
}

.hotkeys-row-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.hotkeys-keycap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  background: var(--bg-panel, #ffffff);
  border: 1px solid var(--border-subtle, #cbd5e1);
  border-radius: 6px;
  cursor: pointer;
}

.hotkeys-keycap-btn:hover {
  border-color: var(--accent-primary, #2563eb);
  color: var(--accent-primary, #2563eb);
}

.hotkeys-unbind-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--text-muted, #64748b);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.hotkeys-unbind-btn:hover {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.24);
}

.hotkeys-unbind-btn .material-symbols-outlined {
  font-size: 15px;
}

.hotkeys-actions-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.hotkeys-actions-row .style-btn {
  justify-content: center;
  padding: 6px 8px;
  font-size: 11px;
  gap: 4px;
}

.hotkeys-actions-row .style-btn .material-symbols-outlined {
  font-size: 15px;
}

.hotkeys-reset-btn.is-armed {
  color: #ffffff;
  background: #dc2626;
  border-color: #b91c1c;
}

.hotkeys-reset-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hotkeys-save-status {
  font-size: 10.5px;
  color: var(--text-muted, #64748b);
  text-align: right;
}

}

/* === 02-project-hub.css (modals) === */
@layer modals {
/* ==========================================================================
   PROJECT HUB MODAL
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-ui-modal, 100200);
  background: rgba(0, 0, 0, 0.58);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-backdrop.is-open {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 20px;
}

.hub-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: rgba(128, 128, 128, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
}

.hub-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   GRIDSPACE PROJECT SPACE WALL (Opened via # Gridspace Logo in Corner)
   ========================================================================== */

.project-wall-backdrop {
  z-index: var(--z-ui-modal, 100200);
  align-items: flex-start;
  justify-content: center;
  padding: 32px 28px;
  background: transparent;
  backdrop-filter: none;
  overflow-y: auto;
}

/* Project Manager lives in its own dedicated space on the grid, separate from the Project UI & world */
body.is-project-space-mode .top-bar,
body.is-project-space-mode #world,
body.is-project-space-mode #connections-layer,
body.is-project-space-mode #connection-labels-layer,
body.is-project-space-mode #drawing-layer,
body.is-project-space-mode #drawing-canvas,
body.is-project-space-mode #marquee-box,
body.is-project-space-mode #dropzone-overlay,
body.is-project-space-mode #style-dock,
body.is-project-space-mode .hud-bar,
body.is-project-space-mode #storyline-tour-bar,
body.is-project-space-mode #storyline-step-popover,
body.is-project-space-mode #footer-share-bar,
body.is-project-space-mode #style-drawer,
body.is-project-space-mode #layers-drawer,
body.is-project-space-mode #diagnostic-drawer,
body.is-project-space-mode #rate-source-backdrop,
body.is-project-space-mode #floating-tools-home-dock,
body.is-project-space-mode #floating-history-dock,
body.is-project-space-mode #floating-settings-dock,
body.is-project-space-mode #workspace-settings-backdrop,
body.is-project-space-mode #floating-pen-widget,
body.is-project-space-mode #floating-voice-widget,
body.is-project-space-mode #floating-arrow-widget,
body.is-project-space-mode #floating-timer-widget,
body.is-project-space-mode #floating-polygon-widget,
body.is-project-space-mode #floating-screen-rec-widget,
body.is-project-space-mode #screen-recorder-hud,
body.is-project-space-mode #voice-recorder-hud,
body.is-project-space-mode #polygon-cursor-badge,
body.is-project-space-mode .cutout-cursor-badge,
body.is-project-space-mode .arrow-tag-picker,
body.is-project-space-mode .gridspace-color-tool,
body.is-project-space-mode .transcript-placement-pill,
body.is-project-space-mode #sticky-video-modal {
  display: none;
}

body.is-project-space-mode .grid-backdrop {
  opacity: 1;
  background-color: var(--bg-canvas, #f5f6f8);
  background-position: 0 0, 0 0, 0 0, 0 0;
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(to right, rgba(15, 23, 42, 0.11) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.11) 1px, transparent 1px);
}

.project-wall-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.project-wall-dock {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  box-shadow: none;
}

.project-wall-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.project-wall-title-stack {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex-wrap: wrap;
}

.project-wall-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.project-wall-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.project-wall-breadcrumb[hidden],
.project-folder-header-actions[hidden],
.project-breadcrumb-sep,
.project-breadcrumb-current {
  display: none;
}

.project-wall-header-row .project-folder-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  height: var(--panel-height, 34px);
  padding: 0 12px;
  box-sizing: border-box;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  color: #0f172a;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.project-wall-header-row .project-folder-back-btn .material-symbols-outlined {
  font-size: 16px;
  flex-shrink: 0;
}

.project-wall-header-row .project-folder-back-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: #ffffff;
}

.project-wall-header-row .project-folder-back-btn.is-drop-target {
  border-color: var(--accent-primary);
  background: #dbeafe;
  color: #1d4ed8;
  outline: 2px dashed var(--accent-primary);
  outline-offset: -2px;
}

.project-folder-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.project-wall-header-row .project-folder-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  height: var(--panel-height, 34px);
  padding: 0 12px;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.project-wall-header-row .project-folder-header-btn .material-symbols-outlined {
  font-size: 16px;
  flex-shrink: 0;
}

.project-wall-header-row .project-folder-header-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: #ffffff;
}

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

.project-wall-create-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1.4 1 480px;
  min-width: 260px;
  flex-wrap: wrap;
}

.project-wall-actions-row .project-create-input-top {
  flex: 1;
  min-width: 180px;
  height: 36px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 0 12px;
  box-sizing: border-box;
  font-size: 13px;
  color: #0f172a;
}

.project-canvas-type-picker {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 2px;
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  box-sizing: border-box;
  flex-shrink: 0;
}

.canvas-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  color: #475569;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.canvas-type-btn .material-symbols-outlined {
  font-size: 15px;
}

.canvas-type-btn:hover {
  color: #0f172a;
  background: #ffffff;
}

.canvas-type-btn.is-active {
  background: #ffffff;
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.project-create-input-top:focus {
  border-color: var(--accent-primary);
  outline: none;
}

.project-wall-actions-row .project-create-btn-top {
  height: 36px;
  box-sizing: border-box;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 14px;
}

.project-wall-actions-row .project-create-folder-btn-top {
  height: 36px;
  box-sizing: border-box;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 12px;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid var(--border-subtle);
}

.project-wall-actions-row .project-create-folder-btn-top:hover {
  background: #ffffff;
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.project-wall-actions-row .project-create-folder-btn-top[hidden] {
  display: none;
}

.project-wall-close-btn {
  flex-shrink: 0;
}

.project-wall-control-card {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.project-wall-search-card {
  flex: 1 1 280px;
  min-width: 220px;
}

.project-wall-actions-row .project-wall-search-bar {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  gap: 10px;
}

.project-wall-search-bar:focus-within {
  background: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: none;
}

.project-wall-search-bar .project-search-input {
  font-size: 13px;
}

.project-wall-count-pill {
  font-size: 11px;
  color: #64748b;
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 0;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.project-wall-surface-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.projects-list-container.project-wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  align-items: stretch;
  gap: 14px;
  max-height: none;
  overflow: visible;
}

/* Search Bar */
.project-search-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 6px 12px;
  box-sizing: border-box;
}

.project-search-container:focus-within {
  border-color: var(--accent-primary);
}

.project-search-icon {
  font-size: 18px;
  color: #64748b;
  flex-shrink: 0;
  user-select: none;
}

.project-search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #0f172a;
  font-family: inherit;
  font-size: 13px;
}

.project-search-input::placeholder {
  color: #94a3b8;
  opacity: 1;
}

.project-search-clear-btn {
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
}

.project-search-clear-btn span {
  font-size: 16px;
}

.project-empty-search {
  grid-column: 1 / -1;
  padding: 36px 20px;
  text-align: center;
  color: var(--text-secondary);
  background: #ffffff;
  border: 1px dashed var(--border-medium);
  border-radius: 0;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.project-empty-search .material-symbols-outlined {
  font-size: 32px;
  opacity: 0.6;
}

/* Horizontal Project Card (150x150px Square Thumbnail Left + Full-Height Details Right) */
.project-item-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  grid-template-rows: 150px;
  gap: 0;
  padding: 0;
  background: #ffffff;
  opacity: 1;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.project-item-card:hover {
  background: #ffffff;
  opacity: 1;
}

.project-item-card.is-active {
  border-color: var(--accent-primary);
  box-shadow: none;
}

.project-item-card.is-dragging-card {
  opacity: 0.48;
}

/* Horizontal Project Folder Card (150x150px Thumbnail Left + 26px Tab Bar & 124px Details Right = exact 150px height) */
.project-folder-card {
  grid-template-columns: 150px minmax(0, 1fr);
  grid-template-rows: 26px 124px;
  border-color: #cbd5e1;
}

.project-folder-card.is-drop-target {
  border-color: var(--accent-primary);
  outline: 2px dashed var(--accent-primary);
  outline-offset: -2px;
}

.project-folder-tab-bar {
  grid-column: 2;
  grid-row: 1;
  height: 26px;
  padding: 4px 12px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #0f172a;
  color: #ffffff;
  border-bottom: 1px solid #0f172a;
}

.project-folder-card.is-active .project-folder-tab-bar {
  background: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.project-folder-tab-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}

.project-folder-tab-label .material-symbols-outlined {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 15px;
  transform: scale(0.68);
  transform-origin: center;
  flex-shrink: 0;
}

.project-folder-tab-count {
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
}

.project-folder-card.is-active .project-folder-tab-count {
  color: #ffffff;
}

.project-folder-card .project-wall-frame.project-folder-frame {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 150px;
  height: 150px;
}

.project-folder-card .project-item-main {
  grid-column: 2;
  grid-row: 2;
}

.project-folder-blueprint svg {
  width: 44px;
  height: 44px;
}

.project-folder-badge {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.project-folder-icon-solid {
  color: #0f172a;
}

.project-folder-card.is-active .project-folder-icon-solid {
  color: var(--accent-primary);
}

.project-folder-blueprint {
  background: #f1f5f9;
}

.folder-blueprint-stack {
  position: relative;
  width: 112px;
  height: 58px;
}

.folder-blueprint-sheet {
  position: absolute;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
}

.folder-blueprint-sheet.s1 {
  top: 0;
  left: 14px;
  width: 84px;
  height: 44px;
  border-color: #94a3b8;
}

.folder-blueprint-sheet.s2 {
  top: 7px;
  left: 7px;
  width: 90px;
  height: 46px;
  border-color: #93c5fd;
}

.folder-blueprint-sheet.s3 {
  top: 14px;
  left: 0;
  width: 96px;
  height: 44px;
  border-color: var(--accent-primary);
}

.project-search-folder-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: #0f172a;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-search-folder-chip .material-symbols-outlined {
  font-size: 12px;
  flex-shrink: 0;
}

/* DEDICATED FOLDER STRUCTURE MODAL */
.folder-structure-modal-card { max-width: 960px; width: 95%; max-height: 88vh; display: flex; flex-direction: column; }
.folder-structure-modal-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 24px; overflow-y: auto; }
.folder-structure-meta-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0; font-size: 12px; }
.folder-meta-item { display: flex; align-items: center; gap: 6px; color: #0f172a; font-weight: 600; }
.folder-meta-icon { font-size: 17px; color: #2563eb; }
.folder-meta-stats { font-size: 11px; color: #64748b; font-weight: 500; }

.folder-structure-tree-mount {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
  border-radius: 0;
  padding: 12px 10px;
  max-height: 64vh;
  overflow-y: auto;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  color: #0f172a;
}

.folder-tree-node { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 0; color: #1e293b; transition: background-color 0.12s ease; }
.folder-tree-node:hover { background: #f1f5f9; }
.folder-tree-node.is-frame-folder { color: #1d4ed8; font-weight: 600; }
.folder-tree-icon { font-size: 17px; color: #64748b; flex-shrink: 0; }
.folder-tree-icon.file-icon { font-size: 16px; color: #64748b; }
.folder-tree-node.is-frame-folder .folder-tree-icon { color: #2563eb; }
.folder-tree-dirname { font-weight: 700; color: #0f172a; }
.folder-tree-count { font-size: 11px; color: #64748b; font-weight: 500; }

.project-tree-frame-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 600;
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.folder-tree-link {
  color: #334155;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.folder-tree-link:hover { color: #2563eb; text-decoration: underline; }
.folder-tree-size { font-size: 11px; color: #64748b; margin-left: auto; flex-shrink: 0; font-weight: 500; }
.project-tree-loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: #64748b; font-size: 13px; }

/* Framed Board Preview Window on the Wall (150x150px Square Thumbnail Left Column) */
.project-wall-frame {
  position: relative;
  width: 150px;
  height: 150px;
  background-color: #f8fafc;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 14px 14px;
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-wall-thumb-img,
.project-wall-collage-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.project-wall-collage {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  background: #e2e8f0;
}

.project-wall-collage.count-3 .project-wall-collage-cell:first-child { grid-row: span 2; }
.project-wall-collage.count-3,
.project-wall-collage.count-4 { grid-template-rows: repeat(2, 1fr); }

.project-wall-collage-cell {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f1f5f9;
}

.project-wall-blueprint {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.blueprint-mini-nodes { position: relative; width: 120px; height: 68px; transform: scale(0.85); }
.blueprint-card {
  position: absolute;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 0;
}
.blueprint-card.c1 { top: 4px; left: 4px; width: 48px; height: 34px; }
.blueprint-card.c2 { top: 10px; right: 4px; width: 52px; height: 38px; border-color: #93c5fd; }
.blueprint-card.c3 { bottom: 2px; left: 28px; width: 56px; height: 22px; }

.project-wall-frame-top,
.project-wall-frame-bottom {
  position: absolute;
  left: 0;
  right: 0;
  padding: 5px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.project-wall-frame-top { top: 0; }
.project-wall-frame-bottom { bottom: 0; justify-content: flex-start; gap: 4px; }

.project-wall-stat-pill {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 0;
  background: #0f172a;
  color: #ffffff;
}

.project-item-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: #ffffff;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
}

.project-item-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.project-item-title-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.project-item-folder-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 18px;
  transform: scale(0.76);
  transform-origin: center;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.project-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-active-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 0;
  background: var(--accent-primary);
  color: #ffffff;
}

.project-canvas-type-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  border: 1px solid var(--border-subtle);
}

.project-item-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-slug-path { overflow: hidden; text-overflow: ellipsis; }

.project-item-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.project-btn-edit,
.project-btn-delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 0;
  color: #475569;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  opacity: 1;
  pointer-events: none;
}

.modal-backdrop.is-open .project-btn-edit,
.modal-backdrop.is-open .project-btn-delete {
  pointer-events: auto;
}

.project-btn-edit .material-symbols-outlined,
.project-btn-delete .material-symbols-outlined {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 16px;
  transform: scale(0.75);
  transform-origin: center;
}

.project-btn-edit:hover,
.project-btn-delete:hover {
  background: #ffffff;
  opacity: 1;
}

.project-btn-delete:hover {
  color: #ef4444;
  border-color: #fecaca;
}

.project-btn-edit:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

#project-edit-backdrop,
#folder-edit-backdrop { z-index: calc(var(--z-ui-modal, 100200) + 10); }
.project-edit-modal-card { max-width: 660px; border-radius: 0; }

.project-folder-select {
  flex: 1 1 260px;
  min-width: 180px;
  height: 36px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 0 10px;
  font-size: 13px;
}

.folder-danger-section {
  border-color: #fecaca;
  background: #fef2f2;
}

.folder-delete-summary {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.45;
}

.folder-btn-danger {
  background: #ef4444;
  border-color: #dc2626;
  color: #ffffff;
}

.folder-btn-danger:hover {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
}

.folder-btn-danger[hidden],
.folder-danger-section[hidden],
#folder-thumbnail-section[hidden],
#btn-remove-folder-thumb[hidden] {
  display: none;
}

.folder-thumb-control-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.folder-thumb-preview-box {
  width: 150px;
  height: 150px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f1f5f9;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 14px 14px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.folder-thumb-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

}

/* === 10-auth-viewer.css (modals) === */
@layer modals {
/* ==========================================================================
   VIEWER / CLIENT PRESENTATIONAL PREVIEW MODE
   Strict Standards: Zero !important, Zero margin (100% Flex/Grid gap & padding)
   ========================================================================== */

body.is-viewer-mode {
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  user-select: none;
}

body.is-viewer-mode #share-popover,
body.is-viewer-mode .brand-badge,
body.is-viewer-mode .project-bar,
body.is-viewer-mode .top-bar-right,
body.is-viewer-mode #project-clocks-bar,
body.is-viewer-mode nav#style-dock,
body.is-viewer-mode aside.hud-bar,
body.is-viewer-mode footer.footer-share-bar,
body.is-viewer-mode div#auth-hud-bar,
body.is-viewer-mode aside#floating-tools-home-dock,
body.is-viewer-mode aside#floating-history-dock,
body.is-viewer-mode aside#floating-settings-dock,
body.is-viewer-mode div#workspace-settings-backdrop,
body.is-viewer-mode div#floating-pen-widget,
body.is-viewer-mode div#floating-voice-widget,
body.is-viewer-mode div#floating-arrow-widget,
body.is-viewer-mode div#floating-timer-widget,
body.is-viewer-mode div#floating-polygon-widget,
body.is-viewer-mode .floating-polygon-widget,
body.is-viewer-mode #btn-floating-polygon-toggle,
body.is-viewer-mode div#floating-screen-rec-widget,
body.is-viewer-mode aside#screen-recorder-hud,
body.is-viewer-mode aside#voice-recorder-hud,
body.is-viewer-mode aside#diagnostic-drawer,
body.is-viewer-mode aside#style-studio-drawer,
body.is-viewer-mode aside#layers-drawer,
body.is-viewer-mode aside#style-drawer,
body.is-viewer-mode div#storyline-step-popover,
body.is-viewer-mode #gridspace-color-tool,
body.is-viewer-mode div#project-hub-backdrop,
body.is-viewer-mode div#rate-source-backdrop,
body.is-viewer-mode div#admin-login-backdrop,
body.is-viewer-mode div.shape-floating-bar,
body.is-viewer-mode div.color-picker-flyout,
body.is-viewer-mode div.card-options-dropdown,
body.is-viewer-mode div.node-resize-handles,
body.is-viewer-mode div.node-purpose-badge,
body.is-viewer-mode span.node-coords-badge,
body.is-viewer-mode div.frame-header-controls,
body.is-viewer-mode div.frame-controls-right,
body.is-viewer-mode button.frame-action-btn,
body.is-viewer-mode label.frame-color-picker-label,
body.is-viewer-mode div.audio-studio-panel,
body.is-viewer-mode button.btn-video-purpose,
body.is-viewer-mode button.btn-audio-transcribe,
body.is-viewer-mode button.btn-audio-ai-source,
body.is-viewer-mode button.btn-audio-rerecord,
body.is-viewer-mode button.btn-upload-audio-file,
body.is-viewer-mode button.btn-start-record,
body.is-viewer-mode div.audio-state-record,
body.is-viewer-mode button.node-options-btn,
body.is-viewer-mode div.connection-endpoint-handle,
body.is-viewer-mode button.connection-delete-btn,
body.is-viewer-mode div.timer-controls-center,
body.is-viewer-mode button.btn-timer-lock,
body.is-viewer-mode button.btn-timer-rate-source {
  display: none;
}

body.is-viewer-mode .app-shell,
body.is-viewer-mode .viewport {
  width: 100vw;
  height: 100vh;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: none;
}

body.is-viewer-mode.is-touch-device .app-shell,
body.is-viewer-mode.is-touch-device .viewport {
  height: 100dvh;
}

body.is-viewer-mode .viewport.is-panning {
  cursor: grabbing;
}

/* Content on the grid stays completely frozen, static, and non-clickable */
body.is-viewer-mode .grid-node {
  pointer-events: none;
  user-select: none;
  cursor: grab;
}

body.is-viewer-mode .grid-node * {
  pointer-events: none;
  user-select: none;
}

/* Keep voice, video & YouTube players interactive for clients in share/viewer mode */
body.is-viewer-mode .grid-node .audio-state-player,
body.is-viewer-mode .grid-node .audio-state-player *,
body.is-viewer-mode .grid-node .node-media-video,
body.is-viewer-mode .grid-node .video-sticky-placeholder,
body.is-viewer-mode .grid-node .video-sticky-placeholder *,
body.is-viewer-mode .grid-node .btn-video-dock-back,
body.is-viewer-mode .grid-node .video-transport-overlay,
body.is-viewer-mode .grid-node .video-transport-overlay *,
body.is-viewer-mode .grid-node .youtube-play-btn,
body.is-viewer-mode .grid-node .youtube-iframe,
body.is-viewer-mode .grid-node .youtube-controls-bar button,
body.is-viewer-mode .grid-node .youtube-controls-bar a,
body.is-viewer-mode .grid-node .node-corner-step-pill,
body.is-viewer-mode .grid-node .node-corner-step-pill * {
  pointer-events: auto;
}

body.is-viewer-mode .grid-node .btn-audio-play,
body.is-viewer-mode .grid-node .audio-scrubber-track,
body.is-viewer-mode .grid-node .video-control-btn,
body.is-viewer-mode .grid-node .video-scrubber-track,
body.is-viewer-mode .grid-node .btn-video-dock-back,
body.is-viewer-mode .grid-node .youtube-play-btn,
body.is-viewer-mode .grid-node .youtube-controls-bar button,
body.is-viewer-mode .grid-node .youtube-controls-bar a,
body.is-viewer-mode .grid-node .node-corner-step-pill {
  cursor: pointer;
}

body.is-viewer-mode .grid-node .video-title-label {
  pointer-events: none;
  cursor: grab;
}

body.is-viewer-mode #connections-layer,
body.is-viewer-mode #connection-labels-layer,
body.is-viewer-mode #drawing-layer,
body.is-viewer-mode #drawing-canvas,
body.is-viewer-mode .conn-group,
body.is-viewer-mode .conn-hit-path,
body.is-viewer-mode .conn-label-pill {
  pointer-events: none;
  user-select: none;
  cursor: grab;
}

body.is-viewer-mode .conn-endpoint-handle,
body.is-viewer-mode .audio-pointer-handle {
  display: none;
}

body.is-viewer-mode .grid-node:not(.node-type-frame).is-selected {
  border-color: var(--node-border);
  box-shadow: none;
}

/* Timer presentation in share/viewer mode: keep hourly rate & live total price crisp */
body.is-viewer-mode .grid-node.node-type-timer:not(.is-editing):not(.is-ghost-active) .timer-header-right,
body.is-viewer-mode .grid-node.node-type-timer.is-timer-locked .timer-card-header .timer-header-right,
body.is-viewer-mode .grid-node.node-type-timer.is-timer-locked .timer-date-chip,
body.is-viewer-mode .grid-node.node-type-timer.is-timer-locked .timer-rate-wrap {
  opacity: 1;
  pointer-events: none;
}

body.is-viewer-mode .grid-node.node-type-timer .timer-rate-wrap {
  padding: 0 8px;
  gap: 2px;
  background: rgba(128, 128, 128, 0.08);
  border-color: var(--border-subtle, #e5e7eb);
}

body.is-viewer-mode .grid-node.node-type-timer .timer-rate-input {
  background: transparent;
  border-color: transparent;
  padding: 0;
  color: var(--text-primary, #111827);
  opacity: 1;
  -webkit-text-fill-color: currentColor;
  appearance: textfield;
  -moz-appearance: textfield;
}

body.is-viewer-mode .grid-node.node-type-timer .timer-rate-input::-webkit-outer-spin-button,
body.is-viewer-mode .grid-node.node-type-timer .timer-rate-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

@supports (field-sizing: content) {
  body.is-viewer-mode .grid-node.node-type-timer .timer-rate-input {
    width: auto;
    min-width: 1ch;
    text-align: left;
    field-sizing: content;
  }
}

/* ==========================================================================
   AUTHENTICATION HUD & ADMIN BADGE
   ========================================================================== */
.is-hidden,
.auth-hud-bar.is-hidden,
.auth-login-btn.is-hidden,
.admin-badge-group.is-hidden,
.modal-backdrop.is-hidden {
  display: none;
}

.auth-hud-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--panel-height, 34px);
  padding: 3px 5px;
  box-sizing: border-box;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  box-shadow: none;
}

.auth-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 0;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: var(--accent-primary, #6366f1);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-login-btn:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent-primary, #6366f1);
}

.auth-login-btn .material-symbols-outlined {
  font-size: 15px;
}

.admin-badge-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.project-wall-header-row .admin-badge-group {
  height: var(--panel-height, 34px);
  padding: 3px 5px;
  box-sizing: border-box;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius);
  flex-shrink: 0;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 0;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.auth-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  height: 24px;
  padding: 0 8px;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.auth-logout-btn .material-symbols-outlined {
  font-size: 16px;
}

/* ==========================================================================
   LOGGED-OFF STATE (GRID REMAINS VISIBLE, NOTHING ELSE EXCEPT CENTER LOGIN)
   ========================================================================== */
body.is-logged-off .top-bar,
body.is-logged-off #style-dock,
body.is-logged-off .hud-bar,
body.is-logged-off #auth-hud-bar,
body.is-logged-off #world,
body.is-logged-off #connections-layer,
body.is-logged-off #connection-labels-layer,
body.is-logged-off #drawing-layer,
body.is-logged-off #drawing-canvas,
body.is-logged-off #drawing-layers-drawer,
body.is-logged-off #floating-tools-home-dock,
body.is-logged-off #floating-history-dock,
body.is-logged-off #floating-settings-dock,
body.is-logged-off #workspace-settings-backdrop,
body.is-logged-off #floating-pen-widget,
body.is-logged-off .floating-pen-widget,
body.is-logged-off #floating-voice-widget,
body.is-logged-off .floating-voice-widget,
body.is-logged-off #floating-arrow-widget,
body.is-logged-off .floating-arrow-widget,
body.is-logged-off #floating-timer-widget,
body.is-logged-off .floating-timer-widget,
body.is-logged-off #floating-polygon-widget,
body.is-logged-off .floating-polygon-widget,
body.is-logged-off #floating-screen-rec-widget,
body.is-logged-off .floating-screen-rec-widget,
body.is-logged-off #voice-recorder-hud,
body.is-logged-off #storyline-step-popover,
body.is-logged-off #layers-drawer,
body.is-logged-off #style-drawer,
body.is-logged-off #marquee-box,
body.is-logged-off #dropzone-overlay,
body.is-logged-off #style-studio-drawer,
body.is-logged-off #diagnostic-drawer,
body.is-logged-off #project-hub-backdrop,
body.is-logged-off #rate-source-backdrop,
body.is-logged-off #sticky-video-modal {
  display: none;
}

body.is-logged-off .viewport {
  width: 100vw;
  height: 100vh;
  cursor: default;
}

body.is-logged-off .grid-backdrop {
  opacity: 1;
  background-color: var(--bg-canvas, #f5f6f8);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(to right, rgba(15, 23, 42, 0.11) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.11) 1px, transparent 1px);
}

/* Fullscreen Overlay: Transparent so the infinite canvas grid is 100% visible */
.auth-login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: var(--z-ui-modal, 100200);
  padding: 24px;
  box-sizing: border-box;
}

body.is-logged-off .auth-login-overlay {
  display: flex;
}

body:not(.is-logged-off) .auth-login-overlay.is-hidden {
  display: none;
}

/* Centered Floating Login Window Card */
.auth-window-card {
  width: 100%;
  max-width: 380px;
  background: rgba(18, 21, 28, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  padding: 32px 28px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-sizing: border-box;
  animation: authFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f8fafc;
}

@keyframes authFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Header & Brand Identity */
.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.auth-brand-badge {
  width: 48px;
  height: 48px;
  border-radius: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(129, 140, 248, 0.12) 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand-icon {
  font-size: 26px;
  color: #a5b4fc;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #ffffff;
  line-height: 1.2;
}

.auth-subtitle {
  font-size: 13px;
  font-weight: 400;
  color: #94a3b8;
  line-height: 1.4;
}

/* Form & Input Fields */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.auth-input-icon {
  position: absolute;
  left: 12px;
  font-size: 18px;
  color: #64748b;
  pointer-events: none;
}

.auth-input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 38px;
  background: rgba(11, 13, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  color: #ffffff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-input::placeholder {
  color: #64748b;
}

.auth-input:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.auth-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: rgba(11, 13, 18, 1);
}

.auth-input.auth-input-password {
  padding-right: 40px;
}

.auth-password-toggle {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.auth-password-toggle:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.auth-password-toggle .material-symbols-outlined {
  font-size: 18px;
}

/* Error Alert Box */
.auth-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 0;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  box-sizing: border-box;
}

.auth-error.is-hidden {
  display: none;
}

.auth-error-icon {
  font-size: 18px;
  color: #ef4444;
  flex-shrink: 0;
}

/* Action & Submit Button */
.auth-actions {
  display: flex;
  flex-direction: column;
  padding-top: 4px;
}

.auth-submit-btn {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.auth-submit-btn:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

.auth-submit-btn:active {
  transform: scale(0.985);
}

.auth-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-submit-btn .material-symbols-outlined {
  font-size: 18px;
}


/* ==========================================================================
   BOTTOM-CENTER PUBLIC SHARE BAR
   ========================================================================== */
.footer-share-bar {
  position: fixed;
  bottom: var(--viewport-edge-pad-bottom, 16px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: var(--z-ui-chrome, 100000);
  pointer-events: none;
}

.footer-share-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.footer-share-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--panel-height, 34px);
  padding: 0 12px;
  background: var(--bg-surface, #ffffff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.08));
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.footer-share-btn:hover {
  background: var(--bg-surface-hover, #f8fafc);
  border-color: var(--accent-primary, #0284c7);
  box-shadow: none;
  transform: translateY(-1px);
}

.footer-share-btn:active {
  transform: translateY(0) scale(0.97);
}

.share-btn-icon {
  font-size: 16px;
  color: var(--accent-primary, #0284c7);
}

.share-btn-label {
  letter-spacing: -0.01em;
}

.share-toast {
  position: fixed;
  bottom: var(--viewport-edge-pad-bottom, 18px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #0f172a;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  border-radius: 0;
  white-space: nowrap;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-ui-toast, 100300);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.share-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.share-toast-icon {
  font-size: 16px;
  color: #38bdf8;
}

body.is-logged-off .footer-share-bar {
  display: none;
}

/* Card / Image Copy to System Clipboard Pulse Feedback */
@keyframes copyPulse {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.35) drop-shadow(0 0 12px rgba(129, 140, 248, 0.6)); }
  100% { filter: brightness(1); }
}

.grid-node.is-copied {
  animation: copyPulse 0.35s ease-out;
}

}

/* === 21-rate-source.css (modals) === */
@layer modals {
/* ==========================================================================
   HOURLY RATE & SURVIVAL EXPENSES SOURCE-OF-TRUTH CONTROLLER
   Strict Standards: Zero !important, Zero layout margin, Zero backdrop-filter
   ========================================================================== */

.rate-dock-btn {
  gap: 7px;
}

.rate-dock-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary, #2563eb);
  flex-shrink: 0;
}

.rate-dock-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

#rate-source-backdrop {
  z-index: var(--z-ui-modal, 100200);
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: none;
  padding: 20px;
}

.rate-source-modal-card {
  width: 100%;
  max-width: 1040px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--border-subtle);
  border-radius: var(--panel-radius, 0px);
  overflow: hidden;
}

.rate-source-header {
  gap: 14px;
  flex-wrap: wrap;
}

.rate-header-piggy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  flex-shrink: 0;
}

.rate-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rate-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-subtle);
}

.rate-mode-btn {
  height: 26px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.rate-mode-btn:hover {
  color: var(--text-primary);
}

.rate-mode-btn.is-active {
  background: var(--accent-primary, #2563eb);
  border-color: var(--accent-primary, #2563eb);
  color: #ffffff;
}

.rate-currency-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rate-currency-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.rate-select {
  height: 30px;
  padding: 0 8px;
  background: var(--bg-panel-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.rate-select:focus {
  border-color: var(--accent-primary);
}

.rate-source-modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.rate-source-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr);
  gap: 16px;
  align-items: start;
}

.rate-source-col-inputs,
.rate-source-col-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.rate-section {
  gap: 10px;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.rate-source-modal-card[data-active-mode="manual"] .rate-manual-section {
  border-color: var(--accent-primary);
}

.rate-source-modal-card[data-active-mode="manual"] .rate-survival-section {
  opacity: 0.72;
}

.rate-source-modal-card[data-active-mode="calculated"] .rate-manual-section {
  opacity: 0.82;
}

.rate-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.rate-section-head .section-heading {
  border-bottom: none;
  padding-bottom: 0;
}

.rate-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rate-subtotal-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 4px 8px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
}

.rate-status-chip {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.rate-status-chip.is-active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.rate-add-btn {
  flex: 0 0 auto;
  height: 26px;
  padding: 0 9px;
}

.rate-manual-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rate-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.rate-input-box {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 8px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
}

.rate-input-box:focus-within {
  border-color: var(--accent-primary);
}

.rate-currency-prefix,
.rate-unit-suffix {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.rate-num-input {
  width: 78px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  outline: none;
}

.rate-inline-hint {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Expense & Tax Item Lists */
.rate-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rate-item-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 116px 56px 28px;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
}

.rate-item-row.is-disabled {
  opacity: 0.55;
}

.rate-item-check {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.rate-item-name {
  min-width: 0;
  height: 26px;
  padding: 0 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  outline: none;
}

.rate-item-name:focus {
  border-color: var(--accent-primary);
  background: var(--bg-panel-hover);
}

.rate-item-val-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  height: 26px;
  padding: 0 6px;
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-subtle);
}

.rate-item-val-box:focus-within {
  border-color: var(--accent-primary);
}

.rate-item-num {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  outline: none;
}

.rate-pill-toggle {
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel-hover);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.rate-pill-toggle:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.rate-pill-toggle.is-alt {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.rate-row-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.rate-row-del-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.rate-row-del-btn .material-symbols-outlined {
  font-size: 16px;
}

.rate-empty-row {
  padding: 10px;
  border: 1px dashed var(--border-subtle);
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

.rate-capacity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rate-cap-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rate-cap-field .rate-input-box {
  width: 100%;
  justify-content: space-between;
}

.rate-cap-field .rate-num-input {
  width: 100%;
  text-align: left;
}

/* Right Column: Hero Output, Waterfall, Timer Sync & Extract */
.rate-hero-card {
  gap: 10px;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.06);
}

.rate-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rate-hero-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.rate-hero-mode-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 7px;
  background: var(--accent-primary);
  color: #ffffff;
}

.rate-hero-mode-badge.is-manual {
  background: #f59e0b;
  color: #111827;
}

.rate-hero-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.rate-hero-value {
  font-size: 30px;
  font-weight: 700;
  color: #10b981;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.rate-hero-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.rate-hero-submetrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.rate-submetric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rate-submetric-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rate-submetric-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.rate-waterfall-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rate-wf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.rate-wf-row.is-total {
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  font-weight: 700;
  color: var(--text-primary);
}

.rate-wf-row.is-highlight {
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
  font-weight: 700;
  color: var(--accent-primary);
}

.rate-warning-note {
  padding: 8px 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #d97706;
  font-size: 11px;
  font-weight: 600;
}

.rate-warning-note.is-hidden {
  display: none;
}

.rate-timers-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.rate-timer-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
}

.rate-timer-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.rate-timer-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rate-full-btn {
  width: 100%;
}

.rate-full-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rate-export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.rate-danger-btn:hover {
  border-color: rgba(239, 68, 68, 0.45);
  color: #ef4444;
}

.rate-danger-btn.is-armed {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

.rate-save-status {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

@media (max-width: 860px) {
  .rate-source-layout {
    grid-template-columns: 1fr;
  }

  .rate-capacity-grid {
    grid-template-columns: 1fr;
  }
}

}

/* === 23-mobile-preview.css (modals) === */
@layer modals {
/* ==========================================================================
   SYSTEM B — MOBILE & TABLET CLIENT SHOWCASE ENGINE (23-mobile-preview.css)
   ========================================================================== */

body.is-mobile-preview-system .top-bar,
body.is-mobile-preview-system #style-dock,
body.is-mobile-preview-system .hud-bar,
body.is-mobile-preview-system #footer-share-bar,
body.is-mobile-preview-system #floating-tools-home-dock,
body.is-mobile-preview-system #floating-history-dock,
body.is-mobile-preview-system #floating-settings-dock,
body.is-mobile-preview-system #workspace-settings-backdrop,
body.is-mobile-preview-system #floating-pen-widget,
body.is-mobile-preview-system #floating-voice-widget,
body.is-mobile-preview-system #floating-arrow-widget,
body.is-mobile-preview-system #floating-timer-widget,
body.is-mobile-preview-system #floating-polygon-widget,
body.is-mobile-preview-system #floating-screen-rec-widget,
body.is-mobile-preview-system #screen-recorder-hud,
body.is-mobile-preview-system #voice-recorder-hud,
body.is-mobile-preview-system #sticky-video-modal,
body.is-mobile-preview-system #storyline-step-popover,
body.is-mobile-preview-system #project-hub-backdrop,
body.is-mobile-preview-system #project-edit-backdrop,
body.is-mobile-preview-system #folder-structure-backdrop,
body.is-mobile-preview-system #rate-source-backdrop,
body.is-mobile-preview-system #style-drawer,
body.is-mobile-preview-system #layers-drawer,
body.is-mobile-preview-system #diagnostic-drawer,
body.is-mobile-preview-system #grid-backdrop {
  display: none;
}

body.is-mobile-preview-system #viewport {
  background-color: var(--bg-canvas, #f8fafc);
  touch-action: none;
  overflow: hidden;
}

body.is-mobile-preview-system #world {
  transform: translate(0px, 0px) scale(1);
  will-change: auto;
}

.mv-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  transform: translate(0px, 0px) scale(1);
  pointer-events: auto;
}

/* Top Showcase Brand Bar */
.mv-topbar {
  position: fixed;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: var(--z-ui-drawer, 100100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.mv-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background-color: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--border-subtle, #cbd5e1);
  border-radius: 999px;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 13px;
  font-weight: 600;
  pointer-events: auto;
  box-sizing: border-box;
}

.mv-brand-icon {
  font-size: 18px;
  color: var(--accent-primary, #3b82f6);
}

.mv-board-title {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mv-mode-tag {
  padding: 2px 6px;
  background-color: rgba(59, 130, 246, 0.12);
  color: var(--accent-primary, #3b82f6);
  border-radius: 999px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  font-weight: 700;
}

.mv-project-select {
  background: transparent;
  color: var(--text-primary, #0f172a);
  border: none;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 13px;
  font-weight: 600;
  max-width: 220px;
  outline: none;
}

/* Bottom Showcase Controls HUD */
.mv-bottom-hud {
  position: fixed;
  bottom: 14px;
  left: 12px;
  right: 12px;
  z-index: var(--z-ui-drawer, 100100);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.mv-hud-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 6px;
  background-color: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--border-subtle, #cbd5e1);
  border-radius: 999px;
  pointer-events: auto;
  box-sizing: border-box;
}

.mv-hud-group.is-hidden {
  display: none;
}

.mv-hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  background: transparent;
  color: var(--text-primary, #0f172a);
  border: none;
  border-radius: 999px;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.mv-hud-fit-btn {
  background-color: rgba(59, 130, 246, 0.12);
  color: var(--accent-primary, #3b82f6);
}

.mv-hud-btn .material-symbols-outlined {
  font-size: 18px;
}

.mv-hud-readout {
  min-width: 44px;
  padding: 0 4px;
  text-align: center;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #475569);
}

/* Mobile Showcase Nodes (0.5x Scaled Coordinates) */
.mv-node {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  background-color: var(--mv-bg, var(--node-surface, #ffffff));
  color: var(--mv-fg, var(--text-primary, #0f172a));
  border-width: var(--mv-border-width, 1px);
  border-style: var(--mv-border-style, solid);
  border-color: var(--mv-border-color, var(--border-subtle, #cbd5e1));
  border-radius: var(--mv-radius, 4px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mv-type-frame {
  background-color: var(--mv-bg, rgba(241, 245, 249, 0.55));
  border-style: dashed;
}

.mv-frame-header {
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #475569);
  background-color: rgba(15, 23, 42, 0.04);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mv-type-image {
  background-color: rgba(15, 23, 42, 0.04);
}

.mv-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

.mv-cutout-svg,
.mv-polygon-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.mv-type-polygon {
  background: transparent;
  border: none;
}

/* Text Box, Card & Code Nodes */
.mv-textbox-body {
  width: 100%;
  height: 100%;
  padding: 6px 8px;
  box-sizing: border-box;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 8px;
  line-height: 1.38;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: hidden;
}

.mv-node.is-bold .mv-textbox-body {
  font-weight: 700;
}

.mv-card-header {
  padding: 4px 7px;
  font-size: 7.5px;
  font-weight: 700;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mv-card-body {
  flex: 1;
  padding: 6px 7px;
  font-size: 7.5px;
  line-height: 1.38;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: hidden;
}

.mv-code-header {
  background-color: #0f172a;
  color: #e2e8f0;
}

.mv-code-body {
  flex: 1;
  padding: 6px;
  background-color: #0f172a;
  color: #38bdf8;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 6.5px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow: hidden;
}

.mv-shape-body {
  width: 100%;
  height: 100%;
  padding: 6px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 8px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow: hidden;
}

/* Video, YouTube & Audio Nodes */
.mv-video-wrap,
.mv-yt-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: #0f172a;
  color: #ffffff;
}

.mv-video-poster {
  position: relative;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.mv-video-poster .mv-media-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  background-color: rgba(15, 23, 42, 0.72);
}

.mv-video-play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background-color: var(--accent-primary, #3b82f6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mv-video-lightbox {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-ui-modal, 100200) + 300);
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100dvh;
  padding: 0;
  background-color: #000000;
  box-sizing: border-box;
}

.mv-lightbox-shell {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  background-color: #000000;
  box-sizing: border-box;
}

.mv-lightbox-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent);
  color: #f8fafc;
  pointer-events: none;
}

.mv-lightbox-title {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mv-lightbox-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background-color: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
}

.mv-lightbox-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #000000;
  display: block;
}

.mv-video,
.mv-yt-stage,
.mv-yt-iframe {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: block;
  background-color: #000000;
}

.mv-yt-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mv-yt-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mv-yt-play-btn {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background-color: rgba(239, 68, 68, 0.94);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mv-media-caption {
  padding: 3px 6px;
  font-size: 7px;
  font-weight: 600;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mv-audio-card {
  width: 100%;
  height: 100%;
  padding: 6px 8px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #0f172a;
  color: #ffffff;
}

.mv-audio-play-btn {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background-color: #3b82f6;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mv-audio-play-btn .material-symbols-outlined {
  font-size: 16px;
}

.mv-audio-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mv-audio-title {
  font-size: 7.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mv-audio-time {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 6.5px;
  color: #94a3b8;
}

.mv-timer-clock {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  font-weight: 700;
}

/* Badges & Arrows */
.mv-step-pill {
  position: absolute;
  top: 3px;
  left: 3px;
  padding: 1px 5px;
  background-color: #2563eb;
  color: #ffffff;
  border-radius: 999px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 6.5px;
  font-weight: 700;
  pointer-events: none;
}

.mv-purpose-pill {
  position: absolute;
  top: 3px;
  right: 3px;
  padding: 1px 5px;
  color: #ffffff;
  border-radius: 999px;
  font-size: 6px;
  font-weight: 700;
  pointer-events: none;
}

.mv-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}

.mv-conn-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 1px 5px;
  background-color: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--border-subtle, #cbd5e1);
  border-radius: 999px;
  font-size: 6.5px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
}

}

/* === 24-emoji-asset.css (modals) === */
@layer modals {
/* Floating Emoji Trigger visibility (base geometry & theme live in 25-floating-home-dock.css) */
  body.is-logged-off #floating-emoji-widget,
  body.is-viewer-mode #floating-emoji-widget,
  body.is-project-space-mode #floating-emoji-widget,
  body.is-mobile-preview-system #floating-emoji-widget {
    display: none;
  }

  /* UTF Emoji Asset Hold Modal */
  .emoji-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-ui-modal, 100200);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.42);
    transition: opacity 0.14s ease;
  }

  .emoji-modal-backdrop.is-open {
    display: flex;
  }

  .emoji-modal-backdrop.is-dragging-emoji {
    pointer-events: none;
    opacity: 0.14;
  }

  .emoji-modal-card {
    width: min(860px, 100%);
    height: min(640px, 86vh);
    display: grid;
    grid-template-columns: 176px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      'header header'
      'toolbar toolbar'
      'sidebar grid'
      'footer footer';
    gap: 12px 14px;
    padding: 18px 20px;
    background: #ffffff;
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
    color: #0f172a;
    overflow: hidden;
  }

  .emoji-modal-header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .emoji-modal-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .emoji-modal-icon {
    font-size: 26px;
    color: #0f172a;
  }

  .emoji-modal-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
  }

  .emoji-modal-subtitle {
    font-size: 12px;
    color: #64748b;
  }

  .emoji-modal-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: #f8fafc;
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 8px;
    color: #334155;
    cursor: pointer;
  }

  .emoji-modal-close-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
  }

  .emoji-modal-toolbar {
    grid-area: toolbar;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .emoji-search-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 38px;
    background: #f8fafc;
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 10px;
  }

  .emoji-search-icon {
    font-size: 18px;
    color: #64748b;
  }

  .emoji-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    color: #0f172a;
    outline: none;
  }

  .emoji-catalog-count {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
  }

  .emoji-category-tabs {
    grid-area: sidebar;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px 10px 2px 0;
    border-right: 1px solid var(--border-subtle, #e2e8f0);
  }

  .emoji-cat-tab {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    flex-shrink: 0;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
    text-align: left;
    color: #334155;
    white-space: normal;
    cursor: pointer;
  }

  .emoji-cat-tab .material-symbols-outlined {
    font-size: 16px;
    flex-shrink: 0;
  }

  .emoji-cat-tab:hover {
    background: #f1f5f9;
    color: #0f172a;
  }

  .emoji-cat-tab.is-active {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
  }

  .emoji-catalog-grid {
    grid-area: grid;
    min-height: 0;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    align-content: start;
    gap: 8px;
    padding: 2px 4px 2px 2px;
    overflow-y: auto;
  }

  .emoji-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    background: #f8fafc;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: grab;
    user-select: none;
  }

  .emoji-tile:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
  }

  .emoji-tile:active {
    cursor: grabbing;
  }

  .emoji-tile-glyph {
    font-size: 28px;
    line-height: 1.1;
  }

  .emoji-tile-code {
    font-size: 10px;
    color: #64748b;
    letter-spacing: -0.02em;
  }

  .emoji-modal-footer {
    grid-area: footer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle, #e2e8f0);
  }

  @media (max-width: 640px) {
    .emoji-modal-card {
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: auto auto auto minmax(0, 1fr) auto;
      grid-template-areas:
        'header'
        'toolbar'
        'sidebar'
        'grid'
        'footer';
    }

    .emoji-category-tabs {
      flex-direction: row;
      flex-wrap: wrap;
      overflow-y: visible;
      padding: 0 0 8px 0;
      border-right: none;
      border-bottom: 1px solid var(--border-subtle, #e2e8f0);
    }

    .emoji-cat-tab {
      width: auto;
      padding: 6px 10px;
    }
  }

  .emoji-footer-hint {
    font-size: 12px;
    color: #64748b;
  }

  .emoji-footer-hint code {
    padding: 1px 5px;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 11px;
    color: #0f172a;
  }

  .emoji-copy-toast {
    padding: 4px 10px;
    background: #0f172a;
    color: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
  }

  .emoji-copy-toast.is-visible {
    opacity: 1;
  }

  /* Canvas Emoji Asset Node */
  .grid-node.node-type-emoji {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }

  .grid-node.node-type-emoji.is-selected {
    outline: 1.5px solid var(--accent-primary, #6366f1);
    outline-offset: 2px;
    border-radius: 8px;
  }

  .node-emoji-surface {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    pointer-events: auto;
  }

  .node-emoji-glyph {
    font-size: var(--emoji-font-size, 72px);
    line-height: 1;
    display: block;
    text-align: center;
  }

}

/* === 27-workspace-settings.css (modals) === */
@layer modals {
/* ==========================================================================
   WORKSPACE SETTINGS & TOOLKIT MODAL + BOTTOM-RIGHT SCREWDRIVER TRIGGER
   Standards: Zero !important, Zero layout spacing margin, Zero blur filter
   ========================================================================== */

/* Bottom-Right Fixed Trigger Pill (Home Dock & History Pill Parity) */
.floating-settings-dock {
  --home-shell-bg: #ffffff;
  --home-shell-border: var(--border-subtle, #e2e8f0);
  --home-slot-bg: #f1f5f9;
  --home-slot-border: #e2e8f0;
  --home-btn-bg: #ffffff;
  --home-btn-hover-bg: #f8fafc;
  --home-btn-border: var(--border-subtle, #e2e8f0);
  --home-btn-fg: #1f1f1f;
  --home-btn-active-bg: #2563eb;
  --home-btn-active-fg: #ffffff;

  position: fixed;
  right: 18px;
  bottom: var(--viewport-edge-pad-bottom, 16px);
  z-index: var(--z-ui-floating, 100050);
  display: flex;
  align-items: center;
  pointer-events: none;
  user-select: none;
}

.floating-settings-dock-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  background: var(--home-shell-bg);
  border: 1px solid var(--home-shell-border);
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  pointer-events: auto;
}

.settings-dock-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--home-slot-bg);
  border: 1.5px solid var(--home-slot-border);
}

.settings-dock-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--home-btn-bg, #ffffff);
  border: 1.5px solid var(--home-btn-border, #e2e8f0);
  color: var(--home-btn-fg, #1f1f1f);
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.12s ease;
}

.settings-dock-btn svg {
  display: block;
  pointer-events: none;
}

.settings-dock-btn:hover:not(.is-active) {
  background: var(--home-btn-hover-bg, #f8fafc);
  border-color: #cbd5e1;
}

.settings-dock-btn:active {
  transform: scale(0.95);
}

.settings-dock-btn.is-active {
  background: var(--home-btn-active-bg, #2563eb);
  border-color: var(--home-btn-active-bg, #2563eb);
  color: var(--home-btn-active-fg, #ffffff);
}

.settings-dock-btn.is-active:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: var(--home-btn-active-fg, #ffffff);
}

/* Workspace Settings Modal Backdrop & Card */
.workspace-settings-backdrop {
  z-index: var(--z-ui-modal, 100200);
  padding: 24px;
  background: rgba(15, 23, 42, 0.44);
}

.workspace-settings-card {
  width: min(680px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.workspace-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--bg-panel-solid, #ffffff);
}

.workspace-settings-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.workspace-settings-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: var(--bg-panel-hover, #f1f5f9);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 10px;
  color: var(--text-primary, #0f172a);
}

.workspace-settings-header .drawer-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.workspace-settings-header .drawer-subtitle {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
  line-height: 1.35;
}

.workspace-settings-close-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
  color: var(--text-secondary, #475569);
}

.workspace-settings-close-btn:hover {
  background: var(--bg-panel-hover, #f1f5f9);
  border-color: var(--border-focus, #cbd5e1);
  color: var(--text-primary, #0f172a);
}

.workspace-settings-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 20px;
  overflow-y: auto;
}

.workspace-settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 12px;
}

.workspace-settings-section-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary, #64748b);
}

.workspace-settings-section-label .material-symbols-outlined {
  font-size: 15px;
  color: var(--accent-primary, #2563eb);
}

/* Section 1: Studio & Project Tools (Balanced 2x2 Action Grid) */
.workspace-settings-card .style-dock {
  position: static;
  left: auto;
  bottom: auto;
  z-index: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.workspace-settings-card .style-dock-btn {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  justify-content: flex-start;
  gap: 9px;
  border-radius: 10px;
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  font-size: 13px;
  font-weight: 600;
}

.workspace-settings-card .style-dock-btn:hover,
.workspace-settings-card .style-dock-btn.is-active {
  background: var(--bg-panel-solid, #ffffff);
  border-color: var(--accent-primary, #2563eb);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.workspace-settings-card .rate-dock-badge {
  margin-left: auto;
  border-radius: 6px;
  padding: 0 7px;
  height: 22px;
}

/* Section 2: Share & Export */
.workspace-settings-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.workspace-settings-card .footer-share-btn {
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  font-size: 13px;
  font-weight: 600;
}

.workspace-settings-card .footer-share-btn:hover {
  background: var(--bg-panel-solid, #ffffff);
  border-color: var(--accent-primary, #2563eb);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
  transform: none;
}

.workspace-settings-card .share-popover {
  position: static;
  bottom: auto;
  left: auto;
  transform: none;
  width: 100%;
  max-width: 100%;
  padding: 14px;
  border-radius: 10px;
  box-sizing: border-box;
  z-index: auto;
}

/* Section 3: Viewport, Storage & System Health */
.workspace-settings-card .hud-bar {
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
  height: auto;
  min-height: 44px;
  width: 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 10px;
}

.workspace-settings-card .coords-readout {
  display: inline-flex;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
  font-size: 11px;
}

.workspace-settings-card .zoom-controls {
  gap: 4px;
}

.workspace-settings-card .hud-btn {
  height: 30px;
  min-width: 30px;
  border-radius: 7px;
}

.workspace-settings-card .hud-btn-with-label {
  padding: 0 10px;
  border: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--bg-panel-hover, #f8fafc);
}

.workspace-settings-card .hud-zoom-pill {
  height: 30px;
  min-width: 54px;
  border-radius: 7px;
}

.workspace-settings-card .hud-storage-pill {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
}

.workspace-settings-card .storage-mini-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--border-subtle, #e2e8f0);
}

.workspace-settings-card .storage-mini-bar-fill {
  border-radius: 999px;
}

.workspace-settings-card .hud-health-pill {
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
}

.workspace-settings-card .hud-health-pill:hover {
  border-color: var(--accent-primary, #2563eb);
}

.workspace-settings-card .hud-health-pill.is-healthy .health-pill-text {
  color: #059669;
}

.workspace-settings-card .hud-health-pill.is-warning .health-pill-text {
  color: #d97706;
}

.workspace-settings-card .hud-health-pill.is-critical .health-pill-text {
  color: #dc2626;
}

@media (max-width: 600px) {
  .workspace-settings-card .style-dock {
    grid-template-columns: 1fr;
  }
}

/* Non-Editor Mode & Focus Guards */
body.is-logged-off #floating-settings-dock,
body.is-viewer-mode #floating-settings-dock,
body.is-project-space-mode #floating-settings-dock,
body.is-mobile-preview-system #floating-settings-dock,
body.is-mobile-constrained #floating-settings-dock,
body.is-logged-off #workspace-settings-backdrop,
body.is-viewer-mode #workspace-settings-backdrop,
body.is-project-space-mode #workspace-settings-backdrop,
body.is-mobile-preview-system #workspace-settings-backdrop,
body.is-mobile-constrained #workspace-settings-backdrop {
  display: none;
}

body.has-void-focus #floating-settings-dock,
body.has-void-focus #workspace-settings-backdrop {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* ==========================================================================
   HASHTAG LIST MODAL (Opened via H Hotkey)
   Standards: Zero !important, Zero layout margin, Zero backdrop-filter blur
   ========================================================================== */

.hashtag-modal-backdrop {
  z-index: var(--z-ui-modal, 100200);
  padding: 24px;
  background: rgba(15, 23, 42, 0.44);
}

.hashtag-modal-stack {
  width: min(640px, 100%);
  max-width: 640px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

.hashtag-panel-card {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 20px 54px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  pointer-events: auto;
}

.hashtag-list-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.hashtag-config-card {
  flex: 0 0 auto;
  padding: 12px 14px;
  background: var(--accent-primary, #2563eb);
  color: var(--accent-text, #ffffff);
  border-color: color-mix(in srgb, #ffffff 22%, var(--accent-primary, #2563eb));
  box-shadow: 0 20px 54px rgba(37, 99, 235, 0.3);
}

.hashtag-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--bg-panel-solid, #ffffff);
}

.hashtag-modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hashtag-modal-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--accent-primary, #2563eb) 10%, var(--bg-panel-hover, #f1f5f9));
  border: 1px solid color-mix(in srgb, var(--accent-primary, #2563eb) 22%, var(--border-subtle, #e2e8f0));
  border-radius: 8px;
  color: var(--accent-primary, #2563eb);
}

.hashtag-modal-header-icon .material-symbols-outlined {
  font-size: 18px;
}

.hashtag-modal-heading-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.hashtag-modal-header .drawer-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.hashtag-modal-header .drawer-subtitle {
  font-size: 11.5px;
  color: var(--text-secondary, #64748b);
  line-height: 1.25;
}

.hashtag-modal-header-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.hashtag-modal-count {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--bg-panel-hover, #f1f5f9);
  border: 1px solid var(--border-subtle, #e2e8f0);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #475569);
  white-space: nowrap;
}

.hashtag-modal-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 5px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, #cbd5e1);
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.08);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary, #475569);
}

.hashtag-modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  flex-shrink: 0;
  border-radius: 7px;
  background: var(--bg-panel-hover, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
  color: var(--text-secondary, #475569);
}

.hashtag-modal-close-btn .material-symbols-outlined {
  font-size: 18px;
}

.hashtag-modal-close-btn:hover {
  background: var(--bg-panel-hover, #f1f5f9);
  border-color: var(--border-focus, #cbd5e1);
  color: var(--text-primary, #0f172a);
}

/* Standalone Selected Hashtag Configurator Card (Inverted Blue Contrast) */
.hashtag-editor-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
}

.hashtag-editor-empty.is-hidden {
  display: none;
}

.hashtag-editor-empty-icon {
  font-size: 16px;
  color: #ffffff;
  flex-shrink: 0;
}

.hashtag-editor-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hashtag-editor-form.is-hidden {
  display: none;
}

.hashtag-editor-fields-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hashtag-editor-field-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  flex-shrink: 0;
}

.hashtag-editor-title-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  box-sizing: border-box;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.hashtag-editor-title-input::placeholder {
  color: rgba(255, 255, 255, 0.68);
  font-weight: 400;
}

.hashtag-editor-title-input:focus {
  background: rgba(255, 255, 255, 0.24);
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.hashtag-editor-num-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 0 7px;
  box-sizing: border-box;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
  flex-shrink: 0;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.hashtag-editor-num-wrap:focus-within {
  background: rgba(255, 255, 255, 0.24);
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.hashtag-editor-num-prefix {
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

.hashtag-editor-num-input {
  width: 44px;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.hashtag-editor-num-input::placeholder {
  color: rgba(255, 255, 255, 0.68);
}

.hashtag-modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 10px 12px;
  box-sizing: border-box;
  background: var(--bg-panel-solid, #ffffff);
}

.hashtag-modal-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hashtag-modal-list .tour-timeline-item {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 2px 4px 2px 2px;
  box-sizing: border-box;
  border-radius: 7px;
  border: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  width: 100%;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.hashtag-modal-list .tour-timeline-item:hover {
  background: var(--bg-panel-hover, #f8fafc);
  border-color: color-mix(in srgb, var(--accent-primary, #2563eb) 45%, var(--border-subtle, #cbd5e1));
}

.hashtag-modal-list .tour-timeline-item.is-active {
  background: color-mix(in srgb, var(--accent-primary, #2563eb) 8%, var(--bg-panel-solid, #ffffff));
  border-color: color-mix(in srgb, var(--accent-primary, #2563eb) 50%, var(--border-subtle, #cbd5e1));
  border-left: 1px solid color-mix(in srgb, var(--accent-primary, #2563eb) 50%, var(--border-subtle, #cbd5e1));
}

.hashtag-modal-list .tour-timeline-item.is-editing-target {
  border-color: var(--accent-primary, #2563eb);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-primary, #2563eb) 35%, transparent);
}

.hashtag-row-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  min-height: 26px;
  padding: 2px 8px;
  box-sizing: border-box;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.hashtag-row-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity 0.12s ease, background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.hashtag-modal-list .tour-timeline-item:hover .hashtag-row-delete-btn {
  opacity: 1;
}

.hashtag-row-delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(220, 38, 38, 0.35);
  color: #dc2626;
}

.hashtag-row-delete-btn .material-symbols-outlined {
  font-size: 15px;
}

.hashtag-modal-list .tour-item-num {
  min-width: 34px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--bg-panel-hover, #f1f5f9);
  border: 1px solid var(--border-subtle, #e2e8f0);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-primary, #2563eb);
}

.hashtag-modal-list .tour-timeline-item.is-active .tour-item-num {
  background: var(--accent-primary, #2563eb);
  border-color: var(--accent-primary, #2563eb);
  color: var(--accent-text, #ffffff);
}

.hashtag-modal-list .tour-item-info {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.hashtag-modal-list .tour-item-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

.hashtag-modal-list .tour-item-type {
  font-size: 10px;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
  flex-shrink: 0;
}

.hashtag-modal-list .tour-item-icon {
  font-size: 15px;
  color: var(--text-muted, #94a3b8);
}

.hashtag-modal-list .tour-timeline-item:hover .tour-item-icon,
.hashtag-modal-list .tour-timeline-item.is-active .tour-item-icon {
  color: var(--accent-primary, #2563eb);
}

.hashtag-modal-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 32px 20px;
  color: var(--text-secondary, #64748b);
}

.hashtag-modal-empty-icon {
  font-size: 30px;
  color: var(--text-muted, #94a3b8);
}

.hashtag-modal-empty-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.hashtag-modal-empty-hint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary, #64748b);
}

.hashtag-modal-empty-hint kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-panel-hover, #f1f5f9);
  border: 1px solid var(--border-subtle, #cbd5e1);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.hashtag-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--bg-panel-hover, #f8fafc);
}

.hashtag-modal-footer.is-hidden {
  display: none;
}

.hashtag-modal-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  box-sizing: border-box;
  border-radius: 7px;
  border: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--bg-panel-solid, #ffffff);
  color: var(--text-primary, #0f172a);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.hashtag-modal-nav-btn:hover {
  border-color: var(--accent-primary, #2563eb);
  color: var(--accent-primary, #2563eb);
}

.hashtag-modal-nav-btn .material-symbols-outlined {
  font-size: 15px;
}

/* Non-Editor Mode & Focus Guards */
body.is-logged-off #hashtag-modal-backdrop,
body.is-viewer-mode #hashtag-modal-backdrop,
body.is-project-space-mode #hashtag-modal-backdrop,
body.is-mobile-preview-system #hashtag-modal-backdrop,
body.is-mobile-constrained #hashtag-modal-backdrop {
  display: none;
}

body.has-void-focus #hashtag-modal-backdrop {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

}
