/* Workflow Dashboard Styles - Scoped to #workflow-view */

/* ============================================================================
   DATA FLOW TOGGLE SWITCH
   ============================================================================ */

.wf-toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

/* Visually hidden but still toggled by <label> (display:none can break first click in some browsers) */
.wf-toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.wf-toggle-slider {
  width: 46px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 12px;
  position: relative;
  transition: background 0.3s ease;
}

.wf-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.wf-toggle-switch input:checked + .wf-toggle-slider {
  background: #4caf50;
}

.wf-toggle-switch input:checked + .wf-toggle-slider::before {
  transform: translateX(22px);
}

.wf-toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
}

.wf-toggle-switch input:checked ~ .wf-toggle-label {
  color: #4caf50;
}

#workflow-view .wf-view-sort-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#workflow-view .wf-view-sort-control select {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  padding: 6px 10px;
}

#workflow-view .wf-role-selection-control {
  display: none;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
}

#workflow-view .wf-role-reset-btn {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  line-height: 1;
  cursor: pointer;
}

#workflow-view .wf-role-reset-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
}

#workflow-view .wf-role-reset-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

#workflow-view .wf-role-view-container {
  width: 100%;
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

#workflow-view .wf-role-group {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fefefe 0%, #f8fafc 100%);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

#workflow-view .wf-role-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e3a8a;
  border-bottom: 1px solid rgba(30, 58, 138, 0.15);
  cursor: pointer;
  transition: filter 0.18s ease;
}

#workflow-view .wf-role-group-header:hover {
  filter: brightness(0.97);
}

#workflow-view .wf-role-group-header:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

#workflow-view .wf-role-group.is-selected .wf-role-group-header {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #14532d;
  border-bottom-color: rgba(20, 83, 45, 0.2);
}

#workflow-view .wf-role-group.is-dimmed {
  opacity: 0.35;
  transition: opacity 0.2s ease;
}
#workflow-view .wf-role-group.is-dimmed:hover {
  opacity: 0.65;
}

#workflow-view .wf-role-group-header h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin: 0;
}

#workflow-view .wf-role-group-header .wf-role-count {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0.8;
}

#workflow-view .wf-role-group-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 10px;
}

/* ============================================================================
   INTERACTIVE FLOW CONNECTIONS - QuickBooks-style connected workflow
   ============================================================================ */

/* SVG Canvas for connection lines */
#workflow-view .wf-flow-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  overflow: visible;
}

#workflow-view .wf-flow-canvas path {
  fill: none;
  stroke: #cbd5e1;
  stroke-width: 1.5;
  stroke-dasharray: 6, 6;
  opacity: 0.25;
  transition: all 0.4s ease;
}

#workflow-view .wf-flow-canvas path.active {
  stroke: #81c784;
  stroke-width: 2;
  opacity: 0.6;
  stroke-dasharray: none;
}

/* Animated flow dots */
#workflow-view .wf-flow-dot {
  fill: #81c784;
  opacity: 0;
  transition: opacity 0.4s;
}

#workflow-view .wf-flow-dot.active {
  opacity: 0.7;
  animation: flowPulse 4s ease-in-out infinite;
}

@keyframes flowPulse {
  0%,
  100% {
    r: 3;
    opacity: 0.5;
  }
  50% {
    r: 5;
    opacity: 0.8;
  }
}

/* Flow animation along path */
@keyframes flowAlongPath {
  0% {
    offset-distance: 0%;
    opacity: 0;
  }
  15% {
    opacity: 0.4;
  }
  85% {
    opacity: 0.4;
  }
  100% {
    offset-distance: 100%;
    opacity: 0;
  }
}

#workflow-view .wf-animated-dot {
  width: 5px;
  height: 5px;
  background: #81c784;
  border-radius: 50%;
  position: absolute;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 4px rgba(129, 199, 132, 0.3);
}

#workflow-view .wf-animated-dot.flowing {
  animation: flowAlongPath 3.5s ease-in-out infinite;
}

/* Connection indicators on items */
#workflow-view .wf-workflow-item[data-connects]::before {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #66bb6a;
  border-radius: 50%;
  opacity: 0;
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 10;
}

#workflow-view .wf-workflow-item[data-connects]:hover::before,
#workflow-view .wf-workflow-item.connected::before {
  opacity: 0.6;
  animation: connectionPulse 3s ease-in-out infinite;
}

@keyframes connectionPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(129, 199, 132, 0.3);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(129, 199, 132, 0);
  }
}

