/* ==========================================================================
   R K KNIT FAB Hierarchy Simulator - Design System
   Developed by AAPKA MIS
   ========================================================================== */

/* Design Tokens & Theme Variables */
:root {
  /* Fonts */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-title: 'Outfit', sans-serif;

  /* Theme: Dark Mode (Default) */
  --bg-primary: #070a13;
  --bg-secondary: #0d1220;
  --bg-tertiary: #141b2e;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  
  --glass-bg: rgba(13, 18, 32, 0.75);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-focus: rgba(6, 182, 212, 0.4);
  --glass-shadow: rgba(0, 0, 0, 0.5);

  /* Brand Accents */
  --brand-cyan: #06b6d4;
  --brand-violet: #8b5cf6;
  --brand-rose: #ec4899;
  
  /* Status Colors */
  --status-active: #10b981;
  --status-vacant: #64748b;
  --status-temporary: #f59e0b;
  --status-new-hire: #3b82f6;
  --status-retired: #ef4444;
  
  /* Node specific styles */
  --node-bg: #111827;
  --node-border: rgba(255, 255, 255, 0.1);
  --node-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  
  /* Utilities */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --grid-color: rgba(255, 255, 255, 0.04);
}

/* Theme: Light Mode Override */
html[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-border-focus: rgba(139, 92, 246, 0.4);
  --glass-shadow: rgba(15, 23, 42, 0.08);
  
  --node-bg: #ffffff;
  --node-border: rgba(15, 23, 42, 0.08);
  --node-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.04), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --grid-color: rgba(15, 23, 42, 0.03);
}

/* Basic Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: relative;
  transition: background-color var(--transition-medium), color var(--transition-medium);
}

/* Ambient glow graphics in background */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  z-index: 0;
  opacity: 0.15;
  pointer-events: none;
  transition: opacity var(--transition-medium);
}
.glow-1 {
  top: 10%;
  left: 20%;
  width: 400px;
  height: 400px;
  background: var(--brand-cyan);
}
.glow-2 {
  bottom: 10%;
  right: 25%;
  width: 500px;
  height: 500px;
  background: var(--brand-violet);
}

html[data-theme="light"] .ambient-glow {
  opacity: 0.06;
}

/* Glassmorphism Helper */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 var(--glass-shadow);
  transition: background var(--transition-medium), border var(--transition-medium), box-shadow var(--transition-medium);
}

/* Common Scrollbar Design */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
}

/* Header Styles */
#main-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  animation: logo-spin 20s linear infinite;
}

@keyframes logo-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.logo-text h1 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--brand-cyan) 0%, var(--brand-violet) 50%, var(--brand-rose) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
  display: block;
  margin-top: -2px;
}

.creator-badge-static {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 4px 12px;
  border-radius: 6px;
}

.badge-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.badge-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.header-center {
  flex: 0 1 400px;
}

.search-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 8px 14px;
  border-radius: 30px;
  color: var(--text-secondary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.search-wrapper:focus-within {
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
  background: rgba(0, 0, 0, 0.2);
}

#search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  width: 100%;
  margin-left: 8px;
  font-family: var(--font-main);
  font-size: 14px;
}

#search-input::placeholder {
  color: var(--text-muted);
}

.btn-icon-small {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

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

/* Edit / View Mode buttons */
.mode-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  padding: 3px;
  border-radius: 30px;
}

.btn-mode {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: transparent;
  border: none;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-mode.active {
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-violet));
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(6, 182, 212, 0.2);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  border-color: var(--brand-cyan);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.sun-icon { display: block; }
.moon-icon { display: none; }

html[data-theme="light"] .sun-icon { display: none; }
html[data-theme="light"] .moon-icon { display: block; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-violet));
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.btn-secondary:hover {
  border-color: var(--brand-cyan);
  background: rgba(255, 255, 255, 0.06);
}

/* Main Workspace */
#app-workspace {
  position: absolute;
  top: 70px;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  overflow: hidden;
}

/* Floating Toolbar */
#toolbar-floating {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  border-radius: 50px;
  z-index: 8;
  height: 48px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

#zoom-indicator {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: center;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--glass-border);
}

.btn-tool {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-tool:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.btn-tool.active {
  color: var(--brand-cyan);
  background: rgba(6, 182, 212, 0.1);
}

.btn-tool.text-danger:hover {
  color: var(--status-retired);
  background: rgba(239, 68, 68, 0.1);
}

.label-select-layout {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-right: 4px;
}

.styled-select {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}

.styled-select:focus {
  border-color: var(--brand-cyan);
}

/* Canvas Area */
#canvas-container {
  flex: 1;
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
  cursor: grab;
}