/* Connected highlight state */
#workflow-view .wf-workflow-item.connected {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%) !important;
  box-shadow:
    0 0 0 1px #a5d6a7,
    0 2px 8px rgba(102, 187, 106, 0.15);
  transform: translateY(-2px);
  z-index: 20;
}

#workflow-view .wf-workflow-item.connected .wf-icon-wrapper {
  box-shadow: 0 2px 8px rgba(102, 187, 106, 0.2);
}

/* Dimmed state for non-connected items during hover */
#workflow-view.showing-connections .wf-workflow-item:not(.connected):not(:hover) {
  opacity: 0.6;
  filter: grayscale(0.2);
}

#workflow-view.showing-connections .wf-panel-item:not(.connected) {
  opacity: 0.6;
  filter: grayscale(0.5);
}

/* Cross-lane connector glow effect */
#workflow-view .wf-cross-connector {
  position: absolute;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #e3f2fd 0%, #42a5f5 100%);
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(66, 165, 245, 0.4);
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#workflow-view .wf-cross-connector.visible {
  opacity: 1;
  animation: connectorPulse 2s ease-in-out infinite;
}

@keyframes connectorPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
}

/* Flow legend */
#workflow-view .wf-flow-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 11px;
  color: #666;
}

#workflow-view .wf-flow-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

#workflow-view .wf-flow-legend-line {
  width: 24px;
  height: 2px;
  background: #81c784;
  border-radius: 1px;
}

#workflow-view .wf-flow-legend-line.data {
  background: #42a5f5;
  position: relative;
}

#workflow-view .wf-flow-legend-line.data::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid #42a5f5;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}

#workflow-view .wf-flow-legend-line.money {
  background: #66bb6a;
}
#workflow-view .wf-flow-legend-line.approval {
  background: #ffca28;
}

/* ============================================================================
   END FLOW CONNECTIONS
   ============================================================================ */

/* Workflow Section Container */
#workflow-view .wf-container {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  gap: 16px;
  max-width: 1680px;
  margin: 0 auto;
  position: relative;
  overflow: visible; /* Allow SVG canvas to render cross-panel connections */
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

/* SVG Canvas for cross-panel connections - positioned in container */
#workflow-view .wf-container > #wf-flow-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10; /* Above panels but below modals */
  overflow: visible;
}

/* Quick Stats */
#workflow-view .wf-quick-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin: 0 0 20px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

#workflow-view .wf-stat-card {
  flex: 1;
  background: white;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
}

#workflow-view .wf-stat-card:hover,
#workflow-view .wf-stat-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  outline: 2px solid rgba(21, 101, 192, 0.25);
  outline-offset: 2px;
}

#workflow-view .wf-stat-card .value {
  font-size: 20px;
  font-weight: 700;
  color: #43a047;
  letter-spacing: -0.5px;
}

#workflow-view .wf-stat-card .label {
  font-size: 10px;
  color: #546e7a;
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

#workflow-view .wf-stat-card.success .value {
  color: #43a047;
}
#workflow-view .wf-stat-card.warning .value {
  color: #fb8c00;
}
#workflow-view .wf-stat-card.info .value {
  color: #1e88e5;
}

/* Workflow Section */
#workflow-view .wf-workflow-section {
  flex: 1;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: visible;
  border: 1px solid #e2e8f0;
}

/* Swim Lanes */
#workflow-view .wf-swim-lane {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  min-height: 50px;
}

#workflow-view .wf-swim-lane:last-child {
  border-bottom: none;
}

#workflow-view .wf-lane-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  color: white;
  padding: 12px 10px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
}

#workflow-view .wf-lane-label.contracts {
  background: linear-gradient(180deg, #8ebdd8 0%, #7cafc8 100%);
}
#workflow-view .wf-lane-label.operations {
  background: linear-gradient(180deg, #9ac4a0 0%, #88b890 100%);
}
#workflow-view .wf-lane-label.settlements {
  background: linear-gradient(180deg, #a8c8dc 0%, #8ebdd8 100%);
}
#workflow-view .wf-lane-label.compliance {
  background: linear-gradient(180deg, #b0d0b5 0%, #9ac4a0 100%);
}
#workflow-view .wf-lane-label.enterprise {
  background: linear-gradient(180deg, #b8a8d0 0%, #a698c0 100%);
}
#workflow-view .wf-lane-label.workforce {
  background: linear-gradient(180deg, #a898b8 0%, #9888a8 100%);
}

#workflow-view .wf-lane-content {
  flex: 1;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  background: linear-gradient(180deg, #fefefe 0%, #f8fafc 100%);
}

/* One flex row per logical row — avoids grid “holes” from mixed row lengths */
#workflow-view .wf-workflow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-evenly;
}

#workflow-view .wf-workflow-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 10px;
  position: relative;
}

#workflow-view .wf-workflow-item:hover {
  background: linear-gradient(135deg, #eef4f8 0%, #e0ebf2 100%);
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(100, 130, 160, 0.15);
}

#workflow-view .wf-workflow-item.highlight {
  background: linear-gradient(135deg, #f8f6ee 0%, #f0ecdc 100%);
}

#workflow-view .wf-workflow-item .wf-icon-wrapper {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  margin-bottom: 4px;
  position: relative;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

#workflow-view .wf-workflow-item:hover .wf-icon-wrapper {
  transform: scale(1.05);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 6px 20px rgba(0, 0, 0, 0.1);
}

#workflow-view .wf-workflow-item .wf-icon-wrapper i {
  font-size: 16px;
}

/* Icon color schemes - Soft muted meadow palette */
#workflow-view .wf-icon-wrapper.blue {
  background: linear-gradient(145deg, #eef4f8 0%, #dce8f0 100%);
  color: #5c8ab0;
  border: 1px solid #c5d8e8;
}
#workflow-view .wf-icon-wrapper.green {
  background: linear-gradient(145deg, #eef5f0 0%, #dce8df 100%);
  color: #5a8c65;
  border: 1px solid #c5d8c9;
}
#workflow-view .wf-icon-wrapper.orange {
  background: linear-gradient(145deg, #f8f4ee 0%, #f0e8dc 100%);
  color: #b08050;
  border: 1px solid #e0d0bc;
}
#workflow-view .wf-icon-wrapper.purple {
  background: linear-gradient(145deg, #f4eef5 0%, #e8dce9 100%);
  color: #8866a0;
  border: 1px solid #d4c4d8;
}
#workflow-view .wf-icon-wrapper.teal {
  background: linear-gradient(145deg, #edf5f6 0%, #dce9eb 100%);
  color: #4a8890;
  border: 1px solid #c0d8dc;
}
#workflow-view .wf-icon-wrapper.red {
  background: linear-gradient(145deg, #f6edef 0%, #ebd9dd 100%);
  color: #a06070;
  border: 1px solid #d8c0c8;
}
#workflow-view .wf-icon-wrapper.gold {
  background: linear-gradient(145deg, #f8f6ee 0%, #f0ecdc 100%);
  color: #a89050;
  border: 1px solid #e0d8bc;
}
#workflow-view .wf-icon-wrapper.gray {
  background: linear-gradient(145deg, #f2f2f2 0%, #e5e5e5 100%);
  color: #707070;
  border: 1px solid #cacaca;
}

#workflow-view .wf-workflow-item .wf-label {
  font-size: 11px;
  color: #475569;
  text-align: center;
  font-weight: 600;
  line-height: 1.2;
  max-width: 72px;
}

/* Anchor to .wf-icon-wrapper so the pill sits on the icon’s top-right, not the tile center */
#workflow-view .wf-icon-wrapper .wf-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  left: auto;
  bottom: auto;
  z-index: 2;
  background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
  color: white;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 1.5px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

#workflow-view .wf-badge.info {
  background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
}
#workflow-view .wf-badge.warning {
  background: linear-gradient(135deg, #ffca28 0%, #ffc107 100%);
}
#workflow-view .wf-badge.alert {
  background: linear-gradient(135deg, #f48fb1 0%, #ec407a 100%);
}

/* Arrow connectors - hidden */
#workflow-view .wf-arrow {
  display: none;
}

/* Divider */
#workflow-view .wf-lane-divider {
  flex: 0 0 auto;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
  margin: 6px 0;
}

/* ============================================================================
   SIDE PANELS - Pastel Color Theme
   ============================================================================ */

#workflow-view .wf-side-panels.wf-workflow-all-panels {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  align-items: stretch;
}

#workflow-view .wf-side-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* Body tint fills the full card (including stretched row height); avoids a short inner grid fill */
  background: linear-gradient(180deg, #fefefe 0%, #f8fafc 100%);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  overflow: visible;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

#workflow-view .wf-side-panel:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

#workflow-view .wf-panel-header {
  flex-shrink: 0;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px 12px 0 0;
}

#workflow-view .wf-panel-header i {
  font-size: 12px;
  opacity: 0.8;
}