#canvas-container:active {
  cursor: grabbing;
}

#grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(var(--grid-color) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 1;
  transition: opacity var(--transition-medium);
}

#chart-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  z-index: 2;
}

#svg-connections-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

#nodes-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none; /* Let pointer events go to nodes explicitly */
}

/* SVG Line Connectors */
.connection-path {
  fill: none;
  stroke: var(--brand-cyan);
  stroke-width: 2px;
  opacity: 0.5;
  transition: stroke var(--transition-medium), opacity var(--transition-medium);
  filter: url(#shadow);
}

.connection-path.highlighted {
  stroke: var(--brand-violet);
  stroke-width: 3.5px;
  opacity: 0.95;
  animation: line-pulse 2s infinite;
}

@keyframes line-pulse {
  0% { stroke-width: 3.5px; }
  50% { stroke-width: 4.5px; }
  100% { stroke-width: 3.5px; }
}

/* Node Styling */
.chart-node {
  position: absolute;
  width: 260px;
  border-radius: 12px;
  background: var(--node-bg);
  border: 1px solid var(--node-border);
  box-shadow: var(--node-shadow);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  pointer-events: auto; /* Re-enable click / drags */
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  user-select: none;
}

.chart-node:hover {
  transform: translateY(-2px);
  border-color: var(--brand-cyan);
  box-shadow: 0 15px 30px -10px rgba(6, 182, 212, 0.25), var(--node-shadow);
}

.chart-node.selected {
  border: 2px solid var(--brand-violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), var(--node-shadow);
}

.chart-node.highlighted {
  border: 2.5px solid var(--brand-cyan);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.4), var(--node-shadow);
}

/* Top border color indicator */
.node-color-tag {
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 4px;
  border-bottom-left-radius: 3px;
  border-bottom-right-radius: 3px;
  background: var(--brand-cyan);
}

/* Card main content row */
.node-card-body {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.node-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.node-info-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

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

.node-designation {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.node-department {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Bottom status bar */
.node-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  padding-top: 6px;
}

.node-emp-id {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Status Pill Badge */
.node-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.node-status-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.status-active-badge {
  background: rgba(16, 185, 129, 0.1);
  color: var(--status-active);
}
.status-active-badge::before {
  background: var(--status-active);
  box-shadow: 0 0 6px var(--status-active);
  animation: badge-pulse 1.5s infinite;
}

.status-vacant-badge {
  background: rgba(148, 163, 184, 0.1);
  color: var(--status-vacant);
  border: 1px dashed rgba(148, 163, 184, 0.3);
}
.status-vacant-badge::before { background: var(--status-vacant); }

.status-temporary-badge {
  background: rgba(245, 158, 11, 0.1);
  color: var(--status-temporary);
}
.status-temporary-badge::before { background: var(--status-temporary); }

.status-new_hire-badge {
  background: rgba(59, 130, 246, 0.1);
  color: var(--status-new-hire);
}
.status-new_hire-badge::before { background: var(--status-new-hire); }

.status-retired-badge {
  background: rgba(239, 110, 110, 0.1);
  color: var(--status-retired);
}
.status-retired-badge::before { background: var(--status-retired); }

@keyframes badge-pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Collapse branch handle indicator */
.node-collapse-handle {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  z-index: 5;
  transition: all var(--transition-fast);
}

.node-collapse-handle:hover {
  color: var(--text-primary);
  border-color: var(--brand-cyan);
  transform: translateX(-50%) scale(1.1);
}

.chart-node.collapsed .node-collapse-handle {
  background: var(--brand-cyan);
  color: #000000;
  border-color: var(--brand-cyan);
}

/* Sidebar Editor Styles */
.sidebar-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: 360px;
  border-radius: 16px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition-medium);
}

.sidebar-panel.hidden {
  transform: translateX(calc(100% + 40px));
}

.sidebar-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}

.btn-close:hover {
  color: var(--text-primary);
}

.sidebar-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Photo Editor UI */
.photo-editor-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.profile-photo-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 2.5px solid var(--glass-border);
  cursor: pointer;
}

.profile-photo-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-upload-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  color: #ffffff;
  font-size: 10px;
}

.profile-photo-wrapper:hover .photo-upload-overlay {
  opacity: 1;
}