/* Soft muted panel header themes */
#workflow-view .wf-panel-header.company {
  background: linear-gradient(135deg, #eef4f8 0%, #dce8f0 100%);
  color: #5c7a90;
  border-bottom-color: #c5d8e8;
}
#workflow-view .wf-panel-header.banking {
  background: linear-gradient(135deg, #eef5f0 0%, #dce8df 100%);
  color: #5a7560;
  border-bottom-color: #c5d8c9;
}
#workflow-view .wf-panel-header.reports {
  background: linear-gradient(135deg, #edf4f7 0%, #dceaef 100%);
  color: #4a7080;
  border-bottom-color: #c0d8e0;
}
#workflow-view .wf-panel-header.enterprise {
  background: linear-gradient(135deg, #f0edf7 0%, #e0dcef 100%);
  color: #6b5a90;
  border-bottom-color: #c8c0d8;
}

/* Former swim-lane categories — same palette as .wf-lane-label, horizontal headers */
#workflow-view .wf-panel-header.contracts {
  background: linear-gradient(135deg, #8ebdd8 0%, #7cafc8 100%);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.25);
}
#workflow-view .wf-panel-header.operations {
  background: linear-gradient(135deg, #9ac4a0 0%, #88b890 100%);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.25);
}
#workflow-view .wf-panel-header.settlements {
  background: linear-gradient(135deg, #a8c8dc 0%, #8ebdd8 100%);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.25);
}
#workflow-view .wf-panel-header.compliance {
  background: linear-gradient(135deg, #b0d0b5 0%, #9ac4a0 100%);
  color: #1e293b;
  border-bottom-color: rgba(15, 23, 42, 0.12);
}
#workflow-view .wf-panel-header.fleet {
  background: linear-gradient(135deg, #b8a8d0 0%, #a698c0 100%);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.25);
}
#workflow-view .wf-panel-header.land {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.25);
}
#workflow-view .wf-panel-header.workforce {
  background: linear-gradient(135deg, #a898b8 0%, #9888a8 100%);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.25);
}

#workflow-view .wf-panel-grid {
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 10px;
}

#workflow-view .wf-panel-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s ease;
  position: relative;
}

#workflow-view .wf-panel-item:hover {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  transform: translateY(-2px);
}

#workflow-view .wf-panel-item .wf-icon-wrapper {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  margin-bottom: 5px;
  position: relative;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

#workflow-view .wf-panel-item:hover .wf-icon-wrapper {
  transform: scale(1.08);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 6px 20px rgba(0, 0, 0, 0.1);
}

#workflow-view .wf-panel-item .wf-icon-wrapper i {
  font-size: 14px;
}

#workflow-view .wf-panel-item .wf-label {
  font-size: 10px;
  color: #64748b;
  text-align: center;
  font-weight: 600;
  line-height: 1.2;
  max-width: 68px;
}

/* Tooltip - rendered via JS for dynamic positioning */
#workflow-view .wf-tooltip {
  position: fixed;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

#workflow-view .wf-tooltip.visible {
  opacity: 1;
}

#workflow-view .wf-tooltip .wf-tooltip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 6px solid transparent;
}

/* Arrow pointing down (tooltip is above the item) */
#workflow-view .wf-tooltip.pos-top .wf-tooltip-arrow {
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: #334155;
}

/* Arrow pointing up (tooltip is below the item) */
#workflow-view .wf-tooltip.pos-bottom .wf-tooltip-arrow {
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: #1e293b;
}

/* Arrow pointing right (tooltip is to the left) */
#workflow-view .wf-tooltip.pos-left .wf-tooltip-arrow {
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: #334155;
}

/* Arrow pointing left (tooltip is to the right) */
#workflow-view .wf-tooltip.pos-right .wf-tooltip-arrow {
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: #1e293b;
}

/* Workflow Modal */
#workflow-view .wf-modal-overlay,
.wf-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

#workflow-view .wf-modal-overlay.active,
.wf-modal-overlay.active {
  display: flex;
}

#workflow-view .wf-modal,
.wf-modal-overlay .wf-modal {
  background: white;
  border-radius: 20px;
  max-width: 520px;
  width: 92%;
  max-height: 85vh;
  min-height: 0; /* flex child: allow max-height to bind so inner body can scroll */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* scroll lives on .wf-modal-body */
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
  transition:
    max-width 0.3s ease,
    transform 0.3s ease;
  border: 1px solid #e2e8f0;
}

/* Large modal for Report Center */
#workflow-view .wf-modal.wf-modal-large,
.wf-modal-overlay .wf-modal.wf-modal-large {
  max-width: 920px;
}

#workflow-view .wf-modal-header,
.wf-modal-overlay .wf-modal-header {
  flex-shrink: 0;
  padding: 22px 28px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 20px 20px 0 0;
}

#workflow-view .wf-modal-header h2,
.wf-modal-overlay .wf-modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.3px;
}

#workflow-view .wf-modal-close,
.wf-modal-overlay .wf-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#workflow-view .wf-modal-close:hover,
.wf-modal-overlay .wf-modal-close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

#workflow-view .wf-modal-body,
.wf-modal-overlay .wf-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  padding: 28px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* Let two-column grids shrink; default grid min-width:auto clips the right column */
}

.wf-modal-overlay .wf-modal-body .form-group {
  min-width: 0;
}

.wf-modal-overlay .wf-modal-body .form-input,
.wf-modal-overlay .wf-modal-body select.form-input,
.wf-modal-overlay .wf-modal-body textarea.form-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* WebKit/macOS: async repopulation of <option> lists can leave native select chrome
   drawing as a menu-item chip; strip native appearance so all modal selects match. */
.wf-modal-overlay .wf-modal-body select.form-input {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--gray-50, #f9fafb);
  color: var(--gray-900, #111827);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gray-700, #374151) 50%),
    linear-gradient(135deg, var(--gray-700, #374151) 50%, transparent 50%);
  background-position:
    calc(100% - 10px) 50%,
    calc(100% - 6px) 50%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

#workflow-view .wf-modal-body p,
.wf-modal-overlay .wf-modal-body p {
  color: #64748b;
  line-height: 1.7;
  margin-bottom: 18px;
  font-size: 14px;
}

#workflow-view .wf-modal-actions,
.wf-modal-overlay .wf-modal-actions {
  display: flex;
  gap: 14px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* Keep footer actions reachable on tall forms (scroll body; bar stays at bottom of viewport). */
#workflow-view .wf-modal-body .wf-modal-actions,
.wf-modal-overlay .wf-modal-body .wf-modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 20px;
  padding-top: 16px;
  padding-bottom: 4px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #fff 14px, #fff 100%);
  border-top: 1px solid #e2e8f0;
}

#workflow-view .wf-btn,
.wf-modal-overlay .wf-btn {
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.2px;
}

#workflow-view .wf-btn i,
.wf-modal-overlay .wf-btn i {
  font-size: 14px;
}

#workflow-view .wf-btn-primary,
.wf-modal-overlay .wf-btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

#workflow-view .wf-btn-primary:hover,
.wf-modal-overlay .wf-btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

#workflow-view .wf-btn-secondary,
.wf-modal-overlay .wf-btn-secondary {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: #475569;
  border: 1px solid #e2e8f0;
}

#workflow-view .wf-btn-secondary:hover,
.wf-modal-overlay .wf-btn-secondary:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-color: #cbd5e1;
}

#workflow-view .wf-btn-success,
.wf-modal-overlay .wf-btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

#workflow-view .wf-btn-success:hover,
.wf-modal-overlay .wf-btn-success:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  transform: translateY(-2px);
}

#workflow-view .wf-btn-warning,
.wf-modal-overlay .wf-btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

/* Status Bar */
#workflow-view .wf-status-bar {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #94a3b8;
  padding: 12px 18px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 0 0;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

#workflow-view .wf-status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

#workflow-view .wf-status-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

#workflow-view .wf-status-item .dot.warning {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}
#workflow-view .wf-status-item .dot.error {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 1200px) {
  #workflow-view .wf-container {
    padding: 12px 14px;
  }
  #workflow-view .wf-side-panels.wf-workflow-all-panels {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
  #workflow-view .wf-side-panel {
    min-width: 0;
  }
  #workflow-view .wf-quick-stats {
    margin: 0 0 16px 0;
    padding: 12px 14px;
  }
  #workflow-view .wf-status-bar {
    margin: 20px 0 0 0;
    padding: 12px 14px;
  }
}

@media (max-width: 768px) {
  #workflow-view .wf-quick-stats {
    flex-wrap: wrap;
    gap: 8px;
  }
  #workflow-view .wf-stat-card {
    min-width: 100px;
    flex: 1 1 100px;
  }
  #workflow-view .wf-side-panel {
    min-width: 100%;
  }
  #workflow-view .wf-workflow-item .wf-icon-wrapper {
    width: 32px;
    height: 32px;
  }
  #workflow-view .wf-workflow-item .wf-icon-wrapper i {
    font-size: 14px;
  }
  #workflow-view .wf-modal,
  .wf-modal-overlay .wf-modal {
    width: 95%;
    border-radius: 12px;
  }
  #workflow-view .wf-modal-body,
  .wf-modal-overlay .wf-modal-body {
    padding: 16px;
  }
}