#input-upload-photo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.btn-secondary-danger {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--status-retired);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--status-retired);
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group textarea {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.styled-select-form {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  width: 100%;
}

.styled-select-form:focus {
  border-color: var(--brand-cyan);
}

.form-group input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 100%;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  background: none;
}

.form-group input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.form-group input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--glass-border);
  border-radius: 8px;
}

/* Color Picker Grid */
.color-picker-grid {
  display: flex;
  gap: 10px;
  padding: 4px 0;
}

.color-option-container {
  position: relative;
  cursor: pointer;
}

.color-option-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.color-dot {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.color-option-container input:checked + .color-dot {
  border-color: #ffffff;
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.sidebar-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.btn-primary-large {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-violet));
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-align: center;
}

.btn-primary-large:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.3);
}

.btn-secondary-danger-large {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--status-retired);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-secondary-danger-large:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--status-retired);
}

/* Context Menu */
.context-menu {
  position: absolute;
  z-index: 100;
  width: 220px;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  font-weight: 500;
}

.context-menu.hidden {
  display: none !important;
}

.context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.context-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.context-item.text-danger:hover {
  color: var(--status-retired);
  background: rgba(239, 68, 68, 0.1);
}

.context-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 4px 6px;
}

/* Modals Overlay & Content */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: opacity var(--transition-medium);
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-container {
  width: 100%;
  max-width: 440px;
  border-radius: 16px;
  overflow: hidden;
  animation: modal-enter var(--transition-medium) forwards;
}

@keyframes modal-enter {
  0% { transform: translateY(20px) scale(0.95); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.1);
}

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

.creator-avatar-container {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 16px;
  border: 3px solid var(--brand-violet);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.creator-avatar-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creator-name {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.creator-role {
  font-size: 12px;
  color: var(--brand-cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.creator-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 18px;
}

.creator-contact-info {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  text-align: left;
}

.contact-item-row {
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.contact-item-row:last-child {
  margin-bottom: 0;
}

.contact-item-row strong {
  color: var(--text-secondary);
}

.contact-item-row a {
  color: var(--brand-cyan);
  text-decoration: none;
}

.contact-item-row a:hover {
  text-decoration: underline;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-left: 4px solid var(--brand-cyan);
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-enter 0.3s forwards;
  min-width: 240px;
}

@keyframes toast-enter {
  0% { transform: translateY(10px) opacity: 0; }
  100% { transform: translateY(0) opacity: 1; }
}

.toast.success { border-left-color: var(--status-active); }
.toast.error { border-left-color: var(--status-retired); }
.toast.info { border-left-color: var(--brand-cyan); }
.toast.warning { border-left-color: var(--status-temporary); }

/* Google sheets details */
.info-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.sheets-actions-info {
  margin-top: 12px;
}

.status-indicator-sync {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.status-dot-sync {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-dot-sync.idle { background: var(--text-muted); }
.status-dot-sync.syncing { 
  background: var(--brand-cyan); 
  animation: sync-pulse 1s infinite;
}
.status-dot-sync.success { background: var(--status-active); }
.status-dot-sync.error { background: var(--status-retired); }

@keyframes sync-pulse {
  0% { transform: scale(0.9); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.5; }
}

.export-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

/* Printable Overlay override */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
    height: auto !important;
    width: auto !important;
  }

  .ambient-glow,
  #main-header,
  #toolbar-floating,
  .sidebar-panel,
  .context-menu,
  .modal-overlay,
  #toast-container,
  #grid-overlay,
  .node-collapse-handle {
    display: none !important;
  }

  #app-workspace {
    position: static !important;
    display: block !important;
    overflow: visible !important;
    height: auto !important;
  }

  #canvas-container {
    position: static !important;
    overflow: visible !important;
    width: 100% !important;
    height: auto !important;
    background: transparent !important;
  }

  #chart-canvas {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
  }

  .chart-node {
    box-shadow: none !important;
    border: 1.5px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-inside: avoid;
  }

  .node-name,
  .node-designation,
  .node-department {
    color: #000000 !important;
  }

  .connection-path {
    stroke: #000000 !important;
    stroke-width: 1.5px !important;
    filter: none !important;
    opacity: 1 !important;
  }
}

/* Empty state styling */
.empty-workspace-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  padding: 40px;
  border-radius: 16px;
  max-width: 440px;
  pointer-events: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.empty-state-icon {
  font-size: 48px;
  color: var(--brand-cyan);
  margin-bottom: 16px;
  animation: pulse-icon 2s infinite ease-in-out;
}

@keyframes pulse-icon {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

.empty-workspace-state h3 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-workspace-state p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}