/* ============================================================================
   DESKTOP — denser tiles in unified panel grid
   ============================================================================ */
@media (min-width: 1024px) {
  #workflow-view .view-header {
    margin-bottom: var(--spacing-md);
  }
  #workflow-view .view-header h2 {
    font-size: 1.5rem;
  }
  #workflow-view .view-subtitle {
    margin-top: 2px;
    font-size: 0.8125rem;
  }

  #workflow-view .wf-quick-stats {
    margin: 0 0 10px 0;
    padding: 8px 12px;
    gap: 8px;
  }
  #workflow-view .wf-stat-card {
    padding: 6px 10px;
  }
  #workflow-view .wf-stat-card .value {
    font-size: 1.1rem;
  }
  #workflow-view .wf-stat-card .label {
    font-size: 9px;
    margin-top: 2px;
  }

  #workflow-view .wf-container {
    padding: 8px 12px 10px;
  }

  #workflow-view .wf-side-panels.wf-workflow-all-panels {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
  }

  #workflow-view .wf-panel-header {
    padding: 6px 8px;
    font-size: 10px;
  }
  #workflow-view .wf-panel-grid {
    padding: 6px;
    gap: 4px;
  }
  #workflow-view .wf-panel-item {
    padding: 4px 4px;
  }
  #workflow-view .wf-panel-item .wf-icon-wrapper {
    width: 28px;
    height: 28px;
    margin-bottom: 2px;
  }
  #workflow-view .wf-panel-item .wf-icon-wrapper i {
    font-size: 12px;
  }

  #workflow-view .wf-status-bar {
    margin-top: 8px;
    padding: 8px 12px;
  }
}

/* ============================================================================
   ENTERPRISE REPORT CENTER - QuickBooks-level reporting
   ============================================================================ */

/* Report Center Container */
.wf-report-center {
  max-height: 70vh;
  overflow-y: auto;
}

/* Report Center Header */
.wf-rc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e8f0;
}

.wf-rc-search {
  flex: 1;
  max-width: 340px;
  position: relative;
}

.wf-rc-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}

.wf-rc-search input {
  width: 100%;
  padding: 12px 120px 12px 40px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: #f8fafc;
}

.wf-rc-enter-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #cbd5e1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.wf-rc-search input:focus + .wf-rc-enter-hint {
  opacity: 1;
}

.wf-rc-search input:focus:not(:focus-visible) {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  background: white;
}

.wf-rc-actions {
  display: flex;
  gap: 10px;
}

.wf-rc-actions .wf-btn {
  padding: 10px 14px;
  font-size: 12px;
}

/* Quick Stats Row */
.wf-rc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.wf-rc-stat {
  background: linear-gradient(145deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  transition: all 0.2s ease;
}

.wf-rc-stat:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.wf-rc-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #3b82f6;
}

.wf-rc-stat-label {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  font-weight: 500;
}

/* Recently Run Section */
.wf-rc-section {
  margin-bottom: 24px;
}

.wf-rc-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.wf-rc-section-header h4 {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wf-rc-section-header a {
  font-size: 12px;
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
}

.wf-rc-section-header a:hover {
  text-decoration: underline;
}

.wf-rc-recent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.wf-rc-recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.wf-rc-recent-item:hover {
  background: linear-gradient(145deg, #eff6ff 0%, #dbeafe 100%);
  transform: translateY(-2px);
  border-color: #bfdbfe;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.wf-rc-recent-item i {
  font-size: 20px;
  color: #3b82f6;
}

.wf-rc-recent-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.wf-rc-recent-date {
  font-size: 11px;
  color: #94a3b8;
}

/* Report Categories */
.wf-rc-categories {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wf-rc-category {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.wf-rc-category:hover {
  border-color: #cbd5e1;
}

.wf-rc-category-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
  cursor: pointer;
  transition: all 0.2s ease;
}

.wf-rc-category-header:hover {
  background: linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 100%);
}

.wf-rc-category-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.wf-rc-category-icon i {
  font-size: 18px;
}

.wf-rc-category-info {
  flex: 1;
}

.wf-rc-category-info h5 {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.wf-rc-category-info span {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.wf-rc-chevron {
  color: #94a3b8;
  transition: transform 0.2s;
}

.wf-rc-category.expanded .wf-rc-chevron {
  transform: rotate(180deg);
}

/* Report List within Category */
.wf-rc-category-reports {
  display: none;
  border-top: 1px solid #e2e8f0;
  background: white;
}

.wf-rc-category.expanded .wf-rc-category-reports {
  display: block;
}

.wf-rc-report {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 14px 76px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wf-rc-report:last-child {
  border-bottom: none;
}

.wf-rc-report:hover {
  background: linear-gradient(90deg, #eff6ff 0%, transparent 100%);
}

.wf-rc-report-info {
  flex: 1;
}

.wf-rc-report-name {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.wf-rc-report-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
}

.wf-rc-report-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.wf-rc-report:hover .wf-rc-report-actions {
  opacity: 1;
}

.wf-rc-report-actions button {
  background: none;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
}

.wf-rc-report-actions button:hover {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #2563eb;
}

/* Report Preview */
.wf-report-preview {
  max-height: 65vh;
  overflow-y: auto;
}

.wf-rp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 18px;
}

.wf-rp-actions {
  display: flex;
  gap: 10px;
}

.wf-rp-actions .wf-btn {
  padding: 8px 14px;
  font-size: 12px;
}

.wf-rp-filters {
  display: flex;
  gap: 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.wf-rp-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wf-rp-filter-group label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.wf-rp-filter-group select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.wf-rp-filter-group select:focus:not(:focus-visible) {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Summary Cards */
.wf-rp-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.wf-rp-card {
  background: linear-gradient(145deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.wf-rp-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.wf-rp-card-value {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

.wf-rp-card-label {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  font-weight: 500;
}

.wf-rp-card-trend {
  font-size: 11px;
  margin-top: 6px;
  font-weight: 600;
}

.wf-rp-card-trend.up {
  color: #16a34a;
}
.wf-rp-card-trend.down {
  color: #dc2626;
}
.wf-rp-card-trend.neutral {
  color: #94a3b8;
}

/* Chart Placeholder */
.wf-rp-chart-placeholder {
  background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  height: 150px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border: 1px solid #e2e8f0;
}

.wf-rp-chart-bars {
  display: flex;
  gap: 8px;
  height: 100%;
  align-items: flex-end;
  width: 100%;
  justify-content: space-around;
}

.wf-rp-bar {
  background: linear-gradient(180deg, #93c5fd 0%, #3b82f6 100%);
  width: 26px;
  border-radius: 6px 6px 0 0;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 0 -2px 8px rgba(59, 130, 246, 0.2);
}

.wf-rp-bar.active {
  background: linear-gradient(180deg, #4caf50 0%, #2e7d32 100%);
}

.wf-rp-bar:hover {
  opacity: 0.8;
  transform: scaleY(1.05);
  transform-origin: bottom;
}

.wf-rp-bar span {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #666;
}

/* Report Table */
.wf-rp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border-radius: 10px;
  overflow: hidden;
}

.wf-rp-table th,
.wf-rp-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.wf-rp-table th {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  font-weight: 600;
  color: #475569;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wf-rp-table tbody tr:hover {
  background: #f8fafc;
}

.wf-rp-table td:nth-child(n + 2) {
  text-align: right;
}

.wf-rp-table th:nth-child(n + 2) {
  text-align: right;
}

/* Scheduled Reports */
.wf-scheduled-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wf-scheduled-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.wf-scheduled-item:hover {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #bfdbfe;
  transform: translateX(4px);
}

.wf-scheduled-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.wf-scheduled-schedule {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 12px;
}

.wf-scheduled-actions {
  display: flex;
  gap: 6px;
}

.wf-scheduled-actions button {
  background: white;
  border: 1px solid #e2e8f0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wf-scheduled-actions button:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #93c5fd;
  color: #1d4ed8;
}

/* Form Groups */
.wf-form-group {
  margin-bottom: 18px;
}

.wf-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.wf-form-group select,
.wf-form-group input[type='text'] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  background: white;
  transition: all 0.2s ease;
}

.wf-form-group select:focus:not(:focus-visible),
.wf-form-group input[type='text']:focus:not(:focus-visible) {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.wf-form-group select:hover,
.wf-form-group input[type='text']:hover {
  border-color: #9ca3af;
}

/* Status Badges */
.wf-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.wf-status-success {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #15803d;
}

.wf-status-pending {
  background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
  color: #c2410c;
}

.wf-status-error {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #dc2626;
}

.wf-status-info {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1d4ed8;
}

/* Toast Notifications */
.wf-toast {
  position: fixed;
  top: 28px;
  right: 28px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 14px 22px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  backdrop-filter: blur(8px);
}

.wf-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.wf-toast-success {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.wf-toast-error {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.wf-toast-info {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.wf-toast-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Report Center Responsive */
@media (max-width: 768px) {
  .wf-rc-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .wf-rc-recent-grid {
    grid-template-columns: 1fr;
  }

  .wf-rp-summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .wf-rc-header {
    flex-direction: column;
    align-items: stretch;
  }

  .wf-rc-search {
    max-width: none;
  }
}

/* ================================================
   INTEGRATIONS HUB
   ================================================ */

.int-connector-card {
  /* Use tokens (not plain white) so dark theme inverted grays match card text */
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  color: var(--gray-800);
  transition:
    box-shadow 0.2s,
    border-color 0.2s;
}
.int-connector-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.int-connector-card.connected {
  border-left: 4px solid #10b981;
}
.int-connector-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.int-connector-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.int-connector-info {
  flex: 1;
}
.int-connector-info h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}
.int-connector-info p {
  margin: 0;
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.4;
}
.int-connector-status {
  flex-shrink: 0;
}
.int-connector-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.int-feature-tag {
  background: var(--gray-100);
  color: var(--gray-600);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.int-data-flows {
  /* Slightly deeper than card surface in both themes */
  background: var(--gray-100);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--gray-200);
}
.int-data-flows h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.int-flow-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
}
.int-flow-row + .int-flow-row {
  border-top: 1px solid var(--gray-200);
}
.int-flow-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.int-flow-icon.push {
  background: #dbeafe;
  color: #1d4ed8;
}
.int-flow-icon.pull {
  background: #d1fae5;
  color: #059669;
}
.int-flow-icon.bidirectional {
  background: #fef3c7;
  color: #d97706;
}
.int-flow-label {
  flex: 1;
  color: var(--gray-700);
}
.int-flow-count {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 500;
}
.int-sync-info {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--gray-700);
  margin-bottom: 16px;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 6px;
}
.int-sync-info i {
  margin-right: 4px;
}
.int-error-count {
  color: #dc2626;
  font-weight: 600;
}
.int-connector-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.int-disconnect-btn {
  color: #dc2626 !important;
  border-color: #fecaca !important;
}
.int-disconnect-btn:hover {
  background: #fef2f2 !important;
}

/* Health banner (status strip above connector cards) */
.int-health-banner {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.int-health-banner__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.int-health-banner__title i {
  flex-shrink: 0;
}
.int-health-banner__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.int-health-stats {
  opacity: 0.92;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.int-health-banner--unknown {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
}
.int-health-banner--live {
  background: #ecfdf5;
  border: 1px solid #86efac;
  color: #065f46;
}
.int-health-banner--stale {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}
.int-health-banner--error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

#integrations-view > .view-header {
  flex-wrap: wrap;
  gap: var(--spacing-md, 16px);
  align-items: flex-start;
}
#integrations-view > .view-header .u-flex-row-center {
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Alert Rules ────────────────────────────────── */
.int-rule-category {
  margin-bottom: 20px;
}
.int-rule-cat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  margin: 0 0 8px;
}
.int-rule-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  margin-bottom: 6px;
}
.int-rule-row:hover {
  border-color: #a5b4fc;
}
.int-rule-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--gray-700);
}
.int-rule-label {
  flex: 1;
}
.int-rule-channels {
  display: flex;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--gray-500);
}
.int-rule-channels label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.int-rule-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.int-rule-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.int-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--gray-300);
  border-radius: 20px;
  transition: background 0.2s;
}
.int-toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.int-rule-toggle input:checked + .int-toggle-slider {
  background: #6366f1;
}
.int-rule-toggle input:checked + .int-toggle-slider::before {
  transform: translateX(16px);
}

@media (max-width: 768px) {
  #integrations-view > .view-header .u-flex-row-center {
    width: 100%;
    justify-content: flex-start;
  }
  .int-connector-header {
    flex-direction: column;
  }
  .int-connector-actions {
    flex-direction: column;
  }
  .int-connector-actions button {
    width: 100%;
  }
  .int-sync-info {
    flex-direction: column;
    gap: 6px;
  }
  .int-health-banner__meta {
    width: 100%;
    justify-content: flex-start;
  }
  .int-health-stats {
    width: 100%;
  }
  .int-rule-row {
    flex-wrap: wrap;
  }
}

/* ── Sidebar role filter (applied when a role is isolated in Workflow Center) ── */
#sidebar-nav .sidebar-group {
  transition:
    opacity 0.25s ease,
    filter 0.25s ease;
}
#sidebar-nav .sidebar-group.wf-role-dimmed {
  opacity: 0.22;
  filter: grayscale(0.55);
  pointer-events: none;
}
#sidebar-nav .sidebar-group.wf-role-relevant {
  opacity: 1;
  filter: none;
}
